[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm
bisitz
bisitz@source.lon-capa.org
Mon, 10 Aug 2009 16:27:39 -0000
bisitz Mon Aug 10 16:27:39 2009 EDT
Modified files:
/loncom/interface lonhtmlcommon.pm
Log:
- Corrected some missing HTML code line breaks in CDATA comments for script code, e.g. in &Update_PrgWin
- Also use new function &scripttag in some cases to wrap script. This automatically corrects the issues mentioned above.
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.229 loncom/interface/lonhtmlcommon.pm:1.230
--- loncom/interface/lonhtmlcommon.pm:1.229 Mon Aug 10 12:32:34 2009
+++ loncom/interface/lonhtmlcommon.pm Mon Aug 10 16:27:39 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.229 2009/08/10 12:32:34 droeschl 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 @@
#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,'<script type="text/javascript">'.
- '// <![CDATA['.
+ &r_print($r,&Apache::lonhtmlcommon::scripttag(
"var popwin;
function openpopwin () {
popwin=open(\'\',\'popwin\',\'width=400,height=100\');".
@@ -990,9 +989,8 @@
&mt('Starting').'" /><\\/form>'.$end_page.
"\');".
"popwin.document.close();}".
- "\nwindow.setTimeout(openpopwin,0)".
- '// ]]>'.
- '</script>');
+ "\nwindow.setTimeout(openpopwin,0)"
+ ));
$prog_state{'formname'}='popremain';
$prog_state{'inputname'}="remaining";
} elsif ($type eq 'inline') {
@@ -1025,14 +1023,12 @@
# update progress
sub Update_PrgWin {
my ($r,$prog_state,$displayString)=@_;
- &r_print($r,'<script type="text/javascript">'.
- '// <![CDATA['.
+ &r_print($r,&Apache::lonhtmlcommon::scripttag(
$$prog_state{'window'}.'.document.'.
- $$prog_state{'formname'}.'.'.
- $$prog_state{'inputname'}.'.value="'.
- $displayString.'";'.
- '// ]]>'.
- '</script>');
+ $$prog_state{'formname'}.'.'.
+ $$prog_state{'inputname'}.'.value="'.
+ $displayString.'";'
+ ));
$$prog_state{'laststart'}=&Time::HiRes::time();
}
@@ -1085,15 +1081,13 @@
if ($user_browser eq 'explorer' && $user_os =~ 'mac') {
$lasttime = '';
}
- &r_print($r,'<script>'.
- '// <![CDATA['.
+ &r_print($r,&Apache::lonhtmlcommon::scripttag(
$$prog_state{'window'}.'.document.'.
- $$prog_state{'formname'}.'.'.
- $$prog_state{'inputname'}.'.value="'.
- $$prog_state{'done'}.'/'.$$prog_state{'max'}.
- ': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'.
- '// ]]>'.
- '</script>');
+ $$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 Close_PrgWin {
my ($r,$prog_state)=@_;
if ($$prog_state{'type'} eq 'popup') {
- &r_print($r,'<script>'.
- '// <![CDATA['.
- 'popwin.close()'.
- '// ]]>'.
- '</script>'."\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 @@
my @fields=@_;
unless (&htmlareabrowser()) { return ''; }
if (&htmlareablocked()) { return '<br />'.&enablelink(@fields); }
- my $output='<script type="text/javascript" defer="1">'
- .'// <![CDATA[';
+ my $output='<script type="text/javascript" defer="1">'."\n"
+ .'// <![CDATA['."\n";
my $lang = &htmlarea_lang();
foreach my $field (@fields) {
$output.="
@@ -1287,7 +1279,7 @@
}";
}
$output.="\nwindow.status='Activated Editfields';\n"
- .'// ]]>'
+ .'// ]]>'."\n"
.'</script><br />'.
&disablelink(@fields);
return $output;