[evolvis-commits] r14272: Fixed detection of selected tab

mirabilos at evolvis.org mirabilos at evolvis.org
Mon Feb 28 04:05:36 CET 2011


Author: mirabilos
Date: 2011-02-28 04:05:36 +0100 (Mon, 28 Feb 2011)
New Revision: 14272

Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/common/include/utils.php
   trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class.php
Log:
Fixed detection of selected tab

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/common/include/utils.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/common/include/utils.php	2011-02-28 03:05:33 UTC (rev 14271)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/common/include/utils.php	2011-02-28 03:05:36 UTC (rev 14272)
@@ -990,12 +990,17 @@
 		$url = "http://" ;
 	
 	$url .= $GLOBALS['sys_default_domain'] ;
-	$url .= normalized_urlprefix () ;
-	$path = ereg_replace ("^/", "", $path) ;
-	$url .= $path ;
+	$url .= util_make_uri ($path) ;
 	return $url ;
 }
 
+function util_make_uri ($path) {
+	$path = ereg_replace ("^/", "", $path) ;
+	$uri .= normalized_urlprefix () ;
+	$uri .= $path ;
+	return $uri ;
+}
+
 function util_make_link ($path, $text, $extra_params=false, $absolute=false) {
 	$ep = '' ;
 	if (is_array($extra_params)) {

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class.php	2011-02-28 03:05:33 UTC (rev 14271)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/include/Layout.class.php	2011-02-28 03:05:36 UTC (rev 14272)
@@ -479,24 +479,24 @@
 					$selected=count($TABS_DIRS)-1;
 				}
 			}
-		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/my/') ) || 
-			  strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/account/') ) || 
-			  strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/register/') ) ||  
-			  strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/themes/') ) ) {
+		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_uri ('/my/') ) || 
+			  strstr(getStringFromServer('REQUEST_URI'),util_make_uri ('/account/') ) || 
+			  strstr(getStringFromServer('REQUEST_URI'),util_make_uri ('/register/') ) ||  
+			  strstr(getStringFromServer('REQUEST_URI'),util_make_uri ('/themes/') ) ) {
 			$selected=array_search(util_make_url ('/my/'), $TABS_DIRS);
-		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('softwaremap') )) {
+		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_uri ('softwaremap') )) {
 			$selected=array_search(util_make_url ('/softwaremap/'), $TABS_DIRS);
-		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/snippet/') )) {
+		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_uri ('/snippet/') )) {
 			$selected=array_search(util_make_url ('/snippet/'), $TABS_DIRS);
-		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/people/') )) {
+		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_uri ('/people/') )) {
 			$selected=array_search(util_make_url ('/people/'), $TABS_DIRS);
-		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/reporting/') )) {
+		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_uri ('/reporting/') )) {
 			$selected=array_search(util_make_url ('/reporting/'),$TABS_DIRS);
-		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_url ('/admin/') ) && $user_is_super) {
+		} elseif (strstr(getStringFromServer('REQUEST_URI'),util_make_uri ('/admin/') ) && $user_is_super) {
 			$selected=array_search(util_make_url ('/admin/'),$TABS_DIRS);
 		} elseif (count($PLUGIN_TABS_DIRS)>0) {
 			foreach ($PLUGIN_TABS_DIRS as $PLUGIN_TABS_DIRS_VALUE) {
-				if (strstr(getStringFromServer('REQUEST_URI'), $PLUGIN_TABS_DIRS_VALUE)) {
+				if (strstr(getStringFromServer('REQUEST_URI'), parse_url ($PLUGIN_TABS_DIRS_VALUE, PHP_URL_PATH))) {
 					$selected=array_search($PLUGIN_TABS_DIRS_VALUE, $TABS_DIRS);
 					break;
 				}



More information about the evolvis-commits mailing list