From c15a28e3c4495a2a185c450e370401f74d46957f Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 21 Feb 2019 16:17:26 +0800 Subject: [PATCH 1/3] * finish task #5274. --- module/bug/model.php | 56 ++++++++++++------------- module/productplan/view/browse.html.php | 4 +- module/story/model.php | 36 ++++++++-------- module/task/model.php | 4 +- module/testcase/model.php | 14 +++---- module/testtask/model.php | 4 +- module/tree/model.php | 2 +- 7 files changed, 60 insertions(+), 60 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 6fac1b92cc..ee0405e9fe 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -134,8 +134,8 @@ class bugModel extends model { $now = helper::now(); $bug = fixer::input('post') - ->add('openedBy', $this->app->user->account) - ->add('openedDate', $now) + ->setDefault('openedBy', $this->app->user->account) + ->setDefault('openedDate', $now) ->setDefault('project,story,task', 0) ->setDefault('openedBuild', '') ->setDefault('deadline', '0000-00-00') @@ -600,9 +600,9 @@ class bugModel extends model ->setDefault('plan', 0) ->setDefault('deadline', '0000-00-00') ->setDefault('resolvedDate', '0000-00-00 00:00:00') + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) ->setIF(strpos($this->config->bug->edit->requiredFields, 'deadline') !== false, 'deadline', $this->post->deadline) - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) ->join('openedBuild', ',') ->join('mailto', ',') ->join('linkBug', ',') @@ -908,15 +908,15 @@ class bugModel extends model $now = helper::now(); $oldBug = $this->getById($bugID); $bug = fixer::input('post') - ->add('resolvedBy', $this->app->user->account) - ->add('status', 'resolved') - ->add('confirmed', 1) - ->add('assignedDate', $now) - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) - ->setDefault('resolvedDate', $now) - ->setDefault('duplicateBug', 0) - ->setDefault('assignedTo', $oldBug->openedBy) + ->add('status', 'resolved') + ->add('confirmed', 1) + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) + ->setDefault('resolvedBy', $this->app->user->account) + ->setDefault('assignedDate', $now) + ->setDefault('resolvedDate', $now) + ->setDefault('duplicateBug', 0) + ->setDefault('assignedTo', $oldBug->openedBy) ->remove('comment,files,labels') ->get(); @@ -1111,8 +1111,11 @@ class bugModel extends model $oldBug = $this->getById($bugID); $now = helper::now(); $bug = fixer::input('post') - ->setDefault('assignedTo', $oldBug->resolvedBy) - ->add('assignedDate', $now) + ->setDefault('assignedTo', $oldBug->resolvedBy) + ->setDefault('assignedDate', $now) + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) + ->setDefault('activatedDate', $now) ->add('resolution', '') ->add('status', 'active') ->add('resolvedDate', '0000-00-00') @@ -1123,9 +1126,6 @@ class bugModel extends model ->add('duplicateBug', 0) ->add('toTask', 0) ->add('toStory', 0) - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) - ->add('activatedDate', $now) ->join('openedBuild', ',') ->remove('comment,files,labels') ->get(); @@ -1149,14 +1149,14 @@ class bugModel extends model $now = helper::now(); $oldBug = $this->getById($bugID); $bug = fixer::input('post') - ->add('assignedTo', 'closed') - ->add('assignedDate', $now) - ->add('status', 'closed') - ->add('closedBy', $this->app->user->account) - ->add('closedDate', $now) - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) - ->add('confirmed', 1) + ->add('assignedTo', 'closed') + ->add('status', 'closed') + ->add('confirmed', 1) + ->setDefault('assignedDate', $now) + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) + ->setDefault('closedBy', $this->app->user->account) + ->setDefault('closedDate', $now) ->remove('comment') ->get(); @@ -1956,8 +1956,8 @@ class bugModel extends model public function saveUserBugTemplate() { $template = fixer::input('post') - ->add('account', $this->app->user->account) - ->add('type', 'bug') + ->setDefault('account', $this->app->user->account) + ->setDefault('type', 'bug') ->stripTags('content', $this->config->allowedTags) ->get(); diff --git a/module/productplan/view/browse.html.php b/module/productplan/view/browse.html.php index fbedcc65f0..7e3d59eade 100644 --- a/module/productplan/view/browse.html.php +++ b/module/productplan/view/browse.html.php @@ -52,7 +52,7 @@ idAB);?> - productplan->title);?> + productplan->title);?> session->currentProductType != 'normal'):?> product->branch);?> @@ -97,7 +97,7 @@ id);?> - ' title="title?>"> + ' title="title?>"> id"), $plan->title); if($plan->parent == '-1') echo ''; diff --git a/module/story/model.php b/module/story/model.php index f7f880095d..a2683d6480 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -147,12 +147,12 @@ class storyModel extends model ->cleanInt('product,module,pri,plan') ->cleanFloat('estimate') ->callFunc('title', 'trim') - ->setDefault('plan,verify', '') - ->add('openedBy', $this->app->user->account) - ->add('openedDate', $now) ->add('assignedDate', 0) ->add('version', 1) ->add('status', 'draft') + ->setDefault('plan,verify', '') + ->setDefault('openedBy', $this->app->user->account) + ->setDefault('openedDate', $now) ->setIF($this->post->assignedTo != '', 'assignedDate', $now) ->setIF($this->post->needNotReview or $projectID > 0, 'status', 'active') ->setIF($this->post->plan > 0, 'stage', 'planned') @@ -416,8 +416,8 @@ class storyModel extends model $now = helper::now(); $story = fixer::input('post') ->callFunc('title', 'trim') - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) ->setIF($this->post->assignedTo != $oldStory->assignedTo, 'assignedDate', $now) ->setIF($specChanged, 'version', $oldStory->version + 1) ->setIF($specChanged and $oldStory->status == 'active' and $this->post->needNotReview == false, 'status', 'changed') @@ -478,9 +478,9 @@ class storyModel extends model $story = fixer::input('post') ->cleanInt('product,module,pri,duplicateStory') ->cleanFloat('estimate') - ->add('assignedDate', $oldStory->assignedDate) - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) + ->setDefault('assignedDate', $oldStory->assignedDate) + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) ->setDefault('plan', '') ->setDefault('status', $oldStory->status) ->setDefault('product', $oldStory->product) @@ -687,8 +687,8 @@ class storyModel extends model $story = fixer::input('post') ->remove('result,preVersion,comment') ->setDefault('reviewedDate', $date) - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) ->setIF($this->post->result == 'pass' and $oldStory->status == 'draft', 'status', 'active') ->setIF($this->post->result == 'pass' and $oldStory->status == 'changed', 'status', 'active') ->setIF($this->post->result == 'reject', 'closedBy', $this->app->user->account) @@ -830,14 +830,14 @@ class storyModel extends model $oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); $now = helper::now(); $story = fixer::input('post') - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) - ->add('closedDate', $now) - ->add('closedBy', $this->app->user->account) ->add('assignedTo', 'closed') - ->add('assignedDate', $now) ->add('status', 'closed') ->add('stage', 'closed') + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) + ->setDefault('closedDate', $now) + ->setDefault('closedBy', $this->app->user->account) + ->setDefault('assignedDate', $now) ->removeIF($this->post->closedReason != 'duplicate', 'duplicateStory') ->removeIF($this->post->closedReason != 'subdivided', 'childStories') ->setIF($this->post->closedReason == 'done', 'stage', 'released') @@ -1097,9 +1097,6 @@ class storyModel extends model $oldStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); $now = helper::now(); $story = fixer::input('post') - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) - ->add('assignedDate', $now) ->add('closedBy', '') ->add('closedReason', '') ->add('closedDate', '0000-00-00') @@ -1107,6 +1104,9 @@ class storyModel extends model ->add('reviewedDate', '0000-00-00') ->add('duplicateStory', 0) ->add('childStories', '') + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) + ->setDefault('assignedDate', $now) ->remove('comment') ->get(); $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq($storyID)->exec(); diff --git a/module/task/model.php b/module/task/model.php index 5487f33fa3..bc80ca5df4 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -616,8 +616,8 @@ class taskModel extends model ->setIF($this->post->status == 'wait' and $this->post->left == $oldTask->left and $this->post->consumed == 0 and $this->post->estimate, 'left', $this->post->estimate) - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) ->stripTags($this->config->task->editor->edit['id'], $this->config->allowedTags) ->join('mailto', ',') ->remove('comment,files,labels,uid,multiple,team,teamEstimate,teamConsumed,teamLeft,contactListMenu') diff --git a/module/testcase/model.php b/module/testcase/model.php index e9b095e2ec..6fb57ab2c6 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -185,11 +185,11 @@ class testcaseModel extends model { $now = helper::now(); $case = fixer::input('post') - ->add('openedBy', $this->app->user->account) - ->add('openedDate', $now) ->add('status', $this->forceNotReview() || $this->post->forceNotReview ? 'normal' : 'wait') ->add('version', 1) ->add('fromBug', $bugID) + ->setDefault('openedBy', $this->app->user->account) + ->setDefault('openedDate', $now) ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion((int)$this->post->story)) ->remove('steps,expects,files,labels,stepType,forceNotReview') ->setDefault('story', 0) @@ -676,11 +676,11 @@ class testcaseModel extends model $version = $stepChanged ? $oldCase->version + 1 : $oldCase->version; $case = fixer::input('post') - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) ->add('version', $version) ->setIF($this->post->story != false and $this->post->story != $oldCase->story, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) - ->setDefault('story,branch', 0) + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) + ->setDefault('story,branch', 0) ->join('stage', ',') ->join('linkCase', ',') ->remove('comment,steps,expects,files,labels,stepType') @@ -752,8 +752,8 @@ class testcaseModel extends model $case = fixer::input('post') ->remove('result,comment') ->setDefault('reviewedDate', substr($now, 0, 10)) - ->add('lastEditedBy', $this->app->user->account) - ->add('lastEditedDate', $now) + ->setDefault('lastEditedBy', $this->app->user->account) + ->setDefault('lastEditedDate', $now) ->setIF($this->post->result == 'pass', 'status', 'normal') ->join('reviewedBy', ',') ->get(); diff --git a/module/testtask/model.php b/module/testtask/model.php index 31ea1eb449..9cf83de325 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -915,8 +915,8 @@ class testtaskModel extends model ->add('run', $runID) ->add('caseResult', $caseResult) ->setForce('stepResults', serialize($stepResults)) - ->add('lastRunner', $this->app->user->account) - ->add('date', $now) + ->setDefault('lastRunner', $this->app->user->account) + ->setDefault('date', $now) ->skipSpecial('stepResults') ->remove('steps,reals,result') ->get(); diff --git a/module/tree/model.php b/module/tree/model.php index b6ae0881dd..ce3cabb835 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -112,7 +112,7 @@ class treeModel extends model ksort($treeMenu); $topMenu = @array_shift($treeMenu); $topMenu = explode("\n", trim($topMenu)); - $lastMenu[] = in_array($type, array('bug', 'story')) ? '' : '/'; + $lastMenu[] = '/'; foreach($topMenu as $menu) { if(!strpos($menu, '|')) continue; From adfd61aa66aceca34ed464125fc00723ea7d6ebb Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 22 Feb 2019 10:36:16 +0800 Subject: [PATCH 2/3] * finish task #5275. --- module/doc/control.php | 8 ++- module/doc/css/alllibs.css | 4 -- module/doc/css/index.css | 13 ----- module/doc/js/common.js | 1 - module/doc/lang/zh-cn.php | 3 +- module/doc/view/side.html.php | 92 ++++++++++++++++++++++++++++++++++- module/doc/view/sort.html.php | 9 ++++ module/task/model.php | 4 +- 8 files changed, 111 insertions(+), 23 deletions(-) delete mode 100644 module/doc/css/alllibs.css create mode 100644 module/doc/view/sort.html.php diff --git a/module/doc/control.php b/module/doc/control.php index 32405ffcae..7c309b241e 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -532,7 +532,7 @@ class doc extends control * @access public * @return void */ - public function sort() + public function sort($type = '') { if($_POST) { @@ -543,6 +543,12 @@ class doc extends control if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->send(array('result' => 'success')); } + + if($type) + { + $this->view->libs = $this->doc->getLibs($type); + $this->display(); + } } /** diff --git a/module/doc/css/alllibs.css b/module/doc/css/alllibs.css deleted file mode 100644 index 515312e555..0000000000 --- a/module/doc/css/alllibs.css +++ /dev/null @@ -1,4 +0,0 @@ -#libs .libs-group-heading{border:1px solid #ddd;overflow:hidden} -#libs .libs-group{border:1px solid #ddd; border-top:0px;overflow:hidden; margin-bottom:20px;} -#libs .libs-group.libs-custom{border-top:1px solid #ddd;overflow:hidden; margin-bottom:20px;} -#libs .lib-custom{width:130px; margin-bottom:10px;} diff --git a/module/doc/css/index.css b/module/doc/css/index.css index f07a46ead0..8e943f4aa7 100644 --- a/module/doc/css/index.css +++ b/module/doc/css/index.css @@ -1,14 +1 @@ -.lib-heading{border-right:1px solid #ddd;} -.lib-more a.more{font-weight:bold; display:block;} -#libs .libs-group-heading{border:1px solid #ddd;} -#libs .libs-group{border:1px solid #ddd; border-top:0px; margin-bottom:20px;} -#libs .libs-group.lib-more{border:0px; text-align:center; height:120px; line-height:110px;} -#libs .libs-group.lib-more:hover{background-color: #EBF2F9} -#libs .libs-custom-heading{text-align:center; height:120px; line-height:110px; position: relative; margin-bottom:20px;} -#libs .libs-custom-heading:hover{background-color: #EBF2F9} -#libs .libs-custom-heading a{display:block;height:100%;} -#libs .libs-custom-heading .lable-custom{position: absolute;left:8px;} -#libs hr {margin-top:0px;} -#libs .panel-body {overflow: auto; max-height: 224px;} - #pageActions ul.dropdown-menu{left: 67px} diff --git a/module/doc/js/common.js b/module/doc/js/common.js index 0c030b430c..262d702e68 100644 --- a/module/doc/js/common.js +++ b/module/doc/js/common.js @@ -80,7 +80,6 @@ $(document).ready(function() } }, 'json'); } - }); 'use strict'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 867064191a..e0c57bfa8f 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -141,7 +141,8 @@ $lang->doc->fastMenuIconList['collectedbyme'] = 'icon-folder-star'; $lang->doc->customObjectLibs['files'] = '显示附件库'; $lang->doc->customObjectLibs['customFiles'] = '显示自定义文档库'; -$lang->doc->customShowLibs = '文档库显示设置'; +$lang->doc->orderLib = '文档库排序'; +$lang->doc->customShowLibs = '显示设置'; $lang->doc->customShowLibsList['zero'] = '显示空文档的库'; $lang->doc->customShowLibsList['unclosed'] = '只显示未关闭的项目'; diff --git a/module/doc/view/side.html.php b/module/doc/view/side.html.php index a7722821ff..749e73e40d 100644 --- a/module/doc/view/side.html.php +++ b/module/doc/view/side.html.php @@ -161,7 +161,20 @@ if(empty($type)) $type = 'product'; - + +goback);?> + diff --git a/module/doc/view/sort.html.php b/module/doc/view/sort.html.php new file mode 100644 index 0000000000..4dd7053b36 --- /dev/null +++ b/module/doc/view/sort.html.php @@ -0,0 +1,9 @@ +
+ + $libName):?> +
+ +
diff --git a/module/task/model.php b/module/task/model.php index bc80ca5df4..9c5bb36250 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -626,7 +626,7 @@ class taskModel extends model if($task->consumed < $oldTask->consumed) die(js::error($this->lang->task->error->consumedSmall)); /* Fix bug#1388, Check children task projectID and moduleID. */ - if($task->project != $oldTask->project) + if(isset($task->project) and $task->project != $oldTask->project) { $this->dao->update(TABLE_TASK)->set('project')->eq($task->project)->set('module')->eq($task->module)->where('parent')->eq($taskID)->exec(); } @@ -705,7 +705,7 @@ class taskModel extends model { if($task->status == 'done') $this->loadModel('score')->create('task', 'finish', $taskID); if($task->status == 'closed') $this->loadModel('score')->create('task', 'close', $taskID); - if($task->parent) + if(!empty($task->parent)) { $this->dao->update(TABLE_TASK)->set('parent')->eq(-1)->where('id')->eq($task->parent)->exec(); $this->updateParentStatus($taskID); From 838bb873b98f3d51c1841ee229418651e92ce378 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 22 Feb 2019 10:43:23 +0800 Subject: [PATCH 3/3] * code for task #5275. --- module/doc/view/side.html.php | 18 +++++++++--------- module/doc/view/sort.html.php | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/module/doc/view/side.html.php b/module/doc/view/side.html.php index 749e73e40d..446b66d703 100644 --- a/module/doc/view/side.html.php +++ b/module/doc/view/side.html.php @@ -264,15 +264,15 @@ $(function() }); }); }); - - function cancelOrder() - { - var $tabPane = $('#mainRow .side-col .tabs .tab-content .tab-pane.active'); - $tabPane.find('.libs-group.sort').remove(); - $tabPane.find('ul.tree').removeClass('hidden'); - $tabPane.closest('.side-col').find('.side-footer .pull-right #orderLib').removeClass('hidden'); - $tabPane.closest('.side-col').find('.side-footer .pull-right #cancelOrder').addClass('hidden'); - } }); + +function cancelOrder() +{ + var $tabPane = $('#mainRow .side-col .tabs .tab-content .tab-pane.active'); + $tabPane.find('.libs-group.sort').remove(); + $tabPane.find('ul.tree').removeClass('hidden'); + $tabPane.closest('.side-col').find('.side-footer .pull-right #orderLib').removeClass('hidden'); + $tabPane.closest('.side-col').find('.side-footer .pull-right #cancelOrder').addClass('hidden'); +} diff --git a/module/doc/view/sort.html.php b/module/doc/view/sort.html.php index 4dd7053b36..921e284452 100644 --- a/module/doc/view/sort.html.php +++ b/module/doc/view/sort.html.php @@ -1,7 +1,7 @@
$libName):?>