From: Nick J. <nje...@us...> - 2002-02-28 06:33:01
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv31025 Modified Files: sandweb.cgi Log Message: * working on Delete, Update, module. *almost* working, but have to leave. checking in. Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.232 retrieving revision 1.233 diff -U2 -r1.232 -r1.233 --- sandweb.cgi 28 Feb 2002 06:14:20 -0000 1.232 +++ sandweb.cgi 28 Feb 2002 06:32:57 -0000 1.233 @@ -1784,16 +1784,22 @@ my $repo_root = $user->get_repo_root(repo => $repo_name); - my @module_list = $user->get_module_list(repo => $repo_name ); - - push @module_list, $module_name; - if ($user->module_exists(repo => $repo_name)) { + # true if commit vcs checkout action (works for update too) + my $do_vcs_action = 0; + + if ($submit eq 'Update') { # update module - $user->update_module( + $do_vcs_action = 1; + if ($user->module_exists(repo => $repo_name, module => $module_name)) { + $user->update_module( repo => $repo_name, module => $module_name, module_description => $module_description, - ); - } else { - # add module + ); + } else { + set_message("module '$module_name' does not exist."); + } + } elsif ($submit eq 'Checkout') { + # checkout module + $do_vcs_action = 1; $user->add_module( repo => $repo_name, @@ -1803,56 +1809,69 @@ } - my $username = $auth->get_username(); - my $template_dir = $config->{'paths'}->{'template_dir'}; - my $users_dir = $config->{'paths'}->{'users_dir'}; + if ($do_vcs_action) { + my $username = $auth->get_username(); + my $template_dir = $config->{'paths'}->{'template_dir'}; + my $users_dir = $config->{'paths'}->{'users_dir'}; + + my $vcsroot; + my @vcs_output = (); + my @vcs_error = (); + if ( $repo_type eq 'CVS' ) { + if ( $repo_connection eq 'local' ) { + $vcsroot = "$repo_root"; + } else { + $vcsroot = + ":$repo_connection:$repo_username\@$repo_server:$repo_root"; + } + } + + my $repository = SandWeb::Repository->new( + root => $vcsroot, + repo_type => $repo_type, + sandbox => "$users_dir/$username", + ); - my $vcsroot; - my @vcs_output = (); - my @vcs_error = (); - if ( $repo_type eq 'CVS' ) { - if ( $repo_connection eq 'local' ) { - $vcsroot = "$repo_root"; + my %return = $repository->checkout( + file => "$module_name", + ); + push (@vcs_output, "$return{'output'}\n"); + push (@vcs_error, "$return{'error'}\n"); + $log->debug('dump', \%return); + my $return = write_config(); + if (! $return) { + # uh oh, problem occured + sandbox( ck_auth => $ck_auth ); + } + my $content = $ui->get_menu( + MENU => 'vcs_output', + LOCATION => $module_name, #$location, + #FILENAME => "@filename", + PROGNAME => $progname, + VCS_OUTPUT => join('', @vcs_output), + VCS_ERROR => join('', @vcs_error), + ); + + print CGI::header( -cookie => $ck_auth ); + $ui->print_screen( + TITLE=> "SandWeb : sandbox", + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => "sandbox", + FOOTER => '', + CONTENT => $content, + ); + exit 0; + } elsif ($submit eq 'Delete') { + if ($user->module_exists(repo => $repo_name, module => $module_name)) { + #$user->delete_module(repo => $repo_name, module => $module_name); + # XXX + # DELETE MODULE DIRECTORY + # XXX - Ask rob how currently we are doing this? } else { - $vcsroot = - ":$repo_connection:$repo_username\@$repo_server:$repo_root"; + set_message("module '$module_name' does not exist."); } + my $return = write_config(); + sandbox_menu( ck_auth => $ck_auth ); + exit(0); } - - my $repository = SandWeb::Repository->new( - root => $vcsroot, - repo_type => $repo_type, - sandbox => "$users_dir/$username", - ); - - my %return = $repository->checkout( - file => "$module_name", - ); - push (@vcs_output, "$return{'output'}\n"); - push (@vcs_error, "$return{'error'}\n"); - - $log->debug('dump', \%return); - my $return = write_config(); - if (! $return) { - # uh oh, problem occured - module_checkout_menu( ck_auth => $ck_auth ); - } - - my $content = $ui->get_menu( - MENU => 'vcs_output', - LOCATION => $module_name, #$location, - #FILENAME => "@filename", - PROGNAME => $progname, - VCS_OUTPUT => join('', @vcs_output), - VCS_ERROR => join('', @vcs_error), - ); - print CGI::header( -cookie => $ck_auth ); - $ui->print_screen( - TITLE=> "SandWeb : module checkout", - MENU_TITLE => 'SandWeb', - SUBMENU_TITLE => "module checkout", - FOOTER => '', - CONTENT => $content, - ); - exit 0; } |