usergroup.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <{include file="admin/permission/header.html"}>
  2. <{include file="admin/permission/nav.html"}>
  3. <div class="container">
  4. <div class="label label-default">所属用户组</div>
  5. <table class="table table-condensed table-hover">
  6. <tr>
  7. <th width=50></th>
  8. <th width=16%>所属用户组</th>
  9. <th width=16%></th>
  10. <th width=16%>基础设置</th>
  11. <th>权限管理</th>
  12. <th width=16%>操作</th>
  13. </tr>
  14. <{foreach from=$groups item=groupInfo}>
  15. <tr>
  16. <td></td>
  17. <td><{$groupInfo.description}></td>
  18. <td style='color:#CCCCCC'>groupid : <{$groupInfo.id}></td>
  19. <td><a href="<{$web_cfg.domain}>?c=permission&a=editUsergroup&groupid=<{$groupInfo.id}>" >基础设置</a></td>
  20. <td><a href="<{$web_cfg.domain}>?c=permission&a=usergroupCpt&groupid=<{$groupInfo.id}>" >权限管理</a></td>
  21. <td><a class="del_usergroup_btn" href="<{$web_cfg.domain}>?c=permission&a=delUsergroup&groupid=<{$groupInfo.id}>" >删除</a></td>
  22. </tr>
  23. <{/foreach}>
  24. </table>
  25. <div class="label label-default">可管理的用户组</div>
  26. <table class="table table-condensed table-hover">
  27. <tr>
  28. <th width=50></th>
  29. <th width=16%>可管理用户组</th>
  30. <th width=16%></th>
  31. <th width=16%>基础设置</th>
  32. <th>权限管理</th>
  33. <th width=16%>操作</th>
  34. </tr>
  35. <{foreach from=$manageGroups item=groupInfo}>
  36. <tr>
  37. <td></td>
  38. <td><{$groupInfo.description}></td>
  39. <td style='color:#CCCCCC'>groupid : <{$groupInfo.id}></td>
  40. <td><a href="<{$web_cfg.domain}>?c=permission&a=editUsergroup&groupid=<{$groupInfo.id}>" >基础设置</a></td>
  41. <td><a href="<{$web_cfg.domain}>?c=permission&a=usergroupCpt&groupid=<{$groupInfo.id}>" >权限管理</a></td>
  42. <td><a class="del_usergroup_btn" href="<{$web_cfg.domain}>?c=permission&a=delUsergroup&groupid=<{$groupInfo.id}>" >删除</a></td>
  43. </tr>
  44. <{/foreach}>
  45. <tr>
  46. <td colspan=6>
  47. <div class="input-group input-group-sm" style="width:250px;">
  48. <span class="input-group-addon">新增</span>
  49. <input id='c' type="hidden" value="permission" />
  50. <input id='a' type="hidden" value="addUsergroup" />
  51. <input id="description" name="description" type="text" class="input-sm form-control" placeholder="用户组名称"/>
  52. <span class="input-group-btn">
  53. <input type="submit" value="提交" id="add_new_group_btn" class="btn btn-default btn-sm btn-primary"/>
  54. </span>
  55. </div>
  56. </td>
  57. </tr>
  58. </table>
  59. </div>
  60. <script>
  61. KISSY.use('node,io,event,overlay,button,component/plugin/drag,overlay/assets/kif-cpt.css', function (S, Node, IO, UA, O, B, DragPlugin) {
  62. var $ = S.all;
  63. //提交
  64. $('#add_new_group_btn').on('click', function () {
  65. var new_group_name = S.trim($('#description').val());
  66. if (new_group_name == '') {
  67. alert('请填写增加的组名称');
  68. return false;
  69. }
  70. //获取可以当前登陆用户可以管理的用户组
  71. new IO({
  72. dataType:'json'
  73. , url: '<{$web_cfg.domain}>'
  74. , data: {
  75. c: 'permission'
  76. ,a: 'UsergroupsOfAllowAssign'
  77. }
  78. , success: function (data) {
  79. if (data.ok) {
  80. var content = '<div class="km-header">把“<font color=red>'+new_group_name+'组</font>”分配给以下哪些组管理</div>';
  81. content += data.msg;
  82. content += '<div class="btn-group"><span class="confirm_btn btn btn-primary btn-xs"></span><span class="closed_btn btn btn-primary btn-xs"></span></div>';
  83. render(content);
  84. } else {
  85. alert('操作失败');
  86. }
  87. }
  88. });
  89. return false;
  90. });
  91. //确认
  92. function confirm_btn() {
  93. var new_group_name = S.trim($('#description').val());
  94. var checked_groupids = [];
  95. var i=0;
  96. $('.manage_groupid').each(function () {
  97. if ($(this).attr('checked')) {
  98. checked_groupids[i] = $(this).val();
  99. i++;
  100. }
  101. });
  102. new IO({
  103. dataType: 'json'
  104. , url: '<{$web_cfg.domain}>'
  105. , data: {
  106. c: 'permission'
  107. ,a: 'addUsergroup'
  108. ,description: new_group_name
  109. ,parent_groupids: checked_groupids.join(',')
  110. }
  111. , success: function (data) {
  112. if (data.ok) {
  113. alert('创建成功');
  114. } else {
  115. alert('创建失败');
  116. }
  117. location.reload();
  118. }
  119. });
  120. }
  121. function render(content) {
  122. var dialog = new O({
  123. width: 300,
  124. content: content,
  125. closable: false,
  126. mask:true,
  127. align: {
  128. points: ['cc', 'cc']
  129. }
  130. });
  131. if (UA.ie == 6) {
  132. Event.on(window, "scroll", center);
  133. }
  134. dialog.show();
  135. // 生成一个确认按钮
  136. var b1 = new B({
  137. content: " 确认 ",
  138. render: '.confirm_btn'
  139. });
  140. var b2 = new B({
  141. content: "取消",
  142. render: ".closed_btn"
  143. });
  144. // 插入到DOM中并显示
  145. b1.render();
  146. b2.render();
  147. // 确认按钮click事件
  148. b1.on('click', function () {
  149. confirm_btn();
  150. });
  151. // 取消按钮click事件
  152. b2.on('click', function () {
  153. dialog.destroy();
  154. });
  155. }
  156. $('.del_usergroup_btn').on('click', function () {
  157. if (!confirm('确定要删除?')) {
  158. return false;
  159. }
  160. });
  161. });
  162. </script>
  163. <{include file="admin/permission/bottom.html"}>