--- loncom/publisher/loncfile.pm 2003/12/29 19:01:27 1.49
+++ loncom/publisher/loncfile.pm 2004/01/05 16:48:50 1.50
@@ -9,7 +9,7 @@
# and displays a page showing the results of the action.
#
#
-# $Id: loncfile.pm,v 1.49 2003/12/29 19:01:27 www Exp $
+# $Id: loncfile.pm,v 1.50 2004/01/05 16:48:50 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -173,6 +173,28 @@ sub display {
return ''.$fn.'';
}
+
+# see if the file is
+# a) published (return 0 if not)
+# b) if, so obsolete (return 0 if not)
+
+sub obsolete_unpub {
+ my ($user,$domain,$construct)=@_;
+ my $published=$construct;
+ $published=~
+ s/^\/home\/$user\/public\_html\//\/home\/httpd\/html\/res\/$domain\/$user\//;
+ if (-e $published) {
+ if (&Apache::lonnet::metadata($published,'obsolete')) {
+ return 1;
+ }
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+
+
=pod
=item exists($user, $domain, $file)
@@ -414,6 +436,11 @@ sub Rename1 {
$request->print('
'.&mt('Cancel').'');
return;
}
+ unless (&obsolete_unpub($user,$domain,$fn)) {
+ $request->print('
'.&mt('Rename').' '.&display($fn). @@ -459,6 +486,11 @@ sub Delete1 { if( -e $fn) { $request->print(''); + unless (&obsolete_unpub($user,$domain,$fn)) { + $request->print('
'.&mt('Delete').' '.&display($fn).'?
'); &CloseForm1($request, $fn); } else {