diff --git a/config/filter.php b/config/filter.php index 7e012a7302..1fc570d8dc 100644 --- a/config/filter.php +++ b/config/filter.php @@ -99,6 +99,7 @@ $filter->webhook->bind = new stdclass(); $filter->bug->batchcreate->cookie['preBranch'] = 'int'; $filter->bug->browse->cookie['bugModule'] = 'int'; $filter->bug->browse->cookie['bugBranch'] = 'int'; +$filter->bug->browse->cookie['treeBranch'] = 'int'; $filter->bug->browse->cookie['preBranch'] = 'int'; $filter->bug->browse->cookie['qaBugOrder'] = 'reg::orderBy'; $filter->bug->browse->cookie['windowWidth'] = 'int'; @@ -127,6 +128,7 @@ $filter->product->browse->cookie['preProductID'] = 'int'; $filter->product->browse->cookie['productStoryOrder'] = 'reg::orderBy'; $filter->product->browse->cookie['storyModule'] = 'int'; $filter->product->browse->cookie['storyBranch'] = 'int'; +$filter->product->browse->cookie['treeBranch'] = 'int'; $filter->product->default->cookie['lastProduct'] = 'int'; $filter->product->default->cookie['preProductID'] = 'int'; $filter->product->index->cookie['preBranch'] = 'int'; diff --git a/module/bug/control.php b/module/bug/control.php index 373f1ddaa7..8de1490270 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -77,7 +77,6 @@ class bug extends control /* Set productID, moduleID, queryID and branch. */ $productID = $this->product->saveState($productID, $this->products); $branch = ($branch == '') ? (int)$this->cookie->preBranch : (int)$branch; - $branchID = $browseType == '' ? $branch : ($browseType == 'bybranch' ? (int)$param : ($this->cookie->bugBranch ? $this->cookie->bugBranch : $branch)); setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true); setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot, '', false, true); @@ -91,9 +90,9 @@ class bug extends control setcookie('bugModule', (int)$param, 0, $this->config->webRoot, '', false, false); $_COOKIE['bugBranch'] = 0; setcookie('bugBranch', 0, 0, $this->config->webRoot, '', false, false); - if($browseType == '') $browseType = 'unclosed'; + if($browseType == '') setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); } - if($browseType == 'bybranch') setcookie('bugBranch', (int)$param, 0, $this->config->webRoot, '', false, false); + if($browseType == 'bybranch') setcookie('bugBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); if($browseType != 'bymodule' and $browseType != 'bybranch') $this->session->set('bugBrowseType', $browseType); $moduleID = ($browseType == 'bymodule') ? (int)$param : (($browseType == 'bysearch' or $browseType == 'bybranch') ? 0 : ($this->cookie->bugModule ? $this->cookie->bugModule : 0)); @@ -103,6 +102,18 @@ class bug extends control $this->bug->setMenu($this->products, $productID, $branch, $moduleID, $browseType, $orderBy); $this->session->set('bugList', $this->app->getURI(true)); + /* Set moduleTree. */ + if($browseType == '') + { + setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); + $browseType = 'unclosed'; + $moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink'), '', $branch); + } + else + { + $moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink'), '', (int)$this->cookie->treeBranch); + } + /* Process the order by field. */ if(!$orderBy) $orderBy = $this->cookie->qaBugOrder ? $this->cookie->qaBugOrder : 'id_desc'; setcookie('qaBugOrder', $orderBy, 0, $this->config->webRoot, '', false, true); @@ -119,7 +130,7 @@ class bug extends control $projects = $this->loadModel('project')->getPairs('empty|withdelete'); /* Get bugs. */ - $bugs = $this->bug->getBugs($productID, $projects, $branchID, $browseType, $moduleID, $queryID, $sort, $pager); + $bugs = $this->bug->getBugs($productID, $projects, $branch, $browseType, $moduleID, $queryID, $sort, $pager); /* Process the sql, get the conditon partion, save it to session. */ $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug', $browseType == 'needconfirm' ? false : true); @@ -157,7 +168,7 @@ class bug extends control $this->view->productName = $this->products[$productID]; $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID); $this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch); - $this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink'), '', $branch); + $this->view->moduleTree = $moduleTree; $this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all; $this->view->summary = $this->bug->summary($bugs); $this->view->browseType = $browseType; diff --git a/module/product/control.php b/module/product/control.php index 508191967e..171e438725 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -116,7 +116,6 @@ class product extends control /* Set product, module and query. */ $productID = $this->product->saveState($productID, $this->products); $branch = ($branch === '') ? (int)$this->cookie->preBranch : (int)$branch; - $branchID = $browseType == '' ? $branch : ($browseType == 'bybranch' ? (int)$param : ($this->cookie->storyBranch ? $this->cookie->storyBranch : $branch)); setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true); setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot, '', false, true); @@ -125,14 +124,15 @@ class product extends control $_COOKIE['storyModule'] = 0; setcookie('storyModule', 0, 0, $this->config->webRoot, '', false, false); } + if($browseType == 'bymodule' or $browseType == '') { setcookie('storyModule', (int)$param, 0, $this->config->webRoot, '', false, false); $_COOKIE['storyBranch'] = 0; setcookie('storyBranch', 0, 0, $this->config->webRoot, '', false, false); - if($browseType == '') $browseType = 'unclosed'; + if($browseType == '') setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); } - if($browseType == 'bybranch') setcookie('storyBranch', (int)$param, 0, $this->config->webRoot, '', false, false); + if($browseType == 'bybranch') setcookie('storyBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); if($browseType != 'bymodule' and $browseType != 'bybranch') $this->session->set('storyBrowseType', $browseType); $moduleID = ($browseType == 'bymodule') ? (int)$param : (($browseType == 'bysearch' or $browseType == 'bybranch') ? 0 : ($this->cookie->storyModule ? $this->cookie->storyModule : 0)); @@ -141,6 +141,19 @@ class product extends control /* Set menu. */ $this->product->setMenu($this->products, $productID, $branch); + /* Set moduleTree. */ + $createModuleLink = $storyType == 'story' ? 'createStoryLink' : 'createRequirementLink'; + if($browseType == '') + { + setcookie('treeBranch', (int)$branch, 0, $this->config->webRoot, '', false, false); + $browseType = 'unclosed'; + $moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'story', $startModuleID = 0, array('treeModel', $createModuleLink), '', $branch); + } + else + { + $moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'story', $startModuleID = 0, array('treeModel', $createModuleLink), '', (int)$this->cookie->treeBranch); + } + /* Process the order by field. */ if(!$orderBy) $orderBy = $this->cookie->productStoryOrder ? $this->cookie->productStoryOrder : 'id_desc'; setcookie('productStoryOrder', $orderBy, 0, $this->config->webRoot, '', false, true); @@ -154,7 +167,7 @@ class product extends control $pager = new pager($recTotal, $recPerPage, $pageID); /* Get stories. */ - $stories = $this->product->getStories($productID, $branchID, $browseType, $queryID, $moduleID, $storyType, $sort, $pager); + $stories = $this->product->getStories($productID, $branch, $browseType, $queryID, $moduleID, $storyType, $sort, $pager); /* Process the sql, get the conditon partion, save it to session. */ $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story', $browseType != 'bysearch'); @@ -188,8 +201,6 @@ class product extends control $showModule = !empty($this->config->datatable->productBrowse->showModule) ? $this->config->datatable->productBrowse->showModule : ''; $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'story', $showModule) : array(); - $createModuleLink = $storyType == 'story' ? 'createStoryLink' : 'createRequirementLink'; - /* Assign. */ $this->view->title = $this->products[$productID]. $this->lang->colon . $this->lang->product->browse; $this->view->position[] = $this->products[$productID]; @@ -201,7 +212,7 @@ class product extends control $this->view->stories = $stories; $this->view->plans = $this->loadModel('productplan')->getPairs($productID, $branch); $this->view->summary = $this->product->summary($stories, $storyType); - $this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'story', $startModuleID = 0, array('treeModel', $createModuleLink), '', $branch); + $this->view->moduleTree = $moduleTree; $this->view->parentModules = $this->tree->getParents($moduleID); $this->view->pager = $pager; $this->view->users = $this->user->getPairs('noletter|pofirst|nodeleted'); diff --git a/module/product/model.php b/module/product/model.php index 19af388b34..86c235e4d7 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -561,8 +561,8 @@ class productModel extends model /* Set modules and browse type. */ $modules = $moduleID ? $this->loadModel('tree')->getAllChildID($moduleID) : '0'; - $browseType = ($browseType == 'bymodule' and $this->session->storyBrowseType and $this->session->storyBrowseType != 'bysearch') ? $this->session->storyBrowseType : $browseType; $browseType = $browseType == 'bybranch' ? 'bymodule' : $browseType; + $browseType = ($browseType == 'bymodule' and $this->session->storyBrowseType and $this->session->storyBrowseType != 'bysearch') ? $this->session->storyBrowseType : $browseType; /* Get stories by browseType. */ $stories = array(); diff --git a/module/story/control.php b/module/story/control.php index 2a58fdf81b..12ada3ffd5 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -945,6 +945,7 @@ class story extends control { if($this->post->comments) { + $data = fixer::input('post')->get(); $allChanges = $this->story->batchClose(); if($allChanges) @@ -955,6 +956,13 @@ class story extends control $this->action->logHistory($actionID, $changes); } } + + foreach($data->storyParentList as $storyID => $parent) + { + if($parent == -1) $skipStory[$storyID] = $data->storyIdList[$storyID]; + } + if(isset($skipStory)) echo js::alert(sprintf($this->lang->story->parentSkip, join(',', $skipStory))); + if(!dao::isError()) $this->loadModel('score')->create('ajax', 'batchOther'); die(js::locate($this->session->storyList, 'parent')); } diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index 655f0ca508..14a0c2ccbf 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -58,7 +58,7 @@ $lang->story->batchChangeStage = "批量修改阶段"; $lang->story->batchAssignTo = "批量指派"; $lang->story->batchChangeModule = "批量修改模块"; $lang->story->viewAll = '查看全部'; -$lang->story->parentClose = '需求:%s 为父需求,将不会被关闭。'; +$lang->story->parentSkip = '需求:%s 为父需求,将不会被关闭。'; $lang->story->common = $lang->storyCommon; $lang->story->id = '编号'; diff --git a/module/story/model.php b/module/story/model.php index d7263016f3..a4cd949dfc 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1136,11 +1136,10 @@ class storyModel extends model $storyIdList = $data->storyIdList ? $data->storyIdList : array(); $oldStories = $this->getByList($storyIdList); - $parentIdList = array(); foreach($storyIdList as $storyID) { $oldStory = $oldStories[$storyID]; - if($oldStory->parent == -1) $parentIdList[] = $oldStory->id; + if($oldStory->parent == -1) continue; if($oldStory->status == 'closed') continue; $story = new stdclass(); @@ -1163,12 +1162,6 @@ class storyModel extends model unset($story); } - if(count($parentIdList)) - { - $noticeParentID = implode(',', $parentIdList); - die(js::alert(sprintf($this->lang->story->parentClose, $noticeParentID))); - } - foreach($stories as $storyID => $story) { if(!$story->closedReason) continue; diff --git a/module/story/view/batchclose.html.php b/module/story/view/batchclose.html.php index 2815cf19f4..e1812d2256 100755 --- a/module/story/view/batchclose.html.php +++ b/module/story/view/batchclose.html.php @@ -32,6 +32,7 @@ $story):?>