diff --git a/module/bug/control.php b/module/bug/control.php index e6a5ccb308..337f06075d 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -114,6 +114,7 @@ class bug extends control /* Build the search form. */ $actionURL = $this->createLink('bug', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID"); + $this->config->bug->search['onMenuBar'] = 'yes'; $this->bug->buildSearchForm($productID, $this->products, $queryID, $actionURL); $this->loadModel('search')->mergeFeatureBar('bug', 'browse'); diff --git a/module/product/control.php b/module/product/control.php index 4736a13696..ae37029ee2 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -160,6 +160,7 @@ class product extends control /* Build search form. */ $actionURL = $this->createLink('product', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID"); + $this->config->product->search['onMenuBar'] = 'yes'; $this->product->buildSearchForm($productID, $this->products, $queryID, $actionURL); $this->loadModel('search')->mergeFeatureBar('product', 'browse'); diff --git a/module/project/control.php b/module/project/control.php index 5e5830cbff..9f9ce9a98f 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -189,6 +189,7 @@ class project extends control /* Build the search form. */ $actionURL = $this->createLink('project', 'task', "projectID=$projectID&status=bySearch¶m=myQueryID"); + $this->config->project->search['onMenuBar'] = 'yes'; $this->project->buildSearchForm($projectID, $this->projects, $queryID, $actionURL); $this->loadModel('search')->mergeFeatureBar('project', 'task'); @@ -1682,6 +1683,8 @@ class project extends control $productType = 'normal'; $productNum = count($products); $branches = array(); + $modules = array(); + $this->loadModel('tree'); foreach($products as $product) { $productPairs[$product->id] = $product->name; @@ -1703,14 +1706,16 @@ class project extends control $branchPairs += $productBranches; } } + foreach($this->tree->getOptionMenu($product->id) as $moduleID => $moduleName) $modules[$moduleID] = $moduleName; } /* Build search form. */ - unset($this->config->product->search['fields']['module']); + if(count($products) >= 2) unset($this->config->product->search['fields']['module']); $this->config->product->search['actionURL'] = $this->createLink('project', 'linkStory', "projectID=$projectID&browseType=bySearch&queryID=myQueryID"); $this->config->product->search['queryID'] = $queryID; $this->config->product->search['params']['product']['values'] = $productPairs + array('all' => $this->lang->product->allProductsOfProject); $this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts($products); + if(count($products) == 1) $this->config->product->search['params']['module']['values'] = $modules; unset($this->lang->story->statusList['draft']); if($productType == 'normal') { @@ -1748,6 +1753,7 @@ class project extends control $this->view->prjStories = $prjStories; $this->view->browseType = $browseType; $this->view->productType = $productType; + $this->view->modules = $modules; $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->branchGroups = $branchGroups; $this->display(); diff --git a/module/search/control.php b/module/search/control.php index 0c138acee8..4172a0dc04 100644 --- a/module/search/control.php +++ b/module/search/control.php @@ -30,6 +30,7 @@ class search extends control $fieldParams = empty($fieldParams) ? json_decode($this->session->searchParams['fieldParams'], true) : $fieldParams; $actionURL = empty($actionURL) ? $this->session->searchParams['actionURL'] : $actionURL; $style = isset($_SESSION['searchParams']['style']) ? $this->session->searchParams['style'] : ''; + $onMenuBar = isset($_SESSION['searchParams']['onMenuBar']) ? $this->session->searchParams['onMenuBar'] : ''; $this->search->initSession($module, $searchFields, $fieldParams); $this->view->module = $module; @@ -40,6 +41,7 @@ class search extends control $this->view->queries = $this->search->getQueryPairs($module); $this->view->queryID = $queryID; $this->view->style = empty($style) ? 'full' : $style; + $this->view->onMenuBar = empty($onMenuBar) ? 'no' : $onMenuBar; $this->display(); } @@ -61,7 +63,7 @@ class search extends control * @access public * @return void */ - public function saveQuery($module) + public function saveQuery($module, $onMenuBar = 'no') { if($_POST) { @@ -69,7 +71,8 @@ class search extends control if(!$queryID) die(js::error(dao::getError())); die(js::closeModal('parent.parent', '', "function(){parent.parent.loadQueries($queryID)}")); } - $this->view->module = $module; + $this->view->module = $module; + $this->view->onMenuBar = $onMenuBar; $this->display(); } diff --git a/module/search/model.php b/module/search/model.php index 755dc911f2..b0124f2247 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -28,6 +28,7 @@ class searchModel extends model $searchParams['fieldParams'] = json_encode($searchConfig['params']); $searchParams['actionURL'] = $searchConfig['actionURL']; $searchParams['style'] = zget($searchConfig, 'style', 'full'); + $searchParams['onMenuBar'] = zget($searchConfig, 'onMenuBar', 'no'); $searchParams['queryID'] = isset($searchConfig['queryID']) ? $searchConfig['queryID'] : 0; $this->session->set('searchParams', $searchParams); diff --git a/module/search/view/buildform.html.php b/module/search/view/buildform.html.php index dcc89e0230..2f9f14d188 100644 --- a/module/search/view/buildform.html.php +++ b/module/search/view/buildform.html.php @@ -400,7 +400,7 @@ foreach($fieldParams as $fieldName => $param) if($style != 'simple') { echo html::commonButton($lang->search->reset, 'onclick=resetForm(this)'); - if(common::hasPriv('search', 'saveQuery')) echo html::a($this->createLink('search', 'saveQuery', "module=$module"), $lang->save, '', "class='saveQuery btn'"); + if(common::hasPriv('search', 'saveQuery')) echo html::a($this->createLink('search', 'saveQuery', "module=$module&onMenuBar=$onMenuBar"), $lang->save, '', "class='saveQuery btn'"); } echo ''; ?> diff --git a/module/search/view/savequery.html.php b/module/search/view/savequery.html.php index e0d6811a9f..7ee2a2a413 100644 --- a/module/search/view/savequery.html.php +++ b/module/search/view/savequery.html.php @@ -14,7 +14,7 @@