From 6f0a2155001f02437cfd88cbd3e74850644caaa0 Mon Sep 17 00:00:00 2001 From: dingyongliang Date: Mon, 23 Dec 2024 13:41:58 +0800 Subject: [PATCH] * [task#132242] add doc defaultPage control. --- framework/router.class.php | 3 ++- module/doc/control.php | 43 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/framework/router.class.php b/framework/router.class.php index 4cbf3c38e7..212a6c199a 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -331,7 +331,7 @@ class router extends baseRouter { $sql = new sql(); $account = $sql->quote($account); - $userSetting = $this->dbQuery('SELECT `key`, `value` FROM ' . TABLE_CONFIG . " WHERE `owner`= $account AND `module`='common' and `key` in ('programLink', 'productLink', 'projectLink', 'executionLink', 'URSR')")->fetchAll(); + $userSetting = $this->dbQuery('SELECT `key`, `value` FROM ' . TABLE_CONFIG . " WHERE `owner`= $account AND `module`='common' and `key` in ('programLink', 'productLink', 'projectLink', 'executionLink', 'URSR', 'docLink')")->fetchAll(); } foreach($userSetting as $setting) @@ -341,6 +341,7 @@ class router extends baseRouter if($setting->key == 'productLink') $config->productLink = $setting->value; if($setting->key == 'projectLink') $config->projectLink = $setting->value; if($setting->key == 'executionLink') $config->executionLink = $setting->value; + if($setting->key == 'docLink') $config->docLink = $setting->value; } $lang->ERCommon = $config->storyCommonList[$this->clientLang]['epic']; diff --git a/module/doc/control.php b/module/doc/control.php index fdd2f4efcc..9ecf685eec 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -32,6 +32,49 @@ class doc extends control $this->loadModel('execution'); } + /** + * 文档落地页。 + * Default page. + * + * @access public + * @return void + */ + public function defaultPage() + { + $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')); + } + + $spaceMap = array( + 'mine' => 'mySpace', + 'product' => 'productSpace', + 'project' => 'projectSpace', + '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}")); + + $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}")); + + $this->locate($this->createLink('doc', $method)); + } + /** * 设置上次访问的文档对象。 * Set last viewed doc object.