[Mapbender-commits] r2838 - branches/2.5/http/print

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Aug 18 03:11:32 EDT 2008


Author: tbaschetti
Date: 2008-08-18 03:11:32 -0400 (Mon, 18 Aug 2008)
New Revision: 2838

Modified:
   branches/2.5/http/print/mod_printPDF.php
Log:
reapplied fix for http://trac.osgeo.org/mapbender/ticket/205

Modified: branches/2.5/http/print/mod_printPDF.php
===================================================================
--- branches/2.5/http/print/mod_printPDF.php	2008-08-15 22:20:09 UTC (rev 2837)
+++ branches/2.5/http/print/mod_printPDF.php	2008-08-18 07:11:32 UTC (rev 2838)
@@ -1,7 +1,7 @@
 <?php
 # $Id: mod_printPDF.php
 # http://www.mapbender.org/index.php/mod_printPDF.php
-# Copyright (C) 2002 CCGIS 
+# Copyright (C) 2002 CCGIS
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -73,34 +73,34 @@
 		document.forms[0].wms_id.value = "";
 		document.forms[0].wms_title.value = "";
 		document.forms[0].legendurl.value = "";
-		
+
 		for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
 			layers = pt.mb_mapObj[ind].wms[i].getLayers(pt.mb_mapObj[ind]);
 			if(layers != "" && layers){
-			
+
 				if(i>0 && document.forms[0].wms_id.value!=''){
 				    document.forms[0].layers.value += "___";
 				    document.forms[0].wms_id.value += "___";
 				    document.forms[0].wms_title.value += "___";
 				    document.forms[0].legendurl.value += "___";
 				}
-						
-				document.forms[0].wms_id.value += pt.mb_mapObj[ind].wms[i].wms_id;   
+
+				document.forms[0].wms_id.value += pt.mb_mapObj[ind].wms[i].wms_id;
 				document.forms[0].wms_title.value += pt.mb_mapObj[ind].wms[i].wms_title;
-					
-				for(var j=0; j<layers.length; j++){			
+
+				for(var j=0; j<layers.length; j++){
 					var layer = layers[j];
 					var title = pt.mb_mapObj[ind].wms[i].getTitleByLayerName(layers[j]);
 					var layerStyle = pt.mb_mapObj[ind].wms[i].getCurrentStyleByLayerName(layers[j]);
 					if(layerStyle==false){
-						var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],"default");	
+						var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],"default");
 					}
 					else{
 						var temp_legendurl = pt.mb_mapObj[ind].wms[i].getLegendUrlByGuiLayerStyle(layers[j],layerStyle);
 					}
-					
+
 					//---------- legendurl ----------
-					tmp_name = "";	
+					tmp_name = "";
 					if(j>0){
 						document.forms[0].layers.value += ",";
 					}
@@ -112,8 +112,8 @@
 						document.forms[0].legendurl.value += temp_legendurl;
 					}else{
 						document.forms[0].legendurl.value +='0';
-					}	
-				}	
+					}
+				}
 			}
 			else{
 				if(i>0 && document.forms[0].wms_id.value!=''){
@@ -122,33 +122,33 @@
 				    document.forms[0].wms_title.value += "___";
 				    document.forms[0].legendurl.value += "___";
 			    }
-				
+
 				document.forms[0].layers.value += "0";
 			    document.forms[0].wms_id.value += "0";
 			    document.forms[0].wms_title.value += "0";
 			    document.forms[0].legendurl.value += "0";
 			}
 		}//for
-		//alert(document.forms[0].layers.value+"---"+document.forms[0].wms_id.value+"---"+document.forms[0].wms_title.value+"---"+document.forms[0].legendurl.value);	
-			
+		//alert(document.forms[0].layers.value+"---"+document.forms[0].wms_id.value+"---"+document.forms[0].wms_title.value+"---"+document.forms[0].legendurl.value);
+
 	}
 
 	function validate(){
 		size = document.getElementById('size').options[document.getElementById('size').selectedIndex].value;
 		format = document.getElementById('format').options[document.getElementById('format').selectedIndex].value;
-		
+
 		if(size != "" && format != ""){
 			var ind = pt.getMapObjIndexByName(target);
 			var coord = pt.mb_mapObj[ind].extent.split(",");
 			var centerX = parseFloat(coord[0]) + (parseFloat(coord[2]) - parseFloat(coord[0]))/2
 			var centerY = parseFloat(coord[1]) + (parseFloat(coord[3]) - parseFloat(coord[1]))/2
 			if(size == "A4" && format == "portrait"){
-				map_width = <?php echo $a4p_map_width; ?>; 
-				map_height = <?php echo $a4p_map_height; ?>; 
+				map_width = <?php echo $a4p_map_width; ?>;
+				map_height = <?php echo $a4p_map_height; ?>;
 			}
 			if(size == "A4" && format == "landscape"){
 				map_width = <?php echo $a4l_map_width; ?>;
-				map_height = <?php echo $a4l_map_height; ?>; 
+				map_height = <?php echo $a4l_map_height; ?>;
 			}
 			if(size == "A3" && format == "portrait"){
 				map_width = <?php echo $a3p_map_width; ?>;
@@ -157,7 +157,7 @@
 			if(size == "A3" && format == "landscape"){
 				map_width = <?php echo $a3l_map_width; ?>;
 				map_height = <?php echo $a3l_map_height; ?>;
-			}  
+			}
 			if(size == "A2" && format == "portrait"){
 				map_width = <?php echo $a2p_map_width; ?>;
 				map_height = <?php echo $a2p_map_height; ?>;
@@ -181,8 +181,9 @@
 			if(size == "A0" && format == "landscape"){
 				map_width = <?php echo $a0l_map_width; ?>;
 				map_height = <?php echo $a0l_map_height; ?>;
-			}     
+			}
 			var pos = pt.makeClickPos2RealWorldPos(target, map_width , map_height);
+			var prevscale= pt.mb_getScale(target);
 			pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
 
 			pt.mb_mapObj[ind].width = Math.round(map_width);
@@ -192,20 +193,20 @@
 			pt.window.frames[target].document.getElementById("maps").style.width = Math.round(map_width);
 			pt.window.frames[target].document.getElementById("maps").style.height = Math.round(map_height);
 
-			//pt.setMapRequest(target);		
-			pt.mb_repaintScale(target, null, null, pt.mb_getScale(target));
+			//pt.setMapRequest(target);
+			pt.mb_repaintScale(target, null, null, prevscale);
 		document.form1.map_url.value = '';
 			for(var i=0; i<pt.mb_mapObj[ind].wms.length; i++){
 				if(pt.mb_mapObj[ind].wms[i].gui_wms_visible > 0){
-					if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){   
+					if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){
 						if(document.form1.map_url.value != ""){
 							document.form1.map_url.value += "___";
-						}         
+						}
 						document.form1.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
 					}
 				}
 			}
-			
+
 			//overview_url
 			var ind_overview = pt.getMapObjIndexByName('overview');
 
@@ -224,7 +225,7 @@
 				if(pt.mb_mapObj[ind].wms[i].mapURL != false && pt.mb_mapObj[ind].wms[i].mapURL != 'false' && pt.mb_mapObj[ind].wms[i].mapURL != ''){
 					if(f.map_url.value != ""){
 						f.map_url.value += "___";
-					}      
+					}
 					f.map_url.value += pt.mb_mapObj[ind].wms[i].mapURL;
 				}
 			}
@@ -247,9 +248,9 @@
 			}else{
 				document.form1.mylegend.value = 'true';
 			}
-			
+
 			// write the measured coordinates
-			
+
 			if (pt.mod_measure_RX != undefined && pt.mod_measure_RY != undefined) {
 				var tmp_x = '';
 				var tmp_y = '';
@@ -268,7 +269,7 @@
 				document.forms['form1'].elements['measured_x_values'].value = tmp_x;
 				document.forms['form1'].elements['measured_y_values'].value = tmp_y;
 			}
-			
+
 			document.form1.submit();
 		}
 		else{
@@ -289,7 +290,7 @@
 <body>
 <form name="form1" method="post" action="../print/mod_printPDF_pdf.php?<?php echo SID; ?>" target="_blank">
 <p id="container_size">
-	<label for="size"><?php echo $label_format ?></label> 
+	<label for="size"><?php echo $label_format ?></label>
 	<select id="size" name="size" onchange="validate();">
 		<option value="false">-</option>
 		<?php
@@ -303,7 +304,7 @@
 </p>
 
 <p id="container_orientation">
-	<label for="format"><?php echo $label_orientation; ?></label> 
+	<label for="format"><?php echo $label_orientation; ?></label>
 	<select id="format" name="format" onchange="validate();">
 		<option value="portrait"><?php echo $label_portrait; ?></option>
 		<option value="landscape"><?php echo $label_landscape; ?></option>
@@ -312,7 +313,7 @@
 
 <?php if($highquality === TRUE): ?>
 	<p id="container_quality">
-		<label for="quality"><?php echo $label_quality; ?></label> 
+		<label for="quality"><?php echo $label_quality; ?></label>
 		<input type="radio" id="quality" name="quality" value="1" checked="checked" /> <?php echo $label_72dpi; ?>
 		<input type="radio" id="quality" name="quality" value="2" /> <?php echo $label_288dpi; ?>
 	</p>
@@ -330,19 +331,19 @@
 		$html .= sprintf("<label for=\"c%s\">%s%s</label> ",$i,${"label_comment".$i},$label_hint);
 		$html .= sprintf("<textarea id=\"c%s\" name=\"c%s\" cols=\"20\" rows=\"2\"%s></textarea> ",$i,$i,$javascript);
 		$html .= "</p>";
-		
+
 		echo $html;
 	}
 ?>
 
 <?php if($legend === TRUE): ?>
 	<p id="container_legend">
-		<label for="mylegendcheckbox"><?php echo $label_legend; ?></label>  
+		<label for="mylegendcheckbox"><?php echo $label_legend; ?></label>
 		<input type="checkbox" id="mylegendcheckbox" name="mylegendcheckbox" value="false" />
 	</p>
 <?php else: ?>
 	<input type="hidden" name="mylegendcheckbox" value="false" />
-<?php endif; ?>  
+<?php endif; ?>
 
 <input type="hidden" name="map_url" />
 <input type="hidden" name="overview_url" />



More information about the Mapbender_commits mailing list