]> dev.renevier.net Git - syp.git/blobdiff - js/admin.js
demo restrictions
[syp.git] / js / admin.js
index e1dfe5f7f04562be72a470b5ea1903beb74959c5..5b27b9d7615cf94e2444214508cb11f88adeaa07 100644 (file)
@@ -268,8 +268,9 @@ var Admin = {
     },
 
     addNewFeature: function () {
+        alert (SypStrings.DisabledForDemo);
+        return;
         userMgr.close();
-
         function cancel() {
             $(document).unbind("keydown");
             Admin.reset()
@@ -429,6 +430,8 @@ var FeatureMgr = {
     },
 
     del: function (feature) {
+        alert (SypStrings.DisabledForDemo);
+        return;
         var form = $("#feature_delete");
         form.find('input[name="fid"]').val(feature.fid);
         AjaxMgr.add({
@@ -473,6 +476,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 +731,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":
@@ -919,6 +935,10 @@ var userMgr = {
 
         this.commError("");
 
+        this.disableForms();
+        alert (SypStrings.DisabledForDemo);
+        return;
+
         AjaxMgr.add({
             form: $("#changepass"),
             oncomplete: OpenLayers.Function.bind(this.ajaxReply, this),
@@ -996,6 +1016,9 @@ var userMgr = {
         }
 
         this.commError("");
+        this.disableForms();
+        alert (SypStrings.DisabledForDemo);
+        return;
 
         AjaxMgr.add({
             form: $("#newuser"),
@@ -1024,10 +1047,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")) {
@@ -1144,6 +1177,8 @@ $(window).load(function () {
         return false;
     });
     $("#image_delete").click(function() {
+            alert (SypStrings.DisabledForDemo);
+            return;
             $("#img").removeAttr('src');
             // needs to rebuild element otherwise some browsers still
             // display image.