edit.html 13 KB

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