diff --git a/extension/lite/group/ext/lang/resource.php b/extension/lite/group/ext/lang/resource.php index c8a9006006..a617a128d7 100644 --- a/extension/lite/group/ext/lang/resource.php +++ b/extension/lite/group/ext/lang/resource.php @@ -330,7 +330,8 @@ $lang->resource->kanban->sortRegion = 'sortRegion'; $lang->resource->kanban->sortGroup = 'sortGroup'; $lang->resource->kanban->deleteRegion = 'deleteRegion'; $lang->resource->kanban->createLane = 'createLane'; -$lang->resource->kanban->setLane = 'setLane'; +$lang->resource->kanban->editLaneName = 'editLaneName'; +$lang->resource->kanban->editLaneColor = 'editLaneColor'; $lang->resource->kanban->sortLane = 'sortLane'; $lang->resource->kanban->deleteLane = 'deleteLane'; $lang->resource->kanban->createColumn = 'createColumn'; diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 1a973f0574..88bc014788 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -635,8 +635,9 @@ $lang->resource->kanban->sortRegion = 'sortRegion'; $lang->resource->kanban->sortGroup = 'sortGroup'; $lang->resource->kanban->deleteRegion = 'deleteRegion'; $lang->resource->kanban->createLane = 'createLane'; -$lang->resource->kanban->setLane = 'setLane'; $lang->resource->kanban->sortLane = 'sortLane'; +$lang->resource->kanban->editLaneColor = 'editLaneColor'; +$lang->resource->kanban->editLaneName = 'editLaneName'; $lang->resource->kanban->deleteLane = 'deleteLane'; $lang->resource->kanban->createColumn = 'createColumn'; $lang->resource->kanban->splitColumn = 'splitColumn'; diff --git a/module/kanban/control.php b/module/kanban/control.php index 54b2d114c3..b50660f759 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1569,6 +1569,67 @@ class kanban extends control $this->display(); } + /** + * Edit lane's name + * + * @param int $laneID + * @param int $executionID + * @param string $from + * @access public + * @return void + */ + public function editLaneName($laneID, $executionID = 0, $from = 'kanban') + { + if($_POST) + { + $this->kanban->setLane($laneID); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + + $this->loadModel('action')->create('kanbanlane', $laneID, 'Edited', '', $executionID); + + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + } + + $lane = $this->kanban->getLaneById($laneID); + if(!$lane) return print(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'kanban', "executionID=$executionID"))); + + $this->view->title = $from == 'kanban' ? $this->lang->edit . '“' . $lane->name . '”' . $this->lang->kanbanlane->common : zget($this->lang->kanban->laneTypeList, $lane->type) . $this->lang->colon . $this->lang->kanban->setLane; + $this->view->lane = $lane; + $this->view->from = $from; + + $this->display(); + } + + /** + * Edit lane's color + * + * @param int $laneID + * @param int $executionID + * @param string $from + * @access public + * @return void + */ + public function editLaneColor($laneID, $executionID = 0, $from = 'kanban') + { + if($_POST) + { + $this->kanban->setLane($laneID); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + + $this->loadModel('action')->create('kanbanlane', $laneID, 'Edited', '', $executionID); + + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + } + + $lane = $this->kanban->getLaneById($laneID); + if(!$lane) return print(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'kanban', "executionID=$executionID"))); + + $this->view->title = $from == 'kanban' ? $this->lang->edit . '“' . $lane->name . '”' . $this->lang->kanbanlane->common : zget($this->lang->kanban->laneTypeList, $lane->type) . $this->lang->colon . $this->lang->kanban->setLane; + $this->view->lane = $lane; + $this->view->from = $from; + + $this->display(); + } /** * Set lane column info. * diff --git a/module/kanban/css/editlanecolor.css b/module/kanban/css/editlanecolor.css new file mode 100644 index 0000000000..1ae9a01187 --- /dev/null +++ b/module/kanban/css/editlanecolor.css @@ -0,0 +1,4 @@ +td>ul {padding-left: 0;} +li {display: block; float: left; padding: 5px; width: 28px; height: 28px;} +li>a { position: relative; display: block; width: 100%; height: 100%; padding: 0; margin: 0; font-family: ZentaoIcon; font-size: 14px; font-style: normal; font-weight: 400; font-variant: normal; line-height: 1; text-align: center; text-transform: none; border: 1px solid transparent; border-radius: 50%; speak: none; -webkit-font-smoothing: antialiased; } +li>a.active:before {font-size: 14px; content: "\e5ca"} diff --git a/module/kanban/js/editlanecolor.js b/module/kanban/js/editlanecolor.js new file mode 100644 index 0000000000..a01570f547 --- /dev/null +++ b/module/kanban/js/editlanecolor.js @@ -0,0 +1,13 @@ +/** + * Set lane color. + * + * @param string $color + * @access public + * @return void + */ +function setColor(color) +{ + $('.cp-tile').removeClass('active'); + $('.cp-tile[data-color="' + color + '"]').addClass('active'); + $('#color').val(color); +} diff --git a/module/kanban/js/view.js b/module/kanban/js/view.js index ea4176e296..b88c734a0c 100644 --- a/module/kanban/js/view.js +++ b/module/kanban/js/view.js @@ -225,13 +225,14 @@ function renderCount($count, count, column) */ function renderLaneName($lane, lane, $kanban, columns, kanban) { - var canSet = lane.actions.includes('setLane'); - var canSort = lane.actions.includes('sortLane') && kanban.lanes.length > 1; - var canDelete = lane.actions.includes('deleteLane'); + var canEditLaneColor = lane.actions.includes('editLaneColor'); + var canEditLaneName = lane.actions.includes('editLaneName'); + var canSort = lane.actions.includes('sortLane') && kanban.lanes.length > 1; + var canDelete = lane.actions.includes('deleteLane'); $lane.parent().toggleClass('sort', canSort); - if(!$lane.children('.actions').length && (canSet || canDelete) && (CRKanban || kanbanInfo.status != 'closed')) + if(!$lane.children('.actions').length && (canEditLaneColor || canEditLaneName || canDelete) && (CRKanban || kanbanInfo.status != 'closed')) { $([ '
', @@ -1094,7 +1095,8 @@ function createLaneMenu(options) if(!privs.length) return []; var items = []; - if(privs.includes('setLane')) items.push({label: kanbanLang.setLane, icon: 'edit', url: createLink('kanban', 'setLane', 'laneID=' + lane.id + '&executionID=0&from=kanban'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '635px'}}); + if(privs.includes('editLaneName')) items.push({label: kanbanLang.editLaneName, icon: 'edit', url: createLink('kanban', 'editLaneName', 'laneID=' + lane.id + '&executionID=0&from=kanban'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '635px'}}); + if(privs.includes('editLaneColor')) items.push({label: kanbanLang.editLaneColor, icon: 'color', url: createLink('kanban', 'editLaneColor', 'laneID=' + lane.id + '&executionID=0&from=kanban'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '635px'}}); if(privs.includes('deleteLane')) items.push({label: kanbanLang.deleteLane, icon: 'trash', url: createLink('kanban', 'deleteLane', 'lane=' + lane.id), attrs: {'target': 'hiddenwin'}}); var bounds = options.$trigger[0].getBoundingClientRect(); diff --git a/module/kanban/lang/en.php b/module/kanban/lang/en.php index b5e565dc96..7075a83218 100644 --- a/module/kanban/lang/en.php +++ b/module/kanban/lang/en.php @@ -174,7 +174,9 @@ $lang->kanban->WIPType = 'WIP Type'; $lang->kanban->WIPCount = 'WIP Count'; $lang->kanban->noLimit = 'No Limit ∞'; $lang->kanban->setLane = 'Lane Settings'; +$lang->kanban->editLaneName = 'Edit Lane Name'; $lang->kanban->laneName = 'Lane Name'; +$lang->kanban->editLaneColor = 'Edit Lane Color'; $lang->kanban->laneColor = 'Lane Color'; $lang->kanban->setColumn = 'Column Settings'; $lang->kanban->columnName = 'Column Name'; diff --git a/module/kanban/lang/zh-cn.php b/module/kanban/lang/zh-cn.php index e5956c4713..773be7451e 100644 --- a/module/kanban/lang/zh-cn.php +++ b/module/kanban/lang/zh-cn.php @@ -174,7 +174,9 @@ $lang->kanban->WIPType = '在制品类型'; $lang->kanban->WIPCount = '在制品数量'; $lang->kanban->noLimit = '不限制∞'; $lang->kanban->setLane = '泳道设置'; +$lang->kanban->editLaneName = '修改泳道名'; $lang->kanban->laneName = '泳道名称'; +$lang->kanban->editLaneColor = '设置背景色'; $lang->kanban->laneColor = '泳道颜色'; $lang->kanban->setColumn = '看板列设置'; $lang->kanban->columnName = '看板列名称'; diff --git a/module/kanban/model.php b/module/kanban/model.php index 94c0aad1c7..edd56df97e 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -945,7 +945,7 @@ class kanbanModel extends model ->orderBy('order') ->fetchGroup('group'); - $actions = array('setLane', 'sortLane', 'deleteLane'); + $actions = array('sortLane', 'deleteLane', 'editLaneName', 'editLaneColor'); foreach($laneGroup as $lanes) { foreach($lanes as $lane) diff --git a/module/kanban/view/editlanecolor.html.php b/module/kanban/view/editlanecolor.html.php new file mode 100644 index 0000000000..af99b5ceed --- /dev/null +++ b/module/kanban/view/editlanecolor.html.php @@ -0,0 +1,45 @@ + + * @package kanban + * @version $Id: setlane.html.php 935 2021-10-26 16:24:24Z liyuchun@easycorp.ltd $ + * @link https://www.zentao.net + */ +?> + +
+
+
+

+ kanban->editLaneColor;?> +

+
+
+ + + + + + + + +
kanban->laneColor;?> + color, "class='form-control'");?> + +
+ +
+
+
+
+ diff --git a/module/kanban/view/editlanename.html.php b/module/kanban/view/editlanename.html.php new file mode 100644 index 0000000000..b498f4f60e --- /dev/null +++ b/module/kanban/view/editlanename.html.php @@ -0,0 +1,47 @@ + + * @package kanban + * @version $Id: setlane.html.php 935 2021-10-26 16:24:24Z liyuchun@easycorp.ltd $ + * @link https://www.zentao.net + */ +?> + +
+
+
+

+ kanban->editLaneName;?> +

+
+
+ + + + + + + + + + + + + + + +
kanban->laneName;?> + name, "class='form-control'");?> +
kanban->WIPType;?> + kanban->laneTypeList, $lane->type), "class='form-control' disabled");?> +
+ +
+
+
+
+