config.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 password}
  27. <input {$item.extend} type="password" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-rule="{$item.rule}" data-tip="{$item.tip}"/>
  28. {/case}
  29. {case text}
  30. <textarea {$item.extend} name="row[{$item.name}]" class="form-control" data-rule="{$item.rule}" rows="5" data-tip="{$item.tip}">{$item.value|htmlentities}</textarea>
  31. {/case}
  32. {case array}
  33. <dl class="fieldlist" data-name="row[{$item.name}]">
  34. <dd>
  35. <ins>{:__('Array key')}</ins>
  36. <ins>{:__('Array value')}</ins>
  37. </dd>
  38. <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
  39. <textarea name="row[{$item.name}]" cols="30" rows="5" class="hide">{$item.value|json_encode|htmlentities}</textarea>
  40. </dl>
  41. {/case}
  42. {case date}
  43. <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}"/>
  44. {/case}
  45. {case time}
  46. <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}"/>
  47. {/case}
  48. {case datetime}
  49. <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}"/>
  50. {/case}
  51. {case number}
  52. <input {$item.extend} type="number" name="row[{$item.name}]" value="{$item.value|htmlentities}" class="form-control" data-tip="{$item.tip}" data-rule="{$item.rule}"/>
  53. {/case}
  54. {case checkbox}
  55. {foreach name="item.content" item="vo"}
  56. <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>
  57. {/foreach}
  58. {/case}
  59. {case radio}
  60. {foreach name="item.content" item="vo"}
  61. <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>
  62. {/foreach}
  63. {/case}
  64. {case value="select" break="0"}{/case}
  65. {case value="selects"}
  66. <select {$item.extend} name="row[{$item.name}]{$item.type=='selects'?'[]':''}" class="form-control selectpicker" data-tip="{$item.tip}" {$item.type=='selects'?'multiple':''}>
  67. {foreach name="item.content" item="vo"}
  68. <option value="{$key}" {in name="key" value="$item.value" }selected{/in}>{$vo}</option>
  69. {/foreach}
  70. </select>
  71. {/case}
  72. {case value="image" break="0"}{/case}
  73. {case value="images"}
  74. <div class="input-group">
  75. <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}">
  76. <div class="input-group-addon no-border no-padding">
  77. <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>
  78. <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>
  79. </div>
  80. <span class="msg-box n-right" for="c-{$item.name}"></span>
  81. </div>
  82. <ul class="row list-inline faupload-preview" id="p-{$item.name}"></ul>
  83. {/case}
  84. {case value="file" break="0"}{/case}
  85. {case value="files"}
  86. <div class="input-group">
  87. <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}">
  88. <div class="input-group-addon no-border no-padding">
  89. <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>
  90. <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>
  91. </div>
  92. <span class="msg-box n-right" for="c-{$item.name}"></span>
  93. </div>
  94. <ul class="row list-inline faupload-preview" id="p-{$item.name}"></ul>
  95. {/case}
  96. {case bool}
  97. <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>
  98. <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>
  99. {/case}
  100. {default /}{$item.value}
  101. {/switch}
  102. </div>
  103. <div class="col-sm-4"></div>
  104. </div>
  105. </td>
  106. </tr>
  107. {/foreach}
  108. </tbody>
  109. </table>
  110. <div class="form-group layer-footer">
  111. <label class="control-label col-xs-12 col-sm-2"></label>
  112. <div class="col-xs-12 col-sm-8">
  113. <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  114. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  115. </div>
  116. </div>
  117. </form>