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

Commit

Permalink
Detect public mode (minisite) and alter default repository descriptio…
Browse files Browse the repository at this point in the history
…n to avoid displaying owner id.
  • Loading branch information
cdujeu committed Sep 17, 2014
1 parent d8a2630 commit ac31383
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
6 changes: 5 additions & 1 deletion core/src/core/classes/class.AJXP_XMLWriter.php
Expand Up @@ -615,15 +615,19 @@ public static function writeRepositoriesData($loggedUser)
$slugString = "repositorySlug=\"$slug\"";
}
$isSharedString = "";
$ownerLabel = null;
if ($repoObject->hasOwner()) {
$uId = $repoObject->getOwner();
$uObject = ConfService::getConfStorageImpl()->createUserObject($uId);
$label = $uObject->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, $uId);
if(empty($label)) $label = $uId;
$ownerLabel = $label;
$isSharedString = 'owner="'.AJXP_Utils::xmlEntities($label).'"';
}
$descTag = "";
$description = $repoObject->getDescription();
$public = false;
if(!empty($_SESSION["CURRENT_MINISITE"])) $public = true;
$description = $repoObject->getDescription($public);
if (!empty($description)) {
$descTag = '<description>'.AJXP_Utils::xmlEntities($description, true).'</description>';
}
Expand Down
17 changes: 13 additions & 4 deletions core/src/core/classes/class.Repository.php
Expand Up @@ -558,9 +558,10 @@ public function setDescription( $descriptionText )
}

/**
* @param bool $public
* @return String
*/
public function getDescription ()
public function getDescription( $public = false, $ownerLabel = null )
{
$m = ConfService::getMessages();
if (isset($this->options["USER_DESCRIPTION"]) && !empty($this->options["USER_DESCRIPTION"])) {
Expand All @@ -569,12 +570,20 @@ public function getDescription ()
} else {
return $this->options["USER_DESCRIPTION"];
}
}if (isSet($this->parentId) && isset($this->owner)) {
}
if (isSet($this->parentId) && isset($this->owner)) {
if (isSet($this->options["CREATION_TIME"])) {
$date = AJXP_Utils::relativeDate($this->options["CREATION_TIME"], $m);
return str_replace(array("%date", "%user"), array($date, $this->owner), $m["473"]);
return str_replace(
array("%date", "%user"),
array($date, $ownerLabel!= null ? $ownerLabel : $this->owner),
$public?$m["470"]:$m["473"]);
} else {
return str_replace(array("%user"), array($this->owner), $m["472"]);
if($public) return $m["474"];
else return str_replace(
array("%user"),
array($ownerLabel!= null ? $ownerLabel : $this->owner),
$m["472"]);
}
} else if ($this->isWriteable() && isSet($this->options["CREATION_TIME"])) {
$date = AJXP_Utils::relativeDate($this->options["CREATION_TIME"], $m);
Expand Down

0 comments on commit ac31383

Please sign in to comment.