This commit is contained in:
Yagami
2022-12-08 13:16:06 +08:00
32 changed files with 188 additions and 116 deletions
+26 -1
View File
@@ -20,7 +20,32 @@ class tasksEntry extends entry
*/
public function get($executionID = 0)
{
if(!$executionID)
/* Get tasks by search, search arguments available: pri, assignedTo, status, id, name. Pager arguments will be utilized as well. */
if($this->param('search', 0) == 1) // TODO: document this api.
{
$this->loadModel('task');
$searchParams = array();
foreach(array('pri' => 'priList', 'assignedTo' => 'assignedToList', 'status' => 'statusList', 'id' => 'idList', 'name' => 'taskName') as $field => $condName)
{
if($this->param($field, false))
{
$searchParams[$condName] = $this->param($field);
continue;
}
if($this->param($condName, false)) $searchParams[$condName] = $this->param($condName);
}
$this->app->loadClass('pager', $static = true);
$pager = pager::init($this->param('total', 0), $this->param('limit', 20), $this->param('page', 1));
$tasks = $this->task->getListByConds((object)$searchParams, $this->param('order', 'id_desc'), $pager);
$data = new stdclass();
$data->status = 'success';
$data->data = new stdclass();
$data->data->tasks = array_values($tasks);
$data->data->pager = (object)$pager;
}
elseif(!$executionID)
{
/* Get my tasks defaultly. */
$control = $this->loadController('my', 'task');
+10 -5
View File
@@ -98,7 +98,7 @@ class baseEntry
* Get request params.
*
* @param string $key
* @param string $defaultValue
* @param mixed $defaultValue
* @access public
* @return mixed
*/
@@ -112,13 +112,18 @@ class baseEntry
* 设置请求参数
* Set request param.
*
* @param string $key
* @param mixed $value
* @param string|array $key if is array, set params by its key-value pairs.
* @param mixed $value
* @access public
* @return mixed
* @return void
*/
public function setParam($key, $value)
public function setParam($key, $value = null)
{
if(is_array($key))
{
foreach($key as $k => $v) $_GET[$k] = $v;
return;
}
$_GET[$key] = $value;
}
+5 -1
View File
@@ -130,7 +130,11 @@ class pager extends basePager
}
}
echo "<ul class='pager' $pageSizeOptions data-page-cookie='{$this->pageCookie}' data-ride='pager' data-rec-total='{$this->recTotal}' data-rec-per-page='{$this->recPerPage}' data-page='{$this->pageID}' data-link-creator='" . helper::createLink($this->moduleName, $this->methodName, $params) . "'></ul>";
global $app, $lang;
$appendApp = '';
$moduleName = $this->moduleName;
if(isset($lang->navGroup->{$moduleName}) and $lang->navGroup->{$moduleName} != $app->tab) $appendApp = "#app={$app->tab}";
echo "<ul class='pager' $pageSizeOptions data-page-cookie='{$this->pageCookie}' data-ride='pager' data-rec-total='{$this->recTotal}' data-rec-per-page='{$this->recPerPage}' data-page='{$this->pageID}' data-link-creator='" . helper::createLink($this->moduleName, $this->methodName, $params) . $appendApp . "'></ul>";
}
}
else
+1 -1
View File
@@ -428,7 +428,7 @@ class build extends control
return print(html::select($varName, $builds, $build, "class='form-control'"));
}
$builds = $this->build->getBuildPairs($productID, $branch, $type, 0, 'project', $build);
$builds = $this->build->getBuildPairs($productID, $branch, $type, 0, 'project', $build, false);
if(strpos($extra, 'multiple') !== false) $varName .= '[]';
if($isJsonView) return print(json_encode($builds));
return print(html::select($varName, $builds, $build, "class='form-control chosen' $extra"));
+1
View File
@@ -6,3 +6,4 @@
.body-modal #mainContent {min-height: 200px;}
td.article-content{overflow:auto !important;}
td.c-build{white-space: nowrap; overflow:hidden;}
+2
View File
@@ -256,6 +256,7 @@ class buildModel extends model
->fetchPairs();
}
$shadows = $this->dao->select('shadow')->from(TABLE_RELEASE)->where('product')->in($products)->fetchPairs('shadow', 'shadow');
$branchs = strpos($params, 'separate') === false ? "0,$branch" : $branch;
$allBuilds = $this->dao->select('t1.id, t1.name, t1.execution, t1.date, t1.deleted, t2.status as objectStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName, t5.type as productType')->from(TABLE_BUILD)->alias('t1')
->beginIF($objectType === 'execution')->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')->fi()
@@ -264,6 +265,7 @@ class buildModel extends model
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
->leftJoin(TABLE_PRODUCT)->alias('t5')->on('t1.product = t5.id')
->where('1=1')
->andWhere('t1.id')->notIN($shadows)
->beginIF(strpos($params, 'hasDeleted') === false)->andWhere('t1.deleted')->eq(0)->fi()
->beginIF(strpos($params, 'hasproject') !== false)->andWhere('t1.project')->ne(0)->fi()
->beginIF(strpos($params, 'singled') !== false)->andWhere('t1.execution')->ne(0)->fi()
+3 -3
View File
@@ -148,7 +148,7 @@ tbody tr td:first-child input {display: none;}
?>
</td>
<?php if($childBuilds):?>
<td class='text-left' title='<?php echo $buildName?>'><?php echo $buildName;?></td>
<td class='c-build text-left' title='<?php echo $buildName?>'><?php echo $buildName;?></td>
<?php endif;?>
<td><?php echo zget($users, $story->openedBy);?></td>
<td class='text-right' title="<?php echo $story->estimate . ' ' . $lang->hourCommon;?>"><?php echo $story->estimate . $config->hourUnit;?></td>
@@ -254,7 +254,7 @@ tbody tr td:first-child input {display: none;}
</span>
</td>
<?php if($childBuilds):?>
<td class='text-left' title='<?php echo $buildName?>'><?php echo $buildName;?></td>
<td class='c-build text-left' title='<?php echo $buildName?>'><?php echo $buildName;?></td>
<?php endif;?>
<td><?php echo zget($users, $bug->openedBy);?></td>
<td><?php echo helper::isZeroDate($bug->openedDate) ? '' : substr($bug->openedDate, 5, 11);?></td>
@@ -343,7 +343,7 @@ tbody tr td:first-child input {display: none;}
$openedBuilds = '';
foreach(explode(',', $bug->openedBuild) as $buildID) $openedBuilds .= ($buildID == 'trunk' ? 'Trunk' : zget($buildPairs, $buildID, '')) . ' ';
?>
<td class='text-left' title='<?php echo $openedBuilds;?>'><?php echo $openedBuilds;?></td>
<td class='c-build text-left' title='<?php echo $openedBuilds;?>'><?php echo $openedBuilds;?></td>
<td><?php echo zget($users, $bug->openedBy);?></td>
<td><?php echo helper::isZeroDate($bug->openedDate) ? '' : substr($bug->openedDate, 5, 11);?></td>
<td><?php echo zget($users, $bug->resolvedBy);?></td>
+4 -1
View File
@@ -1312,7 +1312,10 @@ class execution extends control
{
$showBranch = true;
$branchPairs = $branchGroups[$build->product];
foreach(explode(',', trim($build->branch, ',')) as $branchID) $build->branchName .= "{$branchPairs[$branchID]},";
foreach(explode(',', trim($build->branch, ',')) as $branchID)
{
if(isset($branchPairs[$branchID])) $build->branchName .= "{$branchPairs[$branchID]},";
}
$build->branchName = trim($build->branchName, ',');
}
}
+1 -1
View File
@@ -605,7 +605,7 @@ class productplan extends control
*/
public function ajaxGetProductplans($productID, $branch = 0, $number = '', $expired = '')
{
$plans = $this->productplan->getPairs($productID, $branch, $expired, true);
$plans = $this->productplan->getPairs($productID, empty($branch) ? '' : $branch, $expired, true);
$planName = $number === '' ? 'plan' : "plan[$number]";
$plans = empty($plans) ? array('' => '') : $plans;
echo html::select($planName, $plans, '', "class='form-control'");
+3 -2
View File
@@ -17,11 +17,12 @@ td.c-branch {overflow: hidden; text-align: left !important; white-space: nowrap;
@-moz-document url-prefix() {.main-table tbody > tr.table-children > td:first-child::before {width: 4px;};}
.c-title {width: 160px;}
.c-branch {width: 100px;}
.c-branch {width: 130px;}
.c-story, .c-status {width: 80px;}
.c-execution {width: 60px !important;}
.c-bug, .c-hour {width: 60px;}
.c-desc {width: 160px;}
.c-desc {width: 140px;}
.c-date {width: 90px;}
.plan-name {position: relative; display: flex; align-items: center;}
.plan-name > span {flex: none;}
-1
View File
@@ -100,7 +100,6 @@ $lang->productplan->childrenAB = "C";
$lang->productplan->order = "Rank";
$lang->productplan->deleted = "Deleted";
$lang->productplan->mailto = "Mailto";
$lang->productplan->status = 'Status';
$lang->productplan->planStatus = "Status";
$lang->productplan->statusList['wait'] = 'Wait';
-1
View File
@@ -100,7 +100,6 @@ $lang->productplan->childrenAB = "C";
$lang->productplan->order = "Order";
$lang->productplan->deleted = "Deleted";
$lang->productplan->mailto = "Mailto";
$lang->productplan->status = "Plan Status";
$lang->productplan->planStatus = "Status";
$lang->productplan->statusList['wait'] = 'Wait';
-1
View File
@@ -100,7 +100,6 @@ $lang->productplan->childrenAB = "C";
$lang->productplan->order = "Order";
$lang->productplan->deleted = "Deleted";
$lang->productplan->mailto = "Mailto";
$lang->productplan->status = 'Status';
$lang->productplan->planStatus = "Status";
$lang->productplan->statusList['wait'] = 'Wait';
+1 -2
View File
@@ -86,7 +86,7 @@ $lang->productplan->title = '名称';
$lang->productplan->desc = '描述';
$lang->productplan->begin = '开始日期';
$lang->productplan->end = '结束日期';
$lang->productplan->status = '计划状态';
$lang->productplan->status = '状态';
$lang->productplan->last = "上次计划";
$lang->productplan->future = '待定';
$lang->productplan->stories = "{$lang->SRCommon}数";
@@ -100,7 +100,6 @@ $lang->productplan->childrenAB = "子";
$lang->productplan->order = "排序";
$lang->productplan->deleted = "已删除";
$lang->productplan->mailto = "抄送给";
$lang->productplan->status = "计划状态";
$lang->productplan->planStatus = "状态";
$lang->productplan->statusList['wait'] = '未开始';
-3
View File
@@ -31,9 +31,6 @@
<div class='page-title'>
<span class='label label-id'><?php echo $plan->id;?></span>
<span title='<?php echo $plan->title;?>' class='text'><?php echo $plan->title;?></span>
<?php foreach(explode(',', $branch) as $branchID):?>
<?php if($product->type !== 'normal') echo "<span title='{$lang->product->branchName[$product->type]}' class='label label-branch label-badge'>" . $branchOption[$branchID] . '</span>';?>
<?php endforeach;?>
<span class='label label-info label-badge'>
<?php echo ($plan->begin == $config->productplan->future || $plan->end == $config->productplan->future) ? $lang->productplan->future : $plan->begin . '~' . $plan->end;?>
</span>
+4 -1
View File
@@ -1466,7 +1466,10 @@ class project extends control
{
$showBranch = true;
$branchPairs = $branchGroups[$build->product];
foreach(explode(',', trim($build->branch, ',')) as $branchID) $build->branchName .= "{$branchPairs[$branchID]},";
foreach(explode(',', trim($build->branch, ',')) as $branchID)
{
if(isset($branchPairs[$branchID])) $build->branchName .= "{$branchPairs[$branchID]},";
}
$build->branchName = trim($build->branchName, ',');
}
}
+1
View File
@@ -9,3 +9,4 @@
#tabsNav .nav-tabs > li.active + li.pull-right {margin-right: 0;}
ol, ul {padding-left: 20px;}
.c-id {overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
td.c-build{white-space: nowrap; overflow:hidden;}
+3 -3
View File
@@ -99,7 +99,7 @@
echo html::a($storyLink,$story->title, '', "class='preview'");
?>
</td>
<td class='text-left' title='<?php echo $story->buildName?>'><?php echo $story->buildName?></td>
<td class='c-build text-left' title='<?php echo $story->buildName?>'><?php echo $story->buildName?></td>
<td><?php echo zget($users, $story->openedBy);?></td>
<td class='text-right' style='padding-right:25px' title="<?php echo $story->estimate . ' ' . $lang->hourCommon;?>"><?php echo $story->estimate . $config->hourUnit;?></td>
<td>
@@ -195,7 +195,7 @@
<span class='status-bug status-<?php echo $bug->status?>'><?php echo $this->processStatus('bug', $bug);?></span>
</td>
<?php $resolvedBuildName = zget($builds, $bug->resolvedBuild, '');?>
<td class='text-left' title='<?php echo $resolvedBuildName?>'><?php echo $resolvedBuildName;?></td>
<td class='c-build text-left' title='<?php echo $resolvedBuildName?>'><?php echo $resolvedBuildName;?></td>
<td><?php echo zget($users, $bug->openedBy);?></td>
<td><?php echo helper::isZeroDate($bug->openedDate) ? '' : substr($bug->openedDate, 5, 11);?></td>
<td><?php echo zget($users, $bug->resolvedBy);?></td>
@@ -305,7 +305,7 @@
$openedBuildName = '';
foreach(explode(',', $bug->openedBuild) as $buildID) $openedBuildName .= zget($builds, $buildID, '') . ' ';
?>
<td class='text-left' title='<?php echo $openedBuildName?>'><?php echo $openedBuildName;?></td>
<td class='c-build text-left' title='<?php echo $openedBuildName?>'><?php echo $openedBuildName;?></td>
<td><?php echo zget($users, $bug->openedBy);?></td>
<td><?php echo $bug->openedDate?></td>
<td class='c-actions'>
+1
View File
@@ -10,3 +10,4 @@
ol, ul {padding-left: 20px;}
.body-modal #mainContent {min-height: 240px;}
.c-id {width: 110px;}
td.c-build{white-space: nowrap; overflow:hidden;}
+3 -3
View File
@@ -101,7 +101,7 @@
echo html::a($storyLink,$story->title, '', "class='preview'");
?>
</td>
<td class='text-left' title='<?php echo $story->buildName?>'><?php echo $story->buildName?></td>
<td class='c-build text-left' title='<?php echo $story->buildName?>'><?php echo $story->buildName?></td>
<td><?php echo zget($users, $story->openedBy);?></td>
<td class='text-right' title="<?php echo $story->estimate . ' ' . $lang->hourCommon;?>"><?php echo $story->estimate . $config->hourUnit;?></td>
<td class='text-center'>
@@ -197,7 +197,7 @@
<span class='status-bug status-<?php echo $bug->status?>'><?php echo $this->processStatus('bug', $bug);?></span>
</td>
<?php $resolvedBuildName = zget($builds, $bug->resolvedBuild, '');?>
<td class='text-left' title='<?php echo $resolvedBuildName?>'><?php echo $resolvedBuildName;?></td>
<td class='c-build text-left' title='<?php echo $resolvedBuildName?>'><?php echo $resolvedBuildName;?></td>
<td><?php echo zget($users, $bug->openedBy);?></td>
<td><?php echo substr($bug->openedDate, 5, 11)?></td>
<td><?php echo zget($users, $bug->resolvedBy);?></td>
@@ -307,7 +307,7 @@
$openedBuildName = '';
foreach(explode(',', $bug->openedBuild) as $buildID) $openedBuildName .= zget($builds, $buildID, '') . ' ';
?>
<td class='text-left' title='<?php echo $openedBuildName?>'><?php echo $openedBuildName;?></td>
<td class='c-build text-left' title='<?php echo $openedBuildName?>'><?php echo $openedBuildName;?></td>
<td><?php echo zget($users, $bug->openedBy);?></td>
<td><?php echo $bug->openedDate?></td>
<td class='c-actions'>
+1 -1
View File
@@ -691,7 +691,7 @@ class story extends control
}
$this->view->titles = $titles;
}
$plans = $this->loadModel('productplan')->getPairsForStory($productID, ($branch === 'all' or !in_array($branch, array_keys($branches))) ? 0 : $branch, 'skipParent|unexpired|noclosed');
$plans = $this->loadModel('productplan')->getPairsForStory($productID, ($branch === 'all' or empty($branch)) ? '' : $branch, 'skipParent|unexpired|noclosed');
$plans['ditto'] = $this->lang->story->ditto;
$priList = (array)$this->lang->story->priList;
+34
View File
@@ -4357,6 +4357,40 @@ class taskModel extends model
}
}
/**
* Get task list by conditions.
*
* @param object $conds
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
public function getListByConds($conds, $orderBy = 'id_desc', $pager = null)
{
foreach(array('priList' => array(), 'assignedToList' => array(), 'statusList' => array(), 'idList' => array(), 'taskName' => '') as $condKey => $defaultValue)
{
if(!isset($conds->$condKey))
{
$conds->$condKey = $defaultValue;
continue;
}
if(strripos($condKey, 'list') === strlen($condKey) - 4 && !is_array($conds->$condKey)) $conds->$condKey = array_filter(explode(',', $conds->$condKey));
}
return $this->dao->select('*')->from(TABLE_TASK)
->where('deleted')->eq(0)
->beginIF(!empty($conds->priList))->andWhere('pri')->in($conds->priList)->fi()
->beginIF(!empty($conds->assignedToList))->andWhere('assignedTo')->in($conds->assignedToList)->fi()
->beginIF(!empty($conds->statusList))->andWhere('status')->in($conds->statusList)->fi()
->beginIF(!empty($conds->idList))->andWhere('id')->in($conds->idList)->fi()
->beginIF(!empty($conds->taskName))->andWhere('name')->like("%{$conds->taskName}%")
->beginIF(!$this->app->user->admin)->andWhere('execution')->in($this->app->user->view->sprints)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
}
/**
* Get teamTask members.
*
+3 -3
View File
@@ -250,7 +250,7 @@ class testtask extends control
/* Create testtask from testtask of test.*/
$productID = $productID ? $productID : key($this->products);
$executions = empty($productID) ? array() : $this->loadModel('product')->getExecutionPairsByProduct($productID, '', 'id_desc', $projectID, 'stagefilter');
$builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk,withexecution', $projectID, 'project');
$builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk,withexecution', $projectID, 'project', '', false);
$execution = $this->loadModel('execution')->getByID($executionID);
if(!empty($execution) and $execution->type == 'kanban') $this->lang->testtask->execution = str_replace($this->lang->execution->common, $this->lang->kanban->common, $this->lang->testtask->execution);
@@ -816,11 +816,11 @@ class testtask extends control
$executions[$executionID] = $project->name . "({$this->lang->project->disableExecution})";
}
}
$builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $executionID, 'execution');
$builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $executionID, 'execution', $task->build, false);
}
else
{
$builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $task->project, 'project');
$builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $task->project, 'project', $task->build, false);
}
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->edit;
+11 -2
View File
@@ -390,7 +390,7 @@ class tree extends control
}
else
{
$this->view->optionMenu = $this->tree->getOptionMenu($module->root, $module->type, 0, $module->branch);
$this->view->optionMenu = $this->tree->getOptionMenu($module->root, $module->type, 0, $module->branch, 'noMainBranch');
}
if($type == 'doc') $this->view->libs = $this->loadModel('doc')->getLibs('all', $extra = 'withObject', '', 0, 'book');
@@ -534,8 +534,17 @@ class tree extends control
}
else
{
$optionMenu = $this->tree->getOptionMenu($rootID, $viewType, $rootModuleID, $branch);
$optionMenu = $this->tree->getOptionMenu($rootID, $viewType, $rootModuleID, $branch, $extra);
}
if(strpos($extra, 'excludeModuleID') !== false)
{
list($excludeModule, $noMainBranch) = explode(',', $extra);
parse_str($excludeModule, $output);
$excludeModuleID = $output['excludeModuleID'];
if(isset($optionMenu[$excludeModuleID])) unset($optionMenu[$excludeModuleID]);
}
if($returnType == 'html')
{
//Code for task #5081.
+4 -1
View File
@@ -109,11 +109,14 @@ class treeModel extends model
->andWhere('type')->in($type)
->beginIF($grade)->andWhere('grade')->le($grade)->fi()
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
->beginIF($branch !== 'all' and $branch !== '' and $branch !== false)
->beginIF($branch !== 'all' and $branch !== '' and $branch !== false and strpos($param, 'noMainBranch') === false)
->andWhere('(branch')->eq(0)
->orWhere('branch')->eq($branch)
->markRight(1)
->fi()
->beginIF($branch !== 'all' and $branch !== '' and $branch !== false and strpos($param, 'noMainBranch') !== false)
->andWhere('branch')->eq($branch)
->fi()
->beginIF(strpos($param, 'nodeleted') !== false)->andWhere('deleted')->eq(0)->fi()
->orderBy('grade desc, `order`')
->get();
+1 -1
View File
@@ -189,7 +189,7 @@ function loadModules(branch)
if(typeof(branchID) == 'undefined') branchID = 0;
if(typeof(moduleID) == 'undefined') moduleID = 0;
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branchID + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=&currentModuleID=' + moduleID);
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branchID + '&rootModuleID=0&returnType=html&fieldID=&needManage=true&extra=excludeModuleID=' + <?php echo $module->id;?> + ',noMainBranch&currentModuleID=' + moduleID);
$(moduleBox).load(link, function()
{
$(this).children('select').attr('id', 'parent').attr('name', 'parent');
@@ -344,27 +344,42 @@ class zentaoBot extends xuanBot
* @param object $user
* @param object $pager
* @access public
* @return object|string
* @return array
*/
public function viewTask($args = array(), $user = null, $pager = null)
{
$keys = array();
foreach(array('pri', 'id', 'status', 'assignTo', 'taskName') as $key) $keys[$key] = true;
if(empty($args))
{
$conds = new stdClass();
$conds->assignedToList = is_object($user) ? $user->account : false;
$conds->statusList = 'wait,doing,done,pause,cancel';
return $this->im->task->getListByConds($conds, 'status_asc', 0, $pager);
$keys['assignTo'] = is_object($user) ? $user->account : false;
$keys['status'] = 'wait,doing,done,pause,cancel';
}
$keys = array();
$keys['pri'] = true;
$keys['id'] = true;
$keys['status'] = true;
$keys['assignTo'] = true;
$keys['taskName'] = true;
$conds = $this->parseArguments($args, $keys);
return $this->im->task->getListByConds($conds, 'status_asc', 0, $pager);
$conds->search = 1;
$conds->order = 'status_asc';
$conds->limit = 10;
if(is_object($pager))
{
$conds->page = $pager->pageID;
$conds->limit = $pager->recPerPage;
}
$result = $this->loadEntry('tasks', 'get', array(), (array)$conds);
if(isset($result->tasks))
{
$pager->setRecTotal($result->total);
$pager->setRecPerPage($result->limit);
$pager->setPageID($result->page);
$pager->setPageTotal();
return $result->tasks;
}
return array();
}
/**
@@ -449,7 +464,7 @@ class zentaoBot extends xuanBot
if(empty($params))
{
$originCommand = rawurlencode($this->lang->finishTask . ' ' . implode(' ', $originArgs));
$originCommand = rawurlencode($this->lang->finishCommand . ' ' . implode(' ', $originArgs));
$json = (object)array
(
@@ -578,30 +593,28 @@ class zentaoBot extends xuanBot
public function renderTask($tasks, $originArgs, $pager)
{
$lang = $this->im->lang;
if(!$tasks || $pager->recTotal === 0) return $lang->task->noTask;
$sysURL = common::getSysURL();
$taskCount = $pager->recTotal ? $pager->recTotal : count($tasks);
if($pager->recTotal == 1)
if($taskCount === 0) return $lang->task->noTask;
if($taskCount == 1)
{
$task = current($tasks);
$link = str_replace('x.php', 'index.php', helper::createLink('task', 'view', "taskID=$task->id", 'html'));
$messages = new stdclass();
$messages->type = 'url';
$messages->url = $sysURL . $link;
return array(sprintf($this->lang->tasksFound, $pager->recTotal), $messages);
$messages->url = common::getSysURL() . $link;
return array(sprintf($this->lang->tasksFound, $taskCount), $messages);
}
$messages = array();
if($pager->pageID == 1)
{
$messages[] = sprintf($this->lang->tasksFound, $pager->recTotal);
}
if($pager->pageID == 1) $messages[] = sprintf($this->lang->tasksFound, $taskCount);
$taskTable = $this->renderTaskTable($tasks);
$originCommand = $this->lang->viewTask . ' ' . implode(' ', $originArgs);
$originCommand = $this->lang->viewCommand . ' ' . implode(' ', $originArgs);
$paging = "$pager->pageID / $pager->pageTotal";
if($pager->pageID != 1)
{
@@ -633,7 +646,6 @@ class zentaoBot extends xuanBot
public function renderTaskTable($tasks)
{
$lang = $this->im->lang;
$sysURL = common::getSysURL();
$headMap = array('id'=>'ID', 'pri' => $lang->task->pri, 'name' => $lang->task->name, 'assignedTo' => $lang->task->assignedTo, 'status' => $lang->task->status, 'estimate' => $lang->task->estimateAB, 'consumed' => $lang->task->consumedAB, 'left' => $lang->task->leftAB, 'actions' => $lang->actions);
$thead = '';
@@ -645,7 +657,7 @@ class zentaoBot extends xuanBot
{
$tr = '';
$link = str_replace('x.php', 'index.php', helper::createLink('task', 'view', "taskID=$task->id", 'html'));
$href = urlencode($sysURL . $link);
$href = urlencode(common::getSysURL() . $link);
$isParent = $task->parent == -1;
$isChild = $task->parent > 0;
$isMulti = !empty($task->mode);
@@ -675,13 +687,13 @@ class zentaoBot extends xuanBot
}
else
{
$tr .= "<td class='text-nowrap'>{$this->users[$task->$key]}</td>";
$tr .= "<td class='text-nowrap'>{$task->assignedTo->realname}</td>";
}
break;
case 'actions':
$startUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->startTask} #$task->id";
$finishUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->finishTask} #$task->id";
$closeUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->closeTask} #$task->id";
$startUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->startCommand} #$task->id";
$finishUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->finishCommand} #$task->id";
$closeUrl = 'xxc://sendContentToServerBySendbox/' . "{$this->lang->closeCommand} #$task->id";
$canStart = in_array($task->status, array('wait', 'pause'));
$canFinish = in_array($task->status, array('wait', 'pause', 'doing'));
@@ -770,7 +782,7 @@ class zentaoBot extends xuanBot
if(count($args) == 0)
{
$originCommand = rawurlencode($this->lang->startTask . ' ' . implode(' ', $originArgs));
$originCommand = rawurlencode($this->lang->startCommand . ' ' . implode(' ', $originArgs));
$realStarted = $this->formatDate($task, 'realStarted');
@@ -948,11 +960,12 @@ class zentaoBot extends xuanBot
* @param string $entry
* @param string $action
* @param array $params
* @param array $query
* @param string $version
* @access public
* @return object
*/
public function loadEntry($entry, $action, $params = array(), $version = 'v1')
public function loadEntry($entry, $action, $params = array(), $query = array(), $version = 'v1')
{
try
{
@@ -979,6 +992,10 @@ class zentaoBot extends xuanBot
{
$entry->requestBody = (object)$params;
}
elseif($action == 'get' && !empty($query))
{
$entry->setParam($query);
}
$content = call_user_func_array(array($entry, $action), $params);
return json_decode($content);
@@ -73,10 +73,10 @@ $lang->im->bot->zentaoBot->prevPage = 'Prev Page';
$lang->im->bot->zentaoBot->nextPage = 'Next Page';
$lang->im->bot->zentaoBot->effortRecorded = 'Effort recorded for task #%d.';
$lang->im->bot->zentaoBot->finishTask = 'finish';
$lang->im->bot->zentaoBot->closeTask = 'close';
$lang->im->bot->zentaoBot->startTask = 'start';
$lang->im->bot->zentaoBot->viewTask = 'view';
$lang->im->bot->zentaoBot->finishCommand = 'finish';
$lang->im->bot->zentaoBot->closeCommand = 'close';
$lang->im->bot->zentaoBot->startCommand = 'start';
$lang->im->bot->zentaoBot->viewCommand = 'view';
$lang->im->bot->zentaoBot->errors = new stdclass();
$lang->im->bot->zentaoBot->errors->emptyResult = 'No task found.';
@@ -73,10 +73,10 @@ $lang->im->bot->zentaoBot->prevPage = 'Prev Page';
$lang->im->bot->zentaoBot->nextPage = 'Next Page';
$lang->im->bot->zentaoBot->effortRecorded = 'Effort recorded for task #%d.';
$lang->im->bot->zentaoBot->finishTask = 'finish';
$lang->im->bot->zentaoBot->closeTask = 'close';
$lang->im->bot->zentaoBot->startTask = 'start';
$lang->im->bot->zentaoBot->viewTask = 'view';
$lang->im->bot->zentaoBot->finishCommand = 'finish';
$lang->im->bot->zentaoBot->closeCommand = 'close';
$lang->im->bot->zentaoBot->startCommand = 'start';
$lang->im->bot->zentaoBot->viewCommand = 'view';
$lang->im->bot->zentaoBot->errors = new stdclass();
$lang->im->bot->zentaoBot->errors->emptyResult = 'No task found.';
@@ -73,10 +73,10 @@ $lang->im->bot->zentaoBot->prevPage = 'Prev Page';
$lang->im->bot->zentaoBot->nextPage = 'Next Page';
$lang->im->bot->zentaoBot->effortRecorded = 'Effort recorded for task #%d.';
$lang->im->bot->zentaoBot->finishTask = 'finish';
$lang->im->bot->zentaoBot->closeTask = 'close';
$lang->im->bot->zentaoBot->startTask = 'start';
$lang->im->bot->zentaoBot->viewTask = 'view';
$lang->im->bot->zentaoBot->finishCommand = 'finish';
$lang->im->bot->zentaoBot->closeCommand = 'close';
$lang->im->bot->zentaoBot->startCommand = 'start';
$lang->im->bot->zentaoBot->viewCommand = 'view';
$lang->im->bot->zentaoBot->errors = new stdclass();
$lang->im->bot->zentaoBot->errors->emptyResult = 'No task found.';
@@ -81,10 +81,10 @@ $lang->im->bot->zentaoBot->prevPage = '上一页';
$lang->im->bot->zentaoBot->nextPage = '下一页';
$lang->im->bot->zentaoBot->effortRecorded = '任务 #%d 已完成工时信息填写';
$lang->im->bot->zentaoBot->finishTask = '完成任务';
$lang->im->bot->zentaoBot->closeTask = '关闭任务';
$lang->im->bot->zentaoBot->startTask = '开始任务';
$lang->im->bot->zentaoBot->viewTask = '查看任务';
$lang->im->bot->zentaoBot->finishCommand = '完成';
$lang->im->bot->zentaoBot->closeCommand = '关闭';
$lang->im->bot->zentaoBot->startCommand = '开始';
$lang->im->bot->zentaoBot->viewCommand = '查看';
$lang->im->bot->zentaoBot->errors = new stdclass();
$lang->im->bot->zentaoBot->errors->emptyResult = '未查询到相关匹配信息';
@@ -1,30 +0,0 @@
<?php
/**
* Get task list by conditions.
*
* @param object $conds
* @param string $orderBy
* @param int $limit
* @param object $pager
* @access public
* @return array
*/
public function getListByConds($conds, $orderBy = 'id_desc', $limit = 0, $pager = null)
{
foreach(array('priList' => array(), 'assignedToList' => array(), 'statusList' => array(), 'idList' => array(), 'taskName' => '') as $condKey => $defaultValue)
{
if(!isset($conds->$condKey)) $conds->$condKey = $defaultValue;
}
return $this->dao->select('*')->from(TABLE_TASK)
->where('deleted')->eq(0)
->beginIF(!empty($conds->priList))->andWhere('pri')->in($conds->priList)->fi()
->beginIF(!empty($conds->assignedToList))->andWhere('assignedTo')->in($conds->assignedToList)->fi()
->beginIF(!empty($conds->statusList))->andWhere('status')->in($conds->statusList)->fi()
->beginIF(!empty($conds->idList))->andWhere('id')->in($conds->idList)->fi()
->beginIF(!empty($conds->taskName))->andWhere('name')->like("%{$conds->taskName}%")
->orderBy($orderBy)
->beginIF($limit > 0)->limit($limit)->fi()
->page($pager)
->fetchAll('id');
}