--- loncom/interface/lonhtmlcommon.pm 2011/12/11 13:23:24 1.296
+++ loncom/interface/lonhtmlcommon.pm 2012/01/03 00:28:29 1.300
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.296 2011/12/11 13:23:24 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.300 2012/01/03 00:28:29 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -991,82 +991,23 @@ Returns: none
########################################################
########################################################
-my $uniq=0;
-sub get_uniq_name {
- $uniq++;
- return 'uniquename'.$uniq;
-}
# Create progress
sub Create_PrgWin {
- my ($r, $title, $heading, $number_to_do,$type,$width,$formname,
- $inputname)=@_;
- if (!defined($type)) { $type='popup'; }
- if (!defined($width)) { $width=55; }
+ my ($r,$number_to_do)=@_;
my %prog_state;
- $prog_state{'type'}=$type;
- if ($type eq 'popup') {
- $prog_state{'window'}='popwin';
- my $start_page =
- &Apache::loncommon::start_page($title,undef,
- {'only_body' => 1,
- 'bgcolor' => '#88DDFF',
- 'js_ready' => 1});
- my $end_page = &Apache::loncommon::end_page({'js_ready' => 1});
-
- #the whole function called through timeout is due to issues
- #in mozilla Read BUG #2665 if you want to know the whole story
- &r_print($r,&Apache::lonhtmlcommon::scripttag(
- "var popwin;
- function openpopwin () {
- popwin=open(\'\',\'popwin\',\'width=400,height=100\');".
- "popwin.document.writeln(\'".$start_page.
- "
".&mt("$heading")."<\/h4>".
- "
'); }
- &Update_PrgWin($r,\%prog_state,&mt('Starting'));
- }
-
$prog_state{'done'}=0;
$prog_state{'firststart'}=&Time::HiRes::time();
$prog_state{'laststart'}=&Time::HiRes::time();
$prog_state{'max'}=$number_to_do;
-
+ &Apache::loncommon::LCprogressbar($r);
return %prog_state;
}
# update progress
sub Update_PrgWin {
my ($r,$prog_state,$displayString)=@_;
- &r_print($r,&Apache::lonhtmlcommon::scripttag(
- $$prog_state{'window'}.'.document.'.
- $$prog_state{'formname'}.'.'.
- $$prog_state{'inputname'}.'.value="'.
- $displayString.'";'
- ));
+ &Apache::loncommon::LCprogressbarUpdate($r,undef,$displayString);
$$prog_state{'laststart'}=&Time::HiRes::time();
}
@@ -1112,38 +1053,21 @@ sub Increment_PrgWin {
$min,
$sec,
$lasttime);
-
- &r_print($r,&Apache::lonhtmlcommon::scripttag(
- $$prog_state{'window'}.'.document.'.
- $$prog_state{'formname'}.'.'.
- $$prog_state{'inputname'}.'.value="'.$timeinfo.'";'
- ));
+ my $percent=0;
+ if ($$prog_state{'max'}) {
+ $percent=int(100.*$current/$$prog_state{'max'});
+ }
+ &Apache::loncommon::LCprogressbarUpdate($r,$percent,$timeinfo);
$$prog_state{'laststart'}=&Time::HiRes::time();
}
# close Progress Line
sub Close_PrgWin {
my ($r,$prog_state)=@_;
- if ($$prog_state{'type'} eq 'popup') {
- &r_print($r,&Apache::lonhtmlcommon::scripttag(
- 'popwin.close()'
- ));
- } elsif ($$prog_state{'type'} eq 'inline') {
- &Update_PrgWin($r,$prog_state,&mt('Done'));
- }
+ &Apache::loncommon::LCprogressbarClose($r);
undef(%$prog_state);
}
-sub r_print {
- my ($r,$to_print)=@_;
- if ($r) {
- $r->print($to_print);
- $r->rflush();
- } else {
- print($to_print);
- }
-}
-
# ------------------------------------------------------- Puts directory header
sub crumbs {
@@ -1538,9 +1462,11 @@ returns: nothing
}
my $links;
if ((&show_return_link) && (!$CourseBreadcrumbs)) {
- $links=&htmltag( 'a',"
",
+ my $alttext = &mt('Go Back');
+ $links=&htmltag( 'a',"
",
{ href => '/adm/flip?postdata=return:',
title => &mt("Back to most recent content resource") });
+ $links=&htmltag('li',$links);
}
$links.= join "",
map {
@@ -2077,26 +2003,41 @@ sub course_custom_roles {
sub resource_info_box {
- my ($symb,$onlyfolderflag)=@_;
+ my ($symb,$onlyfolderflag,$stuvcurrent,$stuvdisp)=@_;
my $return='';
+ if ($stuvcurrent ne '') {
+ $return = '';
+ }
if ($symb) {
- $return=&Apache::loncommon::start_data_table();
+ $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.' | '.
+ '
'.&mt('Folder:').' | '.$folder.' | '.
&Apache::loncommon::end_data_table_row();
unless ($onlyfolderflag) {
$return.=&Apache::loncommon::start_data_table_row().
- '
'.&mt('Resource:').' | '.&Apache::lonnet::gettitle($symb).' | '.
+ '
'.&mt('Resource:').' | '.&Apache::lonnet::gettitle($symb).' | '.
+ &Apache::loncommon::end_data_table_row();
+ }
+ if ($stuvcurrent ne '') {
+ $return .= &Apache::loncommon::start_data_table_row().
+ '
'.&mt("Student's current version:").' | '.$stuvcurrent.' | '.
+ &Apache::loncommon::end_data_table_row();
+ }
+ if ($stuvdisp ne '') {
+ $return .= &Apache::loncommon::start_data_table_row().
+ '
'.&mt("Student's version displayed:").' | '.$stuvdisp.' | '.
&Apache::loncommon::end_data_table_row();
}
$return.=&Apache::loncommon::end_data_table();
} else {
$return='
'.&mt('No context provided.').'
';
}
+ if ($stuvcurrent ne '') {
+ $return .= '
';
+ }
return $return;
-
}
##############################################