[Mapbender-commits] r3424 - branches/beck_dev/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jan 12 05:57:13 EST 2009


Author: beck
Date: 2009-01-12 05:57:13 -0500 (Mon, 12 Jan 2009)
New Revision: 3424

Modified:
   branches/beck_dev/http/php/mb_listGUIs.php
Log:


Modified: branches/beck_dev/http/php/mb_listGUIs.php
===================================================================
--- branches/beck_dev/http/php/mb_listGUIs.php	2009-01-12 07:21:36 UTC (rev 3423)
+++ branches/beck_dev/http/php/mb_listGUIs.php	2009-01-12 10:57:13 UTC (rev 3424)
@@ -1,5 +1,5 @@
 <?php
-# $Id: mb_listGUIs.php 3411 2009-01-07 13:08:15Z astrid_emde $
+# $Id: mb_listGUIs.php 3411 2009-01-12 08:22:37Z beck $
 # http://www.mapbender.org/index.php/mb_listGUIs.php
 # Copyright (C) 2002 CCGIS 
 #
@@ -17,91 +17,134 @@
 # 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>";
+			
+			printf("<h2>%s</h2>",$row["category_name"]);
+			if(strlen($row["category_description"]) > 0) {
+				printf("<p><em>%s</em></p>",$row["category_description"]);
+			}
+			
+			echo "<ul>";
 		}
+		
+		$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';
-		}
-	}
+<style type="text/css">
+* {
+	font-weight: normal;
+	font-style: normal;
 }
-</script>
 
-<p><a href="#" onclick="toggleDescription();">Beschreibungen ein-/ausblenden</a></p>
\ No newline at end of file
+body {
+	margin: 0;
+	padding: 1em;
+	font: 12px/1em normal Arial,Verdana,Helvetica,sans-serif;
+	color: #000;
+	background-color: #fff;
+}
+
+h1, h2, p, li {
+	padding: 0;
+	line-height: 1.2em;
+}
+
+h1 {
+	font-size: 2em;
+}
+
+h2 {
+	font-size: 1.5em;
+}
+
+img {
+	border: 0;
+}
+
+ul {
+	width: 65em;
+	padding: .5em;
+	list-style: none;
+	background-color: #eee;
+	border: 1px solid #666;
+}
+
+ul li {
+	clear: both;
+	margin-top: -1px;
+	padding: .25em .5em;
+	background-color: #ffe;
+	border: 1px solid #666;
+	cursor: pointer;
+}
+
+ul li:hover {
+	background-color: #ff9;
+}
+
+ul li strong {
+	float: left;
+	width: 25%;
+	font-weight: bold;
+}
+
+ul li em {
+	float: right;
+	width: 75%;
+	margin-top: -1.2em;
+	color: #666;
+}
+
+a:link, a:visited, a:active {
+	font-size: inherit;
+	font-weight: inherit;
+	text-decoration: none;
+	text-transform: uppercase;
+	color: inherit;
+}
+</style>
\ No newline at end of file



More information about the Mapbender_commits mailing list