index.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. @media (max-width: 767px) {
  20. .edit-form table tr th:nth-last-child(-n + 2), .edit-form table tr td:nth-last-child(-n + 2) {
  21. display: none;
  22. }
  23. .edit-form table tr td .msg-box {
  24. display: none;
  25. }
  26. }
  27. </style>
  28. <div class="panel panel-default panel-intro">
  29. <div class="panel-heading">
  30. {:build_heading(null, false)}
  31. <ul class="nav nav-tabs">
  32. {foreach $siteList as $index=>$vo}
  33. <li class="{$vo.active?'active':''}"><a href="#{$vo.name}" data-toggle="tab">{:__($vo.title)}</a></li>
  34. {/foreach}
  35. <li data-toggle="tooltip" title="{:__('Add new config')}">
  36. <a href="#addcfg" data-toggle="tab"><i class="fa fa-plus"></i></a>
  37. </li>
  38. </ul>
  39. </div>
  40. <div class="panel-body">
  41. <div id="myTabContent" class="tab-content">
  42. <!--@formatter:off-->
  43. {foreach $siteList as $index=>$vo}
  44. <div class="tab-pane fade {$vo.active ? 'active in' : ''}" id="{$vo.name}">
  45. <div class="widget-body no-padding">
  46. <form id="{$vo.name}-form" class="edit-form form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('general.config/edit')}">
  47. {:token()}
  48. <table class="table table-striped">
  49. <thead>
  50. <tr>
  51. <th width="15%">{:__('Title')}</th>
  52. <th width="68%">{:__('Value')}</th>
  53. <th width="15%">{:__('Name')}</th>
  54. <th width="2%"></th>
  55. </tr>
  56. </thead>
  57. <tbody>
  58. {foreach $vo.list as $item}
  59. <tr>
  60. <td>{$item.title}</td>
  61. <td>
  62. <div class="row">
  63. <div class="col-sm-8 col-xs-12">
  64. {switch $item.type}
  65. {case string}
  66. <input {$item.extend_html} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
  67. {/case}
  68. {case password}
  69. <input {$item.extend_html} type="password" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
  70. {/case}
  71. {case text}
  72. <textarea {$item.extend_html} name="row[{$item.name}]" class="form-control" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}">{$item.value|htmlentities}</textarea>
  73. {/case}
  74. {case editor}
  75. <textarea {$item.extend_html} 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>
  76. {/case}
  77. {case array}
  78. <dl {$item.extend_html} class="fieldlist" data-name="row[{$item.name}]">
  79. <dd>
  80. <ins>{:isset($item["setting"]["key"])&&$item["setting"]["key"]?$item["setting"]["key"]:__('Array key')}</ins>
  81. <ins>{:isset($item["setting"]["value"])&&$item["setting"]["value"]?$item["setting"]["value"]:__('Array value')}</ins>
  82. </dd>
  83. <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
  84. <textarea name="row[{$item.name}]" class="form-control hide" cols="30" rows="5">{$item.value|htmlentities}</textarea>
  85. </dl>
  86. {/case}
  87. {case date}
  88. <input {$item.extend_html} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  89. {/case}
  90. {case time}
  91. <input {$item.extend_html} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control datetimepicker" data-date-format="HH:mm:ss" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  92. {/case}
  93. {case datetime}
  94. <input {$item.extend_html} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  95. {/case}
  96. {case datetimerange}
  97. <input {$item.extend_html} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control datetimerange" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  98. {/case}
  99. {case number}
  100. <input {$item.extend_html} type="number" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  101. {/case}
  102. {case checkbox}
  103. <div class="checkbox">
  104. {foreach name="item.content" item="vo"}
  105. <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>
  106. {/foreach}
  107. </div>
  108. {/case}
  109. {case radio}
  110. <div class="radio">
  111. {foreach name="item.content" item="vo"}
  112. <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>
  113. {/foreach}
  114. </div>
  115. {/case}
  116. {case value="select" break="0"}{/case}
  117. {case value="selects"}
  118. <select {$item.extend_html} name="row[{$item.name}]{$item.type=='selects'?'[]':''}" class="form-control selectpicker" data-tip="{$item.tip}" {$item.type=='selects'?'multiple':''}>
  119. {foreach name="item.content" item="vo"}
  120. <option value="{$key}" {in name="key" value="$item.value" }selected{/in}>{$vo}</option>
  121. {/foreach}
  122. </select>
  123. {/case}
  124. {case value="image" break="0"}{/case}
  125. {case value="images"}
  126. <div class="form-inline">
  127. <input id="c-{$item.name}" class="form-control" size="50" name="row[{$item.name}]" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}">
  128. <span><button type="button" id="faupload-{$item.name}" class="btn btn-danger faupload" 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>
  129. <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>
  130. <span class="msg-box n-right" for="c-{$item.name}"></span>
  131. <ul class="row list-inline faupload-preview" id="p-{$item.name}"></ul>
  132. </div>
  133. {/case}
  134. {case value="file" break="0"}{/case}
  135. {case value="files"}
  136. <div class="form-inline">
  137. <input id="c-{$item.name}" class="form-control" size="50" name="row[{$item.name}]" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}">
  138. <span><button type="button" id="faupload-{$item.name}" class="btn btn-danger faupload" data-input-id="c-{$item.name}" data-multiple="{$item.type=='file'?'false':'true'}"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  139. <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>
  140. <span class="msg-box n-right" for="c-{$item.name}"></span>
  141. </div>
  142. {/case}
  143. {case switch}
  144. <input id="c-{$item.name}" name="row[{$item.name}]" type="hidden" value="{:$item.value?1:0}">
  145. <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-{$item.name}" data-yes="1" data-no="0">
  146. <i class="fa fa-toggle-on text-success {if !$item.value}fa-flip-horizontal text-gray{/if} fa-2x"></i>
  147. </a>
  148. {/case}
  149. {case bool}
  150. <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>
  151. <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>
  152. {/case}
  153. {case city}
  154. <div style="position:relative">
  155. <input {$item.extend_html} type="text" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value|htmlentities}" class="form-control" data-toggle="city-picker" data-tip="{$item.tip}" data-rule="{$item.rule}" />
  156. </div>
  157. {/case}
  158. {case value="selectpage" break="0"}{/case}
  159. {case value="selectpages"}
  160. <input {$item.extend_html} type="text" name="row[{$item.name}]" id="c-{$item.name}" value="{$item.value|htmlentities}" class="form-control selectpage" data-source="{:url('general.config/selectpage')}?id={$item.id}" data-primary-key="{$item.setting.primarykey}" data-field="{$item.setting.field}" data-multiple="{$item.type=='selectpage'?'false':'true'}" data-tip="{$item.tip}" data-rule="{$item.rule}" />
  161. {/case}
  162. {case custom}
  163. {$item.extend_html}
  164. {/case}
  165. {/switch}
  166. </div>
  167. <div class="col-sm-4"></div>
  168. </div>
  169. </td>
  170. <td>{php}echo "{\$site.". $item['name'] . "}";{/php}</td>
  171. <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>
  172. </tr>
  173. {/foreach}
  174. </tbody>
  175. <tfoot>
  176. <tr>
  177. <td></td>
  178. <td>
  179. <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
  180. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  181. </td>
  182. <td></td>
  183. <td></td>
  184. </tr>
  185. </tfoot>
  186. </table>
  187. </form>
  188. </div>
  189. </div>
  190. {/foreach}
  191. <div class="tab-pane fade" id="addcfg">
  192. <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('general.config/add')}">
  193. {:token()}
  194. <div class="form-group">
  195. <label class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
  196. <div class="col-xs-12 col-sm-4">
  197. <select name="row[group]" class="form-control selectpicker">
  198. {foreach name="groupList" item="vo"}
  199. <option value="{$key}" {in name="key" value="basic" }selected{/in}>{$vo}</option>
  200. {/foreach}
  201. </select>
  202. </div>
  203. </div>
  204. <div class="form-group">
  205. <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
  206. <div class="col-xs-12 col-sm-4">
  207. <select name="row[type]" id="c-type" class="form-control selectpicker">
  208. {foreach name="typeList" item="vo"}
  209. <option value="{$key}" {in name="key" value="string" }selected{/in}>{$vo}</option>
  210. {/foreach}
  211. </select>
  212. </div>
  213. </div>
  214. <div class="form-group">
  215. <label for="name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
  216. <div class="col-xs-12 col-sm-4">
  217. <input type="text" class="form-control" id="name" name="row[name]" value="" data-rule="required; length(3~30); remote(general/config/check)"/>
  218. </div>
  219. </div>
  220. <div class="form-group">
  221. <label for="title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
  222. <div class="col-xs-12 col-sm-4">
  223. <input type="text" class="form-control" id="title" name="row[title]" value="" data-rule="required"/>
  224. </div>
  225. </div>
  226. <div class="form-group hidden tf tf-selectpage tf-selectpages">
  227. <label for="c-selectpage-table" class="control-label col-xs-12 col-sm-2">{:__('Selectpage table')}:</label>
  228. <div class="col-xs-12 col-sm-4">
  229. <select id="c-selectpage-table" name="row[setting][table]" class="form-control selectpicker" data-live-search="true">
  230. <option value="">{:__('Please select table')}</option>
  231. </select>
  232. </div>
  233. </div>
  234. <div class="form-group hidden tf tf-selectpage tf-selectpages">
  235. <label for="c-selectpage-primarykey" class="control-label col-xs-12 col-sm-2">{:__('Selectpage primarykey')}:</label>
  236. <div class="col-xs-12 col-sm-4">
  237. <select name="row[setting][primarykey]" class="form-control selectpicker" id="c-selectpage-primarykey"></select>
  238. </div>
  239. </div>
  240. <div class="form-group hidden tf tf-selectpage tf-selectpages">
  241. <label for="c-selectpage-field" class="control-label col-xs-12 col-sm-2">{:__('Selectpage field')}:</label>
  242. <div class="col-xs-12 col-sm-4">
  243. <select name="row[setting][field]" class="form-control selectpicker" id="c-selectpage-field"></select>
  244. </div>
  245. </div>
  246. <div class="form-group hidden tf tf-selectpage tf-selectpages">
  247. <label class="control-label col-xs-12 col-sm-2">{:__('Selectpage conditions')}:</label>
  248. <div class="col-xs-12 col-sm-8">
  249. <dl class="fieldlist" data-name="row[setting][conditions]">
  250. <dd>
  251. <ins>{:__('Field title')}</ins>
  252. <ins>{:__('Field value')}</ins>
  253. </dd>
  254. <dd><a href="javascript:;" class="append btn btn-sm btn-success"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
  255. <textarea name="row[setting][conditions]" class="form-control hide" cols="30" rows="5"></textarea>
  256. </dl>
  257. </div>
  258. </div>
  259. <div class="form-group hidden tf tf-array">
  260. <label for="c-array-key" class="control-label col-xs-12 col-sm-2">{:__('Array key')}:</label>
  261. <div class="col-xs-12 col-sm-4">
  262. <input type="text" name="row[setting][key]" class="form-control" id="c-array-key">
  263. </div>
  264. </div>
  265. <div class="form-group hidden tf tf-array">
  266. <label for="c-array-value" class="control-label col-xs-12 col-sm-2">{:__('Array value')}:</label>
  267. <div class="col-xs-12 col-sm-4">
  268. <input type="text" name="row[setting][value]" class="form-control" id="c-array-value">
  269. </div>
  270. </div>
  271. <div class="form-group">
  272. <label for="value" class="control-label col-xs-12 col-sm-2">{:__('Value')}:</label>
  273. <div class="col-xs-12 col-sm-4">
  274. <input type="text" class="form-control" id="value" name="row[value]" value="" data-rule=""/>
  275. </div>
  276. </div>
  277. <div class="form-group hide" id="add-content-container">
  278. <label for="content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
  279. <div class="col-xs-12 col-sm-4">
  280. <textarea name="row[content]" id="content" cols="30" rows="5" class="form-control" data-rule="required(content)">value1|title1
  281. value2|title2</textarea>
  282. </div>
  283. </div>
  284. <div class="form-group">
  285. <label for="tip" class="control-label col-xs-12 col-sm-2">{:__('Tip')}:</label>
  286. <div class="col-xs-12 col-sm-4">
  287. <input type="text" class="form-control" id="tip" name="row[tip]" value="" data-rule=""/>
  288. </div>
  289. </div>
  290. <div class="form-group">
  291. <label for="rule" class="control-label col-xs-12 col-sm-2">{:__('Rule')}:</label>
  292. <div class="col-xs-12 col-sm-4">
  293. <div class="input-group pull-left">
  294. <input type="text" class="form-control" id="rule" name="row[rule]" value="" data-tip="{:__('Rule tips')}"/>
  295. <span class="input-group-btn">
  296. <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown" type="button">{:__('Choose')}</button>
  297. <ul class="dropdown-menu pull-right rulelist">
  298. {volist name="ruleList" id="item"}
  299. <li><a href="javascript:;" data-value="{$key}">{$item}<span class="text-muted">({$key})</span></a></li>
  300. {/volist}
  301. </ul>
  302. </span>
  303. </div>
  304. <span class="msg-box n-right" for="rule"></span>
  305. </div>
  306. </div>
  307. <div class="form-group">
  308. <label for="extend" class="control-label col-xs-12 col-sm-2">{:__('Extend')}:</label>
  309. <div class="col-xs-12 col-sm-4">
  310. <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>
  311. </div>
  312. </div>
  313. <div class="form-group">
  314. <label class="control-label col-xs-12 col-sm-2"></label>
  315. <div class="col-xs-12 col-sm-4">
  316. <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}</button>
  317. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  318. </div>
  319. </div>
  320. </form>
  321. </div>
  322. <!--@formatter:on-->
  323. </div>
  324. </div>
  325. </div>