[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 28 Feb 2005 07:59:43 -0000


albertel		Mon Feb 28 02:59:43 2005 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  - flip it to text/xml in all cases when we would have said text/html but we are in mathml mode
  - xhmt wants selected="selected"
  - xhtml wants <script> bodies wrapped in CDATA, I'm going to check these out on various old IE versions tommorrow
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.252 loncom/interface/loncommon.pm:1.253
--- loncom/interface/loncommon.pm:1.252	Fri Feb 25 00:54:01 2005
+++ loncom/interface/loncommon.pm	Mon Feb 28 02:59:42 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.252 2005/02/25 05:54:01 albertel Exp $
+# $Id: loncommon.pm,v 1.253 2005/02/28 07:59:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -547,7 +547,7 @@
     $result .= "<select size=\"1\" name=\"$firstselectname\" onchange=\"select1_changed()\">\n";
     foreach my $value (sort(keys(%$hashref))) {
         $result.="    <option value=\"$value\" ";
-        $result.=" selected=\"true\" " if ($value eq $firstdefault);
+        $result.=" selected=\"selected\" " if ($value eq $firstdefault);
         $result.=">".&mt($hashref->{$value}->{'text'})."</option>\n";
     }
     $result .= "</select>\n";
@@ -557,7 +557,7 @@
     my $seconddefault = $hashref->{$firstdefault}->{'default'};
     foreach my $value (sort(keys(%select2))) {
         $result.="    <option value=\"$value\" ";        
-        $result.=" selected=\"true\" " if ($value eq $seconddefault);
+        $result.=" selected=\"selected\" " if ($value eq $seconddefault);
         $result.=">".&mt($select2{$value})."</option>\n";
     }
     $result .= "</select>\n";
@@ -691,7 +691,8 @@
     my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif");
     $template .= <<"ENDTEMPLATE";
  <script type="text/javascript">
-//<!-- BEGIN LON-CAPA Internal
+// <!-- BEGIN LON-CAPA Internal
+// <![CDATA[
 function helpMenu(target) {
     var caller = this;
     if (target == 'open') {
@@ -717,6 +718,7 @@
     caller.document.close()
     caller.focus()
 }
+// ]]>
 // END LON-CAPA Internal -->
  </script>
  <a href="$link" title="$title"><img src="$helpicon" border="0" alt="(Help Menu)" /></a>
@@ -1045,7 +1047,7 @@
     $output.="\n<select name='$name' size='$size' multiple='1'>";
     foreach (sort(keys(%hash))) {
         $output.='<option value="'.$_.'" ';
-        $output.='selected ' if ($selected{$_});
+        $output.='selected="selected" ' if ($selected{$_});
         $output.='>'.$hash{$_}."</option>\n";
     }
     $output.="</select>\n";
@@ -1076,7 +1078,7 @@
     }
     foreach (@keys) {
         $selectform.="<option value=\"$_\" ".
-            ($_ eq $def ? 'selected' : '').
+            ($_ eq $def ? 'selected="selected" ' : '').
                 ">".&mt($hash{$_})."</option>\n";
     }
     $selectform.="</select>";
@@ -1113,7 +1115,7 @@
     my $selectform = "<select name=\"$name\" size=\"1\">\n";
     for (my $i=0; $i<=18; $i++) {
         $selectform.="<option value=\"$i\" ".
-            ($i==$deflevel ? 'selected' : '').
+            ($i==$deflevel ? 'selected="selected" ' : '').
                 ">".&gradeleveldescription($i)."</option>\n";
     }
     $selectform.="</select>";
@@ -1143,7 +1145,7 @@
     my $selectdomain = "<select name=\"$name\" size=\"1\">\n";
     foreach (@domains) {
         $selectdomain.="<option value=\"$_\" ".
-            ($_ eq $defdom ? 'selected="selected"' : '').
+            ($_ eq $defdom ? 'selected="selected" ' : '').
                 ">$_</option>\n";
     }
     $selectdomain.="</select>";
@@ -3010,6 +3012,7 @@
 
 sub content_type {
     my ($r,$type,$charset) = @_;
+    if ($ENV{'browser.mathml'} && $type eq 'text/html') { $type='text/xml'; }
     unless ($charset) {
 	$charset=&Apache::lonlocal::current_encoding;
     }
@@ -3310,7 +3313,7 @@
 	$r->print('<option value="none"></option>');
 	foreach (sort({$a <=> $b} keys(%sone))) {
 	    $r->print('<option value="'.$_.'"'.
-                      ($_ eq $defaultcol ? ' selected ' : '').
+                      ($_ eq $defaultcol ? ' selected="selected" ' : '').
                       '>Column '.($_+1).'</option>');
 	}
 	$r->print('</select></td></tr>'."\n");
@@ -3354,7 +3357,7 @@
 	foreach (@$d) {
 	    my ($value,$display,$defaultcol)=@{ $_ };
 	    $r->print('<option value="'.$value.'"'.
-                      ($i eq $defaultcol ? ' selected ':'').'>'.
+                      ($i eq $defaultcol ? ' selected="selected" ':'').'>'.
                       $display.'</option>');
 	}
 	$r->print('</select></td><td>');