--- loncom/interface/loncommon.pm 2011/12/20 23:57:51 1.1041 +++ loncom/interface/loncommon.pm 2011/12/22 00:17:04 1.1045 @@ -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.1045 2011/12/22 00:17:04 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -6563,6 +6563,10 @@ a#LC_content_toolbar_changefolder_toggle background-image:url(/res/adm/pages/open-all-folders.gif); } +a#LC_content_toolbar_edittoplevel { + background-image:url(/res/adm/pages/edittoplevel.gif); +} + ul#LC_toolbar li a:hover { background-position: bottom center; } @@ -7065,7 +7069,7 @@ sub modal_adhoc_inner { 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(). @@ -7142,12 +7146,11 @@ sub end_togglebox { } sub LCprogressbar_script { + my ($id)=@_; return(< // ENDPROGRESSUPDATE } +my $LClastpercent; +my $LCidcnt; +my $LCcurrentid; + sub LCprogressbar { - my ($r,$mode)=(@_); + my ($r)=(@_); + $LClastpercent=0; + $LCidcnt++; + $LCcurrentid=$$.'_'.$LCidcnt; my $starting=&mt('Starting'); my $content=(< -
+
$starting

ENDPROGBAR - $content.=&LCprogressbar_script(); - if ($mode eq 'popup') { - $r->print(&modal_adhoc_launch('LCprogwin',500,50,$content)); - } else { - $r->print($content); - } - $r->rflush(); + &r_print($r,$content.&LCprogressbar_script($LCcurrentid)); } 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 - $r->rflush(); +} + +sub LCprogressbarClose { + my ($r)=@_; + $LClastpercent=0; + &r_print($r,< +// + +ENDCLOSE +} + +sub r_print { + my ($r,$to_print)=@_; + if ($r) { + $r->print($to_print); + $r->rflush(); + } else { + print($to_print); + } } sub html_encode { @@ -7222,6 +7253,7 @@ sub html_encode { return $result; } + sub js_ready { my ($result) = @_;