X-Git-Url: https://dev.renevier.net/gitweb.cgi?a=blobdiff_plain;f=public%2Fjs%2Fsyj.js;h=4b7f01d9a39dda1f010856080f130cc806577a0f;hb=1d1b5940442782d78f796d8608e63328e2e8783b;hp=f2ae9e19125230221488fe2c8eb6654a50550533;hpb=3ff82e2d9fa289beba4e965b82772cf83f905b2f;p=syj.git diff --git a/public/js/syj.js b/public/js/syj.js index f2ae9e1..4b7f01d 100644 --- a/public/js/syj.js +++ b/public/js/syj.js @@ -225,7 +225,6 @@ var SYJView = { map: null, wkt: new OpenLayers.Format.WKT({ internalProjection: Mercator, externalProjection: WGS84 }), needsFormResubmit: false, - hasInitialGeom: false, init: function() { var externalGraphic, baseURL, baseLayer, layerOptions, extent, hidemessenger; @@ -285,7 +284,6 @@ var SYJView = { // XXX: ie has not guessed height of map main div yet during map // initialisation. Now, it will read it correctly. this.map.updateSize(); - this.hasInitialGeom = true; } else { extent = new OpenLayers.Bounds(gMaxExtent.minlon, gMaxExtent.minlat, gMaxExtent.maxlon, gMaxExtent.maxlat) .transform(WGS84, Mercator); @@ -396,8 +394,8 @@ var SYJView = { }, saveSuccess: function(transport) { - if (!this.hasInitialGeom) { // we have created a new path, change location - location = "idx/" + transport.responseText; + if (transport.responseJSON && (typeof transport.responseJSON.redirect === "string")) { + location = transport.responseJSON.redirect; return; } @@ -419,7 +417,7 @@ var SYJView = { break; case 400: case 404: - message = SyjStrings.requestError; // default message + message = SyjStrings.requestError; if (transport.responseJSON) { switch (transport.responseJSON.message) { case "uniquepath": @@ -430,6 +428,12 @@ var SYJView = { } } break; + case 403: + message = ""; + SYJLogin.messenger.setMessage(SyjStrings.loginNeeded, "warn"); + SYJLogin.modalbox.show(); + this.needsFormResubmit = true; + break; case 410: message = SyjStrings.gonePathError; break;