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

bisitz bisitz@source.lon-capa.org
Fri, 12 Dec 2008 17:06:05 -0000


This is a MIME encoded message

--bisitz1229101565
Content-Type: text/plain

bisitz		Fri Dec 12 17:06:05 2008 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Optimized and corrected screen layout for parameter tables:
  - Use data table for tables for parameter settings (course level and folder level)
    (Doesn't use correct data_table_row_closure, because the called sub routine to close the row is used at different places where data_tables are not always used at the moment. However, the standard row closure works fine und produces correct HTML code)
  - Keep background colors but use background-color style instead of bgcolor attribute
  - Removed quotation marks from color value definitions (needed for the needed style change).
    This automatically corrects some old usages without quotation marks and wrong value comparisons
  - Now use correct closing tag in parameter setting table for folder level (2131)
  - Added missing closing tag to parameter setting table for course level (2211)
  - W3C / XHTML conform HTML attributes: use double quotation marks instead of single or no quotation marks
  
  The cells where colors are used and the color values should be revisited.
  
  
--bisitz1229101565
Content-Type: text/plain
Content-Disposition: attachment; filename="bisitz-20081212170605.txt"

Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.418 loncom/interface/lonparmset.pm:1.419
--- loncom/interface/lonparmset.pm:1.418	Wed Dec  3 21:20:57 2008
+++ loncom/interface/lonparmset.pm	Fri Dec 12 17:06:05 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.418 2008/12/03 21:20:57 schafran Exp $
+# $Id: lonparmset.pm,v 1.419 2008/12/12 17:06:05 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -935,10 +935,10 @@
 $start_page
 $breadcrumbs
 <form method="post" action="/adm/parmset?action=settable" name="parmform">
-<input type="hidden" value='' name="pres_value" />
-<input type="hidden" value='' name="pres_type" />
-<input type="hidden" value='' name="pres_marker" />
-<input type="hidden" value='1' name="prevvisit" />
+<input type="hidden" value="" name="pres_value" />
+<input type="hidden" value="" name="pres_type" />
+<input type="hidden" value="" name="pres_marker" />
+<input type="hidden" value="1" name="prevvisit" />
 ENDHEAD
 }
 
@@ -970,7 +970,7 @@
     my $parm=$$display{$which};
 
     if ($parmlev eq 'full') {
-        $r->print('<td bgcolor='.$defbgtwo.' align="center">'
+        $r->print('<td style="background-color:'.$defbgtwo.';" align="center">'
                   .$$part{$which}.'</td>');
     } else {    
         $parm=~s|\[.*\]\s||g;
@@ -979,7 +979,7 @@
     if ($automatic) {
 	$parm.='<span class="LC_warning"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</span>';
     }
-    $r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>');
+    $r->print('<td style="background-color:'.$defbgone.';">'.$parm.'</td>');
    
     my $thismarker=$which;
     $thismarker=~s/^parameter\_//;
@@ -1056,14 +1056,14 @@
 	}
 
     } # end of $parmlev if/else
-    $r->print('<td bgcolor="#CCCCFF" align="center">'.$effective_parm.'</td>');
+    $r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.'</td>');
 
     if ($parmlev eq 'full') {
         my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.
                                         '.'.$$name{$which},$$symbp{$rid});
         my $sessionvaltype=$typeoutpar[$result];
         if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; }
-        $r->print('<td bgcolor="#999999" align="center"><font color="#FFFFFF">'.
+        $r->print('<td style="background-color:#999999;" align="center"><font color="#FFFFFF">'.
                   &valout($sessionval,$sessionvaltype).'&nbsp;'.
                   '</font></td>');
     }
@@ -1073,8 +1073,8 @@
 
 sub print_td {
     my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_;
-    $r->print('<td bgcolor='.(($result==$which)?'"#AAFFAA"':$defbg).
-              ' align="center">');
+    $r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg).
+              ';" align="center">');
     if ($which<11 || $which > 12) {
 	$r->print(&plink($$typeoutpar[$which],
 			 $$display{$value},$$outpar[$which],
@@ -1100,11 +1100,11 @@
     my $grp_parm;
     if (($coursereply) && ($cgroup ne $resultgroup)) { 
         if ($result > 3) {
-            $bgcolor = '"#AAFFAA"';
+            $bgcolor = '#AAFFAA';
             $grp_parm = &valout($coursereply,$resulttype);
         }
         $grp_parm = &valout($coursereply,$resulttype);
-        $output = '<td bgcolor='.$bgcolor.' align="center">';
+        $output = '<td style="background-color:'.$bgcolor.';" align="center">';
         if ($resultgroup && $resultlevel) {
             $output .= '<small><b>'.$resultgroup.'</b> ('.$resultlevel.'): </small>'.$grp_parm;
         } else {
@@ -1112,7 +1112,7 @@
         }
         $output .= '</td>';
     } else {
-        $output .= '<td bgcolor='.$bgcolor.'>&nbsp;</td>';
+        $output .= '<td style="background-color:'.$bgcolor.';">&nbsp;</td>';
     }
     return ($coursereply,$output,$grp_parm,$resultgroup);
 }
@@ -1310,7 +1310,7 @@
     $r->print("\n<table id=\"LC_parm_overview_parm_menu\"><tr>");
     my $cnt=0;
     foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {
-	$r->print("\n<td><label><input type='checkbox' name='pscat' ");
+	$r->print("\n".'<td><label><input type="checkbox" name="pscat" ');
 	$r->print('value="'.$tempkey.'"');
 	if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
 	    $r->print(' checked');
@@ -1858,9 +1858,9 @@
               $coursespan += 3;
            } 
       
-           $r->print('<p><table border=2>');
-           $r->print('<tr><td colspan=5></td>');
-           $r->print('<th colspan='.($coursespan).'>'.&mt('Any User').'</th>');
+           $r->print('<p><table border="2">');
+           $r->print('<tr><td colspan="5"></td>');
+           $r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>');
            if ($uname) {
                if (@usersgroups > 1) {
                    $userspan ++;
@@ -1886,18 +1886,18 @@
 				  'fr'     => 'for Resource'
 					      );
            $r->print(<<ENDTABLETWO);
-<th rowspan=3>$lt{'pie'}</th>
-<th rowspan=3>$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th>
-</tr><tr><td colspan=5></td><th colspan=2>$lt{'ic'}</th><th colspan=2>$lt{'rl'}</th>
-<th colspan=1>$lt{'ic'}</th>
+<th rowspan="3">$lt{'pie'}</th>
+<th rowspan="3">$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th>
+</tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th>
+<th colspan="1">$lt{'ic'}</th>
 
 ENDTABLETWO
            if ($csec) {
-                $r->print("<th colspan=3>".
+                $r->print('<th colspan="3">'.
 			  &mt("in Section")." $csec</th>");
            }
            if ($cgroup) {
-                $r->print("<th colspan=3>".
+                $r->print('<th colspan="3">'.
                           &mt("in Group")." $cgroup</th>");
            }
            $r->print(<<ENDTABLEHEADFOUR);
@@ -1938,20 +1938,20 @@
 		    ||
 		    ($pssymb && $pssymb eq $symbp{$rid})) {
 # ------------------------------------------------------ Entry for one resource
-                    if ($defbgone eq '"#E0E099"') {
-                        $defbgone='"#E0E0DD"';
+                    if ($defbgone eq '#E0E099') {
+                        $defbgone='#E0E0DD';
                     } else {
-                        $defbgone='"#E0E099"';
+                        $defbgone='#E0E099';
                     }
-                    if ($defbgtwo eq '"#FFFF99"') {
-                        $defbgtwo='"#FFFFDD"';
+                    if ($defbgtwo eq '#FFFF99') {
+                        $defbgtwo='#FFFFDD';
                     } else {
-                        $defbgtwo='"#FFFF99"';
+                        $defbgtwo='#FFFF99';
                     }
-                    if ($defbgthree eq '"#FFBB99"') {
-                        $defbgthree='"#FFBBDD"';
+                    if ($defbgthree eq '#FFBB99') {
+                        $defbgthree='#FFBBDD';
                     } else {
-                        $defbgthree='"#FFBB99"';
+                        $defbgthree='#FFBB99';
                     }
 
                     my $thistitle='';
@@ -1980,9 +1980,9 @@
                     if ($totalparms>0) {
                         my $firstrow=1;
 			my $title=&Apache::lonnet::gettitle($symbp{$rid});
-                        $r->print('<tr><td bgcolor='.$defbgone.
+                        $r->print('<tr><td style="background-color:'.$defbgone.';"'.
                              ' rowspan='.$totalparms.
-                             '><tt><font size=-1>'.
+                             '><tt><font size="-1">'.
                              join(' / ',split(/\//,$uri)).
                              '</font></tt><p><b>'.
                              "<a href=\"javascript:openWindow('".
@@ -1995,11 +1995,11 @@
                             $r->print(' ('.$thistitle.')');
                         }
                         $r->print('</a></b></td>');
-                        $r->print('<td bgcolor='.$defbgtwo.
+                        $r->print('<td style="background-color:'.$defbgtwo.';"'.
                                       ' rowspan='.$totalparms.'>'.$typep{$rid}.
                                       '</td>');
 
-                        $r->print('<td bgcolor='.$defbgone.
+                        $r->print('<td style="background-color:'.$defbgone.';"'.
                                       ' rowspan='.$totalparms.
                                       '>'.$maptitles{$mapp{$rid}}.'</td>');
 
@@ -2022,9 +2022,9 @@
         } # end of  full
 #--------------------------------------------------- Entry for parm level map
         if ($parmlev eq 'map') {
-            my $defbgone = '"E0E099"';
-            my $defbgtwo = '"FFFF99"';
-            my $defbgthree = '"FFBB99"';
+            my $defbgone = '#E0E099';
+            my $defbgtwo = '#FFFF99';
+            my $defbgthree = '#FFBB99';
 
             my %maplist;
 
@@ -2114,25 +2114,28 @@
                          ."<br /></h4>\n"
                          );
 #---------------------------------------------------------------- print table
-                $r->print('<p><table border="2">');
-                $r->print('<tr><th>'.&mt('Parameter Name').'</th>');
-                $r->print('<th>'.&mt('Default Value').'</th>');
-                $r->print('<th>'.&mt('Parameter in Effect').'</th></tr>');
+                $r->print('<p>'.&Apache::loncommon::start_data_table()
+                         .&Apache::loncommon::start_data_table_header_row()
+                         .'<th>'.&mt('Parameter Name').'</th>'
+                         .'<th>'.&mt('Default Value').'</th>'
+                         .'<th>'.&mt('Parameter in Effect').'</th>'
+                         .&Apache::loncommon::end_data_table_header_row()
+                );
 
 	        foreach (&keysinorder(\%name,\%keyorder)) {
-                    $r->print('<tr>');
+                    $r->print(&Apache::loncommon::start_data_table_row());
                     &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
                            \%type,\%display,$defbgone,$defbgtwo,$defbgthree,
                            $parmlev,$uname,$udom,$csec,$cgroup);
                 }
-                $r->print("</table></div>");
+                $r->print(&Apache::loncommon::end_data_table().'</p>');
             } # end each map
         } # end of $parmlev eq map
 #--------------------------------- Entry for parm level general (Course level)
         if ($parmlev eq 'general') {
-            my $defbgone = '"E0E099"';
-            my $defbgtwo = '"FFFF99"';
-            my $defbgthree = '"FFBB99"';
+            my $defbgone = '#E0E099';
+            my $defbgtwo = '#FFFF99';
+            my $defbgthree = '#FFBB99';
 
 #-------------------------------------------- for each map, gather information
             my $mapid="0.0";
@@ -2176,7 +2179,8 @@
 #---------------------------------------------------- print header information
 	    my $setdef=&mt("Set Defaults for All Resources in Course");
             $r->print(<<ENDMAPONE);
-<center><h4>$setdef
+<center>
+<h4>$setdef
 <font color="red"><i>$coursename</i></font><br />
 ENDMAPONE
             if ($uname) {
@@ -2190,18 +2194,24 @@
             if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$cgroup</i></font>\n")};
             $r->print("</h4>\n");
 #---------------------------------------------------------------- print table
-            $r->print('<p><table border="2">');
-            $r->print('<tr><th>'.&mt('Parameter Name').'</th>');
-            $r->print('<th>'.&mt('Default Value').'</th>');
-            $r->print('<th>'.&mt('Parameter in Effect').'</th></tr>');
+            $r->print('<p>'.&Apache::loncommon::start_data_table()
+                     .&Apache::loncommon::start_data_table_header_row()
+                     .'<th>'.&mt('Parameter Name').'</th>'
+                     .'<th>'.&mt('Default Value').'</th>'
+                     .'<th>'.&mt('Parameter in Effect').'</th>'
+                     .&Apache::loncommon::end_data_table_header_row()
+            );
 
 	    foreach (&keysinorder(\%name,\%keyorder)) {
-                $r->print('<tr>');
+                $r->print(&Apache::loncommon::start_data_table_row());
                 &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
                        \%type,\%display,$defbgone,$defbgtwo,$defbgthree,
                                    $parmlev,$uname,$udom,$csec,$cgroup);
             }
-            $r->print("</table></center>");
+            $r->print(&Apache::loncommon::end_data_table()
+                     .'</p>'
+                     .'</center>'
+            );
         } # end of $parmlev eq general
     }
     $r->print('</form>'.&Apache::loncommon::end_page());
@@ -2671,9 +2681,9 @@
             '.checked=true;"';
 	$output.=&Apache::loncommon::start_data_table_row().
 	    '<td><i>'.&mt('Create New Environment Variable').'</i><br />'.
-	    '<input type="text" size=40 name="newp_name" '.
+	    '<input type="text" size="40" name="newp_name" '.
                 $onchange.' /></td><td>'.
-            '<input type="text" size=40 name="newp_value" '.
+            '<input type="text" size="40" name="newp_value" '.
                 $onchange.' /></td><td>'.
 	    '<input type="checkbox" name="newp_setparmval" /></td>'.
 	    &Apache::loncommon::end_data_table_row()."\n";
@@ -4313,8 +4323,8 @@
         $r->print('</td>'.&Apache::loncommon::end_data_table_row());
     }
     $r->print(&Apache::loncommon::end_data_table().
-	      "\n<input type='submit' name='storerules' value='".
-	      &mt('Save Rules')."' /></form>\n".
+	      "\n".'<input type="submit" name="storerules" value="'.
+	      &mt('Save Rules').'" /></form>'."\n".
 	      &Apache::loncommon::end_page());
     return;
 }

--bisitz1229101565--