gadmin_set.html 4.4 KB

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