Update of /cvsroot/sandweb/sandweb/bin
In directory sc8-pr-cvs1:/tmp/cvs-serv27632/bin
Modified Files:
sandweb.cgi
Log Message:
* disable the toolbar if the user doesn't belong to any groups
( I'll break this out later so you can specify which buttons to enable/disable per group,
but that implies some kind of per-group config that doesn't exist, it's all hardcoded
groups names in the libs at this point )
* I put the "groups" in here as a global var for testing, need to figure out where to
move this to... even with Unix auth, maybe a Sandweb-specific $data_dir/groups file
is the way to go even with seperate auth mechanisms.
Index: sandweb.cgi
===================================================================
RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v
retrieving revision 1.357
retrieving revision 1.358
diff -U2 -r1.357 -r1.358
--- sandweb.cgi 8 Jul 2003 22:07:50 -0000 1.357
+++ sandweb.cgi 9 Jul 2003 05:02:55 -0000 1.358
@@ -74,7 +74,11 @@
my $config_dir = '../etc';
+# FIXME needs to be in the config file
# for viewcvs support in browser
my $viewcvs='http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/sandweb/';
+# group FIXME needs to be implemented per-user
+my $group = 'all';
+
# internal global vars
my $message = '';
@@ -930,5 +934,6 @@
);
- my @vcs_commands = $repository->get_vcs_commands();
+ my @vcs_commands = $repository->get_vcs_commands(group => $group);
+
$log->debug("creating Browse object");
my $browse = SandWeb::Browse->new(
@@ -964,30 +969,36 @@
#
- my %toolbar = $browse->get_tool_bar(
- 'location' => $location,
- 'progname' => $progname,
- );
-
- #
- # figure out what VCS commands we have available and build a VCS toolbar
- #
-
+ my $toolbar_menu = '';
my @loop_data = ();
my $count = 0;
- while ( $toolbar{'VCS_CMD_LOOP'}->[$count] ) {
- push (@loop_data, $toolbar{'VCS_CMD_LOOP'}->[$count]);
- $count++;
- }
-
- my $image_dir = $config->{'webserver'}->{'image_dir'};
+
+ # must be in a group to get the toolbar
+ if ($group){
+
+ my %toolbar = $browse->get_tool_bar(
+ 'location' => $location,
+ 'progname' => $progname,
+ );
- my $toolbar_menu = $ui->get_menu(
- MENU => 'tool_bar',
- VCS_CMD_LOOP => \@loop_data,
- MODULE_NAME => $module_name,
- REPO_NAME => $repo_name,
- LOCATION => $location,
- IMAGE_DIR => $image_dir,
- );
+ #
+ # figure out what VCS commands we have available and build a VCS toolbar
+ #
+
+ while ( $toolbar{'VCS_CMD_LOOP'}->[$count] ) {
+ push (@loop_data, $toolbar{'VCS_CMD_LOOP'}->[$count]);
+ $count++;
+ }
+
+ my $image_dir = $config->{'webserver'}->{'image_dir'};
+
+ $toolbar_menu = $ui->get_menu(
+ MENU => 'tool_bar',
+ VCS_CMD_LOOP => \@loop_data,
+ MODULE_NAME => $module_name,
+ REPO_NAME => $repo_name,
+ LOCATION => $location,
+ IMAGE_DIR => $image_dir,
+ );
+ }
my %current_location = $browse->get_current_location(
@@ -1351,4 +1362,5 @@
my $filename = $args{'filename'};
my $repo_root = $args{'repo_root'};
+ my $image_dir = $args{'image_dir'};
$log->debug("viewing file : $filename");
@@ -1398,5 +1410,5 @@
);
- my @vcs_commands = $repository->get_vcs_commands();
+ my @vcs_commands = $repository->get_vcs_commands(group => $group);
$log->debug("creating Browse object");
@@ -1414,14 +1426,28 @@
my $repo_type = $repository->get_repo_type();
- my %toolbar = $browse->get_tool_bar(
- 'location' => $location,
- 'progname' => $progname,
- );
+ my $toolbar_menu = '';
my @loop_data = ();
my $count = 0;
- while ( $toolbar{'VCS_CMD_LOOP'}->[$count] ) {
- push (@loop_data, $toolbar{'VCS_CMD_LOOP'}->[$count]);
- $count++;
+ # must be in a group to get the toolbar
+ if ($group){
+ my %toolbar = $browse->get_tool_bar(
+ 'location' => $location,
+ 'progname' => $progname,
+ );
+
+ while ( $toolbar{'VCS_CMD_LOOP'}->[$count] ) {
+ push (@loop_data, $toolbar{'VCS_CMD_LOOP'}->[$count]);
+ $count++;
+ }
+
+ $toolbar_menu = $ui->get_menu(
+ MENU => 'tool_bar',
+ VCS_CMD_LOOP => \@loop_data,
+ MODULE_NAME => $module_name,
+ REPO_NAME => $repo_name,
+ LOCATION => $location,
+ IMAGE_DIR => $image_dir,
+ );
}
@@ -1430,13 +1456,4 @@
# javascript for pop-ups
my $js = $ui->get_javascript( SCRIPT => "openwindow" );
-
- my $toolbar_menu = $ui->get_menu(
- MENU => 'tool_bar',
- VCS_CMD_LOOP => \@loop_data,
- MODULE_NAME => $module_name,
- REPO_NAME => $repo_name,
- LOCATION => $location,
- IMAGE_DIR => $image_dir,
- );
my %current_location = $browse->get_current_location(
|