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

neumanie neumanie@source.lon-capa.org
Thu, 18 Jun 2009 19:43:14 -0000


neumanie		Thu Jun 18 19:43:14 2009 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  Fix multiple display of dirs in the tree view.Add checked attribute to the "All Maps and Foler " radio button. Replace the html table to the loncapa functions data_table.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.461 loncom/interface/lonparmset.pm:1.462
--- loncom/interface/lonparmset.pm:1.461	Wed Jun 17 20:01:57 2009
+++ loncom/interface/lonparmset.pm	Thu Jun 18 19:43:14 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.461 2009/06/17 20:01:57 neumanie Exp $
+# $Id: lonparmset.pm,v 1.462 2009/06/18 19:43:14 neumanie Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1612,19 +1612,23 @@
                     }
                     my $id= $curRes->id();
                     my ($mapid,$resid)=split(/\./,$id);
-                    push(@$tree,$mapid);
-                    $treeinfo->{$mapid} = {
+                    if(!exists($treeinfo->{$mapid})) {
+                        push(@$tree,$mapid);	    
+                        $treeinfo->{$mapid} = {
                                     depth => $depth,
                                     type  => $type,
                                     };
+                    }
                 }
             }
         }
-    }	
+    }
+	
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder')));
     if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) {
         my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />';
-        $r->print('<table><tr><td>'.$icon.'<label>&nbsp;<input type="radio" name="pschp" value="all"/>'.&mt('All Maps or Folders').'</td></tr>');
+        $r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row());
+        $r->print('<td>'.$icon.'<label>&nbsp;<input type="radio" name="pschp" checked="checked" value="all"/>'.&mt('All Maps or Folders').'</td>'.&Apache::loncommon::end_data_table_header_row());
         foreach my $mapid (@{$tree}) {
             my $depth = $treeinfo->{$mapid}->{'depth'};
             my $indent = ('&nbsp;'x$depth);
@@ -1632,13 +1636,13 @@
             if ($treeinfo->{$mapid}->{'type'} eq 'page') {
                 $icon = '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />';
             }
-            $r->print('<tr><td>'.$indent.$icon.'<label>&nbsp;<input type ="radio" name="pschp" value="'.$mapid.'"');
+            $r->print(&Apache::loncommon::start_data_table_header_row().'<td>'.$indent.$icon.'<label>&nbsp;<input type ="radio" name="pschp" value="'.$mapid.'"');
             if ($pschp eq $mapid) {
                 $r->print(' checked="checked"');
             }
-            $r->print('/>'.$$maptitles{$mapid}.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'').'</label></td></tr>');
+            $r->print('/>'.$$maptitles{$mapid}.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'').'</label></td>'.&Apache::loncommon::end_data_table_header_row());
         }
-        $r->print('</table>');
+        $r->print(&Apache::loncommon::end_data_table());
     }
 }