You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
1.4 KiB
1 lines
1.4 KiB
define(["jquery","core/config","core/log","core/url"],function(a,b,c,d){var e=!1,f=function(a){var b,c,e=this,f=null,g=0;if(a.error)for(;g<e.length;g++)b=e[g],b.deferred.reject(a);else{for(g=0;g<e.length;g++){if(b=e[g],c=a[g],"undefined"==typeof c){f=new Error("missing response");break}if(c.error!==!1){f=c.exception;break}b.deferred.resolve(c.data)}null!==f&&("servicerequireslogin"===f.errorcode?window.location=d.relativeUrl("/login/index.php"):e.forEach(function(a){a.deferred.reject(f)}))}},g=function(a,b,d){var f=this,g=0;for(g=0;g<f.length;g++){var h=f[g];e?(c.error("Page unloaded."),c.error(d)):h.deferred.reject(d)}};return{call:function(c,d,h){a(window).bind("beforeunload",function(){e=!0});var i,j=[],k=[],l=[],m="";for("undefined"==typeof h&&(h=!0),"undefined"==typeof d&&(d=!0),i=0;i<c.length;i++){var n=c[i];j.push({index:i,methodname:n.methodname,args:n.args}),n.deferred=a.Deferred(),k.push(n.deferred.promise()),"undefined"!=typeof n.done&&n.deferred.done(n.done),"undefined"!=typeof n.fail&&n.deferred.fail(n.fail),n.index=i,l.push(n.methodname)}m=l.length<=5?l.sort().join():l.length+"-method-calls",j=JSON.stringify(j);var o={type:"POST",data:j,context:c,dataType:"json",processData:!1,async:d,contentType:"application/json"},p="service.php";h||(p="service-nologin.php");var q=b.wwwroot+"/lib/ajax/"+p+"?sesskey="+b.sesskey+"&info="+m;return d?a.ajax(q,o).done(f).fail(g):(o.success=f,o.error=g,a.ajax(q,o)),k}}});
|