From 6491d70c06aaa3655a4dfa5a010841cebbdd6189 Mon Sep 17 00:00:00 2001 From: Wenrui LI Date: Wed, 7 Dec 2022 09:43:50 +0800 Subject: [PATCH 01/13] * move task get list by search into task model, and add to api. --- api/v1/entries/tasks.php | 22 +++++++++++- module/task/model.php | 34 +++++++++++++++++++ .../extension/xuan/im/ext/bot/zentao.bot.php | 4 +-- .../xuan/task/ext/model/xuanxuan.php | 30 ---------------- 4 files changed, 57 insertions(+), 33 deletions(-) delete mode 100644 xuanxuan/extension/xuan/task/ext/model/xuanxuan.php diff --git a/api/v1/entries/tasks.php b/api/v1/entries/tasks.php index 63ed468957..1fb8282ae9 100644 --- a/api/v1/entries/tasks.php +++ b/api/v1/entries/tasks.php @@ -20,7 +20,27 @@ class tasksEntry extends entry */ public function get($executionID = 0) { - if(!$executionID) + /* Get tasks by search, search arguments available: pri, assignedTo, status, id, name. Pager arguments will be utilized as well. */ + if($this->param('search', 0) == 1) + { + $this->loadModel('task'); + $searchParams = array(); + foreach(array('pri' => 'priList', 'assignedTo' => 'assignedToList', 'status' => 'statusList', 'id' => 'idList', 'name' => 'taskName') as $field => $condName) + { + if($this->param($field, false)) $searchParams[$condName] = $this->param($field); + } + + $this->app->loadClass('pager', $static = true); + $pager = pager::init($this->param('total', 0), $this->param('limit', 20), $this->param('page', 1)); + $tasks = $this->task->getListByConds((object)$searchParams, $this->param('order', 'id_desc'), $pager); + + $data = new stdclass(); + $data->status = 'success'; + $data->data = new stdclass(); + $data->data->tasks = array_values($tasks); + $data->data->pager = (object)$pager; + } + elseif(!$executionID) { /* Get my tasks defaultly. */ $control = $this->loadController('my', 'task'); diff --git a/module/task/model.php b/module/task/model.php index dd57730843..84cba6af2a 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -4339,4 +4339,38 @@ class taskModel extends model $order ++; } } + + /** + * Get task list by conditions. + * + * @param object $conds + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ + public function getListByConds($conds, $orderBy = 'id_desc', $pager = null) + { + foreach(array('priList' => array(), 'assignedToList' => array(), 'statusList' => array(), 'idList' => array(), 'taskName' => '') as $condKey => $defaultValue) + { + if(!isset($conds->$condKey)) + { + $conds->$condKey = $defaultValue; + continue; + } + if(strripos($condKey, 'list') === strlen($condKey) - 4 && !is_array($conds->$condKey)) $conds->$condKey = array_filter(explode(',', $conds->$condKey)); + } + + return $this->dao->select('*')->from(TABLE_TASK) + ->where('deleted')->eq(0) + ->beginIF(!empty($conds->priList))->andWhere('pri')->in($conds->priList)->fi() + ->beginIF(!empty($conds->assignedToList))->andWhere('assignedTo')->in($conds->assignedToList)->fi() + ->beginIF(!empty($conds->statusList))->andWhere('status')->in($conds->statusList)->fi() + ->beginIF(!empty($conds->idList))->andWhere('id')->in($conds->idList)->fi() + ->beginIF(!empty($conds->taskName))->andWhere('name')->like("%{$conds->taskName}%") + ->beginIF(!$this->app->user->admin)->andWhere('execution')->in($this->app->user->view->sprints)->fi() + ->orderBy($orderBy) + ->page($pager) + ->fetchAll('id'); + } } diff --git a/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php b/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php index 940530236b..f3e03b74fa 100644 --- a/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php +++ b/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php @@ -353,7 +353,7 @@ class zentaoBot extends xuanBot $conds = new stdClass(); $conds->assignedToList = is_object($user) ? $user->account : false; $conds->statusList = 'wait,doing,done,pause,cancel'; - return $this->im->task->getListByConds($conds, 'status_asc', 0, $pager); + return $this->im->task->getListByConds($conds, 'status_asc', $pager); } $keys = array(); @@ -364,7 +364,7 @@ class zentaoBot extends xuanBot $keys['taskName'] = true; $conds = $this->parseArguments($args, $keys); - return $this->im->task->getListByConds($conds, 'status_asc', 0, $pager); + return $this->im->task->getListByConds($conds, 'status_asc', $pager); } /** diff --git a/xuanxuan/extension/xuan/task/ext/model/xuanxuan.php b/xuanxuan/extension/xuan/task/ext/model/xuanxuan.php deleted file mode 100644 index 9d2302186e..0000000000 --- a/xuanxuan/extension/xuan/task/ext/model/xuanxuan.php +++ /dev/null @@ -1,30 +0,0 @@ - array(), 'assignedToList' => array(), 'statusList' => array(), 'idList' => array(), 'taskName' => '') as $condKey => $defaultValue) - { - if(!isset($conds->$condKey)) $conds->$condKey = $defaultValue; - } - - return $this->dao->select('*')->from(TABLE_TASK) - ->where('deleted')->eq(0) - ->beginIF(!empty($conds->priList))->andWhere('pri')->in($conds->priList)->fi() - ->beginIF(!empty($conds->assignedToList))->andWhere('assignedTo')->in($conds->assignedToList)->fi() - ->beginIF(!empty($conds->statusList))->andWhere('status')->in($conds->statusList)->fi() - ->beginIF(!empty($conds->idList))->andWhere('id')->in($conds->idList)->fi() - ->beginIF(!empty($conds->taskName))->andWhere('name')->like("%{$conds->taskName}%") - ->orderBy($orderBy) - ->beginIF($limit > 0)->limit($limit)->fi() - ->page($pager) - ->fetchAll('id'); -} From 8aa30bd2815a60e30422be1f8fc3ded08a8648e4 Mon Sep 17 00:00:00 2001 From: Wenrui LI Date: Wed, 7 Dec 2022 10:36:49 +0800 Subject: [PATCH 02/13] * use tasks api in zentao bot. --- api/v1/entries/tasks.php | 7 ++- framework/api/entry.class.php | 15 +++-- .../extension/xuan/im/ext/bot/zentao.bot.php | 62 +++++++++++-------- 3 files changed, 53 insertions(+), 31 deletions(-) diff --git a/api/v1/entries/tasks.php b/api/v1/entries/tasks.php index 1fb8282ae9..53477cc5f4 100644 --- a/api/v1/entries/tasks.php +++ b/api/v1/entries/tasks.php @@ -27,7 +27,12 @@ class tasksEntry extends entry $searchParams = array(); foreach(array('pri' => 'priList', 'assignedTo' => 'assignedToList', 'status' => 'statusList', 'id' => 'idList', 'name' => 'taskName') as $field => $condName) { - if($this->param($field, false)) $searchParams[$condName] = $this->param($field); + if($this->param($field, false)) + { + $searchParams[$condName] = $this->param($field); + continue; + } + if($this->param($condName, false)) $searchParams[$condName] = $this->param($condName); } $this->app->loadClass('pager', $static = true); diff --git a/framework/api/entry.class.php b/framework/api/entry.class.php index 33018ca827..0b3f15714b 100644 --- a/framework/api/entry.class.php +++ b/framework/api/entry.class.php @@ -98,7 +98,7 @@ class baseEntry * Get request params. * * @param string $key - * @param string $defaultValue + * @param mixed $defaultValue * @access public * @return mixed */ @@ -112,13 +112,18 @@ class baseEntry * 设置请求参数 * Set request param. * - * @param string $key - * @param mixed $value + * @param string|array $key if is array, set params by its key-value pairs. + * @param mixed $value * @access public - * @return mixed + * @return void */ - public function setParam($key, $value) + public function setParam($key, $value = null) { + if(is_array($key)) + { + foreach($key as $k => $v) $_GET[$k] = $v; + return; + } $_GET[$key] = $value; } diff --git a/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php b/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php index f3e03b74fa..c8b8d27cad 100644 --- a/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php +++ b/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php @@ -344,27 +344,37 @@ class zentaoBot extends xuanBot * @param object $user * @param object $pager * @access public - * @return object|string + * @return array */ public function viewTask($args = array(), $user = null, $pager = null) { + $keys = array(); + foreach(array('pri', 'id', 'status', 'assignTo', 'taskName') as $key) $keys[$key] = true; + if(empty($args)) { - $conds = new stdClass(); - $conds->assignedToList = is_object($user) ? $user->account : false; - $conds->statusList = 'wait,doing,done,pause,cancel'; - return $this->im->task->getListByConds($conds, 'status_asc', $pager); + $keys['assignTo'] = is_object($user) ? $user->account : false; + $keys['status'] = 'wait,doing,done,pause,cancel'; } - $keys = array(); - $keys['pri'] = true; - $keys['id'] = true; - $keys['status'] = true; - $keys['assignTo'] = true; - $keys['taskName'] = true; - $conds = $this->parseArguments($args, $keys); - return $this->im->task->getListByConds($conds, 'status_asc', $pager); + $conds->search = 1; + $conds->order = 'status_asc'; + + $result = $this->loadEntry('tasks', 'get', array(), (array)$conds); + + if(isset($result->tasks)) + { + /* Update pager with result. */ + $pager->setRecTotal($result->total); + $pager->setRecPerPage($result->limit); + $pager->setPageID($result->page); + $pager->setPageTotal(); + + return $result->tasks; + } + + return array(); } /** @@ -578,26 +588,24 @@ class zentaoBot extends xuanBot public function renderTask($tasks, $originArgs, $pager) { $lang = $this->im->lang; - if(!$tasks || $pager->recTotal === 0) return $lang->task->noTask; - $sysURL = common::getSysURL(); + $taskCount = $pager->recTotal ? $pager->recTotal : count($tasks); - if($pager->recTotal == 1) + if($taskCount === 0) return $lang->task->noTask; + + if($taskCount == 1) { $task = current($tasks); $link = str_replace('x.php', 'index.php', helper::createLink('task', 'view', "taskID=$task->id", 'html')); $messages = new stdclass(); $messages->type = 'url'; - $messages->url = $sysURL . $link; - return array(sprintf($this->lang->tasksFound, $pager->recTotal), $messages); + $messages->url = common::getSysURL() . $link; + return array(sprintf($this->lang->tasksFound, $taskCount), $messages); } $messages = array(); - if($pager->pageID == 1) - { - $messages[] = sprintf($this->lang->tasksFound, $pager->recTotal); - } + if($pager->pageID == 1) $messages[] = sprintf($this->lang->tasksFound, $taskCount); $taskTable = $this->renderTaskTable($tasks); @@ -633,7 +641,6 @@ class zentaoBot extends xuanBot public function renderTaskTable($tasks) { $lang = $this->im->lang; - $sysURL = common::getSysURL(); $headMap = array('id'=>'ID', 'pri' => $lang->task->pri, 'name' => $lang->task->name, 'assignedTo' => $lang->task->assignedTo, 'status' => $lang->task->status, 'estimate' => $lang->task->estimateAB, 'consumed' => $lang->task->consumedAB, 'left' => $lang->task->leftAB, 'actions' => $lang->actions); $thead = ''; @@ -645,7 +652,7 @@ class zentaoBot extends xuanBot { $tr = ''; $link = str_replace('x.php', 'index.php', helper::createLink('task', 'view', "taskID=$task->id", 'html')); - $href = urlencode($sysURL . $link); + $href = urlencode(common::getSysURL() . $link); $isParent = $task->parent == -1; $isChild = $task->parent > 0; $isMulti = !empty($task->mode); @@ -948,11 +955,12 @@ class zentaoBot extends xuanBot * @param string $entry * @param string $action * @param array $params + * @param array $query * @param string $version * @access public * @return object */ - public function loadEntry($entry, $action, $params = array(), $version = 'v1') + public function loadEntry($entry, $action, $params = array(), $query = array(), $version = 'v1') { try { @@ -979,6 +987,10 @@ class zentaoBot extends xuanBot { $entry->requestBody = (object)$params; } + elseif($action == 'get' && !empty($query)) + { + $entry->setParam($query); + } $content = call_user_func_array(array($entry, $action), $params); return json_decode($content); From a6258b2d7874b573864c7806ac2a0e05dcd95e5d Mon Sep 17 00:00:00 2001 From: Wenrui LI Date: Wed, 7 Dec 2022 10:40:01 +0800 Subject: [PATCH 03/13] * add todo for tasks search api. --- api/v1/entries/tasks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/v1/entries/tasks.php b/api/v1/entries/tasks.php index 53477cc5f4..c29d861022 100644 --- a/api/v1/entries/tasks.php +++ b/api/v1/entries/tasks.php @@ -21,7 +21,7 @@ class tasksEntry extends entry public function get($executionID = 0) { /* Get tasks by search, search arguments available: pri, assignedTo, status, id, name. Pager arguments will be utilized as well. */ - if($this->param('search', 0) == 1) + if($this->param('search', 0) == 1) // TODO: document this api. { $this->loadModel('task'); $searchParams = array(); From ae62bdff75e61eb06999c1c783713c8f6ee1bb62 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 7 Dec 2022 14:19:36 +0800 Subject: [PATCH 04/13] * Code for task#78661. --- module/tree/control.php | 8 ++++++++ module/tree/view/edit.html.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/module/tree/control.php b/module/tree/control.php index 90280d30ea..9de9df00ab 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -536,6 +536,14 @@ class tree extends control { $optionMenu = $this->tree->getOptionMenu($rootID, $viewType, $rootModuleID, $branch); } + + if(strpos($extra, 'excludeModuleID') !== false) + { + parse_str($extra, $output); + $excludeModuleID = $output['excludeModuleID']; + if(isset($optionMenu[$excludeModuleID])) unset($optionMenu[$excludeModuleID]); + } + if($returnType == 'html') { //Code for task #5081. diff --git a/module/tree/view/edit.html.php b/module/tree/view/edit.html.php index 861740098a..233893d74e 100644 --- a/module/tree/view/edit.html.php +++ b/module/tree/view/edit.html.php @@ -189,7 +189,7 @@ function loadModules(branch) if(typeof(branchID) == 'undefined') branchID = 0; if(typeof(moduleID) == 'undefined') moduleID = 0; - link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branchID + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=¤tModuleID=' + moduleID); + link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branchID + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=excludeModuleID=' + id;?> + '¤tModuleID=' + moduleID); $(moduleBox).load(link, function() { $(this).children('select').attr('id', 'parent').attr('name', 'parent'); From ec6f263bd3c926624f35558ae1d221ba036c9075 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 7 Dec 2022 21:42:59 +0800 Subject: [PATCH 05/13] * Code for task#78661. --- module/tree/control.php | 7 ++++--- module/tree/model.php | 5 ++++- module/tree/view/edit.html.php | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/module/tree/control.php b/module/tree/control.php index 9de9df00ab..dc5c7d5285 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -390,7 +390,7 @@ class tree extends control } else { - $this->view->optionMenu = $this->tree->getOptionMenu($module->root, $module->type, 0, $module->branch); + $this->view->optionMenu = $this->tree->getOptionMenu($module->root, $module->type, 0, $module->branch, 'noMainBranch'); } if($type == 'doc') $this->view->libs = $this->loadModel('doc')->getLibs('all', $extra = 'withObject', '', 0, 'book'); @@ -534,12 +534,13 @@ class tree extends control } else { - $optionMenu = $this->tree->getOptionMenu($rootID, $viewType, $rootModuleID, $branch); + $optionMenu = $this->tree->getOptionMenu($rootID, $viewType, $rootModuleID, $branch, $extra); } if(strpos($extra, 'excludeModuleID') !== false) { - parse_str($extra, $output); + list($excludeModule, $noMainBranch) = explode(',', $extra); + parse_str($excludeModule, $output); $excludeModuleID = $output['excludeModuleID']; if(isset($optionMenu[$excludeModuleID])) unset($optionMenu[$excludeModuleID]); } diff --git a/module/tree/model.php b/module/tree/model.php index c84f818e66..c026a3aec2 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -109,11 +109,14 @@ class treeModel extends model ->andWhere('type')->in($type) ->beginIF($grade)->andWhere('grade')->le($grade)->fi() ->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi() - ->beginIF($branch !== 'all' and $branch !== '' and $branch !== false) + ->beginIF($branch !== 'all' and $branch !== '' and $branch !== false and strpos($param, 'noMainBranch') === false) ->andWhere('(branch')->eq(0) ->orWhere('branch')->eq($branch) ->markRight(1) ->fi() + ->beginIF($branch !== 'all' and $branch !== '' and $branch !== false and strpos($param, 'noMainBranch') !== false) + ->andWhere('branch')->eq($branch) + ->fi() ->beginIF(strpos($param, 'nodeleted') !== false)->andWhere('deleted')->eq(0)->fi() ->orderBy('grade desc, `order`') ->get(); diff --git a/module/tree/view/edit.html.php b/module/tree/view/edit.html.php index 233893d74e..09e8713b54 100644 --- a/module/tree/view/edit.html.php +++ b/module/tree/view/edit.html.php @@ -189,7 +189,7 @@ function loadModules(branch) if(typeof(branchID) == 'undefined') branchID = 0; if(typeof(moduleID) == 'undefined') moduleID = 0; - link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branchID + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=excludeModuleID=' + id;?> + '¤tModuleID=' + moduleID); + link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branchID + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=excludeModuleID=' + id;?> + ',noMainBranch¤tModuleID=' + moduleID); $(moduleBox).load(link, function() { $(this).children('select').attr('id', 'parent').attr('name', 'parent'); From 3e18aa302a8210edc894048573354c4eb9fec615 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 8 Dec 2022 09:16:17 +0800 Subject: [PATCH 06/13] * fix bug #30584. --- module/build/css/view.css | 1 + module/build/view/view.html.php | 6 +++--- module/project/control.php | 5 ++++- module/projectrelease/css/view.css | 1 + module/projectrelease/view/view.html.php | 6 +++--- module/release/css/view.css | 1 + module/release/view/view.html.php | 6 +++--- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/module/build/css/view.css b/module/build/css/view.css index 3f124385b5..0789a2c0c3 100644 --- a/module/build/css/view.css +++ b/module/build/css/view.css @@ -6,3 +6,4 @@ .body-modal #mainContent {min-height: 200px;} td.article-content{overflow:auto !important;} +td.c-build{white-space: nowrap; overflow:hidden;} diff --git a/module/build/view/view.html.php b/module/build/view/view.html.php index abdf3700b4..dfdcb00dbf 100644 --- a/module/build/view/view.html.php +++ b/module/build/view/view.html.php @@ -148,7 +148,7 @@ tbody tr td:first-child input {display: none;} ?> - + openedBy);?> estimate . $config->hourUnit;?> @@ -254,7 +254,7 @@ tbody tr td:first-child input {display: none;} - + openedBy);?> openedDate) ? '' : substr($bug->openedDate, 5, 11);?> @@ -343,7 +343,7 @@ tbody tr td:first-child input {display: none;} $openedBuilds = ''; foreach(explode(',', $bug->openedBuild) as $buildID) $openedBuilds .= ($buildID == 'trunk' ? 'Trunk' : zget($buildPairs, $buildID, '')) . ' '; ?> - + openedBy);?> openedDate) ? '' : substr($bug->openedDate, 5, 11);?> resolvedBy);?> diff --git a/module/project/control.php b/module/project/control.php index 11669e7579..3bdd635c89 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -1466,7 +1466,10 @@ class project extends control { $showBranch = true; $branchPairs = $branchGroups[$build->product]; - foreach(explode(',', trim($build->branch, ',')) as $branchID) $build->branchName .= "{$branchPairs[$branchID]},"; + foreach(explode(',', trim($build->branch, ',')) as $branchID) + { + if(isset($branchPairs[$branchID])) $build->branchName .= "{$branchPairs[$branchID]},"; + } $build->branchName = trim($build->branchName, ','); } } diff --git a/module/projectrelease/css/view.css b/module/projectrelease/css/view.css index 5be75906d4..a35a23f770 100644 --- a/module/projectrelease/css/view.css +++ b/module/projectrelease/css/view.css @@ -9,3 +9,4 @@ #tabsNav .nav-tabs > li.active + li.pull-right {margin-right: 0;} ol, ul {padding-left: 20px;} .c-id {overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} +td.c-build{white-space: nowrap; overflow:hidden;} diff --git a/module/projectrelease/view/view.html.php b/module/projectrelease/view/view.html.php index 12b816fe23..6c1854caac 100644 --- a/module/projectrelease/view/view.html.php +++ b/module/projectrelease/view/view.html.php @@ -99,7 +99,7 @@ echo html::a($storyLink,$story->title, '', "class='preview'"); ?> - buildName?> + buildName?> openedBy);?> estimate . $config->hourUnit;?> @@ -195,7 +195,7 @@ processStatus('bug', $bug);?> resolvedBuild, '');?> - + openedBy);?> openedDate) ? '' : substr($bug->openedDate, 5, 11);?> resolvedBy);?> @@ -305,7 +305,7 @@ $openedBuildName = ''; foreach(explode(',', $bug->openedBuild) as $buildID) $openedBuildName .= zget($builds, $buildID, '') . ' '; ?> - + openedBy);?> openedDate?> diff --git a/module/release/css/view.css b/module/release/css/view.css index c750db6903..acc96a13fd 100644 --- a/module/release/css/view.css +++ b/module/release/css/view.css @@ -10,3 +10,4 @@ ol, ul {padding-left: 20px;} .body-modal #mainContent {min-height: 240px;} .c-id {width: 110px;} +td.c-build{white-space: nowrap; overflow:hidden;} diff --git a/module/release/view/view.html.php b/module/release/view/view.html.php index 59862c8d8d..80e65b07f0 100644 --- a/module/release/view/view.html.php +++ b/module/release/view/view.html.php @@ -101,7 +101,7 @@ echo html::a($storyLink,$story->title, '', "class='preview'"); ?> - buildName?> + buildName?> openedBy);?> estimate . $config->hourUnit;?> @@ -197,7 +197,7 @@ processStatus('bug', $bug);?> resolvedBuild, '');?> - + openedBy);?> openedDate, 5, 11)?> resolvedBy);?> @@ -307,7 +307,7 @@ $openedBuildName = ''; foreach(explode(',', $bug->openedBuild) as $buildID) $openedBuildName .= zget($builds, $buildID, '') . ' '; ?> - + openedBy);?> openedDate?> From 44c075b0aedebd804e8c23eafdc8190cdb366524 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 8 Dec 2022 09:50:30 +0800 Subject: [PATCH 07/13] * Fix bug#30613. --- module/execution/control.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/execution/control.php b/module/execution/control.php index 852ff8a755..1c1768fb15 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1312,7 +1312,10 @@ class execution extends control { $showBranch = true; $branchPairs = $branchGroups[$build->product]; - foreach(explode(',', trim($build->branch, ',')) as $branchID) $build->branchName .= "{$branchPairs[$branchID]},"; + foreach(explode(',', trim($build->branch, ',')) as $branchID) + { + if(isset($branchPairs[$branchID])) $build->branchName .= "{$branchPairs[$branchID]},"; + } $build->branchName = trim($build->branchName, ','); } } From e4b9ef4536748336201f1f781c3a7490ea1a664f Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 8 Dec 2022 09:56:31 +0800 Subject: [PATCH 08/13] * fix bug #30585. --- module/build/control.php | 2 +- module/build/model.php | 2 ++ module/testtask/control.php | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index 021f442967..f351795698 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -428,7 +428,7 @@ class build extends control return print(html::select($varName, $builds, $build, "class='form-control'")); } - $builds = $this->build->getBuildPairs($productID, $branch, $type, 0, 'project', $build); + $builds = $this->build->getBuildPairs($productID, $branch, $type, 0, 'project', $build, false); if(strpos($extra, 'multiple') !== false) $varName .= '[]'; if($isJsonView) return print(json_encode($builds)); return print(html::select($varName, $builds, $build, "class='form-control chosen' $extra")); diff --git a/module/build/model.php b/module/build/model.php index 6f2f11d422..ad3e227710 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -256,6 +256,7 @@ class buildModel extends model ->fetchPairs(); } + $shadows = $this->dao->select('shadow')->from(TABLE_RELEASE)->where('product')->in($products)->fetchPairs('shadow', 'shadow'); $branchs = strpos($params, 'separate') === false ? "0,$branch" : $branch; $allBuilds = $this->dao->select('t1.id, t1.name, t1.execution, t1.date, t1.deleted, t2.status as objectStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName, t5.type as productType')->from(TABLE_BUILD)->alias('t1') ->beginIF($objectType === 'execution')->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')->fi() @@ -264,6 +265,7 @@ class buildModel extends model ->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id') ->leftJoin(TABLE_PRODUCT)->alias('t5')->on('t1.product = t5.id') ->where('1=1') + ->andWhere('t1.id')->notIN($shadows) ->beginIF(strpos($params, 'hasDeleted') === false)->andWhere('t1.deleted')->eq(0)->fi() ->beginIF(strpos($params, 'hasproject') !== false)->andWhere('t1.project')->ne(0)->fi() ->beginIF(strpos($params, 'singled') !== false)->andWhere('t1.execution')->ne(0)->fi() diff --git a/module/testtask/control.php b/module/testtask/control.php index c3d4a34b99..58129d9a6d 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -250,7 +250,7 @@ class testtask extends control /* Create testtask from testtask of test.*/ $productID = $productID ? $productID : key($this->products); $executions = empty($productID) ? array() : $this->loadModel('product')->getExecutionPairsByProduct($productID, '', 'id_desc', $projectID, 'stagefilter'); - $builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk,withexecution', $projectID, 'project'); + $builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk,withexecution', $projectID, 'project', '', false); $execution = $this->loadModel('execution')->getByID($executionID); if(!empty($execution) and $execution->type == 'kanban') $this->lang->testtask->execution = str_replace($this->lang->execution->common, $this->lang->kanban->common, $this->lang->testtask->execution); @@ -816,11 +816,11 @@ class testtask extends control $executions[$executionID] = $project->name . "({$this->lang->project->disableExecution})"; } } - $builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $executionID, 'execution'); + $builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $executionID, 'execution', $task->build, false); } else { - $builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $task->project, 'project'); + $builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $task->project, 'project', $task->build, false); } $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->edit; From 80af5ddba5681fded59153d4cf5b17e7b2b993af Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 8 Dec 2022 10:06:46 +0800 Subject: [PATCH 09/13] * Finish task#78690. --- module/productplan/control.php | 2 +- module/story/control.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/productplan/control.php b/module/productplan/control.php index 486c675848..bf60aab4f2 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -605,7 +605,7 @@ class productplan extends control */ public function ajaxGetProductplans($productID, $branch = 0, $number = '', $expired = '') { - $plans = $this->productplan->getPairs($productID, $branch, $expired, true); + $plans = $this->productplan->getPairs($productID, empty($branch) ? '' : $branch, $expired, true); $planName = $number === '' ? 'plan' : "plan[$number]"; $plans = empty($plans) ? array('' => '') : $plans; echo html::select($planName, $plans, '', "class='form-control'"); diff --git a/module/story/control.php b/module/story/control.php index 2bc3434095..6b869ad089 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -691,7 +691,7 @@ class story extends control } $this->view->titles = $titles; } - $plans = $this->loadModel('productplan')->getPairsForStory($productID, ($branch === 'all' or !in_array($branch, array_keys($branches))) ? 0 : $branch, 'skipParent|unexpired|noclosed'); + $plans = $this->loadModel('productplan')->getPairsForStory($productID, ($branch === 'all' or empty($branch)) ? '' : $branch, 'skipParent|unexpired|noclosed'); $plans['ditto'] = $this->lang->story->ditto; $priList = (array)$this->lang->story->priList; From 8472e0a1914966474412aaeb2d6b45f4ee076824 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 8 Dec 2022 10:34:46 +0800 Subject: [PATCH 10/13] * Finish task#78699. --- module/productplan/css/browse.css | 5 +++-- module/productplan/lang/de.php | 1 - module/productplan/lang/en.php | 1 - module/productplan/lang/fr.php | 1 - module/productplan/lang/zh-cn.php | 3 +-- 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/module/productplan/css/browse.css b/module/productplan/css/browse.css index 8a0fe5b64d..ae54b036db 100644 --- a/module/productplan/css/browse.css +++ b/module/productplan/css/browse.css @@ -17,11 +17,12 @@ td.c-branch {overflow: hidden; text-align: left !important; white-space: nowrap; @-moz-document url-prefix() {.main-table tbody > tr.table-children > td:first-child::before {width: 4px;};} .c-title {width: 160px;} -.c-branch {width: 100px;} +.c-branch {width: 130px;} .c-story, .c-status {width: 80px;} .c-execution {width: 60px !important;} .c-bug, .c-hour {width: 60px;} -.c-desc {width: 160px;} +.c-desc {width: 140px;} +.c-date {width: 90px;} .plan-name {position: relative; display: flex; align-items: center;} .plan-name > span {flex: none;} diff --git a/module/productplan/lang/de.php b/module/productplan/lang/de.php index ac56c0aeec..e418f42088 100644 --- a/module/productplan/lang/de.php +++ b/module/productplan/lang/de.php @@ -100,7 +100,6 @@ $lang->productplan->childrenAB = "C"; $lang->productplan->order = "Rank"; $lang->productplan->deleted = "Deleted"; $lang->productplan->mailto = "Mailto"; -$lang->productplan->status = 'Status'; $lang->productplan->planStatus = "Status"; $lang->productplan->statusList['wait'] = 'Wait'; diff --git a/module/productplan/lang/en.php b/module/productplan/lang/en.php index 49a6bf5bd1..86a0808f04 100644 --- a/module/productplan/lang/en.php +++ b/module/productplan/lang/en.php @@ -100,7 +100,6 @@ $lang->productplan->childrenAB = "C"; $lang->productplan->order = "Order"; $lang->productplan->deleted = "Deleted"; $lang->productplan->mailto = "Mailto"; -$lang->productplan->status = "Plan Status"; $lang->productplan->planStatus = "Status"; $lang->productplan->statusList['wait'] = 'Wait'; diff --git a/module/productplan/lang/fr.php b/module/productplan/lang/fr.php index 5fd88247f3..ad1e414469 100644 --- a/module/productplan/lang/fr.php +++ b/module/productplan/lang/fr.php @@ -100,7 +100,6 @@ $lang->productplan->childrenAB = "C"; $lang->productplan->order = "Order"; $lang->productplan->deleted = "Deleted"; $lang->productplan->mailto = "Mailto"; -$lang->productplan->status = 'Status'; $lang->productplan->planStatus = "Status"; $lang->productplan->statusList['wait'] = 'Wait'; diff --git a/module/productplan/lang/zh-cn.php b/module/productplan/lang/zh-cn.php index f756060d8e..aee350b57a 100644 --- a/module/productplan/lang/zh-cn.php +++ b/module/productplan/lang/zh-cn.php @@ -86,7 +86,7 @@ $lang->productplan->title = '名称'; $lang->productplan->desc = '描述'; $lang->productplan->begin = '开始日期'; $lang->productplan->end = '结束日期'; -$lang->productplan->status = '计划状态'; +$lang->productplan->status = '状态'; $lang->productplan->last = "上次计划"; $lang->productplan->future = '待定'; $lang->productplan->stories = "{$lang->SRCommon}数"; @@ -100,7 +100,6 @@ $lang->productplan->childrenAB = "子"; $lang->productplan->order = "排序"; $lang->productplan->deleted = "已删除"; $lang->productplan->mailto = "抄送给"; -$lang->productplan->status = "计划状态"; $lang->productplan->planStatus = "状态"; $lang->productplan->statusList['wait'] = '未开始'; From 847bb6be13be6798e3d842510a3fe87619db61b3 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 8 Dec 2022 10:46:58 +0800 Subject: [PATCH 11/13] * Finish task#78698. --- module/productplan/view/view.html.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index 47cf7f6a8a..4c91630e9c 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -31,9 +31,6 @@
id;?> title;?> - - type !== 'normal') echo "" . $branchOption[$branchID] . '';?> - begin == $config->productplan->future || $plan->end == $config->productplan->future) ? $lang->productplan->future : $plan->begin . '~' . $plan->end;?> From b7dfd47433959012ca0abde1884a87b754fb919b Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 8 Dec 2022 11:04:55 +0800 Subject: [PATCH 12/13] * fix bug. --- lib/pager/pager.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pager/pager.class.php b/lib/pager/pager.class.php index 0d0b016fa9..a3cfd2f4ba 100644 --- a/lib/pager/pager.class.php +++ b/lib/pager/pager.class.php @@ -130,7 +130,11 @@ class pager extends basePager } } - echo "
    "; + global $app, $lang; + $appendApp = ''; + $moduleName = $this->moduleName; + if(isset($lang->navGroup->{$moduleName}) and $lang->navGroup->{$moduleName} != $app->tab) $appendApp = "#app={$app->tab}"; + echo "
      "; } } else From ce8a83998c70b89a2395ae16e697f90b0093e4fc Mon Sep 17 00:00:00 2001 From: Wenrui LI Date: Thu, 8 Dec 2022 11:38:04 +0800 Subject: [PATCH 13/13] * fix zentaobot paging and command concatenation. --- .../extension/xuan/im/ext/bot/zentao.bot.php | 23 +++++++++++-------- .../xuan/im/ext/lang/de/xuanxuan.php | 8 +++---- .../xuan/im/ext/lang/en/xuanxuan.php | 8 +++---- .../xuan/im/ext/lang/fr/xuanxuan.php | 8 +++---- .../xuan/im/ext/lang/zh-cn/xuanxuan.php | 8 +++---- 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php b/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php index c8b8d27cad..ff55942fa0 100644 --- a/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php +++ b/xuanxuan/extension/xuan/im/ext/bot/zentao.bot.php @@ -360,17 +360,22 @@ class zentaoBot extends xuanBot $conds = $this->parseArguments($args, $keys); $conds->search = 1; $conds->order = 'status_asc'; + $conds->limit = 10; + + if(is_object($pager)) + { + $conds->page = $pager->pageID; + $conds->limit = $pager->recPerPage; + } $result = $this->loadEntry('tasks', 'get', array(), (array)$conds); if(isset($result->tasks)) { - /* Update pager with result. */ $pager->setRecTotal($result->total); $pager->setRecPerPage($result->limit); $pager->setPageID($result->page); $pager->setPageTotal(); - return $result->tasks; } @@ -459,7 +464,7 @@ class zentaoBot extends xuanBot if(empty($params)) { - $originCommand = rawurlencode($this->lang->finishTask . ' ' . implode(' ', $originArgs)); + $originCommand = rawurlencode($this->lang->finishCommand . ' ' . implode(' ', $originArgs)); $json = (object)array ( @@ -609,7 +614,7 @@ class zentaoBot extends xuanBot $taskTable = $this->renderTaskTable($tasks); - $originCommand = $this->lang->viewTask . ' ' . implode(' ', $originArgs); + $originCommand = $this->lang->viewCommand . ' ' . implode(' ', $originArgs); $paging = "$pager->pageID / $pager->pageTotal"; if($pager->pageID != 1) { @@ -682,13 +687,13 @@ class zentaoBot extends xuanBot } else { - $tr .= "{$this->users[$task->$key]}"; + $tr .= "{$task->assignedTo->realname}"; } break; case 'actions': - $startUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->startTask} #$task->id"; - $finishUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->finishTask} #$task->id"; - $closeUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->closeTask} #$task->id"; + $startUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->startCommand} #$task->id"; + $finishUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->finishCommand} #$task->id"; + $closeUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->closeCommand} #$task->id"; $canStart = in_array($task->status, array('wait', 'pause')); $canFinish = in_array($task->status, array('wait', 'pause', 'doing')); @@ -777,7 +782,7 @@ class zentaoBot extends xuanBot if(count($args) == 0) { - $originCommand = rawurlencode($this->lang->startTask . ' ' . implode(' ', $originArgs)); + $originCommand = rawurlencode($this->lang->startCommand . ' ' . implode(' ', $originArgs)); $realStarted = $this->formatDate($task, 'realStarted'); diff --git a/xuanxuan/extension/xuan/im/ext/lang/de/xuanxuan.php b/xuanxuan/extension/xuan/im/ext/lang/de/xuanxuan.php index c2285839a0..b93b31219f 100644 --- a/xuanxuan/extension/xuan/im/ext/lang/de/xuanxuan.php +++ b/xuanxuan/extension/xuan/im/ext/lang/de/xuanxuan.php @@ -73,10 +73,10 @@ $lang->im->bot->zentaoBot->prevPage = 'Prev Page'; $lang->im->bot->zentaoBot->nextPage = 'Next Page'; $lang->im->bot->zentaoBot->effortRecorded = 'Effort recorded for task #%d.'; -$lang->im->bot->zentaoBot->finishTask = 'finish'; -$lang->im->bot->zentaoBot->closeTask = 'close'; -$lang->im->bot->zentaoBot->startTask = 'start'; -$lang->im->bot->zentaoBot->viewTask = 'view'; +$lang->im->bot->zentaoBot->finishCommand = 'finish'; +$lang->im->bot->zentaoBot->closeCommand = 'close'; +$lang->im->bot->zentaoBot->startCommand = 'start'; +$lang->im->bot->zentaoBot->viewCommand = 'view'; $lang->im->bot->zentaoBot->errors = new stdclass(); $lang->im->bot->zentaoBot->errors->emptyResult = 'No task found.'; diff --git a/xuanxuan/extension/xuan/im/ext/lang/en/xuanxuan.php b/xuanxuan/extension/xuan/im/ext/lang/en/xuanxuan.php index c2285839a0..b93b31219f 100644 --- a/xuanxuan/extension/xuan/im/ext/lang/en/xuanxuan.php +++ b/xuanxuan/extension/xuan/im/ext/lang/en/xuanxuan.php @@ -73,10 +73,10 @@ $lang->im->bot->zentaoBot->prevPage = 'Prev Page'; $lang->im->bot->zentaoBot->nextPage = 'Next Page'; $lang->im->bot->zentaoBot->effortRecorded = 'Effort recorded for task #%d.'; -$lang->im->bot->zentaoBot->finishTask = 'finish'; -$lang->im->bot->zentaoBot->closeTask = 'close'; -$lang->im->bot->zentaoBot->startTask = 'start'; -$lang->im->bot->zentaoBot->viewTask = 'view'; +$lang->im->bot->zentaoBot->finishCommand = 'finish'; +$lang->im->bot->zentaoBot->closeCommand = 'close'; +$lang->im->bot->zentaoBot->startCommand = 'start'; +$lang->im->bot->zentaoBot->viewCommand = 'view'; $lang->im->bot->zentaoBot->errors = new stdclass(); $lang->im->bot->zentaoBot->errors->emptyResult = 'No task found.'; diff --git a/xuanxuan/extension/xuan/im/ext/lang/fr/xuanxuan.php b/xuanxuan/extension/xuan/im/ext/lang/fr/xuanxuan.php index c2285839a0..b93b31219f 100644 --- a/xuanxuan/extension/xuan/im/ext/lang/fr/xuanxuan.php +++ b/xuanxuan/extension/xuan/im/ext/lang/fr/xuanxuan.php @@ -73,10 +73,10 @@ $lang->im->bot->zentaoBot->prevPage = 'Prev Page'; $lang->im->bot->zentaoBot->nextPage = 'Next Page'; $lang->im->bot->zentaoBot->effortRecorded = 'Effort recorded for task #%d.'; -$lang->im->bot->zentaoBot->finishTask = 'finish'; -$lang->im->bot->zentaoBot->closeTask = 'close'; -$lang->im->bot->zentaoBot->startTask = 'start'; -$lang->im->bot->zentaoBot->viewTask = 'view'; +$lang->im->bot->zentaoBot->finishCommand = 'finish'; +$lang->im->bot->zentaoBot->closeCommand = 'close'; +$lang->im->bot->zentaoBot->startCommand = 'start'; +$lang->im->bot->zentaoBot->viewCommand = 'view'; $lang->im->bot->zentaoBot->errors = new stdclass(); $lang->im->bot->zentaoBot->errors->emptyResult = 'No task found.'; diff --git a/xuanxuan/extension/xuan/im/ext/lang/zh-cn/xuanxuan.php b/xuanxuan/extension/xuan/im/ext/lang/zh-cn/xuanxuan.php index f7ff79a914..b827753ce5 100644 --- a/xuanxuan/extension/xuan/im/ext/lang/zh-cn/xuanxuan.php +++ b/xuanxuan/extension/xuan/im/ext/lang/zh-cn/xuanxuan.php @@ -81,10 +81,10 @@ $lang->im->bot->zentaoBot->prevPage = '上一页'; $lang->im->bot->zentaoBot->nextPage = '下一页'; $lang->im->bot->zentaoBot->effortRecorded = '任务 #%d 已完成工时信息填写'; -$lang->im->bot->zentaoBot->finishTask = '完成任务'; -$lang->im->bot->zentaoBot->closeTask = '关闭任务'; -$lang->im->bot->zentaoBot->startTask = '开始任务'; -$lang->im->bot->zentaoBot->viewTask = '查看任务'; +$lang->im->bot->zentaoBot->finishCommand = '完成'; +$lang->im->bot->zentaoBot->closeCommand = '关闭'; +$lang->im->bot->zentaoBot->startCommand = '开始'; +$lang->im->bot->zentaoBot->viewCommand = '查看'; $lang->im->bot->zentaoBot->errors = new stdclass(); $lang->im->bot->zentaoBot->errors->emptyResult = '未查询到相关匹配信息';