--- loncom/interface/lonmenu.pm 2021/11/19 18:57:34 1.513 +++ loncom/interface/lonmenu.pm 2022/05/06 19:36:09 1.515 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.513 2021/11/19 18:57:34 raeburn Exp $ +# $Id: lonmenu.pm,v 1.515 2022/05/06 19:36:09 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1056,6 +1056,13 @@ sub innerregister { $currdir =~ s|[^/]+$||; my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn); my $esc_currdir = &Apache::loncommon::escape_single($currdir); + my $pubfile = "/res/$udom/$uname/$thisdisfn"; + my $candelete = 1; + if (-e $londocroot.$pubfile) { + unless (&Apache::lonnet::metadata($pubfile,'obsolete')) { + undef($candelete); + } + } # # Probably should be in mydesk.tab # @@ -1063,7 +1070,18 @@ sub innerregister { s&6&1&list.png&Directory&dir[_1]&golist('$esc_currdir')&List current directory s&6&2&rtrv.png&Retrieve&version[_1]&gocstr('/adm/retrieve','/priv/$udom/$uname/$cleandisfn')&Retrieve old version s&6&3&pub.png&Publish&resource[_3]&gocstr('/adm/publish','/priv/$udom/$uname/$cleandisfn')&Publish this resource +s&7&3©.png&Copy&resource[_4]&gocstr('/adm/cfile?action=copy','/priv/$udom/$uname/$cleandisfn')&Copy this resource +ENDMENUITEMS +# +# Rename and Delete only available if obsolete or unpublished +# + if ($candelete) { + $menuitems .= (< +
+ + + +
ENDCONSTSPACEFORM }