indexnew.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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. </div>
  180. </td>
  181. {if $Think.config.app_debug}
  182. <td></td>
  183. <td></td>
  184. {/if}
  185. </tr>
  186. </tfoot>
  187. </table>
  188. </form>
  189. </div>
  190. </div>
  191. {/foreach}
  192. <div class="tab-pane fade" id="addcfg">
  193. <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('general.config/add')}">
  194. {:token()}
  195. <div class="form-group">
  196. <label class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
  197. <div class="col-xs-12 col-sm-4">
  198. <select name="row[group]" class="form-control selectpicker">
  199. {foreach name="groupList" item="vo"}
  200. <option value="{$key}" {in name="key" value="basic" }selected{/in}>{$vo}</option>
  201. {/foreach}
  202. </select>
  203. </div>
  204. </div>
  205. <div class="form-group">
  206. <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
  207. <div class="col-xs-12 col-sm-4">
  208. <select name="row[type]" id="c-type" class="form-control selectpicker">
  209. {foreach name="typeList" item="vo"}
  210. <option value="{$key}" {in name="key" value="string" }selected{/in}>{$vo}</option>
  211. {/foreach}
  212. </select>
  213. </div>
  214. </div>
  215. <div class="form-group">
  216. <label for="name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
  217. <div class="col-xs-12 col-sm-4">
  218. <input type="text" class="form-control" id="name" name="row[name]" value="" data-rule="required; length(3~50); remote(general/config/check)"/>
  219. </div>
  220. </div>
  221. <div class="form-group">
  222. <label for="title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
  223. <div class="col-xs-12 col-sm-4">
  224. <input type="text" class="form-control" id="title" name="row[title]" value="" data-rule="required"/>
  225. </div>
  226. </div>
  227. <div class="form-group hidden tf tf-selectpage tf-selectpages">
  228. <label for="c-selectpage-table" class="control-label col-xs-12 col-sm-2">{:__('Selectpage table')}:</label>
  229. <div class="col-xs-12 col-sm-4">
  230. <select id="c-selectpage-table" name="row[setting][table]" class="form-control selectpicker" data-live-search="true">
  231. <option value="">{:__('Please select table')}</option>
  232. </select>
  233. </div>
  234. </div>
  235. <div class="form-group hidden tf tf-selectpage tf-selectpages">
  236. <label for="c-selectpage-primarykey" class="control-label col-xs-12 col-sm-2">{:__('Selectpage primarykey')}:</label>
  237. <div class="col-xs-12 col-sm-4">
  238. <select name="row[setting][primarykey]" class="form-control selectpicker" id="c-selectpage-primarykey"></select>
  239. </div>
  240. </div>
  241. <div class="form-group hidden tf tf-selectpage tf-selectpages">
  242. <label for="c-selectpage-field" class="control-label col-xs-12 col-sm-2">{:__('Selectpage field')}:</label>
  243. <div class="col-xs-12 col-sm-4">
  244. <select name="row[setting][field]" class="form-control selectpicker" id="c-selectpage-field"></select>
  245. </div>
  246. </div>
  247. <div class="form-group hidden tf tf-selectpage tf-selectpages">
  248. <label class="control-label col-xs-12 col-sm-2">{:__('Selectpage conditions')}:</label>
  249. <div class="col-xs-12 col-sm-8">
  250. <dl class="fieldlist" data-name="row[setting][conditions]">
  251. <dd>
  252. <ins>{:__('Field title')}</ins>
  253. <ins>{:__('Field value')}</ins>
  254. </dd>
  255. <dd><a href="javascript:;" class="append btn btn-sm btn-success"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
  256. <textarea name="row[setting][conditions]" class="form-control hide" cols="30" rows="5"></textarea>
  257. </dl>
  258. </div>
  259. </div>
  260. <div class="form-group hidden tf tf-array">
  261. <label for="c-array-key" class="control-label col-xs-12 col-sm-2">{:__('Array key')}:</label>
  262. <div class="col-xs-12 col-sm-4">
  263. <input type="text" name="row[setting][key]" class="form-control" id="c-array-key">
  264. </div>
  265. </div>
  266. <div class="form-group hidden tf tf-array">
  267. <label for="c-array-value" class="control-label col-xs-12 col-sm-2">{:__('Array value')}:</label>
  268. <div class="col-xs-12 col-sm-4">
  269. <input type="text" name="row[setting][value]" class="form-control" id="c-array-value">
  270. </div>
  271. </div>
  272. <div class="form-group">
  273. <label for="value" class="control-label col-xs-12 col-sm-2">{:__('Value')}:</label>
  274. <div class="col-xs-12 col-sm-4">
  275. <input type="text" class="form-control" id="value" name="row[value]" value="" data-rule=""/>
  276. </div>
  277. </div>
  278. <div class="form-group hide" id="add-content-container">
  279. <label for="content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
  280. <div class="col-xs-12 col-sm-4">
  281. <textarea name="row[content]" id="content" cols="30" rows="5" class="form-control" data-rule="required(content)">value1|title1
  282. value2|title2</textarea>
  283. </div>
  284. </div>
  285. <div class="form-group">
  286. <label for="tip" class="control-label col-xs-12 col-sm-2">{:__('Tip')}:</label>
  287. <div class="col-xs-12 col-sm-4">
  288. <input type="text" class="form-control" id="tip" name="row[tip]" value="" data-rule=""/>
  289. </div>
  290. </div>
  291. <div class="form-group">
  292. <label for="rule" class="control-label col-xs-12 col-sm-2">{:__('Rule')}:</label>
  293. <div class="col-xs-12 col-sm-4">
  294. <div class="input-group pull-left">
  295. <input type="text" class="form-control" id="rule" name="row[rule]" value="" data-tip="{:__('Rule tips')}"/>
  296. <span class="input-group-btn">
  297. <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown" type="button">{:__('Choose')}</button>
  298. <ul class="dropdown-menu pull-right rulelist">
  299. {volist name="ruleList" id="item"}
  300. <li><a href="javascript:;" data-value="{$key}">{$item}<span class="text-muted">({$key})</span></a></li>
  301. {/volist}
  302. </ul>
  303. </span>
  304. </div>
  305. <span class="msg-box n-right" for="rule"></span>
  306. </div>
  307. </div>
  308. <div class="form-group">
  309. <label for="visible" class="control-label col-xs-12 col-sm-2">{:__('Visible condition')}:</label>
  310. <div class="col-xs-12 col-sm-4">
  311. <input type="text" class="form-control" id="visible" name="row[visible]" value="" data-rule=""/>
  312. </div>
  313. </div>
  314. <div class="form-group">
  315. <label for="extend" class="control-label col-xs-12 col-sm-2">{:__('Extend')}:</label>
  316. <div class="col-xs-12 col-sm-4">
  317. <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>
  318. </div>
  319. </div>
  320. <div class="form-group">
  321. <label class="control-label col-xs-12 col-sm-2"></label>
  322. <div class="col-xs-12 col-sm-4">
  323. {if !$Think.config.app_debug}
  324. <button type="button" class="btn btn-primary disabled">{:__('Only work at development environment')}</button>
  325. {else/}
  326. <button type="submit" class="btn btn-primary btn-embossed">{:__('OK')}</button>
  327. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  328. {/if}
  329. </div>
  330. </div>
  331. </form>
  332. </div>
  333. <!--@formatter:on-->
  334. </div>
  335. </div>
  336. </div>