[Mapbender-commits] r8083 - branches/2.7/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Aug 31 04:13:51 EDT 2011


Author: verenadiewald
Date: 2011-08-31 01:13:51 -0700 (Wed, 31 Aug 2011)
New Revision: 8083

Modified:
   branches/2.7/http/plugins/mb_print.php
Log:
show printbox when opening print dialog

Modified: branches/2.7/http/plugins/mb_print.php
===================================================================
--- branches/2.7/http/plugins/mb_print.php	2011-08-31 08:11:44 UTC (rev 8082)
+++ branches/2.7/http/plugins/mb_print.php	2011-08-31 08:13:51 UTC (rev 8083)
@@ -145,14 +145,13 @@
 		var $scaleInput = $("#scale");
 
 		if (printBox !== null) {
-			printBox.destroy();
-			printBox = null;
+                	destroyPrintBox();
 			jqForm[0].scale.value = "";
 			jqForm[0].coordinates.value = "";
 			jqForm[0].angle.value = "";
 		}
 		else {
-			printBox = new Mapbender.PrintBox({
+                	printBox = new Mapbender.PrintBox({
 				target : myTarget,
 				printWidth : getPDFMapSize("width")/10,
 				printHeight : getPDFMapSize("height")/10,
@@ -212,6 +211,7 @@
 	var destroyPrintBox = function () {
 		if (printBox) {
 			printBox.destroy();
+                        printBox = null;
 		}
 	};
 	
@@ -228,6 +228,11 @@
 		/* than we need the translation of the print button */
 		$("#submit").val("<?php echo htmlentities(_mb("print"), ENT_QUOTES, "UTF-8");?>");
 
+                //show printBox for first entry in printTemplate selectbox
+                $("."+myId+"-dialog").bind("dialogopen", function () {
+                    printObj.createPrintBox();
+                });
+
                 //destroy printBox if printDialog is closed
                 $("."+myId+"-dialog").bind("dialogclose", function () {
                     destroyPrintBox();
@@ -240,7 +245,7 @@
 	 * GETs the config, build corresponding form, remove an existing printBox
 	 */		
 	this.loadConfig = function (configFilename, callback) {
-		// the dataType to $.get is given explicitely, because there were instances of Mapbender that were returning 
+        	// the dataType to $.get is given explicitely, because there were instances of Mapbender that were returning 
 		// either json or a string, which trips up $.parseJSON which was being used in the callback
 		$.get(mbPrintConfigPath + configFilename, function(json, status){
 		    actualConfig = json;
@@ -248,10 +253,11 @@
 		    hookForm();
 			if (typeof callback === "function") {
 				printBox = null;
-				callback();
-			}
+                                callback();
+                        }
 		},"json");
 		destroyPrintBox();
+                
 	};
 
 	/**
@@ -604,9 +610,10 @@
 		if (str) {
 			$("#printPDF_selector").append(str).find("#printPDF_template").change(function () {
 				printObj.loadConfig(mbPrintConfigFilenames[this.selectedIndex], function () {
-					printObj.createPrintBox()
+				    printObj.createPrintBox()
 				});			
 			});
+                       
 			$("#printPDF_handle").click(function () {
 				printObj.createPrintBox();
 			});



More information about the Mapbender_commits mailing list