diff --git a/module/kanban/control.php b/module/kanban/control.php index b640911151..48e0cac930 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -426,7 +426,7 @@ class kanban extends control if($_POST) { $order = $position == 'left' ? $column->order : $column->order + 1; - $columnID = $this->kanban->createColumn($column->region, null, $order); + $columnID = $this->kanban->createColumn($column->region, null, $order, $column->parent); if(dao::isError()) $this->send(array('message' => dao::getError(), 'result' => 'fail')); $this->loadModel('action')->create('kanbanColumn', $columnID, 'Created'); @@ -447,7 +447,7 @@ class kanban extends control */ public function splitColumn($columnID) { - if(!empty($_POST['name'])) + if(!empty($_POST)) { $this->kanban->splitColumn($columnID); if(dao::isError()) $this->send(array('message' => dao::getError(), 'result' => 'fail')); diff --git a/module/kanban/css/splitcolumn.css b/module/kanban/css/splitcolumn.css index e78a85f8c6..7231140e71 100644 --- a/module/kanban/css/splitcolumn.css +++ b/module/kanban/css/splitcolumn.css @@ -1,8 +1,7 @@ .c-id {width: 10px;} .c-nameTitle {width: 66px;} -.c-name {width: 160px;} -.c-colorTitle {width: 80px; padding-left: 15px !important; padding-right: 0px !important;} -.c-color {width: 120px;} +.c-WIPTitle {width: 80px; padding-left: 15px !important; padding-right: 0px !important;} +.c-color {width: 320px;} .c-WIPCount {width: 240px;} td.required:after {right: -1px;} .c-action {width: 80px;} diff --git a/module/kanban/css/view.css b/module/kanban/css/view.css index c033898342..db49e1e1ae 100644 --- a/module/kanban/css/view.css +++ b/module/kanban/css/view.css @@ -38,6 +38,9 @@ body {background-color: #fff} .region .kanban-header-col > .title > .text-grey {opacity: .5; font-weight: bold; color: #8b91a2;} .region .kanban-header-col > .title > .count {opacity: .5; font-weight: bold; color: #8b91a2;} .region .kanban-header-col > .title > .error {color: #333333; padding-left: 5px} +.region .kanban-header-col > .actions {position: relative; right: -30px;} +.region .kanban-header-parent-col > .actions {position: absolute; right: 0px;} +.region .kanban-header-sub-cols .actions {position: absolute; right: 0px;} .region .kanban-lane {position: relative; border-bottom: none!important; min-height: 200px !important} .region .kanban-lane {min-width: max-content; min-width: -moz-max-content} diff --git a/module/kanban/model.php b/module/kanban/model.php index bb3657a82b..bc7e89386a 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -228,12 +228,13 @@ class kanbanModel extends model * @access public * @return int */ - public function createColumn($regionID, $column = null, $order = 0) + public function createColumn($regionID, $column = null, $order = 0, $parent = 0) { if(empty($column)) { $column = fixer::input('post') ->add('region', $regionID) + ->add('parent', $parent) ->setIF($order, 'order', $order) ->setDefault('color', '#333') ->trim('name') @@ -267,7 +268,7 @@ class kanbanModel extends model if($parentColumn->limit) { /* The WIP of the child column is infinite or greater than the WIP of the parent column. */ - if(!$limit || $limit > $parentColumn->limit) + if(!$limit or ($limit > $parentColumn->limit and $parentColumn->limit != -1)) { dao::$errors['limit'][] = $this->lang->kanban->error->parentLimitNote; return false; @@ -277,7 +278,7 @@ class kanbanModel extends model foreach($childColumns as $childColumn) { $limit += (int)$childColumn->limit; - if($limit > $parentColumn->limit) + if($limit > $parentColumn->limit and $parentColumn->limit != -1) { /* The total WIP of the child columns is greater than the WIP of the parent column. */ dao::$errors['limit'][] = $this->lang->kanban->error->childLimitNote; @@ -345,6 +346,12 @@ class kanbanModel extends model return false; } + if(empty($childColumn->name)) + { + dao::$errors['name'] = sprintf($this->lang->error->notempty, $this->lang->kanbancolumn->name); + return false; + } + $sumChildLimit += $childColumn->limit; if($column->limit != -1 and ($childColumn->limit == -1 or ($column->limit < $sumChildLimit))) { @@ -371,6 +378,8 @@ class kanbanModel extends model $this->action->create('kanbanColumn', $childColumnID, 'created'); } } + + $this->dao->update(TABLE_KANBANCOLUMN)->set('parent')->eq(-1)->where('id')->eq($columnID)->exec(); } /** @@ -632,7 +641,7 @@ class kanbanModel extends model if($this->isClickable($column, $action)) $column->actions[] = $action; } - if($column->parent) continue; + if($column->parent and $column->parent != -1) continue; $parentColumnGroup[$group][] = $column; } @@ -2012,7 +2021,7 @@ class kanbanModel extends model { return $this->dao->select('*')->from(TABLE_KANBANCOLUMN) ->where('parent')->eq($parentID) - ->andWhere('archived')->eq($archived) + //->andWhere('archived')->eq($archived) ->andWhere('deleted')->eq($deleted) ->orderBy('order') ->fetchAll('id'); @@ -2193,8 +2202,8 @@ class kanbanModel extends model ->beginIF($action == 'sortlane')->andWhere('`group`')->eq($object->group)->fi() ->fetch('count'); return $count > 1; - case 'createcolumn' : - case 'copycolumn' : + case 'createColumn' : + case 'copyColumn' : case 'splitcolumn' : if($object->parent) return false; // The current column is a child column. diff --git a/module/kanban/view/splitcolumn.html.php b/module/kanban/view/splitcolumn.html.php index ac4503aab6..e4e806f8ee 100644 --- a/module/kanban/view/splitcolumn.html.php +++ b/module/kanban/view/splitcolumn.html.php @@ -22,10 +22,18 @@