[Mapbender-commits] r3490 - branches/astroidex_25/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 26 16:57:57 EST 2009


Author: marc
Date: 2009-01-26 16:57:57 -0500 (Mon, 26 Jan 2009)
New Revision: 3490

Modified:
   branches/astroidex_25/http/php/mb_listGUIs.php
Log:
Html output modification for XHTML Transitional

Modified: branches/astroidex_25/http/php/mb_listGUIs.php
===================================================================
--- branches/astroidex_25/http/php/mb_listGUIs.php	2009-01-26 21:57:08 UTC (rev 3489)
+++ branches/astroidex_25/http/php/mb_listGUIs.php	2009-01-26 21:57:57 UTC (rev 3490)
@@ -21,7 +21,7 @@
 	if(count($arrayGUIs) === 0) {
 		echo "<h1>Error</h1>";
 		echo "<p>There are no GUIs available for this user.</p>";
-		printf("<p><a href=\"../php/mod_logout.php?%s\"><img src=\"../img/button_gray/logout_off.png\" onmouseover=\"this.src='../img/button_gray/logout_over.png'\" onmouseout=\"this.src='../img/button_gray/logout_off.png'\" title=\"Logout\"></a></p>",SID);
+		printf("<p><a href=\"../php/mod_logout.php?%s\"><img src=\"../img/button_gray/logout_off.png\" onmouseover=\"this.src='../img/button_gray/logout_over.png'\" onmouseout=\"this.src='../img/button_gray/logout_off.png'\" alt=\"Logout\" title=\"Logout\"></a></p>",SID);
 		
 		return;
 	}
@@ -29,12 +29,13 @@
 	$v = array();
 	$t = array();
 
-	$sql  = "SELECT DISTINCT gui_id,gui_name,gui_description, ggc.*,gc.category_name,gc.category_description ";
+	$sql  = "SELECT DISTINCT gui_id,gui_name,gui_description, ggc.*,gc.category_name,gc.category_description, gc.category_id ";
 	$sql .= "FROM gui g ";
 	$sql .= "LEFT JOIN gui_gui_category ggc ON g.gui_id = ggc.fkey_gui_id ";
 	$sql .= "LEFT JOIN gui_category gc ON (ggc.fkey_gui_category_id = gc.category_id) ";
 	$sql .= "WHERE gui_id IN (";
 
+
 	for($i = 0; $i < count($arrayGUIs); $i++) {
 		if($i > 0) {
 			$sql .= ",";
@@ -45,41 +46,63 @@
 		array_push($v,$arrayGUIs[$i]);
 		array_push($t,'s');
 	}
+
+	$sql .= ") ORDER BY gc.category_id, gui_name";
+
+ 	$result = db_prep_query($sql,$v,$t);
 	
-	$sql .= ") ORDER BY gc.category_name, gui_name";
-		
-	$result = db_prep_query($sql,$v,$t);
-	
 	$category = NULL;
-echo "<h1><font align='left' color='#000000'>Ma</font><font color='#0000CE'>p</font><font color='#C00000'>b</font><font color='#000000'>ender </font> - "._mb('available Applications')."</h1>";
-	printf("<p><a href=\"../php/mod_logout.php?%s\"><img src=\"../img/button_gray/logout_off.png\" onmouseover=\"this.src='../img/button_gray/logout_over.png'\" onmouseout=\"this.src='../img/button_gray/logout_off.png'\" title=\"Logout\"></a></p>",SID);
-	
-	$total_guis = 0;
-	while($row = db_fetch_array($result)){
-		if($category !== $row["category_name"]) {
-			$category = $row["category_name"];
-			
-			echo "</ul>";
-			
-			if(strlen($row["category_name"]) > 0) {
-				printf("<h2 class=\"gui_category\">%s</h2>",$row["category_name"]);
-			}else{
-				printf("<h2 class=\"gui_category\">%s</h2>","Applcations");
-			}
-			if(strlen($row["category_description"]) > 0) {
-				printf("<p class=\"gui_category_description\"><em>%s</em></p>",$row["category_description"]);
-			}else{
-				printf("<p class=\"gui_category_description\"><em>%s</em></p>","Applications without category connection");
-			}
-			
-			echo "<ul class=\"gui_list\">";
-		}
-		
-		$class = ($total_guis %2 === 0) ? " class=\"alternate\"" : NULL;
-		$url   = sprintf("index.php?%s&gui_id=%s",strip_tags(SID),$row["gui_id"]);
-		printf("<li%s onclick=\"location.href='%s'\"><strong><a href=\"%s\">%s</a></strong><br /><em>%s</em></li>",$class,$url,$url,$row["gui_name"],$row["gui_description"]);
-		
-		$total_guis++;
-	}
+
+	echo "<h1 class='listGuisHeader'>Available GUIs</h1>\n";
+	printf("<p class='logoutButton'><a href=\"../php/mod_logout.php?%s\"><img src=\"../img/button_gray/logout_off.png\" onmouseover=\"this.src='../img/button_gray/logout_over.png'\" onmouseout=\"this.src='../img/button_gray/logout_off.png'\" title=\"Logout\" alt=\"Logout\" /></a></p>\n",SID);
+
+	echo "<div id='menu'>\n";
+	echo "<ul class=\"gui_list\">\n";
+
+
+  $num =  pg_numrows($result);
+ 
+  for ($j=0; $j<$num; $j++){
+     
+    $row = pg_fetch_array ($result, $j);  	
+     if($category !== $row["category_name"]) {
+  			$category = $row["category_name"];
+        			
+  			if(strlen($row["category_name"]) > 0) {		  
+  			
+          printf("\t<li class=\"gui_category\" id=\"%s\"><h2>%s</h2>",$row["category_name"],$row["category_name"]);			  
+        }
+        else {
+        	//$category="NULL";	  
+          printf("\t<li class=\"gui_category\" ><h2>GUI(s) without category</h2>");			  
+        }
+        
+  			if(strlen($row["category_description"]) > 0) {
+  				printf("<label for=\"%s\" class=\"gui_category_description\">%s</label>\n",$row["category_name"],$row["category_description"]);
+  			  echo "\t\t<ul>\n";
+        }
+        else {
+  			  echo "\n\t\t<ul>\n";		
+  		  } 
+  		}
+  		
+  		$url = sprintf("index.php?%s&amp;gui_id=%s",strip_tags(SID),$row["gui_id"]);
+  		if(($j % 2) == 0){$class= "class='alternate' ";}
+  		else {$class="class='normal'";}
+      printf("\t\t<li id=\"%s\" %s onclick=\"location.href='%s'\" ><a href=\"%s\">%s</a><label for=\"%s\">%s</label></li>\n",$row["gui_name"],$class,$url,$url,$row["gui_name"],$row["gui_name"],$row["gui_description"]);
+     
+     //checks next category or last category
+     $nextrow = pg_fetch_array ($result, $j+1); 
+     if(($category !== $nextrow["category_name"]) ||($num==$j+1)) {
+     echo "\t\t</ul>\n";
+     echo "\t</li>\n"; 
+     }
+   
+   
+          
+  }
+echo "</ul>\n";
+echo "</div>\n";
 }
-?>
\ No newline at end of file
+
+?>



More information about the Mapbender_commits mailing list