[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface lonhtmlcommon.pm

raeburn raeburn@source.lon-capa.org
Thu, 13 Aug 2009 15:43:45 -0000


raeburn		Thu Aug 13 15:43:45 2009 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  - Backport 1.218.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.182.4.1 loncom/interface/lonhtmlcommon.pm:1.182.4.2
--- loncom/interface/lonhtmlcommon.pm:1.182.4.1	Wed May 20 21:32:53 2009
+++ loncom/interface/lonhtmlcommon.pm	Thu Aug 13 15:43:45 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.182.4.1 2009/05/20 21:32:53 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.182.4.2 2009/08/13 15:43:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -77,12 +77,12 @@
    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 @@
     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
@@ -430,6 +432,7 @@
     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 @@
         }
 
     }
+// ]]>
 </script>
 ENDJS
     $result .= '  <span style="white-space: nowrap;">';
@@ -975,6 +979,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['.
         "var popwin;
          function openpopwin () {
          popwin=open(\'\',\'popwin\',\'width=400,height=100\');".
@@ -985,7 +990,9 @@
 	      &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 @@
 # 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 @@
     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 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'));
     }
@@ -1167,7 +1186,8 @@
 
     my $nothing=&javascript_nothing();
     return (<<ENDCHECK);
-<script type="text/javascript"> 
+<script type="text/javascript">
+// <![CDATA[
 //<!-- BEGIN LON-CAPA Internal
 var checkwin;
 
@@ -1178,6 +1198,7 @@
     checkwin.document.close();
 }
 // END LON-CAPA Internal -->
+// ]]>
 </script>
 ENDCHECK
 }
@@ -1251,7 +1272,8 @@
     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 @@
     oFCKeditor.Config['DefaultLanguage'] = '$lang';
 }";
     }
-    $output.="\nwindow.status='Activated Editfields';\n</script><br />".
+    $output.="\nwindow.status='Activated Editfields';\n".
+             '// ]]>'.
+             '</script><br />'.
 	&disablelink(@fields);
     return $output;
 }
@@ -1620,6 +1644,7 @@
     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') {
@@ -1642,6 +1667,7 @@
             formname.courselist = '';
         }
     }
+// ]]>
 </script>
     |;
     my $courseform='<b>'.&Apache::loncommon::selectcourse_link