config.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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="form-inline">
  72. <input id="c-{$item.name}" class="form-control" size="35" name="row[{$item.name}]" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}">
  73. <span><button type="button" id="plupload-{$item.name}" class="btn btn-danger plupload" 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>
  74. <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>
  75. <ul class="row list-inline plupload-preview" id="p-{$item.name}"></ul>
  76. </div>
  77. {/case}
  78. {case value="file" break="0"}{/case}
  79. {case value="files"}
  80. <div class="form-inline">
  81. <input id="c-{$item.name}" class="form-control" size="35" name="row[{$item.name}]" type="text" value="{$item.value|htmlentities}" data-tip="{$item.tip}">
  82. <span><button type="button" id="plupload-{$item.name}" class="btn btn-danger plupload" data-input-id="c-{$item.name}" data-multiple="{$item.type=='file'?'false':'true'}"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
  83. <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>
  84. </div>
  85. {/case}
  86. {case bool}
  87. <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>
  88. <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>
  89. {/case}
  90. {default /}{$item.value}
  91. {/switch}
  92. </div>
  93. <div class="col-sm-4"></div>
  94. </div>
  95. </td>
  96. </tr>
  97. {/foreach}
  98. </tbody>
  99. </table>
  100. <div class="form-group layer-footer">
  101. <label class="control-label col-xs-12 col-sm-2"></label>
  102. <div class="col-xs-12 col-sm-8">
  103. <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  104. <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  105. </div>
  106. </div>
  107. </form>