From e1c08416f11c4e884a24d4d88f6898b868e3bb74 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Tue, 29 Mar 2016 13:14:29 +0800 Subject: [PATCH 1/2] * finish task #2568. --- module/product/control.php | 1 + module/product/view/browse.html.php | 19 +++++++++++++++++++ module/story/control.php | 21 +++++++++++++++++++++ module/story/lang/en.php | 1 + module/story/lang/zh-cn.php | 1 + module/story/model.php | 29 +++++++++++++++++++++++++++++ 6 files changed, 72 insertions(+) diff --git a/module/product/control.php b/module/product/control.php index d09f72accf..18b7274558 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -168,6 +168,7 @@ class product extends control $this->view->users = $this->user->getPairs('nodeleted|noletter|pofirst'); $this->view->orderBy = $orderBy; $this->view->browseType = $browseType; + $this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); $this->view->moduleID = $moduleID; $this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all; $this->view->branch = $branch; diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index f1112011f8..a27ee41e52 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -167,6 +167,25 @@ echo ''; } + if(common::hasPriv('story', 'batchChangeModule')) + { + $withSearch = count($modules) > 8; + echo "'; + } + else + { + echo '
  • ' . html::a('javascript:;', $lang->story->moduleAB, '', $class) . '
  • '; + } + if(common::hasPriv('story', 'batchChangePlan')) { unset($plans['']); diff --git a/module/story/control.php b/module/story/control.php index 72cd8d6718..40e94f2314 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -770,6 +770,27 @@ class story extends control $this->display(); } + /** + * Batch change the module of story. + * + * @param int $moduleID + * @access public + * @return void + */ + public function batchChangeModule($moduleID) + { + $storyIDList = !empty($_POST['storyIDList']) ? $this->post->storyIDList : die(js::locate($this->session->storyList, 'parent')); + $allChanges = $this->story->batchChangeModule($storyIDList, $moduleID); + if(dao::isError()) die(js::error(dao::getError())); + foreach($allChanges as $storyID => $changes) + { + $actionID = $this->action->create('story', $storyID, 'Edited'); + $this->action->logHistory($actionID, $changes); + $this->sendmail($storyID, $actionID); + } + die(js::reload('parent')); + } + /** * Batch change the plan of story. * diff --git a/module/story/lang/en.php b/module/story/lang/en.php index d578511301..7f0d94a9e4 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -38,6 +38,7 @@ $lang->story->common = 'Story'; $lang->story->id = 'ID'; $lang->story->product = $lang->productCommon; $lang->story->module = 'Module'; +$lang->story->moduleAB = 'Module'; $lang->story->source = 'Source'; $lang->story->fromBug = 'From bug'; $lang->story->title = 'Title'; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index d0d1d105d8..999b9c4dfa 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -38,6 +38,7 @@ $lang->story->common = '需求'; $lang->story->id = '编号'; $lang->story->product = "所属{$lang->productCommon}"; $lang->story->module = '所属模块'; +$lang->story->moduleAB = '模块'; $lang->story->source = '需求来源'; $lang->story->fromBug = '来源Bug'; $lang->story->title = '需求名称'; diff --git a/module/story/model.php b/module/story/model.php index b3d65a1ee2..5515ff09a1 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -739,6 +739,35 @@ class storyModel extends model return $allChanges; } + /** + * Batch change the module of story. + * + * @param array $storyIDList + * @param int $moduleID + * @access public + * @return array + */ + public function batchChangeModule($storyIDList, $moduleID) + { + $now = helper::now(); + $allChanges = array(); + $oldStories = $this->getByList($storyIDList); + foreach($storyIDList as $storyID) + { + $oldStory = $oldStories[$storyID]; + if($moduleID == $oldStory->module) continue; + + $story = new stdclass(); + $story->lastEditedBy = $this->app->user->account; + $story->lastEditedDate = $now; + $story->module = $moduleID; + + $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq((int)$storyID)->exec(); + if(!dao::isError()) $allChanges[$storyID] = common::createChanges($oldStory, $story); + } + return $allChanges; + } + /** * Batch change the plan of story. * From 590afbf92edd66ceed58c35a6c80ab12396c8384 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Tue, 29 Mar 2016 14:27:57 +0800 Subject: [PATCH 2/2] * finish task #2569. --- module/project/control.php | 1 + module/project/css/task.css | 9 +++++---- module/project/js/task.js | 7 ++++--- module/project/view/task.html.php | 30 +++++++++++++++++++++++++----- module/task/control.php | 26 ++++++++++++++++++++++++++ module/task/lang/en.php | 1 + module/task/lang/zh-cn.php | 1 + module/task/model.php | 29 +++++++++++++++++++++++++++++ 8 files changed, 92 insertions(+), 12 deletions(-) diff --git a/module/project/control.php b/module/project/control.php index 3e44b663b6..ed1add9919 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -187,6 +187,7 @@ class project extends control $this->view->projectID = $projectID; $this->view->project = $project; $this->view->productID = $productID; + $this->view->modules = $this->tree->getTaskOptionMenu($projectID); $this->view->moduleID = $moduleID; $this->view->moduleTree = $this->tree->getTaskTreeMenu($projectID, $productID = 0, $startModuleID = 0, array('treeModel', 'createTaskLink')); $this->view->projectTree = $this->project->tree(); diff --git a/module/project/css/task.css b/module/project/css/task.css index bfcb1cbae2..ec7a57e4c8 100644 --- a/module/project/css/task.css +++ b/module/project/css/task.css @@ -5,7 +5,8 @@ #hideButton span{padding:2px 10px; background:url(theme/default/images/main/zt-icons.png) -100px -161px;} #featurebar .f-right .icon-green-task-import {padding:2px 8px; background:url(theme/default/images/main/zt-icons.png) 0px -82px;} -.assign-menu {min-width: 150px; overflow: hidden; max-height: 305px} -.assign-menu.with-search {padding-bottom: 34px;} -.assign-menu > .assign-search {padding: 0; position: absolute; z-index: 0; bottom: 0; left: 0; right: 0} -.assign-menu > .assign-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666} +.dropdown-menu.with-search {padding-bottom: 34px; min-width: 150px; overflow: hidden; max-height: 305px} +.dropdown-menu > .menu-search {padding: 0; position: absolute; z-index: 0; bottom: 0; left: 0; right: 0} +.dropdown-menu > .menu-search .input-group {width:100%;} +.dropdown-menu > .menu-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666} +.pl-5px{padding-left:5px;} diff --git a/module/project/js/task.js b/module/project/js/task.js index 92b2d6cd38..4a1401749a 100644 --- a/module/project/js/task.js +++ b/module/project/js/task.js @@ -5,15 +5,16 @@ $(function() setTimeout(function(){fixedTfootAction('#projectTaskForm')}, 100); setTimeout(function(){fixedTheadOfList('#taskList')}, 100); - $('.assign-search').click(function(e) + $('.dropdown-menu .with-search .menu-search').click(function(e) { e.stopPropagation(); return false; }).on('keyup change paste', 'input', function() { var val = $(this).val().toLowerCase(); - if(val == '') return $('.assign-menu > .option').removeClass('hide'); - $('.assign-menu > .option').each(function() + var $options = $(this).closest('ul.dropdown-menu.with-search').find('.option'); + if(val == '') return $options.removeClass('hide'); + $options.each(function() { var $option = $(this); $option.toggleClass('hide', $option.text().toString().toLowerCase().indexOf(val) < 0 && $option.data('key').toString().toLowerCase().indexOf(val) < 0); diff --git a/module/project/view/task.html.php b/module/project/view/task.html.php index b32862018f..11347ed787 100644 --- a/module/project/view/task.html.php +++ b/module/project/view/task.html.php @@ -52,9 +52,10 @@ js::set('browseType', $browseType);
    " . html::a('#', $lang->close, '', $misc) . ""; + if($canBatchChangeModule) + { + $withSearch = count($modules) > 10; + echo "'; + } + else + { + echo '
  • ' . html::a('javascript:;', $lang->task->moduleAB, '', $class) . '
  • '; + } + /* Batch assign. */ if($canBatchAssignTo) { @@ -78,13 +98,13 @@ js::set('browseType', $browseType); echo html::select('assignedTo', $memberPairs, '', 'class="hidden"'); echo "