From: Rob H. <for...@us...> - 2002-02-13 04:14:59
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv11500 Modified Files: sandweb.cgi Log Message: merging vcsaction split changes Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.162 retrieving revision 1.163 diff -U2 -r1.162 -r1.163 --- sandweb.cgi 13 Feb 2002 04:08:43 -0000 1.162 +++ sandweb.cgi 13 Feb 2002 04:14:55 -0000 1.163 @@ -106,4 +106,5 @@ my $submit = CGI::param('Submit'); my $vcs_command = CGI::param('vcs_command'); + my @file_list = CGI::param('file_list'); ####################################################### @@ -129,5 +130,5 @@ } elsif ( $action eq 'preferences_menu' ) { - if (! CGI::param('Submit')) { + if (! $submit ) { # call preferences menu preferences_menu( ck_auth => $ck_auth ); @@ -164,4 +165,16 @@ ); } + elsif ( $action eq 'browse_vcs_commit' ) { + # called vcs commit from browse + my $location = CGI::param('location'); + unless ($location) { + $location = ""; + } + browse_vcs_commit( + ck_auth => $ck_auth, + location => $location, + vcs_command => $vcs_command, + ); + } elsif ( $action eq 'file' ) { # called file manipulator @@ -877,20 +890,6 @@ } -############################################################################### -# vcsaction -# -# all VCS actions are caught by this subroutine, and dealt -# with by calling the appropriate Repository method. -# -# A Repository object is created and used. -# -# args: -# ck_auth - the sessions cookie -# vcs_command - name of the Repository object method to be invoked -# filename - name of the file(s) that the vcs_command should -# be used with. NOTE: this is an array -# location - system path to the file(s) specified by filename -############################################################################### -sub vcsaction { + +sub checkout_menu { my %args = @_; @@ -942,86 +941,24 @@ sandbox => "$users_dir/$username", ); - if ( $vcs_command eq 'commit' ) { - if ($message) { - # can't give the leading / to the VCS - $location =~ s/\///; - foreach my $file (@filename) { - %return = $repository->commit( - file => "$location/$file", - message => "$message", - ); - push (@vcs_output, "$return{'output'}\n"); - push (@vcs_error, "$return{'error'}\n"); - } - my $content = $ui->get_menu( - MENU => 'vcs_output', - LOCATION => $location, - 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; - } - my $content = $ui->get_menu( - MENU => 'commit', - LOCATION => $location, - PROGNAME => $progname, - FILENAME => "@filename", - ); - print CGI::header( -cookie => $ck_auth ); - $ui->print_screen( - TITLE=> 'SandWeb : commit file(s)', - MENU_TITLE => 'SandWeb', - SUBMENU_TITLE => 'commit file(s)', - FOOTER => '', - CONTENT => $content, - ERROR => $error, - ); - exit 0; - } - else { - # this is where the Repository object is used - # can't give the leading / to the VCS - $location =~ s/\///; - - 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; + 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; } -sub checkout_menu { +sub commit_menu { my %args = @_; my $ck_auth = $args{'ck_auth'}; @@ -1034,5 +971,22 @@ preferences_menu( ck_auth => $ck_auth ); } - + + my @file_list = $args{'file_list'}; + 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; + 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; + my @repos = sort keys %{$user->{'repo'}}; @@ -1040,11 +994,11 @@ MENU => 'checkout', PROGNAME => $progname, + FILENAME => "@file_list", ); - print CGI::header( -cookie => $ck_auth ); $ui->print_screen( - TITLE=> 'SandWeb : checkout', + TITLE=> 'SandWeb : commit file(s)', MENU_TITLE => 'SandWeb', - SUBMENU_TITLE => 'checkout', + SUBMENU_TITLE => 'commit file(s)', FOOTER => '', CONTENT => $content, @@ -1052,5 +1006,5 @@ ); exit 0; -} +} ############################################################################### @@ -1372,4 +1326,100 @@ ## +############################################################################### +# browse_vcs_commit +# +# VCS actions from browse_menu are caught by this subroutine, and dealt +# with by calling the appropriate Repository method. +# +# A Repository object is created and used. +# +# args: +# ck_auth - the sessions cookie +# vcs_command - name of the Repository object method to be invoked +# filename - name of the file(s) that the vcs_command should +# be used with. NOTE: this is an array +# location - system path to the file(s) specified by filename +############################################################################### + +sub browse_vcs_commit { + 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 @file_list = $args{'file_list'}; + 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; + 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", + ); + + # this is where the Repository object is used + # can't give the leading / to the VCS + $location =~ s/\///; + + foreach my $file (@file_list) { + %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 => "@file_list", + 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, + ); +} ############################################################################### @@ -1447,4 +1497,70 @@ # exit 0; } + +sub commit_commit { + 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 @file_list = $args{'file_list'}; + 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; + 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; + + my $repository = SandWeb::Repository->new( + root => $vcsroot, + repo_type => $repo_type, + sandbox => "$users_dir/$username", + ); + + # can't give the leading / to the VCS + $location =~ s/\///; + foreach my $file (@file_list) { + %return = $repository->commit( + file => "$location/$file", + message => "$message", + ); + push (@vcs_output, "$return{'output'}\n"); + push (@vcs_error, "$return{'error'}\n"); + } + + my $content = $ui->get_menu( + MENU => 'vcs_output', + LOCATION => $location, + PROGNAME => $progname, + VCS_OUTPUT => "@vcs_output", + VCS_ERROR => "@vcs_error", + ); + print CGI::header( -cookie => $ck_auth ); + $ui->print_screen( + TITLE=> "SandWeb : VCS commit", + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => "VCS commit", + FOOTER => '', + CONTENT => $content, + ERROR => $error, + ); + exit 0; +} + ############################################################################### |