diff --git a/module/execution/control.php b/module/execution/control.php index ba14b4f182..394178b508 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1267,19 +1267,12 @@ class execution extends control $project = $this->project->getByID($projectID); if(!empty($project) and $project->model == 'kanban') { - $this->lang->execution->menu = new stdclass(); - $this->lang->execution->createExec = str_replace($this->lang->execution->common, $this->lang->execution->kanban, $this->lang->execution->createExec); - $this->lang->execution->execName = str_replace($this->lang->execution->common, $this->lang->execution->kanban, $this->lang->execution->execName); - $this->lang->execution->execCode = str_replace($this->lang->execution->common, $this->lang->execution->kanban, $this->lang->execution->execCode); - $this->lang->execution->execDesc = str_replace($this->lang->execution->common, $this->lang->execution->kanban, $this->lang->execution->execDesc); - $this->lang->execution->copyExec = str_replace($this->lang->execution->common, $this->lang->execution->kanban, $this->lang->execution->copyExec); - $this->lang->execution->create = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->create); - $this->lang->execution->copy = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->copy); - $this->lang->execution->PM = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->PM); - $this->lang->execution->name = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->name); - $this->lang->execution->code = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->code); - $this->lang->execution->desc = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->desc); - $this->lang->execution->copyTeamTip = str_replace(array($this->lang->execution->common, $this->lang->executionCommon), $this->lang->execution->kanban, $this->lang->execution->copyTeamTip); + global $lang; + $executionLang = $lang->execution->common; + $lang->executionCommon = $lang->execution->kanban; + $lang->execution->common = $lang->execution->kanban; + include $this->app->getModulePath('', 'execution') . 'lang/' . $this->app->getClientLang() . '.php'; + $lang->execution->common = $executionLang; } $extra = str_replace(array(',', ' '), array('&', ''), $extra); @@ -1483,6 +1476,13 @@ class execution extends control $browseExecutionLink = $this->createLink('execution', 'browse', "executionID=$executionID"); $execution = $this->execution->getById($executionID); + if($execution->type == 'kanban') + { + global $lang; + $lang->executionCommon = $lang->execution->kanban; + include $this->app->getModulePath('', 'execution') . 'lang/' . $this->app->getClientLang() . '.php'; + } + if(!empty($_POST)) { $oldPlans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($executionID)->andWhere('plan')->ne(0)->fetchPairs('plan'); @@ -1543,17 +1543,6 @@ class execution extends control $executions = array('' => '') + $this->executions; $managers = $this->execution->getDefaultManagers($executionID); - $project = $this->project->getByID($execution->project); - if($project->model == 'kanban') - { - $this->lang->execution->edit = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->edit); - $this->lang->execution->name = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->name); - $this->lang->execution->code = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->code); - $this->lang->execution->desc = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->desc); - $this->lang->execution->status = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->status); - $this->lang->execution->PM = str_replace($this->lang->executionCommon, $this->lang->execution->kanban, $this->lang->execution->PM); - } - /* Remove current execution from the executions. */ unset($executions[$executionID]); @@ -1625,7 +1614,6 @@ class execution extends control $this->view->multiBranchProducts = $this->product->getMultiBranchPairs(); $this->view->productPlans = $productPlans; $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($linkedProducts), $this->config->systemMode == 'new' ? $execution->project : 0, 'noclosed', $linkedBranchList); - $this->view->project = $project; $this->display(); } @@ -2406,6 +2394,12 @@ class execution extends control if($tips) $tips = str_replace($this->lang->executionCommon, $this->lang->project->stage, $tips); $this->lang->execution->confirmDelete = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->execution->confirmDelete); } + elseif($type == 'kanban') + { + global $lang; + $lang->executionCommon = $lang->execution->kanban; + include $this->app->getModulePath('', 'execution') . 'lang/' . $this->app->getClientLang() . '.php'; + } echo js::confirm($tips . sprintf($this->lang->execution->confirmDelete, $this->executions[$executionID]), $this->createLink('execution', 'delete', "executionID=$executionID&confirm=yes")); exit; diff --git a/module/execution/model.php b/module/execution/model.php index d9d9c22da3..21239d5948 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3045,6 +3045,7 @@ class executionModel extends model if($action == 'suspend') return $execution->status == 'wait' or $execution->status == 'doing'; if($action == 'putoff') return $execution->status == 'wait' or $execution->status == 'doing'; if($action == 'activate') return $execution->status == 'suspended' or $execution->status == 'closed'; + if($action == 'delete') return $execution->status == 'wait' or $execution->status == 'doing'; return true; } diff --git a/module/execution/view/edit.html.php b/module/execution/view/edit.html.php index 68f911e281..0316288f4f 100644 --- a/module/execution/view/edit.html.php +++ b/module/execution/view/edit.html.php @@ -66,7 +66,7 @@ - model != 'kanban'):?> + type != 'kanban'):?> execution->type;?> diff --git a/module/kanban/model.php b/module/kanban/model.php index b523c5dd2b..a030284f05 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -1113,10 +1113,9 @@ class kanbanModel extends model public function getKanban4Group($executionID, $browseType, $groupBy) { /* Get card data. */ - $cardList = array(); - if($browseType == 'story') $cardList .= $this->loadModel('story')->getExecutionStories($executionID); - if($browseType == 'bug') $cardList .= $this->loadModel('bug')->getExecutionBugs($executionID); - if($browseType == 'task') $cardList .= $this->loadModel('execution')->getKanbanTasks($executionID, "id"); + if($browseType == 'story') $cardList = $this->loadModel('story')->getExecutionStories($executionID); + if($browseType == 'bug') $cardList = $this->loadModel('bug')->getExecutionBugs($executionID); + if($browseType == 'task') $cardList = $this->loadModel('execution')->getKanbanTasks($executionID, "id"); $lanes = $this->getLanes4Group($executionID, $browseType, $groupBy, $cardList); if(empty($lanes)) return array(); diff --git a/module/project/control.php b/module/project/control.php index 178bcb0c4d..fa5a7d6d34 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -252,6 +252,7 @@ class project extends control { if($this->execution->isClickable($kanban, $action)) $executionActions[$kanbanID][] = $action; } + if($this->execution->isClickable($kanban, 'delete')) $executionActions[$kanbanID][] = 'delete'; } $this->view->kanbanList = $kanbanList; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index c0e8a48e9b..132c11dc68 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -155,7 +155,7 @@ $lang->project->etc = "等"; $lang->project->product = '所属产品'; $lang->project->branch = '所属分支'; $lang->project->plan = '所属计划'; -$lang->project->createKanban = '创建看板'; +$lang->project->createKanban = '添加看板'; $lang->project->kanban = '看板'; /* Project Kanban. */ diff --git a/module/project/view/index.html.php b/module/project/view/index.html.php index 251e12a41a..af33d3f907 100644 --- a/module/project/view/index.html.php +++ b/module/project/view/index.html.php @@ -68,6 +68,7 @@ if(in_array('suspend', $executionActions[$kanbanID])) echo '
  • ' . html::a(helper::createLink('execution', 'suspend', "executionID=$kanbanID", '', true), '' . $lang->execution->suspend, '', "class='iframe btn btn-link text-left' data-width='75%'") . '
  • '; if(in_array('close', $executionActions[$kanbanID])) echo '
  • ' . html::a(helper::createLink('execution', 'close', "executionID=$kanbanID", '', true), '' . $lang->execution->close, '', "class='iframe btn btn-link text-left' data-width='75%'") . '
  • '; if(in_array('activate', $executionActions[$kanbanID])) echo '
  • ' . html::a(helper::createLink('execution', 'activate', "executionID=$kanbanID", '', true), '' . $lang->execution->activate, '', "class='iframe btn btn-link text-left' data-width='75%'") . '
  • '; + if(in_array('delete', $executionActions[$kanbanID])) echo '
  • ' . html::a(helper::createLink('execution', 'delete', "executionID=$kanbanID&confirm=no&kanban=yes", '', true), '' . $lang->kanban->delete, '', "target='hiddenwin'") . '
  • '; ?> diff --git a/module/user/model.php b/module/user/model.php index fc407db983..52185d5cc7 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1624,7 +1624,7 @@ class userModel extends model if($allProducts === null) $allProducts = $this->dao->select('id,PO,QD,RD,createdBy,acl,whitelist,program,createdBy')->from(TABLE_PRODUCT)->where('acl')->ne('open')->fetchAll('id'); if($allProjects === null) $allProjects = $this->dao->select('id,PO,PM,QD,RD,acl,type,path,parent,openedBy')->from(TABLE_PROJECT)->where('acl')->ne('open')->andWhere('type')->eq('project')->fetchAll('id'); if($allPrograms === null) $allPrograms = $this->dao->select('id,PO,PM,QD,RD,acl,type,path,parent,openedBy')->from(TABLE_PROGRAM)->where('acl')->ne('open')->andWhere('type')->eq('program')->fetchAll('id'); - if($allSprints === null) $allSprints = $this->dao->select('id,PO,PM,QD,RD,acl,project,path,parent,type,openedBy')->from(TABLE_PROJECT)->where('acl')->eq('private')->beginIF($this->config->systemMode == 'new')->andWhere('type')->in('sprint,stage')->fi()->fetchAll('id'); + if($allSprints === null) $allSprints = $this->dao->select('id,PO,PM,QD,RD,acl,project,path,parent,type,openedBy')->from(TABLE_PROJECT)->where('acl')->eq('private')->beginIF($this->config->systemMode == 'new')->andWhere('type')->in('sprint,stage,kanban')->fi()->fetchAll('id'); /* Get teams. */ if($teams === null) @@ -1869,7 +1869,7 @@ class userModel extends model /* Set opened sprints and stages into userview. */ $openedSprints = $this->dao->select('id')->from(TABLE_PROJECT) ->where('acl')->eq('open') - ->beginIF($this->config->systemMode == 'new')->andWhere('type')->in('sprint,stage')->fi() + ->beginIF($this->config->systemMode == 'new')->andWhere('type')->in('sprint,stage,kanban')->fi() ->beginIF($this->config->systemMode == 'new')->andWhere('project')->in($userView->projects)->fi() ->fetchAll('id');