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

bisitz bisitz@source.lon-capa.org
Wed, 16 Jun 2010 14:26:18 -0000


bisitz		Wed Jun 16 14:26:18 2010 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Bug 6267:
  - Corrected pre-selection of "All Maps and Folders" introduced in rev. 1.462:
    Only check if no other selection exists (first call).
  - Don't check folders without symb_name.
  Missing symb_name still to solve, but do the best if it exists.
  
  - Added comments to better differentiate the special folder rows
  - Additonal white space between folder icon and radio button not needed -> removed
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.496 loncom/interface/lonparmset.pm:1.497
--- loncom/interface/lonparmset.pm:1.496	Sun Jun  6 02:40:30 2010
+++ loncom/interface/lonparmset.pm	Wed Jun 16 14:26:18 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.496 2010/06/06 02:40:30 raeburn Exp $
+# $Id: lonparmset.pm,v 1.497 2010/06/16 14:26:18 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1736,27 +1736,34 @@
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',' id="mapmenu"'));
     if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) {
         my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />';
-        $r->print(&Apache::loncommon::start_data_table()
-                 .&Apache::loncommon::start_data_table_row()
+        my $whitespace =
+            '<img src="'
+           .&Apache::loncommon::lonhttpdurl('/adm/lonIcons/whitespace_21.gif')
+           .'" alt="" />';
+
+        $r->print(&Apache::loncommon::start_data_table());
+
+        # Display row: "All Maps and Folders"
+        $r->print(&Apache::loncommon::start_data_table_row()
                  .'<td>'.$icon
-                 .'<label>&nbsp;'
-                 .'<input type="radio" name="pschp" checked="checked" value="all" />'
+                 .'<label>'
+                 .'<input type="radio" name="pschp"'
+        );
+        $r->print(' checked="checked"') if ($pschp eq 'all' || !$pschp);
+        $r->print( ' value="all" />'
                  .&mt('All Maps or Folders')
                  .'</label></td>'
                  .&Apache::loncommon::end_data_table_row()
         );
-        my $whitespace = '<img src="'
-                        .&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif")
-                        .'" alt="" />';
+
+        # Display row: "Main Course Documents"
         if (exists($$allmaps{1})) {
             $r->print(&Apache::loncommon::start_data_table_row()
                 .'<td>'.$icon
-                .'<label>&nbsp;'
+                .'<label>'
                 .'<input type="radio" name="pschp" value="1"'
             );
-            if ($pschp eq 1) {
-                $r->print(' checked="checked"');
-            }
+            $r->print(' checked="checked"') if ($pschp eq '1');
             $r->print('/>'
                 .$$maptitles{1}
                 .($$allmaps{1} !~/^uploaded/?' ['.$$allmaps{1}.']':'')
@@ -1765,6 +1772,8 @@
                 .&Apache::loncommon::end_data_table_row()
             );
         }
+
+        # Display rows for all course maps and folders
         foreach my $id (@{$tree}) {
             my ($mapid,$resid)=split(/\./,$id);
             # Indentation
@@ -1782,11 +1791,13 @@
             $symb_name = $tail;
             $r->print(&Apache::loncommon::start_data_table_row()
                      .'<td>'.$indent.$icon
-                     .'<label>&nbsp;'
+                     .'<label>'
                      .'<input type ="radio" name="pschp" value="'.$allmaps_inverted{$symb_name}.'"'
             );
-            if ($pschp eq $allmaps_inverted{$symb_name}) {
-                $r->print(' checked="checked"');
+            if ($allmaps_inverted{$symb_name} && $pschp) {
+                if ($allmaps_inverted{$symb_name} eq $pschp) {
+                    $r->print(' checked="checked"');
+                }
             }
             $r->print('/>'
                      .$treeinfo->{$id}->{name}
@@ -1796,6 +1807,7 @@
                      .&Apache::loncommon::end_data_table_row()
             );
         }
+
         $r->print(&Apache::loncommon::end_data_table());
     }
 }