autohandler.mc - Base Mason component
autohandler.mc is base Mason component for entire ePortal site.
Attributes are defined via <attr> mason tag:
<%attr> Attribute => value </%attr>
This is title for the page. This title is used for <TITLE> HTML tag and displayed at top of every ePortal's page.
This attribute is used for static Title. For dynamic Title see Title
method
May be 1 or 0. Default is 0.
Used for popup windows. No windows caption, no APP bar, no menus.
There are some attributes to control directory browsing process. Browsing is go when no index.htm file in directory.
Enable or disable directory browsing. Default is 1. Is browsing is disabled then redirect to /errors/not_found.htm is done.
Show or not ..
at top of list of files.
Should be sub ref. Two arguments ($a,$b) are passed to sub which both are absolute filenames.
How to discover a description of a file? May be HASH with filenames or sub
ref. Two arguments (absolute_filename,filename)
are passed to sub.
The default is \&ePortal::Utils::filter_auto_title
How many columns and which to show? This is array ref. Possible values are: /icon name size modified description/
Array ref with regexs. First all dir_include regexs work then dir_exclude. Default is to include all files.
How to title the directory listing? Default is directory name.
You always may restrict access to some pages with a help of .htaccess. Use
require
directives to to this.
Here is another way to do this. You may use the following attributes in pages or directory autohandlers to restrict access to some parts of your site.
Attributes are processed in given order. If any of them are true then access is allowed else redirect is made to /errors/require_xxx.htm page.
Requre user to be registered. Deny access for anonymous users.
Require user to be registered and be listed. Argument if array ref to list of valid user names.
Require user to be registered and be member of a group. Argument if array ref to list of valid group names.
Require user to be registered and be an admin.
You may overload some autohandler's method to add more functionality to a page.
<%method method_name> .. your code goes here return "something"; </%method>
Overloaded parent can be called as
<& PARENT:method_name, %ARGS &>
Add any HTML text to put in <HEAD> section of HTML page.
This method is called just after request processing preparation (check user, etc.) but before any content is sent to client. This method is useful for client events processing and handling redirects.
Any string returned is passed to redirect.mc to do external redirect.
This is the same functionality as Title
attribute. This method is used
to make the Title be dynamic not static.
This is very last part of screen. Useful to show copyright messages
This method is used to show a menu on the left side of the screen. It returns an array or pairs.
<% method MenuItems> % return [ ['menu1' => 'http://...'], ['---' => '---'], ['html' => '<b>this is HTML</b>'] ]; </%method>
Every pair may be any of the following
username
to be registered to see next items.
groupname
to see next items.
Some arguments names are reserved for internal purposes. Here are:
ref($object)
in Perl.
calendar
component
list
component.
Sergey Rusakov, <rusakov_sa@users.sourceforge.net>