Update of /cvsroot/sandweb/sandweb/bin
In directory usw-pr-cvs1:/tmp/cvs-serv21312/bin
Modified Files:
sandweb.cgi
Log Message:
renamed "action objects" to "user objects".
"user" objects are currently : "browse" and "repository".
This is explained in the comments in SandWeb.pm
The situation is that all objects are instantiated by SandWeb.pm,
and the references passed to the CGI.
$browse and $repository are no longer defined globally; they
are created in the browse_menu. I also removed the browse()
subroutine from the CGI, which was replaced by browse_menu()
some time ago.
It is starting to make less sense to have all objects
instantiated in SandWeb.pm ( although it makes sense for
startup objects ), it is probably worthwhile to just instantiate
the "browse" and "repository" objects in the browse_menu()
method of the sandweb.cgi ... perhaps it will be easier
to read, and the end result is exactly the same.
dunno, gonna sleep on it. gotta get up early tomorrow.
Index: sandweb.cgi
===================================================================
RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v
retrieving revision 1.60
retrieving revision 1.61
diff -U2 -r1.60 -r1.61
--- sandweb.cgi 2001/10/17 04:27:29 1.60
+++ sandweb.cgi 2001/10/18 06:05:57 1.61
@@ -42,10 +42,8 @@
undef $return; # no need for this anymore
-# action-related objects ( actions )
+# user-related objects
# these variables are declared here, they will be
# instantiated below ( if needed )
-my $userprefs; # data loaded form users prefs config file
-my $browse; # the browse object - file browser. needs to keep state
-my $repository; # current repository of user
+my $userprefs; # data loaded from users prefs config file
# internal variable configs for development ease
@@ -100,15 +98,4 @@
my $sandbox = $userprefs->{'paths'}->{'users_dir'} . "/$username";
- # instantiate all "action" objects
- my $return = SandWeb::->actions(
- username => $username,
- template_dir => $config->{'paths'}->{'template_dir'},
- users_dir => $config->{'paths'}->{'users_dir'},
- repo_type => $repo_type,
- root => $root,
- sandbox => $sandbox,
- );
- $browse = $return->{'browse'};
- $repository = $return->{'repository'};
if ( param('action') eq 'main_menu' ) {
@@ -245,4 +232,22 @@
preferences_menu( cookie => $cookie );
}
+ 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'};
+
+ # instantiate browse and repository objects
+ my $return = SandWeb::->user(
+ username => $username,
+ template_dir => $template_dir,
+ users_dir => $users_dir,
+ repo_type => $repo_type,
+ root => $root,
+ sandbox => $sandbox,
+ );
+ my $browse = $return->{'browse'};
+ my $repository = $return->{'repository'};
my $username = $auth->get_userinfo('username');
@@ -408,32 +413,4 @@
login_menu();
}
-}
-
-# calls the Browse object, for viewing/selecting files
-sub browse {
- my %args = @_;
- my $cookie = $args{'cookie'};
- unless ($cookie) {
- &login_menu();
- exit 0;
- }
-
- my $username = $auth->get_userinfo('username');
-
- my $path = url_param('path') || '';
-
- # create Browse object and show user's sandbox
- my $content = $browse->browse("$path", "$progname");
-
- print header( -cookie => $cookie );
- $ui->print_screen(
- TITLE=> 'SandWeb : Browse Menu',
- MENU_TITLE => 'SandWeb',
- SUBMENU_TITLE => 'browse menu',
- FOOTER => '',
- CONTENT => $content,
- ERROR => $error,
- );
- exit 0;
}
|