* Adjust task list page of project.

This commit is contained in:
liugang
2018-04-16 17:47:24 +08:00
parent 55fe6144b6
commit 8c731dc75a
3 changed files with 215 additions and 87 deletions
-1
View File
@@ -2,7 +2,6 @@
.bug, .task {color:gray; font-size:9px}
.cont-lt1 .side{width:220px}
#sidebar{position:absolute;left:15px;top:185px;width:20px;height:20px;cursor:pointer;background:url(theme/default/images/main/zt-icons.png) -81px -161px;}
#hideButton{cursor:pointer;}
#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;}
+213 -84
View File
@@ -15,86 +15,218 @@ include '../../common/view/header.html.php';
include '../../common/view/chart.html.php';
include '../../common/view/datepicker.html.php';
include '../../common/view/datatable.fix.html.php';
include './taskheader.html.php';
js::set('moduleID', $moduleID);
js::set('productID', $productID);
js::set('projectID', $projectID);
js::set('browseType', $browseType);
?>
<div class='side' id='taskTree'>
<a class='side-handle' data-id='projectTree'><i class='icon-caret-left'></i></a>
<div class='side-body'>
<div class='panel panel-sm'>
<div class='panel-heading nobr'>
<?php echo html::icon($lang->icons['project']);?> <strong><?php echo $project->name;?></strong>
<div id="mainMenu" class="clearfix">
<div id="sidebarHeader">
<?php echo html::commonButton('<i class="icon icon-caret-left"></i>', '', 'btn btn-icon btn-sm btn-info sidebar-toggle');?>
<div class="title">
<?php
if(!empty($productID))
{
$product = $this->product->getById($productID);
$removeLink = $browseType == 'byproduct' ? inlink('task', "projectID=$projectID&browseType=$status&param=0&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("productBrowseParam")';
echo $product->name;
echo html::a($removeLink, "<span class='close'>&times;</span>", '', "class='text-muted'");
echo html::a($removeLink, "<i class='icon icon-remove'></i>", '', "class='text-muted'");
}
elseif(!empty($moduleID))
{
$module = $this->tree->getById($moduleID);
$removeLink = $browseType == 'bymodule' ? inlink('task', "projectID=$projectID&browseType=$status&param=0&orderBy=$orderBy&recTotal=0&recPerPage={$pager->recPerPage}") : 'javascript:removeCookieByKey("moduleBrowseParam")';
echo $module->name;
echo html::a($removeLink, "<span class='close'>&times;</span>", '', "class='text-muted'");
echo html::a($removeLink, "<i class='icon icon-remove'></i>", '', "class='text-muted'");
}
else
{
$this->app->loadLang('tree');
echo $this->lang->tree->all;
}
?>
</div>
</div>
<div class="btn-toolbar pull-left">
<?php
foreach(customModel::getFeatureMenu('project', 'task') as $menuItem)
{
if($project->type == 'ops' && $menuItem->name == 'needconfirm') continue;
if(isset($menuItem->hidden)) continue;
$menuType = $menuItem->name;
if(strpos($menuType, 'QUERY') === 0)
{
$queryID = (int)substr($menuType, 5);
echo html::a(inlink('task', "project=$projectID&type=bySearch&param=$queryID"), $menuItem->text, '', "id='{$menuType}Tab' class='btn btn-link'");
}
elseif($menuType != 'status')
{
echo html::a(inlink('task', "project=$projectID&type=$menuType"), $menuItem->text, '', "id='{$menuType}Tab' class='btn btn-link'");
}
elseif($menuType == 'status')
{
echo "<div class='btn-group'>";
$taskBrowseType = isset($status) ? $this->session->taskBrowseType : '';
$current = zget($lang->project->statusSelects, $taskBrowseType, '');
if(empty($current)) $current = $menuItem->text;
echo html::a('javascript:;', $current . " <span class='caret'></span>", '', "data-toggle='dropdown' class='btn btn-link'");
echo "<ul class='dropdown-menu'>";
foreach ($lang->project->statusSelects as $key => $value)
{
if($key == '') continue;
echo '<li' . ($key == $taskBrowseType ? " class='active'" : '') . '>';
echo html::a($this->createLink('project', 'task', "project=$projectID&type=$key"), $value);
}
echo '</ul></div>';
}
}
echo common::printLink('project', 'kanban', "projectID=$projectID", $lang->project->kanban, '', "id='kanbanTab' class='btn btn-link'");
if($project->type == 'sprint' or $project->type == 'waterfall')
{
common::printLink('project', 'burn', "project=$projectID", $lang->project->burn, '', "id='burnTab' class='btn btn-link'");
}
echo common::printLink('project', 'tree', "projectID=$projectID", $lang->project->tree, '', "id='treeTab' class='btn btn-link'");
echo "<div class='btn-group'>";
$groupBy = isset($groupBy) ? $groupBy : '';
$current = zget($lang->project->groups, isset($groupBy) ? $groupBy : '', '');
echo html::a('javascript:;', $current . " <span class='caret'></span>", '', "data-toggle='dropdown' class='btn btn-link'");
echo "<ul class='dropdown-menu'>";
foreach ($lang->project->groups as $key => $value)
{
if($key == '') continue;
if($project->type == 'ops' && $key == 'story') continue;
echo '<li' . ($key == $groupBy ? " class='active'" : '') . '>';
common::printLink('project', 'groupTask', "project=$projectID&groupBy=$key", $value);
}
echo '</ul></div>';
?>
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> <?php echo $lang->product->searchStory;?></a>
</div>
<div class="btn-toolbar pull-right">
<div class='btn-group'>
<?php
if(!isset($browseType)) $browseType = '';
if(!isset($orderBy)) $orderBy = '';
common::printIcon('task', 'report', "project=$projectID&browseType=$browseType", '', 'button', 'bar-chart');
?>
<div class="btn-group">
<button class="btn btn-link" data-toggle="dropdown"><i class="icon icon-export muted"></i> <span class="text"><?php echo $lang->export;?></span> <span class="caret"></span></button>
<ul class="dropdown-menu">
<?php
$misc = common::hasPriv('task', 'export') ? "class='export'" : "class=disabled";
$link = common::hasPriv('task', 'export') ? $this->createLink('task', 'export', "project=$projectID&orderBy=$orderBy&type=$browseType") : '#';
echo "<li>" . html::a($link, $lang->story->export, '', $misc) . "</li>";
?>
</ul>
</div>
<div class='panel-body'>
<?php echo $moduleTree;?>
<div class='text-right'>
<?php common::printLink('project', 'edit', "projectID=$projectID", $lang->edit);?>
<?php common::printLink('project', 'delete', "projectID=$projectID&confirm=no", $lang->delete, 'hiddenwin');?>
<?php common::printLink('tree', 'browsetask', "rootID=$projectID&productID=0", $lang->tree->manage);?>
</div>
<div class="btn-group">
<button class="btn btn-link" data-toggle="dropdown"><i class="icon icon-import muted"></i> <span class="text"><?php echo $lang->import;?></span> <span class="caret"></span></button>
<ul class="dropdown-menu">
<?php
$misc = common::hasPriv('project', 'importTask') ? "class='import'" : "class=disabled";
$link = common::hasPriv('project', 'importTask') ? $this->createLink('project', 'importTask', "project=$project->id") : '#';
echo "<li>" . html::a($link, $lang->project->importTask, '', $misc) . "</li>";
$misc = common::hasPriv('project', 'importBug') ? "class='import'" : "class=disabled";
$link = common::hasPriv('project', 'importBug') ? $this->createLink('project', 'importBug', "project=$project->id") : '#';
echo "<li>" . html::a($link, $lang->project->importBug, '', $misc) . "</li>";
?>
</ul>
</div>
</div>
<div class='btn-group'>
<div class='btn-group' id='createActionMenu'>
<?php
$link = $this->createLink('task', 'batchCreate', "project=$projectID" . (isset($moduleID) ? "&storyID=&moduleID=$moduleID" : ''));
if(common::hasPriv('task', 'batchCreate')) echo html::a($link, "<i class='icon icon-plus'></i> {$lang->task->batchCreate}", '', "class='btn btn btn-secondary'");
$link = $this->createLink('task', 'create', "project=$projectID" . (isset($moduleID) ? "&storyID=&moduleID=$moduleID" : ''));
if(common::hasPriv('task', 'create')) echo html::a($link, "<i class='icon icon-plus'></i> {$lang->task->create}", '', "class='btn btn-primary'");
?>
</div>
</div>
</div>
</div>
<div class='main'>
<script>setTreeBox();</script>
<form method='post' id='projectTaskForm'>
<?php
$datatableId = $this->moduleName . ucfirst($this->methodName);
$useDatatable = (isset($this->config->datatable->$datatableId->mode) and $this->config->datatable->$datatableId->mode == 'datatable');
$vars = "projectID=$project->id&status=$status&parma=$param&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage";
<div id="mainContent" class="main-row">
<div class="side-col" id="sidebar">
<div class="cell">
<?php echo $moduleTree;?>
<div class="text-center">
<?php common::printLink('project', 'edit', "projectID=$projectID", $lang->edit, '', "class='btn btn-info btn-wide'");?>
<?php common::printLink('project', 'delete', "projectID=$projectID&confirm=no", $lang->delete, 'hiddenwin', "class='btn btn-info btn-wide'");?>
<?php common::printLink('tree', 'browsetask', "rootID=$projectID&productID=0", $lang->tree->manage, '', "class='btn btn-info btn-wide'");?>
<hr class="space-sm" />
</div>
</div>
</div>
<div class="main-col">
<div class="cell" id="queryBox"></div>
<form class="main-table table-task" data-ride="table" method="post" id='projectTaskForm'>
<div class="table-header">
<div class="table-statistic"><?php echo $summary;?></div>
<nav class="btn-toolbar pull-right"></nav>
</div>
<?php
$datatableId = $this->moduleName . ucfirst($this->methodName);
$useDatatable = (isset($this->config->datatable->$datatableId->mode) and $this->config->datatable->$datatableId->mode == 'datatable');
$vars = "projectID=$project->id&status=$status&parma=$param&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage";
if($useDatatable) include '../../common/view/datatable.html.php';
$customFields = $this->datatable->getSetting('project');
if($project->type == 'ops')
{
foreach($customFields as $id => $customField)
{
if($customField->id == 'story') unset($customFields[$id]);
}
}
$widths = $this->datatable->setFixedFieldWidth($customFields);
$columns = 0;
?>
<table class='table table-condensed table-hover table-striped tablesorter table-fixed <?php echo ($useDatatable ? 'datatable' : 'table-selectable');?> table-selectable' id='taskList' data-checkable='true' data-fixed-left-width='<?php echo $widths['leftWidth']?>' data-fixed-right-width='<?php echo $widths['rightWidth']?>' data-custom-menu='true' data-checkbox-name='taskIDList[]'>
<thead>
<tr>
<?php
foreach($customFields as $field)
{
if($field->show)
{
$this->datatable->printHead($field, $orderBy, $vars);
$columns++;
}
}
?>
</tr>
</thead>
<tbody>
<?php foreach($tasks as $task):?>
<tr class='text-center' data-id='<?php echo $task->id;?>' data-status='<?php echo $task->status?>' data-estimate='<?php echo $task->estimate?>' data-consumed='<?php echo $task->consumed?>' data-left='<?php echo $task->left?>'>
<?php foreach($customFields as $field) $this->task->printCell($field, $task, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table');?>
</tr>
<?php if(!empty($task->children)):?>
<?php foreach($task->children as $key => $child):?>
<?php $class = $key == 0 ? ' table-child-top' : '';?>
<?php $class .= ($key + 1 == count($task->children)) ? ' table-child-bottom' : '';?>
<tr class='text-center table-children<?php echo $class;?> parent-<?php echo $task->id;?>' data-id='<?php echo $child->id?>' data-status='<?php echo $child->status?>' data-estimate='<?php echo $child->estimate?>' data-consumed='<?php echo $child->consumed?>' data-left='<?php echo $child->left?>'>
<?php foreach($customFields as $field) $this->task->printCell($field, $child, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table', true);?>
</tr>
<?php endforeach;?>
<?php endif;?>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<?php if(!isset($columns)) $columns = ($this->cookie->windowWidth > $this->config->wideSize ? 15 : 13) - ($project->type == 'sprint' ? 0 : 1);?>
<td colspan='<?php echo $columns;?>'>
<div class='table-actions clearfix'>
if($useDatatable) include '../../common/view/datatable.html.php';
$customFields = $this->datatable->getSetting('project');
if($project->type == 'ops')
{
foreach($customFields as $id => $customField)
{
if($customField->id == 'story') unset($customFields[$id]);
}
}
$widths = $this->datatable->setFixedFieldWidth($customFields);
$columns = 0;
?>
<table class='table has-sort-head' id='taskList'>
<thead>
<tr>
<?php
foreach($customFields as $field)
{
if($field->show)
{
$this->datatable->printHead($field, $orderBy, $vars);
$columns++;
}
}
?>
</tr>
</thead>
<tbody>
<?php foreach($tasks as $task):?>
<tr class='text-center' data-id='<?php echo $task->id;?>' data-status='<?php echo $task->status?>' data-estimate='<?php echo $task->estimate?>' data-consumed='<?php echo $task->consumed?>' data-left='<?php echo $task->left?>'>
<?php foreach($customFields as $field) $this->task->printCell($field, $task, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table');?>
</tr>
<?php if(!empty($task->children)):?>
<?php foreach($task->children as $key => $child):?>
<?php $class = $key == 0 ? ' table-child-top' : '';?>
<?php $class .= ($key + 1 == count($task->children)) ? ' table-child-bottom' : '';?>
<tr class='text-center table-children<?php echo $class;?> parent-<?php echo $task->id;?>' data-id='<?php echo $child->id?>' data-status='<?php echo $child->status?>' data-estimate='<?php echo $child->estimate?>' data-consumed='<?php echo $child->consumed?>' data-left='<?php echo $child->left?>'>
<?php foreach($customFields as $field) $this->task->printCell($field, $child, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table', true);?>
</tr>
<?php endforeach;?>
<?php endif;?>
<?php endforeach;?>
</tbody>
</table>
<?php if($tasks):?>
<div class="table-footer">
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<div class="table-actions btn-toolbar">
<div class='btn-group dropup'>
<?php
$canBatchEdit = common::hasPriv('task', 'batchEdit', !empty($task) ? $task : null);
$canBatchClose = (common::hasPriv('task', 'batchClose', !empty($task) ? $task : null) && strtolower($browseType) != 'closedBy');
@@ -103,15 +235,12 @@ js::set('browseType', $browseType);
$canBatchAssignTo = common::hasPriv('task', 'batchAssignTo', !empty($task) ? $task : null);
if(count($tasks))
{
echo html::selectButton();
$actionLink = $this->createLink('task', 'batchEdit', "projectID=$projectID");
$misc = $canBatchEdit ? "onclick=\"setFormAction('$actionLink', '', '#projectTaskForm')\"" : "disabled='disabled'";
$disabled = $canBatchEdit ? '' : "disabled='disabled'";
echo "<div class='btn-group dropup'>";
echo html::commonButton($lang->edit, $misc);
echo "<button id='moreAction' type='button' class='btn dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>";
echo "<ul class='dropdown-menu' id='moreActionMenu'>";
echo html::commonButton($lang->edit, "data-form-action='$actionLink' $disabled");
echo "<button type='button' class='btn dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>";
echo "<ul class='dropdown-menu'>";
$actionLink = $this->createLink('task', 'batchClose');
$misc = $canBatchClose ? "onclick=\"setFormAction('$actionLink', 'hiddenwin', '#moreAction')\"" : "class='disabled'";
@@ -161,17 +290,17 @@ js::set('browseType', $browseType);
if($withSearch) echo "<div 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></div>";
echo "</div></li>";
}
echo "</ul></div>";
echo "</ul>";
}
echo "<div class='text'>" . $summary . "</div>";
?>
</div>
<?php $pager->show();?>
</td>
</tr>
</tfoot>
</table>
</form>
</div>
<?php $pager->show('right', 'pagerjs');?>
</div>
</div>
<?php endif;?>
</form>
</div>
</div>
<?php js::set('checkedSummary', $lang->project->checkedSummary);?>
<?php js::set('replaceID', 'taskList')?>
+2 -2
View File
@@ -2204,14 +2204,14 @@ class taskModel extends model
common::printIcon('task', 'assignTo', "projectID=$task->project&taskID=$task->id", $task, 'list', '', '', 'iframe', true);
common::printIcon('task', 'start', "taskID=$task->id", $task, 'list', '', '', 'iframe', true);
common::printIcon('task', 'recordEstimate', "taskID=$task->id", $task, 'list', 'time', '', 'iframe', true);
if($browseType == 'needconfirm')
{
$this->lang->task->confirmStoryChange = $this->lang->confirm;
common::printIcon('task', 'confirmStoryChange', "taskid=$task->id", '', 'list', '', 'hiddenwin');
}
common::printIcon('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true);
common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true);
if($task->status == 'finished') common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true);
common::printIcon('task', 'recordEstimate', "taskID=$task->id", $task, 'list', 'time', '', 'iframe', true);
common::printIcon('task', 'edit', "taskID=$task->id", $task, 'list');
if(empty($task->team) or empty($task->children))
{