From 68ad391c1c4e4eb377167a00ebb52697c68e448c Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 7 Nov 2023 09:19:57 +0000 Subject: [PATCH] * Finish card view ui page. --- module/kanban/config.php | 5 ++ module/kanban/config/action.php | 35 ++++++++++ module/kanban/control.php | 2 +- module/kanban/model.php | 14 +++- module/kanban/ui/splitcolumn.html.php | 1 + module/kanban/ui/viewcard.html.php | 98 +++++++++++++++++++++++++++ 6 files changed, 151 insertions(+), 4 deletions(-) create mode 100644 module/kanban/config/action.php create mode 100644 module/kanban/ui/viewcard.html.php diff --git a/module/kanban/config.php b/module/kanban/config.php index a7aa8de832..6c9da82ab9 100644 --- a/module/kanban/config.php +++ b/module/kanban/config.php @@ -7,6 +7,11 @@ $config->kanban->require->createregion = 'name'; $config->kanban->require->createlane = 'name'; $config->kanban->require->createcolumn = 'name'; +$config->kanban->actions = new stdclass(); +$config->kanban->actions->view = array(); +$config->kanban->actions->viewcard['mainActions'] = array('editCard', 'finishCard', 'activateCard', 'archiveCard'); +$config->kanban->actions->viewcard['suffixActions'] = array('deleteCard'); + $config->kanban->setwip = new stdclass(); $config->kanban->setlane = new stdclass(); $config->kanban->setlaneColumn = new stdclass(); diff --git a/module/kanban/config/action.php b/module/kanban/config/action.php new file mode 100644 index 0000000000..de78922969 --- /dev/null +++ b/module/kanban/config/action.php @@ -0,0 +1,35 @@ +kanban->actionList = array(); +$config->kanban->actionList['editCard']['icon'] = 'edit'; +$config->kanban->actionList['editCard']['text'] = $lang->kanbancard->edit; +$config->kanban->actionList['editCard']['hint'] = $lang->kanbancard->edit; +$config->kanban->actionList['editCard']['url'] = array('module' => 'kanban', 'method' => 'editCard', 'params' => 'cardID={id}'); +$config->kanban->actionList['editCard']['data-toggle'] = 'modal'; + +$config->kanban->actionList['finishCard']['icon'] = 'checked'; +$config->kanban->actionList['finishCard']['text'] = $lang->kanban->finishCard; +$config->kanban->actionList['finishCard']['hint'] = $lang->kanban->finishCard; +$config->kanban->actionList['finishCard']['url'] = array('module' => 'kanban', 'method' => 'finishCard', 'params' => 'cardID={id}&kanbanID={kanban}'); +$config->kanban->actionList['finishCard']['className'] = 'ajax-submit'; + +$config->kanban->actionList['activateCard']['icon'] = 'magic'; +$config->kanban->actionList['activateCard']['text'] = $lang->kanban->activateCard; +$config->kanban->actionList['activateCard']['hint'] = $lang->kanban->activateCard; +$config->kanban->actionList['activateCard']['url'] = array('module' => 'kanban', 'method' => 'activateCard', 'params' => 'cardID={id}&kanbanID={kanban}'); +$config->kanban->actionList['activateCard']['data-toggle'] = 'modal'; + +$config->kanban->actionList['archiveCard']['icon'] = 'ban-circle'; +$config->kanban->actionList['archiveCard']['text'] = $lang->kanban->archiveCard; +$config->kanban->actionList['archiveCard']['hint'] = $lang->kanban->archiveCard; +$config->kanban->actionList['archiveCard']['url'] = array('module' => 'kanban', 'method' => 'archiveCard', 'params' => 'cardID={id}'); +$config->kanban->actionList['archiveCard']['data-confirm'] = $lang->kanbancard->confirmArchive; +$config->kanban->actionList['archiveCard']['className'] = 'ajax-submit'; + +$config->kanban->actionList['deleteCard']['icon'] = 'trash'; +$config->kanban->actionList['deleteCard']['text'] = $lang->kanbancard->delete; +$config->kanban->actionList['deleteCard']['hint'] = $lang->kanbancard->delete; +$config->kanban->actionList['deleteCard']['url'] = array('module' => 'kanban', 'method' => 'deleteCard', 'params' => 'cardID={id}'); +$config->kanban->actionList['deleteCard']['data-confirm'] = $lang->kanbancard->confirmDelete; +$config->kanban->actionList['deleteCard']['className'] = 'ajax-submit'; diff --git a/module/kanban/control.php b/module/kanban/control.php index 5af3908b6d..47db5a7da7 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -995,7 +995,7 @@ class kanban extends control $this->action->logHistory($actionID, $changes); $callback = $this->kanban->getKanbanCallback($card->kanban, $card->region); - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true, 'closeModal' => true)); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => $callback)); } $this->view->card = $this->kanban->getCardByID($cardID); diff --git a/module/kanban/model.php b/module/kanban/model.php index 162901a649..228d6d48cc 100755 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -4023,7 +4023,7 @@ class kanbanModel extends model } return $object->archived == '1'; case 'archivecolumn' : - if($object->archived != '0') return false; // The column has been archived. + return $object->archived == '0'; // The column has been archived. case 'deletecolumn' : if($object->deleted != '0') return false; @@ -4036,8 +4036,14 @@ class kanbanModel extends model ->fetch('count'); return $count > 1; - case 'sortColumn' : - if($object->deleted != '0') return false; + case 'sortcolumn' : + return $object->deleted == '0'; + case 'finishcard' : + return $object->status != 'done'; + case 'activatecard' : + return $object->status == 'done'; + case 'deletecard' : + return $object->deleted == '0'; } return true; @@ -4101,4 +4107,6 @@ class kanbanModel extends model $kanbanData = reset($kanbanData); return array('name' => 'updateKanbanRegion', 'params' => array('region' . $regionID, $kanbanData)); } + + } diff --git a/module/kanban/ui/splitcolumn.html.php b/module/kanban/ui/splitcolumn.html.php index d550b2249a..9c46f2f9f4 100644 --- a/module/kanban/ui/splitcolumn.html.php +++ b/module/kanban/ui/splitcolumn.html.php @@ -2,6 +2,7 @@ declare(strict_types=1); /** * The splitcolumn view file of kanban module of ZenTaoPMS. + * * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net) * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html) * @author Yuting Wang diff --git a/module/kanban/ui/viewcard.html.php b/module/kanban/ui/viewcard.html.php new file mode 100644 index 0000000000..bd21d74d30 --- /dev/null +++ b/module/kanban/ui/viewcard.html.php @@ -0,0 +1,98 @@ + + * @package kanban + * @link https://www.zentao.net + */ +namespace zin; + +$assignedToList = ''; +$assignedToPairs = array_filter(explode(',', $card->assignedTo)); +foreach($assignedToPairs as $index => $assignedTo) +{ + $userName = \zget($users, $assignedTo, ''); + if($userName) $assignedToList .= $userName . ' '; +} + +detailHeader +( + to::title + ( + entityLabel + ( + set::entityID($card->id), + set::level(1), + set::text($card->name) + ) + ) +); + +$actions = $this->loadModel('common')->buildOperateMenu($card); +detailBody +( + sectionList + ( + set::style(array('padding' => '0px 0px 20px 0px')), + section + ( + set::title($lang->kanbancard->desc), + set::content($card->desc), + set::useHtml(true) + ) + ), + history(set::commentUrl(createLink('action', 'comment', array('objectType' => 'kanbancard', 'objectID' => $card->id)))), + floatToolbar + ( + set::object($card), + isAjaxRequest('modal') ? null : to::prefix(backBtn(set::icon('back'), set::className('ghost text-white'), $lang->goback)), + set::main($actions['mainActions']), + set::suffix($actions['suffixActions']) + ), + detailSide + ( + tabs + ( + set::collapse(true), + tabPane + ( + set::key(''), + set::title($lang->kanbancard->legendBasicInfo), + set::active(true), + tableData + ( + item(set::name($lang->kanbancard->assignedTo), $assignedToList), + item(set::name($lang->kanbancard->space), $space->name), + item(set::name($lang->kanbancard->kanban), $kanban->name), + item(set::name($lang->kanbancard->begin), $card->begin), + item(set::name($lang->kanbancard->end), $card->end), + item(set::name($lang->kanbancard->pri), priLabel($card->pri)), + item(set::name($lang->kanbancard->estimate), round($card->estimate, 2) . ' ' . $lang->kanbancard->lblHour), + $kanban->performable ? item(set::name($lang->kanbancard->progress), round($card->progress, 2) . ' %') : null + ) + ) + ), + tabs + ( + set::collapse(true), + tabPane + ( + set::key('legendLifeTime'), + set::title($lang->kanbancard->legendLifeTime), + set::active(true), + tableData + ( + item(set::name($lang->kanbancard->createdBy), \zget($users, $card->createdBy) . $lang->at . $card->createdDate), + item(set::name($lang->kanbancard->archivedBy), $card->archivedBy ? \zget($users, $card->archivedBy) . $lang->at . $card->archivedDate : ''), + item(set::name($lang->kanbancard->lastEditedBy), $card->lastEditedBy ? \zget($users, $card->lastEditedBy) . $lang->at . $card->lastEditedDate : ''), + ) + ) + ) + ) +); + +render();