equal
deleted
inserted
replaced
25 params = toJSONString(params); |
25 params = toJSONString(params); |
26 params = ajaxEscape(params); |
26 params = ajaxEscape(params); |
27 ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
27 ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
28 if(ajax.readyState == 4) |
28 if(ajax.readyState == 4) |
29 { |
29 { |
|
30 var response = String(ajax.responseText + ''); |
|
31 if ( response.substr(0, 1) != '{' ) |
|
32 { |
|
33 handle_invalid_json(ajax.responseText); |
|
34 return false; |
|
35 } |
|
36 try { |
|
37 data = parseJSON(ajax.responseText); |
|
38 } catch(e) { |
|
39 handle_invalid_json(ajax.responseText); |
|
40 } |
30 __aclBuildWizardWindow(); |
41 __aclBuildWizardWindow(); |
31 groups = parseJSON(ajax.responseText); |
42 groups = parseJSON(ajax.responseText); |
32 if ( groups.mode == 'error' ) |
43 if ( groups.mode == 'error' ) |
33 { |
44 { |
34 alert(groups.error); |
45 alert(groups.error); |
305 params = toJSONString(params); |
316 params = toJSONString(params); |
306 params = ajaxEscape(params); |
317 params = ajaxEscape(params); |
307 ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
318 ajaxPost(stdAjaxPrefix+'&_mode=acljson', 'acl_params='+params, function() { |
308 if(ajax.readyState == 4) |
319 if(ajax.readyState == 4) |
309 { |
320 { |
|
321 var response = String(ajax.responseText + ''); |
|
322 if ( response.substr(0, 1) != '{' ) |
|
323 { |
|
324 handle_invalid_json(ajax.responseText); |
|
325 return false; |
|
326 } |
310 try { |
327 try { |
311 data = parseJSON(ajax.responseText); |
328 data = parseJSON(ajax.responseText); |
312 } catch(e) { |
329 } catch(e) { |
313 aclDebug(e+"\n\nResponse:\n"+ajax.responseText); |
330 handle_invalid_json(ajax.responseText); |
314 } |
331 } |
315 aclDataCache = data; |
332 aclDataCache = data; |
316 switch(data.mode) |
333 switch(data.mode) |
317 { |
334 { |
318 case 'seltarget': |
335 case 'seltarget': |
478 break; |
495 break; |
479 case 'debug': |
496 case 'debug': |
480 aclDebug(data.text); |
497 aclDebug(data.text); |
481 break; |
498 break; |
482 default: |
499 default: |
483 alert("Invalid JSON response from server\nMode: "+data.mode+"\nJSON string: "+ajax.responseText); |
500 handle_invalid_json(ajax.responseText); |
484 break; |
501 break; |
485 } |
502 } |
486 } |
503 } |
487 }); |
504 }); |
488 } |
505 } |