updated progress bar

This commit is contained in:
Rushabh Mehta 2012-09-14 10:46:36 +05:30
parent 994b7fd86b
commit 36353b2c7e
2 changed files with 6 additions and 4 deletions

View File

@ -391,7 +391,8 @@ if(r.server_messages)msgprint(r.server_messages)
if(r.exc){console.log(r.exc);};if(r['403']){wn.container.change_to('403');}
if(r.docs){LocalDB.sync(r.docs);}}
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(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(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);opts.progress_bar.css('width',(100.0/total*completed).toFixed(2)+'%');}},50);},complete:function(){clearInterval(interval);}})}
if(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.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;}
@ -401,7 +402,7 @@ wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,f
* lib/js/core.js
*/
if(!console){var console={log:function(txt){}}}
window._version_number="7ab7a080278624be7e07a858feb00d5dace34c9757ef9c5d353d3e40";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
window._version_number="8cf6494c9cf543eaf530304fc5ccd4ce065751aed728f2c1c4f57035";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
/*
* lib/js/legacy/globals.js

View File

@ -278,7 +278,8 @@ if(r.server_messages)msgprint(r.server_messages)
if(r.exc){console.log(r.exc);};if(r['403']){wn.container.change_to('403');}
if(r.docs){LocalDB.sync(r.docs);}}
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(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(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);opts.progress_bar.css('width',(100.0/total*completed).toFixed(2)+'%');}},50);},complete:function(){clearInterval(interval);}})}
if(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.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;}
@ -288,7 +289,7 @@ wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,f
* lib/js/core.js
*/
if(!console){var console={log:function(txt){}}}
window._version_number="7ab7a080278624be7e07a858feb00d5dace34c9757ef9c5d353d3e40";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
window._version_number="8cf6494c9cf543eaf530304fc5ccd4ce065751aed728f2c1c4f57035";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
/*
* lib/js/legacy/globals.js