From a18ace7cf5e231967fccb2f75b12b55dbb835540 Mon Sep 17 00:00:00 2001 From: Karson <karsonzhang@163.com> Date: Thu, 4 May 2017 22:29:55 +0800 Subject: [PATCH] 更新权限管理语言包 --- application/admin/controller/auth/Group.php | 14 ++++++++++---- application/admin/lang/zh-cn/auth/admin.php | 6 ++++++ application/admin/lang/zh-cn/auth/group.php | 7 +++++++ application/admin/lang/zh-cn/auth/rule.php | 10 ++++++++++ application/admin/view/auth/rule/add.html | 2 +- application/admin/view/auth/rule/index.html | 1 - public/assets/js/backend/auth/rule.js | 63 --------------------------------------------------------------- 7 files changed, 34 insertions(+), 69 deletions(-) create mode 100644 application/admin/lang/zh-cn/auth/admin.php create mode 100644 application/admin/lang/zh-cn/auth/group.php create mode 100644 application/admin/lang/zh-cn/auth/rule.php diff --git a/application/admin/controller/auth/Group.php b/application/admin/controller/auth/Group.php index 8aebd66..488bf73 100644 --- a/application/admin/controller/auth/Group.php +++ b/application/admin/controller/auth/Group.php @@ -84,12 +84,13 @@ class Group extends Backend if (!in_array($params['pid'], $this->childrenIds)) { $this->code = -1; + $this->msg = __(''); return; } $parentmodel = model("AuthGroup")->get($params['pid']); if (!$parentmodel) { - $this->code = -1; + $this->msg = __('The parent group can not found'); return; } // 父级别的规则节点 @@ -126,10 +127,10 @@ class Group extends Backend { $this->code = -1; $params = $this->request->post("row/a"); - // 复节点不能是它自身的子节点 + // 父节点不能是它自身的子节点 if (!in_array($params['pid'], $this->childrenIds)) { - $this->code = -1; + $this->msg = __('The parent group can not be its own child'); return; } $params['rules'] = explode(',', $params['rules']); @@ -137,7 +138,7 @@ class Group extends Backend $parentmodel = model("AuthGroup")->get($params['pid']); if (!$parentmodel) { - $this->code = -1; + $this->msg = __('The parent group can not found'); return; } // 父级别的规则节点 @@ -200,6 +201,11 @@ class Group extends Backend continue; } } + if (!$ids) + { + $this->msg = __('You can not delete group that contain child group and administrators'); + return; + } $count = $this->model->where('id', 'in', $ids)->delete(); if ($count) { diff --git a/application/admin/lang/zh-cn/auth/admin.php b/application/admin/lang/zh-cn/auth/admin.php new file mode 100644 index 0000000..0a36d7c --- /dev/null +++ b/application/admin/lang/zh-cn/auth/admin.php @@ -0,0 +1,6 @@ +<?php + +return [ + 'Group' => '所属组别', + 'Login time' => '最后登录', +]; diff --git a/application/admin/lang/zh-cn/auth/group.php b/application/admin/lang/zh-cn/auth/group.php new file mode 100644 index 0000000..89f3a8e --- /dev/null +++ b/application/admin/lang/zh-cn/auth/group.php @@ -0,0 +1,7 @@ +<?php + +return [ + 'The parent group can not be its own child' => '父组别不能是自身的子组别', + 'The parent group can not found' => '父组别未找到', + 'You can not delete group that contain child group and administrators' => '你不能删除含有子组和管理员的组', +]; diff --git a/application/admin/lang/zh-cn/auth/rule.php b/application/admin/lang/zh-cn/auth/rule.php new file mode 100644 index 0000000..d173e4d --- /dev/null +++ b/application/admin/lang/zh-cn/auth/rule.php @@ -0,0 +1,10 @@ +<?php + +return [ + 'Toggle all' => '显示全部', + 'Condition' => '条件', + 'Remark' => '备注', + 'Icon' => '图标', + 'Alert' => '警告', + 'If not necessary, use the command line to build rule' => '非必要情况下请使用命令行来生成', +]; diff --git a/application/admin/view/auth/rule/add.html b/application/admin/view/auth/rule/add.html index 1ec1f98..469289a 100644 --- a/application/admin/view/auth/rule/add.html +++ b/application/admin/view/auth/rule/add.html @@ -1,6 +1,6 @@ <div class="callout callout-info"> <h4>{:__('Alert')}!</h4> - {:__('If not necessary, use the rebuild node feature directly')} + {:__('If not necessary, use the command line to build rule')} </div> <form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action=""> <div class="form-group"> diff --git a/application/admin/view/auth/rule/index.html b/application/admin/view/auth/rule/index.html index d439dd7..0d6331f 100644 --- a/application/admin/view/auth/rule/index.html +++ b/application/admin/view/auth/rule/index.html @@ -8,7 +8,6 @@ <div id="toolbar" class="toolbar"> {:build_toolbar()} <a href="javascript:;" class="btn btn-danger btn-toggle-all"><i class="fa fa-plus"></i> {:__('Toggle all')}</a> - <a href="javascript:;" class="btn btn-danger btn-rebuild">{:__('Rebuild node')}</a> </div> <table id="table" class="table table-bordered table-hover" width="100%"> diff --git a/public/assets/js/backend/auth/rule.js b/public/assets/js/backend/auth/rule.js index 2ae895c..a103402 100755 --- a/public/assets/js/backend/auth/rule.js +++ b/public/assets/js/backend/auth/rule.js @@ -41,69 +41,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function // 为表格绑定事件 Table.api.bindevent(table);//当内容渲染完成后 - $(document).on("click", ".btn-rebuild", function () { - Backend.api.layer.confirm( - __('Are you sure you want to rebuild node?'), - {icon: 3, title: __('Warning'), offset: 0}, - function (index) { - Backend.api.layer.close(index); - Backend.api.ajax({url: "auth/rule/rebuild", data: {step: 1}}, function (content) { - table.bootstrapTable('refresh'); - var msg = '<div style="padding:20px;"><div class="alert alert-warning alert-light">' + __('You can change the node name if you want to') + '</div><label>' + __('Node list') + '</label><div id="treeview"></div></div>'; - Backend.api.layer.open({ - type: 1, - content: msg, - area: ['600px', '400px'], - scrollbar: false, - success: function (layero, index) { - require(['jstree'], function () { - $("#treeview", $(layero)).jstree({ - "themes": {"stripes": true}, - "types": { - "menu": { - "icon": "fa fa-folder-open", - "valid_children": [] - }, - "file": { - "icon": "fa fa-file-o", - "valid_children": [] - } - }, - "plugins": ["types"], - "core": { - 'check_callback': true, - "data": content - } - }).bind("select_node.jstree", function (e, data) { - var ref = $("#treeview", layero).jstree(true); - ref.edit(data.node); - }); - }); - } - , - btn: [__('OK'), __('Cancel')], - yes: function (index, layero) { - //递归获取所有节点信息 - var get_children = function (node) { - var data = []; - $.each(node, function (i, j) { - data.push({id: j.id, name: j.text}); - data = data.concat(get_children(j.children)); - }); - return data; - }; - var data = get_children($("#treeview").jstree('get_json')); - Backend.api.ajax({url: "auth/rule/rebuild", data: {step: 2, data: data}}, function (content) { - Backend.api.layer.close(index); - top.location.reload(); - }); - } - }); - - }); - } - ); - }); //默认隐藏所有子节点 table.on('post-body.bs.table', function (e, settings, json, xhr) { $("a.btn[data-id][data-pid][data-pid!=0]").closest("tr").hide(); -- libgit2 0.24.0