NAME
XAO::DO::Web::Utility - Miscellaneous utility displayable functions
SYNOPSIS
Currently is only useful in XAO::Web site context.
DESCRIPTION
This is a collection of various functions that do not fit well into other objects and are not worth creating separate objects for them (at least at present time).
METHODS
Utility object is based on Action object (see XAO::DO::Web::Action) and therefor what it does depends on the "mode" argument.
For each mode there is a separate method with usually very similar name. See below for the list of mode names and their method counterparts.
- 'tracking-number' => tracking_number (%)
-
Displays tracking URL for given carrier and tracking number.
Arguments are "carrier" and "tracknum". Supported carriers are:
'usps'
'ups'
'fedex'
'dhl'
'yellow' (see http://www.yellowcorp.com/)
Example:
<%Utility mode="tracking-url" carrier="usps" tracknum="VV1234567890"%>
Would display:
http://www.framed.usps.com/cgi-bin/cttgate/ontrack.cgi?tracknbr=VV1234567890
- 'config-param' => config_param (%)
-
Displays site configuration parameter with given "name". Example:
<%Utility mode="config-param" name="customer_support" default="aa@bb.com"%>
Would display whatever is set in site's Config.pm modules for variable "customer_support" or "aa@bb.com" if it is not set.
- 'pass-cgi-params' => pass_cgi_params (%)
-
Builds a piece of HTML code containing current CGI parameters in either form or query formats depending on "result" argument (values are "form" or "query" respectfully).
List of parameters to be copied must be in "params" arguments and may end with asterisk (*) to include parameters by template. In addition to that you can exclude some parameters that wer listed in "params" by putting their names (or name templates) into "except" argument.
Form example:
<FORM METHOD="GET"> <%Utility mode="pass-cgi-params" result="form" params="aa,bb,cc"%> <INPUT NAME="dd"> </FORM>
Would produce:
<FORM METHOD="GET"> <INPUT TYPE="HIDDEN" NAME="aa" VALUE="current value of aa"> <INPUT TYPE="HIDDEN" NAME="bb" VALUE="current value of bb"> <INPUT TYPE="HIDDEN" NAME="bb" VALUE="current value of cc"> <INPUT NAME="dd"> </FORM>
Actual output would be slightly different because no carriage return symbol would be inserted between hidden <INPUT> tags. This is done for rare situations when your code is space sensitive and you do not want to mess it.
Query example:
<A HREF="report.html?sortby=price&<%Utility mode="pass-cgi-params" result="query" params="*" except="sortby" %>">Sort by price</A>
If current page arguments were "sku=123&category=234&sortby=vendor" then the output would be:
<A HREF="report.html?sortby=price&sku=123&category=234">Sort by price</A>
All special symbols in parameter values would be properly escaped, you do not need to worry about that.
- 'current-url' => show_current_url ()
-
Prints out current page URL without parameters. Accepts the same arguments as Page's pageurl method and displays the same value.
- 'base-url' => show_base_url ()
-
Prints out base site URL without parameters. Accepts the same arguments as Page's base_url() method and displays the same value.
- 'show-pagedesc' => show_pagedesc (%)
-
Displays value of pagedesc structure (see symphero.pl) with the given "name". Default name is "fullpath". Useful for processing tree-to-object mapped documents.
- 'select-time-range' => select_time_range(%)
-
Displays a list of <OPTION ...> tags for the given time range.
Exact output depends on "type" argument that can only be "quarters" currently.
Two more arguments "start" and "end" set start and end date for the time range. The format is YYYY-Q, where YYYY is a year in four digits format and Q is quarter number from 1 to 4.
Special argument "current" will have select_time_range() add "SELECTED" option to the appropriate entry in the final list. The format is the same as for "start" and "end". If "end" is not set current date is assumed.
Default sorting is from most recent down, but this can be changed with non-zero "ascend" argument.
Example:
<SELECT NAME="qqq"> <%Utility mode="select-time-range" type="quarters" start="2000-1" current="2000-3"%> </SELECT>
Would produce something like:
<SELECT NAME="qqq"> <OPTION VALUE="2001-1">2001, 1-st Qtr <OPTION VALUE="2000-4">2000, 4-th Qtr <OPTION VALUE="2000-3" SELECTED>2000, 3-rd Qtr <OPTION VALUE="2000-2">2000, 2-nd Qtr <OPTION VALUE="2000-1">2000, 1-st Qtr </SELECT>
EXPORTS
Nothing.
AUTHOR
Copyright (c) 2000-2001 XAO Inc.
Andrew Maltsev <am@xao.com>.
SEE ALSO
Recommended reading: XAO::Web, XAO::DO::Web::Page.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 457:
You forgot a '=back' before '=head1'