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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jul 23 02:52:37 EDT 2008


Author: tbaschetti
Date: 2008-07-23 02:52:36 -0400 (Wed, 23 Jul 2008)
New Revision: 2698

Modified:
   branches/2.5/http/print/mod_printPDF.php
Log:
fixes 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-07-22 17:14:25 UTC (rev 2697)
+++ branches/2.5/http/print/mod_printPDF.php	2008-07-23 06:52:36 UTC (rev 2698)
@@ -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
@@ -36,7 +36,7 @@
 
 	<?php
 	include '../include/dyn_css.php';
-	
+
 	//FIXME:
 	//setlocale(LC_ALL, "de_DE.utf8");
 
@@ -77,34 +77,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 += ",";
 					}
@@ -116,8 +116,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!=''){
@@ -126,33 +126,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; ?>;
@@ -161,7 +161,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; ?>;
@@ -185,10 +185,10 @@
 			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);
 			pt.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
-
+			var prevscale= pt.mb_getScale(target);
 			pt.mb_mapObj[ind].width = Math.round(map_width);
 			pt.mb_mapObj[ind].height = Math.round(map_height);
 			pt.document.getElementById(target).style.width = Math.round(map_width);
@@ -196,20 +196,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');
 
@@ -228,7 +228,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;
 				}
 			}
@@ -251,9 +251,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 = '';
@@ -272,7 +272,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{
@@ -293,7 +293,7 @@
 <form name="form1" method="POST" action="../print/mod_printPDF_pdf.php?<?php echo SID; ?>" target="_blank">
 
 <p>
-	<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
@@ -307,7 +307,7 @@
 </p>
 
 <p>
-	<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>
@@ -316,32 +316,32 @@
 
 <?php if($highquality === TRUE): ?>
 	<p>
-		<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>
 <?php endif; ?>
 
 <p>
-	<label for="c1"><?php echo $label_comment; ?>:</label> 
-	<input type="text" id="c1" name="c1" maxlength="<?php echo $comment_length; ?>" onkeydown="valCom(this);" /> 
+	<label for="c1"><?php echo $label_comment; ?>:</label>
+	<input type="text" id="c1" name="c1" maxlength="<?php echo $comment_length; ?>" onkeydown="valCom(this);" />
 	<em>(max. <?php echo $comment_length; ?>)</em>
 </p>
 
 <p>
-	<label for="c2"><?php echo $label_comment; ?>:</label> 
-	<input type="text" id="c2" name="c2" maxlength="<?php echo $comment_length; ?>" onkeydown="valCom(this);" /> 
+	<label for="c2"><?php echo $label_comment; ?>:</label>
+	<input type="text" id="c2" name="c2" maxlength="<?php echo $comment_length; ?>" onkeydown="valCom(this);" />
 	<em>(max. <?php echo $comment_length; ?>)</em>
 </p>
 
 <?php if($legend === TRUE): ?>
 	<p>
-		<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