From: Rob H. <for...@us...> - 2002-02-13 04:24:20
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv13260 Modified Files: sandweb.cgi Log Message: bad merge, reverting to nick's changes Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.163 retrieving revision 1.164 diff -U2 -r1.163 -r1.164 --- sandweb.cgi 13 Feb 2002 04:14:55 -0000 1.163 +++ sandweb.cgi 13 Feb 2002 04:24:18 -0000 1.164 @@ -1,2 +1,4 @@ +? .sandweb.cgi.swp +? sandweb.cgi.mine #!/usr/bin/perl -w # Sandweb CGI @@ -106,5 +108,4 @@ my $submit = CGI::param('Submit'); my $vcs_command = CGI::param('vcs_command'); - my @file_list = CGI::param('file_list'); ####################################################### @@ -130,5 +131,5 @@ } elsif ( $action eq 'preferences_menu' ) { - if (! $submit ) { + if (! CGI::param('Submit')) { # call preferences menu preferences_menu( ck_auth => $ck_auth ); @@ -165,16 +166,4 @@ ); } - 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 @@ -890,6 +879,20 @@ } - -sub checkout_menu { +############################################################################### +# 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 { my %args = @_; @@ -941,24 +944,86 @@ 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 => '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; + 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; } -sub commit_menu { +sub checkout_menu { my %args = @_; my $ck_auth = $args{'ck_auth'}; @@ -971,22 +1036,5 @@ 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'}}; @@ -994,11 +1042,11 @@ MENU => 'checkout', PROGNAME => $progname, - FILENAME => "@file_list", ); + print CGI::header( -cookie => $ck_auth ); $ui->print_screen( - TITLE=> 'SandWeb : commit file(s)', + TITLE=> 'SandWeb : checkout', MENU_TITLE => 'SandWeb', - SUBMENU_TITLE => 'commit file(s)', + SUBMENU_TITLE => 'checkout', FOOTER => '', CONTENT => $content, @@ -1006,5 +1054,5 @@ ); exit 0; -} +} ############################################################################### @@ -1326,100 +1374,4 @@ ## -############################################################################### -# 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, - ); -} ############################################################################### @@ -1497,70 +1449,4 @@ # 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; -} - ############################################################################### |