--- loncom/interface/lonhtmlcommon.pm 2003/03/03 21:52:24 1.14
+++ loncom/interface/lonhtmlcommon.pm 2003/05/12 22:04:41 1.21
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.14 2003/03/03 21:52:24 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.21 2003/05/12 22:04:41 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -249,174 +249,97 @@ sub get_date_from_form {
##############################################
##############################################
-sub AscendOrderOptions {
- my ($order, $page, $formName)=@_;
+=pod
- my $OpSel1 = '';
- my $OpSel2 = '';
+=item &pjump_javascript_definition()
- if($order eq 'Ascending') {
- $OpSel1 = ' selected';
- } else {
- $OpSel2 = ' selected';
- }
+Returns javascript defining the 'pjump' function, which opens up a
+parameter setting wizard.
- my $Str = '';
- $Str .= ''."\n";
-
- return $Str;
-}
-
-sub MapOptions {
- my ($data, $page, $formName)=@_;
- my $Str = '';
- $Str .= ''."\n";
}
@@ -653,10 +580,10 @@ sub Create_PrgWin {
"");
my %prog_state;
- $prog_state{'now'}=0;
- $prog_state{'since'}=time;
- $prog_state{'started'}=time;
- $prog_state{'total'}=$number_to_do;
+ $prog_state{'done'}=0;
+ $prog_state{'firststart'}=time;
+ $prog_state{'laststart'}=time;
+ $prog_state{'max'}=$number_to_do;
$r->rflush();
return %prog_state;
@@ -667,22 +594,39 @@ sub Update_PrgWin {
my ($r,$prog_state,$displayString)=@_;
$r->print('');
- $$prog_state{'started'}=time;
+ $$prog_state{'laststart'}=time;
$r->rflush();
}
# increment progress state
sub Increment_PrgWin {
my ($r,$prog_state,$extraInfo)=@_;
- $$prog_state{'now'}++;
+ $$prog_state{'done'}++;
+ my $time_est= (time - $$prog_state{'firststart'})/$$prog_state{'done'} *
+ ($$prog_state{'max'}-$$prog_state{'done'});
+ $time_est = int($time_est);
+ if (int ($time_est/60) > 0) {
+ my $min = int($time_est/60);
+ my $sec = $time_est % 60;
+ $time_est = $min.' minutes';
+ if ($sec > 1) {
+ $time_est.= ', '.$sec.' seconds';
+ } elsif ($sec > 0) {
+ $time_est.= ', '.$sec.' second';
+ }
+ } else {
+ $time_est .= ' seconds';
+ }
+ my $lasttime = time-$$prog_state{'laststart'};
+ if ($lasttime == 1) {
+ $lasttime = '('.$lasttime.' second for '.$extraInfo.')';
+ } else {
+ $lasttime = '('.$lasttime.' seconds for '.$extraInfo.')';
+ }
$r->print('');
- $$prog_state{'started'}=time;
- sleep 1;
+ $$prog_state{'done'}.'/'.$$prog_state{'max'}.
+ ': '.$time_est.' remaining '.$lasttime.'";'.'');
+ $$prog_state{'laststart'}=time;
$r->rflush();
}