[Mapbender-commits] r8394 - branches/2.7/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Jun 26 23:24:18 PDT 2012
Author: verenadiewald
Date: 2012-06-26 23:24:18 -0700 (Tue, 26 Jun 2012)
New Revision: 8394
Modified:
branches/2.7/http/plugins/mb_print.php
Log:
add possibility to configure a selectbox for scale selection
Modified: branches/2.7/http/plugins/mb_print.php
===================================================================
--- branches/2.7/http/plugins/mb_print.php 2012-06-25 12:52:47 UTC (rev 8393)
+++ branches/2.7/http/plugins/mb_print.php 2012-06-27 06:24:18 UTC (rev 8394)
@@ -145,13 +145,13 @@
var $scaleInput = $("#scale");
if (printBox !== null) {
- destroyPrintBox();
+ 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,
@@ -161,26 +161,32 @@
afterChangeAngle : function (obj) {
if (typeof(obj) == "object") {
if (typeof(obj.angle) == "number") {
- if(typeof(jqForm[0].angle) != "undefined") {
- jqForm[0].angle.value = obj.angle;
- }
+ if(typeof(jqForm[0].angle) != "undefined") {
+ jqForm[0].angle.value = obj.angle;
+ }
}
if (obj.coordinates) {
- if(typeof(jqForm[0].coordinates) != "undefined") {
- jqForm[0].coordinates.value = String(obj.coordinates);
- }
+ if(typeof(jqForm[0].coordinates) != "undefined") {
+ jqForm[0].coordinates.value = String(obj.coordinates);
+ }
}
}
},
afterChangeSize : function (obj) {
if (typeof(obj) == "object") {
if (obj.scale) {
- jqForm[0].scale.value = parseInt(obj.scale / 10, 10) * 10;
+ if($("#scale").is("input")) {
+ jqForm[0].scale.value = parseInt(obj.scale / 10, 10) * 10;
+ }
+ else {
+ $("#scale .addedScale").remove();
+ $("#scale").append("<option selected class='addedScale' value='"+parseInt(obj.scale / 10, 10) * 10+"'>1 : " + parseInt(obj.scale / 10, 10) * 10 + "</option>");
+ }
}
if (obj.coordinates) {
- if(typeof(jqForm[0].coordinates) != "undefined") {
- jqForm[0].coordinates.value = String(obj.coordinates);
- }
+ if(typeof(jqForm[0].coordinates) != "undefined") {
+ jqForm[0].coordinates.value = String(obj.coordinates);
+ }
}
}
}
@@ -611,26 +617,43 @@
}
});
$("#" + myId + "_formsubmit").before(str);
- $("#scale").keydown(function (e) {
- if (e.keyCode === 13) {
- return false;
- }
- }).keyup(function (e) {
- if (e.keyCode === 13) {
- return false;
- }
-
- var scale = parseInt(this.value, 10);
+ if($("#scale").is("input")) {
+ $("#scale").keydown(function (e) {
+ if (e.keyCode === 13) {
+ return false;
+ }
+ }).keyup(function (e) {
+ if (e.keyCode === 13) {
+ return false;
+ }
+
+ var scale = parseInt(this.value, 10);
+ if (isNaN(scale) || typeof printBox === "undefined") {
+ return true;
+ }
+
+ if(scale < 10) {
+ return true;
+ }
+ printBox.setScale(scale);
+ return true;
+ });
+ }
+ else {
+ $("#scale").change(function (e) {
+ var scale = parseInt(this.value, 10);
if (isNaN(scale) || typeof printBox === "undefined") {
return true;
}
- if(scale < 10) {
- return true;
- }
- printBox.setScale(scale);
- return true;
- });
+ if(scale < 10) {
+ return true;
+ }
+ printBox.setScale(scale);
+ return true;
+ });
+ }
+
$("#angle").keydown(function (e) {
if (e.keyCode === 13) {
return false;
More information about the Mapbender_commits
mailing list