* Add Kanban space creation function.

This commit is contained in:
tianshujie
2021-12-08 15:38:45 +08:00
parent f7440465d8
commit a0e40c020d
10 changed files with 159 additions and 2 deletions

View File

@@ -237,6 +237,7 @@ define('TABLE_RELATION', '`' . $config->db->prefix . 'relation`');
define('TABLE_REPOHISTORY', '`' . $config->db->prefix . 'repohistory`');
define('TABLE_REPOFILES', '`' . $config->db->prefix . 'repofiles`');
define('TABLE_REPOBRANCH', '`' . $config->db->prefix . 'repobranch`');
define('TABLE_KANBANSPACE', '`' . $config->db->prefix . 'kanbanspace`');
define('TABLE_KANBANLANE', '`' . $config->db->prefix . 'kanbanlane`');
define('TABLE_KANBANCOLUMN', '`' . $config->db->prefix . 'kanbancolumn`');
if(!defined('TABLE_LANG')) define('TABLE_LANG', '`' . $config->db->prefix . 'lang`');
@@ -277,6 +278,7 @@ $config->objectTables['job'] = TABLE_JOB;
$config->objectTables['team'] = TABLE_TEAM;
$config->objectTables['pipeline'] = TABLE_PIPELINE;
$config->objectTables['mr'] = TABLE_MR;
$config->objectTables['kanbanspace'] = TABLE_KANBANSPACE;
$config->objectTables['kanbancolumn'] = TABLE_KANBANCOLUMN;
$config->objectTables['kanbanlane'] = TABLE_KANBANLANE;

View File

@@ -35,6 +35,7 @@ $config->action->objectNameFields['pipeline'] = 'name';
$config->action->objectNameFields['mr'] = 'title';
$config->action->objectNameFields['kanbancolumn'] = 'name';
$config->action->objectNameFields['kanbanlane'] = 'name';
$config->action->objectNameFields['kanbanspace'] = 'name';
$config->action->commonImgSize = 870;

View File

@@ -541,6 +541,7 @@ $lang->action->label->issue = '问题|issue|view|issueID=%s';
$lang->action->label->design = '设计|design|view|designID=%s';
$lang->action->label->stakeholder = '干系人|stakeholder|view|userID=%s';
$lang->action->label->api = '接口|api|index|libID=%s&moduleID=%s&apiID=%s';
$lang->action->label->kanbanspace = '看板空间|kanban|space|browseType=all';
$lang->action->label->kanbancolumn = '看板列|execution|kanban|execution=%s';
$lang->action->label->kanbanlane = '看板泳道|execution|kanban|execution=%s&type=all';
$lang->action->label->mr = '合并请求|mr|view|id=%s';

View File

@@ -5,9 +5,15 @@ $config->kanban = new stdclass();
$config->kanban->setwip = new stdclass();
$config->kanban->setlane = new stdclass();
$config->kanban->setlaneColumn = new stdclass();
$config->kanban->createspace = new stdclass();
$config->kanban->setwip->requiredFields = 'limit';
$config->kanban->setlane->requiredFields = 'name,type';
$config->kanban->setlaneColumn->requiredFields = 'name';
$config->kanban->createspace->requiredFields = 'name,owner';
$config->kanban->editor = new stdclass();
$config->kanban->editor->createspace = array('id' => 'desc', 'tools' => 'simpleTools');
$config->kanban->default = new stdclass();
$config->kanban->default->story = new stdclass();

View File

@@ -34,6 +34,29 @@ class kanban extends control
$this->display();
}
/**
* Create a space.
*
* @access public
* @return void
*/
public function createSpace()
{
if(!empty($_POST))
{
$spaceID = $this->kanban->createSpace();
if(dao::isError()) die(js::error(dao::getError()));
$this->loadModel('action')->create('kanbanSpace', $spaceID, 'created');
die(js::closeModal('parent.parent', 'this', "function(){parent.parent.location.reload();}"));
}
$this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed');
$this->display();
}
/**
* Set WIP.
*

View File

@@ -0,0 +1,4 @@
function setWhite(acl)
{
acl != 'open' ? $('#whitelistBox').removeClass('hidden') : $('#whitelistBox').addClass('hidden');
}

View File

@@ -3,6 +3,21 @@ $lang->kanban->space = 'Kanban Space';
$lang->kanban->create = 'Create Kanban';
$lang->kanban->createSpace = 'Create Space';
/* Field. */
$lang->kanban->spaceName = 'Space Name';
$lang->kanban->spaceDesc = 'Space Description';
$lang->kanban->owner = 'Owner';
$lang->kanban->team = 'Team';
$lang->kanban->acl = 'ACL';
$lang->kanbanspace = new stdclass();
$lang->kanbanspace->name = 'Name';
$lang->kanbanspace->owner = 'Owner';
$lang->kanban->spaceAclList[] = array();
$lang->kanban->spaceAclList['open'] = 'Open (Accessible with kanban view permissions)';
$lang->kanban->spaceAclList['private'] = 'Private (For the kanban owner and team members only)';
$lang->kanban->featureBar['all'] = 'All';
$lang->kanban->featureBar['my'] = 'My';
$lang->kanban->featureBar['other'] = 'Other';

View File

@@ -1,7 +1,21 @@
<?php
$lang->kanban->space = '看板空间';
$lang->kanban->create = '添加看板';
$lang->kanban->createSpace = '添加空间';
$lang->kanban->create = '创建看板';
$lang->kanban->createSpace = '创建空间';
/* Field. */
$lang->kanban->spaceName = '空间名称';
$lang->kanban->spaceDesc = '空间描述';
$lang->kanban->owner = '负责人';
$lang->kanban->team = '团队';
$lang->kanban->acl = '访问控制';
$lang->kanbanspace = new stdclass();
$lang->kanbanspace->name = '空间名称';
$lang->kanbanspace->owner = '负责人';
$lang->kanban->spaceAclList['open'] = '公开(有看板空间视图权限即可访问)';
$lang->kanban->spaceAclList['private'] = '私有(只有看板空间负责人、团队成员可访问)';
$lang->kanban->featureBar['all'] = '所有';
$lang->kanban->featureBar['my'] = '我的空间';

View File

@@ -139,6 +139,37 @@ class kanbanModel extends model
return $kanbanGroup;
}
/**
* Create a space.
*
* @access public
* @return int
*/
public function createSpace()
{
$space = fixer::input('post')
->setDefault('createdBy', $this->app->user->account)
->setDefault('createdDate', helper::now())
->add('team', $this->post->mailto)
->join('whitelist', ',')
->join('team', ',')
->remove('uid,mailto,contactListMenu')
->get();
$this->dao->insert(TABLE_KANBANSPACE)->data($space)
->autoCheck()
->batchCheck($this->config->kanban->createspace->requiredFields, 'notempty')
->exec();
if(!dao::isError())
{
$spaceID = $this->dao->lastInsertID();
$spaceFiles = array();
return $spaceID;
}
}
/**
* Add execution Kanban lanes and columns.
*

View File

@@ -0,0 +1,60 @@
<?php
/**
* The createspace 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: createspace.html.php 935 2021-12-08 14:04: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->createSpace;?></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->spaceName;?></th>
<td><?php echo html::input('name', '', "class='form-control'");?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->kanban->owner;?></th>
<td><?php echo html::select('owner', $users, '', "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('mailto[]', $users, '', "class='form-control chosen' multiple");?>
<?php echo $this->fetch('my', 'buildContactLists');?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->kanban->spaceDesc;?></th>
<td colspan='2'>
<?php echo $this->fetch('user', 'ajaxPrintTemplates', 'type=space&link=desc');?>
<?php echo html::textarea('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->spaceAclList, 'private', "onclick='setWhite(this.value);'", 'block'));?></td>
</tr>
<tr id="whitelistBox">
<th><?php echo $lang->whitelist;?></th>
<td><?php echo html::select('whitelist[]', $users, '', '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';?>