[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
www
www at source.lon-capa.org
Wed Dec 21 13:01:58 EST 2011
www Wed Dec 21 18:01:58 2011 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
Saving my work: Bug #6455
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1041 loncom/interface/loncommon.pm:1.1042
--- loncom/interface/loncommon.pm:1.1041 Tue Dec 20 23:57:51 2011
+++ loncom/interface/loncommon.pm Wed Dec 21 18:01:58 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1041 2011/12/20 23:57:51 www Exp $
+# $Id: loncommon.pm,v 1.1042 2011/12/21 18:01:58 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -7065,7 +7065,7 @@
my ($funcname,$width,$height,$content)=@_;
my $innerwidth=$width-20;
$content=&js_ready(
- &start_page('Dialog',undef,{'only_body'=>1,'add_progressbar'=>1,'bgcolor'=>'#FFFFFF'}).
+ &start_page('Dialog',undef,{'only_body'=>1,'bgcolor'=>'#FFFFFF'}).
&start_scrollbox($width.'px',$innerwidth.'px',$height.'px').
$content.
&end_scrollbox().
@@ -7176,8 +7176,11 @@
ENDPROGRESSUPDATE
}
+my $LClastpercent;
+
sub LCprogressbar {
- my ($r,$mode)=(@_);
+ my ($r)=(@_);
+ $LClastpercent=0;
my $starting=&mt('Starting');
my $content=(<<ENDPROGBAR);
<p>
@@ -7186,35 +7189,47 @@
</div>
</p>
ENDPROGBAR
- $content.=&LCprogressbar_script();
- if ($mode eq 'popup') {
- $r->print(&modal_adhoc_launch('LCprogwin',500,50,$content));
- } else {
- $r->print($content);
- }
+ $r->print($content.&LCprogressbar_script());
$r->rflush();
}
sub LCprogressbarUpdate {
- my ($r,$val,$text,$mode)=@_;
- unless ($val) { $val=0; }
+ my ($r,$val,$text)=@_;
+ unless ($val) {
+ if ($LClastpercent) {
+ $val=$LClastpercent;
+ } else {
+ $val=0;
+ }
+ }
if ($val<0) { $val=0; }
if ($val>100) { $val=0; }
+ $LClastpercent=$val;
unless ($text) { $text=$val.'%'; }
- my $function='';
- if ($mode eq 'popup') { $function='modalWindow.'; }
- $function.='LCupdateProgress';
$text=&js_ready($text);
$r->print(<<ENDUPDATE);
<script type="text/javascript">
// <![CDATA[
-$function($val,'$text');
+LCupdateProgress($val,'$text');
// ]]>
</script>
ENDUPDATE
$r->rflush();
}
+sub LCprogressbarClose {
+ my ($r)=@_;
+ $LClastpercent=0;
+ $r->print(<<ENDCLOSE);
+<script type="text/javascript">
+// <![CDATA[
+\$("#progressbar").hide('slow');
+// ]]>
+</script>
+ENDCLOSE
+ $r->rflush();
+}
+
sub html_encode {
my ($result) = @_;
More information about the LON-CAPA-cvs
mailing list