--- loncom/interface/lonhtmlcommon.pm 2009/08/03 16:34:16 1.228
+++ loncom/interface/lonhtmlcommon.pm 2009/08/10 16:27:39 1.230
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.228 2009/08/03 16:34:16 bisitz Exp $
+# $Id: lonhtmlcommon.pm,v 1.230 2009/08/10 16:27:39 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -978,8 +978,7 @@ sub Create_PrgWin {
#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,'');
+ "\nwindow.setTimeout(openpopwin,0)"
+ ));
$prog_state{'formname'}='popremain';
$prog_state{'inputname'}="remaining";
} elsif ($type eq 'inline') {
@@ -1025,14 +1023,12 @@ sub Create_PrgWin {
# update progress
sub Update_PrgWin {
my ($r,$prog_state,$displayString)=@_;
- &r_print($r,'');
+ $$prog_state{'formname'}.'.'.
+ $$prog_state{'inputname'}.'.value="'.
+ $displayString.'";'
+ ));
$$prog_state{'laststart'}=&Time::HiRes::time();
}
@@ -1085,15 +1081,13 @@ sub Increment_PrgWin {
if ($user_browser eq 'explorer' && $user_os =~ 'mac') {
$lasttime = '';
}
- &r_print($r,'');
+ $$prog_state{'formname'}.'.'.
+ $$prog_state{'inputname'}.'.value="'.
+ $$prog_state{'done'}.'/'.$$prog_state{'max'}.
+ ': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'
+ ));
$$prog_state{'laststart'}=&Time::HiRes::time();
}
@@ -1101,11 +1095,9 @@ sub Increment_PrgWin {
sub Close_PrgWin {
my ($r,$prog_state)=@_;
if ($$prog_state{'type'} eq 'popup') {
- &r_print($r,''."\n");
+ &r_print($r,&Apache::lonhtmlcommon::scripttag(
+ 'popwin.close()'
+ ));
} elsif ($$prog_state{'type'} eq 'inline') {
&Update_PrgWin($r,$prog_state,&mt('Done'));
}
@@ -1272,8 +1264,8 @@ sub htmlareaselectactive {
my @fields=@_;
unless (&htmlareabrowser()) { return ''; }
if (&htmlareablocked()) { return '
'.&enablelink(@fields); }
- my $output='
'.
&disablelink(@fields);
return $output;
@@ -2117,6 +2109,25 @@ sub inittags {
}
+# USAGE: scripttag(scriptcode, true/false);
+#
+# EXAMPLES:
+# - scripttag("alert('Hello World!')")
+#
+# NOTES:
+# - works currently only for javascripts
+#
+# OUTPUT: Scriptcode properly enclosed in