--- loncom/interface/lonmenu.pm 2006/05/08 22:30:56 1.179 +++ loncom/interface/lonmenu.pm 2006/06/28 20:56:00 1.187 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.179 2006/05/08 22:30:56 albertel Exp $ +# $Id: lonmenu.pm,v 1.187 2006/06/28 20:56:00 albertel 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 @@ -170,7 +175,7 @@ ENDMAINMENU $lt{'exit'} - + Logo LON-CAPA  @@ -189,14 +194,17 @@ ENDINLINEMENU $navmaps=(<$lt{'nav'} ENDNAV +my $is_group = (&Apache::loncommon::course_type() eq 'Group'); if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { + my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'}; $docs=(<$lt{'docs'} +$text ENDDOCS } if ($showgroups) { + my $text = ($is_group) ? $lt{'teams'} : $lt{'groups'}; $groups =(<$lt{'groups'} +$text ENDGROUPS } if ( @@ -209,14 +217,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 @@ -230,7 +238,7 @@ ENDCRELOAD my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif"); my $remote; if ($env{'user.adv'}) { - $remote = ''.$lt{'launch'}.'' + $remote = ''.$lt{'launch'}.'' } return (< @@ -249,7 +257,7 @@ $groups $remote $lt{'roles'} $lt{'exit'} -LogoLON-CAPA +LogoLON-CAPA $form @@ -277,7 +285,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; @@ -344,7 +352,7 @@ sub innerregister { $newmail = $titletable; } else { if ($noremote) { - $newmail.=''; + $newmail.=''; } } my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');'); @@ -531,7 +539,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; @@ -646,7 +654,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(< @@ -729,9 +737,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(<
@@ -919,12 +927,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 = &Apache::loncommon::course_type(); + if ($type eq 'Group') { + $desc = &convert_menu_function($desc,$type); + } if ($pro eq 'clear') { $output.=&clear($row,$col); } elsif ($pro eq 'any') { @@ -1045,7 +1057,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(); @@ -1183,7 +1195,7 @@ function annotate() { +"" +"" - +"
" + +"<\\/form>" +'$end_page'); annotator.document.close(); } @@ -1199,13 +1211,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(); } @@ -1215,7 +1227,7 @@ ENDUTILITY sub serverform { return(< +
@@ -1226,14 +1238,14 @@ ENDSERVERFORM sub constspaceform { return(< + -
+
-
+ @@ -1253,6 +1265,20 @@ sub get_nav_status { return $navstatus; } +#FIXME this needs to move into mydesktab and the other locations +# the text is generated +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 {