* Finish task #48006, #48007.

This commit is contained in:
liumengyi
2022-01-20 11:05:35 +08:00
parent 9ef522cc46
commit b371c22842
3 changed files with 14 additions and 12 deletions
+2
View File
@@ -156,6 +156,8 @@ class kanban extends control
*/
public function create($spaceID = 0, $type = 'private')
{
$type = $type == 'involved' ? 'private' : $type;
if(!empty($_POST))
{
$kanbanID = $this->kanban->create();
+10 -10
View File
@@ -1315,10 +1315,11 @@ class kanbanModel extends model
public function getSpaceList($browseType, $pager = null)
{
$account = $this->app->user->account;
$spaceIdList = $this->getCanViewObjects('kanbanspace');
$spaceIdList = $this->getCanViewObjects('kanbanspace', $browseType);
$spaceList = $this->dao->select('*')->from(TABLE_KANBANSPACE)
->where('deleted')->eq(0)
->beginIF(in_array($browseType, array('private', 'cooperation', 'public')))->andWhere('type')->eq($browseType)->fi()
->beginIF($browseType == 'private')->andWhere('owner')->eq($account)->fi()
->beginIF($browseType == 'involved')->andWhere('owner')->ne($account)->fi()
->beginIF($this->cookie->showClosed == 0)->andWhere('status')->ne('closed')->fi()
->beginIF(!$this->app->user->admin)->andWhere('id')->in($spaceIdList)->fi()
@@ -1326,7 +1327,7 @@ class kanbanModel extends model
->page($pager)
->fetchAll('id');
$kanbanIdList = $this->getCanViewObjects();
$kanbanIdList = $this->getCanViewObjects('kanban', $browseType);
$kanbanGroup = $this->getGroupBySpaceList(array_keys($spaceList), $kanbanIdList);
foreach($spaceList as $spaceID => $space)
{
@@ -1362,7 +1363,7 @@ class kanbanModel extends model
* Get can view objects.
*
* @param string $objectType kanbanspace|kanban
* @param string $param noclosed
* @param string $param noclosed|private|cooperation|public|involved
* @access public
* @return array
*/
@@ -1374,7 +1375,7 @@ class kanbanModel extends model
->beginIF(strpos($param, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
->fetchAll('id');
$spaceList = $objectType == 'kanban' ? $this->dao->select('id,owner,team,whitelist')->from(TABLE_KANBANSPACE)->fetchAll('id') : array();
$spaceList = $objectType == 'kanban' ? $this->dao->select('id,owner,team,whitelist,type')->from(TABLE_KANBANSPACE)->fetchAll('id') : array();
if($this->app->user->admin) return array_keys($objects);
@@ -1382,17 +1383,16 @@ class kanbanModel extends model
foreach($objects as $objectID => $object)
{
$remove = true;
if($object->owner == $account) $remove = false;
if($param == 'public') continue;
if($object->owner == $account and $param != 'involved') $remove = false;
if(strpos(",{$object->team},", ",$account,") !== false) $remove = false;
if(strpos(",{$object->whitelist},", ",$account,") !== false) $remove = false;
if($objectType == 'kanban')
{
$spaceOwner = isset($spaceList[$object->space]->owner) ? $spaceList[$object->space]->owner : '';
$spaceTeam = isset($spaceList[$object->space]->team) ? trim($spaceList[$object->space]->team, ',') : '';
$spaceWhiteList = isset($spaceList[$object->space]->whitelist) ? trim($spaceList[$object->space]->whitelist, ',') : '';
$spaceOwner = isset($spaceList[$object->space]->owner) ? $spaceList[$object->space]->owner : '';
if(strpos(",$spaceOwner,", ",$account,") !== false) $remove = false;
if(strpos(",$spaceTeam,", ",$account,") !== false) $remove = false;
if(strpos(",$spaceWhiteList,", ",$account,") !== false) $remove = false;
}
if($remove) unset($objects[$objectID]);
+2 -2
View File
@@ -22,7 +22,7 @@
<?php echo html::checkbox('showClosed', array('1' => $lang->kanban->showClosed), '', $this->cookie->showClosed ? 'checked=checked' : '');?>
</div>
<div class="btn-toolbar pull-right">
<?php if(!empty($unclosedSpace)) common::printLink('kanban', 'create', "spaceID=0&type={$browseType}", '<i class="icon icon-plus"></i> ' . $lang->kanban->create, '', 'class="btn btn-secondary iframe" data-width="75%"', '', true);?>
<?php if(!empty($unclosedSpace) and $browseType != 'involved') common::printLink('kanban', 'create', "spaceID=0&type={$browseType}", '<i class="icon icon-plus"></i> ' . $lang->kanban->create, '', 'class="btn btn-secondary iframe" data-width="75%"', '', true);?>
<?php if($browseType != 'involved')common::printLink('kanban', 'createSpace', "type={$browseType}", '<i class="icon icon-plus"></i> ' . $lang->kanban->createSpace, '', 'class="btn btn-primary iframe" data-width="75%"', '', true);?>
</div>
</div>
@@ -51,7 +51,7 @@
</div>
<div class='spaceActions pull-right'>
<?php $class = $space->status == 'closed' ? 'disabled' : '';?>
<?php if($space->status != 'closed') common::printLink('kanban', 'create', "spaceID={$space->id}&type={$browseType}", '<i class="icon icon-plus"></i> ' . $lang->kanban->create, '', "class='iframe' data-width='75%'", '', true);?>
<?php if($space->status != 'closed' and $browseType != 'involved') common::printLink('kanban', 'create', "spaceID={$space->id}&type={$space->type}", '<i class="icon icon-plus"></i> ' . $lang->kanban->create, '', "class='iframe' data-width='75%'", '', true);?>
<?php common::printLink('kanban', 'editSpace', "spaceID={$space->id}", '<i class="icon icon-cog-outline"></i> ' . $lang->kanban->setting, '', "class='iframe' data-width='75%'", '', true);?>
<?php common::printLink('kanban', 'closeSpace', "spaceID={$space->id}", '<i class="icon icon-off"></i> ' . $lang->close, '', "class='iframe {$class}'", '', true);?>
<?php common::printLink('kanban', 'deleteSpace', "spaceID={$space->id}", '<i class="icon icon-trash"></i> ' . $lang->delete, 'hiddenwin', '', '', true);?>