From 42370222fc8f871fdfd6c1614f867d506432ef74 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 9 Dec 2021 16:40:44 +0800 Subject: [PATCH 01/13] * Finish task #45831. --- module/kanban/control.php | 36 ++++++++- module/kanban/model.php | 125 +++++++++++++++++++----------- module/kanban/view/close.html.php | 2 +- module/kanban/view/edit.html.php | 63 +++++++++++++++ 4 files changed, 174 insertions(+), 52 deletions(-) create mode 100644 module/kanban/view/edit.html.php diff --git a/module/kanban/control.php b/module/kanban/control.php index d95c6c8722..3351b806a3 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -111,7 +111,35 @@ class kanban extends control $this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed'); $this->view->spaceID = $spaceID; $this->view->spacePairs = array('' => '') + $this->kanban->getSpacePairs(); - + + $this->display(); + } + + /** + * Edit a kanban. + * + * @param int $kanbanID + * @access public + * @return void + */ + public function edit($kanbanID = 0) + { + if(!empty($_POST)) + { + $changes = $this->kanban->update($kanbanID); + + if(dao::isError()) die(js::error(dao::getError())); + + $this->loadModel('action')->create('kanban', $kanbanID, 'edited'); + $this->action->logHistory($actionID, $changes); + + die(js::reload('parent.parent')); + } + + $this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed'); + $this->view->spacePairs = array('' => '') + $this->kanban->getSpacePairs(); + $this->view->kanban = $this->kanban->getByID($kanbanID); + $this->display(); } @@ -147,8 +175,8 @@ class kanban extends control /** * View a kanban. - * - * @param int $kanbanID + * + * @param int $kanbanID * @access public * @return void */ @@ -158,7 +186,7 @@ class kanban extends control $this->view->regions = $this->kanban->getKanbanData($kanbanID); $this->view->kanban = $kanban; - + $this->display(); } diff --git a/module/kanban/model.php b/module/kanban/model.php index 8fcac94cde..421c55d44a 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -15,8 +15,8 @@ class kanbanModel extends model { /** * Init a kanban. - * - * @param int $kanbanID + * + * @param int $kanbanID * @param string $type default|new * @access public * @return void @@ -41,11 +41,11 @@ class kanbanModel extends model /** * Create a kanban group. - * - * @param int $kanbanID - * @param int $regionID + * + * @param int $kanbanID + * @param int $regionID * @access public - * @return int + * @return int */ public function createGroup($kanbanID, $regionID) { @@ -73,10 +73,10 @@ class kanbanModel extends model /** * Create a default kanban region. - * - * @param object $kanban + * + * @param object $kanban * @access public - * @return int + * @return int */ public function createDefaultRegion($kanban) { @@ -92,11 +92,11 @@ class kanbanModel extends model /** * Create a new region. - * - * @param object $kanban - * @param object $region + * + * @param object $kanban + * @param object $region * @access public - * @return int + * @return int */ public function createRegion($kanban, $region = null) { @@ -104,7 +104,7 @@ class kanbanModel extends model $order = 1; if(!$region) - { + { $maxOrder = $this->dao->select('MAX(`order`) AS maxOrder')->from(TABLE_KANBANORDER) ->where('objectType')->eq('region') ->andWhere('parentID')->eq($kanban->id) @@ -137,12 +137,12 @@ class kanbanModel extends model /** * Create default lane. - * - * @param object $kanban + * + * @param object $kanban * @param int $regionID * @param int $groupID * @access public - * @return int + * @return int */ public function createDefaultLane($kanban, $regionID, $groupID) { @@ -162,8 +162,8 @@ class kanbanModel extends model /** * Create default kanban columns. - * - * @param object $kanban + * + * @param object $kanban * @param int $regionID * @param int $groupID * @access public @@ -192,13 +192,13 @@ class kanbanModel extends model /** * Save kanban object order. - * - * @param int $parentID - * @param string $parentType - * @param int $objectID - * @param string $objectType - * @param string $account - * @param int $order + * + * @param int $parentID + * @param string $parentType + * @param int $objectID + * @param string $objectType + * @param string $account + * @param int $order * @access public * @return void */ @@ -217,11 +217,11 @@ class kanbanModel extends model } /** - * Get kanban by id. - * - * @param int $kanbanID + * Get kanban by id. + * + * @param int $kanbanID * @access public - * @return object + * @return object */ public function getByID($kanbanID) { @@ -230,8 +230,8 @@ class kanbanModel extends model /** * Get kanban data. - * - * @param int $kanbanID + * + * @param int $kanbanID * @access public * @return void */ @@ -281,13 +281,13 @@ class kanbanModel extends model /** * Get ordered region pairs. - * - * @param int $kanbanID + * + * @param int $kanbanID * @access public - * @return array + * @return array */ public function getRegionPairs($kanbanID) - { + { return $this->dao->select('id,name')->from(TABLE_KANBANREGION) ->where('kanban')->eq($kanbanID) ->andWhere('deleted')->eq('0') @@ -297,10 +297,10 @@ class kanbanModel extends model /** * Get kanban group by regions. - * - * @param array $regions + * + * @param array $regions * @access public - * @return array + * @return array */ public function getGroupGroupByRegions($regions) { @@ -312,10 +312,10 @@ class kanbanModel extends model /** * Get lane group by regions. - * - * @param array $regions + * + * @param array $regions * @access public - * @return array + * @return array */ public function getLaneGroupByRegions($regions) { @@ -342,11 +342,11 @@ class kanbanModel extends model } /** - * Get column group by regions. - * - * @param array $regions + * Get column group by regions. + * + * @param array $regions * @access public - * @return array + * @return array */ public function getColumnGroupByRegions($regions) { @@ -386,7 +386,7 @@ class kanbanModel extends model $columnData[$group][] = $parentColumn; foreach($columnGroup[$group] as $column) { - if($column->parent == $parentColumn->id) + if($column->parent == $parentColumn->id) { $parentColumn->asParent = true; @@ -694,6 +694,37 @@ class kanbanModel extends model } } + /** + * Update a kanban. + * + * @param int $kanbanID + * @access public + * @return array + */ + public function update($kanbanID) + { + $kanbanID = (int)$kanbanID; + $account = $this->app->user->account; + $oldKanban = $this->getByID($kanbanID); + $kanban = fixer::input('post') + ->setDefault('lastEditedBy', $account) + ->setDefault('lastEditedDate', helper::now()) + ->join('whitelist', ',') + ->join('team', ',') + ->remove('uid,contactListMenu') + ->get(); + + if(strpos(",{$kanban->team},", ",$account,") === false and $kanban->owner != $account) $kanban->team .= ",$account"; + + $this->dao->update(TABLE_KANBAN)->data($kanban) + ->autoCheck() + ->batchCheck($this->config->kanban->edit->requiredFields, 'notempty') + ->where('id')->eq($kanbanID) + ->exec(); + + if(!dao::isError()) return common::createChanges($oldSpace, $space); + } + /** * Close a kanban. * diff --git a/module/kanban/view/close.html.php b/module/kanban/view/close.html.php index 9da569e29a..231875aa7f 100644 --- a/module/kanban/view/close.html.php +++ b/module/kanban/view/close.html.php @@ -4,7 +4,7 @@ * * @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com) * @license ZPL (http://zpl.pub/page/zplv12.html) - * @author Mengyi Liu + * @author Mengyi Liu * @package kanban * @version $Id: close.html.php 935 2021-12-09 10:49:24Z $ * @link https://www.zentao.net diff --git a/module/kanban/view/edit.html.php b/module/kanban/view/edit.html.php new file mode 100644 index 0000000000..c032f594da --- /dev/null +++ b/module/kanban/view/edit.html.php @@ -0,0 +1,63 @@ + + * @package kanban + * @version $Id: edit.html.php 935 2021-12-09 16:15:24Z $ + * @link https://www.zentao.net + */ +?> + + +
+
+

kanban->create;?>

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
kanban->space;?>space, "class='form-control chosen'");?>
kanban->name;?>name, "class='form-control'");?>
kanban->owner;?>owner, "class='form-control chosen'");?>
kanban->team;?> +
+ team, "class='form-control chosen' multiple");?> + fetch('my', 'buildContactLists');?> +
+
kanban->desc;?> + fetch('user', 'ajaxPrintTemplates', 'type=kanban&link=desc');?> + desc, "rows='10' class='form-control'");?> +
kanban->acl;?>kanban->aclList, $kanban->acl, "onclick='setWhite(this.value);'", 'block'));?>
whitelist;?>whitelist, 'class="form-control chosen" multiple');?>
+
+
+ From de5c753de9f13a4f0feea2448dfc724decd893cc Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 9 Dec 2021 16:46:02 +0800 Subject: [PATCH 02/13] * Modify edit HTML file. --- module/kanban/view/edit.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/kanban/view/edit.html.php b/module/kanban/view/edit.html.php index c032f594da..883087f003 100644 --- a/module/kanban/view/edit.html.php +++ b/module/kanban/view/edit.html.php @@ -14,7 +14,7 @@
-

kanban->create;?>

+

kanban->edit;?>

From 006fca3fe3f1afa62d39515c9bab807cdebe4ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Thu, 9 Dec 2021 16:53:53 +0800 Subject: [PATCH 03/13] * Finish task #45818. --- module/common/view/header.html.php | 1 + module/kanban/control.php | 2 ++ module/kanban/js/view.js | 2 +- module/kanban/lang/zh-cn.php | 2 ++ module/kanban/model.php | 28 ++++++++++++++++++++++++++++ www/theme/default/style.css | 5 +++++ 6 files changed, 39 insertions(+), 1 deletion(-) diff --git a/module/common/view/header.html.php b/module/common/view/header.html.php index e0717d2dee..b265355b70 100755 --- a/module/common/view/header.html.php +++ b/module/common/view/header.html.php @@ -15,6 +15,7 @@ include 'chosen.html.php'; switcherMenu) ? $lang->switcherMenu : '';?> +
headerActions)) echo $lang->headerActions;?>
+ + + + + + + + + + + + + + + + + + + + + + +
kanbanlane->name;?> +
+ +
kanbanlane->column;?>kanbanlane->modeList, 'sameAsOther');?>
kanbanlane->otherlane;?>
kanbanlane->color;?> +
+ +
+ + cancel);?> +
+
+
+ + From e8cd54a0fd06137a583a6c6a62f46fbd892888d1 Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Fri, 10 Dec 2021 09:59:25 +0800 Subject: [PATCH 11/13] *Finish task #45822. --- module/kanban/control.php | 2 +- module/kanban/js/common.js | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/module/kanban/control.php b/module/kanban/control.php index f755d4d00f..1a545824f5 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -149,7 +149,7 @@ class kanban extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'callback' => 'closeModalAndUpdateKanban', 'callback_params' => $regionID)); } - $this->view->lanes = $this->kanban->getLanePairsByRegion($regionID); + $this->view->lanes = $this->kanban->getLanePairsByRegion($regionID); $this->display(); } diff --git a/module/kanban/js/common.js b/module/kanban/js/common.js index e42853624c..c9c0f63ded 100644 --- a/module/kanban/js/common.js +++ b/module/kanban/js/common.js @@ -42,20 +42,20 @@ function initColorPicker() var selectedColor = $('input[name=color]').val(); if(selectedColor && $.inArray(selectedColor.toUpperCase(), colorList) == -1) colorList.unshift(selectedColor); colorList.forEach(function(color, index) - { - var itemClass = color.toUpperCase() == $('input[name=color]').val().toUpperCase() ? 'color-picker-item checked' : 'color-picker-item'; - var colorItem = "
"; - colorItem += ""; - colorItem += "
"; - $('#color-picker').append(colorItem); - }); + { + var itemClass = color.toUpperCase() == $('input[name=color]').val().toUpperCase() ? 'color-picker-item checked' : 'color-picker-item'; + var colorItem = "
"; + colorItem += ""; + colorItem += "
"; + $('#color-picker').append(colorItem); + }); $('.color-picker-item').click(function() - { - var color = $(this).attr('data-color'); - $('input[name=color]').val(color); - $(this).addClass('checked'); - $(this).siblings().removeClass('checked'); - }) + { + var color = $(this).attr('data-color'); + $('input[name=color]').val(color); + $(this).addClass('checked'); + $(this).siblings().removeClass('checked'); + }) } From e7fb8aded2b27169a1c910e1154975c1eade73d3 Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Fri, 10 Dec 2021 10:03:56 +0800 Subject: [PATCH 12/13] *Finish task #45822. --- module/kanban/js/createlane.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/kanban/js/createlane.js b/module/kanban/js/createlane.js index 610b2c6c6b..0697434ca9 100644 --- a/module/kanban/js/createlane.js +++ b/module/kanban/js/createlane.js @@ -3,8 +3,8 @@ $(document).ready(function() initColorPicker(); $('input[name=mode]').change(function() - { - $('#otherLane').parents('tr').toggle($(this).val() == 'sameAsOther'); - }); + { + $('#otherLane').parents('tr').toggle($(this).val() == 'sameAsOther'); + }); }) From 5fbecc7204283df24f94b8ec06d278e74e4425fe Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Fri, 10 Dec 2021 10:06:21 +0800 Subject: [PATCH 13/13] *Finish task #45822. --- module/kanban/js/common.js | 26 +++++++++++++------------- module/kanban/js/createlane.js | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/module/kanban/js/common.js b/module/kanban/js/common.js index c9c0f63ded..1fd04e200d 100644 --- a/module/kanban/js/common.js +++ b/module/kanban/js/common.js @@ -42,20 +42,20 @@ function initColorPicker() var selectedColor = $('input[name=color]').val(); if(selectedColor && $.inArray(selectedColor.toUpperCase(), colorList) == -1) colorList.unshift(selectedColor); colorList.forEach(function(color, index) - { - var itemClass = color.toUpperCase() == $('input[name=color]').val().toUpperCase() ? 'color-picker-item checked' : 'color-picker-item'; - var colorItem = "
"; - colorItem += ""; - colorItem += "
"; - $('#color-picker').append(colorItem); - }); + { + var itemClass = color.toUpperCase() == $('input[name=color]').val().toUpperCase() ? 'color-picker-item checked' : 'color-picker-item'; + var colorItem = "
"; + colorItem += ""; + colorItem += "
"; + $('#color-picker').append(colorItem); + }); $('.color-picker-item').click(function() - { - var color = $(this).attr('data-color'); - $('input[name=color]').val(color); - $(this).addClass('checked'); - $(this).siblings().removeClass('checked'); - }) + { + var color = $(this).attr('data-color'); + $('input[name=color]').val(color); + $(this).addClass('checked'); + $(this).siblings().removeClass('checked'); + }) } diff --git a/module/kanban/js/createlane.js b/module/kanban/js/createlane.js index 0697434ca9..a2fe47e34c 100644 --- a/module/kanban/js/createlane.js +++ b/module/kanban/js/createlane.js @@ -3,8 +3,8 @@ $(document).ready(function() initColorPicker(); $('input[name=mode]').change(function() - { - $('#otherLane').parents('tr').toggle($(this).val() == 'sameAsOther'); - }); + { + $('#otherLane').parents('tr').toggle($(this).val() == 'sameAsOther'); + }); })