* [task#132242] refactor doc landing page.

This commit is contained in:
dingyongliang
2024-12-24 08:57:45 +08:00
committed by 刘刚
parent 93ab04279d
commit 8a0f7ecc7d
+59 -20
View File
@@ -33,25 +33,40 @@ class doc extends control
}
/**
* 文档落地页。
* Default page.
* 最近访问的空间首页。
* Last viewed doc space home.
*
* @access public
* @return void
*/
public function defaultPage()
public function lastViewedSpaceHome()
{
$docLink = isset($this->config->docLink) ? $this->config->docLink : 'lastViewedSpace';
$lastViewedSpaceHome = $this->doc->getLastViewed('lastViewedSpaceHome');
if($lastViewedSpaceHome === 'api')
{
if($docLink === 'lastViewedLib')
{
$lastViewedLib = $this->doc->getLastViewed('lastViewedLib');
if(is_numeric($lastViewedLib)) return $this->locate($this->createLink('api', 'index', "libID={$lastViewedLib}"));
}
return $this->locate($this->createLink('api', 'index'));
}
if($lastViewedSpaceHome === 'api') return $this->locate($this->createLink('api', 'index'));
$spaceMap = array(
'mine' => 'mySpace',
'product' => 'productSpace',
'project' => 'projectSpace',
'custom' => 'teamSpace'
);
$method = $spaceMap[$lastViewedSpaceHome];
if(empty($method)) return $this->locate($this->createLink('doc', 'mySpace'));
return $this->locate($this->createLink('doc', $method));
}
/**
* 最近访问的空间。
* Last viewed doc space.
*
* @access public
* @return void
*/
public function lastViewedSpace()
{
$lastViewedSpaceHome = $this->doc->getLastViewed('lastViewedSpaceHome');
if($lastViewedSpaceHome === 'api') return $this->locate($this->createLink('api', 'index'));
$spaceMap = array(
'mine' => 'mySpace',
@@ -60,19 +75,43 @@ class doc extends control
'custom' => 'teamSpace'
);
$method = $spaceMap[$lastViewedSpaceHome];
if(empty($method)) return $this->locate($this->createLink('doc', 'mySpace'));
if($docLink === 'lastViewedSpaceHome') return $this->locate($this->createLink('doc', $method));
$lastViewedSpace = $this->doc->getLastViewed('lastViewedSpace');
if(!is_numeric($lastViewedSpace)) return $this->locate($this->createLink('doc', 'mySpace'));
if($docLink === 'lastViewedSpace') return $this->locate($this->createLink('doc', $method, "objectID={$lastViewedSpace}"));
return $this->locate($this->createLink('doc', $method, "objectID={$lastViewedSpace}"));
}
$lastViewedLib = $this->doc->getLastViewed('lastViewedLib');
if(!is_numeric($lastViewedLib)) return $this->locate($this->createLink('doc', 'mySpace'));
if($docLink === 'lastViewedLib') return $this->locate($this->createLink('doc', $method, "objectID={$lastViewedSpace}&libID={$lastViewedLib}"));
/**
* 最近访问的库。
* Last viewed doc lib.
*
* @access public
* @return void
*/
public function lastViewedLib()
{
$lastViewedSpaceHome = $this->doc->getLastViewed('lastViewedSpaceHome');
$lastViewedLib = $this->doc->getLastViewed('lastViewedLib');
$this->locate($this->createLink('doc', $method));
if($lastViewedSpaceHome === 'api')
{
if(is_numeric($lastViewedLib)) return $this->locate($this->createLink('api', 'index', "libID={$lastViewedLib}"));
return $this->locate($this->createLink('api', 'index'));
}
$lastViewedSpace = $this->doc->getLastViewed('lastViewedSpace');
$spaceMap = array(
'mine' => 'mySpace',
'product' => 'productSpace',
'project' => 'projectSpace',
'custom' => 'teamSpace'
);
$method = $spaceMap[$lastViewedSpaceHome];
if(empty($method)) return $this->locate($this->createLink('doc', 'mySpace'));
if(!is_numeric($lastViewedSpace) || !is_numeric($lastViewedLib)) return $this->locate($this->createLink('doc', 'mySpace'));
return $this->locate($this->createLink('doc', $method, "objectID={$lastViewedSpace}&libID={$lastViewedLib}"));
}
/**