X-Git-Url: https://dev.renevier.net/gitweb.cgi?p=syp.git;a=blobdiff_plain;f=js%2Fadmin.js;h=36c74069397145bde8909b5116ea1d529a62c6fc;hp=e1dfe5f7f04562be72a470b5ea1903beb74959c5;hb=1eff14d093d541d9858f73ffca042de5a2bf3ea5;hpb=939514b912738c5784b04a0d207db1afd918eb69 diff --git a/js/admin.js b/js/admin.js index e1dfe5f..36c7406 100644 --- a/js/admin.js +++ b/js/admin.js @@ -473,6 +473,11 @@ var FeatureMgr = { } var xml = new OpenLayers.Format.XML().read(data); + if (!xml.documentElement) { + this.commError(SypStrings.UnconsistentError); + $("title").focus(); + return; + } switch (xml.documentElement.nodeName.toLowerCase()) { case "error": @@ -723,7 +728,15 @@ var pwdMgr = { }, 0); return; } + var xml = new OpenLayers.Format.XML().read(data); + if (!xml.documentElement) { + this.commError(SypStrings.UnconsistentError); + $("#login_error").show(); + window.setTimeout(function() { + $("#user").focus().select(); + }, 0); + } switch (xml.documentElement.nodeName.toLowerCase()) { case "error": @@ -910,6 +923,12 @@ var userMgr = { return; } + if (!newpass) { + this.commError(SypStrings.emptyPasswordError); + $("#pass_new").focus().select(); + return; + } + var curpass = $("#pass_current").val(); if (newpass == curpass) { this.commError(SypStrings.changeSamePass); @@ -995,6 +1014,12 @@ var userMgr = { return; } + if (!newuser_pass) { + this.commError(SypStrings.emptyPasswordError); + $("#pass_new").focus().select(); + return; + } + this.commError(""); AjaxMgr.add({ @@ -1024,10 +1049,20 @@ var userMgr = { return; } + var xml = new OpenLayers.Format.XML().read(data); + if (!xml.documentElement) { + // here, we need a timeout because onsend timeout sometimes has not been triggered yet + var self = this; + window.setTimeout(function() { + self.enableForms(); + }, 0); + this.commError(SypStrings.UnconsistentError); + return; + } + var needFormEnabling = true; var focusEl = null; - var xml = new OpenLayers.Format.XML().read(data); switch (xml.documentElement.nodeName.toLowerCase()) { case "error": switch (xml.documentElement.getAttribute("reason")) {