index.html 25 KB

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