[Mapbender-commits] r5905 - in branches/3_dev: core/lib http/frames

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun Apr 11 05:25:29 EDT 2010


Author: mschulz
Date: 2010-04-11 05:25:26 -0400 (Sun, 11 Apr 2010)
New Revision: 5905

Modified:
   branches/3_dev/core/lib/class_User.php
   branches/3_dev/http/frames/login.php
Log:
changed zebra to tabs

Modified: branches/3_dev/core/lib/class_User.php
===================================================================
--- branches/3_dev/core/lib/class_User.php	2010-04-11 08:27:16 UTC (rev 5904)
+++ branches/3_dev/core/lib/class_User.php	2010-04-11 09:25:26 UTC (rev 5905)
@@ -762,5 +762,49 @@
 		}
         return true;
 	}
+	
+    /**
+     * selects the category with guis
+     *
+     * @param $arrayGUIs			
+     * @return integer[]    the IDs of the gui_categories
+     */
+	function getGuiCategoryList($arrayGUIs){
+		$v = array();
+		$t = array();
+	
+		$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 .= ",";
+			}
+			
+			$sql .= "$".($i + 1);
+			
+			array_push($v,$arrayGUIs[$i]);
+			array_push($t,'s');
+		}
+		
+		$sql .= ") ORDER BY gc.category_name, gui_name";
+			
+		$result = db_prep_query($sql,$v,$t);
+		$resultArray = array();
+		
+		if ($result) {
+			while($row = db_fetch_array($result)) {
+				array_push($resultArray, $row);
+			}
+			return $resultArray;
+		}
+		else {
+			return false;
+		}
+	}	
+	
 }
 ?>

Modified: branches/3_dev/http/frames/login.php
===================================================================
--- branches/3_dev/http/frames/login.php	2010-04-11 08:27:16 UTC (rev 5904)
+++ branches/3_dev/http/frames/login.php	2010-04-11 09:25:26 UTC (rev 5905)
@@ -25,61 +25,49 @@
 		return;
 	}
 	
-	$v = array();
-	$t = array();
-
-	$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 .= ",";
-		}
-		
-		$sql .= "$".($i + 1);
-		
-		array_push($v,$arrayGUIs[$i]);
-		array_push($t,'s');
-	}
+	$user = new User(Mapbender::session()->get('mb_user_id'));
+	$result = $user->getGuiCategoryList($arrayGUIs);
 	
-	$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>";
+	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);
-	
+	echo "\n<div id=\"cat_tabs\">";
+	echo "<ul>";
 	$total_guis = 0;
-	while($row = db_fetch_array($result)){
+	$total_cats = 0;
+	$divString = "\t<div>";
+	foreach ($result as $row){
 		if($category !== $row["category_name"]) {
 			$category = $row["category_name"];
-			
-			echo "</ul>";
-			
+			/* first echo the tab div with the tab <ul>'s */
+			echo "\t<li><a href=\"#cat_tabs-$total_cats\"";
+			if(strlen($row["category_description"]) > 0) {
+				printf(" title=\"%s\"",$row["category_description"]);
+			} else {
+				printf(" title=\"%s\"","");
+			}			
+			echo ">";
 			if(strlen($row["category_name"]) > 0) {
-				printf("<h2 class=\"gui_category\">%s</h2>",$row["category_name"]);
-			}else{
-				printf("<h2 class=\"gui_category\">%s</h2>","");
+				echo $category;
 			}
-			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>","");
+			else {
+				echo _mb("ohne Katgeorie");
 			}
-			
-			echo "<ul class=\"gui_list\">";
+			echo "</a></li>\n";
+			/* then concatenate a string containing the tab div's content */
+			$divString .= "\t</div>\n\t<div id=\"cat_tabs-$total_cats\">\n";
+			$total_cats++;
+
 		}
 		
 		$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><a href=\"%s\"><strong>%s</strong><br /><em>%s</em></a></li>",$class,$url,$row["gui_name"],$row["gui_description"]);
+		$divString .= "\t\t<p><a href=\"$url\"><strong>".$row["gui_name"]."</strong> - <em>".$row["gui_description"]."</em></a></p>\n";
+		$total_guis++;
 		
-		$total_guis++;
 	}
+	echo "</ul>\n";
+	echo $divString."\n</div>";
 }
 
 function auth_user($name,$pw){
@@ -143,6 +131,18 @@
 <META http-equiv="Content-Script-Type" content="text/javascript">
 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET;?>">	
 <title>Login</title>
+	<link type="text/css" href="../extensions/jquery-ui-1.8.custom/development-bundle/themes/base/jquery.ui.all.css" rel="stylesheet" />
+	<script type="text/javascript" src="../extensions/jquery-ui-1.8.custom/development-bundle/jquery-1.4.2.js"></script>
+	<script type="text/javascript" src="../extensions/jquery-ui-1.8.custom/development-bundle/external/jquery.bgiframe-2.1.1.js"></script>
+	<script type="text/javascript" src="../extensions/jquery-ui-1.8.custom/development-bundle/ui/jquery.ui.core.js"></script>
+
+	<script type="text/javascript" src="../extensions/jquery-ui-1.8.custom/development-bundle/ui/jquery.ui.widget.js"></script>
+	<script type="text/javascript" src="../extensions/jquery-ui-1.8.custom/development-bundle/ui/jquery.ui.mouse.js"></script>
+	<script type="text/javascript" src="../extensions/jquery-ui-1.8.custom/development-bundle/ui/jquery.ui.draggable.js"></script>
+	<script type="text/javascript" src="../extensions/jquery-ui-1.8.custom/development-bundle/ui/jquery.ui.position.js"></script>
+	<script type="text/javascript" src="../extensions/jquery-ui-1.8.custom/development-bundle/ui/jquery.ui.resizable.js"></script>
+	<script type="text/javascript" src="../extensions/jquery-ui-1.8.custom/development-bundle/ui/jquery.ui.dialog.js"></script>
+	<script type="text/javascript" src="../extensions/jquery-ui-1.8.custom/development-bundle/ui/jquery.ui.tabs.js"></script>
 <?php
 echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/login.css\">";
 $name = $_REQUEST["name"];
@@ -174,7 +174,16 @@
 </script>
 HTML;
 }
-
+echo <<<HTML
+<script type='text/javascript'>
+	<!--
+	$(document).ready(function() {
+		$("#cat_tabs").tabs();
+	});
+	
+	// -->
+</script>
+HTML;
 echo "</head>";
 echo "<body onload='setFocus()'>";
 



More information about the Mapbender_commits mailing list