From 969b52508ca3ec6b6be571f3c93233d4a069ccff Mon Sep 17 00:00:00 2001 From: leiyong <1549684884@qq.com> Date: Mon, 26 Oct 2020 13:04:56 +0800 Subject: [PATCH] * Product add white list function. --- module/common/lang/zh-cn.php | 1 + module/personnel/control.php | 69 ++++++++++++--------- module/personnel/js/addwhitelist.js | 2 +- module/personnel/view/addwhitelist.html.php | 4 +- module/personnel/view/whitelist.html.php | 9 ++- module/product/control.php | 53 ++++++++++++++++ 6 files changed, 100 insertions(+), 38 deletions(-) diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index f43a769535..c5f8b3f1d9 100755 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -166,6 +166,7 @@ $lang->product->viewMenu->roadmap = '路线图|product|roadmap|productID=%s' $lang->product->viewMenu->branch = '@branch@|branch|manage|productID=%s'; $lang->product->viewMenu->module = '模块|tree|browse|productID=%s&view=story'; $lang->product->viewMenu->view = array('link' => '概况|product|view|productID=%s', 'alias' => 'edit'); +$lang->product->viewMenu->whitelist = array('link' => '白名单|product|whitelist|productID=%s', 'alias' => 'addwhitelist'); $lang->release = new stdclass(); $lang->branch = new stdclass(); diff --git a/module/personnel/control.php b/module/personnel/control.php index 79ff40ebf8..1ffd7e48bd 100644 --- a/module/personnel/control.php +++ b/module/personnel/control.php @@ -26,11 +26,8 @@ class personnel extends control */ public function accessible($programID = 0, $deptID = 0, $browseType='browse', $param = 0, $recTotal = 0, $recPerPage = 15, $pageID = 1) { - $this->loadModel('program'); + $this->setProgramNavMenu($programID); $this->app->loadLang('user'); - $this->lang->navGroup->program = 'program'; - $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID); - $this->program->setPGMViewMenu($programID); /* Set the pager. */ $this->app->loadClass('pager', true); @@ -72,10 +69,7 @@ class personnel extends control */ public function putInto($programID = 0, $browseType = 'all', $orderBy = 'id_desc') { - $this->loadModel('program'); - $this->lang->navGroup->program = 'program'; - $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID); - $this->program->setPGMViewMenu($programID); + $this->setProgramNavMenu($programID); $this->view->title = $this->lang->personnel->putInto; $this->view->position[] = $this->lang->personnel->putInto; @@ -91,7 +85,7 @@ class personnel extends control /** * Get white list personnel. * - * @param int $programID + * @param int $objectID * @param string $browsetype * @param string $orderby * @param int $recTotal @@ -100,24 +94,22 @@ class personnel extends control * @access public * @return void */ - public function whitelist($programID = 0, $browseType = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function whitelist($objectID = 0, $module = 'personnel', $browseType = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { - $this->loadModel('program'); + if($module == 'personnel') $this->setProgramNavMenu($objectID); $this->app->loadLang('user'); - $this->lang->navGroup->program = 'program'; - $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID); - $this->program->setPGMViewMenu($programID); $this->app->loadClass('pager', true); $pager = pager::init($recTotal, $recPerPage, $pageID); - $whitelist = $this->personnel->getWhitelist($programID, $browseType, $orderBy, $pager); + $whitelist = $this->personnel->getWhitelist($objectID, $browseType, $orderBy, $pager); $this->view->title = $this->lang->personnel->whitelist; $this->view->position[] = $this->lang->personnel->whitelist; $this->view->pager = $pager; - $this->view->programID = $programID; + $this->view->objectID = $objectID; $this->view->whitelist = $whitelist; + $this->view->module = $module; $this->display(); } @@ -127,20 +119,18 @@ class personnel extends control * * @param int $objectID * @param int $deptID + * @param string $objectType program|project|product|sprint * @access public * @return void */ - public function addWhitelist($objectID = 0, $deptID = 0) + public function addWhitelist($objectID = 0, $deptID = 0, $objectType = 'program', $module = 'personnel') { - $this->loadModel('program'); - $this->lang->navGroup->program = 'program'; - $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($objectID); - $this->program->setPGMViewMenu($objectID); + if($module == 'personnel') $this->setProgramNavMenu($objectID); $this->app->loadLang('project'); if($_POST) { - $this->personnel->addWhitelist('program', $objectID); + $this->personnel->addWhitelist($objectType, $objectID); if(dao::isError()) { $response['result'] = 'fail'; @@ -148,7 +138,7 @@ class personnel extends control $this->send($response); } - $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inLink('whitelist', "programID=$objectID"))); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink($module, 'whitelist', "objectID=$objectID"))); } $this->loadModel('dept'); @@ -157,13 +147,15 @@ class personnel extends control $this->view->title = $this->lang->personnel->addWhitelist; $this->view->position[] = $this->lang->personnel->addWhitelist; - $this->view->objectID = $objectID; - $this->view->deptID = $deptID; - $this->view->deptUsers = $deptUsers; - $this->view->whitelist = $this->personnel->getWhitelist($objectID); - $this->view->depts = $this->dept->getOptionMenu(); - $this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted'); - $this->view->dept = $this->dept->getByID($deptID); + $this->view->objectID = $objectID; + $this->view->objectType = $objectType; + $this->view->module = $module; + $this->view->deptID = $deptID; + $this->view->deptUsers = $deptUsers; + $this->view->whitelist = $this->personnel->getWhitelist($objectID); + $this->view->depts = $this->dept->getOptionMenu(); + $this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted'); + $this->view->dept = $this->dept->getByID($deptID); $this->display(); } @@ -180,7 +172,7 @@ class personnel extends control { if($confirm == 'no') { - die(js::confirm($this->lang->personnel->confirmDelete, inLink('unlinkUser',"id=$id&confirm=yes"))); + die(js::confirm($this->lang->personnel->confirmDelete, inLink('unbindWhielist',"id=$id&confirm=yes"))); } else { @@ -195,4 +187,19 @@ class personnel extends control die(js::reload('parent')); } } + + /* + * Setting up the program's navigation menu. + * + * @param int $programID + * @access public + * @return void + */ + public function setProgramNavMenu($programID = 0) + { + $this->loadModel('program'); + $this->lang->navGroup->program = 'program'; + $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID); + $this->program->setPGMViewMenu($programID); + } } diff --git a/module/personnel/js/addwhitelist.js b/module/personnel/js/addwhitelist.js index be2f4f5f49..63fc24e4fa 100644 --- a/module/personnel/js/addwhitelist.js +++ b/module/personnel/js/addwhitelist.js @@ -7,7 +7,7 @@ function setDeptUsers(dept) { var deptID = $(dept).val(); - var link = createLink('personnel', 'addWhitelist', 'objectID=' + objectID + '&deptID=' + deptID) + var link = createLink(module, 'addWhitelist', 'objectID=' + objectID + '&deptID=' + deptID + '&objectType=' + objectType + '&module=' + module); location.href = link; } diff --git a/module/personnel/view/addwhitelist.html.php b/module/personnel/view/addwhitelist.html.php index cf6f9bc56f..2ad7f83051 100644 --- a/module/personnel/view/addwhitelist.html.php +++ b/module/personnel/view/addwhitelist.html.php @@ -12,10 +12,11 @@ ?> +