--- loncom/interface/lonmenu.pm 2005/08/16 16:36:08 1.159
+++ loncom/interface/lonmenu.pm 2006/03/16 22:12:17 1.166
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.159 2005/08/16 16:36:08 albertel Exp $
+# $Id: lonmenu.pm,v 1.166 2006/03/16 22:12:17 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -64,7 +64,8 @@ sub initlittle {
'Roles':'Courses'),
'docs' => 'Course Documents',
'exit' => 'Exit',
- 'launch' => 'Launch Remote Control');
+ 'launch' => 'Launch Remote Control',
+ 'groups' => 'Groups');
}
# ============================= This gets called at the top of the body section
@@ -78,10 +79,12 @@ sub menubuttons {
['inhibitmenu']);
if (($env{'form.inhibitmenu'} eq 'yes') ||
($ENV{'REQUEST_URI'} eq '/adm/logout')) { return ''; }
-
+ my %lt=&initlittle();
my $navmaps='';
my $reloadlink='';
my $docs='';
+ my $groups='';
+ my $showgroups=0;
my $escurl=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
my $escsymb=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
my $face= 'face="Arial,Helvetica,sans-serif"';
@@ -92,9 +95,20 @@ sub menubuttons {
$escurl = &Apache::lonnet::escape($returnurl);
}
}
+ if ($env{'request.course.id'}) {
+ my %coursegroups;
+ my $viewgrps_permission =
+ &Apache::lonnet::allowed('vcg',$env{'request.course.id'});
+ if (!$viewgrps_permission) {
+ %coursegroups = &Apache::lonnet::get_active_groups($env{'user.domain'},$env{'user.name'},$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
+ }
+ if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {
+ $showgroups = 1;
+ }
+ }
+
if ($env{'browser.interface'} eq 'textual') {
# Textual display only
- my %lt=&initlittle();
$pgbg='#FFFFFF';
$tabbg='#FFFFFF';
$font='#000000';
@@ -115,6 +129,12 @@ ENDRELOAD
$lt{'docs'}
ENDDOCS
}
+ if ($showgroups) {
+ $groups =(<
+$lt{'groups'}
+ENDGROUPS
+ }
}
my $form=&serverform();
my $utility=&utilityfunctions();
@@ -124,7 +144,7 @@ ENDDOCS
$utility
$lt{'main'}
-$reloadlink $navmaps $docs
+$reloadlink $navmaps $docs $groups
$lt{'roles'}
$lt{'exit'}
@@ -190,9 +210,15 @@ ENDNAV
if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
$docs=(<
-$lt{'docs'}
+$lt{'docs'}
ENDDOCS
}
+ if ($showgroups) {
+ $groups =(<
+$lt{'groups'}
+ENDGROUPS
+ }
if (
($env{'request.noversionuri'}=~m[^/(res|public)/] &&
$env{'request.symb'} eq '')
@@ -210,6 +236,13 @@ ENDDOCS
ENDRELOAD
}
}
+ if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) {
+ my $escreload=&Apache::lonnet::escape('return:');
+ $reloadlink=(<
+$lt{'ret'}
+ENDCRELOAD
+ }
my $reg='';
if ($registration) {
$reg=&innerregister($forcereg,$target,$titletable);
@@ -233,6 +266,7 @@ $utility
$reloadlink
$navmaps
$docs
+$groups
$lt{'launch'} |
@@ -363,7 +397,7 @@ sub innerregister {
my $hwkadd='';
if ($env{'request.symb'} ne '' &&
- $env{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
+ $env{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form|task)$/) {
if (&Apache::lonnet::allowed('mgr',$crs)) {
$hwkadd.=&switch('','',7,2,'pgrd.gif','problem[_1]','grades[_3]',
"gocmd('/adm/grades','gradingmenu')",
@@ -1102,15 +1136,20 @@ function gocstr(url,filename) {
this.document.cstrprint.curseed.value = this.document.lonhomework.rndseed.value
}
if (this.document.lonhomework.problemtype) {
- for (var i=0; isend_http_header;
return OK if $r->header_only;
@@ -1195,7 +1235,6 @@ sub handler {
$env{'browser.interface'} ne 'textual') {
$form=&serverform();
}
- my $bodytag=&Apache::loncommon::bodytag('Main Menu');
my $function='student';
if ($env{'request.role'}=~/^(cc|in|ta|ep)/) {
$function='coordinator';
@@ -1225,40 +1264,32 @@ ENDSCRIPT
$env{'browser.interface'}='faketextual';
$env{'environment.remote'}='off';
}
- my $html=&Apache::lonxml::xmlbegin();
- $r->print(<
-LON-CAPA Main Menu
-$script_tag
-
-$bodytag
-ENDHEADER
+ $r->print(&Apache::loncommon::start_page('Main Menu'));
$r->print(''.$form);
- $r->print('