my->preference;?>

diff --git a/module/product/control.php b/module/product/control.php index c5a0d1c8f9..07a340d200 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -712,10 +712,11 @@ class product extends control * @access public * @return void */ - public function dashboard($productID) + public function dashboard($productID = 0) { - $product = $this->product->getStatByID($productID); - if(!$product) die(js::error($this->lang->notFound) . js::locate('back')); + $productID = $this->product->saveState($productID, $this->products); + $product = $this->product->getStatByID($productID); + if(!$product) die(js::locate('product', 'all')); $this->lang->product->menu = $this->lang->product->viewMenu; $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID); diff --git a/module/program/control.php b/module/program/control.php index 08a01dfad2..7cb8ca4c95 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -104,10 +104,6 @@ class program extends control */ public function PGMProduct($programID = 0, $browseType = 'noclosed', $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) { - $programID = $this->program->savePGMState($programID, $this->program->getPGMPairs()); - if(!$programID) $this->locate($this->createLink('program', 'PGMbrowse')); - setCookie("lastPGM", $programID, $this->config->cookieLife, $this->config->webRoot, '', false, true); - $this->lang->navGroup->program = 'program'; $this->lang->program->switcherMenu = $this->program->getPGMSwitcher($programID, true); $this->lang->program->mainMenuAction = $this->program->getPGMMainAction(); @@ -400,6 +396,10 @@ class program extends control */ public function PGMProject($programID = 0, $browseType = 'doing', $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) { + $programID = $this->program->savePGMState($programID, $this->program->getPGMPairs()); + if(!$programID) $this->locate($this->createLink('program', 'PGMbrowse')); + setCookie("lastPGM", $programID, $this->config->cookieLife, $this->config->webRoot, '', false, true); + $this->lang->navGroup->program = 'program'; $this->lang->program->switcherMenu = $this->program->getPGMSwitcher($programID, true); $this->lang->program->mainMenuAction = $this->program->getPGMMainAction(); diff --git a/module/project/control.php b/module/project/control.php index 9f7661bca1..7da8bed048 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -67,39 +67,40 @@ class project extends control /** * Common actions. * - * @param int $projectID + * @param int $executionID + * @param string $extra * @access public * @return object current object */ - public function commonAction($projectID = 0, $extra = '') + public function commonAction($executionID = 0, $extra = '') { $this->loadModel('product'); - /* Get projects and products info. */ - $projectID = $this->project->saveState($projectID, $this->projects); - $project = $this->project->getById($projectID); - $products = $this->project->getProducts($projectID); - $childProjects = $this->project->getChildExecutions($projectID); - $teamMembers = $this->project->getTeamMembers($projectID); - $actions = $this->loadModel('action')->getList('execution', $projectID); + /* Get executions and products info. */ + $executionID = $this->project->saveState($executionID, $this->projects); + $execution = $this->project->getById($executionID); + $products = $this->project->getProducts($executionID); + $childExecutions = $this->project->getChildExecutions($executionID); + $teamMembers = $this->project->getTeamMembers($executionID); + $actions = $this->loadModel('action')->getList('execution', $executionID); /* Set menu. */ - $this->project->setMenu($this->projects, $projectID, $buildID = 0, $extra); + $this->project->setMenu($this->projects, $executionID, $buildID = 0, $extra); /* Assign. */ $this->view->projects = $this->projects; - $this->view->project = $project; - $this->view->childProjects = $childProjects; + $this->view->project = $execution; + $this->view->childProjects = $childExecutions; $this->view->products = $products; $this->view->teamMembers = $teamMembers; - return $project; + return $execution; } /** - * Tasks of a project. + * Tasks of a execution. * - * @param int $projectID + * @param int $executionID * @param string $status * @param string $orderBy * @param int $recTotal @@ -108,8 +109,13 @@ class project extends control * @access public * @return void */ - public function task($projectID = 0, $status = 'unclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 100, $pageID = 1) + public function task($executionID = 0, $status = 'unclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 100, $pageID = 1) { + /* Save last PRJ. */ + $projectID = $this->loadModel('program')->savePRJState($this->session->PRJ, $this->program->getPRJPairs()); + if(!$projectID) $this->locate($this->createLink('program', 'PRJbrowse')); + setCookie("lastPRJ", $projectID, $this->config->cookieLife, $this->config->webRoot, '', false, true); + $this->loadModel('tree'); $this->loadModel('search'); $this->loadModel('task'); @@ -120,13 +126,13 @@ class project extends control /* Set browse type. */ $browseType = strtolower($status); - /* Get products by project. */ - $project = $this->commonAction($projectID, $status); - $projectID = $project->id; - $products = $this->loadModel('product')->getProductPairsByProject($projectID); - setcookie('preProjectID', $projectID, $this->config->cookieLife, $this->config->webRoot, '', false, true); + /* Get products by execution. */ + $execution = $this->commonAction($executionID, $status); + $executionID = $execution->id; + $products = $this->loadModel('product')->getProductPairsByProject($executionID); + setcookie('preProjectID', $executionID, $this->config->cookieLife, $this->config->webRoot, '', false, true); - if($this->cookie->preProjectID != $projectID) + if($this->cookie->preProjectID != $executionID) { $_COOKIE['moduleBrowseParam'] = $_COOKIE['productBrowseParam'] = 0; setcookie('moduleBrowseParam', 0, 0, $this->config->webRoot, '', false, false); @@ -168,8 +174,8 @@ class project extends control $sort = $this->loadModel('common')->appendOrder($orderBy); /* Header and position. */ - $this->view->title = $project->name . $this->lang->colon . $this->lang->project->task; - $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); + $this->view->title = $execution->name . $this->lang->colon . $this->lang->project->task; + $this->view->position[] = html::a($this->createLink('project', 'browse', "executionID=$executionID"), $execution->name); $this->view->position[] = $this->lang->project->task; /* Load pager and get tasks. */ @@ -178,17 +184,17 @@ class project extends control $pager = new pager($recTotal, $recPerPage, $pageID); /* Get tasks. */ - $tasks = $this->project->getTasks($productID, $projectID, $this->projects, $browseType, $queryID, $moduleID, $sort, $pager); + $tasks = $this->project->getTasks($productID, $executionID, $this->projects, $browseType, $queryID, $moduleID, $sort, $pager); if(empty($tasks) and $pageID > 1) { $pager = pager::init(0, $recPerPage, 1); - $tasks = $this->project->getTasks($productID, $projectID, $this->projects, $browseType, $queryID, $moduleID, $sort, $pager); + $tasks = $this->project->getTasks($productID, $executionID, $this->projects, $browseType, $queryID, $moduleID, $sort, $pager); } /* Build the search form. */ - $actionURL = $this->createLink('project', 'task', "projectID=$projectID&status=bySearch¶m=myQueryID"); + $actionURL = $this->createLink('project', 'task', "executionID=$executionID&status=bySearch¶m=myQueryID"); $this->config->project->search['onMenuBar'] = 'yes'; - $this->project->buildTaskSearchForm($projectID, $this->projects, $queryID, $actionURL); + $this->project->buildTaskSearchForm($executionID, $this->projects, $queryID, $actionURL); /* team member pairs. */ $memberPairs = array(); @@ -197,7 +203,7 @@ class project extends control $showAllModule = isset($this->config->project->task->allModule) ? $this->config->project->task->allModule : ''; $extra = (isset($this->config->project->task->allModule) && $this->config->project->task->allModule == 1) ? 'allModule' : ''; $showModule = !empty($this->config->datatable->projectTask->showModule) ? $this->config->datatable->projectTask->showModule : ''; - $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($projectID, 'task', $showModule) : array(); + $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($executionID, 'task', $showModule) : array(); /* Assign. */ $this->view->tasks = $tasks; @@ -211,16 +217,16 @@ class project extends control $this->view->status = $status; $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->param = $param; - $this->view->projectID = $projectID; - $this->view->project = $project; + $this->view->executionID = $projectID; + $this->view->execution = $execution; $this->view->productID = $productID; - $this->view->modules = $this->tree->getTaskOptionMenu($projectID, 0, 0, $showAllModule ? 'allModule' : ''); + $this->view->modules = $this->tree->getTaskOptionMenu($executionID, 0, 0, $showAllModule ? 'allModule' : ''); $this->view->moduleID = $moduleID; - $this->view->moduleTree = $this->tree->getTaskTreeMenu($projectID, $productID, $startModuleID = 0, array('treeModel', 'createTaskLink'), $extra); + $this->view->moduleTree = $this->tree->getTaskTreeMenu($executionID, $productID, $startModuleID = 0, array('treeModel', 'createTaskLink'), $extra); $this->view->memberPairs = $memberPairs; $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), 'noempty'); $this->view->setModule = true; - $this->view->canBeChanged = common::canModify('project', $project); // Determines whether an object is editable. + $this->view->canBeChanged = common::canModify('project', $execution); // Determines whether an object is editable. $this->display(); } diff --git a/module/project/model.php b/module/project/model.php index 5472e7e4d4..6b80915443 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -269,20 +269,27 @@ class projectModel extends model /** * Save the project id user last visited to session. * - * @param int $projectID - * @param array $projects + * @param int $executionID + * @param array $executions * @access public * @return int */ - public function saveState($projectID, $projects) + public function saveState($executionID, $executions) { - if($projectID > 0) $this->session->set('project', (int)$projectID); - if($projectID == 0 and $this->cookie->lastProject) $this->session->set('project', (int)$this->cookie->lastProject); - if($projectID == 0 and $this->session->project == '') $this->session->set('project', key($projects)); - if(!isset($projects[$this->session->project])) + if($executionID > 0) $this->session->set('project', (int)$executionID); + if($executionID == 0 and $this->cookie->lastProject) { - $this->session->set('project', key($projects)); - if($projectID && strpos(",{$this->app->user->view->sprints},", ",{$this->session->project},") === false) $this->accessDenied(); + /* Project link is project-task. */ + $executionID = (int)$this->cookie->lastProject; + $executions = $this->getExecutionPairs($this->session->PRJ); + $executionID = in_array($executionID, array_keys($executions)) ? $executionID : key($executions); + $this->session->set('project', $executionID); + } + if($executionID == 0 and $this->session->project == '') $this->session->set('project', key($executions)); + if(!isset($executions[$this->session->project])) + { + $this->session->set('project', key($executions)); + if($executionID && strpos(",{$this->app->user->view->sprints},", ",{$this->session->project},") === false) $this->accessDenied(); } return $this->session->project; } diff --git a/module/project/view/task.html.php b/module/project/view/task.html.php index e3807fe637..e2f8bab1d4 100644 --- a/module/project/view/task.html.php +++ b/module/project/view/task.html.php @@ -17,12 +17,12 @@ include '../../common/view/datepicker.html.php'; include '../../common/view/datatable.fix.html.php'; js::set('moduleID', $moduleID); js::set('productID', $productID); -js::set('projectID', $projectID); +js::set('executionID', $executionID); js::set('browseType', $browseType); /* Set unfold parent taskID. */ $unfoldTasks = isset($config->project->task->unfoldTasks) ? json_decode($config->project->task->unfoldTasks, true) : array(); -$unfoldTasks = zget($unfoldTasks, $projectID, array()); +$unfoldTasks = zget($unfoldTasks, $executionID, array()); js::set('unfoldTasks', $unfoldTasks); js::set('unfoldAll', $lang->project->treeLevel['all']); js::set('foldAll', $lang->project->treeLevel['root']); @@ -34,14 +34,14 @@ js::set('foldAll', $lang->project->treeLevel['root']); if(!empty($productID)) { $product = $this->product->getById($productID); - $removeLink = $browseType == 'byproduct' ? inlink('task', "projectID=$projectID&browseType=$status¶m=0&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("productBrowseParam")'; + $removeLink = $browseType == 'byproduct' ? inlink('task', "executionID=$executionID&browseType=$status¶m=0&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("productBrowseParam")'; echo $product->name; echo html::a($removeLink, "", '', "class='text-muted'"); } elseif(!empty($moduleID)) { $module = $this->tree->getById($moduleID); - $removeLink = $browseType == 'bymodule' ? inlink('task', "projectID=$projectID&browseType=$status¶m=0&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("moduleBrowseParam")'; + $removeLink = $browseType == 'bymodule' ? inlink('task', "executionID=$executionID&browseType=$status¶m=0&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("moduleBrowseParam")'; echo $module->name; echo html::a($removeLink, "", '', "class='text-muted'"); } @@ -57,12 +57,12 @@ js::set('foldAll', $lang->project->treeLevel['root']); type == 'ops' && $menuItem->name == 'needconfirm') continue; + if($execution->type == 'ops' && $menuItem->name == 'needconfirm') continue; if(isset($menuItem->hidden)) continue; $menuType = $menuItem->name; if($menuType == 'QUERY') { - $searchBrowseLink = $this->createLink('project', 'task', "project=$projectID&type=bySearch¶m=%s"); + $searchBrowseLink = $this->createLink('project', 'task', "project=$executionID&type=bySearch¶m=%s"); $isBySearch = $this->session->taskBrowseType == 'bysearch'; include '../../common/view/querymenu.html.php'; } @@ -72,7 +72,7 @@ js::set('foldAll', $lang->project->treeLevel['root']); $label .= $menuType == $this->session->taskBrowseType ? " {$pager->recTotal}" : ''; $active = $menuType == $this->session->taskBrowseType ? 'btn-active-text' : ''; $title = $menuType == 'needconfirm' ? "title='{$lang->task->storyChange}'" : ''; - echo html::a(inlink('task', "project=$projectID&type=$menuType"), $label, '', "id='{$menuType}' class='btn btn-link $active' $title"); + echo html::a(inlink('task', "project=$executionID&type=$menuType"), $label, '', "id='{$menuType}' class='btn btn-link $active' $title"); } elseif($menuType == 'status') { @@ -91,7 +91,7 @@ js::set('foldAll', $lang->project->treeLevel['root']); { if($key == '') continue; echo ''; - echo html::a($this->createLink('project', 'task', "project=$projectID&type=$key"), $value); + echo html::a($this->createLink('project', 'task', "project=$executionID&type=$key"), $value); } echo '
'; } @@ -103,7 +103,7 @@ js::set('foldAll', $lang->project->treeLevel['root']); - + @@ -197,12 +197,12 @@ js::set('foldAll', $lang->project->treeLevel['root']); moduleName . ucfirst($this->methodName); $useDatatable = (isset($config->datatable->$datatableId->mode) and $config->datatable->$datatableId->mode == 'datatable'); - $vars = "projectID=$project->id&status=$status&parma=$param&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage"; + $vars = "executionID=$execution->id&status=$status&parma=$param&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage"; if($useDatatable) include '../../common/view/datatable.html.php'; $customFields = $this->datatable->getSetting('project'); - if($project->type == 'ops') + if($execution->type == 'ops') { foreach($customFields as $id => $customField) { @@ -265,7 +265,7 @@ js::set('foldAll', $lang->project->treeLevel['root']);
createLink('task', 'batchEdit', "projectID=$projectID"); + $actionLink = $this->createLink('task', 'batchEdit', "executionID=$executionID"); $disabled = $canBatchEdit ? '' : "disabled='disabled'"; echo html::commonButton($lang->edit, "data-form-action='$actionLink' $disabled"); @@ -318,7 +318,7 @@ js::set('foldAll', $lang->project->treeLevel['root']); 10; - $actionLink = $this->createLink('task', 'batchAssignTo', "projectID=$projectID"); + $actionLink = $this->createLink('task', 'batchAssignTo', "executionID=$executionID"); echo html::select('assignedTo', $memberPairs, '', 'class="hidden"'); if($withSearch): ?>