[LON-CAPA-cvs] cvs: loncom /publisher loncfile.pm

banghart lon-capa-cvs@mail.lon-capa.org
Thu, 23 Nov 2006 01:50:58 -0000


banghart		Wed Nov 22 20:50:58 2006 EDT

  Modified files:              
    /loncom/publisher	loncfile.pm 
  Log:
  	Bug 5079. Address Comment 1. Offer link to directory and to
  		newly named file.
  
  
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.78 loncom/publisher/loncfile.pm:1.79
--- loncom/publisher/loncfile.pm:1.78	Wed Nov 22 17:10:58 2006
+++ loncom/publisher/loncfile.pm	Wed Nov 22 20:50:57 2006
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.78 2006/11/22 22:10:58 banghart Exp $
+# $Id: loncfile.pm,v 1.79 2006/11/23 01:50:57 banghart Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1151,8 +1151,10 @@
 	$suffix=$1; #This is the actually filename extension if it exists
 	$main=~s/\.\w+$//; #strip the extension
     }
-    my $dest;                   # On success this is where we'll go.
-    
+    my $dest;                       #
+    my $dest_dir;                   # On success this is where we'll go.
+    my $disp_newname;               #
+    my $dest_newname;               #
     &Debug($r,"loncfile::phase2 dir = $dir main = $main suffix = $suffix");
     &Debug($r,"    newfilename = ".$env{'form.newfilename'});
 
@@ -1180,6 +1182,10 @@
 		return;
 	    }
 	    $dest = $dir."/";
+	    $dest_newname = $env{'form.newfilename'};
+	    $env{'form.newfilename'} =~ /.+(\/.+$)/;
+	    $disp_newname = $1;
+	    $disp_newname =~ s/\///;
 	}
     } elsif ($env{'form.action'} eq 'delete') { 
 	if(!&Delete2($r, $uname, $env{'form.newfilename'})) {
@@ -1210,7 +1216,12 @@
     if ( ($env{'form.action'} eq 'newdir') && ($env{'form.phase'} eq 'two') && ( ($env{'form.callingmode'} eq 'testbank') || ($env{'form.callingmode'} eq 'imsimport') ) ) {
 	$r->print('<h3><a href="javascript:self.close()">'.&mt('Done').'</a></h3>');
     } else {
-	$r->print('<h3><a href="'.&url($dest).'">'.&mt('Done').'</a></h3>');
+        if ($env{'form.action'} eq 'rename') {
+            $r->print('<h3><a href="'.&url($dest).'">'.&mt('Return to Directory').'</a></h3>');
+            $r->print('<h3><a href="'.&url($dest_newname).'">'.$disp_newname.'</a></h3>');
+        } else {
+	    $r->print('<h3><a href="'.&url($dest).'">'.&mt('Done').'</a></h3>');
+	}
     }
 }