Merge branch 'kanban' of https://gitlab.zcorp.cc/easycorp/zentaopms into sprint/179_tianshujie_46151
This commit is contained in:
@@ -14,6 +14,7 @@ $config->kanban->create = new stdclass();
|
||||
$config->kanban->edit = new stdclass();
|
||||
$config->kanban->createspace = new stdclass();
|
||||
$config->kanban->editspace = new stdclass();
|
||||
$config->kanban->createregion = new stdclass();
|
||||
$config->kanban->createcard = new stdclass();
|
||||
$config->kanban->editcard = new stdclass();
|
||||
$config->kanban->editregion = new stdclass();
|
||||
@@ -26,6 +27,7 @@ $config->kanban->create->requiredFields = 'space,name';
|
||||
$config->kanban->edit->requiredFields = 'space,name';
|
||||
$config->kanban->createspace->requiredFields = 'name,owner';
|
||||
$config->kanban->editspace->requiredFields = 'name,owner';
|
||||
$config->kanban->createregion->requiredFields = 'name';
|
||||
$config->kanban->createcard->requiredFields = 'name';
|
||||
$config->kanban->editcard->requiredFields = 'name';
|
||||
$config->kanban->editregion->requiredFields = 'name';
|
||||
|
||||
@@ -288,6 +288,37 @@ class kanban extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a region.
|
||||
*
|
||||
* @param int $kanbanID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createRegion($kanbanID)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$kanban = $this->kanban->getByID($kanbanID);
|
||||
$copyRegionID = (int)$_POST['region'];
|
||||
unset($_POST['region']);
|
||||
|
||||
$regionID = $this->kanban->createRegion($kanban, '', $copyRegionID);
|
||||
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
|
||||
}
|
||||
|
||||
$regions = $this->kanban->getRegionPairs($kanbanID);
|
||||
$regionPairs = array();
|
||||
foreach($regions as $regionID => $region)
|
||||
{
|
||||
$regionPairs[$regionID] = $this->lang->kanban->copy . $region . $this->lang->kanban->styleCommon;
|
||||
}
|
||||
|
||||
$this->view->regions = array('custom' => $this->lang->kanban->custom) + $regionPairs;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
* Edit a region
|
||||
*
|
||||
* @param int $regionID
|
||||
@@ -537,6 +568,8 @@ class kanban extends control
|
||||
else
|
||||
{
|
||||
$this->kanban->delete(TABLE_KANBANCARD, $cardID);
|
||||
|
||||
if(isonlybody()) die(js::reload('parent.parent'));
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ $lang->kanban->createColumnOnRight = 'Create Column On Right';
|
||||
$lang->kanban->copyColumn = 'Copy Column';
|
||||
$lang->kanban->archiveColumn = 'Archive Column';
|
||||
$lang->kanban->spaceCommon = 'Kanban Space';
|
||||
$lang->kanban->styleCommon = 'Style';
|
||||
$lang->kanban->copy = 'Copy';
|
||||
$lang->kanban->custom = 'Custom';
|
||||
|
||||
/* Fields. */
|
||||
$lang->kanban->space = 'Space';
|
||||
@@ -229,6 +232,7 @@ $lang->kanbanlane->modeList['independent'] = 'Independent Kanban column is adopt
|
||||
$lang->kanbanregion = new stdclass();
|
||||
$lang->kanbanregion->name = 'Region Name';
|
||||
$lang->kanbanregion->default = 'Default Region';
|
||||
$lang->kanbanregion->style = 'Region Style';
|
||||
|
||||
$lang->kanbancard = new stdclass();
|
||||
$lang->kanbancard->create = 'Create Card';
|
||||
|
||||
@@ -40,6 +40,9 @@ $lang->kanban->createColumnOnRight = '右侧新增看板列';
|
||||
$lang->kanban->copyColumn = '复制看板列';
|
||||
$lang->kanban->archiveColumn = '归档看板列';
|
||||
$lang->kanban->spaceCommon = '看板空间';
|
||||
$lang->kanban->styleCommon = '样式';
|
||||
$lang->kanban->copy = '复制';
|
||||
$lang->kanban->custom = '自定义';
|
||||
|
||||
/* Fields. */
|
||||
$lang->kanban->space = '所属空间';
|
||||
@@ -229,6 +232,7 @@ $lang->kanbanlane->modeList['independent'] = '采用独立的看板列';
|
||||
$lang->kanbanregion = new stdclass();
|
||||
$lang->kanbanregion->name = '区域名称';
|
||||
$lang->kanbanregion->default = '默认区域';
|
||||
$lang->kanbanregion->style = '区域样式';
|
||||
|
||||
$lang->kanbancard = new stdclass();
|
||||
$lang->kanbancard->create = '创建卡片';
|
||||
|
||||
+61
-33
@@ -13,32 +13,6 @@
|
||||
<?php
|
||||
class kanbanModel extends model
|
||||
{
|
||||
/**
|
||||
* Init a kanban.
|
||||
*
|
||||
* @param int $kanbanID
|
||||
* @param string $type default|new
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function initKanban($kanbanID, $type = 'default')
|
||||
{
|
||||
$kanban = $this->getByID($kanbanID);
|
||||
|
||||
$function = $type == 'default' ? 'createDefaultRegion' : 'createRegion';
|
||||
$regionID = $this->$function($kanban);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$groupID = $this->createGroup($kanban->id, $regionID);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$this->createDefaultLane($kanban, $regionID, $groupID);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$this->createDefaultColumns($kanban, $regionID, $groupID);
|
||||
if(dao::isError()) return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a kanban group.
|
||||
*
|
||||
@@ -95,10 +69,11 @@ class kanbanModel extends model
|
||||
*
|
||||
* @param object $kanban
|
||||
* @param object $region
|
||||
* @param int $copyRegionID
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function createRegion($kanban, $region = null)
|
||||
public function createRegion($kanban, $region = null, $copyRegionID = 0)
|
||||
{
|
||||
$account = $this->app->user->account;
|
||||
$order = 1;
|
||||
@@ -130,9 +105,61 @@ class kanbanModel extends model
|
||||
->exec();
|
||||
|
||||
$regionID = $this->dao->lastInsertID();
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$this->loadModel('action')->create('kanbanRegion', $regionID, 'Created');
|
||||
$this->saveOrder($kanban->id, 'kanban', $regionID, 'region', $account, $order);
|
||||
|
||||
if($copyRegionID)
|
||||
{
|
||||
/* Gets the groups, lanes and columns of the replication region. */
|
||||
$copyGroups = $this->getGroupGroupByRegions($copyRegionID);
|
||||
$copyLaneGroup = $this->getLaneGroupByRegions($copyRegionID);
|
||||
$copyColumnGroup = $this->getColumnGroupByRegions($copyRegionID);
|
||||
|
||||
/* Create groups, lanes, and columns. */
|
||||
foreach($copyGroups[$copyRegionID] as $copyGroupID => $copyGroup)
|
||||
{
|
||||
$newGroupID = $this->createGroup($kanban->id, $regionID);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$copyLanes = $copyLaneGroup[$copyGroupID];
|
||||
$copyColumns = $copyColumnGroup[$copyGroupID];
|
||||
foreach($copyLanes as $copyLane)
|
||||
{
|
||||
unset($copyLane->id);
|
||||
unset($copyLane->actions);
|
||||
$copyLane->region = $regionID;
|
||||
$copyLane->group = $newGroupID;
|
||||
$copyLane->lastEditedTime = helper::now();
|
||||
$this->createLane($kanban->id, $regionID, $copyLane);
|
||||
if(dao::isError()) return false;
|
||||
}
|
||||
|
||||
foreach($copyColumns as $copyColumn)
|
||||
{
|
||||
unset($copyColumn->id);
|
||||
unset($copyColumn->actions);
|
||||
$copyColumn->region = $regionID;
|
||||
$copyColumn->group = $newGroupID;
|
||||
$this->createColumn($regionID, $copyColumn);
|
||||
if(dao::isError()) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$groupID = $this->createGroup($kanban->id, $regionID);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$this->createDefaultLane($kanban, $regionID, $groupID);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$this->createDefaultColumns($kanban, $regionID, $groupID);
|
||||
if(dao::isError()) return false;
|
||||
}
|
||||
|
||||
|
||||
return $regionID;
|
||||
}
|
||||
|
||||
@@ -442,11 +469,11 @@ class kanbanModel extends model
|
||||
*
|
||||
* @param int $regionID
|
||||
* @access public
|
||||
* @return array
|
||||
* @return object
|
||||
*/
|
||||
public function getRegionById($regionID)
|
||||
public function getRegionByID($regionID)
|
||||
{
|
||||
return $this->dao->findById($regionID)->from(TABLE_KANBANREGION)->fetch();
|
||||
return $this->dao->findByID($regionID)->from(TABLE_KANBANREGION)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -477,7 +504,7 @@ class kanbanModel extends model
|
||||
return $this->dao->select('*')->from(TABLE_KANBANGROUP)
|
||||
->where('region')->in($regions)
|
||||
->orderBy('id_asc')
|
||||
->fetchGroup('region');
|
||||
->fetchGroup('region', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -525,7 +552,7 @@ class kanbanModel extends model
|
||||
//->andWhere('archived')->eq('0')
|
||||
->andWhere('region')->in($regions)
|
||||
->orderBy('order')
|
||||
->fetchGroup('group', 'id');
|
||||
->fetchGroup('group');
|
||||
|
||||
$actions = array('createColumn', 'copyColumn', 'editColumn', 'splitColumn', 'setWIP', 'archiveColumn', 'restoreColumn', 'deleteColumn', 'createCard', 'splitColumn');
|
||||
|
||||
@@ -1021,9 +1048,10 @@ class kanbanModel extends model
|
||||
if(!dao::isError())
|
||||
{
|
||||
$kanbanID = $this->dao->lastInsertID();
|
||||
$kanban = $this->getByID($kanbanID);
|
||||
|
||||
$this->saveOrder(0, '', $kanbanID, 'kanban', '', $kanbanID);
|
||||
$this->initKanban($kanbanID);
|
||||
$this->createDefaultRegion($kanban);
|
||||
$this->file->saveUpload('kanban', $kanbanID);
|
||||
$this->file->updateObjectID($this->post->uid, $kanbanID, 'kanban');
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* The createregion 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 Shujie Tian <tianshujie@easycorp.ltd>
|
||||
* @package kanban
|
||||
* @version $Id: createregion.html.php 935 2021-12-15 16:23:24Z $
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><span><?php echo $lang->kanban->createRegion;?></span></h2>
|
||||
</div>
|
||||
<form method='post' enctype='multipart/form-data' class='main-form form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->kanbanregion->name;?></th>
|
||||
<td><?php echo html::input('name', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->kanbanregion->style;?></th>
|
||||
<td><?php echo html::radio('region', $regions, 'custom');?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='form-actions text-center'>
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::commonButton($lang->cancel, "data-dismiss='modal'", 'btn btn-wide');?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
Reference in New Issue
Block a user