From c6cba5483e6415438087da4b43d294555b1a3b4a Mon Sep 17 00:00:00 2001 From: jinianlan Date: Mon, 12 Aug 2019 08:23:00 +0800 Subject: [PATCH] * finish task #6173,#6174,#6175,#6183,#6186,#6187. --- module/block/view/todoblock.html.php | 2 +- module/doc/control.php | 1 + module/doc/js/common.js | 1 - module/doc/model.php | 39 +++++++++++++++++++++++++--- module/story/model.php | 32 ++++++++++++++++++++--- module/task/model.php | 27 ++++++++++++++++--- module/testtask/js/create.js | 35 +++++++++++++++++++++++++ module/testtask/view/create.html.php | 2 +- 8 files changed, 126 insertions(+), 13 deletions(-) diff --git a/module/block/view/todoblock.html.php b/module/block/view/todoblock.html.php index 56da2fa3e2..46cd6b7801 100644 --- a/module/block/view/todoblock.html.php +++ b/module/block/view/todoblock.html.php @@ -19,7 +19,7 @@ if(!$selfCall) die(include('./todolist.html.php')); .block-todoes .todoes-input .form-control:-ms-input-placeholder {font-size: 12px; line-height: 20px;color: #a4a8b6;} .block-todoes .todoes-input .form-control::placeholder {font-size: 12px; line-height: 20px; color: #a4a8b6;} .block-todoes .todoes {padding: 0 10px 10px 10px; margin: 0 -20px; max-height: 350px; overflow: auto; overflow-x:hidden} -.block-todoes .todoes > li {position: relative; padding: 5px 10px 5px 35px; list-style: none; white-space:nowrap; overflow: auto; overflow-x:hidden;} +.block-todoes .todoes > li {position: relative; padding: 5px 10px 5px 35px; list-style: none; white-space:nowrap; overflow: auto; overflow-x:hidden; max-width: 820px;} .block-todoes .todoes > li:hover {background-color: #e9f2fb;} .block-todoes .todo-title {padding: 5px 15px 5px 5px;} .block-todoes .todo-pri {margin: 0 5px;} diff --git a/module/doc/control.php b/module/doc/control.php index 0a14865855..e3a8e262c1 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -45,6 +45,7 @@ class doc extends control $this->lang->modulePageActions = $this->doc->setFastMenu($this->lang->doc->fast); $this->lang->modulePageActions .= common::hasPriv('doc', 'createLib') ? html::a(helper::createLink('doc', 'createLib'), " " . $this->lang->doc->createLib, '', "class='btn btn-secondary iframe' data-width='70%'") : ''; + $this->lang->modulePageActions .= common::hasPriv('doc', 'create') ? $this->doc->setCreateDocMenu() : ''; $actionURL = $this->createLink('doc', 'browse', "lib=0&browseType=bySearch&queryID=myQueryID"); $this->doc->buildSearchForm(0, array(), 0, $actionURL, 'index'); diff --git a/module/doc/js/common.js b/module/doc/js/common.js index bff0bc5d27..19c7943512 100644 --- a/module/doc/js/common.js +++ b/module/doc/js/common.js @@ -52,7 +52,6 @@ $(document).ready(function() $('#module').trigger('chosen:close'); }); - $('#pageActions ul.dropdown-menu').css('left', '67px'); $('.libs-group.sort').sortable( { trigger: '.lib', diff --git a/module/doc/model.php b/module/doc/model.php index 4f61df6c76..4c367ac35c 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -147,7 +147,13 @@ class docModel extends model } elseif($type == 'all') { - $stmt = $this->dao->select('*')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->orderBy('`order`, id desc')->query(); + /* Associated display Settings -> shows only unclosed projects.*/ + $stmt = $this->dao->select('distinct t1.*')->from(TABLE_DOCLIB)->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on("t1.project = '' || t1.project = t2.id") + ->where('t1.deleted')->eq(0) + ->beginIF(strpos($this->config->doc->custom->showLibs,'unclosed') !== false)->andWhere('t2.status')->notin('done,closed')->fi() + ->orderBy('t1.order,t1.id desc') + ->query(); } else { @@ -174,7 +180,7 @@ class docModel extends model if($lib->project != 0) $lib->name = zget($projects, $lib->project, '') . '/' . $lib->name; } - $libPairs[$lib->id] = $lib->name; + $libPairs[$lib->id] = '/' . $lib->name; } } @@ -183,7 +189,7 @@ class docModel extends model $stmt = $this->dao->select('*')->from(TABLE_DOCLIB)->where('id')->in($appendLibs)->orderBy('`order`, id desc')->query(); while($lib = $stmt->fetch()) { - if(!isset($libPairs[$lib->id]) and $this->checkPrivLib($lib, $extra)) $libPairs[$lib->id] = $lib->name; + if(!isset($libPairs[$lib->id]) and $this->checkPrivLib($lib, $extra)) $libPairs[$lib->id] = '/' . $lib->name; } } @@ -1601,6 +1607,33 @@ class docModel extends model return $title; } + /** + * Set document module index page create document button. + * + * @access public + * @return void + */ + public function setCreateDocMenu() + { + $libID = $this->dao->select('id')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->orderBy('id desc')->limit('1')->fetch('id'); + $actions = ""; + if($libID) + { + $actions .= ""; + } + return $actions; + } + public function setFastMenu($fastLib) { $actions = ''; diff --git a/module/story/model.php b/module/story/model.php index 35bb341d62..ea1384f3e3 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2511,9 +2511,7 @@ class storyModel extends model echo substr($story->openedDate, 5, 11); break; case 'assignedTo': - $assignedToText = zget($users, $story->assignedTo, $story->assignedTo); - $btnTextClass = ($story->assignedTo == $this->app->user->account) ? 'text-red' : ''; - echo "{$assignedToText}"; + $this->printAssignedHtml($story, $users); break; case 'assignedDate': echo substr($story->assignedDate, 5, 11); @@ -2564,6 +2562,34 @@ class storyModel extends model } } + /** + * Product module story page add assignment function. + * + * @param object $story + * @param array $users + * @access public + * @return void + */ + public function printAssignedHtml($story, $users) + { + $btnTextClass = ''; + $assignedToText = zget($users, $story->assignedTo); + + if(empty($story->assignedTo)) + { + $btnTextClass = 'text-primary'; + $assignedToText = $this->lang->task->noAssigned; + } + if($story->assignedTo == $this->app->user->account) $btnTextClass = 'text-red'; + + $btnClass = $story->assignedTo == 'closed' ? ' disabled' : ''; + $btnClass = "iframe btn btn-icon-left btn-sm {$btnClass}"; + $assignToLink = helper::createLink('story', 'assignTo', "storyID=$story->id", '', true); + $assignToHtml = html::a($assignToLink, " {$assignedToText}", '', "class='$btnClass'"); + + echo !common::hasPriv('story', 'assignTo', $story) ? "{$assignedToText}" : $assignToHtml; + } + /** * Set report condition. * diff --git a/module/task/model.php b/module/task/model.php index 2609e58603..48931e09ca 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -315,6 +315,7 @@ class taskModel extends model if(!dao::isError()) $this->loadModel('score')->create('ajax', 'batchCreate'); if($parentID > 0 && !empty($taskID)) { + $oldParentTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq((int)$parentID)->fetch(); $this->updateParentStatus($taskID); $this->computeBeginAndEnd($parentID); @@ -324,7 +325,10 @@ class taskModel extends model $task->lastEditedDate = $now; $this->dao->update(TABLE_TASK)->data($task)->where('id')->eq($parentID)->exec(); - $this->action->create('task', $parentID, 'createChildren', '', trim($childTasks, ',')); + $newParentTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq((int)$parentID)->fetch(); + $changes = common::createChanges($oldParentTask, $newParentTask); + $actionID = $this->action->create('task', $parentID, 'createChildren', '', trim($childTasks, ',')); + if(!empty($changes)) $this->action->logHistory($actionID, $changes); } return $mails; } @@ -408,6 +412,7 @@ class taskModel extends model if(empty($parentID)) $parentID = $childTask->parent; if($parentID <= 0) return true; + $oldParentTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($parentID)->fetch(); $this->computeWorkingHours($parentID); $childrenStatus = $this->dao->select('id,status')->from(TABLE_TASK)->where('parent')->eq($parentID)->andWhere('deleted')->eq(0)->fetchPairs('status', 'status'); @@ -499,7 +504,8 @@ class taskModel extends model { if(!$createAction) return $task; - $changes = common::createChanges($parentTask, $task); + $newParentTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($parentID)->fetch(); + $changes = common::createChanges($oldParentTask, $newParentTask); $action = ''; if($status == 'done') $action = 'Finished'; if($status == 'closed') $action = 'Closed'; @@ -515,6 +521,19 @@ class taskModel extends model } } } + else + { + if(!dao::isError()) + { + $newParentTask = $this->dao->select('*')->from(TABLE_TASK)->where('id')->eq($parentID)->fetch(); + $changes = common::createChanges($oldParentTask, $newParentTask); + if($changes) + { + $actionID = $this->loadModel('action')->create('task', $parentID, 'Edited'); + $this->action->logHistory($actionID, $changes); + } + } + } } /** @@ -1103,7 +1122,7 @@ class taskModel extends model ->setDefault('account', $this->app->user->account) ->setDefault('task', $taskID) ->setDefault('date', $task->realStarted) - ->remove('realStarted,comment') + ->remove('realStarted,comment,status') ->get(); $estimate->consumed = $estimate->consumed - $oldTask->consumed; $this->addTaskEstimate($estimate); @@ -1329,7 +1348,7 @@ class taskModel extends model ->setDefault('date', date(DT_DATE1)) ->setIF($this->post->finishedDate, 'date', $this->post->finishedDate) ->setDefault('left', 0) - ->remove('finishedDate,comment,assignedTo,files,labels,consumed,currentConsumed') + ->remove('finishedDate,comment,assignedTo,files,labels,consumed,currentConsumed,status') ->get(); $estimate->consumed = $consumed; diff --git a/module/testtask/js/create.js b/module/testtask/js/create.js index ae1a8ceb76..68dc6a806e 100755 --- a/module/testtask/js/create.js +++ b/module/testtask/js/create.js @@ -1,3 +1,32 @@ +/** + * load builds of selected product project. + * + * @param productID $productID + * @access public + * @return void + */ +function loadProductRelated(productID) +{ + projectID = $('#project').val(); + loadProductProjectBuilds(productID, projectID); +} + +/** + * loadProductProjectBuilds + * + * @param productID $productID + * @param projectID $projectID + * @access public + * @return void + */ +function loadProductProjectBuilds(productID, projectID) +{ + selectedBuild = $('#build').val(); + if(!selectedBuild) selectedBuild = 0; + link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=testTaskBuild&build=' + selectedBuild); + $('#buildBox').load(link, function(){$('#build').chosen();}); +} + /** * Load project related builds * @@ -62,4 +91,10 @@ function suitEndDate() $(function() { adjustPriBoxWidth(); + if($('#project').val()) + { + productID = $('#product').val(); + projectID = $('#project').val(); + loadProductProjectBuilds(productID, projectID); + } }); diff --git a/module/testtask/view/create.html.php b/module/testtask/view/create.html.php index 788948a874..a82c0ede2d 100644 --- a/module/testtask/view/create.html.php +++ b/module/testtask/view/create.html.php @@ -24,7 +24,7 @@ testtask->product;?> - +