Solstice::View::Boilerplate - Superclass for boilerplate views.


Solstice documentation Contained in the Solstice distribution.

Index


Code Index:

NAME

Top

Solstice::View::Boilerplate - Superclass for boilerplate views.

Superclass

Solstice::View.

Export

No symbols exported.

Methods

new($application)

Creates a new Solstice::View::Application object.

setViewTopNav($bool)
getViewTopNav()

Private Methods

_getTemplateParams()

Modules Used

Solstice::Configure, Solstice::View, Solstice::Application, Solstice::OnloadService, Solstice::IncludeService,

AUTHOR

Top

Catalyst Group, <catalyst@u.washington.edu>

VERSION

Top

$Revision: 2586 $

COPYRIGHT

Top


Solstice documentation Contained in the Solstice distribution.
package Solstice::View::Boilerplate;

use 5.006_000;
use strict;
use warnings;

use Solstice::View::MessageService;

use Solstice::NamespaceService;

use base qw(Solstice::View);

use constant TEMPLATE => 'boilerplate/boiler.html';

sub new {
    my $obj = shift;
    my $self = $obj->SUPER::new(@_);
    
    $self->_setTemplatePath($self->getConfigService()->getRoot().'/templates');
    $self->_setTemplate(TEMPLATE);
    
    return $self;
}

sub setViewTopNav {
    my $self = shift;
    $self->{'_view_top_nav'} = shift;
}

sub getViewTopNav {
    my $self = shift;
    return $self->{'_view_top_nav'};
}

sub _getTemplateParams {
    my $self = shift;
    
    my $ns_service = Solstice::NamespaceService->new();
    my $app_name_space = $ns_service->getAppNamespace();

    # Add the messaging pane to the boilerplate if messages need to be shown (still 
    # up to the template to show them though!)
    $self->addChildView('messaging_pane', Solstice::View::MessageService->new());
    
    if (my $nav_view = $self->getNavigationService->new()->getView()) {
        $self->addChildView('application_nav', $nav_view);
    }elsif(defined $app_name_space) {
        my $application_package = $app_name_space.'::Application';
        my $nav_view;
        eval {
            $self->loadModule($application_package);
            $nav_view = $application_package->new()->getNavigationView();
        };
        $self->addChildView('application_nav', $nav_view) if $nav_view;
    }
    
    $self->generateParams();
    my %child_views = $self->processChildViews();
    foreach my $key (%child_views) {
        $self->setParam($key, $child_views{$key});
    }


    # We go through this bit of convolution because we have some subclasses that 
    # never bother to create an app namespace, as they just do a quick redirect 
    # to wherever they want to go.
    my $app_home = '';
    if (defined $app_name_space) {
        my $app_config = $self->getConfigService($ns_service->getAppNamespace());
        $app_home = $app_config->getAppURL() . '/';
    }
    $self->setParam('app_home', $app_home);

    return $self->{'_params'};
}

1;

__END__