--- loncom/interface/lonmenu.pm 2006/05/08 19:32:09 1.178 +++ loncom/interface/lonmenu.pm 2006/05/30 20:09:25 1.184 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.178 2006/05/08 19:32:09 albertel Exp $ +# $Id: lonmenu.pm,v 1.184 2006/05/30 20:09:25 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,6 +44,8 @@ use Apache::lonhtmlcommon(); use Apache::loncommon(); use Apache::lonenc(); use Apache::lonlocal; +use lib '/home/httpd/lib/perl/'; +use LONCAPA; use vars qw(@desklines $readdesk); @@ -61,7 +63,10 @@ sub initlittle { 'docs' => 'Course Documents', 'exit' => 'Exit', 'launch' => 'Launch Remote Control', - 'groups' => 'Groups'); + 'groups' => 'Course Groups', + 'gdoc' => 'Group Documents', + 'teams' => 'Teams', + ); } # ============================= This gets called at the top of the body section @@ -83,14 +88,14 @@ sub menubuttons { 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 $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'})); + my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'})); if ($env{'request.state'} eq 'construct') { if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) { my $returnurl = $env{'request.filename'}; $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:; - $escurl = &Apache::lonnet::escape($returnurl); + $escurl = &escape($returnurl); } } if ($env{'request.course.id'}) { @@ -109,12 +114,12 @@ sub menubuttons { # Textual display only if ($env{'request.course.id'}) { $navmaps=(<$lt{'nav'} +$lt{'nav'} ENDNAV if (($env{'request.noversionuri'}=~/^\/adm\//) && ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) && ($env{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) { - my $escreload=&Apache::lonnet::escape('return:'); + my $escreload=&escape('return:'); $reloadlink=(<$lt{'ret'} ENDRELOAD @@ -190,13 +195,23 @@ ENDINLINEMENU $lt{'nav'} ENDNAV if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { + my $text = $lt{'docs'}; + if ($env{'course.'.$env{'request.course.id'}.'.type'} eq + 'Group') { + $text = $lt{'gdoc'}; + } $docs=(<$lt{'docs'} +$text ENDDOCS } if ($showgroups) { + my $text = $lt{'groups'}; + if ($env{'course.'.$env{'request.course.id'}.'.type'} eq + 'Group') { + $text = $lt{'teams'}; + } $groups =(<$lt{'groups'} +$text ENDGROUPS } if ( @@ -209,14 +224,14 @@ ENDGROUPS m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)]) ) ) { - my $escreload=&Apache::lonnet::escape('return:'); + my $escreload=&escape('return:'); $reloadlink=(<$lt{'ret'} ENDRELOAD } } if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) { - my $escreload=&Apache::lonnet::escape('return:'); + my $escreload=&escape('return:'); $reloadlink=(<$lt{'ret'} ENDCRELOAD @@ -228,7 +243,10 @@ ENDCRELOAD my $form=&serverform(); my $utility=&utilityfunctions(); my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif"); - + my $remote; + if ($env{'user.adv'}) { + $remote = ''.$lt{'launch'}.'' + } return (< // BEGIN LON-CAPA Internal @@ -243,10 +261,10 @@ $reloadlink $navmaps $docs $groups -$lt{'launch'} +$remote $lt{'roles'} $lt{'exit'} -LogoLON-CAPA +LogoLON-CAPA $form @@ -274,7 +292,7 @@ sub registerurl { ($env{'environment.remote'} eq 'off') || ((($env{'request.publicaccess'}) || (!&Apache::lonnet::is_on_map( - &Apache::lonnet::unescape($env{'request.noversionuri'})))) && + &unescape($env{'request.noversionuri'})))) && (!$forcereg))) { return $result. ''.$force_title; @@ -341,7 +359,7 @@ sub innerregister { $newmail = $titletable; } else { if ($noremote) { - $newmail.=''; + $newmail.=''; } } my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');'); @@ -528,7 +546,7 @@ ENDREGTEXT # Registered, graphical output } else { my $requri=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0])); - $requri=&Apache::lonenc::check_encrypt(&Apache::lonnet::unescape($requri)); + $requri=&Apache::lonenc::check_encrypt(&unescape($requri)); my $cursymb=&Apache::lonenc::check_encrypt($env{'request.symb'}); my $navstatus=&get_nav_status(); my $clearcstr; @@ -643,7 +661,7 @@ sub startupremote { # The Remote actually gets launched! # my $configmenu=&rawconfig(); - my $esclowerurl=&Apache::lonnet::escape($lowerurl); + my $esclowerurl=&escape($lowerurl); my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited'); return(< @@ -726,9 +744,9 @@ sub load_remote_msg { if (($env{'browser.interface'} eq 'textual') || ($env{'environment.remote'} eq 'off')) { return ''; } - my $esclowerurl=&Apache::lonnet::escape($lowerurl); + my $esclowerurl=&escape($lowerurl); my $link=&mt('Continue on in Inline Menu mode', - "/adm/remote?action=collapse?url=$esclowerurl"); + "/adm/remote?action=collapse&url=$esclowerurl"); return(<
@@ -916,12 +934,16 @@ sub rawconfig { my $con=($env{'request.state'} eq 'construct'); my $rol=$env{'request.role'}; my $requested_domain = $env{'request.role.domain'}; - foreach (@desklines) { - my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$_); + foreach my $line (@desklines) { + my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$line); $prt=~s/\$uname/$uname/g; $prt=~s/\$udom/$udom/g; $prt=~s/\$crs/$crs/g; $prt=~s/\$requested_domain/$requested_domain/g; + my $type = $env{'course.'.$env{'request.course.id'}.'.type'}; + if ($type eq 'Group') { + $desc = &convert_menu_function($desc,$type); + } if ($pro eq 'clear') { $output.=&clear($row,$col); } elsif ($pro eq 'any') { @@ -1042,7 +1064,7 @@ sub utilityfunctions { unless (($env{'browser.interface'} eq 'textual') || ($env{'environment.remote'} eq 'off') || ($caller eq '/adm/menu')) { return ''; } my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0])); - $currenturl=&Apache::lonenc::check_encrypt(&Apache::lonnet::unescape($currenturl)); + $currenturl=&Apache::lonenc::check_encrypt(&unescape($currenturl)); my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'}); my $nav_control=&nav_control_js(); @@ -1180,7 +1202,7 @@ function annotate() { +"" +"" - +"
" + +"<\\/form>" +'$end_page'); annotator.document.close(); } @@ -1196,13 +1218,13 @@ function set_bookmark() { +"
\\n " - +"
Link Name:
" - +"
Address:

" + +"bgcolor='ffffff' align=center>Link Name:
" + +"
Address:

<\\/center><\\/td>" + +"<\\/tr><\\/table><\\/form><\\/center>" +'$end_page' ); bmquery.document.close(); } @@ -1212,7 +1234,7 @@ ENDUTILITY sub serverform { return(< +
@@ -1223,14 +1245,14 @@ ENDSERVERFORM sub constspaceform { return(< + -
+
-
+ @@ -1250,6 +1272,18 @@ sub get_nav_status { return $navstatus; } +sub convert_menu_function { + my ($rolename,$type) = @_; + if ($type eq 'Group') { + $rolename =~ s/student/member/g; + $rolename =~ s/group/team/g; + $rolename =~ s/course/group/g; + $rolename =~ s/Course/Group/g; + } + return $rolename; +} + + # ================================================================ Main Program BEGIN {