Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
[utils] getWorkspaceShortcutUrl use "?goto=" or "/ws-" depending on t…
…he skip_user_history status.
  • Loading branch information
cdujeu committed Dec 8, 2015
1 parent e4e7e9a commit 9cf3dc1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
15 changes: 15 additions & 0 deletions core/src/core/classes/class.AJXP_Utils.php
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/action.share/class.ShareCenter.php
Expand Up @@ -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)) {
Expand Down
Expand Up @@ -149,15 +149,14 @@ 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();
if(!empty($shareCenter)){
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();
}

/**
Expand Down

0 comments on commit 9cf3dc1

Please sign in to comment.