diff --git a/module/block/control.php b/module/block/control.php index f41958fba4..21e01c131b 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -54,9 +54,10 @@ class block extends control if($this->config->global->flow == 'onlyStory' or $this->config->global->flow == 'onlyTest') unset($modules['project']); $closedBlock = isset($this->config->block->closed) ? $this->config->block->closed : ''; - if(strpos(",$closedBlock,", ",|dynamic,") === false) $modules['dynamic'] = $this->lang->block->dynamic; + if(strpos(",$closedBlock,", ",|assigntome,") === false) $modules['assigntome'] = $this->lang->block->assignToMe; + if(strpos(",$closedBlock,", ",|dynamic,") === false) $modules['dynamic'] = $this->lang->block->dynamic; if(strpos(",$closedBlock,", ",|flowchart,") === false and $this->config->global->flow == 'full') $modules['flowchart'] = $this->lang->block->lblFlowchart; - if(strpos(",$closedBlock,", ",|html,") === false) $modules['html'] = 'HTML'; + if(strpos(",$closedBlock,", ",|html,") === false) $modules['html'] = 'HTML'; $modules = array('' => '') + $modules; $hiddenBlocks = $this->block->getHiddenBlocks(); @@ -292,6 +293,10 @@ class block extends control { $html = $this->fetch('block', 'flowchart'); } + elseif($block->block == 'assigntome') + { + $html = $this->fetch('block', 'printAssignToMeBlock'); + } die($html); } @@ -630,6 +635,72 @@ class block extends control $this->view->projectStats = $this->loadModel('project')->getProjectStats($type, $productID = 0, $branch = 0, $itemCounts = 30, $orderBy = 'order_desc', $this->viewType != 'json' ? $pager : ''); } + /** + * Print assign to me block. + * + * @access public + * @return void + */ + public function printAssignToMeBlock() + { + if(common::hasPriv('todo', 'view')) $hasViewPriv['todo'] = true; + if(common::hasPriv('story', 'view')) $hasViewPriv['story'] = true; + if(common::hasPriv('task', 'view')) $hasViewPriv['task'] = true; + if(common::hasPriv('bug', 'view')) $hasViewPriv['bug'] = true; + if(common::hasPriv('testcase', 'view')) $hasViewPriv['case'] = true; + + if(isset($hasViewPriv['todo'])) + { + $this->app->loadClass('date'); + $this->app->loadLang('todo'); + $todos = $this->dao->select('*')->from(TABLE_TODO) + ->where("(assignedTo = '{$this->app->user->account}' or (assignedTo = '' and account='{$this->app->user->account}'))") + ->andWhere('cycle')->eq(0) + ->orderBy('`date`') + ->fetchAll(); + + foreach($todos as $todo) + { + $todo->begin = date::formatTime($todo->begin); + $todo->end = date::formatTime($todo->end); + } + $this->view->todos = $todos; + } + if(isset($hasViewPriv['story'])) + { + $this->app->loadLang('story'); + $this->view->stories = $this->dao->select('*')->from(TABLE_STORY)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq('0')->orderBy('id_desc')->fetchAll(); + } + if(isset($hasViewPriv['task'])) + { + $this->app->loadLang('task'); + $this->view->tasks = $this->dao->select('*')->from(TABLE_TASK)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq('0')->orderBy('id_desc')->fetchAll(); + } + if(isset($hasViewPriv['bug'])) + { + $this->app->loadLang('bug'); + $this->view->bugs = $this->dao->select('*')->from(TABLE_BUG)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq('0')->orderBy('id_desc')->fetchAll(); + } + if(isset($hasViewPriv['case'])) + { + $this->app->loadLang('testcase'); + $this->app->loadLang('testtask'); + $this->view->cases = $this->dao->select('t1.assignedTo AS assignedTo, t2.*')->from(TABLE_TESTRUN)->alias('t1') + ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id') + ->leftJoin(TABLE_TESTTASK)->alias('t3')->on('t1.task = t3.id') + ->Where('t1.assignedTo')->eq($this->app->user->account) + ->andWhere('t1.status')->ne('done') + ->andWhere('t3.status')->ne('done') + ->andWhere('t3.deleted')->eq(0) + ->andWhere('t2.deleted')->eq(0) + ->orderBy('id_desc') + ->fetchAll(); + } + + $this->view->hasViewPriv = $hasViewPriv; + $this->display(); + } + /** * Print flow chart block * @access public diff --git a/module/block/js/admin.js b/module/block/js/admin.js index 39aec0f8ec..f12d6ce372 100644 --- a/module/block/js/admin.js +++ b/module/block/js/admin.js @@ -18,7 +18,7 @@ function getBlocks(moduleID) getNotSourceParams('html', moduleID.replace('hiddenBlock', '')); return true; } - if(moduleID == 'html' || moduleID == 'dynamic' || moduleID == 'flowchart') + if(moduleID == 'html' || moduleID == 'dynamic' || moduleID == 'flowchart' || moduleID == 'assigntome') { getNotSourceParams(moduleID, blockID); return true; diff --git a/module/block/lang/en.php b/module/block/lang/en.php index aecc5fb0a7..a88800e0f7 100644 --- a/module/block/lang/en.php +++ b/module/block/lang/en.php @@ -31,6 +31,12 @@ $lang->block->lblHtml = 'HTML'; $lang->block->dynamic = 'Dynamic'; $lang->block->lblFlowchart = 'Workflow'; +$lang->block->assignToMeList['todo'] = 'Todo'; +$lang->block->assignToMeList['story'] = 'Story'; +$lang->block->assignToMeList['task'] = 'Task'; +$lang->block->assignToMeList['bug'] = 'Bug'; +$lang->block->assignToMeList['case'] = 'Case'; + $lang->block->params = new stdclass(); $lang->block->params->name = 'Name'; $lang->block->params->value = 'Value'; diff --git a/module/block/lang/zh-cn.php b/module/block/lang/zh-cn.php index ce3758f2a0..81537e9e7a 100644 --- a/module/block/lang/zh-cn.php +++ b/module/block/lang/zh-cn.php @@ -29,8 +29,15 @@ $lang->block->lblBlock = '区块'; $lang->block->lblNum = '条数'; $lang->block->lblHtml = 'HTML内容'; $lang->block->dynamic = '最新动态'; +$lang->block->assignToMe = '指派给我'; $lang->block->lblFlowchart = '流程图'; +$lang->block->assignToMeList['todo'] = '待办'; +$lang->block->assignToMeList['story'] = '需求'; +$lang->block->assignToMeList['task'] = '任务'; +$lang->block->assignToMeList['bug'] = 'Bug'; +$lang->block->assignToMeList['case'] = '用例'; + $lang->block->params = new stdclass(); $lang->block->params->name = '参数名称'; $lang->block->params->value = '参数值'; @@ -111,21 +118,25 @@ $lang->block->default['full']['my']['2']['grid'] = 4; $lang->block->default['full']['my']['2']['source'] = ''; $lang->block->default['full']['my']['3'] = $lang->block->default['project']['1']; $lang->block->default['full']['my']['3']['source'] = 'project'; -$lang->block->default['full']['my']['4']['title'] = '我的待办'; -$lang->block->default['full']['my']['4']['block'] = 'list'; -$lang->block->default['full']['my']['4']['grid'] = 4; -$lang->block->default['full']['my']['4']['source'] = 'todo'; -$lang->block->default['full']['my']['4']['params']['num'] = '20'; -$lang->block->default['full']['my']['5'] = $lang->block->default['product']['1']; -$lang->block->default['full']['my']['5']['source'] = 'product'; -$lang->block->default['full']['my']['6'] = $lang->block->default['project']['2']; -$lang->block->default['full']['my']['6']['source'] = 'project'; -$lang->block->default['full']['my']['7'] = $lang->block->default['qa']['1']; -$lang->block->default['full']['my']['7']['source'] = 'qa'; -$lang->block->default['full']['my']['8'] = $lang->block->default['product']['2']; -$lang->block->default['full']['my']['8']['source'] = 'product'; -$lang->block->default['full']['my']['9'] = $lang->block->default['qa']['2']; -$lang->block->default['full']['my']['9']['source'] = 'qa'; +$lang->block->default['full']['my']['4']['title'] = '指派给我'; +$lang->block->default['full']['my']['4']['block'] = 'assigntome'; +$lang->block->default['full']['my']['4']['grid'] = 8; +$lang->block->default['full']['my']['4']['source'] = ''; +$lang->block->default['full']['my']['5']['title'] = '我的待办'; +$lang->block->default['full']['my']['5']['block'] = 'list'; +$lang->block->default['full']['my']['5']['grid'] = 4; +$lang->block->default['full']['my']['5']['source'] = 'todo'; +$lang->block->default['full']['my']['5']['params']['num'] = '20'; +$lang->block->default['full']['my']['6'] = $lang->block->default['product']['1']; +$lang->block->default['full']['my']['6']['source'] = 'product'; +$lang->block->default['full']['my']['7'] = $lang->block->default['project']['2']; +$lang->block->default['full']['my']['7']['source'] = 'project'; +$lang->block->default['full']['my']['8'] = $lang->block->default['qa']['1']; +$lang->block->default['full']['my']['8']['source'] = 'qa'; +$lang->block->default['full']['my']['9'] = $lang->block->default['product']['2']; +$lang->block->default['full']['my']['9']['source'] = 'product'; +$lang->block->default['full']['my']['10'] = $lang->block->default['qa']['2']; +$lang->block->default['full']['my']['10']['source'] = 'qa'; $lang->block->default['onlyTest']['my']['1'] = $lang->block->default['qa']['1']; $lang->block->default['onlyTest']['my']['1']['source'] = 'qa'; diff --git a/module/block/view/printassigntomeblock.html.php b/module/block/view/printassigntomeblock.html.php new file mode 100644 index 0000000000..33753341c6 --- /dev/null +++ b/module/block/view/printassigntomeblock.html.php @@ -0,0 +1,41 @@ + + * @package block + * @version $Id$ + * @link http://www.zentao.net + */ +?> +
+ +
+ +
+
+
+ $bool):?> +
" id=""> + +
+ +
+
+
+ diff --git a/module/project/view/testtask.html.php b/module/project/view/testtask.html.php index d565654f6e..45613cf33c 100644 --- a/module/project/view/testtask.html.php +++ b/module/project/view/testtask.html.php @@ -53,7 +53,7 @@ common::printIcon('testtask', 'cases', "taskID=$task->id", $task, 'list', 'sitemap'); common::printIcon('testtask', 'linkCase', "taskID=$task->id", $task, 'list', 'link'); common::printIcon('testtask', 'edit', "taskID=$task->id", $task, 'list'); - common::printIcon('testreport', 'create', "objectID=$task->id&objectType=testtask", $task, 'list','flag'); + common::printIcon('testreport', 'browse', "objectID=$task->product&objectType=product&extra=$task->id", $task, 'list','flag'); if(common::hasPriv('testtask', 'delete', $task)) { diff --git a/module/tree/model.php b/module/tree/model.php index 3154bb34ad..135d36b7bc 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -372,7 +372,7 @@ class treeModel extends model } if(!$firstBranch) $lastMenu .= ''; - $lastMenu = "\n"; + $lastMenu = "\n"; return $lastMenu; } @@ -402,7 +402,7 @@ class treeModel extends model } /* createdVersion > 4.1. */ - $menu = "