From: Rob H. <for...@us...> - 2002-02-13 03:39:39
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv4962 Modified Files: sandweb.cgi Log Message: moved checkout to checkout_menu and checkout_commit Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.160 retrieving revision 1.161 diff -U2 -r1.160 -r1.161 --- sandweb.cgi 11 Feb 2002 08:55:33 -0000 1.160 +++ sandweb.cgi 13 Feb 2002 03:39:36 -0000 1.161 @@ -96,14 +96,14 @@ } # has valid auth cookie - my $repository_selected = CGI::param('repository_selected'); - my $repo_name = CGI::param('repo_name'); - my $repo_server = CGI::param('repo_server'); - my $repo_username = CGI::param('repo_username'); - my $repo_type = CGI::param('repo_type'); - my $repo_connection = CGI::param('repo_connection'); - my $repo_root = CGI::param('repo_root'); - my $new_repository = CGI::param('new_repository'); - my $submit = CGI::param('Submit'); - + my $repository_selected = CGI::param('repository_selected'); + my $repo_name = CGI::param('repo_name'); + my $repo_server = CGI::param('repo_server'); + my $repo_username = CGI::param('repo_username'); + my $repo_type = CGI::param('repo_type'); + my $repo_connection = CGI::param('repo_connection'); + my $repo_root = CGI::param('repo_root'); + my $new_repository = CGI::param('new_repository'); + my $submit = CGI::param('Submit'); + my $vcs_command = CGI::param('vcs_command'); ####################################################### @@ -198,4 +198,10 @@ ); } + elsif ( $action eq 'checkout_menu' ) { + # called checkout menu + checkout_menu( + ck_auth => $ck_auth, + ); + } elsif ( $action eq 'vcs_prefs_menu' ) { # called VCS preferences @@ -936,22 +942,5 @@ sandbox => "$users_dir/$username", ); - if ( $vcs_command eq 'checkout' ) { - my $content = $ui->get_menu( - MENU => 'checkout', - LOCATION => $location, - PROGNAME => $progname, - ); - print CGI::header( -cookie => $ck_auth ); - $ui->print_screen( - TITLE=> 'SandWeb : checkout', - MENU_TITLE => 'SandWeb', - SUBMENU_TITLE => 'checkout', - FOOTER => '', - CONTENT => $content, - ERROR => $error, - ); - exit 0; - } - elsif ( $vcs_command eq 'commit' ) { + if ( $vcs_command eq 'commit' ) { if ($message) { # can't give the leading / to the VCS @@ -1002,4 +991,5 @@ } else { + # this is where the Repository object is used # can't give the leading / to the VCS $location =~ s/\///; @@ -1033,4 +1023,72 @@ } +sub checkout_menu { + my %args = @_; + + my $ck_auth = $args{'ck_auth'}; + unless ($ck_auth) { + &login_menu(); + exit 0; + } + if (! load_config()) { + # no existing user config, forward to prefs menu + preferences_menu( ck_auth => $ck_auth ); + } + + my $vcs_command = $args{'vcs_command'}; + my @filename = (); + my $count = 0; + while ( $args{'filename'}->[$count] ) { + push (@filename, $args{'filename'}->[$count]); + $count++; + } + my $location = $args{'location'}; + my $message = CGI::param('message'); + my $username = $auth->get_userinfo('username'); + my $template_dir = $config->{'paths'}->{'template_dir'}; + my $users_dir = $config->{'paths'}->{'users_dir'}; + my %return; + #XXX - not accessing $user->{'repo'}->{$repo_name}* + my $server = $user->{'repository'}->{'server'}; + my $vcs_username = $user->{'repository'}->{'username'}; + my $repo_type = $user->{'repository'}->{'repo_type'}; + my $connection = $user->{'repository'}->{'connection'}; + my $root = $user->{'repository'}->{'root'}; + my $sandbox = $user->{'paths'}->{'users_dir'}; + my @vcs_output = (); + my @vcs_error = (); + my $vcsroot; + + if ( $repo_type eq 'CVS' ) { + if ( $connection eq 'local' ) { + $vcsroot = "$root"; + } else { + $vcsroot = ":$connection:$vcs_username\@$server:$root"; + } + } + + my $repository = SandWeb::Repository->new( + root => $vcsroot, + repo_type => $repo_type, + sandbox => "$users_dir/$username", + ); + + my $content = $ui->get_menu( + MENU => 'checkout', + LOCATION => $location, + PROGNAME => $progname, + ); + + print CGI::header( -cookie => $ck_auth ); + $ui->print_screen( + TITLE=> 'SandWeb : checkout', + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => 'checkout', + FOOTER => '', + CONTENT => $content, + ERROR => $error, + ); + exit 0; +} ############################################################################### @@ -1352,4 +1410,52 @@ ## + +############################################################################### +# checkout commit +# +# Uses the Repository object to do a checkout of specified module +# +# args: +# ck_auth - the sessions cookie +# module - module name to checkout +############################################################################### + +sub checkout_commit { +# my %args = @_; +# my $ck_auth = $args{'ck_auth'}; +# unless ($ck_auth) { +# &login_menu(); +# exit 0; +# } +# # this is where the Repository object is used +# +# foreach my $file (@filename) { +# %return = $repository->$vcs_command( +# file => "$location/$file", +# ); +# push (@vcs_output, "$return{'output'}\n"); +# push (@vcs_error, "$return{'error'}\n"); +# } +# +# my $content = $ui->get_menu( +# MENU => 'vcs_output', +# LOCATION => $location, +# FILENAME => "@filename", +# PROGNAME => $progname, +# VCS_OUTPUT => "@vcs_output", +# VCS_ERROR => "@vcs_error", +# ); +# print CGI::header( -cookie => $ck_auth ); +# $ui->print_screen( +# TITLE=> "SandWeb : VCS $vcs_command", +# MENU_TITLE => 'SandWeb', +# SUBMENU_TITLE => "VCS $vcs_command", +# FOOTER => '', +# CONTENT => $content, +# ERROR => $error, +# ); +# exit 0; +} + ############################################################################### # preferences commit @@ -1455,4 +1561,6 @@ repository_menu( ck_auth => $ck_auth, repository_selected => $repo_name ); } + + |