index.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <style type="text/css">
  2. @media (max-width: 375px) {
  3. .edit-form tr td input {
  4. width: 100%;
  5. }
  6. .edit-form tr th:first-child, .edit-form tr td:first-child {
  7. width: 20%;
  8. }
  9. .edit-form tr th:nth-last-of-type(-n+2), .edit-form tr td:nth-last-of-type(-n+2) {
  10. display: none;
  11. }
  12. }
  13. .edit-form table > tbody > tr td a.btn-delcfg {
  14. visibility: hidden;
  15. }
  16. .edit-form table > tbody > tr:hover td a.btn-delcfg {
  17. visibility: visible;
  18. }
  19. </style>
  20. <div class="panel panel-default panel-intro">
  21. <div class="panel-heading">
  22. {:build_heading(null, false)}
  23. <ul class="nav nav-tabs">
  24. {foreach $siteList as $index=>$vo}
  25. <li class="{$vo.active?'active':''}"><a href="#{$vo.name}" data-toggle="tab">{:__($vo.title)}</a></li>
  26. {/foreach}
  27. <li data-toggle="tooltip" title="{:__('Add new config')}">
  28. <a href="#addcfg" data-toggle="tab"><i class="fa fa-plus"></i></a>
  29. </li>
  30. </ul>
  31. </div>
  32. <div class="panel-body">
  33. <div id="myTabContent" class="tab-content">
  34. {foreach $siteList as $index=>$vo}
  35. <div class="tab-pane fade {$vo.active ? 'active in' : ''}" id="{$vo.name}">
  36. <div class="widget-body no-padding">
  37. <form id="{$vo.name}-form" class="edit-form form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('general.config/edit')}">
  38. {:token()}
  39. <table class="table table-striped">
  40. <thead>
  41. <tr>
  42. <th width="15%">{:__('Title')}</th>
  43. <th width="68%">{:__('Value')}</th>
  44. <th width="15%">{:__('Name')}</th>
  45. <th width="2%"></th>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. {foreach $vo.list as $item}
  50. <tr>
  51. <td>{$item.title}</td>
  52. <td>
  53. <div class="row">
  54. <div class="col-sm-8 col-xs-12">
  55. {switch $item.type}
  56. {case string}
  57. <input {$item.extend} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
  58. {/case}
  59. {case text}
  60. <textarea {$item.extend} name="row[{$item.name}]" class="form-control" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}">{$item.value|htmlentities}</textarea>
  61. {/case}
  62. {case editor}
  63. <textarea {$item.extend} name="row[{$item.name}]" id="editor-{$item.name}" class="form-control editor" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}">{$item.value|htmlentities}</textarea>
  64. {/case}
  65. {case array}
  66. <dl class="fieldlist" data-name="row[{$item.name}]">
  67. <dd>
  68. <ins>{:__('Array key')}</ins>
  69. <ins>{:__('Array value')}</ins>
  70. </dd>
  71. <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
  72. <textarea name="row[{$item.name}]" class="form-control hide" cols="30" rows="5">{$item.value|htmlentities}</textarea>
  73. </dl>
  74. {/case}
  75. {case date}
  76. <input {$item.extend} type="text" name="row[{$item.name}]" value="{$item.value}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  77. {/case}
  78. {case time}
  79. <input {$item.extend} type="text" name="row[{$item.name}]" value="{$item.value}" class="form-control datetimepicker" data-date-format="HH:mm:ss" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  80. {/case}
  81. {case datetime}
  82. <input {$item.extend} type="text" name="row[{$item.name}]" value="{$item.value}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  83. {/case}
  84. {case number}
  85. <input {$item.extend} type="number" name="row[{$item.name}]" value="{$item.value}" class="form-control" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  86. {/case}
  87. {case checkbox}
  88. {foreach name="item.content" item="vo"}
  89. <label for="row[{$item.name}][]-{$key}"><input id="row[{$item.name}][]-{$key}" name="row[{$item.name}][]" type="checkbox" value="{$key}" data-tip="{$item.tip}" {in name="key" value="$item.value" }checked{/in} /> {$vo}</label>
  90. {/foreach}
  91. {/case}
  92. {case radio}
  93. {foreach name="item.content" item="vo"}
  94. <label for="row[{$item.name}]-{$key}"><input id="row[{$item.name}]-{$key}" name="row[{$item.name}]" type="radio" value="{$key}" data-tip="{$item.tip}" {in name="key" value="$item.value" }checked{/in} /> {$vo}</label>
  95. {/foreach}
  96. {/case}
  97. {case value="select" break="0"}{/case}
  98. {case value="selects"}
  99. <select {$item.extend} name="row[{$item.name}]{$item.type=='selects'?'[]':''}" class="form-control selectpicker" data-tip="{$item.tip}" {$item.type=='selects'?'multiple':''}>
  100. {foreach name="item.content" item="vo"}
  101. <option value="{$key}" {in name="key" value="$item.value" }selected{/in}>{$vo}</option>
  102. {/foreach}
  103. </select>
  104. {/case}
  105. {case value="image" break="0"}{/case}
  106. {case value="images"}
  107. <div class="form-inline">
  108. <input id="c-{$item.name}" class="form-control" size="50" name="row[{$item.name}]" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}">
  109. <span><button type="button" id="plupload-{$item.name}" class="btn btn-danger plupload" data-input-id="c-{$item.name}" data-mimetype="image/*" data-multiple="{$item.type=='image'?'false':'true'}" data-preview-id="p-{$item.name}"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  110. <span><button type="button" id="fachoose-{$item.name}" class="btn btn-primary fachoose" data-input-id="c-{$item.name}" data-mimetype="image/*" data-multiple="{$item.type=='image'?'false':'true'}"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  111. <span class="msg-box n-right" for="c-{$item.name}"></span>
  112. <ul class="row list-inline plupload-preview" id="p-{$item.name}"></ul>
  113. </div>
  114. {/case}
  115. {case value="file" break="0"}{/case}
  116. {case value="files"}
  117. <div class="form-inline">
  118. <input id="c-{$item.name}" class="form-control" size="50" name="row[{$item.name}]" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}">
  119. <span><button type="button" id="plupload-{$item.name}" class="btn btn-danger plupload" data-input-id="c-{$item.name}" data-multiple="{$item.type=='file'?'false':'true'}"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  120. <span><button type="button" id="fachoose-{$item.name}" class="btn btn-primary fachoose" data-input-id="c-{$item.name}" data-multiple="{$item.type=='file'?'false':'true'}"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
  121. <span class="msg-box n-right" for="c-{$item.name}"></span>
  122. </div>
  123. {/case}
  124. {case switch}
  125. <input id="c-{$item.name}" name="row[{$item.name}]" type="hidden" value="{:$item.value?1:0}">
  126. <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-{$item.name}" data-yes="1" data-no="0">
  127. <i class="fa fa-toggle-on text-success {if !$item.value}fa-flip-horizontal text-gray{/if} fa-2x"></i>
  128. </a>
  129. {/case}
  130. {case bool}
  131. <label for="row[{$item.name}]-yes"><input id="row[{$item.name}]-yes" name="row[{$item.name}]" type="radio" value="1" {$item.value?'checked':''} data-tip="{$item.tip}" /> {:__('Yes')}</label>
  132. <label for="row[{$item.name}]-no"><input id="row[{$item.name}]-no" name="row[{$item.name}]" type="radio" value="0" {$item.value?'':'checked'} data-tip="{$item.tip}" /> {:__('No')}</label>
  133. {/case}
  134. {case custom}
  135. {$item.extend}
  136. {/case}
  137. {/switch}
  138. </div>
  139. <div class="col-sm-4"></div>
  140. </div>
  141. </td>
  142. <td>{php}echo "{\$site.". $item['name'] . "}";{/php}</td>
  143. <td>{if $item['id']>17}<a href="javascript:;" class="btn-delcfg text-muted" data-name="{$item.name}"><i class="fa fa-times"></i></a>{/if}</td>
  144. </tr>
  145. {/foreach}
  146. </tbody>
  147. <tfoot>
  148. <tr>
  149. <td></td>
  150. <td>
  151. <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
  152. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  153. </td>
  154. <td></td>
  155. <td></td>
  156. </tr>
  157. </tfoot>
  158. </table>
  159. </form>
  160. </div>
  161. </div>
  162. {/foreach}
  163. <div class="tab-pane fade" id="addcfg">
  164. <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('general.config/add')}">
  165. {:token()}
  166. <div class="form-group">
  167. <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
  168. <div class="col-xs-12 col-sm-4">
  169. <select name="row[type]" class="form-control selectpicker">
  170. {foreach name="typeList" item="vo"}
  171. <option value="{$key}" {in name="key" value="string" }selected{/in}>{$vo}</option>
  172. {/foreach}
  173. </select>
  174. </div>
  175. </div>
  176. <div class="form-group">
  177. <label class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
  178. <div class="col-xs-12 col-sm-4">
  179. <select name="row[group]" class="form-control selectpicker">
  180. {foreach name="groupList" item="vo"}
  181. <option value="{$key}" {in name="key" value="basic" }selected{/in}>{$vo}</option>
  182. {/foreach}
  183. </select>
  184. </div>
  185. </div>
  186. <div class="form-group">
  187. <label for="name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
  188. <div class="col-xs-12 col-sm-4">
  189. <input type="text" class="form-control" id="name" name="row[name]" value="" data-rule="required; length(3~30); remote(general/config/check)"/>
  190. </div>
  191. </div>
  192. <div class="form-group">
  193. <label for="title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
  194. <div class="col-xs-12 col-sm-4">
  195. <input type="text" class="form-control" id="title" name="row[title]" value="" data-rule="required"/>
  196. </div>
  197. </div>
  198. <div class="form-group">
  199. <label for="value" class="control-label col-xs-12 col-sm-2">{:__('Value')}:</label>
  200. <div class="col-xs-12 col-sm-4">
  201. <input type="text" class="form-control" id="value" name="row[value]" value="" data-rule=""/>
  202. </div>
  203. </div>
  204. <div class="form-group hide" id="add-content-container">
  205. <label for="content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
  206. <div class="col-xs-12 col-sm-4">
  207. <textarea name="row[content]" id="content" cols="30" rows="5" class="form-control" data-rule="required(content)">value1|title1
  208. value2|title2</textarea>
  209. </div>
  210. </div>
  211. <div class="form-group">
  212. <label for="tip" class="control-label col-xs-12 col-sm-2">{:__('Tip')}:</label>
  213. <div class="col-xs-12 col-sm-4">
  214. <input type="text" class="form-control" id="tip" name="row[tip]" value="" data-rule=""/>
  215. </div>
  216. </div>
  217. <div class="form-group">
  218. <label for="rule" class="control-label col-xs-12 col-sm-2">{:__('Rule')}:</label>
  219. <div class="col-xs-12 col-sm-4">
  220. <div class="input-group pull-left">
  221. <input type="text" class="form-control" id="rule" name="row[rule]" value="" data-tip="{:__('Rule tips')}"/>
  222. <span class="input-group-btn">
  223. <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown" type="button">{:__('Choose')}</button>
  224. <ul class="dropdown-menu pull-right rulelist">
  225. {volist name="ruleList" id="item"}
  226. <li><a href="javascript:;" data-value="{$key}">{$item}<span class="text-muted">({$key})</span></a></li>
  227. {/volist}
  228. </ul>
  229. </span>
  230. </div>
  231. <span class="msg-box n-right" for="rule"></span>
  232. </div>
  233. </div>
  234. <div class="form-group">
  235. <label for="extend" class="control-label col-xs-12 col-sm-2">{:__('Extend')}:</label>
  236. <div class="col-xs-12 col-sm-4">
  237. <textarea name="row[extend]" id="extend" cols="30" rows="5" class="form-control" data-tip="{:__('Extend tips')}" data-rule="required(extend)" data-msg-extend="当类型为自定义时,扩展属性不能为空"></textarea>
  238. </div>
  239. </div>
  240. <div class="form-group">
  241. <label class="control-label col-xs-12 col-sm-2"></label>
  242. <div class="col-xs-12 col-sm-4">
  243. <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
  244. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  245. </div>
  246. </div>
  247. </form>
  248. </div>
  249. </div>
  250. </div>
  251. </div>