svn commit: r265 - trunk/mapbender/http/javascripts/mod_print1.php

vera_schulze at osgeo.org vera_schulze at osgeo.org
Fri May 12 07:25:53 EDT 2006


Author: vera_schulze
Date: 2006-05-12 11:25:53+0000
New Revision: 265

Modified:
   trunk/mapbender/http/javascripts/mod_print1.php   (contents, props changed)

Log:
Code cleaning ready

Modified: trunk/mapbender/http/javascripts/mod_print1.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_print1.php?view=diff&rev=265&p1=trunk/mapbender/http/javascripts/mod_print1.php&p2=trunk/mapbender/http/javascripts/mod_print1.php&r1=264&r2=265
==============================================================================
--- trunk/mapbender/http/javascripts/mod_print1.php	(original)
+++ trunk/mapbender/http/javascripts/mod_print1.php	2006-05-12 11:25:53+0000
@@ -1,6 +1,6 @@
 <?php
-#$Id: mod_print1.php,v 1.12 2006/03/09 10:28:47 uli_rothstein Exp $
-#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_print1.php,v 1.12 2006/03/09 10:28:47 uli_rothstein Exp $
+# $Id$
+# http://www.mapbender.org/index.php/mod_print1.php
 # Copyright (C) 2002 CCGIS 
 #
 # This program is free software; you can redistribute it and/or modify
@@ -42,8 +42,8 @@
 		width: 180px;
 	}
 	body{
-   		font-family: Arial, Helvetica, sans-serif;
-   		font-size: 12px;
+		font-family: Arial, Helvetica, sans-serif;
+		font-size: 12px;
 	}
 -->
 </style>
@@ -54,8 +54,10 @@
 
 $con = db_connect($DBSERVER,$OWNER,$PW);
 db_select_db(DB,$con);
-$sql = "SELECT * from gui_element WHERE fkey_gui_id = '".$_SESSION["mb_user_gui"]."' AND e_id = '".$mb_module_id."'";
-$res = db_query($sql);
+$sql = "SELECT * from gui_element WHERE fkey_gui_id = '".$_SESSION["mb_user_gui"]."' AND e_id = $1";
+$v = array($mb_module_id);
+$t = array('s');
+$res = db_prep_query($sql, $v, $t);
 
 echo "<script type='text/javascript'>";
 #echo "var mb_user_resolution = ".$_SESSION["mb_user_resolution"]." / 2.54;";
@@ -68,7 +70,6 @@
 echo "var a3_height = " . $a3_height . " * DPC;";
 
 
-
 echo "var border_Portrait_a4_left = " . $border_Portrait_a4_left . " * DPC;";
 echo "var border_Portrait_a4_top = " . $border_Portrait_a4_top . " * DPC;";
 echo "var border_Portrait_a4_right = " . $border_Portrait_a4_right . " * DPC;";
@@ -106,95 +107,95 @@
 /**END*PARAMS********************/
 
 function validate(){
-   //window.opener.mb_resolution = DPC;
-   ind_size = document.form1.size.selectedIndex;
-   ind_format = document.form1.format.selectedIndex;
-
-   if(ind_size != 0 && ind_format != 0){
-      var ind = window.opener.getMapObjIndexByName(mod_print1_target);
-      var coord = window.opener.mb_mapObj[ind].extent.split(",");
-      var centerX = parseInt(coord[0]) + (parseInt(coord[2]) - parseInt(coord[0]))/2
-      var centerY = parseInt(coord[1]) + (parseInt(coord[3]) - parseInt(coord[1]))/2
-      if(document.form1.size.options[ind_size].value == "A4" && document.form1.format.options[ind_format].value == "portrait"){
-        document.form1.page_width.value = a4_width;
-        document.form1.page_height.value = a4_height;
-        document.form1.printOffset_left.value = border_Portrait_a4_left;
-        document.form1.printOffset_top.value = border_Portrait_a4_top;
-        document.form1.map_width.value = Math.round(a4_width - border_Portrait_a4_left - border_Portrait_a4_right); 
-        document.form1.map_height.value = Math.round(a4_height - border_Portrait_a4_top - border_Portrait_a4_bottom - header_Portrait_a4_height); 
-        document.form1.header_height.value = header_Portrait_a4_height;
-      }
-      if(document.form1.size.options[ind_size].value == "A4" && document.form1.format.options[ind_format].value == "landscape"){
-        document.form1.page_width.value = a4_height;
-        document.form1.page_height.value = a4_width;
-        document.form1.printOffset_left.value = border_Landscape_a4_left;
-        document.form1.printOffset_top.value = border_Landscape_a4_top;
-        document.form1.map_width.value = Math.round(a4_height - border_Landscape_a4_left - border_Landscape_a4_right); 
-        document.form1.map_height.value = Math.round(a4_width - border_Landscape_a4_top - border_Landscape_a4_bottom - header_Landscape_a4_height); 
-        document.form1.header_height.value = header_Landscape_a4_height;
-      }
-      if(document.form1.size.options[ind_size].value == "A3" && document.form1.format.options[ind_format].value == "portrait"){
-        document.form1.page_width.value = a3_width;
-        document.form1.page_height.value = a3_height;
-        document.form1.printOffset_left.value = border_Portrait_a3_left;
-        document.form1.printOffset_top.value = border_Portrait_a3_top;
-        document.form1.map_width.value = Math.round(a3_width - border_Portrait_a3_left - border_Portrait_a3_right); 
-        document.form1.map_height.value = Math.round(a3_height - border_Portrait_a3_top - border_Portrait_a3_bottom - header_Portrait_a3_height); 
-        document.form1.header_height.value = header_Portrait_a3_height;
-      }
-      if(document.form1.size.options[ind_size].value == "A3" && document.form1.format.options[ind_format].value == "landscape"){
-        document.form1.page_width.value = a3_height;
-        document.form1.page_height.value = a3_width;
-        document.form1.printOffset_left.value = border_Landscape_a3_left;
-        document.form1.printOffset_top.value = border_Landscape_a3_top;
-        document.form1.map_width.value = Math.round(a3_height - border_Landscape_a3_left - border_Landscape_a3_right); 
-        document.form1.map_height.value = Math.round(a3_width - border_Landscape_a3_top - border_Landscape_a3_bottom - header_Landscape_a3_height); 
-        document.form1.header_height.value = header_Landscape_a3_height;
-      }            
-      var pos = window.opener.makeClickPos2RealWorldPos(mod_print1_target, document.form1.map_width.value , document.form1.map_height.value );
-      window.opener.mb_mapObj[ind].width = document.form1.map_width.value;
-      window.opener.mb_mapObj[ind].height = document.form1.map_height.value;
-      window.opener.document.getElementById(mod_print1_target).style.width = document.form1.map_width.value;
-      window.opener.document.getElementById(mod_print1_target).style.height = document.form1.map_height.value;
-      window.opener.window.frames[mod_print1_target].document.getElementById("maps").style.width = document.form1.map_width.value;
-      window.opener.window.frames[mod_print1_target].document.getElementById("maps").style.height = document.form1.map_height.value;
+	//window.opener.mb_resolution = DPC;
+	ind_size = document.form1.size.selectedIndex;
+	ind_format = document.form1.format.selectedIndex;
+
+	if(ind_size != 0 && ind_format != 0){
+		var ind = window.opener.getMapObjIndexByName(mod_print1_target);
+		var coord = window.opener.mb_mapObj[ind].extent.split(",");
+		var centerX = parseInt(coord[0]) + (parseInt(coord[2]) - parseInt(coord[0]))/2
+		var centerY = parseInt(coord[1]) + (parseInt(coord[3]) - parseInt(coord[1]))/2
+		if(document.form1.size.options[ind_size].value == "A4" && document.form1.format.options[ind_format].value == "portrait"){
+			document.form1.page_width.value = a4_width;
+			document.form1.page_height.value = a4_height;
+			document.form1.printOffset_left.value = border_Portrait_a4_left;
+			document.form1.printOffset_top.value = border_Portrait_a4_top;
+			document.form1.map_width.value = Math.round(a4_width - border_Portrait_a4_left - border_Portrait_a4_right); 
+			document.form1.map_height.value = Math.round(a4_height - border_Portrait_a4_top - border_Portrait_a4_bottom - header_Portrait_a4_height); 
+			document.form1.header_height.value = header_Portrait_a4_height;
+		}
+		if(document.form1.size.options[ind_size].value == "A4" && document.form1.format.options[ind_format].value == "landscape"){
+			document.form1.page_width.value = a4_height;
+			document.form1.page_height.value = a4_width;
+			document.form1.printOffset_left.value = border_Landscape_a4_left;
+			document.form1.printOffset_top.value = border_Landscape_a4_top;
+			document.form1.map_width.value = Math.round(a4_height - border_Landscape_a4_left - border_Landscape_a4_right); 
+			document.form1.map_height.value = Math.round(a4_width - border_Landscape_a4_top - border_Landscape_a4_bottom - header_Landscape_a4_height); 
+			document.form1.header_height.value = header_Landscape_a4_height;
+		}
+		if(document.form1.size.options[ind_size].value == "A3" && document.form1.format.options[ind_format].value == "portrait"){
+			document.form1.page_width.value = a3_width;
+			document.form1.page_height.value = a3_height;
+			document.form1.printOffset_left.value = border_Portrait_a3_left;
+			document.form1.printOffset_top.value = border_Portrait_a3_top;
+			document.form1.map_width.value = Math.round(a3_width - border_Portrait_a3_left - border_Portrait_a3_right); 
+			document.form1.map_height.value = Math.round(a3_height - border_Portrait_a3_top - border_Portrait_a3_bottom - header_Portrait_a3_height); 
+			document.form1.header_height.value = header_Portrait_a3_height;
+		}
+		if(document.form1.size.options[ind_size].value == "A3" && document.form1.format.options[ind_format].value == "landscape"){
+			document.form1.page_width.value = a3_height;
+			document.form1.page_height.value = a3_width;
+			document.form1.printOffset_left.value = border_Landscape_a3_left;
+			document.form1.printOffset_top.value = border_Landscape_a3_top;
+			document.form1.map_width.value = Math.round(a3_height - border_Landscape_a3_left - border_Landscape_a3_right); 
+			document.form1.map_height.value = Math.round(a3_width - border_Landscape_a3_top - border_Landscape_a3_bottom - header_Landscape_a3_height); 
+			document.form1.header_height.value = header_Landscape_a3_height;
+		}            
+		var pos = window.opener.makeClickPos2RealWorldPos(mod_print1_target, document.form1.map_width.value , document.form1.map_height.value );
+		window.opener.mb_mapObj[ind].width = document.form1.map_width.value;
+		window.opener.mb_mapObj[ind].height = document.form1.map_height.value;
+		window.opener.document.getElementById(mod_print1_target).style.width = document.form1.map_width.value;
+		window.opener.document.getElementById(mod_print1_target).style.height = document.form1.map_height.value;
+		window.opener.window.frames[mod_print1_target].document.getElementById("maps").style.width = document.form1.map_width.value;
+		window.opener.window.frames[mod_print1_target].document.getElementById("maps").style.height = document.form1.map_height.value;
       
-      window.opener.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
-      window.opener.setMapRequest(mod_print1_target);
-   }
+		window.opener.mb_mapObj[ind].extent = coord[0] + "," + pos[1] + "," + pos[0] + "," +  coord[3];
+		window.opener.setMapRequest(mod_print1_target);
+	}
 }
 function refreshParams(){
-   var ind = window.opener.getMapObjIndexByName(mod_print1_target);
-   document.form1.map_url.value = "";
-   var cnt_urls = 0;
-   for(var i=0; i<window.opener.mb_mapObj[ind].wms.length; i++){
-      if(window.opener.mb_mapObj[ind].wms[i].mapURL != false){
-         if(cnt_urls > 0){document.form1.map_url.value += "###";}
-        //hack for relativ WMS_ONLINERESOURCE
-         if(window.opener.mb_mapObj[ind].wms[i].mapURL.charAt(0) == '/' && window.opener.mb_mapObj[ind].wms[i].mapURL.charAt(1) == 'c')
-         {
-         document.form1.map_url.value += 'http://localhost' + window.opener.mb_mapObj[ind].wms[i].mapURL;
-        }
-        else
-        {
-          document.form1.map_url.value += window.opener.mb_mapObj[ind].wms[i].mapURL;
-        }
-         cnt_urls++;
-      }
-   }
-   document.form1.map_extent.value = window.opener.mb_mapObj[ind].extent;
-   document.form1.map_scale.value = window.opener.mb_getScale(mod_print1_target);
+	var ind = window.opener.getMapObjIndexByName(mod_print1_target);
+	document.form1.map_url.value = "";
+	var cnt_urls = 0;
+	for(var i=0; i<window.opener.mb_mapObj[ind].wms.length; i++){
+		if(window.opener.mb_mapObj[ind].wms[i].mapURL != false){
+			if(cnt_urls > 0){
+				document.form1.map_url.value += "###";
+			}
+			//hack for relativ WMS_ONLINERESOURCE
+			if(window.opener.mb_mapObj[ind].wms[i].mapURL.charAt(0) == '/' && window.opener.mb_mapObj[ind].wms[i].mapURL.charAt(1) == 'c'){
+				document.form1.map_url.value += 'http://localhost' + window.opener.mb_mapObj[ind].wms[i].mapURL;
+			}
+			else{
+				document.form1.map_url.value += window.opener.mb_mapObj[ind].wms[i].mapURL;
+			}
+			cnt_urls++;
+		}
+	}
+	document.form1.map_extent.value = window.opener.mb_mapObj[ind].extent;
+	document.form1.map_scale.value = window.opener.mb_getScale(mod_print1_target);
 }
 function printMap(){
-   if(ind_size > 0 && ind_format >0){
-      refreshParams();
-      document.form1.submit();
-      disablePrinting();
-   }
-   else{
-      alert("Das Format ist noch nicht ausgewählt.");
-   }   
-      window.opener.mod_back_set();
+	if(ind_size > 0 && ind_format >0){
+		refreshParams();
+		document.form1.submit();
+		disablePrinting();
+	}
+	else{
+		alert("Das Format ist noch nicht ausgewählt.");
+	}   
+		window.opener.mod_back_set();
 }
 function disablePrinting(){
    //window.opener.mb_resolution = mb_user_resolution;
@@ -206,45 +207,45 @@
 <form name='form1' method='POST' action='../php/mod_printView1.php?<?php echo SID; ?>' target="_blank">
 <table border='0'>
 <tr>
-   <td>
-   Format:<br />
+	<td>
+	Format:<br />
 
-   <select name='size' onchange='validate()'>
-   <option value=''>Paper size...</option>
-   <option value='A4'>A4</option>
-   <!-- <option value='A3'>A3</option> -->
-   </select>
-   </td>   
+	<select name='size' onchange='validate()'>
+	<option value=''>Paper size...</option>
+	<option value='A4'>A4</option>
+	<!-- <option value='A3'>A3</option> -->
+	</select>
+	</td>   
 </tr>
 <tr>
-   <td>
-   <select name='format' onchange='validate()'>
-   <option value=''>Orientation...(portrait,landscape)</option>
-   <option value='portrait'>Portrait</option>
-   <option value='landscape'>Landscape</option>
-   </select>
-   </td>
+	<td>
+	<select name='format' onchange='validate()'>
+	<option value=''>Orientation...(portrait,landscape)</option>
+	<option value='portrait'>Portrait</option>
+	<option value='landscape'>Landscape</option>
+	</select>
+	</td>
 </tr>
 <tr>
-   <td>
-   <br />Resolution:<br />
-   <select name='quality'>
-   <option value='1'>Standard</option>   
-   <!-- <option value='<?php #echo $printFactor; ?>'>hoch</option> -->
-   </select>
-   </td>
+	<td>
+	<br />Resolution:<br />
+	<select name='quality'>
+	<option value='1'>Standard</option>   
+	<!-- <option value='<?php #echo $printFactor; ?>'>hoch</option> -->
+	</select>
+	</td>
 </tr>
 <tr>
-   <td>
-   <br />Titel: <br />
-   <input type="text" class="textField" name="printTitle" value= "Preview">
-   </td>
+	<td>
+	<br />Titel: <br />
+	<input type="text" class="textField" name="printTitle" value= "Preview">
+	</td>
 </tr>
 <tr>
-   <td>
-   <br />Text: <br />
-   <textarea name="printComment" rows="4" cols="20"></textarea>
-   </td>
+	<td>
+	<br />Text: <br />
+	<textarea name="printComment" rows="4" cols="20"></textarea>
+	</td>
 </tr>
 <table>   
 <input type='hidden' name='printOffset_left' value=''>




More information about the Mapbender_commits mailing list