* finish task #2569.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -52,9 +52,10 @@ js::set('browseType', $browseType);
|
||||
<td colspan='<?php echo $columns;?>'>
|
||||
<div class='table-actions clearfix'>
|
||||
<?php
|
||||
$canBatchEdit = common::hasPriv('task', 'batchEdit');
|
||||
$canBatchClose = (common::hasPriv('task', 'batchClose') && strtolower($browseType) != 'closedBy');
|
||||
$canBatchAssignTo = common::hasPriv('task', 'batchAssignTo');
|
||||
$canBatchEdit = common::hasPriv('task', 'batchEdit');
|
||||
$canBatchClose = (common::hasPriv('task', 'batchClose') && strtolower($browseType) != 'closedBy');
|
||||
$canBatchChangeModule = common::hasPriv('task', 'batchChangeModule');
|
||||
$canBatchAssignTo = common::hasPriv('task', 'batchAssignTo');
|
||||
if(count($tasks))
|
||||
{
|
||||
echo html::selectButton();
|
||||
@@ -70,6 +71,25 @@ js::set('browseType', $browseType);
|
||||
$misc = $canBatchClose ? "onclick=\"setFormAction('$actionLink','hiddenwin')\"" : "class='disabled'";
|
||||
echo "<li>" . html::a('#', $lang->close, '', $misc) . "</li>";
|
||||
|
||||
if($canBatchChangeModule)
|
||||
{
|
||||
$withSearch = count($modules) > 10;
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript:;', $lang->task->moduleAB, '', "id='moduleItem'");
|
||||
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
foreach($modules as $moduleId => $module)
|
||||
{
|
||||
$actionLink = $this->createLink('task', 'batchChangeModule', "moduleID=$moduleId");
|
||||
echo "<li class='option' data-key='$moduleID'>" . html::a('#', $module, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"") . "</li>";
|
||||
}
|
||||
if($withSearch) echo "<li class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
echo '</ul></li>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<li>' . html::a('javascript:;', $lang->task->moduleAB, '', $class) . '</li>';
|
||||
}
|
||||
|
||||
/* Batch assign. */
|
||||
if($canBatchAssignTo)
|
||||
{
|
||||
@@ -78,13 +98,13 @@ js::set('browseType', $browseType);
|
||||
echo html::select('assignedTo', $memberPairs, '', 'class="hidden"');
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript::', $lang->task->assignedTo, 'id="assignItem"');
|
||||
echo "<ul class='dropdown-menu assign-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
foreach ($memberPairs as $key => $value)
|
||||
{
|
||||
if(empty($key)) continue;
|
||||
echo "<li class='option' data-key='$key'>" . html::a("javascript:$(\".table-actions #assignedTo\").val(\"$key\");setFormAction(\"$actionLink\")", $value, '', '') . '</li>';
|
||||
}
|
||||
if($withSearch) echo "<li class='assign-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
if($withSearch) echo "<li class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
echo "</ul>";
|
||||
echo "</li>";
|
||||
}
|
||||
|
||||
@@ -402,6 +402,32 @@ class task extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch change the module of task.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchChangeModule($moduleID)
|
||||
{
|
||||
if($this->post->taskIDList)
|
||||
{
|
||||
$taskIDList = $this->post->taskIDList;
|
||||
unset($_POST['taskIDList']);
|
||||
$allChanges = $this->task->batchChangeModule($taskIDList, $moduleID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
foreach($allChanges as $taskID => $changes)
|
||||
{
|
||||
$this->loadModel('action');
|
||||
$actionID = $this->action->create('task', $taskID, 'Edited');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
$this->sendmail($taskID, $actionID);
|
||||
}
|
||||
}
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch update assign of task.
|
||||
*
|
||||
|
||||
@@ -36,6 +36,7 @@ $lang->task->common = 'Task';
|
||||
$lang->task->id = 'ID';
|
||||
$lang->task->project = $lang->projectCommon;
|
||||
$lang->task->module = 'Module';
|
||||
$lang->task->moduleAB = 'Module';
|
||||
$lang->task->story = 'Story';
|
||||
$lang->task->storySpec = 'Story desc';
|
||||
$lang->task->storyVerify = 'Story Verify';
|
||||
|
||||
@@ -36,6 +36,7 @@ $lang->task->common = '任务';
|
||||
$lang->task->id = '编号';
|
||||
$lang->task->project = '所属' . $lang->projectCommon;
|
||||
$lang->task->module = '所属模块';
|
||||
$lang->task->moduleAB = '模块';
|
||||
$lang->task->story = '相关需求';
|
||||
$lang->task->storySpec = '需求描述';
|
||||
$lang->task->storyVerify = '验收标准';
|
||||
|
||||
@@ -400,6 +400,35 @@ class taskModel extends model
|
||||
return $allChanges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch change the module of task.
|
||||
*
|
||||
* @param array $taskIDList
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchChangeModule($taskIDList, $moduleID)
|
||||
{
|
||||
$now = helper::now();
|
||||
$allChanges = array();
|
||||
$oldTasks = $this->getByList($taskIDList);
|
||||
foreach($taskIDList as $taskID)
|
||||
{
|
||||
$oldTask = $oldTasks[$taskID];
|
||||
if($moduleID == $oldTask->module) continue;
|
||||
|
||||
$task = new stdclass();
|
||||
$task->lastEditedBy = $this->app->user->account;
|
||||
$task->lastEditedDate = $now;
|
||||
$task->module = $moduleID;
|
||||
|
||||
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec();
|
||||
if(!dao::isError()) $allChanges[$taskID] = common::createChanges($oldTask, $task);
|
||||
}
|
||||
return $allChanges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a task to a user again.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user