* Product add white list function.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php js::set('objectID', $objectID);?>
|
||||
<?php js::set('objectType', $objectType);?>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class='btn-toolbar pull-left'>
|
||||
<span class='btn btn-link btn-active-text'>
|
||||
<?php echo html::a($this->createLink('personnel', 'addWhitelist', "objectID={$objectID}"), "<span class='text'> {$lang->personnel->addWhitelist}</span>");?>
|
||||
<?php echo html::a($this->createLink($module, 'addWhitelist', "objectID=$objectID&deptID=$deptID&objectType=$objectType&module=$module"), "<span class='text'> {$lang->personnel->addWhitelist}</span>");?>
|
||||
</span>
|
||||
<div class='input-group space w-200px'>
|
||||
<span class='input-group-addon'><?php echo $lang->project->selectDept?></span>
|
||||
@@ -93,4 +94,5 @@
|
||||
</table>
|
||||
</div>
|
||||
<?php js::set('index', $i);?>
|
||||
<?php js::set('module', $module);?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<div class="btn-toolbar pull-left">
|
||||
<?php echo html::a($this->createLink('personnel', 'whitelist', "programID=$programID"), '<span class="text">' . $lang->personnel->whitelist . '</span>', '', 'class="btn btn-link btn-active-text"');?>
|
||||
<?php echo html::a($this->createLink($module, 'whitelist', "objectID=$objectID"), '<span class="text">' . $lang->personnel->whitelist . '</span>', '', 'class="btn btn-link btn-active-text"');?>
|
||||
</div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php common::printLink('personnel', 'addWhitelist', "objectID=$programID", "<i class='icon icon-plus'></i>" . $lang->personnel->addWhitelist, '', "class='btn btn-primary'");?>
|
||||
<?php common::printLink($module, 'addWhitelist', "objectID=$objectID", "<i class='icon icon-plus'></i>" . $lang->personnel->addWhitelist, '', "class='btn btn-primary'");?>
|
||||
</div>
|
||||
</div>
|
||||
<div id='mainContent' class='main-row fade'>
|
||||
@@ -26,7 +26,6 @@
|
||||
<table class='table has-sort-head' id='userList'>
|
||||
<thead>
|
||||
<tr>
|
||||
<?php $vars = "programID=$programID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
|
||||
<th class='c-id'>
|
||||
<?php echo $lang->idAB;?>
|
||||
</th>
|
||||
@@ -53,8 +52,8 @@
|
||||
<td title="<?php echo $user->email;?>"><?php echo $user->email;?></td>
|
||||
<td class='c-actions'>
|
||||
<?php
|
||||
$deleteClass = common::hasPriv('personnel', 'unbindWhielist') ? 'btn' : 'btn disabled';
|
||||
echo html::a($this->createLink('personnel', 'unbindWhielist', "id=$user->id&confirm=no"), '<i class="icon-unlink"></i>', 'hiddenwin', "title='{$lang->delete}' class='{$deleteClass}'");
|
||||
$deleteClass = common::hasPriv($module, 'unbindWhielist') ? 'btn' : 'btn disabled';
|
||||
echo html::a($this->createLink($module, 'unbindWhielist', "id=$user->id&confirm=no"), '<i class="icon-unlink"></i>', 'hiddenwin', "title='{$lang->delete}' class='{$deleteClass}'");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -789,6 +789,59 @@ class product extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get white list personnel.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $branch
|
||||
* @param string $browsetype
|
||||
* @param string $orderby
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function whitelist($productID = 0, $branch = '', $browseType = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
||||
{
|
||||
$this->lang->product->menu = $this->lang->product->viewMenu;
|
||||
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, '', $branch);
|
||||
$this->product->setMenu($this->products, $productID, $branch);
|
||||
|
||||
echo $this->fetch('personnel', 'whitelist', "objectID=$productID&module=product");
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding users to the white list.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $deptID
|
||||
* @param string $branch
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function addWhitelist($productID = 0, $deptID = 0, $branch = '')
|
||||
{
|
||||
$this->lang->product->menu = $this->lang->product->viewMenu;
|
||||
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID, '', $branch);
|
||||
$this->product->setMenu($this->products, $productID, $branch);
|
||||
|
||||
echo $this->fetch('personnel', 'addWhitelist', "objectID=$productID&dept=$deptID&objectType=product&module=product");
|
||||
}
|
||||
|
||||
/*
|
||||
* Removing users from the white list.
|
||||
*
|
||||
* @param int $id
|
||||
* @param string $confirm
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function unbindWhielist($id = 0, $confirm = 'no')
|
||||
{
|
||||
echo $this->fetch('personnel', 'unbindWhielist', "id=$id&confirm=$confirm");
|
||||
}
|
||||
|
||||
/**
|
||||
* Export product.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user