The merge of acl.js failed so re-merged manually
authorDan
Wed, 19 Dec 2007 23:04:17 -0500
changeset 327 c2f4c900c507
parent 326 ab66d6d1f1f4
child 328 dc838fd61a06
The merge of acl.js failed so re-merged manually
includes/clientside/static/acl.js
--- a/includes/clientside/static/acl.js	Wed Dec 19 22:55:40 2007 -0500
+++ b/includes/clientside/static/acl.js	Wed Dec 19 23:04:17 2007 -0500
@@ -27,6 +27,17 @@
   ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() {
       if(ajax.readyState == 4)
       {
+        var response = String(ajax.responseText + '');
+        if ( response.substr(0, 1) != '{' )
+        {
+          handle_invalid_json(ajax.responseText);
+          return false;
+        }
+        try {
+          data = parseJSON(ajax.responseText);
+        } catch(e) {
+          handle_invalid_json(ajax.responseText);
+        }
         __aclBuildWizardWindow();
         groups = parseJSON(ajax.responseText);
         if ( groups.mode == 'error' )
@@ -307,10 +318,16 @@
   ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() {
       if(ajax.readyState == 4)
       {
+        var response = String(ajax.responseText + '');
+        if ( response.substr(0, 1) != '{' )
+        {
+          handle_invalid_json(ajax.responseText);
+          return false;
+        }
         try {
           data = parseJSON(ajax.responseText);
         } catch(e) {
-          aclDebug(e+"\n\nResponse:\n"+ajax.responseText);
+          handle_invalid_json(ajax.responseText);
         }
         aclDataCache = data;
         switch(data.mode)
@@ -480,7 +497,7 @@
             aclDebug(data.text);
             break;
           default:
-            alert("Invalid JSON response from server\nMode: "+data.mode+"\nJSON string: "+ajax.responseText);
+            handle_invalid_json(ajax.responseText);
             break;
         }
       }