Name
CatalystX::Usul::View::HTML - Render a page of HTML or XHTML
Version
0.8.$Revision: 1319 $
Synopsis
use CatalystX::Usul::Moose;
extends qw(CatalystX::Usul::View);
Description
Generate a page of HTML or XHTML using Template Toolkit and the contents of the stash
Configuration and Environment
Defines the following list of attributes
- css_paths
-
Defaults to an empty hash ref. Populated by "COMPONENT"
- default_css
-
Basename of the file containing the CSS for the generated page. Defaults to
presentation
- default_jscript
-
Basename of the file containing the Javascript used to modify the default behaviour of the browser. Defaults to
behaviour
- default_template
-
Basename of the Template::Toolkit file used to generate the page. Defaults to
layout
- font_extension
-
String appended to font names to create a font filename. Defaults to .typeface.js
- fonts_dir
-
Name of the directory that contains the JavaScript font replacement files. Defaults to
fonts
- fonts_jscript
-
Defaults to an empty hash ref. Populated by "COMPONENT" it maps font names to the pathnames
- form_sources
-
An array ref the overrides the list in the parent class. Contains the stash keys that are searched for widget definitions
- js_for_skin
-
Defaults to an empty hash ref. Populated by "COMPONENT" it maps skin names onto paths for the behaviour class library
- jscript_dir
-
A required directory that contains all of the JavaScript class libraries (except for the one in the skin directory)
- jscript_path
-
A partial path used to construct uris to the JavaScript class libraries. Defaults to static/jscript
- lang_dep_jsprefixs
-
Defaults to an empty array ref. Populated in the component configuration it lists the additional directories to search for language dependent JavaScript files
- lang_dep_jscript
-
Defaults to an empty hash ref. Populated by "COMPONENT" it maps the language dependent JavaScript filenames to pathnames
- lang_dir
-
A string which defaults to
lang
. It is the name of the directory that contains the language dependent JavaScript files - optional_js
-
Defaults to an empty array ref. Populated by "COMPONENT" it lists JavaScript class library files which can be optionally included on a page
- static_js
-
Defaults to an empty array ref. Populated by "COMPONENT" it lists JavaScript class library files which will be included on every page
- target
-
A string which defaults to
top
. The HTML window target - template_extension
-
String which defaults to .tt. The extension applied to Template::Toolkit files
- templates
-
Defaults to an empty hash ref. Populated by "COMPONENT" it caches the per page custom templates
- view_tt
-
An instance of Catalyst::View::TT
Subroutines/Methods
COMPONENT
Looks up and caches CSS, Javascript and template files rather than test for their existence with each request
bad_request
Adds the provided error message to the result div after prepending a stock phrase specific to the failed action
deserialize
Dummy method, does nothing in this view
get_verb
Returns the _method parameter from the query which is used by the action class to lookup the action to forward to. Called from the begin
method once the current view has been determined from the request content type
not_implemented
Proxy for "bad_request"
process
Calls "_fix_stash", _build_widgets
, "_setup_css" and "_setup_jscript" before calling Template::Toolkit via the parent class. Will also call "_fillform" if the override attribute was set in the stash to indicate an error. Encodes the response body using the currently selected encoding
_build_widgets
in CatalystX::Usul::View is passed those parts of the stash that might contain widget definitions which it renders as HTML or XHTML
Private Methods
_fillform
Uses HTML::FillInForm to fill in the response body from the request parameters
_fix_stash
Adds some extra entries to the stash
- template
-
Detects and loads a custom template if one has been created for this page
- target
-
Sets the target for this page in the headers
_setup_css
For the selected skin sets up the data for the main CSS link and the alternate CSS links if any exist
_setup_jscript
For the selected skin adds it's Javascript file to the list files that will be linked into the page
Diagnostics
None
Dependencies
- Catalyst::View::TT
- CatalystX::Usul::View
- CatalystX::Usul::Moose
- Encode
- CatalystX::Usul::Constraints
- File::DataClass::IO
- HTML::FillInForm
- TryCatch
Incompatibilities
There are no known incompatibilities in this module
Bugs and Limitations
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Author
Peter Flanigan, <Support at RoxSoft.co.uk>
License and Copyright
Copyright (c) 2013 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE