--- loncom/interface/lonmenu.pm 2009/08/23 13:22:16 1.244.2.7 +++ loncom/interface/lonmenu.pm 2010/05/23 19:16:02 1.244.2.15 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.244.2.7 2009/08/23 13:22:16 raeburn Exp $ +# $Id: lonmenu.pm,v 1.244.2.15 2010/05/23 19:16:02 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -120,11 +120,6 @@ The javascript is usually similar to "go =item get_nav_status() -=item convert_menu_function() - -FIXME this needs to move into mydesktab and the other locations -the text is generated - =item hidden_button_check() =item roles_selector() @@ -144,6 +139,7 @@ use Apache::loncommon(); use Apache::lonenc(); use Apache::lonlocal; use LONCAPA qw(:DEFAULT :match); +use HTML::Entities(); use vars qw(@desklines %category_names %category_members %category_positions $readdesk); @@ -167,8 +163,8 @@ sub show_course { } sub initlittle { - return &Apache::lonlocal::texthash('ret' => 'Return to Last Location', - 'nav' => 'Navigate Contents', + my %lt=&Apache::lonlocal::texthash('ret' => 'Return to Last Location', + 'nav' => 'Course Contents', 'main' => 'Main Menu', 'roles' => (&Apache::loncommon::show_course()? 'Courses':'Roles'), @@ -178,8 +174,13 @@ sub initlittle { 'login' => 'Log In', 'launch' => 'Launch Remote Control', 'groups' => 'Groups', - 'gdoc' => 'Group Documents', + 'gdoc' => 'Community Documents', ); + if (&Apache::loncommon::course_type() eq 'Community') { + $lt{'nav'} = &mt('Community Contents'); + $lt{'docs'} = &mt('Edit Community'); + } + return %lt; } sub menubuttons { @@ -246,9 +247,12 @@ ENDNAV $lt{'ret'} ENDRELOAD } - if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { - $docs=(<$lt{'docs'} + my $is_community = + (&Apache::loncommon::course_type() eq 'Community'); + if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { + my $text = ($is_community) ? $lt{'gdoc'} : $lt{'docs'}; + $docs=(<$text ENDDOCS } if ($showgroups) { @@ -313,9 +317,10 @@ ENDINLINEMENU $navmaps=(<$lt{'nav'} ENDNAV - my $is_group = (&Apache::loncommon::course_type() eq 'Group'); + my $is_community = + (&Apache::loncommon::course_type() eq 'Community'); if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { - my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'}; + my $text = ($is_community) ? $lt{'gdoc'} : $lt{'docs'}; $docs=(<$text ENDDOCS @@ -576,10 +581,22 @@ sub innerregister { } # Finally, turn the button on or off if ($cfile && !$const_space) { - $editbutton=&switch - ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]', + my $nocrsedit; + # Suppress display where CC has switched to student role. + if ($env{'request.course.id'}) { + unless(&Apache::lonnet::allowed('mdc', + $env{'request.course.id'})) { + $nocrsedit = 1; + } + } + if ($nocrsedit) { + $editbutton=&clear(6,1); + } else { + $editbutton=&switch + ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]', "go('".$cfile."');","Edit this resource"); - $noeditbutton = 0; + $noeditbutton = 0; + } } elsif ($editbutton eq '') { $editbutton=&clear(6,1); } @@ -655,7 +672,7 @@ $menuitems.="Make notes and annotations } } unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { - if (!$env{'request.enc'}) { + if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) { $menuitems.=(< 1) { $role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles); $role_selector .= '
'."\n". ''."\n". + &HTML::Entities::encode($ENV{'REQUEST_URI'},'"<>&').'" />'."\n". ''."\n". ''."\n". ''."\n".