From: Rob H. <for...@us...> - 2003-01-06 09:27:01
|
Update of /cvsroot/sandweb/sandweb/bin In directory sc8-pr-cvs1:/tmp/cvs-serv10000/bin Modified Files: sandweb.cgi Log Message: quick&dirty POD conversion, mostly just encapsulated important comments. Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.338 retrieving revision 1.339 diff -U2 -r1.338 -r1.339 --- sandweb.cgi 6 Jan 2003 08:07:20 -0000 1.338 +++ sandweb.cgi 6 Jan 2003 09:26:58 -0000 1.339 @@ -2,5 +2,17 @@ # Sandweb CGI # -# SandWeb (Web-based VCS client) + +=pod +=head1 + + +SandWeb (Web-based VCS client) + +This is the main application that uses the SandWeb library. +It is intended to be called as a CGI from a web server. + + +=cut + # # Copyright (C) 2002 Nick Jennings @@ -25,4 +37,12 @@ use strict; +=head1 + +uses SandWeb, SandWeb::Repository, SandWeb::Browse, SandWeb::File, + SandWeb::Config, Data::Dumpber, CGI::Carp, CGI + +=cut + + # SandWeb Distribution Modules use SandWeb; @@ -43,6 +63,11 @@ $progname =~ s:^.*/::; +=head1 + +We define a couple global variables : +config_file and config_dir + +=cut -# changeable global vars my $config_file = 'sandweb.cfg'; my $config_dir = '../etc'; @@ -51,8 +76,20 @@ my $message = ''; -# object creation, all objects global throughout CGI +=head1 + +We create one instance of the CGI class and reuse it throughout the +application. + +=cut my $cgi = new CGI; +=head1 + +We call the SandWeb class's start_up method to get some data +structures that we will use throughout the application. + +=cut + my $return = SandWeb::->start_up( config_dir => $config_dir, @@ -69,7 +106,17 @@ } -# assign local references to the "global" objects -# these should generally always be loaded, no matter -# what action is going on. + +=head1 + +We make the data structues ( hash tables ) we get from SandWeb->startup() +global throughout the whole application, these are : + +config +log +ui +auth + +=cut + my $config = $return->{'data'}->{'config'}; my $log = $return->{'data'}->{'log'}; @@ -91,4 +138,6 @@ my $system_password; +=head1 + ############################################################################### # main @@ -100,4 +149,7 @@ # action - name of the action the user has requested. ############################################################################### + +=cut + sub main { my $action = $cgi->param('action') || ''; @@ -519,4 +571,20 @@ } +=head1 + +The application's subroutines are split into three main groups, "Menus", +"Committers", and "Functions". + +All user interaction is determined by a "menu", and all +user input is handled by a "commit". + +The naming convention used is action_menu and action_commit, e.g. +the "login_menu" would present the user with a login screen, and the +"login_commit" would take the user's input and attempt to log them in. + +"Functions" are reusable subroutines for the application, like login, +logout, write config data, etc. + + ############################################################################### ############################################################################### @@ -524,4 +592,8 @@ ## +=cut + +=head1 + ############################################################################### # login menu @@ -532,4 +604,7 @@ # No args. ############################################################################### + +=cut + sub login_menu { my %args = @_; @@ -565,4 +640,5 @@ } +=head1 ############################################################################### @@ -574,4 +650,6 @@ # ck_auth - cookie data. ############################################################################### + +=cut sub debug_menu { my %args = @_; @@ -597,4 +675,6 @@ } +=head1 + ############################################################################### # sandbox menu @@ -608,4 +688,6 @@ ############################################################################### +=cut + sub sandbox_menu { my %args = @_; @@ -692,4 +774,6 @@ } +=head1 + ############################################################################### # browse module menu @@ -706,5 +790,7 @@ # users_dir - location of user sandbox directories. ############################################################################### -# + +=cut + sub browse_module_menu { my %args = @_; @@ -876,4 +962,5 @@ } +=head1 ############################################################################### @@ -885,4 +972,7 @@ # ck_auth - the sessions cookie ############################################################################### + +=cut + sub configuration_menu { my %args = @_; @@ -926,4 +1016,5 @@ } +=head1 ############################################################################### @@ -943,4 +1034,7 @@ # root - root of VCS repository ############################################################################### + +=cut + sub repository_menu { my %args = @_; @@ -1126,4 +1220,5 @@ } +=head1 ############################################################################### @@ -1144,4 +1239,7 @@ # users_dir - location of user sandbox directories. ############################################################################### + +=cut + sub view_file_menu { my %args = @_; @@ -1313,4 +1411,6 @@ } +=head1 + ############################################################################### # XXX FIXME the inline editor is disabled until such time as we can replace @@ -1335,4 +1435,7 @@ # users_dir - location of user sandbox directories. ############################################################################### + +=cut + sub edit_file_menu { my %args = @_; @@ -1397,4 +1500,5 @@ } +=head1 ############################################################################### # delete menu @@ -1410,4 +1514,6 @@ ############################################################################### +=cut + sub delete_menu { my %args = @_; @@ -1498,4 +1604,5 @@ } +=head1 ############################################################################### # rename file menu @@ -1514,4 +1621,7 @@ # users_dir - location of user sandbox directories. ############################################################################### + +=cut + sub rename_menu { my %args = @_; @@ -1590,4 +1700,5 @@ } +=head1 ############################################################################### # create file menu @@ -1603,4 +1714,6 @@ ############################################################################### +=cut + sub create_file_menu { my %args = @_; @@ -1632,4 +1745,5 @@ ); } +=head1 ############################################################################### # create folder menu @@ -1645,4 +1759,6 @@ ############################################################################### +=cut + sub create_folder_menu { my %args = @_; @@ -1676,4 +1792,5 @@ } +=head1 ############################################################################### # upload folder menu @@ -1688,4 +1805,7 @@ # users_dir - location of user sandbox directories. ############################################################################### + +=cut + sub upload_menu { my %args = @_; @@ -1719,4 +1839,5 @@ } +=head1 ############################################################################### # vcs menu @@ -1739,4 +1860,6 @@ ############################################################################### +=cut + sub vcs_menu { my %args = @_; @@ -1843,4 +1966,5 @@ } +=head1 ############################################################################### # tag menu @@ -1856,4 +1980,6 @@ ############################################################################### +=cut + sub tag_menu { my %args = @_; @@ -1897,4 +2023,5 @@ } +=head1 ############################################################################### # branch menu @@ -1910,4 +2037,6 @@ ############################################################################### +=cut + sub branch_menu { my %args = @_; @@ -1951,10 +2080,13 @@ } - +=head1 ############################################################################### ############################################################################### -## Commit Menu Data +## Committers ## +=cut + +=head1 ############################################################################### # XXX FIXME the inline editor is disabled until such time as we can replace @@ -1977,4 +2109,6 @@ ############################################################################### +=cut + sub edit_file_commit { my %args = @_; @@ -2017,4 +2151,5 @@ } +=head1 ############################################################################### # delete_commit is called to delete one or more files @@ -2031,4 +2166,7 @@ # users_dir - location of user sandbox directories. ############################################################################### + +=cut + sub delete_commit { # delete a file @@ -2130,4 +2268,5 @@ } +=head1 ############################################################################### # rename_commit is called by rename_menu to rename a file @@ -2145,4 +2284,7 @@ # users_dir - location of user sandbox directories. ############################################################################### + +=cut + sub rename_commit { my %args = @_; @@ -2174,4 +2316,5 @@ } +=head1 ############################################################################### # create_file_commit is called by create_file_menu to create a new, empty file @@ -2188,4 +2331,7 @@ # users_dir - location of user sandbox directories. ############################################################################### + +=cut + sub create_file_commit { my %args = @_; @@ -2215,4 +2361,5 @@ } +=head1 ############################################################################### # create_folder_commit is called by create_folder_menu to create a new, empty folder @@ -2229,4 +2376,7 @@ # users_dir - location of user sandbox directories. ############################################################################### + +=cut + sub create_folder_commit { my %args = @_; @@ -2253,4 +2403,5 @@ } +=head1 ############################################################################### # upload_commit is called by upload_menu to save uploaded data @@ -2267,4 +2418,7 @@ # users_dir - location of user sandbox directories. ############################################################################### + +=cut + sub upload_commit { my %args = @_; @@ -2301,4 +2455,5 @@ } +=head1 ############################################################################### # download_file_commit is called to save downloaded data. @@ -2315,4 +2470,7 @@ # users_dir - location of user sandbox directories. ############################################################################### + +=cut + sub download_file_commit { my %args = @_; @@ -2337,4 +2495,5 @@ } +=head1 ############################################################################### # vcs_commit @@ -2357,4 +2516,6 @@ ############################################################################### +=cut + sub vcs_commit { my %args = @_; @@ -2612,4 +2773,5 @@ } +=head1 ############################################################################### # sandbox commit @@ -2623,4 +2785,6 @@ ############################################################################### +=cut + sub sandbox_commit { my %args = @_; @@ -2749,4 +2913,5 @@ } +=head1 ############################################################################### # configuration commit @@ -2757,4 +2922,7 @@ # ck_auth - the sessions cookie ############################################################################### + +=cut + sub configuration_commit { my %args = @_; @@ -2783,4 +2951,5 @@ } +=head1 ############################################################################### # repository commit @@ -2799,4 +2968,7 @@ # root - root of VCS repository ############################################################################### + +=cut + sub repository_commit { my %args = @_; @@ -2911,4 +3083,5 @@ } +=head1 ############################################################################### # tag commit @@ -2927,4 +3100,6 @@ ############################################################################### +=cut + sub tag_commit { my %args = @_; @@ -3117,5 +3292,5 @@ } - +=head1 ############################################################################### # branch commit @@ -3136,4 +3311,6 @@ ############################################################################### +=cut + sub branch_commit { my %args = @_; @@ -3328,4 +3505,5 @@ +=head1 ############################################################################### ############################################################################### @@ -3333,4 +3511,7 @@ ## +=cut + +=head1 ############################################################################### # load prefs @@ -3343,4 +3524,7 @@ # ############################################################################### + +=cut + sub load_config { my $no_error = shift; @@ -3381,5 +3565,5 @@ } - +=head1 ############################################################################### # write config data @@ -3388,4 +3572,7 @@ # ############################################################################### + +=cut + sub write_config { $log->debug("write_config()"); @@ -3407,4 +3594,5 @@ } +=head1 ############################################################################### # login @@ -3419,4 +3607,6 @@ ############################################################################### +=cut + sub login { my %args = @_; @@ -3447,4 +3637,5 @@ } +=head1 ############################################################################### # logout @@ -3454,4 +3645,7 @@ # No args. ############################################################################### + +=cut + sub logout { my $stat = $auth->logout(); @@ -3466,4 +3660,5 @@ } +=head1 ############################################################################### # set error @@ -3473,4 +3668,7 @@ # No args. ############################################################################### + +=cut + sub set_message { if (! $message) { |