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

droeschl droeschl@source.lon-capa.org
Tue, 19 May 2009 14:05:19 -0000


This is a MIME encoded message

--droeschl1242741919
Content-Type: text/plain

droeschl		Tue May 19 14:05:19 2009 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
  Log:
  Changes related to modification of LON-CAPA screen header.
  - Added breadcrumbs
  - Removed the LC_nav_location table (breadcrumbs now show the current location within a course and new mail is shown in the top menu)
  - Removed code related to textual interface
  
  
--droeschl1242741919
Content-Type: text/plain
Content-Disposition: attachment; filename="droeschl-20090519140519.txt"

Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.266 loncom/interface/lonmenu.pm:1.267
--- loncom/interface/lonmenu.pm:1.266	Mon May 18 16:29:55 2009
+++ loncom/interface/lonmenu.pm	Tue May 19 14:05:19 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.266 2009/05/18 16:29:55 raeburn Exp $
+# $Id: lonmenu.pm,v 1.267 2009/05/19 14:05:19 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -216,62 +216,20 @@
         }
     }
 
-    if ($env{'browser.interface'} eq 'textual') {
-# Textual display only
-        if ($env{'request.course.id'}) {
-	    $navmaps=(<<ENDNAV);
-<a href="/adm/navmaps?postdata=$escurl&amp;postsymb=$escsymb" target="_top">$lt{'nav'}</a>
-ENDNAV
-            if (&show_return_link()) {
-                my $escreload=&escape('return:');
-                $reloadlink=(<<ENDRELOAD);
-<a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a>
-ENDRELOAD
-            }
-	    if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
-               $docs=(<<ENDDOCS);
-<a href="/adm/coursedocs" target="_top">$lt{'docs'}</a>
-ENDDOCS
-            }
-            if ($showgroups) {
-                $groups =(<<ENDGROUPS);
-<a href="/adm/coursegroups" target="_top">$lt{'groups'}</a>
-ENDGROUPS
-            }
-	}
-        my $form=&serverform();
-        my $utility=&utilityfunctions();
-	my $output=(<<ENDMAINMENU);
-<script type="text/javascript">
-// BEGIN LON-CAPA Internal
-$utility
-</script>
-<div id="LC_top_nav">
-<a href="/adm/menu" target="_top">$lt{'main'}</a>
-$reloadlink $navmaps $docs $groups $roles
-<a href="/adm/logout" target="_top">$lt{'exit'}</a>
-</div>
-<br />
-<script type="text/javascript">
-// END LON-CAPA Internal
-</script>
-$form
-ENDMAINMENU
-        if ($registration) { $output.=&innerregister($forcereg); }
-	return $output."<hr />";
-    } elsif ($env{'environment.remote'} eq 'off') {
+    if ($env{'environment.remote'} eq 'off') {
 # Remote Control is switched off
 # figure out colors
-	my %lt=&initlittle();
+        my %lt=&initlittle();
 
         my $domain=&Apache::loncommon::determinedomain();
-	my $function =&Apache::loncommon::get_users_function();
+        my $function =&Apache::loncommon::get_users_function();
         my $link=&Apache::loncommon::designparm($function.'.link',$domain);
         my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);
         my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);
         my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
-	if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
-	    return (<<ENDINLINEMENU);
+
+        if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
+            return (<<ENDINLINEMENU);
    <table id="LC_top_nav">
     <tr>
       <td>$logo</td>
@@ -418,57 +376,45 @@
 
     $env{'request.registered'} = 1;
 
-    my $textinter=($env{'browser.interface'} eq 'textual');
-    my $noremote=($env{'environment.remote'} eq 'off');
+    my $noremote = ($env{'environment.remote'} eq 'off');
     
-    my $textual=($textinter || $noremote);
-
     undef(@inlineremote);
 
     my $reopen=&Apache::lonmenu::reopenmenu();
 
     my $newmail='';
-    if ($noremote) {
-	$newmail='<table id="LC_nav_location"><tr>';
-    }
-    if (&Apache::lonmsg::newmail()) { 
-	if ($textual) {
-	    $newmail.= '<td class="LC_new_mail">
-                   <a href="/adm/communicate" target="_top">'.
-		   &mt('You have new messages').'</a></td>';
-	} else {
-	    $newmail= 'swmenu.setstatus("you have","messages");';
-	}
+    my $breadcrumb;
+
+    if (&Apache::lonmsg::newmail() && !$noremote) { 
+        # We have new mail and remote is up
+        $newmail= 'swmenu.setstatus("you have","messages");';
     } 
-    if (($textual) 
+    if ($noremote
 	     && ($env{'request.symb'}) 
 	     && ($env{'request.course.id'})) {
-	$newmail.= '<td class="LC_current_location">';
-	my ($mapurl,$rid,$resurl)=
-	    &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
-        my $coursetitle=$env{'course.'.$env{'request.course.id'}.'.description'};
-        $newmail.=$coursetitle;
-        my $maptitle=&Apache::lonnet::gettitle($mapurl);
-	my $restitle=&Apache::lonnet::gettitle(&Apache::lonnet::symbread());
-        if ($maptitle && ($maptitle ne 'default.sequence') && ($maptitle ne $coursetitle)) {
-	    $newmail.=', '.$maptitle;
-        }
-        if ($restitle) {
-	    $newmail.=': '.$restitle;
-        }
-        $newmail.='&nbsp;&nbsp;&nbsp;</td>';
+
+        my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
+        my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
+
+        my $maptitle = &Apache::lonnet::gettitle($mapurl);
+        my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
+        my @crumbs = ({text => mt("Course Content"), href => "Javascript:gonav('/adm/navmaps')"}, 
+                      {text => '...'});
+        push @crumbs, {text => $maptitle} if ($maptitle 
+                                              && $maptitle ne 'default.sequence' 
+                                              && $maptitle ne $coursetitle);
+        push @crumbs, {text => $restitle} if $restitle; 
+        Apache::lonhtmlcommon::clear_breadcrumbs();
+        Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
+        $breadcrumb .= Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
+        #
     }
     if ($env{'request.state'} eq 'construct') {
         $newmail = $titletable;
-    } else {
-	if ($noremote) {
-	    $newmail.='</tr></table>';
-	}
-    }
-    my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');');
-    my $tablestart=($noremote?'<table id="LC_menubuttons">':'').
-	($textinter?'<br /><a href="#content">'.&mt('Skip to Content').'</a><br />':'');
-    my $tableend=($noremote?'</table>':'').($textinter?'<a name="content" />':'');
+    } 
+    my $timesync   = ( $noremote ? '' : 'swmenu.syncclock(1000*'.time.');' );
+    my $tablestart = ( $noremote ? '<table id="LC_menubuttons">' : '');
+    my $tableend   = ( $noremote ? '</table>' : '');
 # =============================================================================
 # ============================ This is for URLs that actually can be registered
     if (($env{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) {
@@ -604,7 +550,7 @@
             if ($currdir =~ m-/$-) {
                 $is_const_dir = 1;
             } else {
-                $currdir =~ s#[^/]+$##;
+                $currdir =~ s|[^/]+$||;
 		my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
 		my $esc_currdir = &Apache::loncommon::escape_single($currdir);
                 $menuitems=(<<ENDMENUITEMS);
@@ -676,16 +622,12 @@
             }
         }
 
-        if ($textual) {
+        if ($noremote) {
 	    my $addremote=0;
-	    foreach (@inlineremote) { if ($_ ne '') { $addremote=1; } }
+	    foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
 	    my $inlinebuttons='';
 	    if ($addremote) {
-# Registered, textual output
-		if ($env{'browser.interface'} eq 'textual') {
-		    $inlinebuttons=
-                        join('',map { (defined($_)?$_:'') } @inlineremote);
-		} else {
+            # Registered, textual output
                     if ($env{'environment.icons'} eq 'iconsonly') {
                         $inlinebuttons=(<<ENDARROWSINLINE);
 <tr><td>
@@ -717,13 +659,13 @@
 			    }
 			}
 		    }
-		}
 	    }
 	    $result =(<<ENDREGTEXT);
 <script type="text/javascript">
 // BEGIN LON-CAPA Internal
 </script>
 $timesync
+$breadcrumb
 $tablestart
 $inlinebuttons
 $tableend
@@ -786,9 +728,9 @@
 # =============================================================================
     } else {
 # ========================================== This can or will not be registered
-        if ($textual) {
+        if ($noremote) {
 # Not registered, textual
-	    $result= (<<ENDDONOTREGTEXT);
+            $result= (<<ENDDONOTREGTEXT);
 ENDDONOTREGTEXT
         } else {
 # Not registered, graphical

--droeschl1242741919--