Name

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

Version

0.1.$Revision: 562 $

Synopsis

package MyApp;

use Catalyst qw(ConfigComponents);

# In the application configuration file
<component name="Model::Navigation">
   <base_class>CatalystX::Usul::Model::Navigation</base_class>
</component>

Description

Provides methods for creating navigation links and access control

Subroutines/Methods

access_check

$state = $c->model( q(Navigation) )->access_check( @args );

Expects to be passed the stash ($c->stash), a key to search in the stash ($args[0]) and a level or room to search for ($args[1]). It returns 0 if the ACL on the requested level/room 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 level/room'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 level/room

This method is called from /get_main_menu (via the /allowed method which negates the result) to determine which levels the current user has access to. It is also called by /auto to determine if access to the requested endpoint 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

$c->model( q(Navigation) )->form( $level, $room );

Stuffs the stash with the data for the form that controls access to levels and rooms

add_header

$c->model( q(Navigation) )->add_header;

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

Calls "get_main_menu". This is the main navigation menu

Calls get_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

Calls get_tools_menu

add_menu_back

$c->model( q(Navigation) )->add_menu_back( $args );

Adds a history back link to the main navigation menu

add_menu_blank

$c->model( q(Navigation) )->add_menu_blank( $args );

Adds some filler to the main navigation menu

add_menu_close

$c->model( q(Navigation) )->add_menu_close( $args );

Adds a window close link to the main navigation menu

allowed

$bool = $c->model( q(Navigation) )->allowed( @args );

Negates the result returned by "access_check". Called from "get_main_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

append_to_selected

$c->model( q(Navigation) )->append_to_selected( $menu_num, $string );

Concats additional string onto the end of the currently selected menu item's href

get_main_menu

$c->model( q(Navigation) )->get_main_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

$links = $c->model( q(Navigation) )->get_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

get_tools_menu

$c->model( q(Navigation) )->get_tools_menu;

Returns the stash data for the tools 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

push_menu_item

$c->model( q(Navigation) )->push_menu_item( $name, $order, $ref );

Pushes an anchor widget $ref onto a menu structure

retrieve

$data = $c->model( q(Navigation) )->retrieve;

Called by "sitemap" this method generates the table data used by HTML::FormWidgets

room_manager_form

$c->model( q(Navigation) )->room_manager( $level, $room );

Allows for editing of the level and room definition elements in the configuration files

select_this

$c->model( q(Navigation) )->select_this( $menu_num, $order, $widget );

Make the widget the selected menu item

sitemap

$c->model( q(Navigation) )->sitemap;

Displays a table of all the pages on the site

unshift_menu_item

$c->model( q(Navigation) )->unshift_menu_item( $name, $order, $widget );

Unshift an anchor widget onto a menu structure

Diagnostics

None

Configuration and Environment

None

Dependencies

CatalystX::Usul::Model
CatalystX::Usul::Table

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