From: Rob H. <for...@us...> - 2002-02-22 03:59:32
|
Update of /cvsroot/sandweb/sandweb/lib/SandWeb In directory usw-pr-cvs1:/tmp/cvs-serv1713/lib/SandWeb Modified Files: Browse.pm Log Message: wow, implementing toolbar worked first time i tried. kick ass. note that this is still using the HTML::Template system, but once I get this all in place I'm going to rip it out and make the CGI deal with browse's output. Index: Browse.pm =================================================================== RCS file: /cvsroot/sandweb/sandweb/lib/SandWeb/Browse.pm,v retrieving revision 1.55 retrieving revision 1.56 diff -U2 -r1.55 -r1.56 --- Browse.pm 22 Feb 2002 03:49:27 -0000 1.55 +++ Browse.pm 22 Feb 2002 03:59:29 -0000 1.56 @@ -15,14 +15,16 @@ my %args = @_; my $username = $args{'username'}; - my $template_dir = $args{'template_dir'}; my $module_name = $args{'module_name'}; my $users_dir = $args{'users_dir'}; + my $template_dir = $args{'template_dir'}; + my $vcs_commands = $args{'vcs_commands'}; my $log_obj = $args{'log_obj'}; my $self = bless { 'username' => $username, - 'template_dir' => $template_dir, 'module_name' => $module_name, 'users_dir' => $users_dir, + 'template_dir' => $template_dir, + 'vcs_commands' => $vcs_commands, 'log_obj' => $log_obj, }, $class; @@ -60,5 +62,4 @@ MODULE_NAME => $module_name, LOCATION => $location, -# LOCATION_LOOP => \@loop_data, REPO_NAME => $repo_name, ); @@ -157,18 +158,31 @@ } -#sub get_tool_bar { -# my @vcs_commands; -# my $count = 0; -# while ( $args{'vcs_commands'}->[$count] ) { -# push (@vcs_commands, $args{'vcs_commands'}->[$count]); -# $count++; -# $content->param( VCS_CMD_LOOP => \@loop_data ); -# } -# foreach my $vcs_command (@vcs_commands) { -# my %row_data; -# $row_data{VCS_CMD} = "$vcs_command"; -# push (@loop_data, \%row_data); -# } -#} +sub get_tool_bar { + my $self = shift; + + my @vcs_commands; + my @loop_data; + my $vcs_commands = $self->_get_vcs_commands(); + my $template_dir = $self->_get_template_dir(); + + my $content = HTML::Template->new( filename => "$template_dir/tool_bar.html" ); + + my $count = 0; + while ( $vcs_commands->[$count] ) { + push (@vcs_commands, $vcs_commands->[$count]); + $count++; + } + + foreach my $vcs_command (@vcs_commands) { + my %row_data; + $row_data{VCS_CMD} = "$vcs_command"; + push (@loop_data, \%row_data); + } + + $content->param( VCS_CMD_LOOP => \@loop_data ); + + return $content->output; +} + # #sub get_current_location { @@ -241,9 +255,13 @@ } +sub _get_vcs_commands { + my $self = shift; + return $self->{'vcs_commands'}; +} + sub _get_log_obj { my $self = shift; return $self->{'log_obj'}; } - 1; |