* Finish task #46151.

This commit is contained in:
tianshujie
2021-12-17 15:11:26 +08:00
parent cd4b1019ef
commit 2628b1c33f
5 changed files with 59 additions and 24 deletions
+2 -2
View File
@@ -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'));
+2 -3
View File
@@ -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;}
+3
View File
@@ -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}
+16 -7
View File
@@ -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.
+36 -12
View File
@@ -22,10 +22,18 @@
<tr>
<td class='c-id'><strong><?php echo $i;?></strong></td>
<td class='c-nameTitle'><strong><?php echo $lang->kanbancolumn->childName;?></strong></td>
<td class='c-name required'><?php echo html::input("name[$i]", '', "class='form-control'");?></td>
<td class='c-colorTitle'><strong><?php echo $lang->kanbancolumn->childColor;?></strong></td>
<td class='c-color required'><?php echo html::select("color[$i]", '', '', "class='form-control chosen'");?></td>
<td class='c-colorTitle'><strong><?php echo $lang->kanban->WIPCount;?></strong></td>
<td class='c-color required'>
<div class="input-control has-icon-right">
<?php echo html::input("name[$i]", '', "class='form-control' id='name$i'");?>
<div class="colorpicker">
<button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown"><span class="cp-title"></span><span class="color-bar"></span><i class="ic"></i></button>
<ul class="dropdown-menu clearfix">
</ul>
<input type='hidden' id='color<?php echo $i;?>' name="color[<?php echo $i;?>]" class='form-control'data-icon="color" data-provide='colorpicker' data-wrapper='input-control-icon-right' data-pull-menu-right="true" data-optional='false' value='#333' data-colors="<?php echo implode(',', $config->kanban->columnColorList);?>">
</div>
</div>
</td>
<td class='c-WIPTitle'><strong><?php echo $lang->kanban->WIPCount;?></strong></td>
<td class='c-WIPCount required'>
<div class="table-col">
<?php echo html::input("WIPCount[$i]", '', "class='form-control' disabled id='WIPCount$i'");?>
@@ -44,10 +52,18 @@
<tr>
<td class='c-id'><strong><?php echo $i;?></strong></td>
<td class='c-nameTitle'><strong><?php echo $lang->kanbancolumn->childName;?></strong></td>
<td class='c-name required'><?php echo html::input("name[$i]", '', "class='form-control'");?></td>
<td class='c-colorTitle'><strong><?php echo $lang->kanbancolumn->childColor;?></strong></td>
<td class='c-color required'><?php echo html::select("color[$i]", '', '', "class='form-control chosen'");?></td>
<td class='c-colorTitle'><strong><?php echo $lang->kanban->WIPCount;?></strong></td>
<td class='c-color required'>
<div class="input-control has-icon-right">
<?php echo html::input("name[$i]", '', "class='form-control' id='name$i'");?>
<div class="colorpicker">
<button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown"><span class="cp-title"></span><span class="color-bar"></span><i class="ic"></i></button>
<ul class="dropdown-menu clearfix">
</ul>
<input type='hidden' id='color<?php echo $i;?>' name="color[<?php echo $i;?>]" class='form-control'data-icon="color" data-provide='colorpicker' data-wrapper='input-control-icon-right' data-pull-menu-right="true" data-optional='false' value='#333' data-colors="<?php echo implode(',', $config->kanban->columnColorList);?>">
</div>
</div>
</td>
<td class='c-WIPTitle'><strong><?php echo $lang->kanban->WIPCount;?></strong></td>
<td class='c-WIPCount required'>
<div class="table-col">
<?php echo html::input("WIPCount[$i]", '', "class='form-control' disabled id='WIPCount$i'");?>
@@ -84,10 +100,18 @@
<tr id='addItem' class='hidden'>
<td class='c-id'><strong><?php echo $i;?></strong></td>
<td class='c-nameTitle'><strong><?php echo $lang->kanbancolumn->childName;?></strong></td>
<td class='c-name required'><?php echo html::input("name[$i]", '', "class='form-control'");?></td>
<td class='c-colorTitle'><strong><?php echo $lang->kanbancolumn->childColor;?></strong></td>
<td class='c-color required'><?php echo html::select("color[$i]", '', '', "class='form-control chosen'");?></td>
<td class='c-colorTitle'><strong><?php echo $lang->kanban->WIPCount;?></strong></td>
<td class='c-color required'>
<div class="input-control has-icon-right">
<?php echo html::input("name[$i]", '', "class='form-control' id='name$i'");?>
<div class="colorpicker">
<button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown"><span class="cp-title"></span><span class="color-bar"></span><i class="ic"></i></button>
<ul class="dropdown-menu clearfix">
</ul>
<input type='hidden' id='color<?php echo $i;?>' name="color[<?php echo $i;?>]" class='form-control'data-icon="color" data-provide='colorpicker' data-wrapper='input-control-icon-right' data-pull-menu-right="true" data-optional='false' value='#333' data-colors="<?php echo implode(',', $config->kanban->columnColorList);?>">
</div>
</div>
</td>
<td class='c-WIPTitle'><strong><?php echo $lang->kanban->WIPCount;?></strong></td>
<td class='c-WIPCount required'>
<div class="table-col">
<?php echo html::input("WIPCount[$i]", '', "class='form-control' disabled id='WIPCount$i'");?>