diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index 98d6f387c4..1d4b97846a 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -417,7 +417,7 @@ $lang->admin->menu->custom = array('link' => "{$lang->custom->common}|custom| $lang->admin->menu->extension = array('link' => "{$lang->extension->common}|extension|browse", 'subModule' => 'extension'); $lang->admin->menu->dev = array('link' => "$lang->redev|dev|api", 'alias' => 'db', 'subModule' => 'dev,editor,entry'); $lang->admin->menu->message = array('link' => "{$lang->message->common}|message|index", 'subModule' => 'message,mail,webhook'); -$lang->admin->menu->system = array('link' => "{$lang->admin->system}|backup|index", 'subModule' => 'cron,backup,action,admin', 'exclude' => 'admin-index'); +$lang->admin->menu->system = array('link' => "{$lang->admin->system}|backup|index", 'subModule' => 'cron,backup,action,admin,search', 'exclude' => 'admin-index'); /* Admin menu order. */ $lang->admin->menuOrder[5] = 'index'; @@ -486,6 +486,7 @@ $lang->navGroup = new stdclass(); $lang->navGroup->my = 'my'; $lang->navGroup->effort = 'my'; $lang->navGroup->score = 'my'; +$lang->navGroup->todo = 'my'; $lang->navGroup->program = 'program'; $lang->navGroup->personnel = 'program'; @@ -543,7 +544,6 @@ $lang->navGroup->company = 'system'; $lang->navGroup->sqlbuilder = 'system'; $lang->navGroup->auditcl = 'system'; $lang->navGroup->cmcl = 'system'; -$lang->navGroup->todo = 'system'; $lang->navGroup->ldap = 'system'; $lang->navGroup->process = 'system'; $lang->navGroup->activity = 'system'; @@ -576,4 +576,3 @@ $lang->navGroup->dev = 'admin'; $lang->navGroup->entry = 'admin'; $lang->navGroup->extension = 'admin'; $lang->navGroup->action = 'admin'; -$lang->navGroup->search = 'admin'; diff --git a/module/index/control.php b/module/index/control.php index fba20d067b..f1c9add72f 100644 --- a/module/index/control.php +++ b/module/index/control.php @@ -69,4 +69,10 @@ class index extends control { echo $this->fetch('misc', 'getsid'); } + + public function ajaxClearObjectSession() + { + $objectType = $this->post->objectType; + $this->session->set($objectType . 'List', ''); + } } diff --git a/module/index/js/index.js b/module/index/js/index.js index ea86e26cab..cfee91f59e 100644 --- a/module/index/js/index.js +++ b/module/index/js/index.js @@ -44,6 +44,20 @@ if(!defaultApp) defaultApp = item.code; }); + + appsMap['search'] = + { + active: false, + code: "search", + group: "search", + icon: "icon-search", + methodName: "index", + moduleName: "search", + text: searchCommon, + title: " " + searchCommon, + url: "/index.php?m=search&f=index", + vars: "" + }; } /** @@ -135,6 +149,7 @@ return 'project'; } } + if(moduleName === 'search' && methodLowerCase === 'buildindex') return 'admin'; code = window.navGroup[moduleName] || moduleName || urlOrModuleName; return appsMap[code] ? code : ''; @@ -489,55 +504,9 @@ var $menu = $('#userNav .dropdown-menu').addClass('hidden'); setTimeout(function(){$menu.removeClass('hidden')}, 200); }); - - /* Hide execution list on mouseleave or click */ - $(document).click(function() - { - $("#moreExecution").hide(); - }); - - $("#recentMenu").click(function(event) - { - $('#globalSearchInput').click(); - event.stopPropagation(); - getExecutions(); - }); - - $("#moreExecution").click(function(event) - { - event.stopPropagation(); - }); }); }()); -/* Get recent executions. */ -function getExecutions() -{ - var $moreExecution = $('#moreExecution').toggle(); - if(!$moreExecution.is(':hidden')) - { - if($('body').hasClass('menu-hide')) - { - $('#moreExecution').addClass('more-execution-hide'); - } - else - { - $('#moreExecution').removeClass('more-execution-hide'); - } - - $.ajax( - { - url: createLink('execution', 'ajaxGetRecentExecutions'), - dataType: 'html', - type: 'post', - success: function(data) - { - $('#executionList').html(data); - } - }) - } -} - $.extend( { gotoObject:function() @@ -550,16 +519,19 @@ $.extend( var reg = /[^0-9]/; if(reg.test(objectValue) || objectType == 'all') { - location.href = createLink('search', 'index') + (config.requestType == 'PATH_INFO' ? '?' : '&') + 'words=' + objectValue; + var searchLink = createLink('search', 'index') + (config.requestType == 'PATH_INFO' ? '?' : '&') + 'words=' + objectValue; } else { var types = objectType.split('-'); var searchModule = types[0]; var searchMethod = typeof(types[1]) == 'undefined' ? 'view' : types[1]; - - location.href = createLink(searchModule, searchMethod, "id=" + objectValue); + var searchLink = createLink(searchModule, searchMethod, "id=" + objectValue); } + + $.post(createLink('index', 'ajaxClearObjectSession'), {objectType: objectType}); + $.apps.open(searchLink); + $('#globalSearchInput').click(); } } }); diff --git a/module/index/lang/de.php b/module/index/lang/de.php index e590de0c12..4f1d780868 100644 --- a/module/index/lang/de.php +++ b/module/index/lang/de.php @@ -1,7 +1,8 @@ index->common = 'Home'; -$lang->index->index = 'Home'; -$lang->index->search = 'Please input'; +$lang->index->common = 'Home'; +$lang->index->index = 'Home'; +$lang->index->pleaseInput = 'Please input'; +$lang->index->search = 'Search'; $lang->index->app = new stdClass(); $lang->index->app->open = 'Open'; diff --git a/module/index/lang/en.php b/module/index/lang/en.php index e590de0c12..4f1d780868 100644 --- a/module/index/lang/en.php +++ b/module/index/lang/en.php @@ -1,7 +1,8 @@ index->common = 'Home'; -$lang->index->index = 'Home'; -$lang->index->search = 'Please input'; +$lang->index->common = 'Home'; +$lang->index->index = 'Home'; +$lang->index->pleaseInput = 'Please input'; +$lang->index->search = 'Search'; $lang->index->app = new stdClass(); $lang->index->app->open = 'Open'; diff --git a/module/index/lang/fr.php b/module/index/lang/fr.php index e590de0c12..4f1d780868 100644 --- a/module/index/lang/fr.php +++ b/module/index/lang/fr.php @@ -1,7 +1,8 @@ index->common = 'Home'; -$lang->index->index = 'Home'; -$lang->index->search = 'Please input'; +$lang->index->common = 'Home'; +$lang->index->index = 'Home'; +$lang->index->pleaseInput = 'Please input'; +$lang->index->search = 'Search'; $lang->index->app = new stdClass(); $lang->index->app->open = 'Open'; diff --git a/module/index/lang/vi.php b/module/index/lang/vi.php index e590de0c12..4f1d780868 100644 --- a/module/index/lang/vi.php +++ b/module/index/lang/vi.php @@ -1,7 +1,8 @@ index->common = 'Home'; -$lang->index->index = 'Home'; -$lang->index->search = 'Please input'; +$lang->index->common = 'Home'; +$lang->index->index = 'Home'; +$lang->index->pleaseInput = 'Please input'; +$lang->index->search = 'Search'; $lang->index->app = new stdClass(); $lang->index->app->open = 'Open'; diff --git a/module/index/lang/zh-cn.php b/module/index/lang/zh-cn.php index 9ad6624c0e..823c4281b4 100644 --- a/module/index/lang/zh-cn.php +++ b/module/index/lang/zh-cn.php @@ -1,7 +1,8 @@ index->common = '首页'; -$lang->index->index = '首页'; -$lang->index->search = '请输入'; +$lang->index->common = '首页'; +$lang->index->index = '首页'; +$lang->index->pleaseInput = '请输入'; +$lang->index->search = '搜索'; $lang->index->app = new stdClass(); $lang->index->app->open = '打开'; diff --git a/module/index/lang/zh-tw.php b/module/index/lang/zh-tw.php index 4fe25547a6..7ed9566f9b 100644 --- a/module/index/lang/zh-tw.php +++ b/module/index/lang/zh-tw.php @@ -1,7 +1,8 @@ index->common = '首頁'; -$lang->index->index = '首頁'; -$lang->index->search = '請輸入'; +$lang->index->common = '首页'; +$lang->index->index = '首页'; +$lang->index->pleaseInput = '请输入'; +$lang->index->search = '搜索'; $lang->index->app = new stdClass(); $lang->index->app->open = '打開'; diff --git a/module/index/view/index.html.php b/module/index/view/index.html.php index 0f186bef99..e803b801b5 100644 --- a/module/index/view/index.html.php +++ b/module/index/view/index.html.php @@ -69,7 +69,7 @@ js::set('defaultOpen', $open);
@@ -118,4 +118,5 @@ js::set('defaultOpen', $open); searchAB);?> searchObjects)) . ',');?> +index->search);?> diff --git a/module/project/control.php b/module/project/control.php index e844295598..695a7d215d 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -488,8 +488,10 @@ class project extends control */ public function view($projectID = 0) { + $project = $this->project->getById($projectID); + if(empty($project) || strpos('scrum,waterfall', $project->model) === false) die(js::error($this->lang->notFound) . js::locate('back')); + $this->project->setMenu($projectID); - $this->app->loadLang('bug'); $this->app->session->set('projectBrowse', $this->app->getURI(true)); @@ -507,7 +509,7 @@ class project extends control $this->view->title = $this->lang->project->view; $this->view->position = $this->lang->project->view; $this->view->projectID = $projectID; - $this->view->project = $this->project->getByID($projectID); + $this->view->project = $project; $this->view->products = $products; $this->view->actions = $this->loadModel('action')->getList('project', $projectID); $this->view->users = $this->loadModel('user')->getPairs('noletter'); diff --git a/module/search/control.php b/module/search/control.php index 0fa15be581..240c033992 100644 --- a/module/search/control.php +++ b/module/search/control.php @@ -157,7 +157,9 @@ class search extends control } } - $this->lang->search->menu = $this->lang->admin->menu; + $this->lang->navGroup->search = 'admin'; + $this->lang->search->menu = $this->lang->admin->menu; + $this->lang->search->menuOrder = $this->lang->admin->menuOrder; $this->view->title = $this->lang->search->buildIndex; $this->display(); @@ -184,12 +186,15 @@ class search extends control if(empty($type)) $type = $this->post->type; if(empty($type) and ($recTotal != 0 or $pageID != 1)) $type = $this->session->searchIngType; $type = (empty($type) or $type[0] == 'all') ? 'all' : $type; + //if($objectType != 'all') $type = explode('', $objectType); $this->app->loadClass('pager', $static = true); - $pager = new pager($recTotal, $this->config->search->recPerPage, $pageID); + $pager = new pager($recTotal, $this->config->search->recPerPage, $pageID); + $begin = time(); + $result = $this->search->getList($words, $pager, $type); /* Set session. */ - $uri = inlink('index', "recTotal=$recTotal&pageID=$pageID"); + $uri = inlink('index', "recTotal=$pager->recTotal&pageID=$pager->pageID"); $uri .= strpos($uri, '?') === false ? '?' : '&'; $uri .= 'words=' . $words; $this->session->set('bugList', $uri); @@ -198,6 +203,8 @@ class search extends control $this->session->set('docList', $uri); $this->session->set('productList', $uri); $this->session->set('productPlanList', $uri); + $this->session->set('programList', $uri); + $this->session->set('projectList', $uri); $this->session->set('executionList', $uri); $this->session->set('releaseList', $uri); $this->session->set('storyList', $uri); @@ -212,20 +219,18 @@ class search extends control $this->session->set('searchIngWord', $words); $this->session->set('searchIngType', $type); - $begin = time(); - $this->view->results = $this->search->getList($words, $pager, $type); - if(strpos($this->server->http_referer, 'search') === false) { $this->session->set('referer', $this->server->http_referer); } - $this->view->consumed = time() - $begin; - $this->view->title = $this->lang->search->index; - $this->view->type = $type; - $this->view->pager = $pager; - $this->view->words = $words; - $this->view->referer = $this->session->referer; + $this->view->results = $result; + $this->view->consumed = time() - $begin; + $this->view->title = $this->lang->search->index; + $this->view->type = $type; + $this->view->pager = $pager; + $this->view->words = $words; + $this->view->referer = $this->session->referer; $this->display(); } diff --git a/module/search/model.php b/module/search/model.php index f8aa24abb1..1bb60ef7af 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -543,8 +543,6 @@ class searchModel extends model if(common::hasPriv($module, 'view')) $allowedObject[] = $objectType; if($module == 'caselib' and common::hasPriv('caselib', 'view')) $allowedObject[] = $objectType; - if($module == 'execution' and common::haspriv('project', 'view')) $allowedobject[] = $objectType; - if($module == 'project' and common::haspriv('program', 'index')) $allowedobject[] = $objectType; if($module == 'deploystep' and common::haspriv('deploy', 'viewstep')) $allowedobject[] = $objectType; } } @@ -578,7 +576,7 @@ class searchModel extends model { if(!isset($this->config->objectTables[$record->objectType])) continue; $table = $this->config->objectTables[$record->objectType]; - $projectID = $this->dao->select('project')->from($table)->where('id')->eq($record->objectID)->fetch('project'); + $projectID = $this->dao->select('project')->from($table)->where('id')->eq($record->objectID)->fetch('project'); $record->url = helper::createLink($module, $method, "id={$record->objectID}", '', false, $projectID); } elseif($module == 'issue') @@ -587,22 +585,18 @@ class searchModel extends model $record->url = helper::createLink($module, $method, "id={$record->objectID}", '', false, $issue->project); $record->extraType = empty($issue->owner) ? 'commonIssue' : 'stakeholderIssue'; } + elseif($module == 'execution') + { + $execution = $this->dao->select('id,type,project')->from(TABLE_EXECUTION)->where('id')->eq($record->objectID)->fetch(); + $record->url = helper::createLink('execution', $method, "id={$record->objectID}", '', false, $execution->project); + $record->extraType = $execution->type; + } elseif($module == 'story') { $story = $this->dao->select('id,type')->from(TABLE_STORY)->where('id')->eq($record->objectID)->fetch(); $record->url = helper::createLink($module, $method, "id={$record->objectID}", '', false, 0, true); $record->extraType = $story->type; } - elseif($module == 'execution') - { - $execution = $this->dao->select('id,type,project')->from(TABLE_PROJECT)->where('id')->eq($record->objectID)->fetch(); - $record->url = helper::createLink('execution', $method, "id={$record->objectID}", '', false, $execution->project); - $record->extraType = $execution->type; - } - elseif($module == 'project') - { - $record->url = helper::createLink('project', 'index', "id={$record->objectID}", '', false, 0, true); - } else { $record->url = helper::createLink($module, $method, "id={$record->objectID}", '', false, 0, true); diff --git a/module/search/view/index.html.php b/module/search/view/index.html.php index 9dbc8dd964..d8db9e44d4 100644 --- a/module/search/view/index.html.php +++ b/module/search/view/index.html.php @@ -1,4 +1,22 @@ - + + +