* adjust for activate task.
This commit is contained in:
@@ -1796,14 +1796,8 @@ class task extends control
|
||||
return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
|
||||
}
|
||||
|
||||
if(!empty($this->view->task->team))
|
||||
{
|
||||
$members = array();
|
||||
foreach($this->view->task->team as $account => $member) $members[$account] = zget($this->view->members, $account);
|
||||
$this->view->members = $members;
|
||||
}
|
||||
|
||||
if(!isset($this->view->members[$this->view->task->finishedBy])) $this->view->members[$this->view->task->finishedBy] = $this->view->task->finishedBy;
|
||||
|
||||
$this->view->title = $this->view->execution->name . $this->lang->colon . $this->lang->task->activate;
|
||||
$this->view->position[] = $this->lang->task->activate;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
$('#confirmButton').click(function()
|
||||
{
|
||||
var memberCount = '';
|
||||
var totalEstimate = 0;
|
||||
var totalConsumed = oldConsumed;
|
||||
var totalLeft = 0;
|
||||
var error = false;
|
||||
$('select[name^=team]').each(function()
|
||||
{
|
||||
if($(this).val() == '') return;
|
||||
|
||||
memberCount++;
|
||||
|
||||
var $tr = $(this).closest('tr');
|
||||
var account = $(this).find('option:selected').text();
|
||||
|
||||
estimate = parseFloat($tr.find('[name^=teamEstimate]').val());
|
||||
if(!isNaN(estimate)) totalEstimate += estimate;
|
||||
if(isNaN(estimate) || estimate == 0)
|
||||
{
|
||||
bootbox.alert(account + ' ' + estimateNotEmpty);
|
||||
error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
consumed = parseFloat($tr.find('[name^=teamConsumed]').val());
|
||||
if(!isNaN(consumed)) totalConsumed += consumed;
|
||||
|
||||
left = parseFloat($tr.find('[name^=teamLeft]').val());
|
||||
if(!isNaN(left)) totalLeft += left;
|
||||
if(!$tr.hasClass('member-done') && (isNaN(left) || left == 0))
|
||||
{
|
||||
bootbox.alert(account + ' ' + leftNotEmpty);
|
||||
error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(estimate == 0 || isNaN(estimate))
|
||||
{
|
||||
$(this).val('').trigger("chosen:updated");
|
||||
bootbox.alert(estimateNotEmpty);
|
||||
error = true;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if(error) return false;
|
||||
|
||||
if(memberCount < 2)
|
||||
{
|
||||
bootbox.alert(teamMemberError);
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#left').val(totalLeft);
|
||||
updateAssignedTo();
|
||||
|
||||
$('.close').click();
|
||||
});
|
||||
|
||||
/**
|
||||
* Update assignedTo.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function updateAssignedTo()
|
||||
{
|
||||
var html = '';
|
||||
var multiple = $('#multiple').prop('checked');
|
||||
var assignedTo = $('#assignedTo').val();
|
||||
if(multiple)
|
||||
{
|
||||
var isTeamMember = false;
|
||||
var mode = $('#mode').val();
|
||||
$('select[name^=team]').each(function()
|
||||
{
|
||||
if($(this).find('option:selected').text() == '') return;
|
||||
if($(this).val() == currentUser) isTeamMember = true;
|
||||
|
||||
var account = $(this).find('option:selected').val();
|
||||
var realName = $(this).find('option:selected').text();
|
||||
var selected = account == assignedTo ? 'selected' : '';
|
||||
|
||||
html += "<option value='" + account + "' title='" + realName + "'" + selected + ">" + realName + "</option>";
|
||||
});
|
||||
|
||||
if(mode == 'multi' && isTeamMember && mode != 'linear')
|
||||
{
|
||||
$('[name=assignedTo]').removeAttr('disabled').trigger('chosen:updated');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('[name=assignedTo]').attr('disabled', 'disabled').trigger('chosen:updated');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(key in members)
|
||||
{
|
||||
var selected = key == assignedTo ? 'selected' : '';
|
||||
html += "<option value='" + key + "' title='" + members[key] + "'" + selected + ">" + members[key] + "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
$('#assignedTo').html(html);
|
||||
if(multiple && mode == 'linear' && $('#modalTeam tr.member-doing').length == 0 && $('#modalTeam tr.member-wait').length >= 1) $('[name=assignedTo]').val($('#modalTeam tr.member-wait:first').find('select[name^=team]:first').val());
|
||||
$('#assignedTo').trigger('chosen:updated');
|
||||
}
|
||||
@@ -493,49 +493,6 @@ $(document).ready(function()
|
||||
$('#dataPlanGroup').fixInputGroup();
|
||||
});
|
||||
|
||||
/* Init task team manage dialog */
|
||||
var $taskTeamEditor = $('#taskTeamEditor').batchActionForm(
|
||||
{
|
||||
idStart: 0,
|
||||
idEnd: 5,
|
||||
chosen: true,
|
||||
datetimepicker: false,
|
||||
colorPicker: false,
|
||||
});
|
||||
var taskTeamEditor = $taskTeamEditor.data('zui.batchActionForm');
|
||||
|
||||
var adjustButtons = function()
|
||||
{
|
||||
var $deleteBtn = $taskTeamEditor.find('.btn-delete');
|
||||
if ($deleteBtn.length == 1) $deleteBtn.addClass('disabled').attr('disabled', 'disabled');
|
||||
};
|
||||
|
||||
$taskTeamEditor.on('click', '.btn-add', function()
|
||||
{
|
||||
var $newRow = taskTeamEditor.createRow(null, $(this).closest('tr'));
|
||||
$newRow.addClass('highlight');
|
||||
setTimeout(function()
|
||||
{
|
||||
$newRow.removeClass('highlight');
|
||||
}, 1600);
|
||||
adjustButtons();
|
||||
}).on('click', '.btn-delete', function()
|
||||
{
|
||||
var $row = $(this).closest('tr');
|
||||
$row.addClass('highlight').fadeOut(700, function()
|
||||
{
|
||||
$row.remove();
|
||||
adjustButtons();
|
||||
});
|
||||
});
|
||||
|
||||
$('#modalTeam').on('change', 'select#team', function()
|
||||
{
|
||||
$(this).closest('tr').find('input[id^=teamEstimate]').closest('.input-group').toggleClass('required', $(this).val() != '')
|
||||
})
|
||||
|
||||
adjustButtons();
|
||||
|
||||
$('#showAllModule').change(function()
|
||||
{
|
||||
var executionID = $('#execution').val();
|
||||
|
||||
+4
-43
@@ -6,13 +6,13 @@ $(function()
|
||||
{
|
||||
$(this).closest('tr').find('input[id^=teamEstimate]').closest('.input-group').toggleClass('required', $(this).val() != '')
|
||||
|
||||
var $source = $(this).siblings('[name^=source]');
|
||||
if($source.val() == '') return;
|
||||
var $teamSource = $(this).siblings('[name^=teamSource]');
|
||||
if($teamSource.val() == '') return;
|
||||
|
||||
var $tr = $(this).closest('tr');
|
||||
var consumed = 0;
|
||||
var estimate = $tr.attr('data-left');;
|
||||
if($(this).val() == $source.val())
|
||||
if($(this).val() == $teamSource.val())
|
||||
{
|
||||
consumed = $tr.attr('data-consumed');
|
||||
estimate = $tr.attr('data-estimate');
|
||||
@@ -90,44 +90,6 @@ function setPreview(){}
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
/* Init task team manage dialog */
|
||||
var $taskTeamEditor = $('#taskTeamEditor').batchActionForm(
|
||||
{
|
||||
idStart: 0,
|
||||
idEnd: newRowCount - 1,
|
||||
chosen: true,
|
||||
datetimepicker: false,
|
||||
colorPicker: false,
|
||||
});
|
||||
var taskTeamEditor = $taskTeamEditor.data('zui.batchActionForm');
|
||||
|
||||
var adjustButtons = function()
|
||||
{
|
||||
var $deleteBtn = $taskTeamEditor.find('.btn-delete');
|
||||
if ($deleteBtn.length == 1) $deleteBtn.addClass('disabled').attr('disabled', 'disabled');
|
||||
};
|
||||
|
||||
$taskTeamEditor.on('click', '.btn-add', function()
|
||||
{
|
||||
var $newRow = taskTeamEditor.createRow(null, $(this).closest('tr'));
|
||||
$newRow.addClass('highlight');
|
||||
setTimeout(function()
|
||||
{
|
||||
$newRow.removeClass('highlight');
|
||||
}, 1600);
|
||||
adjustButtons();
|
||||
}).on('click', '.btn-delete', function()
|
||||
{
|
||||
var $row = $(this).closest('tr');
|
||||
$row.addClass('highlight').fadeOut(700, function()
|
||||
{
|
||||
$row.remove();
|
||||
adjustButtons();
|
||||
});
|
||||
});
|
||||
|
||||
adjustButtons();
|
||||
|
||||
$('#showAllModule').change(function()
|
||||
{
|
||||
var moduleID = $('#moduleIdBox #module').val();
|
||||
@@ -176,8 +138,7 @@ $('#confirmButton').click(function()
|
||||
return false;
|
||||
}
|
||||
|
||||
var requiredFieldList = ',' + requiredFields + ',';
|
||||
if(requiredFieldList.indexOf(',estimate,') >= 0 && (estimate == 0 || isNaN(estimate)))
|
||||
if(estimate == 0 || isNaN(estimate))
|
||||
{
|
||||
$(this).val('').trigger("chosen:updated");
|
||||
bootbox.alert(estimateNotEmpty);
|
||||
|
||||
@@ -28,47 +28,7 @@ $(document).ready(function()
|
||||
$('#left').removeAttr('disabled');
|
||||
$('[name=assignedTo]').removeAttr('disabled').trigger('chosen:updated');
|
||||
}
|
||||
|
||||
updateAssignedTo();
|
||||
});
|
||||
|
||||
/* Init task team manage dialog */
|
||||
var $taskTeamEditor = $('#taskTeamEditor').batchActionForm(
|
||||
{
|
||||
idStart: 0,
|
||||
idEnd: newRowCount - 1,
|
||||
chosen: true,
|
||||
datetimepicker: false,
|
||||
colorPicker: false,
|
||||
});
|
||||
var taskTeamEditor = $taskTeamEditor.data('zui.batchActionForm');
|
||||
|
||||
var adjustButtons = function()
|
||||
{
|
||||
var $deleteBtn = $taskTeamEditor.find('.btn-delete');
|
||||
if ($deleteBtn.length == 1) $deleteBtn.addClass('disabled').attr('disabled', 'disabled');
|
||||
};
|
||||
|
||||
$taskTeamEditor.on('click', '.btn-add', function()
|
||||
{
|
||||
var $newRow = taskTeamEditor.createRow(null, $(this).closest('tr'));
|
||||
$newRow.addClass('highlight');
|
||||
setTimeout(function()
|
||||
{
|
||||
$newRow.removeClass('highlight');
|
||||
}, 1600);
|
||||
adjustButtons();
|
||||
}).on('click', '.btn-delete', function()
|
||||
{
|
||||
var $row = $(this).closest('tr');
|
||||
$row.addClass('highlight').fadeOut(700, function()
|
||||
{
|
||||
$row.remove();
|
||||
adjustButtons();
|
||||
});
|
||||
});
|
||||
|
||||
adjustButtons();
|
||||
});
|
||||
|
||||
$('#confirmButton').click(function()
|
||||
|
||||
+7
-11
@@ -89,7 +89,7 @@ class taskModel extends model
|
||||
->cleanINT('execution,story,module')
|
||||
->stripTags($this->config->task->editor->create['id'], $this->config->allowedTags)
|
||||
->join('mailto', ',')
|
||||
->remove('after,files,labels,assignedTo,uid,storyEstimate,storyDesc,storyPri,team,teamEstimate,teamMember,multiple,teams,contactListMenu,selectTestStory,testStory,testPri,testEstStarted,testDeadline,testAssignedTo,testEstimate,sync,otherLane,region,lane')
|
||||
->remove('after,files,labels,assignedTo,uid,storyEstimate,storyDesc,storyPri,team,teamSource,teamEstimate,teamMember,multiple,teams,contactListMenu,selectTestStory,testStory,testPri,testEstStarted,testDeadline,testAssignedTo,testEstimate,sync,otherLane,region,lane')
|
||||
->add('version', 1)
|
||||
->get();
|
||||
|
||||
@@ -884,7 +884,7 @@ class taskModel extends model
|
||||
{
|
||||
if(empty($account)) continue;
|
||||
|
||||
$source = $this->post->source[$row];
|
||||
$teamSource = $this->post->teamSource[$row];
|
||||
$member = new stdClass();
|
||||
$member->task = $taskID;
|
||||
$member->order = $row;
|
||||
@@ -902,7 +902,7 @@ class taskModel extends model
|
||||
}
|
||||
elseif($taskStatus == 'doing')
|
||||
{
|
||||
if(!empty($source) and $source != $account and isset($doingUsers[$source])) $member->transfer = $source;
|
||||
if(!empty($teamSource) and $teamSource != $account and isset($doingUsers[$teamSource])) $member->transfer = $teamSource;
|
||||
if(isset($doingUsers[$account]) and ($mode == 'multi' or ($mode == 'linear' and $minStatus != 'wait'))) $member->status = 'doing';
|
||||
}
|
||||
|
||||
@@ -1087,7 +1087,7 @@ class taskModel extends model
|
||||
->stripTags($this->config->task->editor->edit['id'], $this->config->allowedTags)
|
||||
->cleanINT('execution,story,module')
|
||||
->join('mailto', ',')
|
||||
->remove('comment,files,labels,uid,multiple,team,teamEstimate,teamConsumed,teamLeft,source,contactListMenu')
|
||||
->remove('comment,files,labels,uid,multiple,team,teamEstimate,teamConsumed,teamLeft,teamSource,contactListMenu')
|
||||
->get();
|
||||
|
||||
if($task->consumed < $oldTask->consumed) return print(js::error($this->lang->task->error->consumedSmall));
|
||||
@@ -1608,7 +1608,7 @@ class taskModel extends model
|
||||
->setDefault('lastEditedDate', $now)
|
||||
->setDefault('assignedDate', $now)
|
||||
->stripTags($this->config->task->editor->assignto['id'], $this->config->allowedTags)
|
||||
->remove('comment,showModule,team,teamEstimate,teamConsumed,teamLeft,source')
|
||||
->remove('comment,showModule,team,teamEstimate,teamConsumed,teamLeft,teamSource')
|
||||
->get();
|
||||
|
||||
if(count(array_filter($this->post->team)) > 1)
|
||||
@@ -2179,7 +2179,7 @@ class taskModel extends model
|
||||
->setDefault('assignedDate', helper::now())
|
||||
->setDefault('activatedDate', helper::now())
|
||||
->stripTags($this->config->task->editor->activate['id'], $this->config->allowedTags)
|
||||
->remove('comment')
|
||||
->remove('comment,uid,multiple,team,teamEstimate,teamConsumed,teamLeft,teamSource')
|
||||
->get();
|
||||
|
||||
if(!is_numeric($task->left))
|
||||
@@ -2190,11 +2190,7 @@ class taskModel extends model
|
||||
|
||||
if(!empty($oldTask->team))
|
||||
{
|
||||
$this->dao->update(TABLE_TASKTEAM)->set('left')->eq($this->post->left)
|
||||
->where('task')->eq($taskID)
|
||||
->andWhere('account')->eq($this->post->assignedTo)
|
||||
->exec();
|
||||
|
||||
$this->manageTaskTeam($oldTask->mode, $oldTask->id, $task->status);
|
||||
$task = $this->computeHours4Multiple($oldTask, $task);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,14 @@
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/kindeditor.html.php';?>
|
||||
<?php include '../../common/view/sortable.html.php';?>
|
||||
<?php js::set('oldConsumed', $task->consumed);?>
|
||||
<?php js::set('currentUser', $app->user->account);?>
|
||||
<?php js::set('members', $members);?>
|
||||
<?php js::set('teamMemberError', $lang->task->error->teamMember);?>
|
||||
<?php js::set('totalLeftError', sprintf($this->lang->task->error->leftEmptyAB, $this->lang->task->statusList[$task->status]));?>
|
||||
<?php js::set('estimateNotEmpty', sprintf($lang->error->notempty, $lang->task->estimate))?>
|
||||
<?php js::set('leftNotEmpty', sprintf($lang->error->notempty, $lang->task->left))?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
@@ -23,20 +31,41 @@
|
||||
<?php endif;?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<?php $isMultiple = !empty($task->team);?>
|
||||
<?php if($isMultiple):?>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->task->mode;?></th>
|
||||
<td class='w-p35-f'><?php echo zget($lang->task->modeList, $task->mode) . html::hidden('mode', $task->mode);?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->task->assignedTo;?></th>
|
||||
<td class='w-p25-f'><?php echo html::select('assignedTo', $members, $task->finishedBy, "class='form-control chosen'");?></td>
|
||||
<td></td>
|
||||
<td class='w-p35-f'>
|
||||
<div class="input-group" id="dataPlanGroup">
|
||||
<?php echo html::select('assignedTo', $members, $task->finishedBy, "class='form-control chosen'" . ($isMultiple ? ' disabled' : ''));?>
|
||||
<?php if($isMultiple):?>
|
||||
<span class="input-group-btn team-group"><a class="btn br-0" href="#modalTeam" data-toggle="modal"><?php echo $lang->task->team;?></a></span>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<?php if($isMultiple):?>
|
||||
<div class="checkbox-primary c-multipleTask affair">
|
||||
<input type="checkbox" name="multiple" value="1" id="multiple" checked disabled /><label for="multiple" class="no-margin"><?php echo $lang->task->multiple;?></label>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($task->parent != '-1'):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->left;?></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('left', '', "class='form-control'");?>
|
||||
<?php echo html::input('left', '', "class='form-control'" . ($isMultiple ? ' readonly' : ''));?>
|
||||
<span class='input-group-addon'><?php echo $lang->task->hour;?></span>
|
||||
</div>
|
||||
</td>
|
||||
@@ -53,16 +82,40 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='3' class='text-center'>
|
||||
<?php
|
||||
<?php
|
||||
echo html::submitButton($lang->task->activate);
|
||||
echo html::linkButton($lang->goback, $this->session->taskList);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class='modal fade modal-team' id='modalTeam' data-scroll-inside='false'>
|
||||
<div class='modal-dialog'>
|
||||
<div class='modal-content with-padding'>
|
||||
<div class='modal-header'>
|
||||
<button type='button' class='close' data-dismiss='modal'>
|
||||
<i class="icon icon-close"></i>
|
||||
</button>
|
||||
<h4 class='modal-title'><?php echo $lang->task->team;?></h4>
|
||||
</div>
|
||||
<div class='modal-body'>
|
||||
<table class="table table-form" id='taskTeamEditor'>
|
||||
<tbody class='sortable'>
|
||||
<?php include __DIR__ . DS . 'taskteam.html.php';?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><td colspan='3' class='text-center form-actions'><?php echo html::a('javascript:void(0)', $lang->confirm, '', "id='confirmButton' class='btn btn-primary btn-wide'");?></td></tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<hr class='small' />
|
||||
<div class='main'><?php include '../../common/view/action.html.php';?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php js::set('newRowCount', (!empty($task->team) and count($task->team) < 6) ? 6 - count($task->team) : 1);?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -80,7 +80,7 @@ foreach(explode(',', $config->task->create->requiredFields) as $field)
|
||||
</td>
|
||||
<td>
|
||||
<div class="checkbox-primary c-multipleTask affair">
|
||||
<input type="checkbox" name="multiple" value="1" id="multipleBox"><label for="multipleBox" class="no-margin"><?php echo $lang->task->multiple;?></label>
|
||||
<input type="checkbox" name="multiple" value="1" id="multipleBox" /><label for="multipleBox" class="no-margin"><?php echo $lang->task->multiple;?></label>
|
||||
</div>
|
||||
<button id='selectAllUser' type="button" class="btn btn-link<?php if($task->type !== 'affair') echo ' hidden';?>"><?php echo $lang->task->selectAllUser;?></button>
|
||||
</td>
|
||||
@@ -286,20 +286,7 @@ foreach(explode(',', $config->task->create->requiredFields) as $field)
|
||||
<div class='modal-body'>
|
||||
<table class="table table-form" id='taskTeamEditor'>
|
||||
<tbody class='sortable'>
|
||||
<tr class='template'>
|
||||
<td><?php echo html::select("team[]", $members, '', "class='form-control chosen'");?></td>
|
||||
<td class="<?php echo zget($requiredFields, 'estimate', '', ' required')?>">
|
||||
<div class='input-group'>
|
||||
<?php echo html::input("teamEstimate[]", '', "class='form-control text-center' placeholder='{$lang->task->estimateAB}'") ?>
|
||||
<span class='input-group-addon'><?php echo $lang->task->hour;?></span>
|
||||
</div>
|
||||
</td>
|
||||
<td class='w-130px sort-handler'>
|
||||
<button type="button" class="btn btn-link btn-sm btn-icon btn-add"><i class="icon icon-plus"></i></button>
|
||||
<button type='button' class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<button type="button" class="btn btn-link btn-sm btn-icon btn-delete"><i class="icon icon-close"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php include __DIR__ . DS . 'taskteam.html.php';?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@@ -340,6 +327,7 @@ foreach(explode(',', $config->task->create->requiredFields) as $field)
|
||||
<?php js::set('testStoryIdList', $testStoryIdList);?>
|
||||
<?php js::set('executionID', $execution->id);?>
|
||||
<?php js::set('executionType', $execution->type);?>
|
||||
<?php js::set('newRowCount', 5);?>
|
||||
<script>
|
||||
$(function(){parent.$('body.hide-modal-close').removeClass('hide-modal-close');})
|
||||
</script>
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
<?php js::set('estimateNotEmpty', sprintf($lang->error->notempty, $lang->task->estimate))?>
|
||||
<?php js::set('leftNotEmpty', sprintf($lang->error->notempty, $lang->task->left))?>
|
||||
<?php js::set('requiredFields', $config->task->edit->requiredFields);?>
|
||||
|
||||
<?php $newRowCount = count($task->team) < 6 ? 6 - count($task->team) : 1;?>
|
||||
<?php if($task->status != 'wait' and $task->status != 'doing') $newRowCount = 0;?>
|
||||
<?php js::set('newRowCount', $newRowCount);?>
|
||||
<?php
|
||||
$requiredFields = array();
|
||||
foreach(explode(',', $config->task->edit->requiredFields) as $field)
|
||||
@@ -279,64 +275,7 @@ foreach(explode(',', $config->task->edit->requiredFields) as $field)
|
||||
<div class="modal-content with-padding" id='taskTeamEditor'>
|
||||
<table class='table table-form'>
|
||||
<tbody class="sortable">
|
||||
<?php foreach($task->team as $member):?>
|
||||
<?php
|
||||
$memberDisabled = false;
|
||||
$sortDisabled = false;
|
||||
$memberStatus = $member->status;
|
||||
if($memberStatus == 'done') $memberDisabled = true;
|
||||
if($memberStatus != 'wait' and $task->mode == 'linear') $sortDisabled = true;
|
||||
if($task->mode == 'linear' and strpos('|closed|cancel|pause|', $task->status) !== false)
|
||||
{
|
||||
$memberStatus = $task->status;
|
||||
$memberDisabled = true;
|
||||
$sortDisabled = true;
|
||||
}
|
||||
?>
|
||||
<tr class='member-<?php echo $memberStatus;?>' data-estimate='<?php echo (float)$member->estimate?>' data-consumed='<?php echo (float)$member->consumed?>' data-left='<?php echo (float)$member->left?>'>
|
||||
<td class='w-250px'>
|
||||
<?php echo html::select("team[]", $members, $member->account, "class='form-control chosen'" . ($memberDisabled ? ' disabled' : ''))?>
|
||||
<?php echo html::hidden("source[]", $member->account);?>
|
||||
<?php if($memberDisabled) echo html::hidden("team[]", $member->account);?>
|
||||
</td>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<span class="input-group-addon <?php echo zget($requiredFields, 'estimate', '', ' required');?>"><?php echo $lang->task->estimate?></span>
|
||||
<?php echo html::input("teamEstimate[]", (float)$member->estimate, "class='form-control text-center' placeholder='{$lang->task->hour}'" . ($memberDisabled ? ' readonly' : ''))?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->consumed?></span>
|
||||
<?php echo html::input("teamConsumed[]", (float)$member->consumed, "class='form-control text-center' readonly placeholder='{$lang->task->hour}'")?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->left?></span>
|
||||
<?php echo html::input("teamLeft[]", (float)$member->left, "class='form-control text-center' placeholder='{$lang->task->hour}'" . ($memberDisabled ? ' readonly' : ''))?>
|
||||
</div>
|
||||
</td>
|
||||
<td class='w-130px sort-handler'>
|
||||
<button type="button" <?php echo $memberDisabled ? 'disabled' : '';?> class="btn btn-link btn-sm btn-icon btn-add"><i class="icon icon-plus"></i></button>
|
||||
<button type="button" <?php echo $sortDisabled ? 'disabled' : '';?> class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<button type="button" <?php echo $memberDisabled ? 'disabled' : '';?> class="btn btn-link btn-sm btn-icon btn-delete"><i class="icon icon-close"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr class='template member-wait'>
|
||||
<td class='w-250px'>
|
||||
<?php echo html::select("team[]", $members, '', "class='form-control chosen'")?>
|
||||
<?php echo html::hidden("source[]", '');?>
|
||||
</td>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<span class="input-group-addon <?php echo zget($requiredFields, 'estimate', '', ' required');?>"><?php echo $lang->task->estimate?></span>
|
||||
<?php echo html::input("teamEstimate[]", '', "class='form-control text-center' placeholder='{$lang->task->hour}'")?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->consumed?></span>
|
||||
<?php echo html::input("teamConsumed[]", 0, "class='form-control text-center' readonly placeholder='{$lang->task->hour}'")?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->left?></span>
|
||||
<?php echo html::input("teamLeft[]", '', "class='form-control text-center' placeholder='{$lang->task->hour}'")?>
|
||||
</div>
|
||||
</td>
|
||||
<td class='w-130px sort-handler'>
|
||||
<button type="button" class="btn btn-link btn-sm btn-icon btn-add"><i class="icon icon-plus"></i></button>
|
||||
<button type='button' class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<button type="button" class="btn btn-link btn-sm btn-icon btn-delete"><i class="icon icon-close"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php include dirname(__FILE__) . DS . 'taskteam.html.php';?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><td colspan='3' class='text-center form-actions'><?php echo html::a('javascript:void(0)', $lang->confirm, '', "id='confirmButton' class='btn btn-primary btn-wide'");?></td></tr>
|
||||
@@ -348,5 +287,4 @@ foreach(explode(',', $config->task->edit->requiredFields) as $field)
|
||||
</form>
|
||||
</div>
|
||||
<?php js::set('executionID', $execution->id);?>
|
||||
<?php if($task->mode == 'linear') js::set('sortSelector', 'tr.member-wait');?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<?php js::set('oldConsumed', $task->consumed);?>
|
||||
<?php js::set('team', $task->team);?>
|
||||
<?php js::set('members', $members);?>
|
||||
<?php js::set('newRowCount', count($task->team) < 6 ? 6 - count($task->team) : 1);?>
|
||||
<?php js::set('teamMemberError', $lang->task->error->teamMember);?>
|
||||
<?php js::set('totalLeftError', sprintf($this->lang->task->error->leftEmptyAB, $this->lang->task->statusList[$task->status]));?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
@@ -55,60 +54,12 @@
|
||||
<?php echo html::input('left', $task->left, "class='form-control' {$disabled}");?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php foreach($task->team as $member):?>
|
||||
<?php
|
||||
$memberDisabled = false;
|
||||
$linearDisabled = false;
|
||||
if($member->status == 'done') $memberDisabled = true;
|
||||
if($member->status != 'wait' and $task->mode == 'linear') $linearDisabled = true;
|
||||
?>
|
||||
<tr class='member-<?php echo $member->status;?>' data-estimate='<?php echo (float)$member->estimate?>' data-consumed='<?php echo (float)$member->consumed?>' data-left='<?php echo (float)$member->left?>'>
|
||||
<td class='w-250px'>
|
||||
<?php echo html::select("team[]", $members, $member->account, "class='form-control chosen'" . ($memberDisabled ? ' disabled' : ''))?>
|
||||
<?php echo html::hidden("source[]", $member->account);?>
|
||||
<?php if($memberDisabled) echo html::hidden("team[]", $member->account);?>
|
||||
</td>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->task->estimate?></span>
|
||||
<?php echo html::input("teamEstimate[]", (float)$member->estimate, "class='form-control text-center' placeholder='{$lang->task->hour}'" . ($memberDisabled ? ' readonly' : ''));?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->consumed?></span>
|
||||
<?php echo html::input("teamConsumed[]", (float)$member->consumed, "class='form-control text-center' readonly placeholder='{$lang->task->hour}'")?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->left?></span>
|
||||
<?php echo html::input("teamLeft[]", (float)$member->left, "class='form-control text-center' placeholder='{$lang->task->hour}'" . ($memberDisabled ? ' readonly' : ''))?>
|
||||
</div>
|
||||
</td>
|
||||
<td class='w-130px sort-handler'>
|
||||
<button type="button" <?php echo $linearDisabled ? 'disabled' : '';?> class="btn btn-link btn-sm btn-icon btn-add"><i class="icon icon-plus"></i></button>
|
||||
<button type='button' <?php echo $linearDisabled ? 'disabled' : '';?> class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<button type="button" <?php echo $linearDisabled ? 'disabled' : '';?> class="btn btn-link btn-sm btn-icon btn-delete"><i class="icon icon-close"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<tr class='template'>
|
||||
<td class='w-250px'>
|
||||
<?php echo html::select("team[]", $members, '', "class='form-control chosen'")?>
|
||||
<?php echo html::hidden("source[]", '');?>
|
||||
</td>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->task->estimate?></span>
|
||||
<?php echo html::input("teamEstimate[]", '', "class='form-control text-center' placeholder='{$lang->task->hour}'")?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->consumed?></span>
|
||||
<?php echo html::input("teamConsumed[]", '', "class='form-control text-center' readonly placeholder='{$lang->task->hour}'")?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->left?></span>
|
||||
<?php echo html::input("teamLeft[]", '', "class='form-control text-center' placeholder='{$lang->task->hour}'")?>
|
||||
</div>
|
||||
</td>
|
||||
<td class='w-130px sort-handler'>
|
||||
<button type="button" class="btn btn-link btn-sm btn-icon btn-add"><i class="icon icon-plus"></i></button>
|
||||
<button type='button' class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<button type="button" class="btn btn-link btn-sm btn-icon btn-delete"><i class="icon icon-close"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php include dirname(__FILE__) . DS . 'taskteam.html.php';?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><td colspan='3' class='text-center form-actions'><?php echo html::submitButton();?></td></tr>
|
||||
<tr>
|
||||
<td colspan='3' class='text-center form-actions'><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
<?php if(!empty($task->team)):?>
|
||||
<?php foreach($task->team as $member):?>
|
||||
<?php
|
||||
$memberDisabled = false;
|
||||
$sortDisabled = false;
|
||||
$memberStatus = $member->status;
|
||||
if($memberStatus == 'done') $memberDisabled = true;
|
||||
if($memberStatus != 'wait' and $task->mode == 'linear') $sortDisabled = true;
|
||||
if($task->mode == 'linear' and strpos('|closed|cancel|pause|', $task->status) !== false and $app->rawMethod != 'activate')
|
||||
{
|
||||
$memberStatus = $task->status;
|
||||
$memberDisabled = true;
|
||||
$sortDisabled = true;
|
||||
}
|
||||
?>
|
||||
<tr class='member-<?php echo $memberStatus;?>' data-estimate='<?php echo (float)$member->estimate?>' data-consumed='<?php echo (float)$member->consumed?>' data-left='<?php echo (float)$member->left?>'>
|
||||
<td class='w-250px'>
|
||||
<?php echo html::select("team[]", $members, $member->account, "class='form-control chosen'" . ($memberDisabled ? ' disabled' : ''))?>
|
||||
<?php echo html::hidden("teamSource[]", $member->account);?>
|
||||
<?php if($memberDisabled) echo html::hidden("team[]", $member->account);?>
|
||||
</td>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<span class="input-group-addon <?php echo zget($requiredFields, 'estimate', '', ' required');?>"><?php echo $lang->task->estimate?></span>
|
||||
<?php echo html::input("teamEstimate[]", (float)$member->estimate, "class='form-control text-center' placeholder='{$lang->task->hour}'" . ($memberDisabled ? ' readonly' : ''))?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->consumed?></span>
|
||||
<?php echo html::input("teamConsumed[]", (float)$member->consumed, "class='form-control text-center' readonly placeholder='{$lang->task->hour}'")?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->left?></span>
|
||||
<?php echo html::input("teamLeft[]", (float)$member->left, "class='form-control text-center' placeholder='{$lang->task->hour}'" . ($memberDisabled ? ' readonly' : ''))?>
|
||||
</div>
|
||||
</td>
|
||||
<td class='w-130px sort-handler'>
|
||||
<button type="button" <?php echo $memberDisabled ? 'disabled' : '';?> class="btn btn-link btn-sm btn-icon btn-add"><i class="icon icon-plus"></i></button>
|
||||
<button type="button" <?php echo $sortDisabled ? 'disabled' : '';?> class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<button type="button" <?php echo $memberDisabled ? 'disabled' : '';?> class="btn btn-link btn-sm btn-icon btn-delete"><i class="icon icon-close"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<tr class='template teamTemplate member-wait'>
|
||||
<td class='w-250px'>
|
||||
<?php echo html::select("team[]", $members, '', "class='form-control chosen'")?>
|
||||
<?php echo html::hidden("teamSource[]", '');?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if(empty($task->team)):?>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input("teamEstimate[]", '', "class='form-control text-center' placeholder='{$lang->task->estimateAB}'") ?>
|
||||
<span class='input-group-addon'><?php echo $lang->task->hour;?></span>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<div class='input-group'>
|
||||
<span class="input-group-addon <?php echo zget($requiredFields, 'estimate', '', ' required');?>"><?php echo $lang->task->estimate?></span>
|
||||
<?php echo html::input("teamEstimate[]", '', "class='form-control text-center' placeholder='{$lang->task->hour}'")?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->consumed?></span>
|
||||
<?php echo html::input("teamConsumed[]", 0, "class='form-control text-center' readonly placeholder='{$lang->task->hour}'")?>
|
||||
<span class='input-group-addon fix-border'><?php echo $lang->task->left?></span>
|
||||
<?php echo html::input("teamLeft[]", '', "class='form-control text-center' placeholder='{$lang->task->hour}'")?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
<td class='w-130px sort-handler'>
|
||||
<button type="button" class="btn btn-link btn-sm btn-icon btn-add"><i class="icon icon-plus"></i></button>
|
||||
<button type='button' class='btn btn-link btn-sm btn-icon btn-move'><i class='icon-move'></i></button>
|
||||
<button type="button" class="btn btn-link btn-sm btn-icon btn-delete"><i class="icon icon-close"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $newRowCount = (!empty($task->team) and count($task->team) < 6) ? 6 - count($task->team) : 1;?>
|
||||
<?php if(isset($task->status) and $task->status != 'wait' and $task->status != 'doing') $newRowCount = 0;?>
|
||||
<?php js::set('newRowCount', $newRowCount);?>
|
||||
<?php if(isset($task->mode) and $task->mode == 'linear') js::set('sortSelector', 'tr.member-wait');?>
|
||||
<script>
|
||||
$(document).ready(function()
|
||||
{
|
||||
/* Init task team manage dialog */
|
||||
var $taskTeamEditor = $('tr.teamTemplate').closest('table').batchActionForm(
|
||||
{
|
||||
idStart: 0,
|
||||
idEnd: newRowCount - 1,
|
||||
chosen: true,
|
||||
datetimepicker: false,
|
||||
colorPicker: false,
|
||||
});
|
||||
var taskTeamEditor = $taskTeamEditor.data('zui.batchActionForm');
|
||||
|
||||
var adjustButtons = function()
|
||||
{
|
||||
var $deleteBtn = $taskTeamEditor.find('.btn-delete');
|
||||
if ($deleteBtn.length == 1) $deleteBtn.addClass('disabled').attr('disabled', 'disabled');
|
||||
};
|
||||
|
||||
var disableMembers = function()
|
||||
{
|
||||
var mode = $('#mode').length > 0 ? $('#mode').val() : '<?php echo (isset($task->mode) ? $task->mode : '')?>';
|
||||
if(mode == 'multi')
|
||||
{
|
||||
var members = [];
|
||||
var $teams = $taskTeamEditor.find('select#team');
|
||||
for(i = 0; i < $teams.length; i++)
|
||||
{
|
||||
var value = $teams.eq(i).val();
|
||||
if(value != '') members.push(value);
|
||||
}
|
||||
|
||||
$teams.each(function()
|
||||
{
|
||||
var $this = $(this);
|
||||
var value = $this.val();
|
||||
$this.find('option:disabled').removeAttr('disabled');
|
||||
$.each(members, function(i, account)
|
||||
{
|
||||
if(account == value) return;
|
||||
$this.find('option[value=' + account + ']').attr('disabled', 'disabled');
|
||||
})
|
||||
$this.trigger("chosen:updated");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$taskTeamEditor.on('click', '.btn-add', function()
|
||||
{
|
||||
var $newRow = taskTeamEditor.createRow(null, $(this).closest('tr'));
|
||||
$newRow.addClass('highlight');
|
||||
setTimeout(function()
|
||||
{
|
||||
$newRow.removeClass('highlight');
|
||||
}, 1600);
|
||||
disableMembers();
|
||||
adjustButtons();
|
||||
}).on('click', '.btn-delete', function()
|
||||
{
|
||||
var $row = $(this).closest('tr');
|
||||
$row.addClass('highlight').fadeOut(700, function()
|
||||
{
|
||||
$row.remove();
|
||||
disableMembers();
|
||||
adjustButtons();
|
||||
});
|
||||
});
|
||||
|
||||
adjustButtons();
|
||||
disableMembers();
|
||||
|
||||
$taskTeamEditor.on('change', 'select#team', function()
|
||||
{
|
||||
$(this).closest('tr').find('input[id^=teamEstimate]').closest('.input-group').toggleClass('required', $(this).val() != '')
|
||||
|
||||
disableMembers();
|
||||
|
||||
var $teamSource = $(this).siblings('[name^=teamSource]');
|
||||
if($teamSource.val() == '') return;
|
||||
|
||||
var $tr = $(this).closest('tr');
|
||||
var consumed = 0;
|
||||
var estimate = $tr.attr('data-left');;
|
||||
if($(this).val() == $teamSource.val())
|
||||
{
|
||||
consumed = $tr.attr('data-consumed');
|
||||
estimate = $tr.attr('data-estimate');
|
||||
}
|
||||
$tr.find('[name^=teamConsumed]').val(consumed);
|
||||
$tr.find('[name^=teamEstimate]').val(estimate);
|
||||
});
|
||||
$taskTeamEditor.find('select#team:enabled').each(function()
|
||||
{
|
||||
$(this).closest('tr').find('input[id^=teamEstimate]').closest('.input-group').toggleClass('required', $(this).val() != '')
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -1386,7 +1386,7 @@ class taskTest
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getTeamByAccount($users, $account, $filter = 'done')
|
||||
public function getTeamByAccount($users, $account, array('filter' => 'done'))
|
||||
{
|
||||
$object = $this->objectModel->getTeamByAccount($users, $account, $filter);
|
||||
if(empty($object)) return '_';
|
||||
|
||||
@@ -44,6 +44,6 @@ r($task->getTeamByAccount($users, 'admin')) && p() && e('admin_doing'); //获取
|
||||
|
||||
$users[0]->status = 'done';
|
||||
r($task->getTeamByAccount($users, 'admin')) && p() && e('admin_wait'); //过滤已完成的成员获取的指定账号的团队信息
|
||||
r($task->getTeamByAccount($users, 'admin', '')) && p() && e('admin_done'); //不过滤已完成的成员获取的指定账号的团队信息
|
||||
r($task->getTeamByAccount($users, 'admin', array('filter' => ''))) && p() && e('admin_done'); //不过滤已完成的成员获取的指定账号的团队信息
|
||||
|
||||
r($task->getTeamByAccount($users, 'dev')) && p() && e('_'); //获取的不存在账号
|
||||
|
||||
Reference in New Issue
Block a user