[fusion-commits] r1744 - trunk/widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Fri Jan 23 15:41:41 EST 2009
Author: chrisclaydon
Date: 2009-01-23 15:41:41 -0500 (Fri, 23 Jan 2009)
New Revision: 1744
Modified:
trunk/widgets/SaveMap.js
Log:
re #193 Update SaveMap widget to support basic settings as defined in the widget info file.
Modified: trunk/widgets/SaveMap.js
===================================================================
--- trunk/widgets/SaveMap.js 2009-01-23 20:33:53 UTC (rev 1743)
+++ trunk/widgets/SaveMap.js 2009-01-23 20:41:41 UTC (rev 1744)
@@ -49,10 +49,10 @@
var json = widgetTag.extension;
this.format = (json.Format && json.Format[0] != '')?
json.Format[0] : 'png';
-
+
//for DWF, parse printLayouts and build menu
if (this.format == 'DWF' && json.PrintLayout.length) {
-
+
var layouts = json.PrintLayout;
for (var i = 0; i < layouts.length; i++) {
var layout = layouts[i];
@@ -100,6 +100,27 @@
};
this.oMenu.add(menuItem);
}
+ } else if(this.format.toLowerCase() == 'dwf') {
+ var layout = json;
+ if(layout.ResourceId) {
+ this.printLayout = layout.ResourceId[0];
+ };
+ if (layout.PageHeight) {
+ this.pageHeight = layout.PageHeight[0];
+ };
+ if (layout.PageWidth) {
+ this.pageWidth = layout.PageWidth[0];
+ };
+ if (layout.Margins) {
+ this.margins = [layout.Margins[0].Top[0],
+ layout.Margins[0].Left[0],
+ layout.Margins[0].Right[0],
+ layout.Margins[0].Bottom[0]];
+ };
+ if (layout.Scale) {
+ this.printScale = layout.Scale[0];
+ };
+
} else {
if (json.Width && json.Width[0] != '') {
this.imageWidth = json.Width[0];
@@ -111,11 +132,11 @@
this.enable = Fusion.Widget.SaveMap.prototype.enable;
},
-
+
enable: function() {
Fusion.Widget.prototype.enable.apply(this, []);
},
-
+
setLayout: function(data) {
this.printLayout = data.rid;
this.pageHeight = data.pageHeight;
@@ -148,16 +169,16 @@
var szPageHeight = '';
var szPageWidth = '';
var szPageMargins = '';
- if (this.format === 'DWF') {
+ if (this.format.toLowerCase() == 'dwf') {
if (this.printLayout) {
- szLayout = '&layout=' + this.printLayout;
- } else {
- alert('DWF Save is not properly configured.');
- return;
+ szLayout = '&layout=' + this.printLayout;
+ //} else {
+ // alert('DWF Save is not properly configured.');
+ // return;
}
if (this.printScale) {
szScale = '&scale=' + this.printScale;
- }
+ }
if (this.pageHeight) {
szPageHeight = '&pageheight=' + this.pageHeight;
}
@@ -182,7 +203,7 @@
w = open(url, "Save", 'menubar=no,height=200,width=300');
} else {
var s = Fusion.fusionURL + 'layers/' + m.arch + '/' + Fusion.getScriptLanguage() + "/SaveMap." + Fusion.getScriptLanguage() + '?session='+m.getSessionID() + '&mapname=' + m.getMapName() + '&format=' + this.format.toUpperCase() + szLayout + szScale + szWidth + szHeight + szPageHeight + szPageWidth + szPageMargins;
-
+
this.iframe.src = s;
}
}
More information about the fusion-commits
mailing list