Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/private/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ public static function getActiveNavigationEntry() {
*/
public static function getSettingsNavigation() {
$l = \OC::$server->getL10N('lib');
$defaults = new OC_Defaults();

$settings = array();
// by default, settings only contain the help menu
Expand All @@ -431,7 +432,7 @@ public static function getSettingsNavigation() {
array(
"id" => "help",
"order" => 1000,
"href" => OC_Helper::linkToRoute("settings_help"),
"href" => $defaults->getKnowledgeBaseUrl(),
"name" => $l->t("Help"),
"icon" => OC_Helper::imagePath("settings", "help.svg")
)
Expand Down
19 changes: 19 additions & 0 deletions lib/private/defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ class OC_Defaults {
private $defaultSlogan;
private $defaultLogoClaim;
private $defaultMailHeaderColor;
private $defaultKnowledgeBaseUrl;

function __construct() {
$this->l = \OC::$server->getL10N('lib');
$urlGenerator = \OC::$server->getURLGenerator();
$version = OC_Util::getVersion();

$this->defaultEntity = 'ownCloud'; /* e.g. company name, used for footers and copyright notices */
Expand All @@ -64,6 +66,7 @@ function __construct() {
$this->defaultSlogan = $this->l->t('web services under your control');
$this->defaultLogoClaim = '';
$this->defaultMailHeaderColor = '#1d2d44'; /* header color of mail notifications */
$this->defaultKnowledgeBaseUrl = $urlGenerator->linkToRoute('settings_help');

$themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
if (file_exists($themePath)) {
Expand All @@ -79,6 +82,7 @@ function __construct() {

/**
* @param string $method
* @return bool
*/
private function themeExist($method) {
if (isset($this->theme) && method_exists($this->theme, $method)) {
Expand Down Expand Up @@ -280,4 +284,19 @@ public function getMailHeaderColor() {
}
}

/**
* get knowledge base URL, will be used for the "Help"-Link in the top
* right menu
*
* @return string
*/
public function getKnowledgeBaseUrl() {
if ($this->themeExist('getKnowledgeBaseUrl')) {
return $this->theme->getKnowledgeBaseUrl();
} else {
return $this->defaultKnowledgeBaseUrl;
}

}

}
6 changes: 6 additions & 0 deletions themes/example/defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class OC_Theme {
private $themeSyncClientUrl;
private $themeSlogan;
private $themeMailHeaderColor;
private $themeKnowledgeBaseUrl;

/* put your custom text in these variables */
function __construct() {
Expand All @@ -39,6 +40,7 @@ function __construct() {
$this->themeSyncClientUrl = 'https://owncloud.org/install';
$this->themeSlogan = 'Your custom cloud, personalized for you!';
$this->themeMailHeaderColor = '#745bca';
$this->themeKnowledgeBaseUrl = 'https://doc.owncloud.org';
}
/* nothing after this needs to be adjusted */

Expand Down Expand Up @@ -92,4 +94,8 @@ public function getMailHeaderColor() {
return $this->themeMailHeaderColor;
}

public function getKnowledgeBaseUrl() {
return $this->themeKnowledgeBaseUrl;
}

}