From e19602194ac8493add9ae51d33689b559f451b8b Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 12 Jan 2022 10:30:55 +0800 Subject: [PATCH 1/5] * Modify the editing project error problem. --- module/kanban/control.php | 3 ++- module/kanban/view/setlaneheight.html.php | 2 +- module/project/control.php | 5 ++--- module/project/view/edit.html.php | 2 ++ 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/module/kanban/control.php b/module/kanban/control.php index b87cf766a9..86713fecd1 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -479,7 +479,8 @@ class kanban extends control $kanban = $from == 'execution' ? $this->loadModel('execution')->getByID($kanbanID) : $this->kanban->getByID($kanbanID); - $this->view->heightType = $kanban->displayCards > 2 ? 'custom' : 'auto'; + $this->view->heightType = $kanban->displayCards > 2 ? 'custom' : 'auto'; + $this->view->displayCards = $kanban->displayCards ? $kanban->displayCards : ''; $this->display(); } diff --git a/module/kanban/view/setlaneheight.html.php b/module/kanban/view/setlaneheight.html.php index d41e84b686..62125573fd 100644 --- a/module/kanban/view/setlaneheight.html.php +++ b/module/kanban/view/setlaneheight.html.php @@ -24,7 +24,7 @@ kanban->cardCount;?> - kanban->cardCountTip}' autocomplete='off'");?> + kanban->cardCountTip}' autocomplete='off'");?> diff --git a/module/project/control.php b/module/project/control.php index 2851aa5228..36288c0ac5 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -586,8 +586,7 @@ class project extends control } } - $canChangeModel = $this->project->checkCanChangeModel($projectID, $project->model); - $disableModel = $canChangeModel == true ? '' : 'disabled'; + if($project->model != 'kanban') $canChangeModel = $this->project->checkCanChangeModel($projectID, $project->model); $this->view->title = $this->lang->project->edit; $this->view->position[] = $this->lang->project->edit; @@ -614,7 +613,7 @@ class project extends control $this->view->availableBudget = $this->program->getBudgetLeft($parentProject) + (float)$project->budget; $this->view->budgetUnitList = $this->project->getBudgetUnitList(); $this->view->model = $project->model; - $this->view->disableModel = $disableModel; + $this->view->disableModel = (isset($canChangeModel) and $canChangeModel == true) ? '' : 'disabled'; $this->display(); } diff --git a/module/project/view/edit.html.php b/module/project/view/edit.html.php index e8f430a273..2909dd3673 100644 --- a/module/project/view/edit.html.php +++ b/module/project/view/edit.html.php @@ -34,10 +34,12 @@
+ model != 'kanban'):?> + Date: Wed, 12 Jan 2022 11:07:02 +0800 Subject: [PATCH 2/5] * Working with Kanban Data. --- module/execution/config.php | 1 + module/execution/control.php | 9 ++++----- module/execution/model.php | 8 ++++---- module/execution/view/ajaxgetdropmenu.html.php | 5 +++++ module/project/model.php | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/module/execution/config.php b/module/execution/config.php index ec4ef74386..3de6ff2291 100644 --- a/module/execution/config.php +++ b/module/execution/config.php @@ -11,6 +11,7 @@ $config->execution->list->exportFields = 'id,name,projectName,code,PM,end,status $config->execution->modelList['scrum'] = 'sprint'; $config->execution->modelList['waterfall'] = 'stage'; +$config->execution->modelList['kanban'] = 'kanban'; global $lang, $app; $app->loadLang('task'); diff --git a/module/execution/control.php b/module/execution/control.php index f934284e97..0e874bebae 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1967,13 +1967,12 @@ class execution extends control */ public function kanban($executionID, $browseType = 'all', $orderBy = 'id_asc', $groupBy = 'all') { - unset($this->lang->execution->menu); - - $users = $this->loadModel('user')->getPairs('noletter|nodeleted'); + $this->lang->execution->menu = new stdclass(); + $execution = $this->commonAction($executionID); $kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $browseType, $orderBy, $groupBy); - $execution = $this->execution->getById($executionID); $userList = array(); + $users = $this->loadModel('user')->getPairs('noletter|nodeleted'); $avatarPairs = $this->dao->select('account, avatar')->from(TABLE_USER)->where('deleted')->eq(0)->fetchPairs(); foreach($avatarPairs as $account => $avatar) { @@ -2945,7 +2944,7 @@ class execution extends control $projects = $this->loadModel('program')->getProjectList(0, 'all', 0, 'order_asc', null, 0, 0, true); $executionGroups = $this->dao->select('*')->from(TABLE_EXECUTION) ->where('deleted')->eq(0) - ->andWhere('type')->in('sprint,stage') + ->andWhere('type')->in('sprint,stage,kanban') ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->sprints)->fi() ->beginIF($this->config->systemMode == 'new')->andWhere('project')->in(array_keys($projects))->fi() ->orderBy('id_desc') diff --git a/module/execution/model.php b/module/execution/model.php index e897bac7eb..d2332fd56e 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -65,7 +65,7 @@ class executionModel extends model { if(!$this->app->user->admin and strpos(",{$this->app->user->view->sprints},", ",$executionID,") === false and !defined('TUTORIAL') and $executionID != 0) die(js::error($this->lang->execution->accessDenied) . js::locate('back')); - $executions = $this->loadModel('execution')->getPairs(0, 'all', 'nocode'); + $executions = $this->getPairs(0, 'all', 'nocode'); if(!$executionID and $this->session->execution) $executionID = $this->session->execution; if(!$executionID or !in_array($executionID, array_keys($executions))) $executionID = key($executions); $this->session->set('execution', $executionID); @@ -1054,7 +1054,7 @@ class executionModel extends model /* Order by status's content whether or not done */ $executions = $this->dao->select('*, IF(INSTR("done,closed", status) < 2, 0, 1) AS isDone, INSTR("doing,wait,suspended,closed", status) AS sortStatus')->from(TABLE_EXECUTION) ->where('deleted')->eq(0) - ->beginIF($type == 'all')->andWhere('type')->in('stage,sprint')->fi() + ->beginIF($type == 'all')->andWhere('type')->in('stage,sprint,kanban')->fi() ->beginIF($projectID and $this->config->systemMode == 'new')->andWhere('project')->eq($projectID)->fi() ->beginIF($type != 'all' and $this->config->systemMode == 'new')->andWhere('type')->eq($type)->fi() ->beginIF(strpos($mode, 'withdelete') === false)->andWhere('deleted')->eq(0)->fi() @@ -1319,7 +1319,7 @@ class executionModel extends model $module = 'execution'; $method = 'task'; } - if($module == 'testcase' and ($method == 'view' || $method == 'edit' || $method == 'batchedit')) + if($module == 'testcase' and ($method == 'view' or $method == 'edit' or $method == 'batchedit')) { $module = 'execution'; $method = 'testcase'; @@ -1329,7 +1329,7 @@ class executionModel extends model $module = 'execution'; $method = 'testtask'; } - if($module == 'build' and ($method == 'edit' || $method= 'view')) + if($module == 'build' and ($method == 'edit' or $method == 'view')) { $module = 'execution'; $method = 'build'; diff --git a/module/execution/view/ajaxgetdropmenu.html.php b/module/execution/view/ajaxgetdropmenu.html.php index e5ac0900c0..48f728d304 100644 --- a/module/execution/view/ajaxgetdropmenu.html.php +++ b/module/execution/view/ajaxgetdropmenu.html.php @@ -75,6 +75,11 @@ foreach($executions as $projectID => $projectExecutions) $selected = $execution->id == $executionID ? 'selected' : ''; if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account]))) { + $kanbanLink = "/execution-kanban-%s.html"; + $taskLink = "/execution-task-%s.html"; + if($execution->type != 'kanban' and $link == $kanbanLink) $link = $taskLink; + if($execution->type == 'kanban' and $link != $kanbanLink) $link = $kanbanLink; + $myExecutionsHtml .= '
  • ' . html::a(sprintf($link, $execution->id), $execution->name, '', "class='$selected executionName' title='{$execution->name}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
  • '; if($selected == 'selected') $tabActive = 'myExecution'; diff --git a/module/project/model.php b/module/project/model.php index 0895b4bfe6..60b703035a 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1836,7 +1836,7 @@ class projectModel extends model $executions = $this->dao->select('t1.*,t2.name projectName, t2.model as projectModel')->from(TABLE_EXECUTION)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') - ->where('t1.type')->in('sprint,stage') + ->where('t1.type')->in('sprint,stage,kanban') ->beginIF($projectID != 0)->andWhere('t1.project')->eq($projectID)->fi() ->beginIF(!empty($myExecutionIDList))->andWhere('t1.id')->in(array_keys($myExecutionIDList))->fi() ->beginIF($status == 'undone')->andWhere('t1.status')->notIN('done,closed')->fi() From 7870309514558c35c8b155f6e53479ac730a76ec Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 12 Jan 2022 11:13:16 +0800 Subject: [PATCH 3/5] * Modify create and execute jump app error. --- module/execution/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/execution/control.php b/module/execution/control.php index 0e874bebae..f29a2d76ac 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1397,7 +1397,7 @@ class execution extends control $this->loadModel('kanban')->createRDKanban($execution); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('kanban', "executionID=$executionID"))); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('kanban', "executionID=$executionID") . '#app=execution')); } if(!empty($planID)) From 4bca0680ab417ba46e19a7490e63661af24562b4 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 12 Jan 2022 15:44:44 +0800 Subject: [PATCH 4/5] * Finish task #47335. --- module/execution/config.php | 2 ++ module/execution/control.php | 41 ++++++++++++++++++--------- module/execution/css/kanban.css | 1 + module/execution/model.php | 4 ++- module/execution/view/kanban.html.php | 33 +++++++++++++++++++++ 5 files changed, 67 insertions(+), 14 deletions(-) diff --git a/module/execution/config.php b/module/execution/config.php index 3de6ff2291..69eeeb5f7d 100644 --- a/module/execution/config.php +++ b/module/execution/config.php @@ -13,6 +13,8 @@ $config->execution->modelList['scrum'] = 'sprint'; $config->execution->modelList['waterfall'] = 'stage'; $config->execution->modelList['kanban'] = 'kanban'; +$config->execution->statusActions = array('start', 'putoff', 'suspend', 'close', 'activate'); + global $lang, $app; $app->loadLang('task'); $config->execution->task = new stdclass(); diff --git a/module/execution/control.php b/module/execution/control.php index f29a2d76ac..34254711b1 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1397,7 +1397,8 @@ class execution extends control $this->loadModel('kanban')->createRDKanban($execution); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('kanban', "executionID=$executionID") . '#app=execution')); + if($this->app->tab == 'project') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('project', 'index', "projectID=$projectID"))); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('kanban', "executionID=$executionID"))); } if(!empty($planID)) @@ -1476,6 +1477,7 @@ class execution extends control $this->app->loadLang('stage'); $this->app->loadLang('programplan'); $browseExecutionLink = $this->createLink('execution', 'browse', "executionID=$executionID"); + $execution = $this->execution->getById($executionID); if(!empty($_POST)) { @@ -1527,6 +1529,7 @@ class execution extends control $this->executeHooks($executionID); if($_POST['status'] == 'doing') $this->loadModel('common')->syncPPEStatus($executionID); + if($execution->type == 'kanban') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "executionID=$executionID"))); } @@ -1534,7 +1537,6 @@ class execution extends control $this->execution->setMenu($executionID); $executions = array('' => '') + $this->executions; - $execution = $this->execution->getById($executionID); $managers = $this->execution->getDefaultManagers($executionID); $project = $this->project->getByID($execution->project); @@ -1721,6 +1723,7 @@ class execution extends control { $execution = $this->commonAction($executionID); $executionID = $execution->id; + if($execution->type == 'kanban') $this->lang->executionCommon = $this->lang->execution->kanban; if(!empty($_POST)) { @@ -1793,6 +1796,7 @@ class execution extends control { $execution = $this->commonAction($executionID); $executionID = $execution->id; + if($execution->type == 'kanban') $this->lang->executionCommon = $this->lang->execution->kanban; if(!empty($_POST)) { @@ -1828,6 +1832,7 @@ class execution extends control { $execution = $this->commonAction($executionID); $executionID = $execution->id; + if($execution->type == 'kanban') $this->lang->executionCommon = $this->lang->execution->kanban; if(!empty($_POST)) { @@ -1870,6 +1875,7 @@ class execution extends control { $execution = $this->commonAction($executionID); $executionID = $execution->id; + if($execution->type == 'kanban') $this->lang->executionCommon = $this->lang->execution->kanban; if(!empty($_POST)) { @@ -1968,8 +1974,14 @@ class execution extends control public function kanban($executionID, $browseType = 'all', $orderBy = 'id_asc', $groupBy = 'all') { $this->lang->execution->menu = new stdclass(); - $execution = $this->commonAction($executionID); - $kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $browseType, $orderBy, $groupBy); + $execution = $this->commonAction($executionID); + $kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $browseType, $orderBy, $groupBy); + $executionActions = array(); + + foreach($this->config->execution->statusActions as $action) + { + if($this->execution->isClickable($execution, $action)) $executionActions[] = $action; + } $userList = array(); $users = $this->loadModel('user')->getPairs('noletter|nodeleted'); @@ -1980,14 +1992,15 @@ class execution extends control $userList[$account]['avatar'] = $avatar; } - $this->view->title = $this->lang->kanban->view; - $this->view->users = $users; - $this->view->regions = $kanbanData; - $this->view->execution = $execution; - $this->view->userList = $userList; - $this->view->browseType = $browseType; - $this->view->orderBy = $orderBy; - $this->view->groupBy = $groupBy; + $this->view->title = $this->lang->kanban->view; + $this->view->users = $users; + $this->view->regions = $kanbanData; + $this->view->execution = $execution; + $this->view->userList = $userList; + $this->view->browseType = $browseType; + $this->view->orderBy = $orderBy; + $this->view->groupBy = $groupBy; + $this->view->executionActions = $executionActions; $this->display(); } @@ -2382,6 +2395,7 @@ class execution extends control else { /* Delete execution. */ + $execution = $this->execution->getByID($executionID); $this->dao->update(TABLE_EXECUTION)->set('deleted')->eq(1)->where('id')->eq($executionID)->exec(); $this->loadModel('action')->create('execution', $executionID, 'deleted', '', ACTIONMODEL::CAN_UNDELETED); $this->execution->updateUserView($executionID); @@ -2390,7 +2404,8 @@ class execution extends control $this->executeHooks($executionID); if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess)); - die(js::reload('parent')); + if($execution->type == 'kanban') return print(js::locate($this->createLink('execution', 'all'), 'parent')); + return print(js::reload('parent')); } } diff --git a/module/execution/css/kanban.css b/module/execution/css/kanban.css index df132b1ab1..ec349e5541 100644 --- a/module/execution/css/kanban.css +++ b/module/execution/css/kanban.css @@ -108,3 +108,4 @@ #kanbanScaleControl > .input-group-btn:first-child > .btn {border-radius: 16px 0 0 16px; border-right-color: transparent;} #kanbanScaleControl > .input-group-btn:last-child > .btn {border-radius: 0 16px 16px 0; border-left-color: transparent;} #kanbanScaleControl > .input-group-btn > .btn:hover {border-color: #b8bfce;} +#kanbanActionMenu {top: 24px; right: 28px;} diff --git a/module/execution/model.php b/module/execution/model.php index d2332fd56e..b9a5aed9b7 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3038,7 +3038,9 @@ class executionModel extends model */ public static function isClickable($execution, $action) { - $action = strtolower($action); + $action = strtolower($action); + $clickable = commonModel::hasPriv('execution', $action); + if(!$clickable) return false; if($action == 'start') return $execution->status == 'wait'; if($action == 'close') return $execution->status != 'closed'; diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php index 2ecc5dc6dd..227d766668 100644 --- a/module/execution/view/kanban.html.php +++ b/module/execution/view/kanban.html.php @@ -59,6 +59,39 @@ $canCreateLane = commonModel::hasPriv('kanban', 'createLane'); +
    + " . $lang->kanban->fullScreen, '', "class='btn btn-link'"); + $actions = ''; + $printSettingBtn = (common::hasPriv('kanban', 'createRegion') or (common::hasPriv('kanban', 'setLaneHeight')) or common::hasPriv('execution', 'edit') or common::hasPriv('execution', 'close') or common::hasPriv('execution', 'delete') or !empty($executionActions)); + + if($printSettingBtn) + { + $actions .= html::a('javascript:;', "" . $lang->kanban->setting, '', "data-toggle='dropdown' class='btn btn-link'"); + $actions .= ""; + } + + $actions .= "
    "; + + echo $actions; + ?> +
    From c5bf8afbc291f23ff8d2bb596c1ef805926566f9 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 12 Jan 2022 15:50:44 +0800 Subject: [PATCH 5/5] * Modify the link judgment method. --- module/execution/view/ajaxgetdropmenu.html.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/execution/view/ajaxgetdropmenu.html.php b/module/execution/view/ajaxgetdropmenu.html.php index 48f728d304..c52d2687f1 100644 --- a/module/execution/view/ajaxgetdropmenu.html.php +++ b/module/execution/view/ajaxgetdropmenu.html.php @@ -75,8 +75,8 @@ foreach($executions as $projectID => $projectExecutions) $selected = $execution->id == $executionID ? 'selected' : ''; if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account]))) { - $kanbanLink = "/execution-kanban-%s.html"; - $taskLink = "/execution-task-%s.html"; + $kanbanLink = $this->createLink('execution', 'kanban', "executionID=%s"); + $taskLink = $this->createLink('execution', 'task', "executionID=%s"); if($execution->type != 'kanban' and $link == $kanbanLink) $link = $taskLink; if($execution->type == 'kanban' and $link != $kanbanLink) $link = $kanbanLink;
    project->model;?> project->modelList, $model, "class='form-control chosen' required $disableModel");?>
    program->parent;?>