--- loncom/interface/lonmenu.pm 2010/03/11 16:35:12 1.317 +++ loncom/interface/lonmenu.pm 2010/03/22 15:10:10 1.320 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.317 2010/03/11 16:35:12 droeschl Exp $ +# $Id: lonmenu.pm,v 1.320 2010/03/22 15:10:10 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -115,14 +115,7 @@ This gets called in the header section =item innerregister() -This gets called in order to register a URL, both with the Remote -and in the body of the document - -=item loadevents() - -=item unloadevents() - -=item get_menu_name() +This gets called in order to register a URL in the body of the document =item clear() @@ -200,6 +193,11 @@ sub primary_menu { 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'; # @@ -207,12 +205,12 @@ sub primary_menu { && &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 @@ -259,13 +257,9 @@ sub secondary_menu { && $crstype eq 'Community'; next if $$menuitem[4] eq 'mdcCommunity' && $crstype ne 'Community'; - next if $$menuitem[4] =~ /^remotenav/ - && $env{'environment.remotenavmap'} ne 'on'; - next if $$menuitem[4] =~ /noremotenav/ - && $env{'environment.remotenavmap'} eq 'on'; - next if $$menuitem[4] =~ /^(no|)remotenav$/ + next if $$menuitem[4] =~ /^Course$/ && $crstype eq 'Community'; - next if $$menuitem[4] =~ /^(no|)remotenavCommunity$/ + next if $$menuitem[4] =~ /^Community$/ && $crstype ne 'Community'; next if $$menuitem[4] =~ /showgroups$/ && !$canviewgrps @@ -279,15 +273,6 @@ sub secondary_menu { $menu .= $roles_selector ? "
  • $roles_selector
  • " : ''; - } elsif ($env{'environment.remotenavmap'} eq 'on') { - # open link using javascript when remote navmap is activated - my @items = @{$menuitem}; - if ($menuitem->[4] eq 'remotenav') { - $items[0] = "javascript:gonav('$menuitem->[0]');"; - } else { - $items[0] = "javascript:go('$menuitem->[0]');"; - } - $menu .= &prep_menuitem(\@items); } else { $menu .= &prep_menuitem(\@$menuitem); } @@ -330,21 +315,8 @@ sub show_return_link { sub registerurl { - my ($forcereg) = @_; - my $result = ''; if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; } - my $force_title=''; - if ($env{'request.state'} eq 'construct') { - $force_title=&Apache::lonxml::display_title(); - } - return - $result - .'' - .$force_title; + return Apache::lonxml::display_title(); } sub innerregister { @@ -366,14 +338,13 @@ sub innerregister { my $maptitle = &Apache::lonnet::gettitle($mapurl); my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread()); - my $contentstext; - if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Community') { - $contentstext = &mt('Community Contents'); - } else { - $contentstext = &mt('Course Contents'); - } - my @crumbs = ({text => $contentstext, - href => "Javascript:gonav('/adm/navmaps')"}); + +#SD +#course_type only Course and Community? +# + my @crumbs = ({text => Apache::loncommon::course_type() + . ' Contents', + href => "Javascript:gopost('/adm/navmaps','')"}); if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { push(@crumbs, {text => '...', @@ -703,24 +674,6 @@ sub edit_course_upload { return $cfile; } -sub loadevents() { - if ($env{'request.state'} eq 'construct' || - $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; } - return 'LONCAPAreg();'; -} - -sub unloadevents() { - if ($env{'request.state'} eq 'construct' || - $env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; } - return 'LONCAPAstale();'; -} - -sub get_menu_name { - my $hostid = $Apache::lonnet::perlvar{'lonHostID'}; - $hostid =~ s/\W//g; - return 'LCmenu'.$hostid; -} - # ================================================================== Raw Config #SD @@ -747,8 +700,7 @@ sub switch { my $idx=10*$row+$col; $category_members{$cat}.=':'.$idx; -# Inline Remote -#RC $img=~s/\.gif$/\.png/; +# Inline Menu if ($nobreak==2) { return ''; } my $text=$top.' '.$bot; $text=~s/\s*\-\s*//gs; @@ -778,14 +730,9 @@ sub switch { } } else { # Inline Menu -#SD look here - if ($env{'environment.icons'} eq 'iconsonly') { - $inlineremote[$idx]=''.$pic.''; - } else { $inlineremote[$idx]= ''.$pic. ''.$desc.''; - } } return ''; } @@ -1045,25 +992,6 @@ sub check_for_rcrs { return $showreqcrs; } -# ====================================================================== Footer - -sub nav_control_js { - my $nav=($env{'environment.remotenavmap'} eq 'on'); - return (< '(More ...)', @@ -1098,7 +1026,6 @@ sub utilityfunctions { $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl)); my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'}); - my $nav_control=&nav_control_js(); my $dc_popup_cid; if ($env{'user.adv'} && exists($env{'user.role.dc./'. @@ -1133,7 +1060,6 @@ return (<