--- loncom/interface/lonmenu.pm 2012/12/06 13:38:25 1.395 +++ loncom/interface/lonmenu.pm 2012/12/07 17:15:56 1.398 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.395 2012/12/06 13:38:25 raeburn Exp $ +# $Id: lonmenu.pm,v 1.398 2012/12/07 17:15:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -578,7 +578,7 @@ sub innerregister { my $text = 'Edit Folder'; if (($mapurl =~ /\.page$/) || ($env{'request.symb'}=~ - /^uploaded/$cdom/$cnum/default_\d+\.page$/)) { + m{uploaded/$cdom/$cnum/default_\d+\.page$})) { $text = 'Edit Page'; } &switch('','',7,4,'docs-22x22.png',$text,'parms[_2]', @@ -754,12 +754,24 @@ ENDMENUITEMS sub get_editbutton { my ($cfile,$home,$switchserver,$forceedit,$forceview,$forcereg) = @_; - my $jscall = - &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver, + my $jscall; + if (($forceview) && ($env{'form.todocs'})) { + my ($folderpath,$command); + if ($env{'request.symb'}) { + $folderpath = &Apache::loncommon::symb_to_docspath($env{'request.symb'}); + } elsif ($env{'form.folderpath'} =~ /^supplemental/) { + $folderpath = $env{'form.folderpath'}; + $command = '&forcesupplement=1'; + } + $folderpath = &escape(&HTML::Entities::encode(&escape($folderpath),'<>&"')); + $jscall = "go('/adm/coursedocs?folderpath=$folderpath$command')"; + } else { + $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver, $forceedit,$forcereg,$env{'request.symb'}, &escape($env{'form.folderpath'}), &escape($env{'form.title'}),$env{'form.idx'}, - &escape($env{'form.suppurl'})); + &escape($env{'form.suppurl'},$env{'form.todocs'})); + } if ($jscall) { my $icon = 'pcstr.png'; my $label = 'Edit'; @@ -915,7 +927,9 @@ sub prepare_functions { (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) && (($resurl =~ m{^/adm/wrapper/ext/}) || ($resurl =~ m{^/uploaded/$cdom/$cnum/supplemental/}) || - ($resurl eq '/adm/supplemental'))) { + ($resurl eq '/adm/supplemental') || + ($resurl =~ m{^/public/$cdom/$cnum/syllabus$}) || + ($resurl =~ m{^/adm/$match_domain/$match_username/aboutme$}))) { my @folders=split('&',$env{'form.folderpath'}); if ((@folders > 2) || ($resurl ne '/adm/supplemental')) { my $esc_path=&escape(&HTML::Entities::encode(&escape($env{'form.folderpath'}),'<>&"'));