NAME
FWS::V2::Format - Framework Sites version 2 text and html formatting
VERSION
Version 0.003
SYNOPSIS
use FWS::V2;
my $fws = FWS::V2->new();
my $tempPassword = $fws->createPassword( lowLength => 6, highLength => 8);
my $newGUID = $fws->createGUID();
DESCRIPTION
Framework Sites version 2 methods that use or manipulate text either for rendering or default population.
METHODS
createGUID
Return a non repeatable Globally Unique Identifier to be used to populate the guid field that is default on all FWS tables.
#
# retrieve a guid to use with a new record
#
my $guid = $fws->createGUID();
In version 2 all GUID's have a prefix, if not specified it will be set to 'd'. There should be no reason to use another prefix, but if you wish you can add it as the only parameter it will be used. In newer versions of FWS the prefix will eventually be deprecated and is only still present for compatibility.
createPin
Return a short pin for common data structures.
#
# retrieve a guid to use with a new record
#
my $pin = $fws->createPin();
This pin will be checked against the directory, and profile tables to make sure it is not repeated and by default be 6 characters long with only easy to read character composition (23456789QWERTYUPASDFGHJKLZXCVBNM).
createPassword
Return a random password or text key that can be used for temp password or unique configurable small strings.
#
# retrieve a password that is 6-8 characters long and does not contain commonly mistaken letters
#
my $tempPassword = $fws->createPassword(
composition => "abcedef1234567890",
lowLength => 6,
highLength => 8);
If no composition is given, a vocal friendly list will be used: qwertyupasdfghjkzxcvbnmQWERTYUPASDFGHJKZXCVBNM23456789
dateTime
Return the date time in a given format. By passing epochTime, SQLTime you can do a time conversion from that date/time to what ever format is set to. If you do not pass epoch or SQL time the server time will be used.
#
# get the current Date in SQL format
#
my $currentDate = $fws->dateTime(format=>'date');
#
# convert SQL formated date time to a human form
#
my $humanDate = $fws->dateTime(SQLTime=>'2012-10-12 10:09:33',format=>'date');
By passing monthMod or dayMod you can adjust the month forward or backwards by the given number of months or days
#
# 3 months from today (negative numbers are ok)
#
my $threeMonths = $fws->dateTime(format=>'date',monthMod=>3);
Possible Parameters:
format
Format type to return. This is the only required field
epochTime
epoch time which could be created with time()
monthMod
modify the current month ahead or behind. (Note: If your current day is 31st, and you mod to a month that has less than 31 days it will move to the highest day of that month)
dayMod
modify the current day ahead or behind.
dateSeperator
This will default to '-', but can be changed to anything. (Note: Do not use this if you are returing SQLTime format)
GMTOffset
Time zone modifier. Example: EST would be -5
SQLTime
Use an SQL time format as the incomming date and time.
The following types of formats are valid:
date
mm-dd-yyyy
time
hh:mmAM XXX
fancyDate
weekdayName, monthName dd[st|nd|rd] of yyyy
cookie
cookie compatible date/time
apache
apache web server compatible date/time
number
yyyymmddhhmmss
dateTime
mm-dd-yyyy hh:mmAM XXX
dateTimeFull
mm-dd-yyyy hh:mm:ss XXX
SQL
yyyy-mm-dd hh:mm:ss
epoch
Standard epoch number
yearFirstDate
yyyy-mm-dd
formatCurrency
Return a number in USD Format.
print $fws->formatCurrency(33.55);
justFileName
Return just the file name when given a full file path
my $fileName = $fws->justFileName('/this/is/not/going/to/be/here/justTheFileName.jpg');
jqueryEnable
Add FWS core distribution jQuery modules and corresponding CSS files to the CSS and JS cached files. These are located in the /fws/jquery directory. The naming convention for jQuery files are normalized and only the module name and version is required.
#
# if the module you were loadings file name is:
# jquery-WHATEVERTHEMODULEIS-1.1.1.min.js
# it would be loaded via jqueryEnable as follows:
#
$fws->jqueryEnable('WHATEVERTHEMODULEIS-1.1.1');
This method ensures jQuery files are only loaded once, and the act of any jQuery module being enabled will auto-activate the core jQuery library. They will be loaded in the order they were called from any element in the rendering process.
popupWindow
Create a link to a popup window or just the onclick. Passing queryString is requried and pass linkHTML if you would like it to be a link.
$valueHash{'html'} .= $fws->popupWindow(queryString=>'p=somePage',$linkHTML=>'Click Here to go to some page');
NOTE: This should only be used in the context of the FWS Administration, and is only here as a reference for modifiers of the admin.
removeHTML
Return a string minus anything that is in < >.
$safeForText = $fws->removeHTML('<a href="somelink.html">This is the text that will return without the anchor</a>');
FWS ADMIN METHODS
These methods are used only by FWS Admin maintainers. They should not be used out of the context of the FWS Admin as they could change without warning.
adminField
Return an edit field or field block for the FWS Admin. The adminField method is a very configurable tool used by the FWS administration maintainers.
#
# Create a admin edit field
#
$valueHash{'html'} .= $fws->adminField( %paramHash );
NOTE: This should only be used in the context of the FWS Administration, and is only here as a reference for modifiers of the admin.
adminPageHeader
Return a standard HTML admin header for admin elements that open in new pages.
#
# Header for an admin page that opens in a new window
#
$valueHash{'html'} .= $fws->adminPageHeader( name =>'Page Name in the upper right',
rightContent =>'This will show up on the right,
usually its a saving widget',
title =>'This is title on the left, it will
look just like a panel title',
icon =>'somethingInTheFWSIconDirectory.png');
NOTE: This should only be used in the context of the FWS Administration, and is only here as a reference for modifiers of the admin.
tabs
Return jQueryUI tab html. The tab names, tab content, tinyMCE editing field name, and any javascript for the tab onclick is passed as arrays to the method.
#
# add the data to the tabs and panels to the HTML
#
$valueHash{'html'} .= $self->tabs( id =>'theIdOfTheTabContainer',
tabs =>[@tabArray],
tabContent =>[@contentArray],
tabJava =>[@javaArray],
# tinyMCE paramaters - usualy only for dynamic edit
# modals and tabs.
tabFields =>[@fieldArray],
guid =>'someGUIDforTinyMCEEdits',
);
NOTE: This should only be used in the context of the FWS Administration, and is only here as a reference for modifiers of the admin.
AUTHOR
Nate Lewis, <nlewis at gnetworks.com>
BUGS
Please report any bugs or feature requests to bug-fws-v2 at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=FWS-V2. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc FWS::V2::Format
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
LICENSE AND COPYRIGHT
Copyright 2012 Nate Lewis.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.