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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jan 13 02:53:34 EST 2009


Author: beck
Date: 2009-01-13 02:53:34 -0500 (Tue, 13 Jan 2009)
New Revision: 3429

Modified:
   branches/astroidex_25/http/php/mb_listGUIs.php
Log:
Added tableless GUI listing.

Modified: branches/astroidex_25/http/php/mb_listGUIs.php
===================================================================
--- branches/astroidex_25/http/php/mb_listGUIs.php	2009-01-13 07:53:03 UTC (rev 3428)
+++ branches/astroidex_25/http/php/mb_listGUIs.php	2009-01-13 07:53:34 UTC (rev 3429)
@@ -17,91 +17,62 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-# list of user-guis after login:
 function mb_listGUIs($arrayGUIs){
-	echo "<form name='listGUIsForm' target='_blank'>";
-	echo "<table width = '50%' ><tr><td id='head_border'>";
-	echo "<h2><font align='left' color='#000000'>xxxxx Categories Ma</font><font color='#0000CE'>p</font><font color='#C00000'>b</font><font color='#000000'>ender GUI list </font> </h2>";
-	echo "</td><td id='head_border'>";
+	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);
+		
+		return;
+	}
 	
-	if (count($arrayGUIs)>0){
-		$v = array();
-		$t = array();
+	$v = array();
+	$t = array();
 
-		$sql_list_guis = "SELECT DISTINCT gui_id,gui_name,gui_description, ggc.*,gc.category_name,gc.category_description FROM gui g ";
-		$sql_list_guis .= "Left JOIN gui_gui_category ggc ON ";
-		$sql_list_guis .= "g.gui_id = ggc.fkey_gui_id ";
-		$sql_list_guis .= "Left Join gui_category gc On (ggc.fkey_gui_category_id = gc.category_id) ";
-		$sql_list_guis .= "WHERE gui_id IN (";
+	$sql  = "SELECT DISTINCT gui_id,gui_name,gui_description, ggc.*,gc.category_name,gc.category_description ";
+	$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_list_guis .= ",";}
-			$sql_list_guis .= "$".($i+1);
-			array_push($v,$arrayGUIs[$i]);
-			array_push($t,'s');
+	for($i = 0; $i < count($arrayGUIs); $i++) {
+		if($i > 0) {
+			$sql .= ",";
 		}
-
-		$sql_list_guis .= ") ORDER BY gc.category_name, gui_name";
 		
-		$res_list_guis = db_prep_query($sql_list_guis,$v,$t);
-
-		echo "<a href=\"../php/mod_logout.php?".SID."\"><img src =\"../img/button_gray/logout_off.png\" border='0' onmouseover='this.src=\"../img/button_gray/logout_over.png\"' onmouseout='this.src=\"../img/button_gray/logout_off.png\"' title=\"Logout\"></a>";
-		echo "</td></tr></table>";
+		$sql .= "$".($i + 1);
 		
+		array_push($v,$arrayGUIs[$i]);
+		array_push($t,'s');
+	}
+	
+	$sql .= ") ORDER BY gc.category_name, gui_name";
 		
-#echo "<table width='50%' class='list_guis' border='1' cellpadding='3' rules='rows'><tr='background-color:#F0F0F0;' width='80px'><td ><b>GUI name</b></td><td><b>GUI description</b></td></tr>";
-		$cnt_list_guis = 0;
-		$tempCategory = '';
-		$table_rows = array();
+	$result = db_prep_query($sql,$v,$t);
+	
+	$category = NULL;
 
-		while($row = db_fetch_array($res_list_guis)){
-				if($tempCategory != $row["category_name"]){
-				$tempCategory = $row["category_name"];
-				if ($cnt_list_guis != 0){echo "</table>";}
-					echo "<p>".$tempCategory;
-					echo "<br><label><em>".$row["category_description"]."</em></label></p>";
-					echo "<table class='list_guis' cellpadding='3'>"; # rules='rows'
-					echo "<tr><th class='th_gui' >GUI name</th><th class='th_gui_description'>GUI description</th></tr>";
-				}
+	echo "<h1>Available GUIs</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);
+	
+	while($row = db_fetch_array($result)){
+		if($category !== $row["category_name"]) {
+			$category = $row["category_name"];
 			
-			echo "<tr>";
-			echo "<td class='td_gui' ><b><a href='index.php?".strip_tags (SID)."&gui_id=".$row["gui_id"]."'>".$row["gui_name"]."</a><b></td>";
-			echo "<td class='td_gui_description'><a href='index.php?".strip_tags (SID)."&gui_id=".$row["gui_id"]."'>".$row["gui_description"]."</a></td>";
-			echo "</tr>";
-			array_push($table_rows,"table_row_".$cnt_list_guis);
-			$cnt_list_guis++;
+			echo "</ul>";
+			
+			if(strlen($row["category_name"]) > 0) {
+				printf("<h2 class=\"gui_category\">%s</h2>",$row["category_name"]);
+			}
+			if(strlen($row["category_description"]) > 0) {
+				printf("<p class=\"gui_category_description\"><em>%s</em></p>",$row["category_description"]);
+			}
+			
+			echo "<ul class=\"gui_list\">";
 		}
+		
+		$url = sprintf("index.php?%s&gui_id=%s",strip_tags(SID),$row["gui_id"]);
+		printf("<li onclick=\"location.href='%s'\"><strong><a href=\"%s\">%s</a></strong><br /><em>%s</em></li>",$url,$url,$row["gui_name"],$row["gui_description"]);
 	}
-	else{
-		echo "</td><td align = 'right'>";
-		echo "<a href=\"../php/mod_logout.php?".SID."\"><img src =\"../img/button_gray/logout_off.png\" border='0' onmouseover='this.src=\"../img/button_gray/logout_over.png\"' onmouseout='this.src=\"../img/button_gray/logout_off.png\"' title=\"Logout\"></a>";
-		echo "</td><tr>" ;
-		echo "<td><br>There are no guis available for this user</td></tr>";
-		echo "</table>";
-	}
-	echo "</form>";
 }
-?>
-
-<script type="text/javascript">
-function toggleDescription() {
-	var thsDescription = document.getElementsByTagName('th');
-	var tdsDescription = document.getElementsByTagName('td');
-	
-	for(var i = 0; i < thsDescription.length; i++) {
-		if(thsDescription[i].className == 'th_gui_description') {
-			var visibility = thsDescription[i].style.visibility;
-			thsDescription[i].style.visibility = (visibility == 'hidden') ? 'visible' : 'hidden';
-		}
-	}
-	
-	for(var i = 0; i < tdsDescription.length; i++) {
-		if(tdsDescription[i].className == 'td_gui_description') {
-			var visibility = tdsDescription[i].style.visibility;
-			tdsDescription[i].style.visibility = (visibility == 'hidden') ? 'visible' : 'hidden';
-		}
-	}
-}
-</script>
-
-<p><a href="#" onclick="toggleDescription();">Beschreibungen ein-/ausblenden</a></p>
\ No newline at end of file
+?>
\ No newline at end of file



More information about the Mapbender_commits mailing list