From 2bc327efa06c88d1c78479e11ac4b55ce9e84a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Mon, 18 Dec 2017 15:05:55 +0800 Subject: [PATCH 01/35] * Fix bug --- module/task/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/task/model.php b/module/task/model.php index fc6df284b5..87d7a4ca8c 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2041,8 +2041,8 @@ class taskModel extends model echo $canView ? html::a($taskLink, sprintf('%03d', $task->id)) : sprintf('%03d', $task->id); break; case 'pri': - echo ""; - echo $task->pri == '0' ? '' : zget($this->lang->task->priList, $task->pri, $task->pri); + echo ""; + echo $task->pri == '0' ? '' : zget(array_keys($this->lang->task->priList), $task->pri, $task->pri); echo ""; break; case 'name': From 9c10a2a2f6c8d25769d1abecaaa49bd54f3bd8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Mon, 18 Dec 2017 16:49:23 +0800 Subject: [PATCH 02/35] * Fix bug#1327 --- module/task/control.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index 6efd176bda..b4d02d1461 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1217,8 +1217,6 @@ class task extends control } $task->progress .= '%'; - - if($task->parent) $task->name = '[' . $taskLang->childrenAB . '] ' . $task->name; } } else @@ -1236,10 +1234,25 @@ class task extends control foreach($tasks as $task) $relatedStoryIdList[$task->story] = $task->story; /* Get related objects title or names. */ - $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs(); + $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY)->where('id')->in($relatedStoryIdList)->fetchPairs(); $relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('task')->andWhere('objectID')->in(@array_keys($tasks))->andWhere('extra')->ne('editor')->fetchGroup('objectID'); $relatedModules = $this->loadModel('tree')->getTaskOptionMenu($projectID); + $children = $this->dao->select('*')->from(TABLE_TASK)->where('deleted')->eq(0)->andWhere('parent')->in(array_keys($tasks))->fetchGroup('parent', 'id'); + if(!empty($children)) + { + $position = 0; + foreach($tasks as $task) + { + $position ++; + if(isset($children[$task->id])) + { + array_splice($tasks, $position, 0, $children[$task->id]); + $position += count($children[$task->id]); + } + } + } + foreach($tasks as $task) { if($this->post->fileType == 'csv') @@ -1266,6 +1279,8 @@ class task extends control if(isset($users[$task->closedBy])) $task->closedBy = $users[$task->closedBy]; if(isset($users[$task->lastEditedBy])) $task->lastEditedBy = $users[$task->lastEditedBy]; + if(!empty($task->parent)) $task->name = '[' . $taskLang->childrenAB . '] ' . $task->name; + $task->openedDate = substr($task->openedDate, 0, 10); $task->assignedDate = substr($task->assignedDate, 0, 10); $task->finishedDate = substr($task->finishedDate, 0, 10); From 1060a606c6659ade720cf0812d20a98ca9b47d79 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 18 Dec 2017 17:16:34 +0800 Subject: [PATCH 03/35] * finish task #3455. --- lib/base/dao/dao.class.php | 2 +- module/story/model.php | 4 ++-- module/task/config.php | 6 ++++-- module/task/model.php | 9 ++++++++- module/testcase/control.php | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index 7192a30ace..c63fd0a09d 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -800,7 +800,7 @@ class baseDAO $this->setFields($field); $result = $this->query()->fetch(PDO::FETCH_OBJ); - dao::$cache[$table][$key] = $result; + dao::$cache[$table][$key] = getRow($result); return $result ? $result->$field : ''; } diff --git a/module/story/model.php b/module/story/model.php index aee5ab9a20..9c49d4662e 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2512,13 +2512,13 @@ class storyModel extends model $history = $this->action->getHistory($actionID); $action->history = isset($history[$actionID]) ? $history[$actionID] : array(); $action->appendLink = ''; - if(strpos($action->extra, ':')!== false) + if(strpos($action->extra, ':') !== false) { list($extra, $id) = explode(':', $action->extra); $action->extra = $extra; if($id) { - $name = $this->dao->select('title')->from(TABLE_STORY)->where('id')->eq($id)->fetch('title'); + $name = $this->dao->select('title')->from(TABLE_STORY)->where('id')->eq($id)->fetch('title'); if($name) $action->appendLink = html::a(zget($this->config->mail, 'domain', common::getSysURL()) . helper::createLink($action->objectType, 'view', "id=$id"), "#$id " . $name); } } diff --git a/module/task/config.php b/module/task/config.php index 4d6e6bb4f4..50160daefa 100644 --- a/module/task/config.php +++ b/module/task/config.php @@ -173,10 +173,12 @@ $config->task->datatable->fieldList['closedReason']['fixed'] = 'no'; $config->task->datatable->fieldList['closedReason']['width'] = '80'; $config->task->datatable->fieldList['closedReason']['required'] = 'no'; -$config->task->datatable->fieldList['story']['title'] = 'story'; +global $lang; +$config->task->datatable->fieldList['story']['title'] = "S"; $config->task->datatable->fieldList['story']['fixed'] = 'no'; -$config->task->datatable->fieldList['story']['width'] = '80'; +$config->task->datatable->fieldList['story']['width'] = '30'; $config->task->datatable->fieldList['story']['required'] = 'no'; +$config->task->datatable->fieldList['story']['name'] = $lang->task->story; $config->task->datatable->fieldList['mailto']['title'] = 'mailto'; $config->task->datatable->fieldList['mailto']['fixed'] = 'no'; diff --git a/module/task/model.php b/module/task/model.php index fc6df284b5..b1dbdfd889 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2118,7 +2118,14 @@ class taskModel extends model case 'story': if(!empty($task->storyID)) { - if(!common::printLink('story', 'view', "storyid=$task->storyID", $task->storyTitle)) echo $task->storyTitle; + if(common::hasPriv('story', 'view')) + { + echo html::a(helper::createLink('story', 'view', "storyid=$task->storyID", 'html', true), "", '', "class='iframe' title='{$task->storyTitle}'"); + } + else + { + echo $task->storyTitle; + } } break; case 'mailto': diff --git a/module/testcase/control.php b/module/testcase/control.php index 7dddc2cc14..c8c7ee1581 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -1531,7 +1531,7 @@ class testcase extends control $num = $out[1]; $sign = $out[2]; $signbit = $sign == '.' ? 1 : 3; - $step = trim(substr($step, strlen($num) + $signbit)); + $step = trim(substr($step, strpos($step, $sign) + $signbit)); if(!empty($step)) $caseStep[$num]['content'] = $step; $caseStep[$num]['type'] = 'step'; } From aeaaeb67d83c55f19db4bcbb80bfcef7a68b746d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 18 Dec 2017 17:30:01 +0800 Subject: [PATCH 04/35] * fix bug for cache. --- lib/base/dao/dao.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index c63fd0a09d..de4318b9f7 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -782,7 +782,7 @@ class baseDAO { $sql = $this->processSQL(); $table = $this->table; - $key = 'fetch-' . md5($sql); + $key = 'fetch-' . md5($sql . $field); if(isset(dao::$cache[$table][$key])) { if(empty($field)) return $this->getRow(dao::$cache[$table][$key]); @@ -800,7 +800,7 @@ class baseDAO $this->setFields($field); $result = $this->query()->fetch(PDO::FETCH_OBJ); - dao::$cache[$table][$key] = getRow($result); + dao::$cache[$table][$key] = $this->getRow($result); return $result ? $result->$field : ''; } From c4f8508e5afae65b86e736563560036fe5b9ae67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Mon, 18 Dec 2017 18:44:36 +0800 Subject: [PATCH 05/35] * Task#3467 --- module/bug/js/batchcreate.js | 12 ++++++++++++ module/story/js/batchcreate.js | 14 +++++++++++++- module/story/js/batchedit.js | 2 +- module/task/js/batchcreate.js | 13 ++++++++++++- module/task/js/batchedit.js | 3 ++- module/testcase/js/batchcreate.js | 12 ++++++++++++ module/testcase/js/batchedit.js | 2 +- www/js/my.full.js | 22 ++++++++++++++++++++++ 8 files changed, 75 insertions(+), 5 deletions(-) diff --git a/module/bug/js/batchcreate.js b/module/bug/js/batchcreate.js index 28d0230bbd..88405b439c 100644 --- a/module/bug/js/batchcreate.js +++ b/module/bug/js/batchcreate.js @@ -136,3 +136,15 @@ if(navigator.userAgent.indexOf("Firefox") < 0) this.style.height = (this.scrollHeight + 2) + "px"; }); } + +$(document).keydown(function(event) +{ + if(event.keyCode == 38) + { + inputFocusJump('up'); + } + else if(event.keyCode == 40) + { + inputFocusJump('down'); + } +}); \ No newline at end of file diff --git a/module/story/js/batchcreate.js b/module/story/js/batchcreate.js index a931a89f9f..48b612bf7d 100644 --- a/module/story/js/batchcreate.js +++ b/module/story/js/batchcreate.js @@ -33,7 +33,19 @@ $(document).on('mousedown', 'select', function() } $(this).val(value); } -}) +}); + +$(document).keydown(function(event) +{ + if(event.keyCode == 38) + { + inputFocusJump('up'); + } + else if(event.keyCode == 40) + { + inputFocusJump('down'); + } +}); if(navigator.userAgent.indexOf("Firefox") < 0) { diff --git a/module/story/js/batchedit.js b/module/story/js/batchedit.js index 790c960aeb..2faf80e809 100644 --- a/module/story/js/batchedit.js +++ b/module/story/js/batchedit.js @@ -90,4 +90,4 @@ $(document).on('change', 'select', function() $(this).trigger("chosen:updated"); $(this).trigger("change"); } -}) +}); diff --git a/module/task/js/batchcreate.js b/module/task/js/batchcreate.js index 79ec55162f..f45e71ab36 100755 --- a/module/task/js/batchcreate.js +++ b/module/task/js/batchcreate.js @@ -153,5 +153,16 @@ $(function() if($.cookie('zeroTask') == 'true') toggleZeroTaskStory(); if(storyID != 0) setStoryRelated(0); -}) + $(document).keydown(function(event) + { + if(event.keyCode == 38) + { + inputFocusJump('up'); + } + else if(event.keyCode == 40) + { + inputFocusJump('down'); + } + }); +}); diff --git a/module/task/js/batchedit.js b/module/task/js/batchedit.js index 7c4ad12144..b181c7fdc6 100644 --- a/module/task/js/batchedit.js +++ b/module/task/js/batchedit.js @@ -44,4 +44,5 @@ $(document).on('change', 'select', function() $(this).trigger("chosen:updated"); $(this).trigger("change"); } -}) +}); + diff --git a/module/testcase/js/batchcreate.js b/module/testcase/js/batchcreate.js index 0291853257..8239848949 100644 --- a/module/testcase/js/batchcreate.js +++ b/module/testcase/js/batchcreate.js @@ -57,6 +57,18 @@ $(document).ready(function() $(this).val(value); } }); + + $(document).keydown(function(event) + { + if(event.keyCode == 38) + { + inputFocusJump('up'); + } + else if(event.keyCode == 40) + { + inputFocusJump('down'); + } + }); }); /** diff --git a/module/testcase/js/batchedit.js b/module/testcase/js/batchedit.js index 9e68699ff6..33667f298e 100644 --- a/module/testcase/js/batchedit.js +++ b/module/testcase/js/batchedit.js @@ -75,4 +75,4 @@ $(document).on('change', 'select', function() $(this).trigger("chosen:updated"); $(this).trigger("change"); } -}) +}); diff --git a/www/js/my.full.js b/www/js/my.full.js index 31ed1f085d..3322dae22a 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -1941,6 +1941,28 @@ function revertModuleCookie() } } +/** + * Focus move up or down for input. + * + * @param type up|down + */ +function inputFocusJump(type){ + var hasFocus = $('input').is(':focus'); + if(hasFocus) + { + var title = $("input:focus").attr('name').replace(/\[\d]/g, ''); + var $input = $(":input[name^=" + title + "]:text:not(:disabled):not([name*='%'])"); + var num = $input.length; + var index = parseInt($("input:focus").attr('name').replace(/[^0-9]/g, '')); + var nextIndex = type == 'down' ? index + 1 : index - 1; + + if(nextIndex < num && nextIndex >= 0) + { + $input[nextIndex].focus(); + } + } +} + /* Ping the server every some minutes to keep the session. */ needPing = true; From 39d39bc4d890c7380bf4577ec4b16a060c8cb930 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 19 Dec 2017 09:59:40 +0800 Subject: [PATCH 06/35] * finish task #3444. --- module/testcase/config.php | 2 +- module/testcase/control.php | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/module/testcase/config.php b/module/testcase/config.php index 40c08e6a09..d246cfc859 100644 --- a/module/testcase/config.php +++ b/module/testcase/config.php @@ -19,7 +19,7 @@ $config->testcase->export->listFields = array('type', 'stage', 'pri', 'status' $config->testcase->exportFields = ' id, product, branch, module, story, - title, precondition, stepDesc, stepExpect, keywords, + title, precondition, stepDesc, stepExpect, real, keywords, pri, type, stage, status, bugsAB, resultsAB, stepNumberAB, lastRunResult, openedBy, openedDate, lastEditedBy, lastEditedDate, version, linkCase'; diff --git a/module/testcase/control.php b/module/testcase/control.php index c8c7ee1581..0d1df328f8 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -1106,6 +1106,17 @@ class testcase extends control } } + $stmt = $this->dao->select('*')->from(TABLE_TESTRESULT) + ->where('`case`')->in(array_keys($cases)) + ->beginIF($taskID)->andWhere('run')->eq($taskID)->fi() + ->orderBy('id_desc') + ->query(); + $results = array(); + while($result = $stmt->fetch()) + { + if(!isset($results[$result->case])) $results[$result->case] = unserialize($result->stepResults); + } + /* Get users, products and projects. */ $users = $this->loadModel('user')->getPairs('noletter'); $products = $this->loadModel('product')->getPairs('nocode'); @@ -1134,7 +1145,7 @@ class testcase extends control $relatedModules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in($relatedModuleIdList)->fetchPairs(); $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs(); $relatedCases = $this->dao->select('id, title')->from(TABLE_CASE)->where('id')->in($relatedCaseIdList)->fetchPairs(); - $relatedSteps = $this->dao->select('parent,`case`,version,type,`desc`,expect')->from(TABLE_CASESTEP)->where('`case`')->in(@array_keys($cases))->orderBy('version desc,id')->fetchGroup('case'); + $relatedSteps = $this->dao->select('id,parent,`case`,version,type,`desc`,expect')->from(TABLE_CASESTEP)->where('`case`')->in(@array_keys($cases))->orderBy('version desc,id')->fetchGroup('case', 'id'); $relatedModules = array('0' => '/') + $relatedModules; $cases = $this->testcase->appendData($cases); @@ -1142,6 +1153,9 @@ class testcase extends control { $case->stepDesc = ''; $case->stepExpect = ''; + $case->real = ''; + $result = isset($results[$case->id]) ? $results[$case->id] : array(); + if($case->lastRunResult == 'fail' and !isset($relatedSteps[$case->id]) and !empty($result)) $case->real = $result[0]['real']; if(isset($relatedSteps[$case->id])) { $i = $childId = 0; @@ -1162,6 +1176,7 @@ class testcase extends control $sign = (in_array($this->post->fileType, array('html', 'xml'))) ? '
' : "\n"; $case->stepDesc .= $stepId . ". " . $step->desc . $sign; $case->stepExpect .= $stepId . ". " . $step->expect . $sign; + if($case->lastRunResult == 'fail') $case->real .= $stepId . ". " . (isset($result[$step->id]) ? $result[$step->id]['real'] : '') . $sign; $childId ++; } } From 1e05a84212ecaf5b74cbd11a0638194f45bf8abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Tue, 19 Dec 2017 10:28:20 +0800 Subject: [PATCH 07/35] * Task#3467 --- module/bug/js/batchcreate.js | 14 +++++++++++++- module/story/js/batchcreate.js | 14 +++++++++++++- module/task/js/batchcreate.js | 14 +++++++++++++- module/testcase/js/batchcreate.js | 14 +++++++++++++- www/js/my.full.js | 23 +++++++++++++++++++++++ 5 files changed, 75 insertions(+), 4 deletions(-) diff --git a/module/bug/js/batchcreate.js b/module/bug/js/batchcreate.js index 88405b439c..0bec2bd3c7 100644 --- a/module/bug/js/batchcreate.js +++ b/module/bug/js/batchcreate.js @@ -139,7 +139,19 @@ if(navigator.userAgent.indexOf("Firefox") < 0) $(document).keydown(function(event) { - if(event.keyCode == 38) + if(event.ctrlKey && event.keyCode == 38) + { + event.stopPropagation(); + event.preventDefault(); + selectFocusJump('up'); + } + else if(event.ctrlKey && event.keyCode == 40) + { + event.stopPropagation(); + event.preventDefault(); + selectFocusJump('down'); + } + else if(event.keyCode == 38) { inputFocusJump('up'); } diff --git a/module/story/js/batchcreate.js b/module/story/js/batchcreate.js index 48b612bf7d..d5bfb73443 100644 --- a/module/story/js/batchcreate.js +++ b/module/story/js/batchcreate.js @@ -37,7 +37,19 @@ $(document).on('mousedown', 'select', function() $(document).keydown(function(event) { - if(event.keyCode == 38) + if(event.ctrlKey && event.keyCode == 38) + { + event.stopPropagation(); + event.preventDefault(); + selectFocusJump('up'); + } + else if(event.ctrlKey && event.keyCode == 40) + { + event.stopPropagation(); + event.preventDefault(); + selectFocusJump('down'); + } + else if(event.keyCode == 38) { inputFocusJump('up'); } diff --git a/module/task/js/batchcreate.js b/module/task/js/batchcreate.js index f45e71ab36..374037f345 100755 --- a/module/task/js/batchcreate.js +++ b/module/task/js/batchcreate.js @@ -156,7 +156,19 @@ $(function() $(document).keydown(function(event) { - if(event.keyCode == 38) + if(event.ctrlKey && event.keyCode == 38) + { + event.stopPropagation(); + event.preventDefault(); + selectFocusJump('up'); + } + else if(event.ctrlKey && event.keyCode == 40) + { + event.stopPropagation(); + event.preventDefault(); + selectFocusJump('down'); + } + else if(event.keyCode == 38) { inputFocusJump('up'); } diff --git a/module/testcase/js/batchcreate.js b/module/testcase/js/batchcreate.js index 8239848949..086ab502c5 100644 --- a/module/testcase/js/batchcreate.js +++ b/module/testcase/js/batchcreate.js @@ -60,7 +60,19 @@ $(document).ready(function() $(document).keydown(function(event) { - if(event.keyCode == 38) + if(event.ctrlKey && event.keyCode == 38) + { + event.stopPropagation(); + event.preventDefault(); + selectFocusJump('up'); + } + else if(event.ctrlKey && event.keyCode == 40) + { + event.stopPropagation(); + event.preventDefault(); + selectFocusJump('down'); + } + else if(event.keyCode == 38) { inputFocusJump('up'); } diff --git a/www/js/my.full.js b/www/js/my.full.js index 3322dae22a..d4c4833932 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -1963,6 +1963,29 @@ function inputFocusJump(type){ } } +/** + * Focus move up or down for select. + * + * @param type + */ +function selectFocusJump(type) +{ + var hasFocus = $('select').is(':focus'); + if(hasFocus) + { + var title = $("select:focus").attr('name').replace(/\[\d]/g, ''); + var $select = $("select[name^=" + title + "]:not([name*='%'])"); + var num = $select.length; + var index = parseInt($("select:focus").attr('name').replace(/[^0-9]/g, '')); + var nextIndex = type == 'down' ? index + 1 : index - 1; + + if(nextIndex < num && nextIndex >= 0) + { + $select[nextIndex].focus(); + } + } +} + /* Ping the server every some minutes to keep the session. */ needPing = true; From f157829c16aa15f9f201e3ccd6a881abe9b439a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Tue, 19 Dec 2017 13:54:40 +0800 Subject: [PATCH 08/35] * Fix Bug#1326 --- module/task/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/task/model.php b/module/task/model.php index aafda6574d..3775ca9086 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -259,7 +259,7 @@ class taskModel extends model { if(!$taskID) return true; - $tasks = $this->dao->select('`id`,`estimate`,`consumed`,`left`')->from(TABLE_TASK)->where('parent')->eq($taskID)->fetchAll('id'); + $tasks = $this->dao->select('`id`,`estimate`,`consumed`,`left`')->from(TABLE_TASK)->where('parent')->eq($taskID)->andWhere('status')->ne('cancel')->fetchAll('id'); if(empty($tasks)) return true; $estimate = 0; From ab4f445f190717ce8a31148bc5e15bb2a74bace6 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 19 Dec 2017 14:00:08 +0800 Subject: [PATCH 09/35] * finish task #3475. --- module/story/model.php | 3 ++- module/tree/model.php | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index 9c49d4662e..a6141dd336 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -481,6 +481,7 @@ class storyModel extends model ->get(); if(isset($story->plan) and is_array($story->plan)) $story->plan = trim(join(',', $story->plan), ','); if(empty($_POST['product'])) $story->branch = $oldStory->branch; + if(empty($_POST['branch'])) $story->branch = 0; $this->dao->update(TABLE_STORY) ->data($story) @@ -1672,7 +1673,7 @@ class storyModel extends model ->leftJoin(TABLE_PRODUCT)->alias('t4')->on('t2.product = t4.id') ->where('t1.project')->eq((int)$projectID) ->beginIF($type == 'byProduct')->andWhere('t1.product')->eq($param)->fi() - ->beginIF($type == 'byBrach')->andWhere('t2.branch')->eq($param)->fi() + ->beginIF($type == 'byBranch')->andWhere('t2.branch')->eq($param)->fi() ->beginIF($type == 'byModule' and $param)->andWhere('t2.module')->in($modules)->fi() ->andWhere('t2.deleted')->eq(0) ->orderBy($orderBy) diff --git a/module/tree/model.php b/module/tree/model.php index f2e42571de..387b2aeab1 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -574,7 +574,12 @@ class treeModel extends model if($startModule) $startModulePath = $startModule->path . '%'; } - $projectModules = $this->getTaskTreeModules($rootID, true); + $projectModules = $this->getTaskTreeModules($rootID, true); + $projectBranches = $this->dao->select('DISTINCT t2.branch')->from(TABLE_PROJECTSTORY)->alias('t1') + ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') + ->where('t1.project')->eq($rootID) + ->andWhere('t2.deleted')->eq(0) + ->fetchPairs(); /* Get module according to product. */ $products = $this->loadModel('product')->getProductsByProject($rootID); @@ -602,12 +607,13 @@ class treeModel extends model while($module = $stmt->fetch()) { /* if not manage, ignore unused modules. */ - if(!isset($projectModules[$module->id])) continue; - $this->buildTree($treeMenu, $module, 'task', $userFunc, $extra); + if(isset($projectModules[$module->id])) $this->buildTree($treeMenu, $module, 'task', $userFunc, $extra); } - if(isset($treeMenu[0]) and $branch) + if((isset($treeMenu[0]) and $branch) or isset($projectBranches[$branch])) { - $treeMenu[0] = "
  • " . html::a($link, $branchName, '_self', "id='branch$branch'") . "
      {$treeMenu[0]}
  • "; + $childMenu = isset($treeMenu[0]) ? "
      {$treeMenu[0]}
    " : ''; + $link = helper::createLink('project', 'story', "project=$rootID&ordery=&status=byBranch&praram=$branch"); + $treeMenu[0] = "
  • " . html::a($link, $branchName, '_self', "id='branch$branch'") . "{$childMenu}
  • "; } $tree .= isset($treeMenu[0]) ? $treeMenu[0] : ''; } From bd0694658c547db41fa339bd6ee784f41561155d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 19 Dec 2017 14:18:51 +0800 Subject: [PATCH 10/35] * adjust for project story. --- module/project/js/story.js | 1 + module/project/view/story.html.php | 1 + 2 files changed, 2 insertions(+) diff --git a/module/project/js/story.js b/module/project/js/story.js index 1a0b6c4bc5..f9290a4e9f 100644 --- a/module/project/js/story.js +++ b/module/project/js/story.js @@ -21,6 +21,7 @@ $(function() $('#module' + moduleID).addClass('active'); $('#product' + productID).addClass('active'); + $('#branch' + branchID).addClass('active'); $(document).on('click', "#storyList tbody tr", function(){showCheckedSummary();}); $(document).on('change', "#storyList :checkbox", function(){showCheckedSummary();}); }); diff --git a/module/project/view/story.html.php b/module/project/view/story.html.php index ab0263df62..156627e13f 100644 --- a/module/project/view/story.html.php +++ b/module/project/view/story.html.php @@ -15,6 +15,7 @@ + project->confirmUnlinkStory)?>
    From b7ce9dc9718375a418f75be2dfc9ad91ccfefcb7 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 20 Dec 2017 16:10:34 +0800 Subject: [PATCH 35/35] * adjust for story field for custom. --- module/build/view/view.html.php | 1 - module/datatable/view/ajaxcustom.html.php | 6 +++--- module/group/view/browse.html.php | 6 +++--- module/task/config.php | 4 ++-- module/task/lang/en.php | 1 + module/task/lang/zh-cn.php | 1 + module/task/model.php | 2 +- module/upgrade/model.php | 21 +++++++++++++++++++++ 8 files changed, 32 insertions(+), 10 deletions(-) diff --git a/module/build/view/view.html.php b/module/build/view/view.html.php index 06bca9ff92..2a5406e30f 100644 --- a/module/build/view/view.html.php +++ b/module/build/view/view.html.php @@ -217,7 +217,6 @@ tfoot tr td .table-actions .btn{display:none;} bug->openedDateAB);?> bug->resolvedByAB);?> bug->resolvedDateAB);?> - actions?> diff --git a/module/datatable/view/ajaxcustom.html.php b/module/datatable/view/ajaxcustom.html.php index 37f34fcdcd..03b8a8327e 100644 --- a/module/datatable/view/ajaxcustom.html.php +++ b/module/datatable/view/ajaxcustom.html.php @@ -126,7 +126,7 @@ $(function() var $col = $cols.filter('[data-key=' + col.id + ']'); $col.toggleClass('disabled', !col.show); $col.attr('data-order', col.order); - if(col.width) $col.find('input').val(col.width.replace('px', '')); + if(col.width) $col.find('input#width').val(col.width.replace('px', '')); } $('.cols-list').on('click', '.col:not(.require) .show-hide, .col:not(.require) .title', function() @@ -149,14 +149,14 @@ $(function() $list.sortable({trigger: '.title', selector: '.col'}); } - }).on('keyup change', 'input', function() + }).on('keyup change', 'input#width', function() { renderColWidth($(this).closest('.col')); }); function renderColWidth($col) { - var width = $col.find('input').val(); + var width = $col.find('input#width').val(); if(width == 'auto') { width = '500'; diff --git a/module/group/view/browse.html.php b/module/group/view/browse.html.php index e59dd4f05d..3617e4e7b3 100644 --- a/module/group/view/browse.html.php +++ b/module/group/view/browse.html.php @@ -27,8 +27,8 @@ group->id;?> group->name;?> - group->desc;?> - group->users;?> + group->desc;?> + group->users;?> actions;?> @@ -38,7 +38,7 @@ id;?> name;?> - desc;?> + desc;?> group->managepriv = $lang->group->managePrivByGroup;?> diff --git a/module/task/config.php b/module/task/config.php index 50160daefa..bbdb6c92d8 100644 --- a/module/task/config.php +++ b/module/task/config.php @@ -174,9 +174,9 @@ $config->task->datatable->fieldList['closedReason']['width'] = '80'; $config->task->datatable->fieldList['closedReason']['required'] = 'no'; global $lang; -$config->task->datatable->fieldList['story']['title'] = "S"; +$config->task->datatable->fieldList['story']['title'] = "storyAB"; $config->task->datatable->fieldList['story']['fixed'] = 'no'; -$config->task->datatable->fieldList['story']['width'] = '30'; +$config->task->datatable->fieldList['story']['width'] = '40'; $config->task->datatable->fieldList['story']['required'] = 'no'; $config->task->datatable->fieldList['story']['name'] = $lang->task->story; diff --git a/module/task/lang/en.php b/module/task/lang/en.php index 76831bedb2..235291e98d 100644 --- a/module/task/lang/en.php +++ b/module/task/lang/en.php @@ -45,6 +45,7 @@ $lang->task->project = $lang->projectCommon; $lang->task->module = 'Module'; $lang->task->moduleAB = 'Module'; $lang->task->story = 'Story'; +$lang->task->storyAB = 'Story'; $lang->task->storySpec = 'Story Description'; $lang->task->storyVerify = 'Acceptance'; $lang->task->name = 'Name'; diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index 035a1f0e06..bc7de853a2 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -45,6 +45,7 @@ $lang->task->project = '所属' . $lang->projectCommon; $lang->task->module = '所属模块'; $lang->task->moduleAB = '模块'; $lang->task->story = '相关需求'; +$lang->task->storyAB = '需求'; $lang->task->storySpec = '需求描述'; $lang->task->storyVerify = '验收标准'; $lang->task->name = '任务名称'; diff --git a/module/task/model.php b/module/task/model.php index 0cfdf49cca..3618268668 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2034,7 +2034,7 @@ class taskModel extends model $class = ''; if($id == 'status') $class .= ' task-' . $task->status; if($id == 'id') $class .= ' cell-id'; - if($id == 'name' or $id == 'story') $class .= ' text-left'; + if($id == 'name') $class .= ' text-left'; if($id == 'deadline' and isset($task->delay)) $class .= ' delayed'; if($id == 'assignedTo' && $task->assignedTo == $account) $class .= ' red'; diff --git a/module/upgrade/model.php b/module/upgrade/model.php index a41e3331c2..6ea04e8f06 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -1938,4 +1938,25 @@ class upgradeModel extends model } return true; } + + /** + * Change story field width. + * + * @access public + * @return bool + */ + public function changeStoryWidth() + { + $projectCustom = $this->dao->select('*')->from(TABLE_CONFIG)->where('section')->eq('projectTask')->andWhere('`key`')->in('cols,tablecols')->fetchAll('id'); + foreach($projectCustom as $configID => $projectTask) + { + $fields = json_decode($projectTask->value); + foreach($fields as $i => $field) + { + if($field->id == 'story') $field->width = '40px'; + } + $this->dao->update(TABLE_CONFIG)->set('value')->eq(json_encode($fields))->where('id')->eq($configID)->exec(); + } + return true; + } }