* Code for task #94948.
This commit is contained in:
+26
-18
@@ -44,33 +44,41 @@ $config->group->priv->search['params']['dependPrivs'] = array('operator' => '
|
||||
$config->group->priv->search['params']['desc'] = array('operator' => 'include', 'control' => 'input', 'values' => '');
|
||||
|
||||
$config->group->actionList = array();
|
||||
$config->group->actionList['manageView']['icon'] = 'eye';
|
||||
$config->group->actionList['manageView']['text'] = $lang->group->manageView;
|
||||
$config->group->actionList['manageView']['hint'] = $lang->group->manageView;
|
||||
$config->group->actionList['manageView']['url'] = helper::createLink('group', 'manageView', "groupID={id}");
|
||||
$config->group->actionList['manageView']['data-toggle'] = 'modal';
|
||||
$config->group->actionList['manageView']['icon'] = 'eye';
|
||||
$config->group->actionList['manageView']['text'] = $lang->group->manageView;
|
||||
$config->group->actionList['manageView']['hint'] = $lang->group->manageView;
|
||||
$config->group->actionList['manageView']['url'] = helper::createLink('group', 'manageView', "groupID={id}");
|
||||
|
||||
$config->group->actionList['managePriv']['icon'] = 'lock';
|
||||
$config->group->actionList['managePriv']['text'] = $lang->group->managePriv;
|
||||
$config->group->actionList['managePriv']['hint'] = $lang->group->managePriv;
|
||||
$config->group->actionList['managePriv']['url'] = helper::createLink('group', 'managepriv', "type=bypackage&groupID={id}");
|
||||
|
||||
$config->group->actionList['manageMember']['icon'] = 'persons';
|
||||
$config->group->actionList['manageMember']['text'] = $lang->group->manageMember;
|
||||
$config->group->actionList['manageMember']['hint'] = $lang->group->manageMember;
|
||||
$config->group->actionList['manageMember']['url'] = helper::createLink('group', 'manageMember', "groupID={id}");
|
||||
$config->group->actionList['manageProjectAdmin']['icon'] = 'persons';
|
||||
$config->group->actionList['manageProjectAdmin']['text'] = $lang->group->manageProjectAdmin;
|
||||
$config->group->actionList['manageProjectAdmin']['hint'] = $lang->group->manageProjectAdmin;
|
||||
$config->group->actionList['manageProjectAdmin']['url'] = helper::createLink('group', 'manageProjectAdmin', "groupID={id}");
|
||||
$config->group->actionList['manageProjectAdmin']['data-toggle'] = 'modal';
|
||||
|
||||
$config->group->actionList['edit']['icon'] = 'edit';
|
||||
$config->group->actionList['edit']['text'] = $lang->group->edit;
|
||||
$config->group->actionList['edit']['hint'] = $lang->group->edit;
|
||||
$config->group->actionList['edit']['url'] = helper::createLink('group', 'edit', "groupID={id}");
|
||||
$config->group->actionList['manageMember']['icon'] = 'persons';
|
||||
$config->group->actionList['manageMember']['text'] = $lang->group->manageMember;
|
||||
$config->group->actionList['manageMember']['hint'] = $lang->group->manageMember;
|
||||
$config->group->actionList['manageMember']['url'] = helper::createLink('group', 'manageMember', "groupID = {id}");
|
||||
$config->group->actionList['manageMember']['data-toggle'] = 'modal';
|
||||
|
||||
$config->group->actionList['copy']['icon'] = 'copy';
|
||||
$config->group->actionList['copy']['text'] = $lang->group->copy;
|
||||
$config->group->actionList['copy']['hint'] = $lang->group->copy;
|
||||
$config->group->actionList['copy']['url'] = helper::createLink('group', 'copy', "groupID={id}");
|
||||
$config->group->actionList['edit']['icon'] = 'edit';
|
||||
$config->group->actionList['edit']['text'] = $lang->group->edit;
|
||||
$config->group->actionList['edit']['hint'] = $lang->group->edit;
|
||||
$config->group->actionList['edit']['url'] = helper::createLink('group', 'edit', "groupID={id}");
|
||||
$config->group->actionList['edit']['data-toggle'] = 'modal';
|
||||
|
||||
$config->group->actionList['copy']['icon'] = 'copy';
|
||||
$config->group->actionList['copy']['text'] = $lang->group->copy;
|
||||
$config->group->actionList['copy']['hint'] = $lang->group->copy;
|
||||
$config->group->actionList['copy']['url'] = helper::createLink('group', 'copy', "groupID={id}");
|
||||
$config->group->actionList['copy']['data-toggle'] = 'modal';
|
||||
|
||||
$config->group->actionList['delete']['icon'] = 'trash';
|
||||
$config->group->actionList['delete']['text'] = $lang->group->delete;
|
||||
$config->group->actionList['delete']['hint'] = $lang->group->delete;
|
||||
$config->group->actionList['delete']['url'] = helper::createLink('group', 'delete', "groupID={id}");
|
||||
$config->group->actionList['delete']['url'] = 'javascript:confirmDelete("{id}")';
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
global $lang;
|
||||
$config->group->dtable = new stdclass();
|
||||
|
||||
$config->group->dtable->fieldList['id']['title'] = $lang->idAB;
|
||||
$config->group->dtable->fieldList['id']['name'] = 'id';
|
||||
$config->group->dtable->fieldList['id']['type'] = 'id';
|
||||
|
||||
$config->group->dtable->fieldList['name']['title'] = $lang->group->name;
|
||||
$config->group->dtable->fieldList['name']['name'] = 'name';
|
||||
$config->group->dtable->fieldList['name']['type'] = 'title';
|
||||
$config->group->dtable->fieldList['name']['sortType'] = false;
|
||||
|
||||
$config->group->dtable->fieldList['desc']['title'] = $lang->group->desc;
|
||||
$config->group->dtable->fieldList['desc']['name'] = 'desc';
|
||||
$config->group->dtable->fieldList['desc']['type'] = 'desc';
|
||||
$config->group->dtable->fieldList['desc']['hint'] = true;
|
||||
|
||||
$config->group->dtable->fieldList['users']['title'] = $lang->group->users;
|
||||
$config->group->dtable->fieldList['users']['name'] = 'users';
|
||||
$config->group->dtable->fieldList['users']['type'] = 'desc';
|
||||
$config->group->dtable->fieldList['users']['hint'] = true;
|
||||
|
||||
$config->group->dtable->fieldList['actions']['title'] = $lang->actions;
|
||||
$config->group->dtable->fieldList['actions']['name'] = 'actions';
|
||||
$config->group->dtable->fieldList['actions']['type'] = 'actions';
|
||||
$config->group->dtable->fieldList['actions']['list'] = $config->group->actionList;
|
||||
$config->group->dtable->fieldList['actions']['menu'] = array('manageView', 'managePriv', 'manageProjectAdmin|manageMember', 'edit', 'copy', 'delete');
|
||||
+18
-31
@@ -32,27 +32,25 @@ class group extends control
|
||||
*/
|
||||
public function browse()
|
||||
{
|
||||
$title = $this->lang->company->orgView . $this->lang->colon . $this->lang->group->browse;
|
||||
$position[] = $this->lang->group->browse;
|
||||
|
||||
$groups = $this->group->getList();
|
||||
$groupUsers = array();
|
||||
foreach($groups as $group)
|
||||
{
|
||||
$group->actions = array();
|
||||
if($group->role == 'projectAdmin')
|
||||
{
|
||||
$groupUsers[$group->id] = $this->dao->select('t1.account, t2.realname')->from(TABLE_PROJECTADMIN)->alias('t1')->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account')->fetchPairs();
|
||||
$groupUsers = $this->dao->select('t1.account, t2.realname')->from(TABLE_PROJECTADMIN)->alias('t1')->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account')->fetchPairs();
|
||||
$group->users = implode(',', $groupUsers);
|
||||
}
|
||||
else
|
||||
{
|
||||
$groupUsers[$group->id] = $this->group->getUserPairs($group->id);
|
||||
$groupUsers = $this->group->getUserPairs($group->id);
|
||||
$group->users = implode(',', $groupUsers);
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->groups = $groups;
|
||||
$this->view->groupUsers = $groupUsers;
|
||||
$this->view->title = $this->lang->company->orgView . $this->lang->colon . $this->lang->group->browse;
|
||||
$this->view->groups = $groups;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -458,37 +456,26 @@ class group extends control
|
||||
* Delete a group.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @param string $confirm yes|no
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function delete($groupID, $confirm = 'no')
|
||||
public function delete($groupID)
|
||||
{
|
||||
if($confirm == 'no')
|
||||
$this->group->delete($groupID);
|
||||
|
||||
/* if ajax request, send result. */
|
||||
if(dao::isError())
|
||||
{
|
||||
return print(js::confirm($this->lang->group->confirmDelete, $this->createLink('group', 'delete', "groupID=$groupID&confirm=yes")));
|
||||
$response['result'] = 'fail';
|
||||
$response['message'] = dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->group->delete($groupID);
|
||||
|
||||
/* if ajax request, send result. */
|
||||
if($this->server->ajax)
|
||||
{
|
||||
if(dao::isError())
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
$response['message'] = dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = '';
|
||||
}
|
||||
return $this->send($response);
|
||||
}
|
||||
return print(js::locate($this->createLink('group', 'browse'), 'parent'));
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = '';
|
||||
$response['load'] = inLink('browse');
|
||||
}
|
||||
return $this->send($response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* 提示并删除分组。
|
||||
* Delete group with tips.
|
||||
*
|
||||
* @param int groupID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
window.confirmDelete = function(groupID)
|
||||
{
|
||||
if(window.confirm(confirmDelete))
|
||||
{
|
||||
$.ajaxSubmit({url: $.createLink('group', 'delete', 'groupID=' + groupID)});
|
||||
}
|
||||
}
|
||||
@@ -128,6 +128,8 @@ $lang->privlang->parent = 'Module/Package';
|
||||
$lang->group->copyOptions['copyPriv'] = 'Rechte kopieren';
|
||||
$lang->group->copyOptions['copyUser'] = 'Benutzer kopieren';
|
||||
|
||||
$lang->group->featureBar['browse']['all'] = 'Privilege Group';
|
||||
|
||||
$lang->group->versions[''] = 'Verlauf';
|
||||
$lang->group->versions['18_4_alpha1'] = 'ZenTao18.4.alpha1';
|
||||
$lang->group->versions['18_3'] = 'ZenTao18.3';
|
||||
|
||||
@@ -128,6 +128,8 @@ $lang->privlang->parent = 'Module/Package';
|
||||
$lang->group->copyOptions['copyPriv'] = 'Copy Privileges';
|
||||
$lang->group->copyOptions['copyUser'] = 'Copy Users';
|
||||
|
||||
$lang->group->featureBar['browse']['all'] = 'Privilege Group';
|
||||
|
||||
$lang->group->versions[''] = 'History';
|
||||
$lang->group->versions['18_4_alpha1'] = 'ZenTao18.4.alpha1';
|
||||
$lang->group->versions['18_3'] = 'ZenTao18.3';
|
||||
|
||||
@@ -128,6 +128,8 @@ $lang->privlang->parent = 'Module/Package';
|
||||
$lang->group->copyOptions['copyPriv'] = 'Copier Privilèges';
|
||||
$lang->group->copyOptions['copyUser'] = 'Copier Utilisateurs';
|
||||
|
||||
$lang->group->featureBar['browse']['all'] = 'Privilege Group';
|
||||
|
||||
$lang->group->versions[''] = 'History';
|
||||
$lang->group->versions['18_4_alpha1'] = 'ZenTao18.4.alpha1';
|
||||
$lang->group->versions['18_3'] = 'ZenTao18.3';
|
||||
|
||||
@@ -128,6 +128,8 @@ $lang->privlang->parent = '所属模块/权限包';
|
||||
$lang->group->copyOptions['copyPriv'] = '复制权限';
|
||||
$lang->group->copyOptions['copyUser'] = '复制用户';
|
||||
|
||||
$lang->group->featureBar['browse']['all'] = '浏览分组';
|
||||
|
||||
$lang->group->versions[''] = '修改历史';
|
||||
$lang->group->versions['18_4_alpha1'] = '禅道18.4.alpha1';
|
||||
$lang->group->versions['18_3'] = '禅道18.3';
|
||||
|
||||
@@ -839,8 +839,10 @@ class groupModel extends model
|
||||
{
|
||||
$action = strtolower($action);
|
||||
|
||||
if($action == 'manageview' and $group->role == 'limited') return false;
|
||||
if($action == 'copy' and $group->role == 'limited') return false;
|
||||
if($action == 'manageview' && $group->role == 'limited') return false;
|
||||
if($action == 'copy' && $group->role == 'limited') return false;
|
||||
if($group->role == 'projectAdmin' && in_array($action, array('manageview', 'managepriv', 'managemember', 'edit', 'copy'))) return false;
|
||||
if($group->role != 'projectAdmin' && $actions == 'manageprojectadmin') return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The browse view file of group module of ZenTaoPMS.
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Shujie Tian<tianshujie@easycorp.ltd>
|
||||
* @package group
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
/* zin: Define the set::module('group') feature bar on main menu. */
|
||||
featureBar
|
||||
(
|
||||
set::current('all'),
|
||||
);
|
||||
|
||||
jsVar('confirmDelete', $lang->group->confirmDelete);
|
||||
$tableData = initTableData($groups, $config->group->dtable->fieldList, $this->group);
|
||||
dtable
|
||||
(
|
||||
set::cols(array_values($config->group->dtable->fieldList)),
|
||||
set::data($tableData),
|
||||
);
|
||||
|
||||
/* ====== Render page ====== */
|
||||
render();
|
||||
Reference in New Issue
Block a user