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

raeburn raeburn at source.lon-capa.org
Sun Dec 25 14:39:08 EST 2011


raeburn		Sun Dec 25 19:39:08 2011 EDT

  Modified files:              
    /loncom/interface	lonnavmaps.pm 
  Log:
  - Tags for table used to construct "Tools:" menu moved to 
    &show_linkitems_toolbar() routine.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.475 loncom/interface/lonnavmaps.pm:1.476
--- loncom/interface/lonnavmaps.pm:1.475	Wed Dec 21 20:21:49 2011
+++ loncom/interface/lonnavmaps.pm	Sun Dec 25 19:39:08 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.475 2011/12/21 20:21:49 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.476 2011/12/25 19:39:08 raeburn Exp $
 
 #
 # Copyright Michigan State University Board of Trustees
@@ -464,7 +464,7 @@
 
 =item add_linkitem()
 
-=item show_linkitems()
+=item show_linkitems_toolbar()
 
 =back
 
@@ -1516,16 +1516,7 @@
     }
 
     if ($args->{'caller'} eq 'navmapsdisplay') {
-        $result .= '<table><tr><td>'.
-                   &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').'</td>';
-	    $result .= '<td> </td>'; 
-	$result.='<td class="LC_middle">'.&mt('Tools:').'</td>';
-	$result.=&show_linkitems_toolbar($args->{'linkitems'});
-        if ($args->{'sort_html'}) {
-            $result.='<td> </td><td> </td><td> </td>'.
-                '<td align="right">'.$args->{'sort_html'}.'</td></tr>';
-        }
-        $result .= '</table>';
+        $result .= &show_linkitems_toolbar($args,$condition);
     } elsif ($args->{'sort_html'}) { 
         $result.=$args->{'sort_html'}; 
     }
@@ -1863,37 +1854,52 @@
 }
 
 sub show_linkitems_toolbar {
-    my ($linkitems,$condition)=@_;
-    my @linkorder = ('firsthomework','everything','uncompleted',
-                     'changefolder','clearbubbles','edittoplevel');
-    my $result .='<td align="left">'."\n". 
-                 '<span class="LC_nobreak">'."\n".
-                 '<ul id="LC_toolbar">';
-    foreach my $link (@linkorder) {
-        my $link_id = 'LC_content_toolbar_'.$link;
-        if (defined($linkitems->{$link})) {
-            if ($linkitems->{$link}{'text'} ne '') {
-                $linkitems->{$link}{'cmd'}=~s/"/'/g;
-                if ($linkitems->{$link}{'cmd'}) {
-                    if ($link eq 'changefolder') {
-                        if ($condition) {
-                            $link_id='LC_content_toolbar_changefolder_toggled';
-                        } else {
-                            $link_id='LC_content_toolbar_changefolder';
+    my ($args,$condition) = @_;
+    my $result = 
+        '<table><tr><td>'.
+        &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').
+        '</td>'.
+        '<td> </td>'.
+        '<td class="LC_middle">'.&mt('Tools:').'</td>';
+    if (ref($args) eq 'HASH') {
+        if (ref($args->{'linkitems'}) eq 'HASH') {
+            my @linkorder = ('firsthomework','everything','uncompleted',
+                             'changefolder','clearbubbles','edittoplevel');
+            $result .='<td align="left">'."\n". 
+                      '<span class="LC_nobreak">'."\n".
+                      '<ul id="LC_toolbar">';
+            foreach my $link (@linkorder) {
+                my $link_id = 'LC_content_toolbar_'.$link;
+                if (ref($args->{'linkitems'}{$link}) eq 'HASH') {
+                    if ($args->{'linkitems'}{$link}{'text'} ne '') {
+                        $args->{'linkitems'}{$link}{'cmd'}=~s/"/'/g;
+                        if ($args->{'linkitems'}{$link}{'cmd'}) {
+                            if ($link eq 'changefolder') {
+                                if ($condition) {
+                                    $link_id='LC_content_toolbar_changefolder_toggled';
+                                } else {
+                                    $link_id='LC_content_toolbar_changefolder';
+                                }
+                            }
+                            $result .= '<li><a href="#" '.
+                                       'onclick="'.$args->{'linkitems'}{$link}{'cmd'}.'" '.
+                                       'id="'.$link_id.'" '.
+                                       'class="LC_toolbarItem" '.
+                                       'title="'.$args->{'linkitems'}{$link}{'text'}.'">'.
+                                       '</a></li>'."\n";
                         }
                     }
-                    $result .= '<li><a href="#" '.
-                               'onclick="'.$linkitems->{$link}{'cmd'}.'" '.
-                               'id="'.$link_id.'" '.
-                               'class="LC_toolbarItem" '.
-                               'title="'.$linkitems->{$link}{'text'}.'">'.
-                               '</a></li>'."\n";
                 }
             }
+            $result .= '</ul>'.
+                       '</span></td>'."\n";
+        }
+        if ($args->{'sort_html'}) {
+            $result .= '<td> </td><td> </td><td> </td>'.
+                       '<td align="right">'.$args->{'sort_html'}.'</td>';
         }
     }
-    $result .= '</ul>'.
-               '</span></td>'."\n";
+    $result .= '</tr></table>';
     return $result;
 }
 




More information about the LON-CAPA-cvs mailing list