--- loncom/interface/lonmenu.pm 2005/02/21 00:32:04 1.149 +++ loncom/interface/lonmenu.pm 2023/11/19 21:28:17 1.542 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.149 2005/02/21 00:32:04 www Exp $ +# $Id: lonmenu.pm,v 1.542 2023/11/19 21:28:17 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -26,734 +26,1832 @@ # http://www.lon-capa.org/ # # -# There are two parameters controlling the action of this module: -# -# browser.interface - if this is 'textual', it overrides the second parameter -# and goes to screen reader PDA mode -# -# environment.remote - if this is 'on', the routines controll the remote -# control, otherwise they render the main window controls; ignored it -# browser.interface is 'textual' -# + +=head1 NAME + +Apache::lonmenu + +=head1 SYNOPSIS + +Loads contents of /home/httpd/lonTabs/mydesk.tab, +used to generate inline menu, and Main Menu page. + +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 %primary_sub_menu + +The keys of this hash reference are the names of items in the primary_menu array +which have sub-menus. For each key, the corresponding value is a reference to +an array containing components extracted from lines in mydesk.tab which begin +with primsub:. +This hash, which is used by primary_menu to generate sub-menus, is populated in +the BEGIN block. + +=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 + +=item prep_menuitems(\@menuitem,$target,$listclass,$linkattr) + +This routine wraps a menuitem in proper HTML. It is used by primary_menu() and +secondary_menu(). + +=item primary_menu() + +This routine evaluates @primary_menu and returns a two item array, +with the array elements containing XHTML for the left and right sides of +the menu that contains the 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 create_submenu() + +Creates XHTML for unordered list of sub-menu items which belong to a +particular top-level menu item. Uses hover pseudo class in css to display +dropdown list when mouse hovers over top-level item. Support for IE6 +(no hover psuedo class) via LC_hoverable class for
-$lt{'main'} - | -$reloadlink -$navmaps -- -$lt{'launch'} | --$lt{'roles'} - | --$lt{'exit'} - | -- -LON-CAPA | -$form -
'; + $menu .= '
';
- }
- if (($textual) && ($ENV{'request.symb'}) && ($ENV{'request.course.id'})) {
- my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($ENV{'request.symb'});
- $newmail.=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
- my $maptitle=&Apache::lonnet::gettitle($mapurl);
- my $restitle=&Apache::lonnet::gettitle($resurl);
- if ($maptitle && $maptitle ne 'default.sequence') {
- $newmail.=', '.$maptitle;
+ unless ((($crstype eq 'Placement') && (!$env{'request.role.adv'})) || (@mapcrumbs) ||
+ (!$maptitle) || ($maptitle eq 'default.sequence') ||
+ ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'}) ||
+ ($ltiscope eq 'resource')) {
+ push @crumbs, {text => $maptitle, no_mt => 1,
+ href => &Apache::lonnet::clutter($mapurl).'?navmap=1'};
+ }
+ if ($restitle && !@mapcrumbs) {
+ push(@crumbs,{text => $restitle, no_mt => 1});
+ }
+ my @tools;
+ if ($env{'request.filename'} =~ /\.page$/) {
+ my %breadcrumb_tools = &Apache::lonhtmlcommon::current_breadcrumb_tools();
+ if (ref($breadcrumb_tools{'tools'}) eq 'ARRAY') {
+ @tools = @{$breadcrumb_tools{'tools'}};
+ }
+ }
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
+ if (@tools) {
+ &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',@tools);
+ }
+ } else {
+ $resurl = $env{'request.noversionuri'};
+ my $courseurl = &Apache::lonnet::courseid_to_courseurl($env{'request.course.id'});
+ my $title = &mt('View Resource');
+ if ($resurl =~ m{^\Q/uploaded$courseurl/supplemental/\E(default|\d+)/}) {
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['folderpath','title']);
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ if ($env{'form.title'}) {
+ $title = $env{'form.title'};
+ }
+ my ($trail,$cnum,$cdom);
+ if ($env{'form.folderpath'}) {
+ $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ &Apache::loncommon::validate_folderpath(1,'',$cnum,$cdom);
+ }
+ if ($env{'form.folderpath'}) {
+ &prepare_functions($resurl,$forcereg,$group,undef,undef,1,$hostname);
+ $title = &HTML::Entities::encode($title,'\'"<>&');
+ ($trail) =
+ &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1);
+ } else {
+ &Apache::lonhtmlcommon::add_breadcrumb(
+ {text => "Supplemental $crstype Content",
+ href => "javascript:gopost('/adm/supplemental','')"});
+ $title = &HTML::Entities::encode(&mt('View Resource'),'\'"<>&');
+ ($trail) =
+ &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1);
+ }
+ if (ref($showncrumbsref)) {
+ $$showncrumbsref = 1;
+ }
+ return $trail;
+ } elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) {
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &prepare_functions('/public'.$courseurl."/syllabus",
+ $forcereg,$group,undef,undef,1,$hostname);
+ $title = &HTML::Entities::encode(&mt('Syllabus File'),'\'"<>&');
+ my ($trail) =
+ &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1);
+ if (ref($showncrumbsref)) {
+ $$showncrumbsref = 1;
+ }
+ return $trail;
+ } elsif (($resurl eq '/public'.$courseurl.'/syllabus') &&
+ ($env{'form.folderpath'})) {
+ if ($env{'form.title'}) {
+ $title = $env{'form.title'};
+ } else {
+ $title = 'Syllabus';
+ }
+ &prepare_functions($resurl,$forcereg,$group,undef,undef,1,$hostname);
+ $title = &HTML::Entities::encode($title,'\'"<>&');
+ my ($trail) =
+ &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1,1);
+ return $trail;
+ }
+ unless ($env{'request.state'} eq 'construct') {
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'});
+ }
}
- if ($restitle) {
- $newmail.=': '.$restitle;
+ } elsif (! $const_space){
+ #a situation when we're looking at a resource outside of context of a
+ #course or construction space (e.g. with cumulative rights)
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ unless ($env{'request.noversionuri'} =~ m{^/adm/$match_domain/$match_username/aboutme$}) {
+ &Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'});
}
- $newmail.=' ';
- }
- if (&Apache::lonmsg::newmail()) {
- $newmail=($textual?
- 'You have new messages ': - 'swmenu.setstatus("you have","messages");'); - } - if ($ENV{'request.state'} eq 'construct') { - $newmail = $titletable; } - if ($noremote) { - $newmail.=' |
$link
-ENDREMOTEFORM -} -# ================================================================= Reopen menu - -sub reopenmenu { - if (($ENV{'browser.interface'} eq 'textual') || - ($ENV{'environment.remote'} eq 'off')) { return ''; } - my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; - my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); - return('window.open('.$nothing.',"'.$menuname.'","",false);'); -} - -# =============================================================== Open the menu - -sub open { - my $returnval=''; - if (($ENV{'browser.interface'} eq 'textual') || - ($ENV{'environment.remote'} eq 'off')) { - return ''; - } - my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; - unless (shift eq 'unix') { -# resizing does not work on linux because of virtual desktop sizes - $returnval.=(<';
+ for (my $row=1; $row<=8; $row++) {
+ foreach my $cat (keys(%category_members)) {
+ if ($category_positions{$cat} ne "$col,$row") { next; }
+ #$output.='
'; + if ($type eq 'map') { + $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,question part,question parts] in this folder.',$missing); + } else { + $lt{'miss'} .= &mt('Submissions are missing for [quant,_1,part] in this question.',$missing); + } + if ($missing > 1) { + $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit answers for them.').''; + } else { + $lt{'miss'} .= ' '.&mt('If you confirm you are done you will be unable to submit an answer for it.').' '; + } + } + $donebuttontext = &HTML::Entities::encode($donebuttontext,'<>&"'); + if ($proctor) { + if ($height !~ /^\d+$/) { + $height = 400; + if ($missing) { + $height += 60; + } + } + if ($width !~ /^\d+$/) { + $width = 400; + if ($missing) { + $width += 60; + } + } + return <
+
-sub close {
- if (($ENV{'browser.interface'} eq 'textual') ||
- ($ENV{'environment.remote'} eq 'off')) { return ''; }
- my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
- return(<$lt{'preamble'} $lt{$type} + $lt{'miss'} +$lt{'proctor'} + +$lt{'cancel'} +';
+ }
+ return < $lt{'preamble'} $lt{$type} $lt{'miss'} $lt{'okdone'} $lt{'cancel'} |