Update of /cvsroot/sandweb/sandweb/bin
In directory usw-pr-cvs1:/tmp/cvs-serv31980/bin
Modified Files:
sandweb.cgi
Log Message:
implemented multi-file "file operations" for the only subroutine
which actually needs it at this point : remove
Tested, works.
I could forsee download using it to tar/zip/jar/whatever a bunch
of files and sending them to you. that'd be sweet. maybe we could
have a preference setting.
Index: sandweb.cgi
===================================================================
RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v
retrieving revision 1.97
retrieving revision 1.98
diff -U2 -r1.97 -r1.98
--- sandweb.cgi 2001/12/18 09:07:38 1.97
+++ sandweb.cgi 2001/12/18 09:47:14 1.98
@@ -133,8 +133,10 @@
elsif ( param('action') eq 'file' ) {
# called file manipulator
+ my @filename = ();
+ @filename = param('filename'),
file(
cookie => $cookie,
file_command => param('file_command'),
- filename => param('filename'),
+ filename => \@filename,
location => param('location'),
);
@@ -142,5 +144,5 @@
elsif ( param('action') eq 'vcsaction' ) {
# called VCS action
- my @filename;
+ my @filename = ();
if ( param('filename') ) {
@filename = param('filename'),
@@ -351,5 +353,11 @@
my $file_command = $args{'file_command'};
my $location = $args{'location'};
- my $filename = param('filename');
+ my @filename = ();
+ my $count = 0;
+ while ( $args{'filename'}->[$count] ) {
+ push (@filename, $args{'filename'}->[$count]);
+ $count++;
+ }
+ my $filename = "@filename";
my $save = param('save');
my $username = $auth->get_userinfo('username');
@@ -364,4 +372,35 @@
my $vcsroot;
+ if ( $file_command eq 'remove' ) {
+ unless (@filename) {
+ set_error("Please select file(s) or folder(s) to remove.");
+ browse_menu(
+ cookie => $cookie,
+ path => $location,
+ );
+ }
+
+ foreach my $entry (@filename) {
+
+ my $file = SandWeb::File->new(
+ 'filename' => $entry,
+ 'location' => "$users_dir/$username$location",
+ );
+
+ if ($file) {
+ if ( $file->get_file_type() eq 'Directory' ) {
+ $file->remove_folder();
+ } else {
+ $file->remove_file();
+ }
+ }
+ }
+
+ browse_menu(
+ cookie => $cookie,
+ path => $location,
+ );
+ }
+
if ( $repo_type eq 'CVS' ) {
if ( $connection eq 'local' ) {
@@ -544,25 +583,4 @@
);
exit 0;
- }
- elsif ( $file_command eq 'remove' ) {
- if ($file) {
- if ( $file->get_file_type() eq 'Directory' ) {
- $file->remove_folder();
- } else {
- $file->remove_file();
- }
-
- browse_menu(
- cookie => $cookie,
- path => $location,
- );
- exit 0;
- }
- set_error("Please select file(s) or folder(s) to remove.");
- browse_menu(
- cookie => $cookie,
- path => $location,
- );
-
}
elsif ( $file_command eq 'upload' ) {
|