人人商城

desitemp.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. {template 'common/header-gw'}
  2. <script type="text/javascript">
  3. require(['filestyle', 'util'], function($, u){
  4. $(".form-group").find(':file').filestyle({buttonText: '上传图片'});
  5. $('.form-control').blur(function(){
  6. var identifie = $('input[name="template[identifie]"]').val();
  7. $(".identifie").html(identifie);
  8. });
  9. /*表单数据检测*/
  10. $("#form1").submit(function(){
  11. var msg = '';
  12. var m = $.trim($(':text[name="template[name]"]').val());
  13. if(m == '') {
  14. msg += '必须输入模板名称. <br />';
  15. }
  16. if((/\*\/|\/\*|eval|\$\_/i).test(m)) {
  17. msg += '必须输入有效的模板名称. <br />';
  18. }
  19. var identifie = $.trim($(':text[name="template[identifie]"]').val());
  20. if(identifie == '' || !(/^[a-z][a-z\d_]+$/i).test(identifie)) {
  21. msg += '必须输入模板标识(只能包括字母和数字, 且只能以字母开头). <br />';
  22. }
  23. var author = $.trim($(':text[name="template[author]"]').val());
  24. if(author == '' || (/\*\/|\/\*|eval|\$\_/i).test(author)) {
  25. msg += '必须输入有效的作者. <br />';
  26. }
  27. var url = $.trim($(':text[name="template[url]"]').val());
  28. if(url == '' || (/\*\/|\/\*|eval|\$\_/i).test(url)) {
  29. msg += '必须输入有效的模板发布页. <br />';
  30. }
  31. if($(':checkbox[name="versions[]"]:checked').length == 0) {
  32. msg += '必须选择模板支持的微擎版本. <br />';
  33. }
  34. if(msg != '') {
  35. u.message(msg, '', 'error');
  36. return false;
  37. }
  38. if($(':hidden[name=do]').val() == '') {
  39. return false;
  40. }
  41. return true;
  42. });
  43. });
  44. /*添加配置项节点*/
  45. function addOption(point, title) {
  46. var html = '<div class="form-group">' +
  47. '<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">' + title +'</label>' +
  48. '<div class="col-sm-10">' +
  49. '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
  50. '<div class="input-group" style="margin-left:-15px;margin-bottom:10px">' +
  51. '<span class="input-group-addon">变量名</span>' +
  52. '<input class="form-control" name="settings[variables][]" type="text" placeholder="请输入配置变量"> ' +
  53. '</div>' +
  54. '</div>' +
  55. '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
  56. '<div class="input-group" style="margin-left:-15px;margin-bottom:10px">' +
  57. '<span class="input-group-addon">变量描述</span>' +
  58. '<input class="form-control" name="settings[description][]" type="text" placeholder="请输入变量描述"> ' +
  59. '</div>' +
  60. '</div>' +
  61. '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
  62. '<div class="input-group" style="margin-left:-15px;margin-bottom:10px">' +
  63. '<span class="input-group-addon">值</span>' +
  64. '<input class="form-control" name="settings[values][]" type="text" placeholder="请输入配置值"> ' +
  65. '</div>' +
  66. '</div>' +
  67. '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
  68. '<label class="checkbox-inline"> ' +
  69. '<a href="javascript:;" onclick="deleteOption(this)" class="fa fa-times-circle" title="删除此操作"></a> ' +
  70. '</label> ' +
  71. '</div>' +
  72. '</div>' +
  73. '</div>';
  74. $('#settings').append(html);
  75. }
  76. /*删除配置项节点*/
  77. function deleteOption(o) {
  78. $(o).parent().parent().parent().parent().remove();
  79. }
  80. </script>
  81. {template 'extension/theme-tabs'}
  82. <div class="clearfix">
  83. <form class="form-horizontal form" id="form1" action="" method="post" enctype="multipart/form-data">
  84. <input type="hidden" name="id" value="{$rule['rule'][id]}">
  85. <h5 class="page-header">模板基本信息 <small>这里来定义你自己模板的基本信息</small></h5>
  86. <div class="form-group">
  87. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板名称</label>
  88. <div class="col-sm-10 col-xs-12">
  89. <input type="text" class="form-control" placeholder="" name="template[name]"/>
  90. <span class="help-block">模板的名称, 由于显示在用户的模板列表中. 不要超过10个字符 </span>
  91. </div>
  92. </div>
  93. <div class="form-group">
  94. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板标识</label>
  95. <div class="col-sm-10 col-xs-12">
  96. <input type="text" class="form-control" placeholder="" name="template[identifie]" />
  97. <span class="help-block">模板标识符, 应对应模板文件夹的名称, 微擎系统按照此标识符查找模板定义, 只能由字母数字下划线组成 </span>
  98. </div>
  99. </div>
  100. <div class="form-group">
  101. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板类型</label>
  102. <div class="col-sm-10 col-xs-12">
  103. <select name="template[type]" class="form-control">
  104. {loop $temtypes $type}
  105. <option value="{$type['name']}">{$type['title']}</option>
  106. {/loop}
  107. </select>
  108. <span class="help-block">模板的类型, 用于分类展示和查找你的模板</span>
  109. </div>
  110. </div>
  111. <div class="form-group">
  112. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板介绍</label>
  113. <div class="col-sm-10 col-xs-12">
  114. <textarea class="form-control" name="template[description]" rows="4"></textarea>
  115. <span class="help-block">模板详细描述, 详细介绍模板的功能和使用方法 </span>
  116. </div>
  117. </div>
  118. <div class="form-group">
  119. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">作者</label>
  120. <div class="col-sm-10 col-xs-12">
  121. <input type="text" class="form-control" placeholder="" name="template[author]"/>
  122. <span class="help-block">模板的作者, 留下你的大名吧</span>
  123. </div>
  124. </div>
  125. <div class="form-group">
  126. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">发布页</label>
  127. <div class="col-sm-10 col-xs-12">
  128. <input type="text" class="form-control" placeholder="" name="template[url]" value="http://bbs.we7.cc/" />
  129. <span class="help-block">模板的发布页, 用于发布模板更新信息的页面, 推荐使用微擎模板版块</span>
  130. </div>
  131. </div>
  132. <div class="form-group">
  133. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板支持位置数</label>
  134. <div class="col-sm-10 col-xs-12">
  135. <select name="template[sections]" class="form-control">
  136. <option value="0">不设置位置</option>
  137. <?php for ($i=1; $i<=10; $i++) {?>
  138. <option {if $item['section'] == $i} selected{/if} value="{$i}">位置{$i}</option>
  139. <?php }?>
  140. </select>
  141. <span class="help-block">此设置为指定模板支持导航链接显示在模板中的位置选项,管理员可添加导航链接到相应的位置中。不设置位置则表示不支持导航位置显示。</span>
  142. </div>
  143. </div>
  144. <h5 class="page-header">模板发布 <small>这里来定义模板发布时需要的配置项<span class="text-danger">(说明:变量名用于设置不同的变量,只能是字母数字组成.变量描述可方便用户识别对应变量的作用,不能为空)</span></small></h5>
  145. <div id="settings">
  146. <div class="form-group">
  147. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">配置项</label>
  148. <div class="col-sm-10 col-xs-12">
  149. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
  150. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  151. <span class="input-group-addon">变量名</span>
  152. <input class="form-control" name="settings[variables][]" type="text" placeholder="请输入配置变量">
  153. </div>
  154. </div>
  155. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
  156. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  157. <span class="input-group-addon">变量描述</span>
  158. <input class="form-control" name="settings[description][]" type="text" placeholder="请输入变量描述">
  159. </div>
  160. </div>
  161. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
  162. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  163. <span class="input-group-addon">值</span>
  164. <input class="form-control" name="settings[values][]" type="text" placeholder="请输入配置值">
  165. </div>
  166. </div>
  167. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-1">
  168. <label class="checkbox-inline">
  169. <a href="javascript:;" onclick="deleteOption(this)" class="fa fa-times-circle" title="删除此操作"></a>
  170. </label>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. <div class="form-group">
  176. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
  177. <div class="col-sm-10 col-xs-12">
  178. <div class="well well-sm">
  179. <a href="javascript:;" onclick="addOption('{$point}', '{$row['title']}');">添加操作 <i class="fa fa-plus-circle" title="添加菜单"></i></a>
  180. </div>
  181. <span class="help-block">{$row['desc']}</span>
  182. </div>
  183. </div>
  184. <div class="form-group">
  185. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">兼容的微擎版本</label>
  186. <div class="col-sm-10 col-xs-12">
  187. {loop $versions $v}
  188. <label class="checkbox-inline">
  189. <input type="checkbox" name="versions[]" value="{$v}" />WeEngine {$v}
  190. </label>
  191. {/loop}
  192. <span class="help-block">当前模板兼容的微擎系统版本, 安装时会判断版本信息, 不兼容的版本将无法安装</span>
  193. </div>
  194. </div>
  195. <div class="form-group">
  196. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模板背景</label>
  197. <div class="col-sm-10 col-xs-12">
  198. <input type="file" name="preview" value="{$m['preview']}">
  199. <span class="help-block">模板封面, 大小为 145*225, 更好的设计将会获得官方推荐位置</span>
  200. </div>
  201. </div>
  202. <div class="form-group">
  203. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
  204. <div class="col-sm-10 col-xs-12">
  205. <input name="method" type="hidden" value="download"/>
  206. <input name="token" type="hidden" value="{$_W['token']}" />
  207. {if $available['create']}
  208. <input type="submit" class="btn btn-primary" name="submit" onclick="$(':hidden[name=method]').val('create');" value="直接生成模板文件" />
  209. {else}
  210. <input type="submit" class="btn btn-primary disabled" disabled="disabled" name="submit" value="直接生成模板文件" />
  211. <div class="alert-warning alert" style="width:auto;margin-top:5px;">需要 addons 目录具有可写权限</div>
  212. {/if}
  213. <span class="help-block">点此直接在源码目录 <span class="identifie">app/themes/</span> 处生成模板开发的模板文件, 方便快速开发</span>
  214. </div>
  215. </div>
  216. <div class="form-group">
  217. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
  218. <div class="col-sm-10 col-xs-12">
  219. {if $available['download']}
  220. <input type="submit" class="btn btn-primary span3" name="submit" onclick="$(':hidden[name=method]').val('download');" value="下载模板文件" />
  221. {else}
  222. <input type="submit" class="btn btn-primary span3 disabled" disabled="disabled" name="submit" value="下载模板文件" />
  223. <div class="alert-warning alert">需要启用 Zip 模板</div>
  224. {/if}
  225. <span class="help-block">如果您的服务器不能直接读写文件, 请下载后上传至服务器目录 <span class="identifie">app/themes/</span> 下来编辑开发 </span>
  226. </div>
  227. </div>
  228. </form>
  229. </div>
  230. {template 'common/footer-gw'}