From 4011dd18f01d275620b13815573e359c77664e3a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 8 Oct 2017 16:48:24 -0700 Subject: [PATCH] alternate navbar layouts --- Zotlabs/Render/Comanche.php | 5 + boot.php | 16 +- doc/member/member_guide.bb | 9 ++ include/nav.php | 14 +- view/tpl/nav.tpl | 1 + view/tpl/navbar_tucson.tpl | 289 ++++++++++++++++++++++++++++++++++++ view/tpl/profile_tabs.tpl | 3 - 7 files changed, 325 insertions(+), 12 deletions(-) create mode 100755 view/tpl/navbar_tucson.tpl diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php index d126cb3da..ca664cba6 100644 --- a/Zotlabs/Render/Comanche.php +++ b/Zotlabs/Render/Comanche.php @@ -121,6 +121,11 @@ class Comanche { if($cnt) \App::$layout['theme'] = trim($matches[1]); + $cnt = preg_match("/\[navbar\](.*?)\[\/navbar\]/ism", $s, $matches); + if($cnt) + \App::$layout['navbar'] = trim($matches[1]); + + $cnt = preg_match_all("/\[webpage\](.*?)\[\/webpage\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { // only the last webpage definition is used if there is more than one diff --git a/boot.php b/boot.php index f955ba511..df57009e5 100755 --- a/boot.php +++ b/boot.php @@ -2090,17 +2090,21 @@ function construct_page() { $installing = false; + $navbar = get_config('system','navbar','nav'); + if(App::$profile_uid) { + $navbar = get_pconfig(App::$profile_uid,'system','navbar',$navbar); + } + + if($comanche && App::$layout['navbar']) { + $navbar = App::$layout['navbar']; + } + if (App::$module == 'setup') { $installing = true; } else { - nav($a); + nav($navbar); } - if ($comanche) { - if (App::$layout['nav']) { - App::$page['nav'] = get_custom_nav(App::$layout['nav']); - } - } $current_theme = Zotlabs\Render\Theme::current(); diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index 0a2d11a88..0794f24d3 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -634,6 +634,15 @@ This will select the theme named "suckerberg" and select the "pas The condensed notation isn't part of Comanche itself but is recognised by $Projectname platform as a theme specifier. +[h4]Navbar[/h4] + +[code] + [navbar]tucson[/navbar] +[/code] + +Use the 'tucson' navbar template and CSS rules. By default the 'nav' navbar template will be used. + + [h4]Regions[/h4] Each region has a name, as noted above. You will specify the region of interest using a 'region' tag, which includes the name. Any content you wish placed in this region should be placed between the opening region tag and the closing tag. diff --git a/include/nav.php b/include/nav.php index 6b56c9aee..622717347 100644 --- a/include/nav.php +++ b/include/nav.php @@ -6,7 +6,7 @@ require_once('include/security.php'); require_once('include/menu.php'); -function nav() { +function nav($template = 'nav') { /** * @@ -267,7 +267,16 @@ EOT; $nav_apps[] = Zlib\Apps::app_render($app,'nav'); } - $tpl = get_markup_template('nav.tpl'); + $c = theme_include('navbar_' . $template . '.css'); + $tpl = get_markup_template('navbar_' . $template . '.tpl'); + + if($c && $tpl) { + head_add_css('navbar_' . $template . '.css'); + } + + if(! $tpl) { + $tpl = get_markup_template('nav.tpl'); + } App::$page['nav'] .= replace_macros($tpl, array( '$baseurl' => z_root(), @@ -490,7 +499,6 @@ function channel_apps($is_owner = false, $nickname = null) { '$tabs' => $arr['tabs'], '$name' => App::$profile['channel_name'], '$thumb' => App::$profile['thumb'], - '$channel_menu' => get_config('system','channel_menu') ] ); } diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index a19fa15a1..1d905d173 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -252,6 +252,7 @@ {{foreach $channel_apps as $channel_app}} {{$channel_app}} {{/foreach}} + diff --git a/view/tpl/navbar_tucson.tpl b/view/tpl/navbar_tucson.tpl new file mode 100755 index 000000000..15f06eda1 --- /dev/null +++ b/view/tpl/navbar_tucson.tpl @@ -0,0 +1,289 @@ +{{if $nav.login && !$userinfo}} +
+ + {{$nav.loginmenu.1.1}} + + {{if $nav.register}} + + {{$nav.register.1}} + + {{/if}} +
+{{/if}} +{{if $userinfo}} + +{{/if}} + + + +{{if $nav.help.6}} +
+ {{$nav.help.5}} + +
+{{/if}} diff --git a/view/tpl/profile_tabs.tpl b/view/tpl/profile_tabs.tpl index b59135209..72e98ae82 100644 --- a/view/tpl/profile_tabs.tpl +++ b/view/tpl/profile_tabs.tpl @@ -2,6 +2,3 @@ {{foreach $tabs as $tab}} {{$tab.label}} {{/foreach}} -{{if ! $channel_menu}} - -{{/if}} \ No newline at end of file