config.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <form id="config-form" class="edit-form form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2. {if $addon.tips}
  3. <div class="alert {$addon.tips.extend|default='alert-info-light'}" style="margin-bottom:10px;">
  4. <b>{$addon.tips.title}</b><br>
  5. {$addon.tips.value}
  6. </div>
  7. {/if}
  8. <table class="table table-striped">
  9. <thead>
  10. <tr>
  11. <th width="15%">{:__('Title')}</th>
  12. <th width="85%">{:__('Value')}</th>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. {foreach $addon.config as $item}
  17. <tr>
  18. <td>{$item.title}</td>
  19. <td>
  20. <div class="row">
  21. <div class="col-sm-8 col-xs-12">
  22. {switch $item.type}
  23. {case string}
  24. <input {$item.extend} type="text" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
  25. {/case}
  26. {case text}
  27. <textarea {$item.extend} name="row[{$item.name}]" class="form-control" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}">{$item.value|htmlentities}</textarea>
  28. {/case}
  29. {case array}
  30. <dl class="fieldlist" data-name="row[{$item.name}]">
  31. <dd>
  32. <ins>{:__('Array key')}</ins>
  33. <ins>{:__('Array value')}</ins>
  34. </dd>
  35. <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
  36. <textarea name="row[{$item.name}]" cols="30" rows="5" class="hide">{$item.value|json_encode|htmlentities}</textarea>
  37. </dl>
  38. {/case}
  39. {case date}
  40. <input {$item.extend} 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}"/>
  41. {/case}
  42. {case time}
  43. <input {$item.extend} 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}"/>
  44. {/case}
  45. {case datetime}
  46. <input {$item.extend} 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}"/>
  47. {/case}
  48. {case number}
  49. <input {$item.extend} type="number" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  50. {/case}
  51. {case checkbox}
  52. {foreach name="item.content" item="vo"}
  53. <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>
  54. {/foreach}
  55. {/case}
  56. {case radio}
  57. {foreach name="item.content" item="vo"}
  58. <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>
  59. {/foreach}
  60. {/case}
  61. {case value="select" break="0"}{/case}
  62. {case value="selects"}
  63. <select {$item.extend} name="row[{$item.name}]{$item.type=='selects'?'[]':''}" class="form-control selectpicker" data-tip="{$item.tip}" {$item.type=='selects'?'multiple':''}>
  64. {foreach name="item.content" item="vo"}
  65. <option value="{$key}" {in name="key" value="$item.value" }selected{/in}>{$vo}</option>
  66. {/foreach}
  67. </select>
  68. {/case}
  69. {case value="image" break="0"}{/case}
  70. {case value="images"}
  71. <div class="input-group">
  72. <input {$item.extend} id="c-{$item.name}" class="form-control" size="50" name="row[{$item.name}]" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}" data-rule="{$item.rule}">
  73. <div class="input-group-addon no-border no-padding">
  74. <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>
  75. <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>
  76. </div>
  77. <span class="msg-box n-right" for="c-{$item.name}"></span>
  78. </div>
  79. <ul class="row list-inline faupload-preview" id="p-{$item.name}"></ul>
  80. {/case}
  81. {case value="file" break="0"}{/case}
  82. {case value="files"}
  83. <div class="input-group">
  84. <input {$item.extend} id="c-{$item.name}" class="form-control" size="50" name="row[{$item.name}]" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}" data-rule="{$item.rule}">
  85. <div class="input-group-addon no-border no-padding">
  86. <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'}" data-preview-id="p-{$item.name}"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  87. <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>
  88. </div>
  89. <span class="msg-box n-right" for="c-{$item.name}"></span>
  90. </div>
  91. <ul class="row list-inline faupload-preview" id="p-{$item.name}"></ul>
  92. {/case}
  93. {case bool}
  94. <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>
  95. <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>
  96. {/case}
  97. {default /}{$item.value}
  98. {/switch}
  99. </div>
  100. <div class="col-sm-4"></div>
  101. </div>
  102. </td>
  103. </tr>
  104. {/foreach}
  105. </tbody>
  106. </table>
  107. <div class="form-group layer-footer">
  108. <label class="control-label col-xs-12 col-sm-2"></label>
  109. <div class="col-xs-12 col-sm-8">
  110. <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  111. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  112. </div>
  113. </div>
  114. </form>