From: Rob H. <for...@us...> - 2002-11-05 08:37:11
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv4327/bin Modified Files: sandweb.cgi Log Message: partially implemented password confirmation for vcs, this actually is easier than do some kind of master password scheme ( at least the same amount of work ). Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.325 retrieving revision 1.326 diff -U2 -r1.325 -r1.326 --- sandweb.cgi 17 Oct 2002 06:31:36 -0000 1.325 +++ sandweb.cgi 5 Nov 2002 08:37:05 -0000 1.326 @@ -302,12 +302,24 @@ } - vcs_commit( - ck_auth => $ck_auth, - vcs_command => $vcs_command, - module_name => $module_name, - repo_name => $repo_name, - filename => \@filename, - location => $location, - ); + if ($submit) { + vcs_commit( + ck_auth => $ck_auth, + vcs_command => $vcs_command, + module_name => $module_name, + repo_name => $repo_name, + filename => \@filename, + location => $location, + main_window_url => $main_window_url, + ); + } else { + vcs_menu( + ck_auth => $ck_auth, + vcs_command => $vcs_command, + module_name => $module_name, + repo_name => $repo_name, + filename => \@filename, + location => $location, + ); + } exit; } @@ -1680,4 +1692,112 @@ ############################################################################### +# vcs menu +# +# asks user for VCS password +# +# 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 +# repo_name - name of the current repository. +# module_name - name of the current module. +# message - message to the VCS system. +############################################################################### + +sub vcs_menu { + my %args = @_; + + my $ck_auth = $args{'ck_auth'}; + my $location = $args{'location'}; + my $module_name = $args{'module_name'}; + my $repo_name = $args{'repo_name'}; + my $vcs_command = $args{'vcs_command'}; + my $vcs_message = $args{'message'}; + my $main_window_url = "$ENV{'HTTP_REFERER'}"; + my @filename_loop = (); + my $count = 0; + + my $confirm_password = 1; +# $config->{'repo'}->{"$repo_name"}->{'module'}->{"$module_name"}->{'confirm_password'}; + + while ( $args{'filename'}->[$count] ) { + # build loop to pass filenames through template + # + my %entry; + $entry{'FILENAME'} = $args{'filename'}->[$count]; + push (@filename_loop, \%entry); + $count++; + } + + my @filename = (); + $count = 0; + + while ( $args{'filename'}->[$count] ) { + push (@filename, $args{'filename'}->[$count]); + $count++; + } + + unless ( @filename || @filename eq '.' ) { + $log->debug("no file was selected for vcs action"); + my $content = $ui->get_menu( + MENU => 'output', + LOCATION => $location, + FILENAME => '', + PROGNAME => $progname, + OUTPUT => "Please select file(s) or folder(s) to perform vcs action on", + ERROR => "No file(s) or folder(s) selected", + ); + print $cgi->header( -cookie => $ck_auth ); + $ui->print_popup( + TITLE => 'SandWeb : vcs', + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => 'vcs', + FOOTER => '', + CONTENT => $content, + MESSAGE => $message, + ); + + exit; + } + + unless ($confirm_password) { + + vcs_commit( + ck_auth => $ck_auth, + vcs_command => $vcs_command, + module_name => $module_name, + repo_name => $repo_name, + filename => \@filename, + location => $location, + ); + + exit; + } + + my $content = $ui->get_menu( + MENU => 'vcs', + PROGNAME => $progname, + LOCATION => $location, + VCS_COMMAND => $vcs_command, + VCS_MESSAGE => $vcs_message, + MODULE_NAME => $module_name, + REPO_NAME => $repo_name, + MAIN_WINDOW_URL => $main_window_url, + ); + print $cgi->header( -cookie => $ck_auth ); + $ui->print_popup( + TITLE => 'SandWeb : vcs', + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => 'vcs', + FOOTER => '', + CONTENT => $content, + MESSAGE => $message, + ); +} + +############################################################################### # tag menu # @@ -2215,6 +2335,5 @@ my $users_dir = $config->{'paths'}->{'users_dir'}; my $repo_name = $args{'repo_name'}; - my $prev_url = "$ENV{'HTTP_REFERER'}"; - $log->debug("prev_url $prev_url"); + my $main_window_url = $args{'main_window_url'}; my %return; @@ -2364,5 +2483,5 @@ MENU_TITLE => 'SandWeb', SUBMENU_TITLE => "VCS $vcs_command", - PREVIOUS_URL => $prev_url, + PREVIOUS_URL => $main_window_url, FOOTER => '', CONTENT => $content, @@ -2385,5 +2504,5 @@ MENU_TITLE => 'SandWeb', SUBMENU_TITLE => "VCS $vcs_command", - PREVIOUS_URL => $prev_url, + PREVIOUS_URL => $main_window_url, FOOTER => '', CONTENT => $content, @@ -2419,5 +2538,5 @@ MENU_TITLE => 'SandWeb', SUBMENU_TITLE => "VCS $vcs_command", - PREVIOUS_URL => $prev_url, + PREVIOUS_URL => $main_window_url, FOOTER => '', CONTENT => $content, |