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

raeburn raeburn@source.lon-capa.org
Tue, 18 May 2010 20:30:08 -0000


raeburn		Tue May 18 20:30:08 2010 EDT

  Modified files:              (Branch: version_2_10_X)
    /loncom/interface	lonnavmaps.pm 
  Log:
  - Backport 1.446 (part), 1.447.
  
  
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.444 loncom/interface/lonnavmaps.pm:1.444.2.1
--- loncom/interface/lonnavmaps.pm:1.444	Sun Feb 28 22:36:38 2010
+++ loncom/interface/lonnavmaps.pm	Tue May 18 20:30:08 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Navigate Maps Handler
 #
-# $Id: lonnavmaps.pm,v 1.444 2010/02/28 22:36:38 raeburn Exp $
+# $Id: lonnavmaps.pm,v 1.444.2.1 2010/05/18 20:30:08 raeburn Exp $
 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1441,19 +1441,22 @@
     if ($printCloseAll && !$args->{'resource_no_folder_link'}) {
 	my ($link,$text);
         if ($condition) {
-	    $link='"navmaps?condition=0&filter=&'.$queryString.
-		'&here='.&escape($here).'"';
+	    $link='navmaps?condition=0&filter=&'.$queryString.
+		'&here='.&escape($here);
 	    $text='Close all folders';
         } else {
-	    $link='"navmaps?condition=1&filter=&'.$queryString.
-		'&here='.&escape($here).'"';
+	    $link='navmaps?condition=1&filter=&'.$queryString.
+		'&here='.&escape($here);
 	    $text='Open all folders';
         }
+        if ($env{'form.register'}) {
+            $link .= '&register='.$env{'form.register'};
+        }
 	if ($args->{'caller'} eq 'navmapsdisplay') {
 	    &add_linkitem($args->{'linkitems'},'changefolder',
-			  'location.href='.$link,$text);
+                          "location.href='$link'",$text);
 	} else {
-	    $result.='<a href='.$link.'>'.&mt($text).'</a>';
+            $result.= '<a href="'.$link.'">'.&mt($text).'</a>';
 	}
         $result .= "\n";
     }
@@ -1469,6 +1472,9 @@
 	<input type="hidden" name="navurl" value="$ENV{'QUERY_STRING'}" />
 	<input type="hidden" name="navtime" value="$time" />
 END
+        if ($env{'form.register'}) {
+            $result .= '<input type="hidden" name="register" value="'.$env{'form.register'}.'" />';
+        }
         if ($args->{'sort'} eq 'discussion') { 
 	    my $totdisc = 0;
 	    my $haveDisc = '';
@@ -1490,7 +1496,6 @@
 	$result.='</form>';
     }
 
-   
     if ($args->{'caller'} eq 'navmapsdisplay') {
         $result .= '<table><tr><td>'.
                    &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').'</td>';
@@ -1499,7 +1504,7 @@
         } else {
 	    $result .= '</tr><tr>'; 
         }
-	$result.="<td class=\"LC_middle\">".mt('Tools:')."</td>";
+        $result.='<td class="LC_middle">'.&mt('Tools:').'</td>';
 	$result.=&show_linkitems_toolbar($args->{'linkitems'});
         if ($args->{'sort_html'}) {
 	    if ($env{'environment.remotenavmap'} ne 'on') {
@@ -1847,71 +1852,38 @@
     $$linkitems{$name}{'text'}=&mt($text);
 }
 
-sub show_linkitems {
-    my ($linkitems)=@_;
-    my @linkorder = ("blank","launchnav","closenav","firsthomework",
-		     "everything","uncompleted","changefolder","clearbubbles");
-    
-    my $result .= (<<ENDBLOCK);
-              <td align="left">
-<script type="text/javascript">
-    function changeNavDisplay () {
-	var navchoice = document.linkitems.toplink[document.linkitems.toplink.selectedIndex].value;
-ENDBLOCK
-    foreach my $link (@linkorder) {
-	$result.= "if (navchoice == '$link') {".
-	    $linkitems->{$link}{'cmd'}."}\n";
-    }
-    $result.='}
-              </script>
-                   <form name="linkitems" method="post">
-                       <span class="LC_nobreak"><select name="toplink">'."\n";
-    foreach my $link (@linkorder) {
-	if (defined($linkitems->{$link})) {
-	    if ($linkitems->{$link}{'text'} ne '') {
-		$result .= ' <option value="'.$link.'">'.
-		    $linkitems->{$link}{'text'}."</option>\n";
-	    }
-	}
-    }
-    $result .= '</select>&nbsp;<input type="button" name="chgnav"
-                   value="Go" onClick="javascript:changeNavDisplay()" />
-                </span></form></td>'."\n";
-	
-    return $result;
-}
-
 sub show_linkitems_toolbar {
     my ($linkitems,$condition)=@_;
-    my @linkorder = ("blank","launchnav","closenav","firsthomework",
+    my @linkorder = ("launchnav","closenav","firsthomework",
 		     "everything","uncompleted","changefolder","clearbubbles");
-    
-    my $result .=' 
-              <td align="left">
-                       <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'}
-                   }
-                          $result .=  ' <li><a href="#"'.
-			    	' onClick="'.$linkitems->{$link}{'cmd'}.'"'.
-                                ' id="'.$link_id.'"'.
-                                ' class="LC_toolbarItem"'.
-			   	' title="'.$linkitems->{$link}{'text'}.'"></a></li>'."\n";
-		}
-
-	    }
-	}
+    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';
+                        }
+                    }
+                    $result .= '<li><a href="#" '.
+                               'onclick="'.$linkitems->{$link}{'cmd'}.'" '.
+                               'id="'.$link_id.'" '.
+                               'class="LC_toolbarItem" '.
+                               'title="'.$linkitems->{$link}{'text'}.'">'.
+                               '</a></li>'."\n";
+                }
+            }
+        }
     }
-    $result .= '</ul>';
-    $result .= ' </span></td>'."\n";
-	
+    $result .= '</ul>'.
+               '</span></td>'."\n";
     return $result;
 }