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

raeburn raeburn@source.lon-capa.org
Wed, 17 Mar 2010 19:35:56 -0000


raeburn		Wed Mar 17 19:35:56 2010 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonmenu.pm 
  Log:
  - If no user session, display same menu items as shown to "public" users.
    (appropriate for /adm/resetpw, /adm/createaccount, /adm/coursecatalog).
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.953 loncom/interface/loncommon.pm:1.954
--- loncom/interface/loncommon.pm:1.953	Tue Mar 16 19:55:49 2010
+++ loncom/interface/loncommon.pm	Wed Mar 17 19:35:56 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.953 2010/03/16 19:55:49 droeschl Exp $
+# $Id: loncommon.pm,v 1.954 2010/03/17 19:35:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4559,6 +4559,11 @@
     my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,
         $no_nav_bar,$bgcolor,$no_inline_link,$args)=@_;
 
+    my $public;
+    if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
+        || ($env{'user.name'} eq '') && ($env{'user.domain'} eq '')) {
+        $public = 1;
+    }
     if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); }
 
     $function = &get_users_function() if (!$function);
@@ -4608,7 +4613,7 @@
     } 
 
     my $name = &plainname($env{'user.name'},$env{'user.domain'});
-    if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
+    if ($public) {
 	undef($role);
     } else {
 	$name = &aboutmewrapper($name,$env{'user.name'},$env{'user.domain'});
@@ -4666,7 +4671,7 @@
         $bodytag .= qq|<div id="LC_realm">$realm $dc_info</div>|;
 
         #don't show menus for public users
-        if($env{'user.name'} ne 'public' && $env{'user.domain'} ne 'public'){
+        if (!$public){
             $bodytag .= Apache::lonmenu::secondary_menu();
             $bodytag .= Apache::lonmenu::serverform();
             $bodytag .= Apache::lonhtmlcommon::scripttag('', 'end');
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.318 loncom/interface/lonmenu.pm:1.319
--- loncom/interface/lonmenu.pm:1.318	Tue Mar 16 19:55:49 2010
+++ loncom/interface/lonmenu.pm	Wed Mar 17 19:35:56 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.318 2010/03/16 19:55:49 droeschl Exp $
+# $Id: lonmenu.pm,v 1.319 2010/03/17 19:35:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -194,6 +194,11 @@
     my $menu;
     # each element of @primary contains following array:
     # (link url, icon path, alt text, link text, condition)
+    my $public;
+    if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
+        || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {
+        $public = 1;
+    }
     foreach my $menuitem (@primary_menu) {
         # evaluate conditions 
         next if    ref($menuitem)       ne 'ARRAY';    #
@@ -201,12 +206,12 @@
                 && &Apache::lonmsg::mynewmail();       # whether a new msg 
         next if    $$menuitem[4]        eq 'newmsg'    # arrived or not
                 && !&Apache::lonmsg::mynewmail();      # 
-        next if    $$menuitem[4]        !~ /public/    ##we've a public user, 
-                && $env{'user.name'}    eq 'public'    ##who should not see all 
-                && $env{'user.domain'}  eq 'public';   ##links
+        next if    $$menuitem[4]        !~ /public/    ##we've a public user,
+                && $public;                            ##who should not see all
+                                                       ##links
         next if    $$menuitem[4]        eq 'onlypublic'# hide links which are 
-                && $env{'user.name'}    ne 'public'    # only visible to public
-                && $env{'user.domain'}  ne 'public';   # users
+                && !$public;                           # only visible to public
+                                                       # users
         next if    $$menuitem[4]        eq 'roles'     ##show links depending on
                 && &Apache::loncommon::show_course();  ##term 'Courses' or 
         next if    $$menuitem[4]        eq 'courses'   ##'Roles' wanted