From 9cf3dc108bf6b9d5c2b8a7584d26aaf2cb4f5651 Mon Sep 17 00:00:00 2001 From: cdujeu Date: Tue, 8 Dec 2015 09:35:07 +0100 Subject: [PATCH] [utils] getWorkspaceShortcutUrl use "?goto=" or "/ws-" depending on the skip_user_history status. --- core/src/core/classes/class.AJXP_Utils.php | 15 +++++++++++++++ .../plugins/action.share/class.ShareCenter.php | 2 +- .../class.AJXP_Notification.php | 3 +-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/core/src/core/classes/class.AJXP_Utils.php b/core/src/core/classes/class.AJXP_Utils.php index 6c84c71b97..9ecb5b01b3 100644 --- a/core/src/core/classes/class.AJXP_Utils.php +++ b/core/src/core/classes/class.AJXP_Utils.php @@ -893,6 +893,21 @@ public static function detectServerURL($withURI = false) } } + /** + * @param Repository $repository + * @return string + */ + public static function getWorkspaceShortcutURL($repository){ + $repoSlug = $repository->getSlug(); + $skipHistory = ConfService::getCoreConf("SKIP_USER_HISTORY", "conf"); + if($skipHistory){ + $prefix = "/ws-"; + }else{ + $prefix = "?goto="; + } + return trim(self::detectServerURL(true), "/").$prefix.$repoSlug; + } + /** * Modifies a string to remove all non ASCII characters and spaces. * @param string $text diff --git a/core/src/plugins/action.share/class.ShareCenter.php b/core/src/plugins/action.share/class.ShareCenter.php index 1f8110d626..843cb8bcba 100644 --- a/core/src/plugins/action.share/class.ShareCenter.php +++ b/core/src/plugins/action.share/class.ShareCenter.php @@ -2540,7 +2540,7 @@ public function shareToJson($shareId, $shareData, $node = null){ "description" => $repo->getDescription(), "entries" => $sharedEntries, "element_watch" => $elementWatch, - "repository_url"=> AJXP_Utils::detectServerURL(true)."?goto=". $repo->getSlug() ."/", + "repository_url"=> AJXP_Utils::getWorkspaceShortcutURL($repo)."/", "content_filter"=> $cFilter ); if (isSet($minisiteData)) { diff --git a/core/src/plugins/core.notifications/class.AJXP_Notification.php b/core/src/plugins/core.notifications/class.AJXP_Notification.php index c6e551cce6..8670a39f45 100755 --- a/core/src/plugins/core.notifications/class.AJXP_Notification.php +++ b/core/src/plugins/core.notifications/class.AJXP_Notification.php @@ -149,7 +149,6 @@ protected function replaceVars($tplString, $mess, $rich = true) */ public function getMainLink() { - $repoId = $this->getNode()->getRepositoryId(); if(isSet($_SESSION["CURRENT_MINISITE"])){ $hash = $_SESSION["CURRENT_MINISITE"]; $shareCenter = ShareCenter::getShareCenter(); @@ -157,7 +156,7 @@ public function getMainLink() return $shareCenter->buildPublicletLink($hash); } } - return trim(AJXP_Utils::detectServerURL(true), "/")."/?goto=".$repoId.$this->node->getPath(); + return AJXP_Utils::getWorkspaceShortcutURL($this->getNode()->getRepository()).$this->getNode()->getPath(); } /**