123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <{include file="admin/permission/header.html"}>
- <{include file="admin/permission/nav.html"}>
- <div class="container">
- <div class="label label-default">所属用户组</div>
- <table class="table table-condensed table-hover">
- <tr>
- <th width=50></th>
- <th width=16%>所属用户组</th>
- <th width=16%></th>
- <th width=16%>基础设置</th>
- <th>权限管理</th>
- <th width=16%>操作</th>
- </tr>
- <{foreach from=$groups item=groupInfo}>
- <tr>
- <td></td>
- <td><{$groupInfo.description}></td>
- <td style='color:#CCCCCC'>groupid : <{$groupInfo.id}></td>
- <td><a href="<{$web_cfg.domain}>?c=permission&a=editUsergroup&groupid=<{$groupInfo.id}>" >基础设置</a></td>
- <td><a href="<{$web_cfg.domain}>?c=permission&a=usergroupCpt&groupid=<{$groupInfo.id}>" >权限管理</a></td>
- <td><a class="del_usergroup_btn" href="<{$web_cfg.domain}>?c=permission&a=delUsergroup&groupid=<{$groupInfo.id}>" >删除</a></td>
- </tr>
- <{/foreach}>
- </table>
- <div class="label label-default">可管理的用户组</div>
- <table class="table table-condensed table-hover">
- <tr>
- <th width=50></th>
- <th width=16%>可管理用户组</th>
- <th width=16%></th>
- <th width=16%>基础设置</th>
- <th>权限管理</th>
- <th width=16%>操作</th>
- </tr>
- <{foreach from=$manageGroups item=groupInfo}>
- <tr>
- <td></td>
- <td><{$groupInfo.description}></td>
- <td style='color:#CCCCCC'>groupid : <{$groupInfo.id}></td>
- <td><a href="<{$web_cfg.domain}>?c=permission&a=editUsergroup&groupid=<{$groupInfo.id}>" >基础设置</a></td>
- <td><a href="<{$web_cfg.domain}>?c=permission&a=usergroupCpt&groupid=<{$groupInfo.id}>" >权限管理</a></td>
- <td><a class="del_usergroup_btn" href="<{$web_cfg.domain}>?c=permission&a=delUsergroup&groupid=<{$groupInfo.id}>" >删除</a></td>
- </tr>
- <{/foreach}>
- <tr>
- <td colspan=6>
- <div class="input-group input-group-sm" style="width:250px;">
- <span class="input-group-addon">新增</span>
- <input id='c' type="hidden" value="permission" />
- <input id='a' type="hidden" value="addUsergroup" />
- <input id="description" name="description" type="text" class="input-sm form-control" placeholder="用户组名称"/>
- <span class="input-group-btn">
- <input type="submit" value="提交" id="add_new_group_btn" class="btn btn-default btn-sm btn-primary"/>
- </span>
- </div>
- </td>
- </tr>
- </table>
- </div>
- <script>
- KISSY.use('node,io,event,overlay,button,component/plugin/drag,overlay/assets/kif-cpt.css', function (S, Node, IO, UA, O, B, DragPlugin) {
- var $ = S.all;
-
- //提交
- $('#add_new_group_btn').on('click', function () {
- var new_group_name = S.trim($('#description').val());
-
- if (new_group_name == '') {
- alert('请填写增加的组名称');
- return false;
- }
-
- //获取可以当前登陆用户可以管理的用户组
- new IO({
- dataType:'json'
- , url: '<{$web_cfg.domain}>'
- , data: {
- c: 'permission'
- ,a: 'UsergroupsOfAllowAssign'
- }
- , success: function (data) {
- if (data.ok) {
- var content = '<div class="km-header">把“<font color=red>'+new_group_name+'组</font>”分配给以下哪些组管理</div>';
- content += data.msg;
- 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>';
- render(content);
- } else {
- alert('操作失败');
- }
- }
- });
-
- return false;
- });
-
- //确认
- function confirm_btn() {
- var new_group_name = S.trim($('#description').val());
- var checked_groupids = [];
-
- var i=0;
- $('.manage_groupid').each(function () {
- if ($(this).attr('checked')) {
- checked_groupids[i] = $(this).val();
- i++;
- }
- });
-
- new IO({
- dataType: 'json'
- , url: '<{$web_cfg.domain}>'
- , data: {
- c: 'permission'
- ,a: 'addUsergroup'
- ,description: new_group_name
- ,parent_groupids: checked_groupids.join(',')
- }
- , success: function (data) {
- if (data.ok) {
- alert('创建成功');
- } else {
- alert('创建失败');
- }
- location.reload();
- }
- });
- }
-
- function render(content) {
- var dialog = new O({
- width: 300,
- content: content,
- closable: false,
- mask:true,
- align: {
- points: ['cc', 'cc']
- }
- });
-
- if (UA.ie == 6) {
- Event.on(window, "scroll", center);
- }
-
- dialog.show();
-
- // 生成一个确认按钮
- var b1 = new B({
- content: " 确认 ",
- render: '.confirm_btn'
- });
-
- var b2 = new B({
- content: "取消",
- render: ".closed_btn"
- });
-
- // 插入到DOM中并显示
- b1.render();
- b2.render();
-
- // 确认按钮click事件
- b1.on('click', function () {
- confirm_btn();
- });
-
- // 取消按钮click事件
- b2.on('click', function () {
- dialog.destroy();
- });
- }
-
- $('.del_usergroup_btn').on('click', function () {
- if (!confirm('确定要删除?')) {
- return false;
- }
- });
- });
- </script>
- <{include file="admin/permission/bottom.html"}>
|