* Finish task #45831.

This commit is contained in:
liumengyi
2021-12-09 16:40:44 +08:00
parent f35a970a5f
commit 42370222fc
4 changed files with 174 additions and 52 deletions
+32 -4
View File
@@ -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();
}
+78 -47
View File
@@ -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.
*
+1 -1
View File
@@ -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 <fujia@cnezsoft.com>
* @author Mengyi Liu <liumengyi@easycorp.ltd>
* @package kanban
* @version $Id: close.html.php 935 2021-12-09 10:49:24Z $
* @link https://www.zentao.net
+63
View File
@@ -0,0 +1,63 @@
<?php
/**
* The edit file of kanban module of ZenTaoPMS.
*
* @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 <liumengyi@easycorp.ltd>
* @package kanban
* @version $Id: edit.html.php 935 2021-12-09 16:15:24Z $
* @link https://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<div id='mainContent' class='main-content'>
<div class='main-header'>
<h2><?php echo $lang->kanban->create;?></h2>
</div>
<form class='form-indicator main-form' method='post' target='hiddenwin' id='dataform'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->kanban->space;?></th>
<td><?php echo html::select('space', $spacePairs, $kanban->space, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->kanban->name;?></th>
<td><?php echo html::input('name', $kanban->name, "class='form-control'");?></td>
</tr>
<tr>
<th><?php echo $lang->kanban->owner;?></th>
<td><?php echo html::select('owner', $users, $kanban->owner, "class='form-control chosen'");?></td>
</tr>
<tr>
<th><?php echo $lang->kanban->team;?></th>
<td colspan='2'>
<div class="input-group">
<?php echo html::select('team[]', $users, $kanban->team, "class='form-control chosen' multiple");?>
<?php echo $this->fetch('my', 'buildContactLists');?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->kanban->desc;?></th>
<td colspan='2'>
<?php echo $this->fetch('user', 'ajaxPrintTemplates', 'type=kanban&link=desc');?>
<?php echo html::textarea('desc', $kanban->desc, "rows='10' class='form-control'");?>
</td>
</tr>
<tr>
<th><?php echo $lang->kanban->acl;?></th>
<td colspan='2'><?php echo nl2br(html::radio('acl', $lang->kanban->aclList, $kanban->acl, "onclick='setWhite(this.value);'", 'block'));?></td>
</tr>
<tr id="whitelistBox">
<th><?php echo $lang->whitelist;?></th>
<td><?php echo html::select('whitelist[]', $users, $kanban->whitelist, 'class="form-control chosen" multiple');?></td>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'><?php echo html::submitButton();?></td>
</tr>
</table>
</form>
</div>
<?php include '../../common/view/footer.html.php';?>