[Mapbender-commits] r5299 - trunk/mapbender/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Jan 8 07:49:24 EST 2010
Author: verenadiewald
Date: 2010-01-08 07:49:22 -0500 (Fri, 08 Jan 2010)
New Revision: 5299
Modified:
trunk/mapbender/http/javascripts/mod_digitize_tab.php
Log:
new events beforeUpdate and beforeInsert
Modified: trunk/mapbender/http/javascripts/mod_digitize_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php 2010-01-07 16:19:54 UTC (rev 5298)
+++ trunk/mapbender/http/javascripts/mod_digitize_tab.php 2010-01-08 12:49:22 UTC (rev 5299)
@@ -150,8 +150,13 @@
}
parent.Mapbender.modules[mod_digitize_elName].events = {
closeGeometry: eventCloseGeometry,
- beforeUpdateOrInsert: new parent.Mapbender.Event()
+ beforeUpdateOrInsert: new parent.Mapbender.Event(),
+ beforeUpdate: new parent.Mapbender.Event(),
+ beforeInsert: new parent.Mapbender.Event()
};
+
+ parent.Mapbender.modules[mod_digitize_elName].cancelAjaxRequest = false;
+ parent.Mapbender.modules[mod_digitize_elName].cancelAjaxRequestMessage = "An error occured.";
});
@@ -1877,7 +1882,7 @@
}
// preselect the correct entry of the box
- patternString = "option( )+value( )*=( )*'"+elementValue+"'";
+ patternString = "option( )+value( )*=( )*('|\")"+elementValue+"('|\")";
pattern = new RegExp(patternString);
var patternStringForReplace = "option value = '"+elementValue+"'";
formElementHtml = formElementHtml.replace(pattern, patternStringForReplace+" selected");
@@ -1902,7 +1907,7 @@
formElementHtml = formElementHtml.replace(pattern, patternString + classString);
// set name of select box to elementlabel
- patternString = "name\s*=\s*\\*'\w+\\*'";
+ patternString = "name\s*=\s*\\*('|\")\w+\\*('|\")";
pattern = new RegExp(patternString);
if (pattern.test(formElementHtml)) {
formElementHtml = formElementHtml.replace(pattern, "name='" + elementLabel + "'");
@@ -1938,7 +1943,7 @@
formElementHtml = formElementHtml.replace(pattern, patternString + classString);
// set name of select box to elementlabel
- patternString = "name\s*=\s*\\*'\w+\\*'";
+ patternString = "name\s*=\s*\\*('|\")\w+\\*('|\")";
pattern = new RegExp(patternString);
if (pattern.test(formElementHtml)) {
formElementHtml = formElementHtml.replace(pattern, "name='" + elementLabel + "'");
@@ -2249,12 +2254,32 @@
}
// str = parent.get_wfs_str(myconf, d, m, type, fid);
- parent.Mapbender.modules[mod_digitize_elName].events.beforeUpdateOrInsert.trigger({
- feature: d.get(m)
- });
-
+ if (type === "insert" || type === "update") {
+ var module = parent.Mapbender.modules[mod_digitize_elName];
+ module.events.beforeUpdateOrInsert.trigger({
+ feature: d.get(m)
+ });
+ if (type === "insert") {
+ module.events.beforeInsert.trigger({
+ feature: d.get(m)
+ });
+ }
+ if (type === "update") {
+ module.events.beforeUpdate.trigger({
+ feature: d.get(m)
+ });
+ }
+
+ if (module.cancelAjaxRequest) {
+ alert(module.cancelAjaxRequestMessage);
+ module.cancelAjaxRequest = false;
+ module.cancelAjaxRequestMessage = "An error occured.";
+ return;
+ }
+ }
+
var geoJson = d.featureToString(m);
-
+
parent.mb_ajax_post(
"../extensions/geom2wfst.php",
{
More information about the Mapbender_commits
mailing list