Finish task #49692.

This commit is contained in:
zhouxin
2022-02-22 09:00:47 +00:00
parent fdd36dce95
commit a9995c6fe0
6 changed files with 68 additions and 8 deletions
+23 -4
View File
@@ -74,12 +74,12 @@ class kanban extends control
* @access public
* @return void
*/
public function editSpace($spaceID)
public function editSpace($spaceID, $type = '')
{
$this->loadModel('action');
if(!empty($_POST))
{
$changes = $this->kanban->updateSpace($spaceID);
$changes = $this->kanban->updateSpace($spaceID, $type);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
@@ -89,8 +89,27 @@ class kanban extends control
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$this->view->space = $this->kanban->getSpaceById($spaceID);
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$space = $this->kanban->getSpaceById($spaceID);
$typeList = $this->lang->kanbanspace->typeList;
if($space->type == 'cooperation' or $space->type == 'public') unset($typeList['private']);
if($space->type == 'private' and ($type == 'cooperation' or $type == 'public'))
{
$team = $space->whitelist;
}
else
{
$team = $space->team;
}
$this->view->spaceID = $spaceID;
$this->view->space = $space;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->typeList = $typeList;
$this->view->type = $type;
$this->view->team = $team;
$this->view->defaultType = $type == '' ? $space->type : $type;
$this->display();
}
+11
View File
@@ -0,0 +1,11 @@
/**
* When type change.
*
* @param string type
* @access public
* @return void
*/
function changeType(spaceID, type)
{
location.href = createLink('kanban', 'editSpace', 'spaceID=' + spaceID + '&type=' + type);
}
+4
View File
@@ -271,6 +271,10 @@ $lang->kanbanspace->featureBar['cooperation'] = 'Cooperation Space';
$lang->kanbanspace->featureBar['public'] = 'Public Space';
$lang->kanbanspace->featureBar['involved'] = 'Involved';
$lang->kanbanspace->typeList['private'] = 'Private Space';
$lang->kanbanspace->typeList['cooperation'] = 'Cooperation Space';
$lang->kanbanspace->typeList['public'] = 'Public Space';
$lang->kanbancolumn = new stdclass();
$lang->kanbancolumn->name = $lang->kanban->columnName;
$lang->kanbancolumn->limit = $lang->kanban->WIPCount;
+4
View File
@@ -271,6 +271,10 @@ $lang->kanbanspace->featureBar['cooperation'] = '协作空间';
$lang->kanbanspace->featureBar['public'] = '公共空间';
$lang->kanbanspace->featureBar['involved'] = '我参与的';
$lang->kanbanspace->typeList['private'] = '私人空间';
$lang->kanbanspace->typeList['cooperation'] = '协作空间';
$lang->kanbanspace->typeList['public'] = '公共空间';
$lang->kanbancolumn = new stdclass();
$lang->kanbancolumn->name = $lang->kanban->columnName;
$lang->kanbancolumn->limit = $lang->kanban->WIPCount;
+18 -1
View File
@@ -1754,7 +1754,7 @@ class kanbanModel extends model
* @access public
* @return array
*/
public function updateSpace($spaceID)
public function updateSpace($spaceID, $type = '')
{
$spaceID = (int)$spaceID;
$oldSpace = $this->getSpaceById($spaceID);
@@ -1767,6 +1767,8 @@ class kanbanModel extends model
->remove('uid,contactListMenu')
->get();
if($type == 'cooperation' or $type == 'public') $space->whitelist = '';
$space = $this->loadModel('file')->processImgURL($space, $this->config->kanban->editor->editspace['id'], $this->post->uid);
$this->dao->update(TABLE_KANBANSPACE)->data($space)
@@ -1775,6 +1777,15 @@ class kanbanModel extends model
->where('id')->eq($spaceID)
->exec();
if($oldSpace->type == 'private' and ($type == 'cooperation' or $type == 'public'))
{
$kanbanList = $this->dao->select('id,team,whitelist')->from(TABLE_KANBAN)->where('space')->eq($spaceID)->andWhere('deleted')->eq('0')->fetchAll('id');
foreach($kanbanList as $id => $kanbanData)
{
$this->dao->update(TABLE_KANBAN)->set('team')->eq($kanbanData->whitelist)->set('whitelist')->eq('')->where('id')->eq($id)->andWhere('deleted')->eq('0')->exec();
}
}
if(!dao::isError())
{
$this->file->saveUpload('kanbanspace', $spaceID);
@@ -1783,6 +1794,12 @@ class kanbanModel extends model
}
}
public function updateKanbanBySpace($spaceID, $type)
{
$spaceType = $this->dao->select('type')->from(TABLE_KANBANSPACE)->where('id')->eq($spaceID)->fetch();
}
/**
* Close a space.
*
+8 -3
View File
@@ -18,12 +18,17 @@
</div>
<form class='form-indicator main-form form-ajax' method='post' enctype='multipart/form-data' id='dataform'>
<table class='table table-form'>
<tr>
<th><?php echo $lang->kanbanspace->type;?></th>
<td><?php echo html::select('type', $typeList, $defaultType, "onchange='changeType($spaceID, this.value)' class='form-control chosen'");?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->kanbanspace->name;?></th>
<td><?php echo html::input('name', $space->name, "class='form-control'");?></td>
<td></td>
</tr>
<?php if($space->type != 'private'):?>
<?php if($space->type != 'private' or $type == 'cooperation' or $type == 'public'):?>
<tr>
<th><?php echo $lang->kanbanspace->owner;?></th>
<td><?php echo html::select('owner', $users, $space->owner, "class='form-control chosen'");?></td>
@@ -32,7 +37,7 @@
<th><?php echo $lang->kanbanspace->team;?></th>
<td colspan='2'>
<div class="input-group">
<?php echo html::select('team[]', $users, $space->team, "class='form-control chosen' multiple data-drop_direction='down'");?>
<?php echo html::select('team[]', $users, $team, "class='form-control chosen' multiple data-drop_direction='down'");?>
<?php echo $this->fetch('my', 'buildContactLists');?>
</div>
</td>
@@ -45,7 +50,7 @@
<?php echo html::textarea('desc', $space->desc, "rows='10' class='form-control'");?>
</td>
</tr>
<?php if($space->type == 'private'):?>
<?php if($space->type == 'private' and $type != 'cooperation' and $type != 'public'):?>
<tr id="whitelistBox">
<th><?php echo $lang->whitelist;?></th>
<td><?php echo html::select('whitelist[]', $users, $space->whitelist, 'class="form-control chosen" multiple');?></td>