人人商城

designer.html 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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="application[identifie]"]').val();
  7. $(".identifie").html(identifie);
  8. });
  9. $(':checkbox[name="platform[rule]"]').click(function(){
  10. if($(this).is(':checked')) {
  11. $('.rule-ops').show();
  12. $(':checkbox[name="handles[]"]').eq(0).attr('checked', 'checked');
  13. $(':checkbox[name="handles[]"]').eq(0).attr('disabled', 'disabled');
  14. } else {
  15. $('.rule-ops').hide();
  16. $(':checkbox[name="handles[]"]').eq(0).removeAttr('disabled');
  17. }
  18. });
  19. $("#form1").submit(function(){
  20. var msg = '';
  21. var m = $.trim($(':text[name="application[name]"]').val());
  22. if(m == '') {
  23. msg += '必须输入模块名称. <br />';
  24. }
  25. if((/\*\/|\/\*|eval|\$\_/i).test(m)) {
  26. msg += '必须输入有效的模块名称. <br />';
  27. }
  28. var identifie = $.trim($(':text[name="application[identifie]"]').val());
  29. if(identifie == '' || !(/^[a-z][a-z\d_]+$/i).test(identifie)) {
  30. msg += '必须输入模块标识(只能包括字母和数字, 且只能以字母开头). <br />';
  31. }
  32. var ver = $.trim($(':text[name="application[version]"]').val());
  33. if(identifie == '' || !(/^[\d\.]+$/i).test(ver)) {
  34. msg += '必须输入模块版本号(只能包括数字和句点). <br />';
  35. }
  36. if($.trim($(':text[name="application[ability]"]').val()) == '') {
  37. msg += '必须输入模块简述. <br />';
  38. }
  39. var author = $.trim($(':text[name="application[author]"]').val());
  40. if(author != '' && (/\*\/|\/\*|eval|\$\_/i).test(author)) {
  41. msg += '必须输入有效的作者. <br />';
  42. }
  43. var url = $.trim($(':text[name="application[url]"]').val());
  44. if(url != '' && (/\*\/|\/\*|eval|\$\_/i).test(url)) {
  45. msg += '必须输入有效的模块发布页. <br />';
  46. }
  47. if($(':checkbox[name="versions[]"]:checked').length == 0) {
  48. msg += '必须选择模块支持的微擎版本. <br />';
  49. }
  50. if(msg != '') {
  51. u.message(msg, '', 'error');
  52. return false;
  53. }
  54. if($(':hidden[name=do]').val() == '') {
  55. return false;
  56. }
  57. return true;
  58. });
  59. });
  60. function addOption(point, title) {
  61. var html = '<div class="form-group">' +
  62. '<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">' + title +'</label>' +
  63. '<div class="col-sm-10">' +
  64. '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
  65. '<div class="input-group" style="margin-left:-15px;margin-bottom:10px">' +
  66. '<span class="input-group-addon">操作名称</span>' +
  67. '<input class="form-control" name="bindings[' + point + '][titles][]" type="text" placeholder="请输入操作名称"> ' +
  68. '</div>' +
  69. '</div>' +
  70. '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
  71. '<div class="input-group" style="margin-left:-15px;margin-bottom:10px">' +
  72. '<span class="input-group-addon">入口标识</span>' +
  73. '<input class="form-control" name="bindings[' + point + '][dos][]" type="text" placeholder="请输入操作入口"> ' +
  74. '</div>' +
  75. '</div>' +
  76. '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">' +
  77. '<div class="input-group" style="margin-left:-15px;margin-bottom:10px">' +
  78. '<span class="input-group-addon">操作附加数据</span>' +
  79. '<input class="form-control" name="bindings[' + point + '][state][]" type="text" placeholder="操作附加数据"> ' +
  80. '</div>' +
  81. '</div>' +
  82. '<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3 '+ (point == 'menu' ? 'hide' : '') +'">' +
  83. '<div style="margin-left:-15px;">' +
  84. '<label class="checkbox-inline" style="vertical-align:bottom"> ' +
  85. '<input type="hidden" name="bindings[' + point + '][direct][]" value="false" /> ' +
  86. '<input type="checkbox" onclick="$(this).prev().val(this.checked ? \'true\' : \'false\');" /> 无需登陆直接展示 ' +
  87. '</label> ' +
  88. '&nbsp; &nbsp; &nbsp; <a href="javascript:;" onclick="deleteOption(this)" class="fa fa-times-circle" title="删除此操作"></a> ' +
  89. '</div>' +
  90. '</div>' +
  91. '</div>' +
  92. '</div>';
  93. $('#bindings-' + point).append(html);
  94. }
  95. function deleteOption(o) {
  96. $(o).parent().parent().parent().parent().remove();
  97. }
  98. </script>
  99. {template 'extension/module-tabs'}
  100. <div class="clearfix">
  101. <form class="form-horizontal form" id="form1" action="" method="post" enctype="multipart/form-data">
  102. <input type="hidden" name="id" value="{$rule['rule'][id]}">
  103. <h5 class="page-header">模块基本信息 <small>这里来定义你自己模块的基本信息</small></h5>
  104. <div class="form-group">
  105. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模块名称</label>
  106. <div class="col-sm-10 col-xs-12">
  107. <input type="text" class="form-control" placeholder="" name="application[name]"/>
  108. <span class="help-block">模块的名称, 由于显示在用户的模块列表中. 不要超过10个字符 </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. <input type="text" class="form-control" placeholder="" name="application[identifie]" />
  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="application[version]" />
  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. <select name="application[type]" class="form-control">
  129. {loop $modtypes $tp}
  130. <option value="{$tp['name']}">{$tp['title']}</option>
  131. {/loop}
  132. </select>
  133. <span class="help-block">模块的类型, 用于分类展示和查找你的模块</span>
  134. </div>
  135. </div>
  136. <div class="form-group">
  137. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模块简述</label>
  138. <div class="col-sm-10 col-xs-12">
  139. <input type="text" class="form-control" placeholder="" name="application[ability]"/>
  140. <span class="help-block">模块功能描述, 使用简单的语言描述模块的作用, 来吸引用户 </span>
  141. </div>
  142. </div>
  143. <div class="form-group">
  144. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模块介绍</label>
  145. <div class="col-sm-10 col-xs-12">
  146. <textarea class="form-control" name="application[description]" rows="4"></textarea>
  147. <span class="help-block">模块详细描述, 详细介绍模块的功能和使用方法 </span>
  148. </div>
  149. </div>
  150. <div class="form-group">
  151. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">作者</label>
  152. <div class="col-sm-10 col-xs-12">
  153. <input type="text" class="form-control" placeholder="" name="application[author]"/>
  154. <span class="help-block">模块的作者, 留下你的大名吧</span>
  155. </div>
  156. </div>
  157. <div class="form-group">
  158. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">发布页</label>
  159. <div class="col-sm-10 col-xs-12">
  160. <input type="text" class="form-control" placeholder="" name="application[url]" value="http://bbs.we7.cc/" />
  161. <span class="help-block">模块的发布页, 用于发布模块更新信息的页面, 推荐使用微擎模块版块</span>
  162. </div>
  163. </div>
  164. <div class="form-group">
  165. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">设置项</label>
  166. <div class="col-sm-10 col-xs-12">
  167. <label class="checkbox-inline">
  168. <input type="checkbox" name="application[setting]" value="true" />
  169. 存在全局设置项
  170. </label>
  171. <span class="help-block">此模块是否存在全局的配置参数, 此参数是针对公众账号独立保存的</span>
  172. </div>
  173. </div>
  174. <h5 class="page-header">公众平台消息处理选项 <small>这里来定义公众平台消息相关处理</small></h5>
  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. {loop $mtypes $k $v}
  179. <div class="checkbox">
  180. <label>
  181. <input name="subscribes[]" type="checkbox" value="{$k}" /> {$v}
  182. </label>
  183. </div>
  184. {/loop}
  185. <span class="help-block">订阅特定的消息类型后, 此消息类型的消息到达微擎系统后将会以通知的方式(消息数据只读, 并不能返回处理结果)调用模块的接受器, 用这样的方式可以实现全局的数据统计分析等功能. 请参阅 <a href="http://www.we7.cc/docs/#flow-module-subscribe">模块消息订阅</a></span>
  186. <div class="alert-warning alert">注意: 订阅的消息信息是只读的, 只能用作分析统计, 不能更改, 也不能改变微擎处理主流程</div>
  187. </div>
  188. </div>
  189. <div class="form-group">
  190. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">直接处理的类型</label>
  191. <div class="col-sm-10 col-xs-12">
  192. {loop $mtypes $k $v}
  193. {if $k != 'unsubscribe' && $k != 'view'}
  194. <div class="checkbox">
  195. <label>
  196. <input name="handles[]" type="checkbox" value="{$k}" /> {$v}
  197. </label>
  198. </div>
  199. {/if}
  200. {/loop}
  201. <span class="help-block">当前模块能够直接处理的消息类型(没有上下文的对话语境, 能直接处理消息并返回数据). 如果公众平台传递过来的消息类型不在设定的类型列表中, 那么系统将不会把此消息路由至此模块</span>
  202. <div class="alert-warning alert">
  203. 注意: 关键字路由只能针对文本消息有效, 文本消息最为重要. 其他类型的消息并不能被直接理解, 多数情况需要使用文本消息来进行语境分析, 再处理其他相关消息类型<br>
  204. 注意: 上下文锁定的模块不受此限制, 上下文锁定期间, 任何类型的消息都会路由至锁定模块
  205. </div>
  206. </div>
  207. </div>
  208. <div class="form-group">
  209. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">是否要嵌入规则</label>
  210. <div class="col-sm-10 col-xs-12">
  211. <label class="checkbox-inline">
  212. <input type="checkbox" name="platform[rule]" value="true" />
  213. 需要嵌入规则
  214. </label>
  215. <span class="help-block">是否要在规则编辑时添加此规则的相应的规则</span>
  216. <div class="alert-warning alert">注意: 如果需要嵌入规则, 那么此模块必须能够处理文本类型消息 (需要定义Processor)</div>
  217. </div>
  218. </div>
  219. <h5 class="page-header">微站功能绑定 <small>这里来定义此功能模块中微站的相关功能如何同系统对接</small></h5>
  220. {loop $points $point $row}
  221. <div id="bindings-{$point}">
  222. <div class="form-group">
  223. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">{$row['title']}</label>
  224. <div class="col-sm-10 col-xs-12">
  225. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
  226. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  227. <span class="input-group-addon">操作名称</span>
  228. <input class="form-control" name="bindings[{$point}][titles][]" type="text" placeholder="请输入操作名称">
  229. </div>
  230. </div>
  231. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
  232. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  233. <span class="input-group-addon">入口标识</span>
  234. <input class="form-control" name="bindings[{$point}][dos][]" type="text" placeholder="请输入操作入口">
  235. </div>
  236. </div>
  237. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">
  238. <div class="input-group" style="margin-left:-15px;margin-bottom:10px">
  239. <span class="input-group-addon">操作附加数据</span>
  240. <input class="form-control" name="bindings[{$point}][state][]" type="text" placeholder="操作附加数据">
  241. </div>
  242. </div>
  243. <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3 {if $point == 'menu'}hide{/if}">
  244. <div style="margin-left:-15px;margin-bottom:17px">
  245. <label class="checkbox-inline" style="vertical-align:bottom">
  246. <input type="hidden" name="bindings[{$point}][direct][]" value="false" />
  247. <input type="checkbox" onclick="$(this).prev().val(this.checked ? 'true' : 'false');" /> 无需登陆直接展示
  248. </label>
  249. &nbsp; &nbsp; &nbsp; <a href="javascript:;" onclick="deleteOption(this)" class="fa fa-times-circle" title="删除此操作"></a>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. </div>
  255. {if $point == 'menu' && !$flag}
  256. {php $flag = 1;}
  257. <div class="form-group">
  258. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">权限标识</label>
  259. <div class="col-sm-10 col-xs-12">
  260. <textarea name="permission" class="form-control" cols="30" rows="10" placeholder="添加门店:we7_demo_store_add"></textarea>
  261. <span class="help-block">
  262. <strong class="text-danger">
  263. 如果您设计的模块需要对某些操作设置权限,您可以在这里输入权限标识,并在对应的文件进行标识判断<br>
  264. 权限标识由:标识名称和标识组成。例如,添加门店:we7_demo_store_add"。标识格式:模块名称_标识。例如,名称名称为:we7_demo,标识为:store_add,则对应标识为:we7_demo_store_add<br>
  265. 标识名称和标识之间使用英文半角“:”隔开。多个权限标识使用换行隔开
  266. </strong>
  267. </span>
  268. </div>
  269. </div>
  270. {/if}
  271. <div class="form-group">
  272. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
  273. <div class="col-sm-10 col-xs-12">
  274. <div class="well well-sm">
  275. <a href="javascript:;" onclick="addOption('{$point}', '{$row['title']}');">添加操作 <i class="fa fa-plus-circle" title="添加菜单"></i></a>
  276. </div>
  277. <span class="help-block">{$row['desc']}</span>
  278. <span class="help-block"><strong>注意: {$row['title']}扩展功能定义于 WeSite 类的实现中</strong></span>
  279. </div>
  280. </div>
  281. {/loop}
  282. <h5 class="page-header">计划任务 <small>这里来定义模块的计划任务<span class="text-danger">(如果您的模块不需要计划任务,跳过此项)</span></small></h5>
  283. <div id="cron-container"></div>
  284. <div class="form-group">
  285. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
  286. <div class="col-sm-10 col-xs-12">
  287. <div class="well well-sm">
  288. <a href="javascript:;" onclick="addCronOption();">添加计划任务 <i class="fa fa-plus-circle" title="添加菜单"></i></a>
  289. </div>
  290. <span class="help-block"><strong>注意: XXXXXX</strong></span>
  291. </div>
  292. </div>
  293. <h5 class="page-header">模块发布 <small>这里来定义模块发布时需要的配置项</small></h5>
  294. <div class="form-group">
  295. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">兼容的微擎版本</label>
  296. <div class="col-sm-10 col-xs-12">
  297. {loop $versions $v}
  298. <label class="checkbox-inline">
  299. <input name="versions[]" type="checkbox" value="{$v}" {if in_array($v, $m['versions'])} checked="checked"{/if} />WeEngine {$v}
  300. </label>
  301. {/loop}
  302. <span class="help-block">当前模块兼容的微擎系统版本, 安装时会判断版本信息, 不兼容的版本将无法安装</span>
  303. </div>
  304. </div>
  305. <div class="form-group">
  306. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模块缩略图</label>
  307. <div class="col-sm-10 col-xs-12">
  308. <input type="file" name="icon" value="{$m['icon']}">
  309. <span class="help-block">用 48*48 的图片来让你的模块更吸引眼球吧</span>
  310. </div>
  311. </div>
  312. <div class="form-group">
  313. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模块封面</label>
  314. <div class="col-sm-10 col-xs-12">
  315. <input type="file" name="preview" value="{$m['preview']}">
  316. <span class="help-block">模块封面, 大小为 600*350, 更好的设计将会获得官方推荐位置</span>
  317. </div>
  318. </div>
  319. <div class="form-group">
  320. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模块安装脚本</label>
  321. <div class="col-sm-10 col-xs-12">
  322. <textarea class="form-control" name="install" rows="4">{$m['install']}</textarea>
  323. <span class="help-block">当前模块全新安装时所执行的脚本, 可以定义为SQL语句. 也可以指定为单个的php脚本文件, 如: install.php</span>
  324. </div>
  325. </div>
  326. <div class="form-group">
  327. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模块卸载脚本</label>
  328. <div class="col-sm-10 col-xs-12">
  329. <textarea class="form-control" name="uninstall" rows="4">{$m['uninstall']}</textarea>
  330. <span class="help-block">当前模块卸载时所执行的脚本, 可以定义为SQL语句. 也可以指定为单个的php脚本文件, 如: uninstall.php</span>
  331. </div>
  332. </div>
  333. <div class="form-group">
  334. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">模块升级脚本</label>
  335. <div class="col-sm-10 col-xs-12">
  336. <textarea class="form-control" name="upgrade" rows="4">{$m['upgrade']}</textarea>
  337. <span class="help-block">当前模块更新时所执行的脚本, 可以定义为SQL语句. 也可以指定为单个的php脚本文件, 如: upgrade.php. (推荐使用php脚本, 方便检测字段及兼容性)</span>
  338. <input type="hidden" name="token" value="{$_W['token']}" />
  339. </div>
  340. </div>
  341. <div class="form-group">
  342. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
  343. <div class="col-sm-10 col-xs-12">
  344. <input name="method" type="hidden" value="download"/>
  345. <input name="token" type="hidden" value="{$_W['token']}" />
  346. {if $available['create']}
  347. <input type="submit" class="btn btn-primary" name="submit" onclick="$(':hidden[name=method]').val('create');" value="直接生成模块模板" />
  348. {else}
  349. <input type="submit" class="btn btn-primary disabled" disabled="disabled" name="submit" value="直接生成模块模板" />
  350. <div class="alert-warning alert" style="width:auto;margin-top:5px;">需要 addons 目录具有可写权限</div>
  351. {/if}
  352. <span class="help-block">点此直接在源码目录 addons/<span class="identifie"></span> 处生成模块开发的模板文件, 方便快速开发</span>
  353. </div>
  354. </div>
  355. <div class="form-group">
  356. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
  357. <div class="col-sm-10 col-xs-12">
  358. {if $available['download']}
  359. <input type="submit" class="btn btn-primary span3" name="submit" onclick="$(':hidden[name=method]').val('download');" value="下载模块模板" />
  360. {else}
  361. <input type="submit" class="btn btn-primary span3 disabled" disabled="disabled" name="submit" value="下载模块模板" />
  362. <div class="alert-warning alert">需要启用 Zip 模块</div>
  363. {/if}
  364. <span class="help-block">如果您的服务器不能直接读写文件, 请下载后上传至服务器目录 addons/<span class="identifie"></span> 下来编辑开发 </span>
  365. </div>
  366. </div>
  367. </form>
  368. </div>
  369. {template 'common/footer-gw'}