index.html 25 KB

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