$1<\/tt><\/a>$2/gi;
return $message;
}
@@ -90,7 +90,7 @@ Successful completion of an operation me
sub confirm_success {
my ($message,$failure)=@_;
if ($failure) {
- return ''."\n"
+ return ''."\n"
.'
'."\n"
.$message."\n"
.''."\n";
@@ -927,7 +927,7 @@ Returns: none
=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:
@@ -940,6 +940,8 @@ Inputs:
=item $extraInfo A description of the items being iterated over. Typically
'student'.
+=item $step (optional) counter step. Will be set to default 1 if ommited.
+
=back
Returns: none
@@ -1049,11 +1051,22 @@ sub Update_PrgWin {
# increment progress state
sub Increment_PrgWin {
- my ($r,$prog_state,$extraInfo)=@_;
- $$prog_state{'done'}++;
+ my ($r,$prog_state,$extraInfo,$step)=@_;
+ if ($step !~ /^\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'})/
- $$prog_state{'done'} *
- ($$prog_state{'max'}-$$prog_state{'done'});
+ $current * $last;
$time_est = int($time_est);
#
my $min = int($time_est/60);
@@ -1061,7 +1074,7 @@ sub Increment_PrgWin {
#
my $str;
if ($min == 0 && $sec > 1) {
- $str = '[_2] seconds';
+ $str = '[_1] seconds';
} elsif ($min == 1 && $sec > 1) {
$str = '1 minute [_2] seconds';
} elsif ($min == 1 && $sec < 2) {
@@ -1100,7 +1113,7 @@ sub Increment_PrgWin {
$$prog_state{'window'}.'.document.'.
$$prog_state{'formname'}.'.'.
$$prog_state{'inputname'}.'.value="'.
- $$prog_state{'done'}.'/'.$$prog_state{'max'}.
+ $current.'/'.$$prog_state{'max'}.
': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'
));
$$prog_state{'laststart'}=&Time::HiRes::time();
@@ -1283,7 +1296,6 @@ sub htmlarea_lang {
sub htmlareaselectactive {
my @fields=@_;
unless (&htmlareabrowser()) { return ''; }
- #if (&htmlareablocked()) { return '
'.&enablelink(@fields); }
my $output='
'.
- &disablelink(@fields);
+ .'
';
return $output;
}
@@ -1440,8 +1451,9 @@ returns: nothing
if ($menulink) {
my $description = 'Menu';
my $no_mt_descr = 0;
- if (exists($env{'request.course.id'}) &&
- $env{'request.course.id'} ne '') {
+ if ((exists($env{'request.course.id'})) &&
+ ($env{'request.course.id'} ne '') &&
+ ($env{'course.'.$env{'request.course.id'}.'.description'} ne '')) {
$description =
$env{'course.'.$env{'request.course.id'}.'.description'};
$no_mt_descr = 1;
@@ -1482,7 +1494,10 @@ returns: nothing
my $lasttext = $last->{'no_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 = '';
$faq = $last->{'faq'} if (exists($last->{'faq'}));
@@ -1768,7 +1783,6 @@ ENDTWO
} # End: row_count block for pick_box
-
sub role_select_row {
my ($roles,$title,$css_class,$show_separate_custom,$cdom,$cnum) = @_;
my $crstype = 'Course';
@@ -1991,6 +2005,29 @@ sub course_custom_roles {
}
+sub resource_info_box {
+ my ($symb,$onlyfolderflag)=@_;
+ my $return='';
+ if ($symb) {
+ $return=&Apache::loncommon::start_data_table();
+ my ($map,$id,$resource)=&Apache::lonnet::decode_symb($symb);
+ my $folder=&Apache::lonnet::gettitle($map);
+ $return.=&Apache::loncommon::start_data_table_row().
+ ''.&mt('Folder:').' | '.$folder.' | '.
+ &Apache::loncommon::end_data_table_row();
+ unless ($onlyfolderflag) {
+ $return.=&Apache::loncommon::start_data_table_row().
+ ''.&mt('Resource:').' | '.&Apache::lonnet::gettitle($symb).' | '.
+ &Apache::loncommon::end_data_table_row();
+ }
+ $return.=&Apache::loncommon::end_data_table();
+ } else {
+ $return=''.&mt('No context provided.').'
';
+ }
+ return $return;
+
+}
+
##############################################
##############################################
@@ -2371,6 +2408,7 @@ returns: XHTML list as String.
# \@items, {listattr => { class => 'abc', id => 'xyx' }, itemattr => {class => 'abc', id => 'xyx'}}
sub list_from_array {
my ($items, $args) = @_;
+ return unless scalar @$items;
my ($ul, $li) = inittags( qw(ul li) );
my $listitems = join '', map { $li->($_, $args->{itemattr}) } @$items;
return $ul->( $listitems, $args->{listattr} );