--- loncom/interface/lonmenu.pm 2010/12/02 13:07:08 1.309.2.20
+++ loncom/interface/lonmenu.pm 2009/12/16 14:21:59 1.310
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.309.2.20 2010/12/02 13:07:08 raeburn Exp $
+# $Id: lonmenu.pm,v 1.310 2009/12/16 14:21:59 wenzelju Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -131,7 +131,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,15 +163,8 @@ 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;
- 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'; #
@@ -181,22 +173,11 @@ sub primary_menu {
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
- ##links
+ && $env{'user.name'} eq 'public' ##who should not see all
+ && $env{'user.domain'} eq 'public'; ##links
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; #
+ && $env{'user.name'} ne 'public' # only visible to public
+ && $env{'user.domain'} ne '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
@@ -204,18 +185,7 @@ sub primary_menu {
if ($$menuitem[3] eq 'Help') { # special treatment for helplink
- if ($public) {
- my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
- my $defdom = &Apache::lonnet::default_login_domain();
- my $to = &Apache::loncommon::build_recipient_list(undef,
- 'helpdeskmail',
- $defdom,$origmail);
- if ($to ne '') {
- $menu .= &prep_menuitem($menuitem);
- }
- } else {
- $menu .= '
'.&Apache::loncommon::top_nav_help('Help').'';
- }
+ $menu .= ''.&Apache::loncommon::top_nav_help('Help').'';
} else {
my @items = @{$menuitem};
$items[0] = 'javascript:'.$menuitem->[0].';';
@@ -240,16 +210,10 @@ sub secondary_menu {
$env{'user.domain'}, $env{'user.name'},
$env{'course.' . $env{'request.course.id'} . '.domain'},
$env{'course.' . $env{'request.course.id'} . '.num'});
- my $custommenu = &Apache::loncommon::needs_gci_custom();
- my $numdc = &Apache::loncommon::check_for_gci_dc();
- my $role = $env{'request.role'};
foreach my $menuitem (@secondary_menu) {
# evaluate conditions
next if ref($menuitem) ne 'ARRAY';
- next if $$menuitem[4] eq 'showmenu'
- && ($custommenu || (!$numdc && $role eq 'cm'));
- next if $$menuitem[4] ne 'showmenu'
- && $$menuitem[4] ne 'author'
+ next if $$menuitem[4] ne 'always'
&& !$env{'request.course.id'};
next if $$menuitem[4] eq 'showreturn'
&& !$showlink
@@ -271,9 +235,8 @@ sub secondary_menu {
next if $$menuitem[4] =~ /showgroups$/
&& !$canviewgrps
&& !%groups;
- next if $$menuitem[4] eq 'showroles'
- && ($custommenu || !$numdc || ($numdc && $env{'request.noversionuri'} eq '/adm/roles'));
- if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'} && !$custommenu) {
+
+ if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
# special treatment for role selector
my $roles_selector = &roles_selector(
$env{'course.' . $env{'request.course.id'} . '.domain'},
@@ -317,51 +280,6 @@ sub secondary_menu {
return "";
}
-sub gci_secondary_menu {
- my %courses = (
- 'review' => 'gci_9615072b469884921gcil1',
- 'submit' => 'gci_1H96711d710194bfegcil1',
- 'tutorial' => 'gci_5422913620b814c90gcil1',
- );
- my %linktext = (
- 'review' => 'Review Questions',
- 'submit' => 'Submit Questions',
- 'managetest' => 'Manage Tests',
- 'tutorial' => 'Tutorials',
- );
- my %links = (
- 'managetest' => '/adm/menu',
- );
- my $current = 'managetest';
- if ($env{'form.destinationurl'} eq '/adm/gci_info') {
- undef($current);
- }
- foreach my $key (keys(%courses)) {
- $links{$key} = "javascript:switchpage('$key');";
- if ($env{'request.course.id'} eq $courses{$key}) {
- if ($env{'environment.remotenavmap'} eq 'on') {
- $links{$key} = "javascript:gonav('/adm/navmaps')";
- } else {
- $links{$key} = '/adm/navmaps';
- }
- $current = $key;
- $links{'managetest'} = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2fmenu';
- }
- }
- my @menutabs = ('review','submit','managetest','tutorial');
- my $tabs;
- foreach my $item (@menutabs) {
- if ($item eq $current) {
- $tabs .= ''.
- $linktext{$item}.'';
- } else {
- $tabs .= ''.
- $linktext{$item}.'';
- }
- }
- return '
';
-}
#
# This routine returns a translated hash for the menu items in the top inline menu row
@@ -555,11 +473,6 @@ ENDINLINEMENU
}
sub show_return_link {
- return unless ($env{'request.course.id'});
- if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})
- || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
- return if ($env{'form.register'});
- }
return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
$env{'request.symb'} eq '')
||
@@ -568,7 +481,7 @@ sub show_return_link {
(($env{'request.noversionuri'}=~/^\/adm\//) &&
($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
($env{'request.noversionuri'}!~
- m[^/adm/.*/(smppg|bulletinboard)($|\?)])
+ m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
));
}
@@ -641,17 +554,9 @@ sub innerregister {
} else {
$contentstext = &mt('Course Contents');
}
- my @crumbs;
- unless (($forcereg) && ($env{'request.noversionuri'} eq '/adm/navmaps')
- && ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
- my $link = "javascript:gopost('/adm/navmaps','')";
- if ($env{'environment.remotenavmap'} eq 'on') {
- $link = "javascript:gonav('/adm/navmaps','')"
- }
- @crumbs = ({text => Apache::loncommon::course_type()
- . ' Contents',
- href => $link});
- }
+ my @crumbs = ({text => $contentstext,
+ href => "Javascript:gonav('/adm/navmaps')"});
+
if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {
push(@crumbs, {text => '...',
no_mt => 1});
@@ -895,7 +800,7 @@ $menuitems.="Make notes and annotations
"&go('/adm/requestcourse')&Course requests\n";
}
}
- unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|portfolio)(\?|$)/) {
+ unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) {
$menuitems.=(< 0) {
- $switcher = &Apache::loncommon::gcitest_switcher($role,$formname,%courses);
- my $current;
- my $cid = $env{'request.course.id'};
- if ($cid) {
- $current = $role.'./'.$env{'course.'.$cid.'.domain'}.
- '/'.$env{'course.'.$cid.'.num'};
- }
- $switcher_js = &Apache::loncommon::gcitest_switcher_js($current,$numcourses,$formname);
- if ($switcher_js) {
- $switcher_js= <<"ENDSCRIPT";
-
-
-ENDSCRIPT
+# calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control
+ &rawconfig(1);
+ my $output='';
+ for (my $col=1; $col<=2; $col++) {
+ $output.='';
+ for (my $row=1; $row<=8; $row++) {
+ foreach my $cat (keys(%category_members)) {
+ if ($category_positions{$cat} ne "$col,$row") { next; }
+ #$output.=' ';
+ $output.='';
+ $output.=' '.&mt($category_names{$cat}).'';
+ $output.=' ';
+ my %active=();
+ foreach my $menu_item (split(/\:/,$category_members{$cat})) {
+ if ($inlineremote[$menu_item]) {
+ $active{$menu_item}=1;
+ }
+ }
+ foreach my $item (sort(keys(%active))) {
+ $output.=$inlineremote[$item];
+ }
+ $output.=' ';
+ $output.=' ';
}
- $switcher = $switcher_js.$switcher;
- }
- if ($env{'user.domain'} eq 'gci') {
- $canreq =
- &Apache::lonnet::check_can_request('gcitest',\%can_request,\%request_domains);
- $createtext = &mt('Create Concept Test');
- if ($numcourses) {
- $createtext = &mt('Create New Test');
- }
- }
- if ($env{'request.course.id'}) {
- if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
- my $navlink;
- if ($env{'environment.remotenavmap'} eq 'on') {
- $navlink = "javascript:gonav('/adm/navmaps')";
- } else {
- $navlink = '/adm/navmaps';
- }
- $output .=
- '
';
- } 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 .=
- ' ';
- }
- } elsif ($switcher || $canreq) {
- $output .= '
'.
- ' ';
- }
- } elsif ($context eq 'gcinorole') {
- my $queued = &Apache::loncoursequeueadmin::queued_selfenrollment('notitle');
- if ($queued) {
- $output .=
- ''.
- ' '.&mt('Pending Enrollment Requests').''.
- $queued.
- '';
- }
- } else {
- # calling rawconfig with "1" will evaluate mydesk.tab,
- # even if there is no active remote control
- &rawconfig(1);
- $output='';
- for (my $col=1; $col<=2; $col++) {
- $output.='';
- for (my $row=1; $row<=8; $row++) {
- foreach my $cat (keys(%category_members)) {
- if ($category_positions{$cat} ne "$col,$row") { next; }
- $output.='';
- $output.=' '.&mt($category_names{$cat}).'';
- $output.=' ';
- my %active=();
- foreach my $menu_item (split(/\:/,$category_members{$cat})) {
- if ($inlineremote[$menu_item]) {
- $active{$menu_item}=1;
- }
- }
- foreach my $item (sort(keys(%active))) {
- $output.=$inlineremote[$item];
- }
- $output.=' ';
- $output.=' ';
- }
- }
- $output.=" | ";
- }
- $output.=" ";
+ }
+ $output.="";
}
+ $output.=" ";
return $output;
}
@@ -1881,54 +1659,11 @@ END
}
sub utilityfunctions {
- my ($caller,$custommenu) = @_;
+ my $caller = shift;
unless ($env{'environment.remote'} eq 'off' ||
$caller eq '/adm/menu') {
return ''; }
-
- my $gcimenujs;
- if ($custommenu) {
- my %concepttests = &Apache::loncommon::existing_gcitest_courses('cc');
- my $managetesturl = '/adm/menu';
- my $createtesturl = '/adm/requestcourse';
- if (($env{'request.course.id'}) &&
- ($env{'course.'.$env{'request.course.id'}.'.domain'} eq 'gci')) {
- my @items = keys(%concepttests);
- if (@items== 1) {
- my $newrole = $items[0];
- $newrole =~ s{_}{/};
- $managetesturl = '/adm/roles?selectrole=1&cc./'.$newrole.'=1';
- } else {
- $managetesturl = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2fmenu';
- }
- }
- if ($env{'request.course.id'}) {
- $createtesturl = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2frequestcourse';
- }
- $gcimenujs = <<"ENDCUSTOM";
-
-function switchpage(caller) {
- if (caller == 'review') {
- document.location.href = '/adm/roles?selectrole=1&st./gci/9615072b469884921gcil1=1';
- }
- if (caller == 'submit') {
- document.location.href = '/adm/roles?selectrole=1&st./gci/1H96711d710194bfegcil1=1';
- }
- if (caller == 'createtest') {
- document.location.href = '$createtesturl';
- }
- if (caller == 'managetest') {
- document.location.href = '$managetesturl';
- }
- if (caller == 'tutorial') {
- document.location.href = '/adm/roles?selectrole=1&st./gci/5422913620b814c90gcil1=1';
- }
- return;
-}
-
-ENDCUSTOM
- }
-
+
my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
if ($currenturl =~ m{^/adm/wrapper/ext/}) {
if ($env{'request.external.querystring'}) {
@@ -1976,8 +1711,6 @@ return (< |