From 45078dda825d6412f755e2727e25c027ca48c1e9 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 22 Sep 2018 19:48:17 +0200 Subject: introduce profile settings and provide a way for modules without an app to still be able to link to its settings page from the navbar --- Zotlabs/Module/Profiles.php | 4 ++-- include/nav.php | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index 202ee462a..de4075ba9 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -8,8 +8,8 @@ require_once('include/selectors.php'); class Profiles extends \Zotlabs\Web\Controller { function init() { - - nav_set_selected('Profiles'); + + nav_set_selected('Profiles', 'settings/profiles'); if(! local_channel()) { return; diff --git a/include/nav.php b/include/nav.php index 5a2096e02..1eef8dc07 100644 --- a/include/nav.php +++ b/include/nav.php @@ -221,6 +221,9 @@ function nav($template = 'default') { } } + if(! $settings_url && isset(App::$nav_sel['settings_url'])) + $settings_url = App::$nav_sel['settings_url']; + //app bin if($is_owner) { if(get_pconfig(local_channel(), 'system','import_system_apps') !== datetime_convert('UTC','UTC','now','Y-m-d')) { @@ -300,7 +303,7 @@ function nav($template = 'default') { '$addapps' => t('Add Apps'), '$orderapps' => t('Arrange Apps'), '$sysapps_toggle' => t('Toggle System Apps'), - '$url' => (($url) ? $url : App::$cmd), + '$url' => (($url) ? $url : z_root() . '/' . App::$cmd), '$settings_url' => $settings_url )); @@ -323,11 +326,16 @@ function nav($template = 'default') { * Set a menu item in navbar as selected * */ -function nav_set_selected($item){ - App::$nav_sel['raw_name'] = $item; - $item = ['name' => $item]; +function nav_set_selected($raw_name, $settings_url = ''){ + App::$nav_sel['raw_name'] = $raw_name; + + $item = ['name' => $raw_name]; Apps::translate_system_apps($item); + App::$nav_sel['name'] = $item['name']; + + if($settings_url) + App::$nav_sel['settings_url'] = z_root() . '/' . $settings_url; } function channel_apps($is_owner = false, $nickname = null) { -- cgit v1.2.3