From: Rob H. <for...@us...> - 2001-11-22 09:35:42
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv31478/bin Modified Files: sandweb.cgi Log Message: added templates for create_file, create_folder and upload for these to work, there need to be 1) methods in File class to carry out these actions and 2) more "if" statements in the file subroutine of sandweb.cgi to catch the create command Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.68 retrieving revision 1.69 diff -U2 -r1.68 -r1.69 --- sandweb.cgi 2001/11/22 08:28:59 1.68 +++ sandweb.cgi 2001/11/22 09:35:38 1.69 @@ -9,4 +9,5 @@ use SandWeb::Repository; use SandWeb::Browse; +use SandWeb::File; # Debugging @@ -283,6 +284,10 @@ } +# file operations such as file/folder creation, viewing and editing +# happen in this subroutine. A file object is created and used. +# sub file { my %args = @_; + my $cookie = $args{'cookie'}; unless ($cookie) { @@ -316,10 +321,11 @@ my $file_type; - if (! -f "$location/$filename" ) { - set_error = "File does not exist!"; - browse_menu(); + if ($filename) { + if (! -f "$location/$filename" ) { + set_error = "File does not exist!"; + browse_menu(); + } } - use SandWeb::File; my $file = SandWeb::File->new( 'filename' => $filename, @@ -378,4 +384,55 @@ MENU_TITLE => 'SandWeb', SUBMENU_TITLE => 'edit file', + FOOTER => '', + CONTENT => $content, + ERROR => $error, + ); + exit 0; + } + elsif ( $command eq 'create_file' ) { + my $content = $ui->create_file( + PROGNAME => $progname, + LOCATION => $location, + ); + + print header( -cookie => $cookie ); + $ui->print_screen( + TITLE=> 'SandWeb : Create File', + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => 'create file', + FOOTER => '', + CONTENT => $content, + ERROR => $error, + ); + exit 0; + } + elsif ( $command eq 'create_folder' ) { + + my $content = $ui->create_folder( + PROGNAME => $progname, + LOCATION => $location, + ); + + print header( -cookie => $cookie ); + $ui->print_screen( + TITLE=> 'SandWeb : Create Folder', + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => 'create folder', + FOOTER => '', + CONTENT => $content, + ERROR => $error, + ); + exit 0; + } + elsif ( $command eq 'upload' ) { + my $content = $ui->upload_file( + LOCATION => $location, + PROGNAME => $progname, + ); + print header( -cookie => $cookie ); + $ui->print_screen( + TITLE=> 'SandWeb : Upload File', + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => 'upload file', FOOTER => '', CONTENT => $content, |