From: Nick J. <nje...@us...> - 2002-02-01 23:31:16
|
Update of /cvsroot/sandweb/sandweb/bin In directory usw-pr-cvs1:/tmp/cvs-serv21094 Modified Files: sandweb.cgi Log Message: * working on repository_menu, not finished, but got a design going. * added comments to subroutines describing params (rob, can you do this for your subroutines??) Index: sandweb.cgi =================================================================== RCS file: /cvsroot/sandweb/sandweb/bin/sandweb.cgi,v retrieving revision 1.145 retrieving revision 1.146 diff -U2 -r1.145 -r1.146 --- sandweb.cgi 2002/02/01 03:50:26 1.145 +++ sandweb.cgi 2002/02/01 23:31:12 1.146 @@ -50,5 +50,4 @@ my $userprefs; # user data loaded from users prefs config file my $repository_settings; # repository data loaded from users prefs config file -my %repository_settings; my $module_settings; # module data loaded from users prefs config file @@ -328,7 +327,12 @@ } +# # sandbox menu # # main menu to do stuff with sandbox section. +# +# ck_auth - cookie data. +# +# sub sandbox_menu { my %args = @_; @@ -345,5 +349,5 @@ load_prefs(1); - my @modules = keys %{$module_settings}; + my @modules = sort keys %{$module_settings}; if ($#modules < 0) { $no_modules = 1; @@ -981,4 +985,11 @@ } + +# repository menu +# +# manage repository information, add/delete/modify repositories +# +# ck_auth - cookie data +# sub repository_menu { my %args = @_; @@ -991,8 +1002,11 @@ my $username = $auth->get_userinfo('username'); my $users_dir = $config->{'paths'}->{'users_dir'}; - my @repos = sort keys %{repository_settings}; - - my $repo_type = $repository_settings->{'repository'}->{'repo_type'}; - my $connection = $repository_settings->{'repository'}->{'connection'}; + # get list of repositories + my @repos = sort keys %{$repository_settings}; + my $repo_selected = $repos[0]; # default for pulldown + + # selected repository data + my $repo_type = $repository_settings->{$repo_selected}->{'repo_type'}; + my $connection = $repository_settings->{$repo_selected}->{'connection'}; my $vcsroot; @@ -1006,25 +1020,48 @@ my @repo_types = $repository->get_repo_types(); + # loop data my @loop_connection = (); + my @loop_repository_select = (); my @loop_repo_type = (); + + foreach my $repo (@repos) { + my %entries; + if ($repo_selected eq $repo) { + $entries{REPOSITORY_ENTRY} = "<option selected>$repo</option>"; + } else { + $entries{REPOSITORY_ENTRY} = "<option>$repo</option>"; + } + push (@loop_repository_select, \%entries); + } + # add new repo + my %tmp; + if ($repo_selected eq 'Add New Repository') { + $tmp{REPOSITORY_ENTRY} = "<option select>Add New Repository</option>"; + + } else { + $tmp{REPOSITORY_ENTRY} = "<option>Add New Repository</option>"; + + } + push (@loop_repository_select, \%tmp); + - foreach my $connection_loop (@connections) { + foreach my $type (@connections) { my %row_data; - if ($connection_loop eq $connection) { - $row_data{CONNECTION} = "<option selected>$connection_loop</option>"; + if ($type eq $connection) { + $row_data{CONNECTION} = "<option selected>$type</option>"; } else { - $row_data{CONNECTION} = "<option>$connection_loop</option>"; + $row_data{CONNECTION} = "<option>$type</option>"; } push (@loop_connection, \%row_data); } - foreach my $repo_type_loop (@repo_types) { + foreach my $type (@repo_types) { my %row_data; - if ($repo_type_loop eq $repo_type) { - $row_data{REPO_TYPE} = "<option selected>$repo_type_loop</option>"; + if ($type eq $repo_type) { + $row_data{REPO_TYPE} = "<option selected>$type</option>"; } else { - $row_data{REPO_TYPE} = "<option>$repo_type_loop</option>"; + $row_data{REPO_TYPE} = "<option>$type</option>"; } push (@loop_repo_type, \%row_data); @@ -1036,4 +1073,5 @@ LOOP_CONNECTION => \@loop_connection, LOOP_REPO_TYPE => \@loop_repo_type, + LOOP_REPOSITORY_SELECT => \@loop_repository_select, ); |