--- loncom/interface/lonmenu.pm 2012/12/06 21:43:27 1.397 +++ 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.397 2012/12/06 21:43:27 raeburn Exp $ +# $Id: lonmenu.pm,v 1.398 2012/12/07 17:15:56 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -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';