From 2b422e243684640f2544a222558d4fcb1ea0af90 Mon Sep 17 00:00:00 2001 From: leiyong <1549684884@qq.com> Date: Fri, 19 Feb 2021 17:51:30 +0800 Subject: [PATCH] * Finish task#36021. --- config/filter.php | 30 ++++++++++++++++-------------- module/index/css/index.css | 4 ++-- module/project/control.php | 34 ++++++++++++++++++++++++---------- module/project/lang/de.php | 1 + module/project/lang/en.php | 1 + module/project/lang/fr.php | 1 + module/project/lang/vi.php | 1 + module/project/lang/zh-cn.php | 1 + module/project/lang/zh-tw.php | 1 + module/project/model.php | 20 +++++++++++++++----- 10 files changed, 63 insertions(+), 31 deletions(-) diff --git a/config/filter.php b/config/filter.php index f2f17a2258..46fde65570 100644 --- a/config/filter.php +++ b/config/filter.php @@ -172,20 +172,22 @@ $filter->program->pgmbrowse->cookie['showClosed'] = 'code'; $filter->program->export->cookie['checkedItem'] = 'reg::checked'; $filter->program->ajaxgetpgmdropmenu->cookie['showClosed'] = 'code'; -$filter->project->default->cookie['lastProject'] = 'int'; -$filter->project->default->cookie['lastPRJ'] = 'int'; -$filter->project->default->cookie['projectMode'] = 'code'; -$filter->project->story->cookie['storyModuleParam'] = 'int'; -$filter->project->story->cookie['storyPreProjectID'] = 'int'; -$filter->project->story->cookie['storyProductParam'] = 'int'; -$filter->project->story->cookie['storyBranchParam'] = 'reg::checked'; -$filter->project->story->cookie['projectStoryOrder'] = 'reg::orderBy'; -$filter->project->task->cookie['moduleBrowseParam'] = 'int'; -$filter->project->task->cookie['preProjectID'] = 'int'; -$filter->project->task->cookie['productBrowseParam'] = 'int'; -$filter->project->task->cookie['projectTaskOrder'] = 'reg::orderBy'; -$filter->project->task->cookie['windowWidth'] = 'int'; -$filter->project->export->cookie['checkedItem'] = 'reg::checked'; +$filter->project->default->cookie['lastProject'] = 'int'; +$filter->project->default->cookie['lastPRJ'] = 'int'; +$filter->project->default->cookie['projectMode'] = 'code'; +$filter->project->default->cookie['recentExecutions'] = 'code'; +$filter->project->story->cookie['storyModuleParam'] = 'int'; +$filter->project->story->cookie['storyPreProjectID'] = 'int'; +$filter->project->story->cookie['storyProductParam'] = 'int'; +$filter->project->story->cookie['storyBranchParam'] = 'reg::checked'; +$filter->project->story->cookie['projectStoryOrder'] = 'reg::orderBy'; +$filter->project->task->cookie['moduleBrowseParam'] = 'int'; +$filter->project->task->cookie['preProjectID'] = 'int'; +$filter->project->task->cookie['productBrowseParam'] = 'int'; +$filter->project->task->cookie['projectTaskOrder'] = 'reg::orderBy'; +$filter->project->task->cookie['windowWidth'] = 'int'; +$filter->project->task->cookie['recentExecutions'] = 'code'; +$filter->project->export->cookie['checkedItem'] = 'reg::checked'; $filter->qa->default->cookie['lastProduct'] = 'int'; $filter->qa->default->cookie['preBranch'] = 'int'; diff --git a/module/index/css/index.css b/module/index/css/index.css index a2e7e20609..359a4665a0 100644 --- a/module/index/css/index.css +++ b/module/index/css/index.css @@ -24,11 +24,11 @@ body.menu-hide {padding-left: 0;} .menu-hide #menu .nav > li > a > .text {display: none} .menu-hide #menu .nav > li.has-avatar > a {padding: 2px 0;} -#moreExecution {display:none; max-height: 520px; min-height: 520px; max-width:260px; min-width: 150px; position: fixed; bottom: 40px; z-index: 999; background: white; padding: 20px 10px; border: 1px solid #efefef} +#moreExecution {display:none; max-height: 520px; min-height: 520px; max-width:360px; min-width: 150px; position: fixed; bottom: 40px; z-index: 999; background: white; padding: 20px 10px; border: 1px solid #efefef} .more-execution-show {left: 96px;} .more-execution-hide {left: 40px;} #moreExecution .icon-search {opacity: 0.5;} -#executionList {max-height: 450px; min-height: 450px; max-width:260px; min-width: 150px; margin-top: 5px;} +#executionList {max-height: 450px; min-height: 450px; max-width:360px; min-width: 150px; margin-top: 5px;} @media screen and (max-height: 768px) { diff --git a/module/project/control.php b/module/project/control.php index e095bef854..06e6d1395b 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -117,6 +117,13 @@ class project extends control if(!$projectID) $this->locate($this->createLink('program', 'PRJbrowse')); setCookie("lastPRJ", $projectID, $this->config->cookieLife, $this->config->webRoot, '', false, true); + /* Save the recently five executions visited in the cookie. */ + $recentExecutions = $this->cookie->recentExecutions ? explode('join', $this->cookie->recentExecutions) : array(); + array_unshift($recentExecutions, $executionID); + $recentExecutions = array_unique($recentExecutions); + $recentExecutions = array_slice($recentExecutions, 0, 5); + setcookie("recentExecutions", implode('join', $recentExecutions), $this->config->cookieLife, $this->config->webRoot, '', false, true); + $this->loadModel('tree'); $this->loadModel('search'); $this->loadModel('task'); @@ -2471,18 +2478,25 @@ class project extends control */ public function ajaxGetRecentExecutions() { - $executions = $this->project->getRecentExecutions(); - if(!empty($executions)) + $allExecution = $this->project->getRecentExecutions(); + if(!empty($allExecution)) { - $executionsName = array(); - foreach($executions as $execution) $executionsName[] = $execution->name; - $executionsPinYin = common::convert2Pinyin($executionsName); - foreach($executions as $execution) + foreach($allExecution as $type => $executionList) { - $link = helper::createLink('project', 'task', 'executionID=' . $execution->id, '', false, $execution->project); - $execution->code = empty($execution->code) ? $execution->name : $execution->code; - $dataKey = 'date-key="' . zget($executionsPinYin, $execution->name, $execution->name) . '"'; - echo html::a($link, ' ' . $execution->name, '', "class='search-list-item' title='$execution->name' $dataKey"); + echo '
'. $this->lang->project->$type . '
'; + $color = $type == 'recent' ? 'text-brown' : ''; + $executions = $allExecution[$type]; + $executionsName = array(); + foreach($executions as $execution) $executionsName[] = $execution->name; + $executionsPinYin = common::convert2Pinyin($executionsName); + foreach($executions as $execution) + { + $link = helper::createLink('project', 'task', 'executionID=' . $execution->id, '', false, $execution->project); + $execution->code = empty($execution->code) ? $execution->name : $execution->code; + $dataKey = 'date-key="' . zget($executionsPinYin, $execution->name, $execution->name) . '"'; + $class = "class='search-list-item $color' title='$execution->name' $dataKey"; + echo html::a($link, ' ' . $execution->name, '', $class); + } } } else diff --git a/module/project/lang/de.php b/module/project/lang/de.php index 61529d7ea6..e33155b727 100644 --- a/module/project/lang/de.php +++ b/module/project/lang/de.php @@ -81,6 +81,7 @@ $lang->project->waitTasks = 'Waiting Tasks'; $lang->project->viewByUser = 'By User'; $lang->project->oneProduct = "Only one stage can be linked {$lang->productCommon}"; $lang->project->noLinkProduct = "Stage not linked {$lang->productCommon}"; +$lang->project->recent = 'Recent visits: '; $lang->project->start = 'Start'; $lang->project->activate = 'Aktivieren'; diff --git a/module/project/lang/en.php b/module/project/lang/en.php index 421decfb13..f596508c0d 100644 --- a/module/project/lang/en.php +++ b/module/project/lang/en.php @@ -81,6 +81,7 @@ $lang->project->waitTasks = 'Waiting Tasks'; $lang->project->viewByUser = 'By User'; $lang->project->oneProduct = "Only one stage can be linked {$lang->productCommon}"; $lang->project->noLinkProduct = "Stage not linked {$lang->productCommon}"; +$lang->project->recent = 'Recent visits: '; $lang->project->start = 'Start'; $lang->project->activate = 'Activate'; diff --git a/module/project/lang/fr.php b/module/project/lang/fr.php index 0d4fd92a38..097394a9d4 100644 --- a/module/project/lang/fr.php +++ b/module/project/lang/fr.php @@ -81,6 +81,7 @@ $lang->project->waitTasks = 'Waiting Tasks'; $lang->project->viewByUser = 'Par Utilisateur'; $lang->project->oneProduct = "Only one stage can be linked {$lang->productCommon}"; $lang->project->noLinkProduct = "Stage not linked {$lang->productCommon}"; +$lang->project->recent = 'Recent visits: '; $lang->project->start = 'Démarrer'; $lang->project->activate = 'Activer'; diff --git a/module/project/lang/vi.php b/module/project/lang/vi.php index 34e73da984..5150d92d19 100644 --- a/module/project/lang/vi.php +++ b/module/project/lang/vi.php @@ -81,6 +81,7 @@ $lang->project->waitTasks = 'Waiting Tasks'; $lang->project->viewByUser = 'Theo người dùng'; $lang->project->oneProduct = "Only one stage can be linked {$lang->productCommon}"; $lang->project->noLinkProduct = "Stage not linked {$lang->productCommon}"; +$lang->project->recent = 'Recent visits: '; $lang->project->start = 'Bắt đầu'; $lang->project->activate = 'Kích hoạt'; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index 6743ec7b98..c149412794 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -81,6 +81,7 @@ $lang->project->waitTasks = '待处理'; $lang->project->viewByUser = '按用户查看'; $lang->project->oneProduct = "阶段只能关联一个{$lang->productCommon}"; $lang->project->noLinkProduct = "阶段没有关联{$lang->productCommon}"; +$lang->project->recent = '近期访问:'; $lang->project->start = "开始"; $lang->project->activate = "激活"; diff --git a/module/project/lang/zh-tw.php b/module/project/lang/zh-tw.php index 12d2f128a0..6aeeee45ee 100644 --- a/module/project/lang/zh-tw.php +++ b/module/project/lang/zh-tw.php @@ -81,6 +81,7 @@ $lang->project->waitTasks = '待處理'; $lang->project->viewByUser = '按用戶查看'; $lang->project->oneProduct = "階段只能關聯一個{$lang->productCommon}"; $lang->project->noLinkProduct = "階段沒有關聯{$lang->productCommon}"; +$lang->project->recent = '近期访问:'; $lang->project->start = "開始"; $lang->project->activate = "激活"; diff --git a/module/project/model.php b/module/project/model.php index fac6a86f38..bc7c3ddd8b 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -3594,7 +3594,7 @@ class projectModel extends model ->beginIF(!$this->app->user->admin)->andWhere('t1.project')->in($this->app->user->view->projects)->fi() ->andWhere('t1.status')->ne('closed') ->andWhere('t1.deleted')->eq('0') - ->orderBy('id_desc') + ->orderBy('project_desc, id_desc') ->fetchAll(); /* Get the project or product to which the execution belongs. */ @@ -3602,19 +3602,29 @@ class projectModel extends model $stageIdList = array(); foreach($executions as $execution) { - if($execution->type == 'stage') $stageIdList[$execution->id] = $execution->id; - if($execution->type == 'sprint') $projectIdList[$execution->project] = $execution->project; + if($execution->type == 'stage') $stageIdList[$execution->id] = $execution->id; + $projectIdList[$execution->project] = $execution->project; } $projectPairs = $this->loadModel('program')->getPRJPairsByIdList($projectIdList); $productPairs = $this->getStageLinkProductPairs($stageIdList); + $recentExecutions = explode('join', $this->cookie->recentExecutions); + $allExecution = array('recent' => array(), 'mine' => array()); foreach($executions as $execution) { - if($execution->type == 'stage') $execution->name = zget($productPairs, $execution->id) . '/' . $execution->name; + if($execution->type == 'stage') $execution->name = zget($projectPairs, $execution->project) . '/' . zget($productPairs, $execution->id) . '/' . $execution->name; if($execution->type == 'sprint') $execution->name = zget($projectPairs, $execution->project) . '/' . $execution->name; + if(in_array($execution->id, $recentExecutions)) + { + $index = array_search($execution->id, $recentExecutions); + $allExecution['recent'][$index] = $execution; + continue; + } + $allExecution['mine'][] = $execution; } - return $executions; + ksort($allExecution['recent']); + return $allExecution; } /**