gadmin_add.html 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {include file="public/header" /}
  2. <div class="page">
  3. <form id="add_form" method="post">
  4. <table class="ds-default-table">
  5. <tbody>
  6. <tr class="noborder">
  7. <td class="required w120">{$Think.lang.gadmin_name}</td>
  8. <td class="vatop rowform">
  9. <input id="gname" name="gname" value="" class="input-txt" type="text">
  10. <span class="err"></span>
  11. </td>
  12. </tr>
  13. </tbody>
  14. </table>
  15. <table class="ds-default-table">
  16. <thead>
  17. <tr class="space">
  18. <th> <input id="limitAll" value="1" type="checkbox">&nbsp;&nbsp;{$Think.lang.admin_set_limt}</th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. {foreach name="limit" item="v" key="k" }
  23. <tr>
  24. <td>
  25. <label style="width:100px">{$v.nav|default=''}</label>
  26. <input id="limit{$k}" type="checkbox" onclick="selectLimit('limit{$k}')">
  27. <label for="limit{$k}"><b>{$v.name}</b>&nbsp;&nbsp;</label>
  28. {foreach name="$v.child" item="xv" key="xk" }
  29. <label><input dstype='limit' class="limit{$k}" type="checkbox" name="permission[]" value="{$xv.action}">{$xv.name}&nbsp;</label>
  30. {/foreach}
  31. </td>
  32. </tr>
  33. {/foreach}
  34. </tbody>
  35. </table>
  36. <table>
  37. <tfoot class="tfoot">
  38. <input class="btn" type="submit" value="{$Think.lang.ds_confirm_submit}"/>
  39. </tfoot>
  40. </table>
  41. </form>
  42. </div>
  43. <script>
  44. function selectLimit(name) {
  45. if ($('#'+name).prop('checked')) {
  46. $('.'+name).prop('checked', true);
  47. } else {
  48. $('.'+name).prop('checked', false);
  49. }
  50. }
  51. $(function() {
  52. $('#limitAll').on('click', function() {
  53. if ($(this).prop('checked')) {
  54. $(this).parents('table').find('input:checkbox').prop('checked', true);
  55. } else {
  56. $(this).parents('table').find('input:checkbox').prop('checked', false);
  57. }
  58. });
  59. $("#add_form").validate({
  60. errorPlacement: function(error, element) {
  61. error.appendTo(element.nextAll('span.err'));
  62. },
  63. rules: {
  64. gname: {
  65. required: true,
  66. remote: {
  67. url: ADMINSITEURL+'/admin/ajax.html?branch=check_gadmin_name',
  68. type: 'get',
  69. data: {
  70. gname: function() {
  71. return $('#gname').val();
  72. }
  73. }
  74. }
  75. }
  76. },
  77. messages: {
  78. gname: {
  79. required: '{$Think.lang.ds_none_input}',
  80. remote: '{$Think.lang.admin_add_admin_not_exists}'
  81. }
  82. }
  83. });
  84. });
  85. </script>