html_edit_template.tpl 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>{{i18n .Lang "doc.edit_doc"}} - Powered by MinDoc</title>
  8. <style type="text/css">
  9. .w-e-menu.selected > i {
  10. color: #44B036 !important;
  11. }
  12. </style>
  13. <script type="text/javascript">
  14. window.IS_ENABLE_IFRAME = '{{conf "enable_iframe" }}' === 'true';
  15. window.BASE_URL = '{{urlfor "HomeController.Index" }}';
  16. </script>
  17. <script type="text/javascript">
  18. window.editor = null;
  19. window.imageUploadURL = "{{urlfor "DocumentController.Upload" "identify" .Model.Identify}}";
  20. window.fileUploadURL = "{{urlfor "DocumentController.Upload" "identify" .Model.Identify}}";
  21. window.documentCategory = {{.Result}};
  22. window.book = {{.ModelResult}};
  23. window.selectNode = null;
  24. window.deleteURL = "{{urlfor "DocumentController.Delete" ":key" .Model.Identify}}";
  25. window.editURL = "{{urlfor "DocumentController.Content" ":key" .Model.Identify ":id" ""}}";
  26. window.releaseURL = "{{urlfor "BookController.Release" ":key" .Model.Identify}}";
  27. window.sortURL = "{{urlfor "BookController.SaveSort" ":key" .Model.Identify}}";
  28. window.baiduMapKey = "{{.BaiDuMapKey}}";
  29. window.historyURL = "{{urlfor "DocumentController.History"}}";
  30. window.removeAttachURL = "{{urlfor "DocumentController.RemoveAttachment"}}";
  31. window.vueApp = null;
  32. window.lang = {{i18n $.Lang "common.js_lang"}};
  33. </script>
  34. <!-- Bootstrap -->
  35. <link href="{{cdncss "/static/bootstrap/css/bootstrap.min.css"}}" rel="stylesheet">
  36. <link href="{{cdncss "/static/font-awesome/css/font-awesome.min.css"}}" rel="stylesheet">
  37. <link href="{{cdncss "/static/jstree/3.3.4/themes/default/style.min.css"}}" rel="stylesheet">
  38. <!-- <link href="{{cdncss "/static/wangEditor/css/wangEditor.min.css"}}" rel="stylesheet"> -->
  39. <link href="{{cdncss (print "/static/editor.md/lib/highlight/styles/" .HighlightStyle ".css") "version"}}" rel="stylesheet">
  40. <link href="{{cdncss "/static/webuploader/webuploader.css"}}" rel="stylesheet">
  41. <link href="{{cdncss "/static/css/jstree.css"}}" rel="stylesheet">
  42. <link href="{{cdncss "/static/css/markdown.css"}}" rel="stylesheet">
  43. <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
  44. <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  45. <!--[if lt IE 9]>
  46. <script src="/static/html5shiv/3.7.3/html5shiv.min.js"></script>
  47. <script src="/static/respond.js/1.4.2/respond.min.js"></script>
  48. <![endif]-->
  49. </head>
  50. <body>
  51. <div class="m-manual manual-editor">
  52. <!--{{/*<div class="manual-head" id="editormd-tools">
  53. <div class="editormd-group">
  54. <a href="{{urlfor "BookController.Dashboard" ":key" .Model.Identify}}" data-toggle="tooltip" data-title="{{i18n .Lang "doc.backward"}}"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
  55. </div>
  56. <div class="editormd-group">
  57. <a href="javascript:;" id="markdown-save" data-toggle="tooltip" data-title="{{i18n .Lang "doc.save"}}" class="disabled save"><i class="fa fa-save" aria-hidden="true" name="save"></i></a>
  58. </div>
  59. <div class="editormd-group">
  60. <a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.modify_history"}}"><i class="fa fa-history item" name="history" aria-hidden="true"></i></a>
  61. <a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.sidebar"}}"><i class="fa fa-columns item" aria-hidden="true" name="sidebar"></i></a>
  62. <a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.help"}}"><i class="fa fa-question-circle-o last" aria-hidden="true" name="help"></i></a>
  63. </div>
  64. <div class="editormd-group">
  65. <a href="javascript:;" data-toggle="tooltip" data-title="{{i18n .Lang "doc.publish"}}"><i class="fa fa-cloud-upload" name="release" aria-hidden="true"></i></a>
  66. </div>
  67. <div class="editormd-group">
  68. <a href="javascript:;" data-toggle="tooltip" data-title=""></a>
  69. <a href="javascript:;" data-toggle="tooltip" data-title=""></a>
  70. </div>
  71. <div class="clearfix"></div>
  72. </div>*/}}-->
  73. <div class="manual-body">
  74. <div class="manual-category" id="manualCategory" style="top: 0;">
  75. <div class="manual-nav">
  76. <div class="nav-item active"><i class="fa fa-bars" aria-hidden="true"></i> {{i18n .Lang "doc.document"}}</div>
  77. <div class="nav-plus pull-right" data-toggle="tooltip" data-title="{{i18n .Lang "doc.backward"}}" data-direction="right">
  78. <a style="color: #999999;" href="{{urlfor "BookController.Dashboard" ":key" .Model.Identify}}" target="_blank"><i class="fa fa-chevron-left" aria-hidden="true"></i></a>
  79. </div>
  80. <div class="nav-plus pull-right" id="btnAddDocument" data-toggle="tooltip" data-title="{{i18n .Lang "doc.create_doc"}}" data-direction="right"><i class="fa fa-plus" aria-hidden="true"></i></div>
  81. <div class="clearfix"></div>
  82. </div>
  83. <div class="manual-tree" id="sidebar">
  84. </div>
  85. </div>
  86. <div class="manual-editor-container" id="manualEditorContainer" style="top: 0;">
  87. <div class="manual-wangEditor">
  88. <div id="htmlEditor" class="manual-editormd-active" style="height: 100%"></div>
  89. </div>
  90. <div class="manual-editor-status">
  91. <div id="attachInfo" class="item" style="display: inline-block; padding: 0 3em;">0 {{i18n .Lang "doc.attachments"}}</div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. <!-- Modal -->
  97. <div class="modal fade" id="addDocumentModal" tabindex="-1" style="z-index: 10001 !important;" role="dialog" aria-labelledby="addDocumentModalLabel">
  98. <div class="modal-dialog" role="document">
  99. <form method="post" action="{{urlfor "DocumentController.Create" ":key" .Model.Identify}}" id="addDocumentForm" class="form-horizontal">
  100. <input type="hidden" name="identify" value="{{.Model.Identify}}">
  101. <input type="hidden" name="doc_id" value="0">
  102. <input type="hidden" name="parent_id" value="0">
  103. <div class="modal-content">
  104. <div class="modal-header">
  105. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  106. <h4 class="modal-title" id="myModalLabel">{{i18n .Lang "doc.create_doc"}}</h4>
  107. </div>
  108. <div class="modal-body">
  109. <div class="form-group">
  110. <label class="col-sm-2 control-label">{{i18n .Lang "doc.doc_name"}} <span class="error-message">*</span></label>
  111. <div class="col-sm-10">
  112. <input type="text" name="doc_name" id="documentName" placeholder="{{i18n .Lang "doc.doc_name"}}" class="form-control" maxlength="50">
  113. <p style="color: #999;font-size: 12px;">{{i18n .Lang "doc.doc_name_tips"}}</p>
  114. </div>
  115. </div>
  116. <div class="form-group">
  117. <label class="col-sm-2 control-label">{{i18n .Lang "doc.doc_id"}}</label>
  118. <div class="col-sm-10">
  119. <input type="text" name="doc_identify" id="documentIdentify" placeholder="{{i18n .Lang "doc.doc_id"}}" class="form-control" maxlength="50">
  120. <p style="color: #999;font-size: 12px;">{{i18n .Lang "doc.doc_id_tips"}}</p>
  121. </div>
  122. </div>
  123. </div>
  124. <div class="modal-footer">
  125. <span id="add-error-message" class="error-message"></span>
  126. <button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
  127. <button type="submit" class="btn btn-primary" id="btnSaveDocument" data-loading-text="{{i18n .Lang "message.processing"}}">{{i18n .Lang "doc.save"}}</button>
  128. </div>
  129. </div>
  130. </form>
  131. </div>
  132. </div>
  133. <div class="modal fade" id="uploadAttachModal" tabindex="-1" style="z-index: 10001 !important;" role="dialog" aria-labelledby="uploadAttachModalLabel">
  134. <div class="modal-dialog" role="document">
  135. <form method="post" action="{{urlfor "DocumentController.Create" ":key" .Model.Identify}}" id="addDocumentForm" class="form-horizontal">
  136. <input type="hidden" name="identify" value="{{.Model.Identify}}">
  137. <input type="hidden" name="doc_id" value="0">
  138. <input type="hidden" name="parent_id" value="0">
  139. <div class="modal-content">
  140. <div class="modal-header">
  141. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  142. <h4 class="modal-title" id="myModalLabel">{{i18n .Lang "doc.upload_attachment"}}</h4>
  143. </div>
  144. <div class="modal-body">
  145. <div class="attach-drop-panel">
  146. <div class="upload-container" id="filePicker"><i class="fa fa-upload" aria-hidden="true"></i></div>
  147. </div>
  148. <div class="attach-list" id="attachList">
  149. <template v-for="item in lists">
  150. <div class="attach-item" :id="item.attachment_id">
  151. <template v-if="item.state == 'wait'">
  152. <div class="progress">
  153. <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100">
  154. <span class="sr-only">0% Complete (success)</span>
  155. </div>
  156. </div>
  157. </template>
  158. <template v-else-if="item.state == 'error'">
  159. <span class="error-message">${item.message}</span>
  160. <button type="button" class="btn btn-sm close" @click="removeAttach(item.attachment_id)">
  161. <i class="fa fa-remove" aria-hidden="true"></i>
  162. </button>
  163. </template>
  164. <template v-else>
  165. <a :href="item.http_path" target="_blank" :title="item.file_name">${item.file_name}</a>
  166. <span class="text">(${(item.file_size/1024/1024).toFixed(4)}MB)</span>
  167. <span class="error-message">${item.message}</span>
  168. <button type="button" class="btn btn-sm close" @click="removeAttach(item.attachment_id)">
  169. <i class="fa fa-remove" aria-hidden="true"></i>
  170. </button>
  171. <div class="clearfix"></div>
  172. </template>
  173. </div>
  174. </template>
  175. </div>
  176. </div>
  177. <div class="modal-footer">
  178. <span id="add-error-message" class="error-message"></span>
  179. <button type="button" class="btn btn-default" data-dismiss="modal">{{i18n .Lang "common.cancel"}}</button>
  180. <button type="button" class="btn btn-primary" id="btnUploadAttachFile" data-dismiss="modal">{{i18n .Lang "common.confirm"}}</button>
  181. </div>
  182. </div>
  183. </form>
  184. </div>
  185. </div>
  186. <script src="https://cdn.jsdelivr.net/npm/i18next/i18next.min.js"></script>
  187. <script src="{{cdnjs "/static/jquery/1.12.4/jquery.min.js"}}"></script>
  188. <script src="{{cdnjs "/static/bootstrap/js/bootstrap.min.js"}}"></script>
  189. <script src="{{cdnjs "/static/vuejs/vue.min.js"}}" type="text/javascript"></script>
  190. <script src="{{cdnjs "/static/jstree/3.3.4/jstree.min.js"}}" type="text/javascript"></script>
  191. <script src="{{cdnjs "/static/webuploader/webuploader.min.js"}}" type="text/javascript"></script>
  192. <script src="{{cdnjs "/static/js/class2browser.js"}}" type="text/javascript"></script>
  193. <script src="{{cdnjs "/static/wangEditor/wangEditor.min.js"}}" type="text/javascript"></script>
  194. <script src="{{cdnjs "/static/js/wangEditor-plugins/save-menu.js"}}" type="text/javascript"></script>
  195. <script src="{{cdnjs "/static/js/wangEditor-plugins/release-menu.js"}}" type="text/javascript"></script>
  196. <script src="{{cdnjs "/static/js/wangEditor-plugins/attach-menu.js"}}" type="text/javascript"></script>
  197. <script src="{{cdnjs "/static/js/wangEditor-plugins/history-menu.js"}}" type="text/javascript"></script>
  198. <script src="{{cdnjs "/static/layer/layer.js"}}" type="text/javascript" ></script>
  199. <script src="{{cdnjs "/static/to-markdown/dist/to-markdown.js"}}" type="text/javascript"></script>
  200. <script src="{{cdnjs "/static/js/jquery.form.js"}}" type="text/javascript"></script>
  201. <script src="{{cdnjs "/static/js/editor.js"}}" type="text/javascript"></script>
  202. <script src="{{cdnjs "/static/js/html-editor.js"}}" type="text/javascript"></script>
  203. <script src="{{cdnjs "/static/js/custom-elements-builtin-0.6.5.min.js"}}" type="text/javascript"></script>
  204. <script src="{{cdnjs "/static/js/x-frame-bypass-1.0.2.js"}}" type="text/javascript"></script>
  205. <script type="text/javascript">
  206. $(function () {
  207. lang = {{i18n $.Lang "common.js_lang"}};
  208. $("#attachInfo").on("click",function () {
  209. $("#uploadAttachModal").modal("show");
  210. });
  211. window.uploader = null;
  212. $("#uploadAttachModal").on("shown.bs.modal",function () {
  213. if(window.uploader === null){
  214. try {
  215. window.uploader = WebUploader.create({
  216. auto: true,
  217. dnd : true,
  218. swf: '{{.BaseUrl}}/static/webuploader/Uploader.swf',
  219. server: '{{urlfor "DocumentController.Upload"}}',
  220. formData : { "identify" : {{.Model.Identify}},"doc_id" : window.selectNode.id },
  221. pick: "#filePicker",
  222. fileVal : "editormd-file-file",
  223. fileNumLimit : 1,
  224. compress : false
  225. }).on("beforeFileQueued",function (file) {
  226. uploader.reset();
  227. }).on( 'fileQueued', function( file ) {
  228. var item = {
  229. state : "wait",
  230. attachment_id : file.id,
  231. file_size : file.size,
  232. file_name : file.name,
  233. message : "{{i18n .Lang "doc.uploading"}}"
  234. };
  235. window.vueApp.lists.splice(0,0,item);
  236. }).on("uploadError",function (file,reason) {
  237. for(var i in window.vueApp.lists){
  238. var item = window.vueApp.lists[i];
  239. if(item.attachment_id == file.id){
  240. item.state = "error";
  241. item.message = "{{i18n .Lang "message.upload_failed"}}:" + reason;
  242. break;
  243. }
  244. }
  245. }).on("uploadSuccess",function (file, res) {
  246. for(var index in window.vueApp.lists){
  247. var item = window.vueApp.lists[index];
  248. if(item.attachment_id === file.id){
  249. if(res.errcode === 0) {
  250. window.vueApp.lists.splice(index, 1, res.attach);
  251. }else{
  252. item.message = res.message;
  253. item.state = "error";
  254. }
  255. break;
  256. }
  257. }
  258. }).on("beforeFileQueued",function (file) {
  259. }).on("uploadComplete",function () {
  260. }).on("uploadProgress",function (file, percentage) {
  261. var $li = $( '#'+file.id ),
  262. $percent = $li.find('.progress .progress-bar');
  263. $percent.css( 'width', percentage * 100 + '%' );
  264. });
  265. }catch(e){
  266. console.log(e);
  267. }
  268. }
  269. });
  270. });
  271. </script>
  272. </body>
  273. </html>