[Mapbender-commits] r4479 - branches/print_dev/http/print
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Aug 4 11:26:19 EDT 2009
Author: mschulz
Date: 2009-08-04 11:26:19 -0400 (Tue, 04 Aug 2009)
New Revision: 4479
Modified:
branches/print_dev/http/print/mod_printPDF_div.js
Log:
printbox now uses width/height from the template config
Modified: branches/print_dev/http/print/mod_printPDF_div.js
===================================================================
--- branches/print_dev/http/print/mod_printPDF_div.js 2009-08-04 15:11:24 UTC (rev 4478)
+++ branches/print_dev/http/print/mod_printPDF_div.js 2009-08-04 15:26:19 UTC (rev 4479)
@@ -80,6 +80,7 @@
var PrintPDF = function (options) {
var that = this;
+var actualConfig;
eventInit.register(function () {
mod_printPDF_init();
@@ -96,8 +97,8 @@
var jqForm = $("#"+myId+"_form");
printBox = createBox({
target : myTarget,
- width : w/mb_resolution,
- height : h/mb_resolution,
+ printWidth : getPDFMapSize("width")/10,
+ printHeight : getPDFMapSize("height")/10,
scale : Math.pow(10, Math.floor(Math.log(map.getScale())/Math.LN10)),
afterChangeAngle : function (obj) {
if (typeof(obj) == "object") {
@@ -128,6 +129,17 @@
});
};
+var getPDFMapSize = function (key) {
+ for (var page in actualConfig.pages) {
+ for (var pageElement in actualConfig.pages[page].elements) {
+ if (actualConfig.pages[page].elements[pageElement].type == "map") {
+ return actualConfig.pages[page].elements[pageElement][key];
+ break;
+ }
+ }
+ }
+};
+
var destroyPrintBox = function () {
if (printBox) {
printBox.destroy();
@@ -145,10 +157,11 @@
this.loadConfig = function (configFilename) {
$.get(mbPrintConfigPath + configFilename, function(json, status){
- var obj = eval('(' + json + ')');
- buildForm(obj);
+ actualConfig = eval('(' + json + ')');
+ buildForm();
hookForm();
});
+ destroyPrintBox();
};
var hookForm = function () {
@@ -267,11 +280,11 @@
*
* @param {Object} json the config object in json
*/
-var buildForm = function (json) {
+var buildForm = function () {
$(".print_option_dyn").remove();
var str = "";
- for (var item in json.controls) {
- var element = json.controls[item];
+ for (var item in actualConfig.controls) {
+ var element = actualConfig.controls[item];
var element_id = myId + "_" + element.id;
if (element.type != "hidden") {
str += '<div class="print_option_dyn">\n';
More information about the Mapbender_commits
mailing list