人人商城

fields.html 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. {template 'common/header-gw'}
  2. <ol class="breadcrumb">
  3. <li><a href="./?refresh"><i class="fa fa-home"></i></a></li>
  4. <li><a href="{url 'system/welcome'}">系统</a></li>
  5. <li class="active">字段管理</li>
  6. </ol>
  7. <ul class="nav nav-tabs">
  8. <li {if $do == 'display'}class="active"{/if}><a href="{url 'user/fields'}">字段管理</a></li>
  9. <li {if empty($id) && $do == 'post'}class="active"{/if}><a href="{url 'user/fields/post'}">添加字段</a></li>
  10. {if !empty($id) && $do == 'post'}<li class="active"><a href="{php echo url('user/fields/post', array('id' => $id));}">编辑字段</a></li>{/if}
  11. </ul>
  12. {if $do == 'display'}
  13. <form action="" method="post">
  14. <div class="table-responsive clearfix">
  15. <h5 class="page-header">字段管理</h5>
  16. <div class="panel panel-default">
  17. <div class="panel-body table-responsive">
  18. <table class="table table-hover">
  19. <thead class="navbar-inner">
  20. <tr>
  21. <th>排序</th>
  22. <th>字段名</th>
  23. <th>标题</th>
  24. <th>是否启用</th>
  25. <th>注册页显示</th>
  26. <th>是否必填</th>
  27. <th>操作</th>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. {loop $fields $field}
  32. <tr>
  33. <td>
  34. <input type="text" class="form-control" style="width:50%;" name="displayorder[{$field['id']}]" value="{$field['displayorder']}">
  35. </td>
  36. <td style="vertical-align:middle;"><div>{$field['field']}</div></td>
  37. <td style="vertical-align:middle;">{$field['title']}</td>
  38. <td style="vertical-align:middle;"><input type="checkbox" name="available[{$field['id']}]" value="1" {if $field['available']}checked{/if}/></td>
  39. <td style="vertical-align:middle;"><input type="checkbox" name="showinregister[{$field['id']}]" value="1" {if $field['showinregister']}checked{/if}/></td>
  40. <td style="vertical-align:middle;"><input type="checkbox" name="required[{$field['id']}]" value="1" {if $field['required']}checked{/if}/></td>
  41. <td style="vertical-align:middle;"><a href="{php echo url('user/fields/post', array('id' => $field['id']))}" title="编辑">编辑</a></td>
  42. </tr>
  43. {/loop}
  44. </tbody>
  45. </table>
  46. </div>
  47. </div>
  48. <div>
  49. <button type="submit" class="btn btn-primary col-lg-1" name="submit" value="提交">提交</button>
  50. <input type="hidden" name="token" value="{$_W['token']}" />
  51. </div>
  52. </div>
  53. </form>
  54. {elseif $do == 'post'}
  55. <div class="clearfix">
  56. <h5 class="page-header">编辑字段</h5>
  57. <form class="form-horizontal form" action="" method="post">
  58. <input type="hidden" name="id" value="{$item['id']}">
  59. <div class="form-group">
  60. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">字段</label>
  61. <div class="col-sm-10 col-xs-12">
  62. <input type="text" class="form-control" placeholder="请使用字母或数字或下划线组合字段名" name="field" value="{$item['field']}" {if !empty($item['field'])}readonly{/if}>
  63. </div>
  64. </div>
  65. <div class="form-group">
  66. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">字段长度</label>
  67. <div class="col-sm-10 col-xs-12">
  68. <select class="form-control" name="length" >
  69. <option value="64" {if $item['field_length'] == 64}selected{/if}>64</option>
  70. <option value="128" {if $item['field_length'] == 128}selected{/if}>128</option>
  71. <option value="255" {if $item['field_length'] == 255}selected{/if}>255</option>
  72. </select>
  73. </div>
  74. </div>
  75. <div class="form-group">
  76. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">排序</label>
  77. <div class="col-sm-10 col-xs-12">
  78. <input type="text" class="form-control" placeholder="" name="displayorder" value="{$item['displayorder']}">
  79. </div>
  80. </div>
  81. <div class="form-group">
  82. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">名称</label>
  83. <div class="col-sm-10 col-xs-12">
  84. <input type="text" class="form-control" placeholder="" name="title" value="{$item['title']}">
  85. <input type="hidden" name="name_old" value="{$item['Field']}">
  86. </div>
  87. </div>
  88. <div class="form-group">
  89. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">描述</label>
  90. <div class="col-sm-10 col-xs-12">
  91. <textarea style="height:100px;" class="form-control" name="description" cols="50">{$item['description']}</textarea>
  92. </div>
  93. </div>
  94. <div class="form-group">
  95. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">是否启用</label>
  96. <div class="col-sm-10 col-xs-12">
  97. <label for="radio_1" class="radio-inline"><input type="radio" name="available" id="radio_1" value="1" {if empty($item) || $item['available'] == 1} checked{/if} /> 是</label>
  98. <label for="radio_0" class="radio-inline"><input type="radio" name="available" id="radio_0" value="0" {if !empty($item) && $item['available'] == 0} checked{/if} /> 否</label>
  99. </div>
  100. </div>
  101. <div class="form-group">
  102. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">是否必填</label>
  103. <div class="col-sm-10 col-xs-12">
  104. <label for="radio_6" class="radio-inline"><input type="radio" name="required" id="radio_6" value="1" {if empty($item) || $item['required'] == 1} checked{/if} /> 是</label>
  105. <label for="radio_7" class="radio-inline"><input type="radio" name="required" id="radio_7" value="0" {if !empty($item) && $item['required'] == 0} checked{/if} /> 否</label>
  106. </div>
  107. </div>
  108. <div class="form-group">
  109. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">提交后不可修改</label>
  110. <div class="col-sm-10 col-xs-12">
  111. <label for="radio_3" class="radio-inline"><input type="radio" name="unchangeable" id="radio_3" value="1" {if empty($item) || $item['unchangeable'] == 1} checked{/if} /> 是</label>
  112. <label for="radio_2" class="radio-inline"><input type="radio" name="unchangeable" id="radio_2" value="0" {if !empty($item) && $item['unchangeable'] == 0} checked{/if} /> 否</label>
  113. </div>
  114. </div>
  115. <div class="form-group">
  116. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">在注册页面显示</label>
  117. <div class="col-sm-10 col-xs-12">
  118. <label for="radio_4" class="radio-inline"><input type="radio" name="showinregister" id="radio_4" value="1" {if empty($item) || $item['showinregister'] == 1} checked{/if} /> 是</label>
  119. <label for="radio_5" class="radio-inline"><input type="radio" name="showinregister" id="radio_5" value="0" {if !empty($item) && $item['showinregister'] == 0} checked{/if} /> 否</label>
  120. </div>
  121. </div>
  122. <div class="form-group">
  123. <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label"></label>
  124. <div class="col-sm-10 col-xs-12">
  125. <button type="submit" class="btn btn-primary" name="submit" value="提交">提交</button>
  126. <input type="hidden" name="token" value="{$_W['token']}" />
  127. </div>
  128. </div>
  129. </form>
  130. </div>
  131. <script>
  132. $('input[name="field"]').blur(function() {
  133. field_value = $(this).val();
  134. reg = /^[A-Za-z0-9_]*$/;
  135. if (!reg.test(field_value)) {
  136. $(this).val('');
  137. }
  138. })
  139. </script>
  140. {/if}
  141. {template 'common/footer-gw'}