This commit is contained in:
Rushabh Mehta 2012-09-14 11:15:06 +05:30
commit 043e7c4eb9
2 changed files with 24 additions and 2 deletions

View File

@ -392,19 +392,30 @@ if(r.server_messages){r.server_messages=JSON.parse(r.server_messages)
msgprint(r.server_messages);}
if(r.exc){r.exc=JSON.parse(r.exc);if(r.exc instanceof Array){$.each(r.exc,function(i,v){if(v)console.log(v);})}else{console.log(r.exc);}};if(r['403']){wn.container.change_to('403');}
if(r.docs){LocalDB.sync(r.docs);}}
<<<<<<< HEAD
wn.request.call=function(opts){wn.request.prepare(opts);var args={url:opts.url||wn.request.url,data:opts.args,type:opts.type||'POST',dataType:opts.dataType||'json',success:function(r,xhr){wn.request.cleanup(opts,r);opts.success&&opts.success(r,xhr.responseText);},error:function(xhr,textStatus){wn.request.cleanup(opts,{});show_alert('Unable to complete request: '+textStatus)
opts.error&&opts.error(xhr)}};if(opts.progress_bar){var interval=null;$.extend(args,{xhr:function(){var xhr=jquery.ajaxSettings.xhr();interval=setInterval(function(){if(xhr.readyState>2){var total=parseInt(xhr.getResponseHeader('Content-length'));var completed=parseInt(xhr.responseText.length);var percent=(100.0/total*completed).toFixed(2)
opts.progress_bar.css('width',(percent<10?10:percent)+'%');}},50);},complete:function(){clearInterval(interval);}})}
$.ajax(args)}
=======
wn.request.call=function(opts){wn.request.prepare(opts);var ajax_args={url:opts.url||wn.request.url,data:opts.args,type:opts.type||'POST',dataType:opts.dataType||'json',success:function(r,xhr){wn.request.cleanup(opts,r);opts.success(r,xhr.responseText);},error:function(xhr,textStatus){wn.request.cleanup(opts,{});show_alert('Unable to complete request: '+textStatus)
if(opts.error)opts.error(xhr)}};if(opts.progress_bar){var interval=null;$.extend(ajax_args,{xhr:function(){var xhr=jQuery.ajaxSettings.xhr();interval=setInterval(function(){if(xhr.readyState>2){var total=parseInt(xhr.getResponseHeader('Content-length'));var completed=parseInt(xhr.responseText.length);var percent=(100.0/total*completed).toFixed(2)
opts.progress_bar.css('width',(percent<10?10:percent)+'%');console.log(percent);}},50);return xhr;},complete:function(){clearInterval(interval);}})}
console.log(ajax_args);$.ajax(ajax_args);}
>>>>>>> bf65507939fe258d0ec4c65c48fb35e34f963ff5
wn.call=function(opts){var args=$.extend({},opts.args)
if(opts.module&&opts.page){args.cmd=opts.module+'.page.'+opts.page+'.'+opts.page+'.'+opts.method}else if(opts.method){args.cmd=opts.method;}
for(key in args){if(args[key]&&typeof args[key]!='string'){args[key]=JSON.stringify(args[key]);}}
wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,freeze:opts.freeze,show_spinner:!opts.no_spinner});}
wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,freeze:opts.freeze,show_spinner:!opts.no_spinner,progress_bar:opts.progress_bar});}
/*
* lib/js/core.js
*/
if(!console){var console={log:function(txt){}}}
<<<<<<< HEAD
window._version_number="d0dad4fa131b16b4b3226ab63ad2594c6c18a48d6e193ab73c57faa5";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
=======
window._version_number="%(_version_number)s";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
>>>>>>> bf65507939fe258d0ec4c65c48fb35e34f963ff5
/*
* lib/js/legacy/globals.js

View File

@ -279,19 +279,30 @@ if(r.server_messages){r.server_messages=JSON.parse(r.server_messages)
msgprint(r.server_messages);}
if(r.exc){r.exc=JSON.parse(r.exc);if(r.exc instanceof Array){$.each(r.exc,function(i,v){if(v)console.log(v);})}else{console.log(r.exc);}};if(r['403']){wn.container.change_to('403');}
if(r.docs){LocalDB.sync(r.docs);}}
<<<<<<< HEAD
wn.request.call=function(opts){wn.request.prepare(opts);var args={url:opts.url||wn.request.url,data:opts.args,type:opts.type||'POST',dataType:opts.dataType||'json',success:function(r,xhr){wn.request.cleanup(opts,r);opts.success&&opts.success(r,xhr.responseText);},error:function(xhr,textStatus){wn.request.cleanup(opts,{});show_alert('Unable to complete request: '+textStatus)
opts.error&&opts.error(xhr)}};if(opts.progress_bar){var interval=null;$.extend(args,{xhr:function(){var xhr=jquery.ajaxSettings.xhr();interval=setInterval(function(){if(xhr.readyState>2){var total=parseInt(xhr.getResponseHeader('Content-length'));var completed=parseInt(xhr.responseText.length);var percent=(100.0/total*completed).toFixed(2)
opts.progress_bar.css('width',(percent<10?10:percent)+'%');}},50);},complete:function(){clearInterval(interval);}})}
$.ajax(args)}
=======
wn.request.call=function(opts){wn.request.prepare(opts);var ajax_args={url:opts.url||wn.request.url,data:opts.args,type:opts.type||'POST',dataType:opts.dataType||'json',success:function(r,xhr){wn.request.cleanup(opts,r);opts.success(r,xhr.responseText);},error:function(xhr,textStatus){wn.request.cleanup(opts,{});show_alert('Unable to complete request: '+textStatus)
if(opts.error)opts.error(xhr)}};if(opts.progress_bar){var interval=null;$.extend(ajax_args,{xhr:function(){var xhr=jQuery.ajaxSettings.xhr();interval=setInterval(function(){if(xhr.readyState>2){var total=parseInt(xhr.getResponseHeader('Content-length'));var completed=parseInt(xhr.responseText.length);var percent=(100.0/total*completed).toFixed(2)
opts.progress_bar.css('width',(percent<10?10:percent)+'%');console.log(percent);}},50);return xhr;},complete:function(){clearInterval(interval);}})}
console.log(ajax_args);$.ajax(ajax_args);}
>>>>>>> bf65507939fe258d0ec4c65c48fb35e34f963ff5
wn.call=function(opts){var args=$.extend({},opts.args)
if(opts.module&&opts.page){args.cmd=opts.module+'.page.'+opts.page+'.'+opts.page+'.'+opts.method}else if(opts.method){args.cmd=opts.method;}
for(key in args){if(args[key]&&typeof args[key]!='string'){args[key]=JSON.stringify(args[key]);}}
wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,freeze:opts.freeze,show_spinner:!opts.no_spinner});}
wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,freeze:opts.freeze,show_spinner:!opts.no_spinner,progress_bar:opts.progress_bar});}
/*
* lib/js/core.js
*/
if(!console){var console={log:function(txt){}}}
<<<<<<< HEAD
window._version_number="d0dad4fa131b16b4b3226ab63ad2594c6c18a48d6e193ab73c57faa5";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
=======
window._version_number="%(_version_number)s";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
>>>>>>> bf65507939fe258d0ec4c65c48fb35e34f963ff5
/*
* lib/js/legacy/globals.js