--- loncom/interface/lonmenu.pm 2010/11/30 05:51:55 1.309.2.19 +++ loncom/interface/lonmenu.pm 2010/12/30 21:36:50 1.315.2.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.309.2.19 2010/11/30 05:51:55 raeburn Exp $ +# $Id: lonmenu.pm,v 1.315.2.6 2010/12/30 21:36:50 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,17 +42,72 @@ Coordinates the response to clicking an This is part of the LearningOnline Network with CAPA project described at http://www.lon-capa.org. +=head1 GLOBAL VARIABLES + +=over + +=item @desklines + +Each element of this array contains a line of mydesk.tab that doesn't start with +cat, prim or scnd. +It gets filled in the BEGIN block of this module. + +=item %category_names + +The keys of this hash are the abbreviations used in mydesk.tab in those lines that +start with cat, the values are strings representing titles. +It gets filled in the BEGIN block of this module. + +=item %category_members + +TODO + +=item %category_positions + +The keys of this hash are the abbreviations used in mydesk.tab in those lines that +start with cat, its values are position vectors (column, row). +It gets filled in the BEGIN block of this module. + +=item $readdesk + +Indicates that mydesk.tab has been read. +It is set to 'done' in the BEGIN block of this module. + +=item @primary_menu + +The elements of this array reference arrays that are made up of the components +of those lines of mydesk.tab that start with prim. +It is used by primary_menu() to generate the corresponding menu. +It gets filled in the BEGIN block of this module. + +=item @secondary_menu + +The elements of this array reference arrays that are made up of the components +of those lines of mydesk.tab that start with scnd. +It is used by secondary_menu() to generate the corresponding menu. +It gets filled in the BEGIN block of this module. + +=back + =head1 SUBROUTINES =over -Little texts +=item prep_menuitems(\@menuitem) -=item initlittle() +This routine wraps a menuitem in proper HTML. It is used by primary_menu() and +secondary_menu(). -=item menubuttons() +=item primary_menu() -This gets called at the top of the body section +This routine evaluates @primary_menu and returns XHTML for the menu +that contains following links: About, Message, Roles, Help, Logout +@primary_menu is filled within the BEGIN block of this module with +entries from mydesk.tab + +=item secondary_menu() + +Same as primary_menu() but operates on @secondary_menu. =item show_return_link() @@ -131,7 +186,6 @@ use Apache::lonhtmlcommon(); use Apache::loncommon(); use Apache::lonenc(); use Apache::lonlocal; -use Apache::loncoursequeueadmin; use LONCAPA qw(:DEFAULT :match); use HTML::Entities(); @@ -164,8 +218,6 @@ sub prep_menuitem { # entries from mydesk.tab sub primary_menu { my $menu; - my $custommenu = &Apache::loncommon::needs_gci_custom(); - my $numdc = &Apache::loncommon::check_for_gci_dc(); # each element of @primary contains following array: # (link url, icon path, alt text, link text, condition) my $public; @@ -180,31 +232,31 @@ 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, - && $public; ##who should not see all + 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 + next if $$menuitem[4] eq 'onlypublic'# hide links which are && !$public; # only visible to public # users - next if $$menuitem[4] eq 'gci' - && (!$custommenu || $env{'request.role'} =~ m{^st\./gcitest/}); - next if $$menuitem[4] eq 'home' - && (($custommenu) || ($env{'user.domain'} eq 'gcitest') || - (($env{'user.domain'} eq 'gci') && !$numdc)); - next if $$menuitem[4] eq 'gcitest' - && (($env{'user.domain'} eq 'gci') || ($env{'request.role'} eq 'cm')); - next if $$menuitem[4] eq 'roles' # hide links which are - && $custommenu; # not visible when GCI - next if $$menuitem[4] eq 'courses' # tabbed interface in use - && $custommenu; # next if $$menuitem[4] eq 'roles' ##show links depending on - && &Apache::loncommon::show_course(); ##term 'Courses' or + && &Apache::loncommon::show_course(); ##term 'Courses' or next if $$menuitem[4] eq 'courses' ##'Roles' wanted && !&Apache::loncommon::show_course(); ## - - + + if ($$menuitem[3] eq 'Help') { # special treatment for helplink - $menu .= '
';
+ for (my $row=1; $row<=8; $row++) {
+ foreach my $cat (keys(%category_members)) {
+ if ($category_positions{$cat} ne "$col,$row") { next; }
+ #$output.='
'.
- ' '.&mt('Management').''. - ''.
- ' '.
- '
'; - } else { - my $navtext = &mt('Table of Contents'); - my $navdesc = &mt('Display Table of Contents for Geoscience Concept Inventory'); - if ($env{'request.role.domain'} eq 'gcitest') { - $navtext = &mt('Display Test Contents'); - $navdesc = &mt('Display the table of contents for this Concept Test'); - } - my $navlink; - if ($env{'environment.remotenavmap'} eq 'on') { - $navlink = "javascript:gonav('/adm/navmaps');" - } else { - $navlink = '/adm/navmaps'; - } - $output .= - ' '.
- ' '.&mt('Utilities').''. - ''.
- ' ';
- if ($canreq) {
- $output .= '
'.
- ' ';
- }
- $output .= '
'; - } - } elsif ($switcher || $canreq) { - $output .= ' '. - ' '.
- ' '.&mt('Utilities').''. - ''.
- ' ';
- if ($switcher) {
- $output .= '
'.
- ' ';
- }
- $output .= '
'; - } - } elsif ($context eq 'gcinorole') { - my $queued = &Apache::loncoursequeueadmin::queued_selfenrollment('notitle'); - if ($queued) { - $output .= - ' '.
- ' ';
- }
- } else {
- # calling rawconfig with "1" will evaluate mydesk.tab,
- # even if there is no active remote control
- &rawconfig(1);
- $output=''.&mt('Pending Enrollment Requests').''. - $queued. - '
|