edit.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <include file="public@header"/>
  2. <style type="text/css">
  3. .pic-list li {
  4. margin-bottom: 5px;
  5. }
  6. </style>
  7. <script type="text/html" id="photos-item-tpl">
  8. <li id="saved-image{id}">
  9. <input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
  10. <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
  11. style="width: 200px;" title="图片名称">
  12. <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
  13. onclick="imagePreviewDialog(this.src);">
  14. <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
  15. <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
  16. </li>
  17. </script>
  18. <script type="text/html" id="files-item-tpl">
  19. <li id="saved-file{id}">
  20. <input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
  21. <input class="form-control" id="file-{id}-name" type="text" name="file_names[]" value="{name}"
  22. style="width: 200px;" title="文件名称">
  23. <a id="file-{id}-preview" href="{preview_url}" target="_blank">下载</a>
  24. <a href="javascript:uploadOne('文件上传','#file-{id}','file');">替换</a>
  25. <a href="javascript:(function(){$('#saved-file{id}').remove();})();">移除</a>
  26. </li>
  27. </script>
  28. </head>
  29. <body>
  30. <div class="wrap js-check-wrap">
  31. <ul class="nav nav-tabs">
  32. <li><a href="{:url('AdminPage/index')}">所有页面</a></li>
  33. <li><a href="{:url('AdminPage/add')}">添加页面</a></li>
  34. <li class="active"><a href="#">编辑页面</a></li>
  35. </ul>
  36. <form action="{:url('AdminPage/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
  37. <div class="row">
  38. <div class="col-md-9">
  39. <table class="table table-bordered">
  40. <tr>
  41. <th width="100">标题<span class="form-required">*</span></th>
  42. <td>
  43. <input type="hidden" name="post[id]" value="{$post.id}">
  44. <input class="form-control" type="text" style="width: 400px;" name="post[post_title]"
  45. required
  46. value="{$post.post_title}" placeholder="请输入标题"/>
  47. </td>
  48. </tr>
  49. <tr>
  50. <th width="100">别名</th>
  51. <td>
  52. <input class="form-control" type="text" style="width: 400px;" name="post[post_alias]"
  53. value="{$post.post_alias}" placeholder="请输入别名"/>
  54. <p class="help-block">用于美化url链接</p>
  55. </td>
  56. </tr>
  57. <tr>
  58. <th>关键词</th>
  59. <td>
  60. <input class="form-control" type="text" name="post[post_keywords]" style="width:400px"
  61. value="{$post['post_keywords']}" placeholder="请输入关键字">
  62. <p class="help-block">多关键词之间用空格隔开</p>
  63. </td>
  64. </tr>
  65. <tr>
  66. <th>摘要</th>
  67. <td><textarea class="form-control" name="post[post_excerpt]" style="height: 50px;">{$post.post_excerpt}</textarea>
  68. </td>
  69. </tr>
  70. <tr>
  71. <th>内容</th>
  72. <td>
  73. <script type="text/plain" id="content" name="post[post_content]">{$post.post_content}</script>
  74. </td>
  75. </tr>
  76. <tr>
  77. <th>相册</th>
  78. <td>
  79. <ul id="photos" class="pic-list list-unstyled form-inline">
  80. <notempty name="post.more.photos">
  81. <foreach name="post.more.photos" item="vo">
  82. <php>$img_url=cmf_get_image_preview_url($vo['url']);</php>
  83. <li id="saved-image{$key}">
  84. <input id="photo-{$key}" type="hidden" name="photo_urls[]"
  85. value="{$vo.url}">
  86. <input class="form-control" id="photo-{$key}-name" type="text"
  87. name="photo_names[]"
  88. value="{$vo.name|default=''}" style="width: 200px;" title="图片名称">
  89. <img id="photo-{$key}-preview"
  90. src="{:cmf_get_image_preview_url($vo['url'])}"
  91. style="height:36px;width: 36px;"
  92. onclick="parent.imagePreviewDialog(this.src);">
  93. <a href="javascript:uploadOneImage('图片上传','#photo-{$key}');">替换</a>
  94. <a href="javascript:(function(){$('#saved-image{$key}').remove();})();">移除</a>
  95. </li>
  96. </foreach>
  97. </notempty>
  98. </ul>
  99. <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
  100. class="btn btn-sm btn-default">选择图片</a>
  101. </td>
  102. </tr>
  103. <tr>
  104. <th>附件</th>
  105. <td>
  106. <ul id="files" class="pic-list list-unstyled form-inline">
  107. <notempty name="post.more.files">
  108. <foreach name="post.more.files" item="vo">
  109. <php>$file_url=cmf_get_file_download_url($vo['url']);</php>
  110. <li id="saved-file{$key}">
  111. <input id="file-{$key}" type="hidden" name="file_urls[]"
  112. value="{$vo.url}">
  113. <input class="form-control" id="file-{$key}-name" type="text"
  114. name="file_names[]"
  115. value="{$vo.name}" style="width: 200px;" title="图片名称">
  116. <a id="file-{$key}-preview" href="{$file_url}" target="_blank">下载</a>
  117. <a href="javascript:uploadOne('文件上传','#file-{$key}','file');">替换</a>
  118. <a href="javascript:(function(){$('#saved-file{$key}').remove();})();">移除</a>
  119. </li>
  120. </foreach>
  121. </notempty>
  122. </ul>
  123. <a href="javascript:uploadMultiFile('附件上传','#files','files-item-tpl','file');"
  124. class="btn btn-sm btn-default">选择文件</a>
  125. </td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. <div class="form-group">
  130. <div class="col-sm-offset-2 col-sm-10">
  131. <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
  132. <a class="btn btn-default" href="{:url('AdminPage/index')}">{:lang('BACK')}</a>
  133. </div>
  134. </div>
  135. </div>
  136. <div class="col-md-3">
  137. <table class="table table-bordered">
  138. <tr>
  139. <th>缩略图</th>
  140. </tr>
  141. <tr>
  142. <td>
  143. <div style="text-align: center;">
  144. <input type='hidden' name='post[more][thumbnail]' id='thumbnail'
  145. value="{$post.more.thumbnail|default=''}">
  146. <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
  147. <if condition="empty($post['more']['thumbnail'])">
  148. <img src="__TMPL__/public/assets/images/default-thumbnail.png"
  149. id='thumbnail-preview'
  150. width='135' height='135' style='cursor: pointer'/>
  151. <else/>
  152. <img src="{:cmf_get_image_preview_url($post['more']['thumbnail'])}"
  153. id='thumbnail-preview'
  154. width='135' height='135' style='cursor: hand'/>
  155. </if>
  156. </a>
  157. <input type="button" class="btn btn-sm"
  158. onclick="$('#thumbnail-preview').attr('src','__TMPL__/public/assets/images/default-thumbnail.png');$('#thumbnail').val('');return false;"
  159. value="取消图片">
  160. </div>
  161. </td>
  162. </tr>
  163. <tr>
  164. <th>发布时间</th>
  165. </tr>
  166. <tr>
  167. <td><input class="form-control js-bootstrap-datetime" type="text" name="post[published_time]"
  168. value="{:date('Y-m-d H:i',$post['published_time'])}"></td>
  169. </tr>
  170. <tr>
  171. <th>状态</th>
  172. <php>
  173. $status_yes=$post['post_status']==1?"checked":"";
  174. </php>
  175. </tr>
  176. <tr>
  177. <td>
  178. <div class="checkbox">
  179. <label>
  180. <input type="checkbox" name="post[post_status]" value="1" {$status_yes}>发布
  181. </label>
  182. </div>
  183. </td>
  184. </tr>
  185. <tr>
  186. <th>模板</th>
  187. </tr>
  188. <tr>
  189. <td>
  190. <select class="form-control" name="post[more][template]" id="more-template-select">
  191. <option value="">请选择模板</option>
  192. <foreach name="page_theme_files" item="vo">
  193. <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
  194. <option value="{$value}">{$vo.name} {$vo.file}.html</option>
  195. </foreach>
  196. </select>
  197. </td>
  198. </tr>
  199. </table>
  200. </div>
  201. </div>
  202. </form>
  203. </div>
  204. <script type="text/javascript" src="__STATIC__/js/admin.js"></script>
  205. <script type="text/javascript">
  206. //编辑器路径定义
  207. var editorURL = GV.WEB_ROOT;
  208. </script>
  209. <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  210. <script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  211. <script type="text/javascript">
  212. $(function () {
  213. editorcontent = new baidu.editor.ui.Editor();
  214. editorcontent.render('content');
  215. try {
  216. editorcontent.sync();
  217. } catch (err) {
  218. }
  219. $('#more-template-select').val("{$post.more.template|default=''}");
  220. });
  221. </script>
  222. </body>
  223. </html>