Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.271 and 1.277

version 1.271, 2010/04/13 10:21:29 version 1.277, 2010/06/10 09:09:59
Line 927  Returns: none Line 927  Returns: none
   
 =item Increment_PrgWin  =item Increment_PrgWin
   
 Increment the count of items completed for the progress window by 1.    Increment the count of items completed for the progress window by $step or 1 if no step is provided.
   
 Inputs:  Inputs:
   
Line 940  Inputs: Line 940  Inputs:
 =item $extraInfo A description of the items being iterated over.  Typically  =item $extraInfo A description of the items being iterated over.  Typically
 'student'.  'student'.
   
   =item $step (optional) counter step. Will be set to default 1 if ommited.
   
 =back  =back
   
 Returns: none  Returns: none
Line 1049  sub Update_PrgWin { Line 1051  sub Update_PrgWin {
   
 # increment progress state  # increment progress state
 sub Increment_PrgWin {  sub Increment_PrgWin {
     my ($r,$prog_state,$extraInfo)=@_;      my ($r,$prog_state,$extraInfo,$step)=@_;
     $$prog_state{'done'}++;      if ( ($step == 0) || ($step !~ /^\d+(\.\d+)*$/) ) {
           $step = 1; # default
       }
       $$prog_state{'done'} += $step;
   
       # Catch (max modulo step) <> 0
       my $current = $$prog_state{'done'};
       my $last = ($$prog_state{'max'} - $current);
       if ($last <= 0) {
           $last = 1;
           $current = $$prog_state{'max'};
       }
   
     my $time_est= (&Time::HiRes::time() - $$prog_state{'firststart'})/      my $time_est= (&Time::HiRes::time() - $$prog_state{'firststart'})/
         $$prog_state{'done'} *          $current * $last;
  ($$prog_state{'max'}-$$prog_state{'done'});  
     $time_est = int($time_est);      $time_est = int($time_est);
     #      #
     my $min = int($time_est/60);      my $min = int($time_est/60);
Line 1100  sub Increment_PrgWin { Line 1113  sub Increment_PrgWin {
         $$prog_state{'window'}.'.document.'.          $$prog_state{'window'}.'.document.'.
         $$prog_state{'formname'}.'.'.          $$prog_state{'formname'}.'.'.
         $$prog_state{'inputname'}.'.value="'.          $$prog_state{'inputname'}.'.value="'.
         $$prog_state{'done'}.'/'.$$prog_state{'max'}.          $current.'/'.$$prog_state{'max'}.
         ': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'          ': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'
     ));      ));
     $$prog_state{'laststart'}=&Time::HiRes::time();      $$prog_state{'laststart'}=&Time::HiRes::time();
Line 1481  returns: nothing Line 1494  returns: nothing
         my $lasttext = $last->{'no_mt'} ? $last->{'text'}           my $lasttext = $last->{'no_mt'} ? $last->{'text'} 
                      : mt( $last->{'text'} );                       : mt( $last->{'text'} );
   
         $links .= htmltag( 'li', htmltag('b', $lasttext), {title => $lasttext});          # last breadcrumb is the first order heading of a page
           # for course breadcrumbs it's just bold
           $links .= htmltag( 'li', htmltag($CourseBreadcrumbs ? 'b' : 'h1',
                   $lasttext), {title => $lasttext});
   
         my $icons = '';          my $icons = '';
         $faq  = $last->{'faq'}  if (exists($last->{'faq'}));          $faq  = $last->{'faq'}  if (exists($last->{'faq'}));
Line 2392  returns: XHTML list as String. Line 2408  returns: XHTML list as String.
 # \@items, {listattr => { class => 'abc', id => 'xyx' }, itemattr => {class => 'abc', id => 'xyx'}}  # \@items, {listattr => { class => 'abc', id => 'xyx' }, itemattr => {class => 'abc', id => 'xyx'}}
 sub list_from_array {  sub list_from_array {
     my ($items, $args) = @_;      my ($items, $args) = @_;
       return unless scalar @$items;
     my ($ul, $li) = inittags( qw(ul li) );      my ($ul, $li) = inittags( qw(ul li) );
     my $listitems = join '', map { $li->($_, $args->{itemattr}) } @$items;      my $listitems = join '', map { $li->($_, $args->{itemattr}) } @$items;
     return $ul->( $listitems, $args->{listattr} );      return $ul->( $listitems, $args->{listattr} );

Removed from v.1.271  
changed lines
  Added in v.1.277


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>