Solstice::View::Application - The application wide view (boilerplate) for a Solstice application.


Solstice documentation Contained in the Solstice distribution.

Index


Code Index:

NAME

Top

Solstice::View::Application - The application wide view (boilerplate) for a Solstice application.

SYNOPSIS

Top

  use Solstice::View::Application;

  my $app_view = new Solstice::View::Application();
  my $screen = "";
  $app_view->paint($screen);

DESCRIPTION

Top

The main application view for Solstice. This view is simply an HTML framework to build the Solstice application on. It combines the views of other Solstice components to create the Solstice look and feel.

Superclass

Solstice::View.

Export

No symbols exported.

Methods

new($application)

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

Private Methods

_getTemplateParams()
setDocumentTitle($document_title)

Set the HTML 'title' tag value to $document_title.

getDocumentTitle()

Returns the HTML 'title' tag value.

Modules Used

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

AUTHOR

Top

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

VERSION

Top

$Revision: 3385 $

COPYRIGHT

Top


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

# $Id: Application.pm 3385 2006-05-17 23:16:52Z mcrawfor $

use 5.006_000;
use strict;
use warnings;

use base qw(Solstice::View);

use Solstice::Application;
use Solstice::NamespaceService;
use Solstice::Server;
use Solstice::Session;
use Solstice::StringLibrary qw(unrender);

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

use constant TRUE  => 1;
use constant FALSE => 0;

our ($VERSION) = ('$Revision: 3385 $' =~ /^\$Revision:\s*([\d.]*)/);

sub new {
    my $obj = shift;
    my $self = $obj->SUPER::new(@_);

    $self->_setTemplatePath('templates');
    $self->_setTemplate(TEMPLATE);

    return $self;
}

sub setEscapeFrames {
    my $self = shift;
    $self->{'_escape_frames'} = shift;
}

sub getEscapeFrames {
    my $self = shift;
    return $self->{'_escape_frames'};
}

sub _getTemplateParams {
    my $self = shift;

    my $ns_service      = Solstice::NamespaceService->new();
    my $include_service = $self->getIncludeService();
    my $onload_service  = $self->getOnloadService();
    my $app_config = $self->getConfigService($ns_service->getAppNamespace());
    my $app_virtual_root = $app_config->getAppURL();
    my $session = Solstice::Session->new();

    # Add the current application includes
    $include_service->addApplicationIncludes($ns_service->getAppNamespace());
    
    my %params = $self->processChildViews();

    # Process the javascript includes 
    my @js_includes = map { {src => $_} } @{$include_service->getJavascriptIncludes()};
    
    # Process the css includes
    my @css_includes = map { {src => $_} } @{$include_service->getCSSIncludes()};

    # Onload events
    if ($session->getSubsessionID()) {
        $onload_service->addEvent(
            'Solstice.Remote.run(\'Solstice\', \'subsession_check\', {\'subsession\': solstice_subsession, \'chain_id\': solstice_subsession_chain })'
        );
    }
    my @onload_events = map { {event => $_} } @{$onload_service->getEvents()};

    my $server = Solstice::Server->new();

    return {
        %params,
        document_lang       => 'en', 
        document_title      => $self->getDocumentTitle(), 
        document_base       => $self->getBaseURL(), 
        document_script     => \@js_includes,
        document_stylesheet => \@css_includes,
        development_mode    => $app_config->getDevelopmentMode() || FALSE,
        onload_events       => \@onload_events,
        session_app_key     => $self->getSessionAppKey(),
        subsession_id       => $session->getSubsessionID(),
        chain_id            => $session->getSubsessionChainID(),
        uri                 => $server->getURI(), 
        escape_frames       => $self->getEscapeFrames(),
        app_path            => $app_virtual_root,
    };
}


sub setDocumentTitle {
    my $self = shift;
    $self->{'_document_title'} = shift;
}

sub getDocumentTitle {
    my $self = shift;
    return unrender($self->getIncludeService()->getPageTitle() || $self->{'_document_title'});
}



sub setSessionAppKey {
    my $self = shift;
    $self->{'_session_app_key'} = shift;
}


sub getSessionAppKey {
    my $self = shift;
    return $self->{'_session_app_key'};
}


1;

__END__