[Mapbender-commits] r8228 - in branches/2.7: http/javascripts resources/db/pgsql/UTF-8/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Dec 12 10:10:30 EST 2011


Author: verenadiewald
Date: 2011-12-12 07:10:29 -0800 (Mon, 12 Dec 2011)
New Revision: 8228

Modified:
   branches/2.7/http/javascripts/mod_legend.php
   branches/2.7/http/javascripts/mod_legendDiv.php
   branches/2.7/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql
Log:
added opportunity to show legend in reverse direction as element var

Modified: branches/2.7/http/javascripts/mod_legend.php
===================================================================
--- branches/2.7/http/javascripts/mod_legend.php	2011-12-08 12:42:55 UTC (rev 8227)
+++ branches/2.7/http/javascripts/mod_legend.php	2011-12-12 15:10:29 UTC (rev 8228)
@@ -68,6 +68,7 @@
 
 var checkbox_on_off = typeof checkbox_on_off === "undefined" ? 'false' : checkbox_on_off;
 var stickylegend = typeof stickylegend === "undefined" ? "false" : stickylegend;
+var reverse = typeof reverse === "undefined" ? "false" : reverse;
 
 function mod_legend_pos(frameName){
 	if(frameName == mod_legend_target){
@@ -85,9 +86,9 @@
 		
 		var str = "";
 		var str_tmp = "";
-						
-		for(var i=0; i<parent.mb_mapObj[ind].wms.length; i++){
-			
+
+		if(reverse == 'true') {
+			for(var i=parent.mb_mapObj[ind].wms.length-1; i>=0; i--){
 			 	var layerNames = parent.mb_mapObj[ind].wms[i].getLayers(parent.mb_mapObj[ind]);
 				for(var j=0; j<layerNames.length; j++){
 					var layerParent = parent.mb_mapObj[ind].wms[i].checkLayerParentByLayerName(layerNames[j]); 
@@ -124,14 +125,63 @@
 //	                	}
 					} 
 				}
-			if(str_tmp !=''){
-				if (showwmstitle == 'true'){
-					str += "<div><span class='header'>" +parent.mb_mapObj[ind].wms[i].wms_title+ "</span></div>";
+				if(str_tmp !=''){
+					if (showwmstitle == 'true'){
+						str += "<div><span class='header'>" +parent.mb_mapObj[ind].wms[i].wms_title+ "</span></div>";
+					}
+					str += str_tmp;
+					str_tmp ='';
 				}
-				str += str_tmp;
-				str_tmp ='';
-			}		
+			}	
 		}
+		else {
+			for(var i=0; i<parent.mb_mapObj[ind].wms.length; i++){
+				 	var layerNames = parent.mb_mapObj[ind].wms[i].getLayers(parent.mb_mapObj[ind]);
+					for(var j=0; j<layerNames.length; j++){
+						var layerParent = parent.mb_mapObj[ind].wms[i].checkLayerParentByLayerName(layerNames[j]); 
+						var layerTitle = parent.mb_mapObj[ind].wms[i].getTitleByLayerName(layerNames[j]);
+						var layerStyle = parent.mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layerNames[j]);
+						var legendUrl = false;
+						if(layerStyle == false){
+							legendUrl = parent.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],"");
+							
+							//alert("mapObj ind: "+ind+" wms index: "+i+"layer name: "+layerNames[j]+" : LegendUrl (style false): "+legendUrl);	
+						}
+						else{
+							legendUrl = parent.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],layerStyle);
+						}
+				         
+						if (legendUrl !== false){
+							
+	//	 					if(layerParent == 0){
+			 					if(showlayertitle == 'true'){
+									str_tmp += "<div><span class='titles'>" + layerTitle+ "</span></div>";
+								}
+								str_tmp += "<div>";
+			                    if(legendlink == 'true'){
+			                    	str_tmp += "<a href='../php/result.php?lingo=deutsch&layer="+layerNames[j]+"' class='link_metadata' title='Zeigt Liste zum Thema: "+layerTitle+"' target='result'>";
+			                    }
+					
+			                    str_tmp += "<img border=0 src = '";			
+								str_tmp += legendUrl;
+								str_tmp += "'></img>";
+								if (legendlink == 'true'){
+			                    	str_tmp += "</a>";
+			                    }
+			                    str_tmp += "</div>";
+	//	                	}
+						} 
+					}
+				if(str_tmp !=''){
+					if (showwmstitle == 'true'){
+						str += "<div><span class='header'>" +parent.mb_mapObj[ind].wms[i].wms_title+ "</span></div>";
+					}
+					str += str_tmp;
+					str_tmp ='';
+				}		
+			}
+		}
+
 	    if(str != ""){
 			parent.writeTag("legend", "leg", str);
 		}

Modified: branches/2.7/http/javascripts/mod_legendDiv.php
===================================================================
--- branches/2.7/http/javascripts/mod_legendDiv.php	2011-12-08 12:42:55 UTC (rev 8227)
+++ branches/2.7/http/javascripts/mod_legendDiv.php	2011-12-12 15:10:29 UTC (rev 8228)
@@ -43,6 +43,7 @@
 var showwmstitle = typeof showwmstitle === "undefined" ? "false" : showwmstitle;
 var showlayertitle = typeof showlayertitle === "undefined" ? "false" : showlayertitle;
 var showgroupedlayertitle = typeof showgroupedlayertitle === "undefined" ? "false" : showgroupedlayertitle;
+var reverse = typeof reverse === "undefined" ? "false" : reverse;
 
 function mod_legend_pos(frameName){
 	if(frameName == mod_legend_target){
@@ -51,50 +52,96 @@
 	
 		var str = "";
 		var str_tmp = "";
-						
-		for(var i=0; i<mb_mapObj[ind].wms.length; i++){
-			
-			 	var layerNames = mb_mapObj[ind].wms[i].getLayers(mb_mapObj[ind]);
-				for(var j=0; j<layerNames.length; j++){
-					var layerParent = mb_mapObj[ind].wms[i].checkLayerParentByLayerName(layerNames[j]); 
-					var layerTitle = mb_mapObj[ind].wms[i].getTitleByLayerName(layerNames[j]);
-					var layerStyle = mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layerNames[j]);
-					var legendUrl = false;
-					if(layerStyle == false){
-						legendUrl = mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],"");	
+		
+		if(reverse == 'true') {
+			for(var i=parent.mb_mapObj[ind].wms.length-1; i>=0; i--){
+				 	var layerNames = mb_mapObj[ind].wms[i].getLayers(mb_mapObj[ind]);
+					for(var j=0; j<layerNames.length; j++){
+						var layerParent = mb_mapObj[ind].wms[i].checkLayerParentByLayerName(layerNames[j]); 
+						var layerTitle = mb_mapObj[ind].wms[i].getTitleByLayerName(layerNames[j]);
+						var layerStyle = mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layerNames[j]);
+						var legendUrl = false;
+						if(layerStyle == false){
+							legendUrl = mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],"");	
+						}
+						else{
+							legendUrl = mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],layerStyle);
+						}
+				         
+						if (legendUrl !== false){
+							
+	//	 					if(layerParent == 0){
+			 					if(showlayertitle == 'true'){
+	                                                        	str_tmp += "<div><span class='titles'>" + layerTitle+ "</span></div>";
+								}
+								str_tmp += "<div>";
+			                    if(legendlink == 'true'){
+			                    	str_tmp += "<a href='../php/result.php?lingo=deutsch&layer="+layerNames[j]+"' class='link_metadata' title='Zeigt Liste zum Thema: "+layerTitle+"' target='result'>";
+			                    }
+			                    str_tmp += "<img border=0 src = '";			
+								str_tmp += legendUrl;
+								str_tmp += "'></img>";
+								if (legendlink == 'true'){
+			                    	str_tmp += "</a>";
+			                    }
+			                    str_tmp += "</div>";
+	//	                	}
+						} 
 					}
-					else{
-						legendUrl = mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],layerStyle);
+				if(str_tmp !=''){
+					if (showwmstitle == 'true'){
+						str += "<div><span class='header'>" +mb_mapObj[ind].wms[i].wms_title+ "</span></div>";
 					}
-			         
-					if (legendUrl !== false){
-						
-//	 					if(layerParent == 0){
-		 					if(showlayertitle == 'true'){
-                                                        	str_tmp += "<div><span class='titles'>" + layerTitle+ "</span></div>";
-							}
-							str_tmp += "<div>";
-		                    if(legendlink == 'true'){
-		                    	str_tmp += "<a href='../php/result.php?lingo=deutsch&layer="+layerNames[j]+"' class='link_metadata' title='Zeigt Liste zum Thema: "+layerTitle+"' target='result'>";
-		                    }
-		                    str_tmp += "<img border=0 src = '";			
-							str_tmp += legendUrl;
-							str_tmp += "'></img>";
-							if (legendlink == 'true'){
-		                    	str_tmp += "</a>";
-		                    }
-		                    str_tmp += "</div>";
-//	                	}
-					} 
-				}
-			if(str_tmp !=''){
-				if (showwmstitle == 'true'){
-					str += "<div><span class='header'>" +mb_mapObj[ind].wms[i].wms_title+ "</span></div>";
-				}
-				str += str_tmp;
-				str_tmp ='';
-			}		
+					str += str_tmp;
+					str_tmp ='';
+				}		
+			}
 		}
+		else {
+			for(var i=0; i<mb_mapObj[ind].wms.length; i++){
+				 	var layerNames = mb_mapObj[ind].wms[i].getLayers(mb_mapObj[ind]);
+					for(var j=0; j<layerNames.length; j++){
+						var layerParent = mb_mapObj[ind].wms[i].checkLayerParentByLayerName(layerNames[j]); 
+						var layerTitle = mb_mapObj[ind].wms[i].getTitleByLayerName(layerNames[j]);
+						var layerStyle = mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layerNames[j]);
+						var legendUrl = false;
+						if(layerStyle == false){
+							legendUrl = mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],"");	
+						}
+						else{
+							legendUrl = mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layerNames[j],layerStyle);
+						}
+				         
+						if (legendUrl !== false){
+							
+	//	 					if(layerParent == 0){
+			 					if(showlayertitle == 'true'){
+	                                                        	str_tmp += "<div><span class='titles'>" + layerTitle+ "</span></div>";
+								}
+								str_tmp += "<div>";
+			                    if(legendlink == 'true'){
+			                    	str_tmp += "<a href='../php/result.php?lingo=deutsch&layer="+layerNames[j]+"' class='link_metadata' title='Zeigt Liste zum Thema: "+layerTitle+"' target='result'>";
+			                    }
+			                    str_tmp += "<img border=0 src = '";			
+								str_tmp += legendUrl;
+								str_tmp += "'></img>";
+								if (legendlink == 'true'){
+			                    	str_tmp += "</a>";
+			                    }
+			                    str_tmp += "</div>";
+	//	                	}
+						} 
+					}
+				if(str_tmp !=''){
+					if (showwmstitle == 'true'){
+						str += "<div><span class='header'>" +mb_mapObj[ind].wms[i].wms_title+ "</span></div>";
+					}
+					str += str_tmp;
+					str_tmp ='';
+				}		
+			}
+		}				
+
 	    if(str != ""){
 			writeTag("", "legend", str);
 		}

Modified: branches/2.7/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql
===================================================================
--- branches/2.7/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql	2011-12-08 12:42:55 UTC (rev 8227)
+++ branches/2.7/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql	2011-12-12 15:10:29 UTC (rev 8228)
@@ -101,3 +101,14 @@
 
 -- Fix: wrong tooltip for Legend-button
 UPDATE gui_element SET e_title = 'Legend' WHERE e_id = 'legendButton' AND fkey_gui_id = 'template_print';
+
+-- new element_var reverse for element legend
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type)
+SELECT gui_element.fkey_gui_id,
+'legend', 'reverse', 'false', 'parameter to decide wether the legend should be in the reverse direction' ,'var'
+from gui_element
+WHERE
+gui_element.e_id = 'legend' AND
+gui_element.fkey_gui_id
+NOT IN (SELECT fkey_gui_id FROM gui_element_vars WHERE fkey_e_id = 'legend' AND var_name = 'reverse');
+



More information about the Mapbender_commits mailing list