--- loncom/interface/lonmenu.pm 2009/12/07 20:04:18 1.309.2.1 +++ loncom/interface/lonmenu.pm 2010/09/03 19:20:47 1.309.2.15 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.309.2.1 2009/12/07 20:04:18 raeburn Exp $ +# $Id: lonmenu.pm,v 1.309.2.15 2010/09/03 19:20:47 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -131,6 +131,7 @@ use Apache::lonhtmlcommon(); use Apache::loncommon(); use Apache::lonenc(); use Apache::lonlocal; +use Apache::loncoursequeueadmin; use LONCAPA qw(:DEFAULT :match); use HTML::Entities(); @@ -286,36 +287,30 @@ sub gci_secondary_menu { my %courses = ( 'review' => 'gci_9615072b469884921gcil1', 'submit' => 'gci_1H96711d710194bfegcil1', + 'tutorial' => 'gci_5422913620b814c90gcil1', ); my %linktext = ( 'review' => 'Review Questions', 'submit' => 'Submit Questions', - 'createtest' => 'Create a Test', + 'managetest' => 'Manage Tests', + 'tutorial' => 'Tutorials', ); - my (%links,$current); + 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}) { $links{$key} = '/adm/navmaps'; $current = $key; + $links{'managetest'} = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2fmenu'; } } - $links{'createtest'} = "javascript:switchpage('createtest');"; - if (($ENV{'REQUEST_URI'} eq '/adm/requestcourse') || - ($env{'form.orgurl'} eq '/adm/requestcourse')) { - $current = 'createtest'; - } - my @menutabs = ('review','submit','createtest'); - if ($env{'user.adv'}) { - my $key = 'managetest'; - push(@menutabs,$key); - $linktext{$key} = 'Manage Tests'; - $links{$key} = "javascript:switchpage('$key');"; - if (($current eq '') && (($ENV{'REQUEST_URI'} eq '/adm/menu') || - ($env{'form.orgurl'} eq '/adm/menu'))) { - $current = $key; - } - } + my @menutabs = ('review','submit','managetest','tutorial'); my $tabs; foreach my $item (@menutabs) { if ($item eq $current) { @@ -1388,30 +1383,63 @@ sub inlinemenu { undef(@inlineremote); undef(%category_members); my $output; - if ($context eq 'gcicustom') { - $output.='
'. - '
'. - ''.&mt('Utilities').''. - ''; + if (($context eq 'gcicustom') || ($context eq 'gcistudent') || + ($context eq 'gcinorole')) { + $output='
'. + ''. +''; + if ($env{'request.course.id'}) { + if (($context eq 'gcicustom') && (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { + $output.= '
'. + '
'. + '

'.&mt('Utilities').'

'. + ''; + if ($context eq 'gcicustom') { + my $createtext = &mt('Create Concept Test'); + if ($switcher) { + $createtext = &mt('Create New Test'); + } + $output .= ''; + } if ($switcher) { - $output .= ''; + $output .= ''; } - $output .= '
choose role'.$createtext.'
choose role'.$switcher.'
choose role'.$switcher.'
communication'.&mt('Send and display messages').'
'; - if (($env{'request.course.id'}) && - (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { - $output.= '
'. - '
'. - ''.&mt('Test Management').''. - ''. - ''."\n". - '
user privs'.&mt('Manage Enrollment').'
what is new'.&mt("What's New?").'
'; + $output .= '
communication'.&mt('Send/Display Messages').'
user preferences'.&mt('Set my user preferences').'
'. + ''. + '
'. + '

'.&mt('Test Management').'

'. + ''."\n". + ''."\n". + ''."\n". + ''. + ''. + '
course contentsConcept Test Contents
assemble testAssemble Concept Test
user privs'.&mt('Enrollment and Student Activity').'
what is new'.&mt("What's New?").'
print concept test'.&mt("Prepare Printable Concept Test").'
Test Statistics'.&mt("Concept Test Statistics").'
'; + } else { + my $navtext = &mt('Table of Contents'); + if ($env{'request.role.domain'} eq 'gcitest') { + $navtext = &mt('Display Test Contents'); + } + $output .= 'course contents'.$navtext.''; + } + } else { + $output.=''; } - $output.='
'. + '
'. + '

'.&mt('Pending Enrollment Requests').'

'. + $queued. + '
'; + } + } + $output.=''; + } else { # calling rawconfig with "1" will evaluate mydesk.tab, # even if there is no active remote control &rawconfig(1); - my $output=''; + $output='
'; for (my $col=1; $col<=2; $col++) { $output.='
'; for (my $row=1; $row<=8; $row++) { @@ -1431,6 +1459,7 @@ sub inlinemenu { } $output.='
'; $output.=''; + } } $output.=""; } @@ -1737,7 +1766,7 @@ sub utilityfunctions { my $gcimenujs; if ($custommenu) { - my %concepttests = &Apache::loncommon::existing_gcitest_courses(); + my %concepttests = &Apache::loncommon::existing_gcitest_courses('cc'); my $managetesturl = '/adm/menu'; my $createtesturl = '/adm/requestcourse'; if (($env{'request.course.id'}) && @@ -1769,6 +1798,10 @@ function switchpage(caller) { if (caller == 'managetest') { document.location.href = '$managetesturl'; } + if (caller == 'tutorial') { + document.location.href = '/adm/roles?selectrole=1&st./gci/5422913620b814c90gcil1=1'; + } + return; } @@ -2014,7 +2047,9 @@ sub hidden_button_check { return; } if ($env{'request.role.adv'}) { - return; + unless (&Apache::loncommon::needs_gci_custom()) { + return; + } } my $buttonshide = &Apache::lonnet::EXT('resource.0.buttonshide'); return $buttonshide;