--- loncom/interface/loncommon.pm 2011/12/21 20:21:49 1.1043 +++ loncom/interface/loncommon.pm 2011/12/21 21:25:40 1.1044 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1043 2011/12/21 20:21:49 raeburn Exp $ +# $Id: loncommon.pm,v 1.1044 2011/12/21 21:25:40 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -7193,8 +7193,7 @@ sub LCprogressbar {

ENDPROGBAR - $r->print($content.&LCprogressbar_script()); - $r->rflush(); + &r_print($r,$content.&LCprogressbar_script()); } sub LCprogressbarUpdate { @@ -7211,27 +7210,35 @@ sub LCprogressbarUpdate { $LClastpercent=$val; unless ($text) { $text=$val.'%'; } $text=&js_ready($text); - $r->print(< // ENDUPDATE - $r->rflush(); } sub LCprogressbarClose { my ($r)=@_; $LClastpercent=0; - $r->print(< // ENDCLOSE - $r->rflush(); +} + +sub r_print { + my ($r,$to_print)=@_; + if ($r) { + $r->print($to_print); + $r->rflush(); + } else { + print($to_print); + } } sub html_encode { @@ -7241,6 +7248,7 @@ sub html_encode { return $result; } + sub js_ready { my ($result) = @_;