[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    www/areas/docs
From:       Tom Albers <tomalbers () kde ! nl>
Date:       2009-03-22 21:49:35
Message-ID: 1237758575.868498.17470.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 942926 by toma:

Make search more intelligent. First search in the selected branch, if not find, \
search in development branch.


 M  +22 -19    index.php  


--- trunk/www/areas/docs/index.php #942925:942926
@@ -3,6 +3,9 @@
 	$development_branch = "development (4.3.x)" ;
 	$oldstable_branch = "kde3  (3.5.x)" ;
 
+	$selected_branch = $branch;
+	$sleccted_language = $language;
+
 	$name="KDE Sysadmin";
 	$url="https://bugs.kde.org/enter_sysadmin_request.cgi";
 
@@ -42,40 +45,39 @@
 */
 include 'include/produce_lists.inc.php';
 
-
 /*
 	When there is an application given, check if it is in the
 	array and redirect to it, if yes.
 */
 
-if ( $application != "" ) {
-  $search_branch = 'development'; // search in development, as there is koffice / \
                keg for now.
-	$apps_packages = $generated[$search_branch][$selected_language];
-//	$apps_packages = $generated['development'][$selected_language];
+function search( $branch, $lang, $application ) 
+{
+	global $generated;
+	$apps_packages = $generated[$branch][$lang];
 	foreach ($apps_packages as $apps_package_name => $apps_package) {
 		foreach ($apps_package as $application_value) {
 			if ( $application == $application_value ) {
-				$application_not_found = "";
-				/*
-					Use the development branch for now
-					This will change when more extragear 
-					applications end up in stable/l10n
-				*/
-				header( "Location: " .
-						"/" . $search_branch .
-						"/" . $selected_language .
+				return 
+						"/" . $branch .
+						"/" . $lang .
 						"/" . $apps_package_name .
 						"/" . $application .
-						"/" . "index.html");
-				break 2; // break both "foreach"
-			} else {
-				/* tell the user what did not get found */
-				$application_not_found = $application_from_user; 
+						"/" . "index.html";
 			}
 		}
 	}
 }
 
+if ( $application != "" ) {
+  $url = search( $selected_branch, $selected_language, $application);
+  if ( $url == '' && $selected_branch != 'development')
+    $url = search( 'development', $selected_language, $application); // search in \
development, as there is koffice / keg for now. +  if ( $url == '')
+    $application_not_found = $application;
+  else
+    header( "Location: $url" ); 
+}
+
 /* This is the actual start of the page as the media framework knows it */
 
 
@@ -276,6 +278,7 @@
 	<li>
 		Application Name:<br />
 		<input type='text' name='application' class=\"text_input\" />
+		<input type='hidden' name='branch' value='$selected_branch' />
 		<input type='hidden' name='language' value='$selected_language' />
 		<input type='submit' value='Open' id=\"openbutton\"/>
 	</li>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic