From: Rob H. <for...@us...> - 2002-01-25 18:21:15
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv22276 Modified Files: sandweb.cgi Log Message: added comments, replaced spaces with tabs Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.122 retrieving revision 1.123 diff -U2 -r1.122 -r1.123 --- sandweb.cgi 2002/01/25 07:41:56 1.122 +++ sandweb.cgi 2002/01/25 18:21:12 1.123 @@ -31,7 +31,7 @@ # object creation, all objects global throughout CGI my $return = SandWeb::->start_up( - config_dir => $config_dir, - config_file => $config_file, - progname => $progname, + config_dir => $config_dir, + config_file => $config_file, + progname => $progname, ); @@ -98,11 +98,10 @@ my $username = $auth->get_userinfo('username'); - my $repo = $userprefs->{'repository'}->{'name'}; - my $repo_type = $userprefs->{'repository'}->{'VCS'}; - my $root = $userprefs->{'repository'}->{'root'}; - my $server = $userprefs->{'repository'}->{'server'}; - my $sandbox = $userprefs->{'paths'}->{'users_dir'} . "/$username"; + my $repo = $userprefs->{'repository'}->{'name'}; + my $repo_type = $userprefs->{'repository'}->{'VCS'}; + my $root = $userprefs->{'repository'}->{'root'}; + my $server = $userprefs->{'repository'}->{'server'}; + my $sandbox = $userprefs->{'paths'}->{'users_dir'} . "/$username"; - if ( $action eq 'main_menu' ) { # called main menu @@ -125,5 +124,5 @@ elsif ( $action eq 'logout' ) { # called logout - logout(); + logout(); } elsif ( $action eq 'browse_menu' ) { @@ -133,5 +132,5 @@ $path = ""; } - browse_menu( + browse_menu( cookie => $cookie, path => $path, @@ -142,5 +141,5 @@ my @filename = (); @filename = CGI::param('filename'), - file( + file( cookie => $cookie, file_command => CGI::param('file_command'), @@ -191,10 +190,10 @@ my $page = $action; my $msg = "Invalid page - $page!"; - $log->error("$msg"); - set_error("$msg"); - debug_menu( cookie => $cookie ); + $log->error("$msg"); + set_error("$msg"); + debug_menu( cookie => $cookie ); } } - } + } else { # no cookie, default login_menu @@ -360,5 +359,5 @@ my @vcs_commands = $repository->get_vcs_commands(); my @file_commands = $file->get_file_commands(); - $repo_type = $repository->get_repo_type(); + $repo_type = $repository->get_repo_type(); my $path = $args{'path'} || ''; @@ -389,12 +388,12 @@ my $cookie = $args{'cookie'}; - unless ($cookie) { - &login_menu(); - exit 0; - } - if (! load_prefs()) { - # no existing user config, forward to prefs menu - preferences_menu( cookie => $cookie ); - } + unless ($cookie) { + &login_menu(); + exit 0; + } + if (! load_prefs()) { + # no existing user config, forward to prefs menu + preferences_menu( cookie => $cookie ); + } @@ -423,5 +422,5 @@ my $vcsroot; - # Remove a file ?? XXX + # Remove a file if ( $file_command eq 'remove' ) { unless (@filename) { @@ -439,6 +438,6 @@ my $file = SandWeb::File->new( 'log_obj' => $log, - 'filename' => $entry, - 'location' => "$users_dir/$username$location", + 'filename' => $entry, + 'location' => "$users_dir/$username$location", ); @@ -462,22 +461,23 @@ ); } + + # CVS parses network CVSROOTs and local CVSROOTs + # differently - # XXX if ( $repo_type eq 'CVS' ) { $log->debug("repo type is CVS, setting up CVSROOT"); - if ( $connection eq 'local' ) { - $vcsroot = "$root"; - } else { - $vcsroot = ":$connection:$vcs_username\@$server:$root"; - } + if ( $connection eq 'local' ) { + $vcsroot = "$root"; + } else { + $vcsroot = ":$connection:$vcs_username\@$server:$root"; + } } - # comments on what these vars mean? XXX - my $group; # XXX - my $permissions; # XXX - my $file_type; # XXX - my $file; # XXX + # Initialize variables for use by File class + my $file_type; # Text, Binary or Unknown + my $file; # File object - # XXX + # If a filename has been specified, create a file + # object for later use if ($filename) { $log->debug("creating file object"); @@ -490,5 +490,5 @@ } - # XXX + # file viewer if ( $file_command eq 'view' ) { $log->debug("viewing file : $filename"); @@ -722,12 +722,12 @@ my $cookie = $args{'cookie'}; - unless ($cookie) { - &login_menu(); - exit 0; - } - if (! load_prefs()) { - # no existing user config, forward to prefs menu - preferences_menu( cookie => $cookie ); - } + unless ($cookie) { + &login_menu(); + exit 0; + } + if (! load_prefs()) { + # no existing user config, forward to prefs menu + preferences_menu( cookie => $cookie ); + } my $vcs_command = $args{'vcs_command'}; @@ -831,21 +831,21 @@ my $content = $ui->get_menu( MENU => 'vcs_output', - LOCATION => $location, + LOCATION => $location, FILENAME => "@filename", - PROGNAME => $progname, - FULLPATH => "$users_dir/$username/$location", + PROGNAME => $progname, + FULLPATH => "$users_dir/$username/$location", VCS_OUTPUT => "@vcs_output", VCS_ERROR => "@vcs_error", - ); - print CGI::header( -cookie => $cookie ); - $ui->print_screen( - TITLE=> "SandWeb : VCS $vcs_command", - MENU_TITLE => 'SandWeb', - SUBMENU_TITLE => "VCS $vcs_command", - FOOTER => '', - CONTENT => $content, - ERROR => $error, - ); - exit 0; + ); + print CGI::header( -cookie => $cookie ); + $ui->print_screen( + TITLE=> "SandWeb : VCS $vcs_command", + MENU_TITLE => 'SandWeb', + SUBMENU_TITLE => "VCS $vcs_command", + FOOTER => '', + CONTENT => $content, + ERROR => $error, + ); + exit 0; } @@ -904,6 +904,6 @@ if ( $repo_type eq 'CVS' ) { - $vcsroot = ":$connection:$vcs_username\@$server:$root"; - } else { + $vcsroot = ":$connection:$vcs_username\@$server:$root"; + } else { $vcsroot = "blah"; } @@ -1089,14 +1089,14 @@ sub logout { - my %args = @_; - my $stat = $auth->logout(); + my %args = @_; + my $stat = $auth->logout(); - if ($stat == 1) { - login_menu(); - } - else { + if ($stat == 1) { + login_menu(); + } + else { set_error("Logout failed: $stat"); - login_menu(); - } + login_menu(); + } } |