gadmin.add.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php defined('InShopNC') or exit('Access Invalid!');?>
  2. <div class="page">
  3. <div class="fixed-bar">
  4. <div class="item-title">
  5. <h3><?php echo $lang['nc_limit_manage'];?></h3>
  6. <?php echo $output['top_link'];?>
  7. </div>
  8. </div>
  9. <div class="fixed-empty"></div>
  10. <form id="add_form" method="post">
  11. <input type="hidden" name="form_submit" value="ok" />
  12. <table class="table tb-type2 nobdb">
  13. <tbody>
  14. <tr class="noborder">
  15. <td colspan="2" class="required"><label class="validation" for="admin_name"><?php echo $lang['gadmin_name'];?>:</label></td>
  16. </tr>
  17. <tr class="noborder">
  18. <td class="vatop rowform"><input type="text" id="gname" maxlength="40" name="gname" class="txt"></td>
  19. <td class="vatop tips"></td>
  20. </tr>
  21. <tr>
  22. <td colspan="2"><table class="table tb-type2 nomargin">
  23. <thead>
  24. <tr class="space">
  25. <th> <input id="limitAll" id="limitAll" value="1" type="checkbox">&nbsp;&nbsp;<?php echo $lang['admin_set_limt'];?></th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. <?php foreach((array)$output['limit'] as $k => $v) { ?>
  30. <tr>
  31. <td>
  32. <label style="width:100px"><?php echo (!empty($v['nav'])) ? $v['nav'] : '&nbsp;'; ?></label>
  33. <input id="limit<?php echo $k;?>" type="checkbox" onclick="selectLimit('limit<?php echo $k;?>')">
  34. <label for="limit<?php echo $k;?>"><b><?php echo $v['name'];?></b>&nbsp;&nbsp;</label>
  35. <?php foreach($v['child'] as $xk => $xv) { ?>
  36. <label><input nctype='limit' class="limit<?php echo $k;?>" type="checkbox" name="permission[]" value="<?php echo $xv['op'];?>">
  37. <?php echo $xv['name'];?>&nbsp;</label>
  38. <?php } ?>
  39. </td>
  40. </tr>
  41. <?php } ?>
  42. </tbody>
  43. </table></td>
  44. </tr>
  45. </tbody>
  46. <tfoot>
  47. <tr class="tfoot">
  48. <td colspan="2"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit'];?></span></a></td>
  49. </tr>
  50. </tfoot>
  51. </table>
  52. </form>
  53. </div>
  54. <script>
  55. function selectLimit(name){
  56. if($('#'+name).attr('checked')) {
  57. $('.'+name).attr('checked',true);
  58. }else {
  59. $('.'+name).attr('checked',false);
  60. }
  61. }
  62. $(document).ready(function(){
  63. //按钮先执行验证再提交表单
  64. $("#submitBtn").click(function(){
  65. if($("#add_form").valid()){
  66. $("#add_form").submit();
  67. }
  68. });
  69. $('#limitAll').click(function(){
  70. $('input[type="checkbox"]').attr('checked',$(this).attr('checked') == 'checked');
  71. });
  72. $("#add_form").validate({
  73. errorPlacement: function(error, element){
  74. error.appendTo(element.parent().parent().prev().find('td:first'));
  75. },
  76. rules : {
  77. gname : {
  78. required : true,
  79. remote : {
  80. url :'index.php?act=admin&op=ajax&branch=check_gadmin_name',
  81. type:'get',
  82. data:{
  83. gname : function(){
  84. return $('#gname').val();
  85. }
  86. }
  87. }
  88. }
  89. },
  90. messages : {
  91. gname : {
  92. required : '<?php echo $lang['nc_none_input'];?>',
  93. remote : '<?php echo $lang['admin_add_admin_not_exists'];?>'
  94. }
  95. }
  96. });
  97. });
  98. </script>