Repository: airavata-php-gateway Updated Branches: refs/heads/develop 6d121230c -> 5c7e26471
Configuration added if themes have login/create account links setup, navbar will hide. Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/8d1bcdcb Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/8d1bcdcb Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/8d1bcdcb Branch: refs/heads/develop Commit: 8d1bcdcb61a5d3965af0f90f55f6cf73f7642ef8 Parents: 26ed2cf Author: Nipurn Doshi <[email protected]> Authored: Mon Oct 31 00:24:47 2016 -0700 Committer: Nipurn Doshi <[email protected]> Committed: Mon Oct 31 00:24:47 2016 -0700 ---------------------------------------------------------------------- app/config/pga_config.php.template | 5 ++++ app/libraries/CommonUtilities.php | 49 +++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8d1bcdcb/app/config/pga_config.php.template ---------------------------------------------------------------------- diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template index b7e2208..7a18f5a 100644 --- a/app/config/pga_config.php.template +++ b/app/config/pga_config.php.template @@ -217,6 +217,11 @@ return array( 'portal-smtp-server-port' => '587', /** + * Set this to true if theme has set links to login + */ + 'theme-based-login-links-configured' => false, + + /** * Set JIRA Issue Collector scripts here. */ 'jira-help' => http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8d1bcdcb/app/libraries/CommonUtilities.php ---------------------------------------------------------------------- diff --git a/app/libraries/CommonUtilities.php b/app/libraries/CommonUtilities.php index 962bbcd..b7e434e 100644 --- a/app/libraries/CommonUtilities.php +++ b/app/libraries/CommonUtilities.php @@ -139,7 +139,7 @@ class CommonUtilities } } - echo '<nav class="navbar navbar-inverse navbar-static-top" role="navigation"> + $navbar = '<nav class="navbar navbar-inverse navbar-static-top" role="navigation"> <div class="container-fluid"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> @@ -167,7 +167,7 @@ class CommonUtilities if ($options[0]['nav-active'] == Session::get("nav-active")) $active = " active "; } - echo '<li class="dropdown ' . $active . '"> + $navbar .= '<li class="dropdown ' . $active . '"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $label . '<span class="caret"></span></a> <ul class="dropdown-menu" role="menu">'; @@ -175,15 +175,14 @@ class CommonUtilities foreach ($options as $option) { $id = strtolower(str_replace(' ', '-', $option['label'])); - echo '<li' . $disabled . '><a href="' . $option['url'] . '" id=' . $id . '>' . $option['label'] . '</a></li>'; + $navbar .= '<li' . $disabled . '><a href="' . $option['url'] . '" id=' . $id . '>' . $option['label'] . '</a></li>'; } } - echo '</ul> - </li>'; + $navbar .= '</ul></li>'; } if( count( $menus) == 0) - echo '<li class="brand-logo"></li>'; + $navbar .= '<li class="brand-logo"></li>'; $active = ""; if(Session::has('loggedin') && @@ -192,9 +191,9 @@ class CommonUtilities ){ if( Session::get("nav-active") == "storage") $active = "active"; - echo '<li class="' . $active . '"><a href="' . URL::to("/") . '/files/browse"><span class="glyphicon glyphicon-folder-close"></span> Storage</a></li>'; + $navbar .= '<li class="' . $active . '"><a href="' . URL::to("/") . '/files/browse"><span class="glyphicon glyphicon-folder-close"></span> Storage</a></li>'; } - echo '</ul> + $navbar .= '</ul> <ul class="nav navbar-nav navbar-right">'; @@ -211,39 +210,47 @@ class CommonUtilities //notification bell $notices = array(); $notices = CommonUtilities::get_all_notices(); - echo CommonUtilities::get_notices_ui( $notices); + $navbar .= CommonUtilities::get_notices_ui( $notices); } if (Session::has("admin") || Session::has("admin-read-only")) - echo '<li class="' . $active . '"><a href="' . URL::to("/") . '/admin/dashboard"><span class="glyphicon glyphicon-user"></span>Admin Dashboard</a></li>'; -// else -// echo '<li><a href="' . URL::to("/") . '/user/profile"><span class="glyphicon glyphicon-user"></span> Profile</a></li>'; + $navbar .= '<li class="' . $active . '"><a href="' . URL::to("/") . '/admin/dashboard"><span class="glyphicon glyphicon-user"></span>Admin Dashboard</a></li>'; - echo '<li class="dropdown"> + $navbar .= '<li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">' . Session::get("username") . ' <span class="caret"></span></a>'; - echo '<ul class="dropdown-menu" role="menu">'; + $navbar .= '<ul class="dropdown-menu" role="menu">'; if ( Session::has("existing-gateway-provider")) { $requestedGateways = Session::get("requestedGateways"); foreach( $requestedGateways as $gatewayId => $gateway){ if( $gateway["approvalStatus"] == "Approved"){ - echo '<li><a href="' . URL::to('/') . '/admin/dashboard?gatewayId=' . $gateway["gatewayInfo"]->gatewayId . '">Manage ' . $gateway["gatewayInfo"]->gatewayName . '</a></li>'; + $navbar .= '<li><a href="' . URL::to('/') . '/admin/dashboard?gatewayId=' . $gateway["gatewayInfo"]->gatewayId . '">Manage ' . $gateway["gatewayInfo"]->gatewayName . '</a></li>'; } } } - echo '<li><a href="' . URL::to('/') . '/logout"><span class="glyphicon glyphicon-log-out"></span> Log out</a></li>'; - echo '</ul></li></ul>'; + $navbar .= '<li><a href="' . URL::to('/') . '/logout"><span class="glyphicon glyphicon-log-out"></span> Log out</a></li>'; + $navbar .= '</ul></li>'; } else { - echo '<li><a href="' . URL::to('/') . '/create"><span class="glyphicon glyphicon-user"></span> Create account</a></li>'; - echo '<li><a href="' . URL::to('/') . '/login"><span class="glyphicon glyphicon-log-in"></span> Log in</a></li>'; - echo '</ul>'; + $navbar .= '<li><a href="' . URL::to('/') . '/create"><span class="glyphicon glyphicon-user"></span> Create account</a></li>'; + $navbar .= '<li><a href="' . URL::to('/') . '/login"><span class="glyphicon glyphicon-log-in"></span> Log in</a></li>'; } - echo '</div></div></nav>'; + $navbar .= '</ul></div></div></nav>'; + + // Check if theme user has created links in their theme to the login and create account page. + if( !Session::has('loggedin') && + isset( Config::get('pga_config.portal')['theme-based-login-links-configured'])) + { + if( Config::get('pga_config.portal')['theme-based-login-links-configured'] ){ + $navbar = ""; + } + } + + echo $navbar; } public static function get_notices_ui( $notices){
