--- loncom/interface/lonmenu.pm 2012/12/06 14:37:35 1.396 +++ loncom/interface/lonmenu.pm 2012/12/26 23:50:26 1.400 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.396 2012/12/06 14:37:35 raeburn Exp $ +# $Id: lonmenu.pm,v 1.400 2012/12/26 23:50:26 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); } # @@ -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'}),'<>&"')); @@ -2009,13 +2022,13 @@ BEGIN { $category_names{$entries[2]}=$entries[3]; } elsif ($configline=~/^prim\:/) { my @entries = (split(/\:/, $configline))[1..5]; - push @primary_menu, \@entries; + push(@primary_menu,\@entries); } elsif ($configline=~/^primsub\:/) { my ($parent,@entries) = (split(/\:/, $configline))[1..4]; - push (@{$primary_submenu{$parent}},\@entries); + push(@{$primary_submenu{$parent}},\@entries); } elsif ($configline=~/^scnd\:/) { my @entries = (split(/\:/, $configline))[1..5]; - push @secondary_menu, \@entries; + push(@secondary_menu,\@entries); } elsif ($configline) { push(@desklines,$configline); }