Update of /cvsroot/sandweb/sandweb/bin
In directory usw-pr-cvs1:/tmp/cvs-serv18978/bin
Modified Files:
sandweb.cgi
Log Message:
added vcsaction subroutine to main cgi, Repository calls are passed
transparently through this.
Repository actions that need special treatment ( like tag, because
it requires user interaction ) can be caught and dealt with in
vcsaction.
These changes are by no means complete; it's more along the lines
of stub code. More work needs to be done in the preferences area
before I can carry this much further. However, I think it's compartmentalized
into objects and subroutines pretty nicely now; should make a good
foundation for future work.
Index: sandweb.cgi
===================================================================
RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v
retrieving revision 1.69
retrieving revision 1.70
diff -U2 -r1.69 -r1.70
--- sandweb.cgi 2001/11/22 09:35:38 1.69
+++ sandweb.cgi 2001/11/24 09:46:03 1.70
@@ -136,4 +136,13 @@
);
}
+ elsif ( param('action') eq 'vcsaction' ) {
+ # called VCS action
+ vcsaction(
+ cookie => $cookie,
+ filename => param('filename'),
+ command => param('command'),
+ location => param('location'),
+ );
+ }
else {
# called an invalid page
@@ -302,4 +311,5 @@
my $command = $args{'command'};
+ my $filename = $args{'filename'};
my $username = $auth->get_userinfo('username');
my $template_dir = $config->{'paths'}->{'template_dir'};
@@ -316,5 +326,4 @@
);
- my $filename = $args{'filename'};
my $group;
my $permissions;
@@ -445,4 +454,43 @@
}
}
+
+sub vcsaction {
+ my %args = @_;
+
+ 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 );
+ }
+
+ my $command = $args{'command'};
+ my $filename = $args{'filename'};
+ my $location = $args{'location'};
+ my $username = $auth->get_userinfo('username');
+ my $template_dir = $config->{'paths'}->{'template_dir'};
+ my $users_dir = $config->{'paths'}->{'users_dir'};
+ my $repo_type = $userprefs->{'repository'}->{'VCS'};
+ my $root = $userprefs->{'repository'}->{'root'};
+ my $sandbox = $userprefs->{'paths'}->{'users_dir'};
+
+ my $repository = SandWeb::Repository->new(
+ root => $root,
+ repo_type => $repo_type,
+ sandbox => "$users_dir/$username",
+ );
+
+ my %return = $repository->$command( file => "$location/$filename" );
+
+ print header;
+ print '<pre>';
+ print "$return{'output'}\n";
+ print '</pre>';
+ exit 1;
+}
+
# user prefs, this is the preferences menu for configuring the users prefs.cfg
|