From: Rob H. <for...@us...> - 2001-12-04 00:44:05
|
Update of /cvsroot/sandweb/sandweb/lib/SandWeb In directory usw-pr-cvs1:/tmp/cvs-serv29326/lib/SandWeb Modified Files: UI.pm Log Message: UI.pm was getting to be a pain in the ass, so I fixed it. now there are ( only only ever should be, with the way we currently use UI.pm ) only 3 subroutines - print_screen, menu_bar and get_menu. Index: UI.pm =================================================================== RCS file: /cvsroot/sandweb/sandweb/lib/SandWeb/UI.pm,v retrieving revision 1.22 retrieving revision 1.23 diff -U2 -r1.22 -r1.23 --- UI.pm 2001/11/27 00:47:17 1.22 +++ UI.pm 2001/12/04 00:43:56 1.23 @@ -1,4 +1,4 @@ # SandWeb User Interface Class -# use HTML::Template or something? +# package SandWeb::UI; @@ -7,15 +7,15 @@ sub new { - my $class = shift; - my %args = @_; + my $class = shift; + my %args = @_; - my $self = bless { + my $self = bless { 'log_obj' => $args{'log_obj'}, 'template_dir' => $args{'template_dir'}, 'cgi_path' => $args{'cgi_path'}, 'cgi_exec' => $args{'cgi_exec'}, - }, $class; + }, $class; - return $self; + return $self; } @@ -61,360 +61,50 @@ sub get_menu_bar { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - - my %defaults = ( - CGI_PATH => $self->_get_cgi_path(), - CGI_EXEC => $self->_get_cgi_exec(), - ); - - # generate menu_bar data - $tmp = HTML::Template->new(filename => "$template_dir/menu_bar.html"); - $tmp->param(%defaults, %args); - my @lists = $tmp->output; - return join('', @lists); -} - - -sub get_login { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - CGI_PATH => $self->_get_cgi_path(), - CGI_EXEC => $self->_get_cgi_exec(), - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/login.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} - -sub get_preferences { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/preferences.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} - -sub get_vcs_prefs { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/vcs_prefs.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} - -sub get_cvs_prefs { - - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/cvs_prefs.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} - -sub get_rcs_prefs { - - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/rcs_prefs.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} - -sub view_file { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - FILENAME => $filename, - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/view_file.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} - -sub edit_file { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - FILENAME => $filename, - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/edit_file.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} + my $self = shift; + my %args = @_; -sub get_vcs_output { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - FILENAME => $filename, - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/vcs_output.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} + my $template_dir = $self->_get_template_dir(); -sub file_info { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $location = $args{'location'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - LOCATION => $location, - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/file_info.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} + my %defaults = ( + CGI_PATH => $self->_get_cgi_path(), + CGI_EXEC => $self->_get_cgi_exec(), + ); -sub create_file { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $location = $args{'location'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - LOCATION => $location, - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/create_file.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); + # generate menu_bar data + $tmp = HTML::Template->new(filename => "$template_dir/menu_bar.html"); + $tmp->param(%defaults, %args); + my @lists = $tmp->output; + return join('', @lists); } -sub create_folder{ - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $location = $args{'location'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - LOCATION => $location, - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/create_folder.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} -sub upload_file { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $location = $args{'location'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - LOCATION => $location, - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/upload.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} +sub get_menu { + my $self = shift; + my %args = @_; -sub get_commit { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/commit.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} + my $template_dir = $self->_get_template_dir(); + my $log = $self->_logobj(); -sub get_checkout { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/checkout.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); -} + my $menu = $args{'menu'}; + delete $args{menu}; -sub get_tag { - my $self = shift; - my %args = @_; - - my $template_dir = $self->_get_template_dir(); - my $filename = $args{'filename'}; - my $log = $self->_logobj(); - - # this will eventually be $conf->defaults() - my %defaults = ( - # CGI_PATH => $self->_get_cgi_path(), - # CGI_EXEC => $self->_get_cgi_exec(), - ); - - # generate content data - my $tmp = HTML::Template->new(filename => "$template_dir/tag.html"); - $tmp->param( %defaults, %args ); - my @contents = $tmp->output; - return join('', @contents); + # generate content data + my $tmp = HTML::Template->new(filename => "$template_dir/$menu.html"); + $tmp->param( %args ); + my @contents = $tmp->output; + return join('', @contents); } sub _get_cgi_exec { - return $_[0]->{'cgi_exec'}; + return $_[0]->{'cgi_exec'}; } sub _get_cgi_path { - return $_[0]->{'cgi_path'}; + return $_[0]->{'cgi_path'}; } sub _get_template_dir { - return $_[0]->{'template_dir'}; + return $_[0]->{'template_dir'}; } sub _logobj { - return $_[0]->{'log_obj'}; + return $_[0]->{'log_obj'}; } |