--- loncom/interface/lonmenu.pm 2012/12/06 13:38:25 1.395 +++ loncom/interface/lonmenu.pm 2012/12/22 14:57:20 1.399 @@ -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.399 2012/12/22 14:57:20 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -487,8 +487,7 @@ sub innerregister { } my $trail; if ($env{'form.folderpath'}) { - my $editbutton = - &prepare_functions($resurl,$forcereg,$group,undef,undef,1); + &prepare_functions($resurl,$forcereg,$group,undef,undef,1); ($trail) = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); } else { @@ -525,7 +524,7 @@ sub innerregister { $editbutton = &prepare_functions($resurl,$forcereg,$group); } if ($editbutton eq '') { - &clear(6,1); + $editbutton = &clear(6,1); } # @@ -578,7 +577,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 +753,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'; @@ -848,7 +859,7 @@ sub prepare_functions { $forceedit,$forceview,$forcereg, $env{'form.title'},$env{'form.suppurl'}); } - } elsif ($resurl !~ m{^adm/($match_domain)/($match_username)/aboutme$}) { + } elsif ($resurl !~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) { if ($env{'request.filename'}) { my $file=&Apache::lonnet::declutter($env{'request.filename'}); ($cfile,$home,$switchserver,$forceedit,$forceview) = @@ -915,7 +926,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'}),'<>&"'));