From: Rob H. <for...@us...> - 2002-06-02 18:41:03
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv18818/bin Modified Files: sandweb.cgi Log Message: changed the way we use the CGI class so it's objected-oriented style rather than procedural, e.g. $cgi->header; instead of CGI::header; Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.293 retrieving revision 1.294 diff -U2 -r1.293 -r1.294 --- sandweb.cgi 20 May 2002 06:00:42 -0000 1.293 +++ sandweb.cgi 2 Jun 2002 18:40:59 -0000 1.294 @@ -51,4 +51,7 @@ # object creation, all objects global throughout CGI + +my $cgi = new CGI; + my $return = SandWeb::->start_up( config_dir => $config_dir, @@ -97,11 +100,11 @@ ############################################################################### sub main { - my $action = CGI::param('action') || ''; + my $action = $cgi->param('action') || ''; if ($action eq 'login') { # attempting login - my $username = CGI::param('username'); - my $password = CGI::param('password'); - my $salt = CGI::param('salt'); + my $username = $cgi->param('username'); + my $password = $cgi->param('password'); + my $salt = $cgi->param('salt'); login( username => $username, @@ -111,5 +114,5 @@ } else { # if auth cookie exists, this will return it's data - my $ck_auth = CGI::cookie('sandweb_auth') || ''; + my $ck_auth = $cgi->cookie('sandweb_auth') || ''; if ($ck_auth) { @@ -131,20 +134,20 @@ # 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_password = CGI::param('repo_password') || ''; - 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') || ''; - my $module_name = CGI::param('module_name') || ''; - my $module_description = CGI::param('module_description') || ''; - my $location = CGI::param('location') || ''; - my $sort = CGI::param('sort') || ''; - my $previous_url = CGI::param('previous_url') || ''; + 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_password = $cgi->param('repo_password') || ''; + 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') || ''; + my $module_name = $cgi->param('module_name') || ''; + my $module_description = $cgi->param('module_description') || ''; + my $location = $cgi->param('location') || ''; + my $sort = $cgi->param('sort') || ''; + my $previous_url = $cgi->param('previous_url') || ''; $log->debug("action: $action submit: $submit"); @@ -172,5 +175,5 @@ } elsif ( $action eq 'preferences' ) { - if (! CGI::param('Submit')) { + if (! $cgi->param('Submit')) { # call preferences menu preferences_menu( @@ -220,6 +223,6 @@ my @filename = (); - if ( CGI::param('filename') ) { - @filename = CGI::param('filename'), + if ( $cgi->param('filename') ) { + @filename = $cgi->param('filename'), } else { @filename = ('.'); @@ -227,10 +230,10 @@ if ( $vcs_command eq "tag" ) { - my $tag_sync = CGI::param('tag_sync') || ''; - my $tag_switch = CGI::param('tag_switch') || ''; - my $trunk_sync = CGI::param('trunk_sync') || ''; - my $trunk_switch = CGI::param('trunk_switch') || ''; - my $create_tag = CGI::param('create_tag') || ''; - my $remove_tag = CGI::param('remove_tag') || ''; + my $tag_sync = $cgi->param('tag_sync') || ''; + my $tag_switch = $cgi->param('tag_switch') || ''; + my $trunk_sync = $cgi->param('trunk_sync') || ''; + my $trunk_switch = $cgi->param('trunk_switch') || ''; + my $create_tag = $cgi->param('create_tag') || ''; + my $remove_tag = $cgi->param('remove_tag') || ''; if ($submit) { tag_commit( @@ -272,5 +275,5 @@ view_file_menu( ck_auth => $ck_auth, - filename => CGI::param('filename') || '', + filename => $cgi->param('filename') || '', module_name => $module_name, repo_name => $repo_name, @@ -283,5 +286,5 @@ edit_file_commit( ck_auth => $ck_auth, - filename => CGI::param('filename') || '', + filename => $cgi->param('filename') || '', module_name => $module_name, repo_name => $repo_name, @@ -291,5 +294,5 @@ edit_file_menu( ck_auth => $ck_auth, - filename => CGI::param('filename') || '', + filename => $cgi->param('filename') || '', module_name => $module_name, repo_name => $repo_name, @@ -300,5 +303,5 @@ elsif ( $action eq 'delete' ) { # called file deleter - my @filename = CGI::param('filename') || ''; + my @filename = $cgi->param('filename') || ''; delete_commit( ck_auth => $ck_auth, @@ -314,6 +317,6 @@ rename_commit( ck_auth => $ck_auth, - filename => CGI::param('filename') || '', - tofile => CGI::param('tofile') || '', + filename => $cgi->param('filename') || '', + tofile => $cgi->param('tofile') || '', module_name => $module_name, repo_name => $repo_name, @@ -323,5 +326,5 @@ rename_menu( ck_auth => $ck_auth, - filename => CGI::param('filename') || '', + filename => $cgi->param('filename') || '', module_name => $module_name, repo_name => $repo_name, @@ -335,5 +338,5 @@ create_file_commit( ck_auth => $ck_auth, - filename => CGI::param('filename') || '', + filename => $cgi->param('filename') || '', module_name => $module_name, repo_name => $repo_name, @@ -354,5 +357,5 @@ create_folder_commit( ck_auth => $ck_auth, - filename => CGI::param('filename') || '', + filename => $cgi->param('filename') || '', module_name => $module_name, repo_name => $repo_name, @@ -373,5 +376,5 @@ upload_commit( ck_auth => $ck_auth, - filename => CGI::param('filename') || '', + filename => $cgi->param('filename') || '', module_name => $module_name, repo_name => $repo_name, @@ -392,5 +395,5 @@ download_file_commit( ck_auth => $ck_auth, - filename => CGI::param('filename') || '', + filename => $cgi->param('filename') || '', module_name => $module_name, repo_name => $repo_name, @@ -433,5 +436,5 @@ # load current menu (instead of going to new one) #no strict 'refs'; - #my $curr_menu = CGI::param('curr_menu') || ''; + #my $curr_menu = $cgi->param('curr_menu') || ''; #&$curr_menu( ck_auth => $ck_auth); debug_menu( @@ -473,5 +476,5 @@ ); - print CGI::header; + print $cgi->header; $ui->print_screen( TITLE => 'SandWeb : login', @@ -506,5 +509,5 @@ $content = "Data Dump<br /><pre>" . $content . "</pre>"; - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : debug', @@ -596,5 +599,5 @@ my $username = $auth->get_username(); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : sandbox', @@ -766,5 +769,5 @@ my $content = "$popup_header $toolbar_menu $current_location_menu $browser_menu $popup_footer"; - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : browse module', @@ -803,5 +806,5 @@ ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : preferences', @@ -980,5 +983,5 @@ $js .= $ui->get_javascript( SCRIPT => "repository" ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : repository', @@ -1138,5 +1141,5 @@ my $content = "$popup_header $toolbar_menu $current_location_menu $menu $popup_footer"; - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : view file', @@ -1214,5 +1217,5 @@ ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_screen( TITLE=> 'SandWeb : edit file', @@ -1280,5 +1283,5 @@ ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> "SandWeb : renamefile", @@ -1300,5 +1303,5 @@ ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> 'SandWeb : rename file', @@ -1346,5 +1349,5 @@ $log->debug("location: $location"); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> 'SandWeb : create file', @@ -1384,5 +1387,5 @@ REPO_NAME => $repo_name, ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE => 'SandWeb : create folder', @@ -1424,5 +1427,5 @@ PREVIOUS_URL => $prev_url, ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> 'SandWeb : upload file', @@ -1470,5 +1473,5 @@ REPO_NAME => $repo_name, ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> 'SandWeb : tag menu', @@ -1527,5 +1530,5 @@ ); $log->debug("editing file : $filename"); - my $file_content = CGI::param('data'), + my $file_content = $cgi->param('data'), $filename = $file->get_filename(); $log->debug("saving edited file : $filename"); @@ -1538,5 +1541,5 @@ ); - print CGI::redirect( "$progname?action=view_file&filename=$filename&location=$location&repo_name=$repo_name&module_name=$module_name" ); + print $cgi->redirect( "$progname?action=view_file&filename=$filename&location=$location&repo_name=$repo_name&module_name=$module_name" ); } @@ -1595,5 +1598,5 @@ ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> "SandWeb : delete file", @@ -1642,5 +1645,5 @@ ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> "SandWeb : delete file", @@ -1813,5 +1816,5 @@ # if a file has been uploaded, then # grab it's filehandle - $filehandle = CGI::upload('filehandle'); + $filehandle = $cgi->upload('filehandle'); if ( $filehandle) { $filename = $filehandle; @@ -1825,8 +1828,8 @@ filehandle => $filehandle, ); - print CGI::redirect( "$previous_url" ); + print $cgi->redirect( "$previous_url" ); } else { set_message("Error: no file was received!"); - print CGI::redirect( "$previous_url" ); + print $cgi->redirect( "$previous_url" ); } } @@ -1906,5 +1909,5 @@ my $module_name = $args{'module_name'}; my $location = $args{'location'}; - my $message = CGI::param('message'); + my $message = $cgi->param('message'); my $username = $auth->get_username(); my $users_dir = $config->{'paths'}->{'users_dir'}; @@ -1943,5 +1946,5 @@ VCS_ERROR => join('', @vcs_error), ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> "SandWeb :VCS Command", @@ -1997,5 +2000,5 @@ ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> "SandWeb : VCS $vcs_command", @@ -2015,5 +2018,5 @@ FILENAME => "@filename", ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> 'SandWeb : commit file(s)', @@ -2051,5 +2054,5 @@ if ( $return{'error'} ) { - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> "SandWeb : VCS $vcs_command", @@ -2072,5 +2075,5 @@ ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> "SandWeb : VCS $vcs_command", @@ -2106,5 +2109,5 @@ ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> "SandWeb : VCS $vcs_command", @@ -2242,5 +2245,5 @@ my $prev_url = "$ENV{'HTTP_REFERER'}"; $log->debug("prev_url $prev_url"); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> "SandWeb : vcs output", @@ -2298,5 +2301,5 @@ foreach my $param (@personal_params) { - if ( CGI::param("$param") ) { + if ( $cgi->param("$param") ) { $user->{'personal'}->{"$param"} = param("$param"); } @@ -2454,5 +2457,5 @@ my $module_name = $args{'module_name'}; my $location = $args{'location'}; - my $message = CGI::param('message'); + my $message = $cgi->param('message'); my $username = $auth->get_username(); my $users_dir = $config->{'paths'}->{'users_dir'}; @@ -2584,5 +2587,5 @@ ); - print CGI::header( -cookie => $ck_auth ); + print $cgi->header( -cookie => $ck_auth ); $ui->print_popup( TITLE=> "SandWeb : VCS tag", @@ -2704,5 +2707,5 @@ if ($stat) { $log->standard("$username logged on."); - my $ck_auth = CGI::cookie( $auth->set_auth_cookie() ); + my $ck_auth = $cgi->cookie( $auth->set_auth_cookie() ); if (! load_config()) { # no existing user config, forward to prefs menu |