[Mapbender-commits] r3621 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Mar 3 03:23:53 EST 2009
Author: astrid_emde
Date: 2009-03-03 03:23:53 -0500 (Tue, 03 Mar 2009)
New Revision: 3621
Modified:
trunk/mapbender/http/php/mb_listGUIs.php
Log:
gui-categories added
http://trac.osgeo.org/mapbender/ticket/344
http://www.mapbender.org/GUI_Category
Modified: trunk/mapbender/http/php/mb_listGUIs.php
===================================================================
--- trunk/mapbender/http/php/mb_listGUIs.php 2009-03-03 08:22:07 UTC (rev 3620)
+++ trunk/mapbender/http/php/mb_listGUIs.php 2009-03-03 08:23:53 UTC (rev 3621)
@@ -17,47 +17,92 @@
# 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>";
- echo "<h2><font align='left' color='#000000'>Ma</font><font color='#0000CE'>p</font><font color='#C00000'>b</font><font color='#000000'>ender GUI list </font> </h2>";
- echo "</td><td>";
+ 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'\" alt=\"Logout\" title=\"Logout\"></a></p>",SID);
+
+ return;
+ }
- if (count($arrayGUIs)>0){
- $v = array();
- $t = array();
- $sql_list_guis = "SELECT DISTINCT gui_id,gui_name,gui_description FROM gui 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');
+ $v = array();
+ $t = array();
+
+ $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 .= ",";
}
- $sql_list_guis .= ") ORDER BY gui_name";
- $res_list_guis = db_prep_query($sql_list_guis,$v,$t);
- 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></table>";
- echo "<table width='50%' class='list_guis' border='1' cellpadding='3' rules='rows'><tr style='background-color:#F0F0F0;' width='80px'><td ><b>GUI name</b></td><td><b>GUI description</b></td></tr>";
- $cnt_list_guis = 0;
- while($row = db_fetch_array($res_list_guis)){
- echo "<tr ";
- if(($cnt_list_guis % 2) == 0){ echo " style='background-color:#ffffff;' ";}
- echo ">";
- echo "<td><b><a href='index.php?".strip_tags (SID)."&gui_id=".$row["gui_id"]."'>".$row["gui_name"]."</a><b></td>";
- echo "<td>".$row["gui_description"]."</td>";
- echo "</tr>";
- $cnt_list_guis++;
- }
+
+ $sql .= "$".($i + 1);
+
+ array_push($v,$arrayGUIs[$i]);
+ array_push($t,'s');
}
- 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>";
+
+ $sql .= ") ORDER BY gc.category_id, gui_name";
+
+ $result = db_prep_query($sql,$v,$t);
+
+ $category = NULL;
+
+ 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&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";
}
+
?>
More information about the Mapbender_commits
mailing list