Peter Flanigan > CatalystX-Usul-0.17.1 > CatalystX::Usul::Model::Navigation

Download:
catalystx-usul/CatalystX-Usul-0.17.1.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: v0.17.1   Source  

Name ^

CatalystX::Usul::Model::Navigation - Navigation links and access control

Version ^

Describes v0.17.$Rev: 1 $

Synopsis ^

   package YourApp;

   use Catalyst qw(ConfigComponents...);

   __PACKAGE__->config(
     'Model::Navigation' => {
        parent_classes   => q(CatalystX::Usul::Model::Navigation) }, );

Description ^

Provides methods for creating navigation links and access control

Configuration and Environment ^

Defines the following list of attributes

action_class

A non empty simple string which defaults to Config::Rooms, the name of the model used to manage defined actions

action_source

A non empty simple string which defaults to action, the stash key where action definitions are stored

default_action

A non empty simple string which defaults to redirect_to_default. Each controller implements this action. It redirects to the controllers default action

menu_link_class

A non empty simple string which defaults to menu_link fade. The classes on the markup for a navigation link

menu_selected_class

A non empty simple string which defaults to menu_selected fade. The classes on the markup for the selected navigation link

menu_title_class

A non empty simple string which defaults to menu_title fade. The classes on the markup of the not selected navigation links

namespace_source

A non empty simple string which defaults to namespace. The stash key where the namespace/controller definitions are stored

namespace_tag

A non empty simple string which defaults to ..Level... A popup menu selection option used to selected namespace/controller operations

skins

A required array ref. A list of the available skins/themes

user_level_access

A boolean which defaults to false. It true then access to actions can be set for individual users, not just groups of users. Slows things down a lot

Subroutines/Methods ^

COMPONENT

   $navigation_model_object = $self->COMPONENT( $app, $attributes );

Called by Catalyst when the application starts it sets the default action from global config and sets up the list of available skins

access_check

   $state = $self->access_check( $source, $key );

Expects to be passed a key to search in the stash ($source) and a controller or action to search for ($key). It returns 0 if the ACL on the requested controller/action permits access to the current user. It returns 1 if no ACL was found. It returns 2 if the current user is unknown and the controller/action's ACL did not contain the value any which would permit anonymous access. It returns 3 if the current user is explicitly denied access to the selected controller/action

This method is called from "add_nav_menu" (via the "allowed" method which negates the result) to determine which controllers the current user has access to. It is also called by auto to determine if access to the requested action is permitted

It could also be used from an application controller method to allow the display logic to display content based on the users identity

access_control_form

   $self->form( $namespace, $name );

Stuffs the stash with the data for the form that controls access to controllers and actions

add_menu_back

   $self->add_menu_back( { tip => $title_text } );

Adds a history back link to the main navigation menu

add_menu_blank

   $self->add_menu_blank;

Adds some filler to the main navigation menu

add_menu_close

   $self->add_menu_close( $args );

Adds a window close link to the main navigation menu

add_nav_header

   $self->add_nav_header;

Calls parent method. Adds main and tools menu data. Adds quick link data

Calls "add_nav_menu". This is the main navigation menu

Calls "add_utils_menu"

Calls add_quick_links. Quick links appear in the header and are selected from the rooms config items if the quick_link element is set. It's numeric value determines the sort order of the links

add_nav_menu

   $self->add_nav_menu;

Returns the data used to generate the main navigation menu. The menu uses a Cone Trees layout which has been flattened to produce a visual trail of breadcrumbs effect, i.e. Home > Reception > Tutorial

add_navigation_sidebar

   $panel_number = $self->add_navigation_sidebar;

Adds a sidebar panel containing a tree widget that represents all the action available in the application (another sitemap)

add_quick_links

   $links = $self->add_quick_links;

Returns the data used to display "quick" navigation links. Caches data on first use. These usually appear in the header and allow single click access to any endpoint. They are identified in the configuration by adding a quick_link attribute to the rooms element. The quick_link attribute value is an integer which determines the display order

add_utils_menu

   $self->add_utils_menu;

Returns the stash data for the utilities menu. This contains a selection of utility options including: toggle runtime debugging, toggle footer, skin switching, context sensitive help, about popup, email feedback and logout option. Calls "_add_help_menu" and "_add_tools_menu"

allowed

   $state = $self->allowed( $source, $key );

Negates the result returned by "access_check". Called from "add_nav_menu" to determine if a page is accessible to a user. If the user does not have access then do not display a link to it

app_closed_form

   $self->app_closed_form;

Allows administrators to authenticate and reopen the application

load_status_msgs

   $self->load_status_msgs;

Calls Catalyst::Plugin::StatusMessage to load the stash with the status and error messages from the previous request (oops there goes HTTP's statelessness). Stuffs the messages back into the stash so that they appear in the results div

navigation_sidebar_form

   $self->navigation_sidebar_form;

Calls "_get_tree_panel_data" and creates a tree widget using the data. Implements the navigation sidebar

room_manager_form

   $self->room_manager_form( $namespace, $name );

Allows for editing of the controller and action definition elements in the configuration files

select_this

   $self->select_this( $menu_no, $order, $widget );

Make the widget the selected menu item

sitemap_form

   $self->sitemap_form;

Displays a table of all the pages on the site

Private Methods ^

_add_help_menu

   $self->_add_help_menu( $name, $stack, $menu_no );

Stashes the data for the help menu options

_add_tools_menu

   $self->_add_tools_menu( $name, $stack, $menu_no );

Utility menu options

_get_tree_panel_data

   $data = $self->_get_tree_panel_data;

Called by "sitemap" this method generates the table data used by HTML::FormWidgets's Tree subclass

_get_sitemap_data

   $data = $self->_get_sitemap_data;

Called by "sitemap" this method generates an array of hash refs used by HTML::FormWidgets's TabSwapper subclass

_get_sitemap_table

   $data = $self->_get_sitemap_table( $ns );

Called by "_get_sitemap_data" this method generates the table data used by HTML::FormWidgets's Table subclass

_push_menu_link

   $self->_push_menu_link( $name, $order, $ref );

Pushes an anchor widget $ref onto a menu structure

_unshift_menu_item

   $self->_unshift_menu_item( $name, $order, $widget );

Unshift an anchor widget onto a menu structure

Diagnostics ^

None

Dependencies ^

CatalystX::Usul::Model
CatalystX::Usul::TraitFor::Model::StashHelper
CatalystX::Usul::Moose
Class::Usul::Response::Table
File::DataClass::IO

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) 2014 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

syntax highlighting: