--- loncom/interface/lonhtmlcommon.pm 2009/05/20 20:27:37 1.217 +++ loncom/interface/lonhtmlcommon.pm 2009/05/22 17:57:19 1.218 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common html routines # -# $Id: lonhtmlcommon.pm,v 1.217 2009/05/20 20:27:37 raeburn Exp $ +# $Id: lonhtmlcommon.pm,v 1.218 2009/05/22 17:57:19 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -77,12 +77,12 @@ sub confirm_success { my ($message,$failure)=@_; if ($failure) { return '<span class="LC_error">'."\n" - .'<img src="/adm/lonIcons/navmap.wrong.gif" /> '."\n" + .'<img src="/adm/lonIcons/navmap.wrong.gif" alt="'.&mt('Error').'" /> '."\n" .$message."\n" .'</span>'."\n"; } else { return '<span class="LC_success">'."\n" - .'<img src="/adm/lonIcons/navmap.correct.gif" /> '."\n" + .'<img src="/adm/lonIcons/navmap.correct.gif" alt="'.&mt('Ok').'" /> '."\n" .$message."\n" .'</span>'."\n"; } @@ -130,11 +130,13 @@ sub dragmath_js { my ($popup) = @_; return <<ENDDRAGMATHJS; <script type="text/javascript"> + // <![CDATA[ function mathedit(textarea, doc) { targetEntry = textarea; targetDoc = doc; newwin = window.open("/adm/dragmath/applet/$popup.html","","width=565,height=500,resizable"); } + // ]]> </script> ENDDRAGMATHJS @@ -161,7 +163,7 @@ sub authorbombs { foreach (keys %bombs) { if ($_=~/^$udom\/$uname\//) { return '<a href="/adm/bombs/'.$url. - '"><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/bomb.gif').'" border="0" /></a>'. + '"><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/bomb.gif').'" alt="'.&mt('Bomb').'" border="0" /></a>'. &Apache::loncommon::help_open_topic('About_Bombs'); } } @@ -430,6 +432,7 @@ sub date_setter { my $result = "\n<!-- $dname date setting form -->\n"; $result .= <<ENDJS; <script type="text/javascript"> +// <![CDATA[ function $dname\_checkday() { var day = document.$formname.$dname\_day.value; var month = document.$formname.$dname\_month.value; @@ -490,6 +493,7 @@ document.$formname.$dname\_year.value, } } +// ]]> </script> ENDJS $result .= ' <span class="LC_nobreak">'; @@ -975,6 +979,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,'<script type="text/javascript">'. + '// <![CDATA['. "var popwin; function openpopwin () { popwin=open(\'\',\'popwin\',\'width=400,height=100\');". @@ -985,7 +990,9 @@ sub Create_PrgWin { &mt('Starting').'" /><\\/form>'.$end_page. "\');". "popwin.document.close();}". - "\nwindow.setTimeout(openpopwin,0)</script>"); + "\nwindow.setTimeout(openpopwin,0)". + '// ]]>'. + '</script>'); $prog_state{'formname'}='popremain'; $prog_state{'inputname'}="remaining"; } elsif ($type eq 'inline') { @@ -1018,10 +1025,14 @@ sub Create_PrgWin { # update progress sub Update_PrgWin { my ($r,$prog_state,$displayString)=@_; - &r_print($r,'<script type="text/javascript">'.$$prog_state{'window'}.'.document.'. + &r_print($r,'<script type="text/javascript">'. + '// <![CDATA['. + $$prog_state{'window'}.'.document.'. $$prog_state{'formname'}.'.'. $$prog_state{'inputname'}.'.value="'. - $displayString.'";</script>'); + $displayString.'";'. + '// ]]>'. + '</script>'); $$prog_state{'laststart'}=&Time::HiRes::time(); } @@ -1074,11 +1085,15 @@ sub Increment_PrgWin { if ($user_browser eq 'explorer' && $user_os =~ 'mac') { $lasttime = ''; } - &r_print($r,'<script>'.$$prog_state{'window'}.'.document.'. + &r_print($r,'<script>'. + '// <![CDATA['. + $$prog_state{'window'}.'.document.'. $$prog_state{'formname'}.'.'. $$prog_state{'inputname'}.'.value="'. $$prog_state{'done'}.'/'.$$prog_state{'max'}. - ': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'.'</script>'); + ': '.$time_est.' '.&mt('remaining').' '.$lasttime.'";'. + '// ]]>'. + '</script>'); $$prog_state{'laststart'}=&Time::HiRes::time(); } @@ -1086,7 +1101,11 @@ sub Increment_PrgWin { sub Close_PrgWin { my ($r,$prog_state)=@_; if ($$prog_state{'type'} eq 'popup') { - &r_print($r,'<script>popwin.close()</script>'."\n"); + &r_print($r,'<script>'. + '// <![CDATA['. + 'popwin.close()'. + '// ]]>'. + '</script>'."\n"); } elsif ($$prog_state{'type'} eq 'inline') { &Update_PrgWin($r,$prog_state,&mt('Done')); } @@ -1168,6 +1187,7 @@ sub spellheader { my $nothing=&javascript_nothing(); return (<<ENDCHECK); <script type="text/javascript"> +// <![CDATA[ //<!-- BEGIN LON-CAPA Internal var checkwin; @@ -1178,6 +1198,7 @@ function spellcheckerwindow(string) { checkwin.document.close(); } // END LON-CAPA Internal --> +// ]]> </script> ENDCHECK } @@ -1251,7 +1272,8 @@ sub htmlareaselectactive { my @fields=@_; unless (&htmlareabrowser()) { return ''; } if (&htmlareablocked()) { return '<br />'.&enablelink(@fields); } - my $output='<script type="text/javascript" defer="1">'; + my $output='<script type="text/javascript" defer="1">' + .'// <![CDATA['; my $lang = &htmlarea_lang(); foreach my $field (@fields) { $output.=" @@ -1264,7 +1286,9 @@ sub htmlareaselectactive { oFCKeditor.Config['DefaultLanguage'] = '$lang'; }"; } - $output.="\nwindow.status='Activated Editfields';\n</script><br />". + $output.="\nwindow.status='Activated Editfields';\n" + .'// ]]>' + .'</script><br />'. &disablelink(@fields); return $output; } @@ -1646,6 +1670,7 @@ sub course_selection { my ($formname,$totcodes,$codetitles,$idlist,$idlist_titles) = @_; my $output = qq| <script type="text/javascript"> +// <![CDATA[ function coursePick (formname) { for (var i=0; i<formname.coursepick.length; i++) { if (formname.coursepick[i].value == 'category') { @@ -1668,6 +1693,7 @@ sub course_selection { formname.courselist = ''; } } +// ]]> </script> |; my $courseform='<b>'.&Apache::loncommon::selectcourse_link