* [task#130183,doing,1h] My space support create sub space.

This commit is contained in:
zhouxin
2024-10-16 08:37:35 +08:00
committed by sunhao
parent a2144ec00f
commit 266a68cfd8
5 changed files with 19 additions and 19 deletions
+2 -3
View File
@@ -201,10 +201,10 @@ class doc extends control
if($execution->type == 'stage') $this->lang->doc->execution = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->doc->execution);
}
if($type == 'custom')
if($type == 'custom' || $type == 'mine')
{
$lib = $this->doc->getLibByID($libID);
$this->view->spaces = $this->doc->getTeamSpaces();
$this->view->spaces = $this->doc->getSubSpaces($type);
$this->view->spaceID = !empty($lib->parent) ? $lib->parent : $objectID;
}
@@ -1402,7 +1402,6 @@ class doc extends control
$noPicks = empty($picks);
$picks = $noPicks ? '' : ",$picks,";
if($type == 'mine') $spaceID = 0; // Ignore the spaceID of mine.
list($spaces, $spaceID) = $this->doc->getSpaces($type, $spaceID);
$data = array('spaceID' => $spaceID);
$libs = $this->doc->getLibsOfSpace($type, $spaceID);
+9 -10
View File
@@ -955,18 +955,19 @@ class docModel extends model
}
/**
* 获取团队空间下的空间。
* Get team spaces.
* 获取团队空间或我的空间下的空间。
* Get team spaces or my spaces.
*
* @param string $type
* @access public
* @return array
*/
public function getTeamSpaces(): array
public function getSubSpaces(string $type = 'custom'): array
{
if(common::isTutorialMode()) return $this->loadModel('tutorial')->getTeamSpaces();
if(common::isTutorialMode()) return $this->loadModel('tutorial')->getSubSpaces($type);
$objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB)
->where('type')->eq('custom')
->where('type')->eq($type)
->andWhere('deleted')->eq(0)
->andWhere('parent')->eq(0)
->andWhere('vision')->eq($this->config->vision)
@@ -992,10 +993,9 @@ class docModel extends model
*/
public function getSpaces($type = 'custom', $spaceID = 0)
{
if($type === 'mine') return array(array(array('id' => 1, 'type' => 'mine', 'name' => $this->lang->doc->spaceList['mine'])), 1);
$pairs = array();
if($type == 'custom') $pairs = $this->getTeamSpaces();
if($type == 'mine' || $type == 'custom') $pairs = $this->getSubSpaces($type);
if($type == 'product')
{
$pairs = $this->loadModel('product')->getPairs('nocode');
@@ -1438,8 +1438,7 @@ class docModel extends model
->where('deleted')->eq(0)
->andWhere('vision')->eq($this->config->vision)
->andWhere('type')->eq($type)
->beginIF($type == 'custom')->andWhere('parent')->eq($objectID)->fi()
->beginIF($type == 'mine')->andWhere('addedBy')->eq($this->app->user->account)->fi()
->andWhere('parent')->eq($objectID)
->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi()
->orderBy('`order` asc, id_asc')
->fetchAll('id');
@@ -2275,7 +2274,7 @@ class docModel extends model
{
if($type == 'custom')
{
$spaces = $this->getTeamSpaces();
$spaces = $this->getSubSpaces('custom');
if(empty($objectID)) $objectID = (int)key($spaces);
if(!isset($spaces[$objectID])) $objectID = (int)key($spaces);
}
+1 -1
View File
@@ -72,7 +72,7 @@ formPanel
)
)
) : null,
$type == 'custom' ? formRow
$type == 'custom' || $type == 'mine' ? formRow
(
formGroup
(
+2 -2
View File
@@ -931,8 +931,8 @@ class docZen extends doc
*/
public function getAllSpaces(string $extra = ''): array
{
if(strpos($extra, 'nomine') !== false) return $this->doc->getTeamSpaces();
if(strpos($extra, 'nomine') !== false) return $this->doc->getSubSpaces('custom');
if(strpos($extra, 'onlymine') !== false) return array('mine' => $this->lang->doc->spaceList['mine']);
return array('mine' => $this->lang->doc->spaceList['mine']) + $this->doc->getTeamSpaces();
return array('mine' => $this->lang->doc->spaceList['mine']) + $this->doc->getSubSpaces('custom');
}
}
+5 -3
View File
@@ -2096,15 +2096,17 @@ class tutorialModel extends model
}
/**
* 获取新手模式团队空间。
* 获取新手模式团队空间或我的空间。
* Get team spaces.
*
* @param string $type
* @access public
* @return array
*/
public function getTeamSpaces(): array
public function getSubSpaces($type = 'custom'): array
{
return array(1 => 'Test Team Space');
if($type == 'custom') return array(1 => 'Test Team Space');
if($type == 'mine') return array(1 => 'Test My Space');
}
/**