--- loncom/interface/loncommon.pm 2011/12/20 22:43:34 1.1040
+++ loncom/interface/loncommon.pm 2011/12/23 16:55:34 1.1046
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1040 2011/12/20 22:43:34 raeburn Exp $
+# $Id: loncommon.pm,v 1.1046 2011/12/23 16:55:34 raeburn 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;
}
@@ -6739,6 +6743,7 @@ sub headtag {
$result.=&modal_window();
$result.=&togglebox_script();
$result.=&wishlist_window();
+ $result.=&LCprogressbarUpdate_script();
} else {
if ($args->{'add_modal'}) {
$result.=&modal_window();
@@ -6749,6 +6754,9 @@ sub headtag {
if ($args->{'add_togglebox'}) {
$result.=&togglebox_script();
}
+ if ($args->{'add_progressbar'}) {
+ $result.=&LCprogressbarUpdate_script();
+ }
}
if (ref($args->{'redirect'})) {
my ($time,$url,$inhibit_continue) = @{$args->{'redirect'}};
@@ -6965,7 +6973,7 @@ sub end_page {
sub wishlist_window {
return(<<'ENDWISHLIST');
-
+ENDLAUNCH
+}
+
+sub modal_adhoc_close {
+ return (<
+//
+
+ENDCLOSE
+}
+
sub togglebox_script {
return(<
@@ -7097,18 +7145,105 @@ sub end_togglebox {
return ''.&end_data_table();
}
-sub modal_adhoc_window {
- my ($funcname,$width,$height,$content,$linktext)=@_;
- my $innerwidth=$width-20;
- $content=&js_ready(
- &start_page('Dialog',undef,{'only_body'=>1,'bgcolor'=>'#FFFFFF'}).
- &start_scrollbox($width.'px',$innerwidth.'px',$height.'px').
- $content.
- &end_scrollbox().
- &end_page()
- );
- return &modal_adhoc_script($funcname,$width,$height,$content).
- "".$linktext."";
+sub LCprogressbar_script {
+ my ($id)=@_;
+ return(<
+//
+
+ENDPROGRESS
+}
+
+sub LCprogressbarUpdate_script {
+ return(<
+.ui-progressbar { position:relative; }
+.pblabel { position: absolute; width: 100%; text-align: center; line-height: 1.9em; }
+
+
+ENDPROGRESSUPDATE
+}
+
+my $LClastpercent;
+my $LCidcnt;
+my $LCcurrentid;
+
+sub LCprogressbar {
+ my ($r)=(@_);
+ $LClastpercent=0;
+ $LCidcnt++;
+ $LCcurrentid=$$.'_'.$LCidcnt;
+ my $starting=&mt('Starting');
+ my $content=(<
+
+ $starting
+
+
+ENDPROGBAR
+ &r_print($r,$content.&LCprogressbar_script($LCcurrentid));
+}
+
+sub LCprogressbarUpdate {
+ 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.'%'; }
+ $text=&js_ready($text);
+ &r_print($r,<
+//
+
+ENDUPDATE
+}
+
+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 {
@@ -7118,6 +7253,7 @@ sub html_encode {
return $result;
}
+
sub js_ready {
my ($result) = @_;