fapi

fapi

fapi

The API for all things FarCry

Metadata

addProfilePoint()

If profiling is enabled, adds a point to the request profile

Arguments

Name Type Required Default Options Description
section string Yes The name of point grouping
label string Yes The name of the profile point

addRequestLog()

Adds an item to the request log

Arguments

Name Type Required Default Options Description
text string Yes The text of the log line

array()

Corrects a URL with the specified query string values removed, replaced, or added. New values can be specified with a query string, struct, or named arguments. Also fixes friendly url query variables.

Examples

Create and populate an array:
<cfdump var="#application.fapi.array(5,"How now brown cow",url)#" />

Arguments

Name Type Required Default Options Description
None

arrayFind()

Corrects a URL with the specified query string values removed, replaced, or added. New values can be specified with a query string, struct, or named arguments. Also fixes friendly url query variables.

Examples

Search an array:
<cfset a = application.fapi.array(4,3,2,1) />
<cfdump var="#application.fapi.arrayFind(a,2)#" />

Arguments

Name Type Required Default Options Description
ar array Yes The array to search
value Any Yes The value to find

arrayRemove()

Corrects a URL with the specified query string values removed, replaced, or added. New values can be specified with a query string, struct, or named arguments. Also fixes friendly url query variables.

Examples

remove items from an array:
<cfset a = application.fapi.array(4,3,2,1) />
<cfdump var="#application.fapi.arrayRemove(a,'2,3')#" />

Arguments

Name Type Required Default Options Description
array array Yes The array to remove elements from
elements Any Yes The elements in the array to remove. Can be an array or a list.

checkCatID()

Returns true if the category alias is found.

Arguments

Name Type Required Default Options Description
alias String Yes The category alias

checkNavID()

Due to restrictions across the various databases FarCry supports, null dates are NOT supported. To deal with this the formtools have been designed to use certain dates as null. Pass a date into this function to determine if it is a FarCry null date.

Examples

Link to the archive navigation node if it has been defined:
<cfif not application.fapi.checkNavID("archive")>
    <skin:buildLink objectid="#application.fapi.getNavID("archive")#">Archive</skin:buildLink>
</cfif>

Arguments

Name Type Required Default Options Description
alias String Yes The navigation alias

checkObjectPermission()

Retrieve the properties of the selected object after an objectadmin action.

Examples

If the user can access a node, show a link to it:
<cfif application.fapi.checkObjectPermission(application.fapi.getNavID("archives","home"),"View")>
    <skin:buildLink objectid="#application.fapi.getNavID("archives","home")#">Archives</skin:buildLink>
</cfif>

Arguments

Name Type Required Default Options Description
objectid String Yes
permission String Yes
role String No Defaults to the currently logged in users assigned roles

checkPermission()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Show a link to the webtop if the current user has permission to access it:
<cfif application.fapi.checkPermission("Admin")>
    <a href="#application.url.webtop#/">Webtop</a>
</cfif>

Arguments

Name Type Required Default Options Description
permission String Yes
role String No Defaults to the currently logged in users assigned roles

checkTypePermission()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Include a webskin if the user has permission to add a news item:
<cfif application.fapi.checkTypePermission("dmNews","Create")>
    <skin:view typename="dmNews" webskin="displayAddNewsForm" />
</cfif>

Arguments

Name Type Required Default Options Description
typename String Yes
permission String Yes
role String No Defaults to the currently logged in users assigned roles

checkWebskinPermission()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Only show a link if the user has permission to view the webskin:
<cfif application.fapi.checkWebskinPermission("dmProfile", "displaySensitiveDetails")>
    <skin:buildLink type="dmProfile" view="displaySensitiveDetails">Show me everything</a>
</cfif>

Arguments

Name Type Required Default Options Description
type String Yes
webskin String Yes
role String No Defaults to the currently logged in users assigned roles

convertToApplicationTimezone()

Ability to display a date with the offset against local server time. This feature would be especially useful for those people hosting their application on servers where they do not have the ability to change the server clock (e.g shared hosting etc).

Examples

Convert the date stored in the DB to a date that is relevent to the user:
#application.fapi.castOffSetDateTime(stobj.dateTimeLastUpdated)#

Arguments

Name Type Required Default Options Description
date String Yes The date cast offset from system date

convertToSystemTimezone()

Ability to save a date from the offset to the local server time. This feature would be especially useful for those people hosting their application on servers where they do not have the ability to change the server clock (e.g shared hosting etc).

Examples

Convert the date relevent to the user into the date offset to the local server time:
#application.fapi.castSystemDateTime(stobj.dateTimeLastUpdated)#

Arguments

Name Type Required Default Options Description
date String Yes The date to convert to the standard system time

dateToRFC822()

Things like RSS feeds need to have the date displayed in RFC 822 format: Tue, 07 Jul 2009 10:35:38 +0800 This funciton takes a coldfusion date and formats it properly. Note you need to pass in the Timezone either as an offset like "+0800", "-0700", etc or as a string like "EST", "PDT", etc.

Examples

//Current RFC 822 date for Sydney
var mystring = application.fapi.dateToRFC822(now(), "+1000")

Arguments

Name Type Required Default Options Description
dt date Yes [runtime expression]
timezone string Yes +0800

deprecated()

As a core developer you can flag deprecated code by using this function to pass in a depricated message

Arguments

Name Type Required Default Options Description
message String No The message to be logged. Should include instructions for the appropriate best practice to replace the deprecated code.

extends()

Find out if a component is a FarCry content type:

Examples

<cfdump var="#application.fapi.extends(mycomponent path,'farcry.core.packages.types.types')#" />

Arguments

Name Type Required Default Options Description
desc string Yes The component to test
anc string Yes The ancestor to check for

fail()

Returns a standard return structure from a function when it fails

Arguments

Name Type Required Default Options Description
message string No
detail string No
type string No
name string No
errNumber string No
stackTrace string No
tagContext array No [runtime expression]

filterStructure()

Removes specified structure elements

Arguments

Name Type Required Default Options Description
st String Yes The structure to parse
lKeys String Yes A list of structure keys to delete

findType()

The following snippet shows how to get the type of a related content item in a webskin:

Examples

<cfset othertype = application.fapi.findType(stObj.aObjectIDs[1]) />

Arguments

Name Type Required Default Options Description
objectid String Yes

fixURL()

Corrects a URL with the specified query string values removed, replaced, or added. New values can be specified with a query string, struct, or named arguments. Also fixes friendly url query variables.

Examples

Refresh the current FarCry page:
<cflocation url="#application.fapi.fixURL()#" />
Remove a query variable from a custom URL:
<cfset formurl = application.fapi.fixURL(removevalues="searchstring") />
Remove your own query variables as well as FarCry query variables:
<cfset docs = application.fapi.fixURL(removevalues="+searchstring") />
Replace or add query variables by specifying a query string:
<cfset nextpage = application.fapi.fixURL(addvalues="page=#url.page+1#") />
Replace or add query variables by specifying a struct:
<cfset st = structnew() />
<cfset st.a = 1 />
<cfset st.b = black />
<cfset newpage = application.fapi.fixURL("/otherpage.cfm?a=9",addvalues=st) />

Arguments

Name Type Required Default Options Description
url string No [runtime expression] The url to use
removevalues string No List of values to remove from the query string. Prefix with '+' to remove these values in addition to the defaults.
addvalues any No A query string or a struct of values, to add to the query string
ampDelim string No & Delimiter to use for ampersands
charset string No utf-8 The character encoding in which the url values are encoded.

flushCache()

Provides date formatting in the style of Twitter's timeline: "just now", "5 minutes ago", "yesterday", "2 weeks ago".

Examples

Searches project, plugins and core and returns the url for the best matching icon.
#application.fapi.getIconURL(icon='dmHTML', size=16)# 

Arguments

Name Type Required Default Options Description
lTypes string Yes [runtime expression] typenames to flush

getCatID()

Returns the objectID of the dmCategory record for the passed alias. If the alias does not exist, the alternate alias will be used.

Arguments

Name Type Required Default Options Description
alias String Yes The navigation alias
alternateAlias String No root

getComponents()

Get a list of all the components in types:

Examples

<cfoutput>#application.fapi.getComponents("types")#</cfoutput>

Arguments

Name Type Required Default Options Description
package string Yes
locations string No

getConfig()

Due to restrictions across the various databases FarCry supports, null dates are NOT supported. To deal with this the formtools have been designed to use certain dates as null. Pass a date into this function to determine if it is a FarCry null date.

Examples

Retrieve a config value:
<cfmail to="[email protected]" to="#application.fapi.getConfig('admin','adminemail')#" subject="Hello">
    Hello world.
</cfmail>

Arguments

Name Type Required Default Options Description
key String Yes The Config Key identifying the config form the property is located in.
name String Yes The name of the config property you wish to retrieve a value for.
default String No If the config item is not found, use this as the default.

getContentObject()

Allows you to fetch a ContentObject. This is functionally the same as doing: getContentType("mytype").getData(objectid); however, using this method allows you to get the ContentObject structure without having to know the type.

There is some performace overhead when you get a ContentObject without knowing the type (requires more database lookups). So, if possible, it is better to use getContentType("type").getData(objectid).

Examples

Retrieve the properties of the selected object after an objectadmin action:
<cfset stObj = application.fapi.getContentObject(form.selectedobjectid,"thistype") />

Arguments

Name Type Required Default Options Description
objectid UUID Yes The objectid for which object is to be found
typename string No The typename of the objectid. Pass in to avoid having to lookup the type.

getContentObjects()

Allows you to fetch a set of content types by specifying filters, status and order.

Examples

Retrive the objectids of all visible news, ordered by published date:
<cfset qNews = application.fapi.getContentObjects(typename="dmNews",publishdate_lt=now(),expirydate_gt=now(),orderby="publishdate desc") />

Arguments

Name Type Required Default Options Description
typename string Yes The name of the content type
lProperties string No objectid The properties to return
status string No [runtime expression] Filter by object status. Only used for content types that support it.
orderBy string No Order by clause
maxRows numeric No -1 Number of records to return

getContentType()

Returns an instantiated content type that is not populated with any data.

Examples

Instantiate a dmFile component:
<cfset oFile = application.fapi.getContentType("dmFile") />

Arguments

Name Type Required Default Options Description
typename string Yes

getContentTypeMetadata()

Returns the value of the metadata for a typename passed in. Omitting the md name, all metadata for the property will be returned.

Arguments

Name Type Required Default Options Description
typename string Yes The typename for which we want metadata for
md string No The name of the piece of metadata we want (optional)
default string No The default value if the metadata does not exist

getCurrentLocale()

Returns the current locale string based on if the client is logged in or not

Arguments

Name Type Required Default Options Description
None

getCurrentUser()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Get the current user:
<cfset stProfile = application.fapi.getCurrentUser() />
<cfif not isstructempty(stProfile)>
    <cfoutput>Hello #stProfile.firstname#</cfoutput>
</cfif>

Arguments

Name Type Required Default Options Description
None

getCurrentUsersProfile()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Get the current logged in users profile:
<cfset stProfile = application.fapi.getCurrentUsersProfile() />
<cfif not isstructempty(stProfile)>
    <cfoutput>Hello #stProfile.firstname#</cfoutput>
</cfif>

Arguments

Name Type Required Default Options Description
None

getDocType()

This function is used to get information about the doctype your application should be generating. This value, by default, uses the application.fc.doctype variable.

The default variable is set in core and is by default the latest version of html (html 4.01 at the time of this writing.). You can change this by setting the application.fc.doctype variable value in your _serverSpecificVars.cfm file.

This turns the doctype tag contents into a struct. The parts you'll likely use, and will be there for sure are:

doctype.typehtml, xhtml
doctype.version1.0, 1.1, 3.2, blank
doctype.subtypeFrameset, Transitional, blank
doctype.uridtd, blank
doctype.tagending/, blank

Example struct output:

		AVAILABILITY     | PUBLIC
		PUBLICIDENTIFIER |
		       | LABEL        | XHTML 1.0 Frameset
		       | LANGUAGE     | EN
		       | ORGANIZATION | W3C
		       | RAW          | -//W3C//DTD XHTML 1.0 Frameset//EN
		       | REGISTRATION | -
		       | TYPE         | DTD
		RAW              | html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
		SUBTYPE          | Frameset
		TOPLEVEL         | html
		TYPE             | XHTML
		URI              | http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd
		VERSION          | 1.0
		TAGENDING		 |	/
		

Examples

<cfdump var="#application.fapi.extends(mycomponent path,'farcry.core.packages.types.types')#" />

Arguments

Name Type Required Default Options Description
docTypeString string No [runtime expression]

getFileWebRoot()

Due to restrictions across the various databases FarCry supports, null dates are NOT supported. To deal with this the formtools have been designed to use certain dates as null. Pass a date into this function to determine if it is a FarCry null date.

Examples

In a webskin output a link for a file property:
<cfif len(stObj.brochure)>
    <cfoutput><a href="#application.fapi.getFileWebRoot()##stObj.brochure#">Brochure</a></cfoutput>
</cfif>

Arguments

Name Type Required Default Options Description
None

getFormtool()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Instantiate a list formtool component:
<cfset oList = application.fapi.getFormtool("list") />

Arguments

Name Type Required Default Options Description
formtool string Yes

getIconURL()

Provides date formatting in the style of Twitter's timeline: "just now", "5 minutes ago", "yesterday", "2 weeks ago".

Examples

Searches project, plugins and core and returns the url for the best matching icon.
#application.fapi.getIconURL(icon='dmHTML', size=16)# 

Arguments

Name Type Required Default Options Description
icon string Yes The name of the icon to retrieve
size string Yes 48 The size of the icon required
default string No blank.png The fallback icon to use
bPhysicalPath boolean No false Use of this argument is usually only for the system to stream the file if outside of the webroot.

getImageWebRoot()

Due to restrictions across the various databases FarCry supports, null dates are NOT supported. To deal with this the formtools have been designed to use certain dates as null. Pass a date into this function to determine if it is a FarCry null date.

Examples

In a webskin output an image tag for an image property:
<cfif len(stObj.logo)>
    <cfoutput><img src="#application.fapi.getImageWebRoot()##stObj.logo#" alt="#stObj.title#" /></cfoutput>
</cfif>

Arguments

Name Type Required Default Options Description
None

Due to restrictions across the various databases FarCry supports, null dates are NOT supported. To deal with this the formtools have been designed to use certain dates as null. Pass a date into this function to determine if it is a FarCry null date.

Examples

Home:
<cfset urlHome = application.fapi.getLink(alias="home") />
A related object:
<cfset urlRelated = application.fapi.getLink(objectid=stObj.relatedIDs[1]) />
An alternative page view of a related object:
<cfset urlRelatedAlternate = application.fapi.getLink(objectid=stObj.aRelatedIDs[2],view="displayPageXML") />
An alternate body of a related object:
<cfset urlRelatedSwitchBody = application.fapi.getLink(objectid=stObj.aRelatedIDs[3],bodyview="displayBodyFullDetail") />
Get a link to a type webskin:
<cfset urlListing = application.fapi.getLink(type="dmNews",bodyview="displayTypeLatest") />

Arguments

Name Type Required Default Options Description
href String No
objectid String No
alias String No
type String No
view String No
bodyView String No
linktext String No
target String No _self
bShowTarget String No false
externallink String No
id String No
class String No
style String No
title String No
urlOnly String No false
r_url String No
xCode String No
includeDomain String No false
Domain String No [runtime expression]
stParameters String No [runtime expression]
urlParameters String No
JSWindow String No 0
stJSParameters String No [runtime expression]
anchor String No
ampDelim string No Delimiter to use for ampersands. Defaults to & except where parameters include ajaxmode

getNavID()

Due to restrictions across the various databases FarCry supports, null dates are NOT supported. To deal with this the formtools have been designed to use certain dates as null. Pass a date into this function to determine if it is a FarCry null date.

Examples

Link to the archive navigation node if it has been defined:
<cfif not application.fapi.checkNavID("archive")>
    <skin:buildLink objectid="#application.fapi.getNavID("archive")#">Archive</skin:buildLink>
</cfif>

Arguments

Name Type Required Default Options Description
alias String Yes The navigation alias
alternateAlias String No home

getNewContentObject()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Retrieve a new content object:
<cfset stObj = application.fapi.getNewContentObject("thistype","key") />

If you want to make sure you keep retrieving the same new object each time until you end up saving to the database, pass in a key.

Arguments

Name Type Required Default Options Description
typename string Yes The typename of the new object to be created.
key string No The key for the new object. Subsequent calls for a new object of the same type will return the same object until it is saved to the database.
stProperties String No [runtime expression] A structure containing default values for the new object.

getPackagePath()

Find the version of a custom component with the most precedence:

Examples

<cfoutput>#application.fapi.getPackagePath("custom","myfactory")#</cfoutput>

Arguments

Name Type Required Default Options Description
package string Yes
component string Yes
locations string No

getProfileHTML()

Returns HTML for displaying the profile

Arguments

Name Type Required Default Options Description
profile query Yes The chart that we want to chart
bLongForm boolean No false

getPropertyMetadata()

Returns the value of the metadata for a typename/property passed in. Omitting the md name, all metadata for the property will be returned.

Arguments

Name Type Required Default Options Description
typename string Yes The typename containing the property
property string Yes The property for which we want metadata for
md string No The name of the piece of metadata we want (optional)
default string No The default value if the metadata does not exist

getRelatedContent()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Fetch all the related image records attached to the current stObj:
<cfset qContent = application.fapi.getRelatedContent(objectid=stobj.objectid, filter='dmImage') />

<cfloop query="qContent">
    <skin:view objectid=qContent.objectid webskin="displayTeaserStandard" />
</cfloop>

Arguments

Name Type Required Default Options Description
objectid uuID Yes The object for which related objects are to be found
typename string No The typename of the objectid. Pass in to avoid having to lookup the type.
filter string No The typename of related objects to find. Empty for ALL typenames.
arrayType string No The typename containing the property that defines the relationship we are looking for
arrayProperty string No The property that defines the relationship we are looking for

getRequestLogHTML()

Returns display for the log

Arguments

Name Type Required Default Options Description
log query Yes The log query to output
bLongForm boolean No false

getResource()

Corrects a URL with the specified query string values removed, replaced, or added. New values can be specified with a query string, struct, or named arguments. Also fixes friendly url query variables.

Examples

Get a translated string:
<cfoutput>#application.fapi.getResource("project.homepage.welcome","Welcome!")#</cfoutput>
Get a simple translated message:
<cfoutput>#application.fapi.getResource("project.homepage.newmessages","You have {1} new messages",5)#</cfoutput>
Get a complex translated message:
<cfoutput>#application.fapi.getResource("project.news.currentpage","Page {1} of {2}",application.fapi.array(3,5))#</cfoutput>

Arguments

Name Type Required Default Options Description
key string Yes
default string No [runtime expression]
substituteValues String No [runtime expression]
locale string No

getUUID()

The native createUUID is very usefull - unfortunately it always takes 10-15ms to run. This is fine for once off calls, but not for the frequent usage that might happen during an import.

This function bypasses that problem by accessing the Java equivilent directly.

Examples

Generating many UUIDs:
<cftimer label="createUUID()" type="inline">
    <cfloop from="1" to="10000" index="i">
        <cfset anotheruuid = createuuid() />
    </cfloop>
</cftimer>

<cftimer label="application.fapi.getUUID()" type="inline">
    <cfloop from="1" to="10000" index="i">
        <cfset anotheruuid = application.fapi.getUUID() />
    </cfloop>
</cftimer>

Arguments

Name Type Required Default Options Description
None

getWebRoot()

Due to restrictions across the various databases FarCry supports, null dates are NOT supported. To deal with this the formtools have been designed to use certain dates as null. Pass a date into this function to determine if it is a FarCry null date.

Examples

Redirect to the project webroot:
<cflocation url="#application.fapi.getWebRoot()#" />

Arguments

Name Type Required Default Options Description
None

getWebskinCacheStatus()

Returns the objectbroker cache status of a webskin. Status can be -1:force ancestors to not cache, 0:do not cache, 1:cache

Arguments

Name Type Required Default Options Description
typename string Yes
template string Yes
path string No
defaultStatus numeric No 0

getWebskinDisplayName()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Returns the display name defined in the webskin:
<cfset application.fapi.getWebskinDisplayName('dmNews', 'displayTeaserStandard') />

Arguments

Name Type Required Default Options Description
typename string Yes
template string Yes
path string No

hasPermission()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Show content if the current user has a specified permission:
<cfif application.fapi.hasPermission("welcomemessage")>
    <p>Welcome back!</p>
</cfif>

Arguments

Name Type Required Default Options Description
permission string No permissions to check

hasRole()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Show a block of content if the current user has a specified role. As seen in the example the "Welcome Back" message is only displayed if the current, view user has been assigned the role of "Member". The "Member" part gets defined in the webtop under "roles" and the value you pass to this function is the Title of the role. In other words, the role you are checking for needs to be setup per installation and is completely user defined.

<cfif application.fapi.hasRole("Member")>
    <p>Welcome back!</p>
</cfif>

Arguments

Name Type Required Default Options Description
role string No Roles to check

hasWebskin()

Retrieve the properties of the selected object after an objectadmin action.

Examples

<cfif application.fapi.hasWebskin("dmHTML", "displayPage1Col")>
    <skin:view typename="dmHTML" objectid="#q.objectid#" webskin="displayPage1Col" />
</cfif>

Arguments

Name Type Required Default Options Description
typename string Yes The typename of the webskin to be found.
webskin String Yes

init()

FAPI Constructor

Arguments

Name Type Required Default Options Description
None

insertQueryVariable()

Inserts the specified key and value, replacing the existing value for that key

Arguments

Name Type Required Default Options Description
url string Yes The url to modify
key string Yes The key to insert
value string Yes The value to insert
ampDelim string No & Delimiter to use for ampersands
charset string No utf-8 The character encoding in which the url values are encoded.

isDefaultObject()

Returns true if the object has not yet been stored in the database

If you know what the type is, pass it in to avoid an unnecessary database calls.

Examples

Returns true if the object has not yet been stored in the database:
<cfset bDefaultObject = application.fapi.isDefaultObject(form.selectedobjectid,"thistype") />

Arguments

Name Type Required Default Options Description
objectid UUID Yes The objectid for which object is to be found
typename string No The typename of the objectid. Pass in to avoid having to lookup the type.

isLoggedIn()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Show a profile webskin if a user is logged in:
<cfif application.fapi.isloggedIn()>
    <skin:view stObject="#application.fapi.getCurrentUser()#" webskin="displayProfilePod" />
</cfif>

Arguments

Name Type Required Default Options Description
None

listContainsAny()

Returns true if the first list contains any of the items in the second list. This method is case sensitive. See listContainsAnyNoCase if you need case insensitve search.

Examples

var newList = application.fapi.listFilter("one,two,three,four", "^[ot]", ",")
//newList = "one,two,three"

Arguments

Name Type Required Default Options Description
list1 string Yes The list being searched
list2 string Yes The list of search terms
delimiters string No , Delimiters used by lists

listContainsAnyNoCase()

Returns true if the first list contains any of the items in the second list in any case. The third, optional parameter, is the list delimiter - comma by default.

Examples

var doesIt = application.fapi.listContainsAnyNoCase("This,will,BE,TRUE","TRUE,Fred,larry,joe",",")

Arguments

Name Type Required Default Options Description
list1 string Yes The list being searched
list2 string Yes The list of search terms
delimiters string No , Delimiters used by lists

listDiff()

Returns the items in list2 that aren't in list2

Arguments

Name Type Required Default Options Description
list1 string Yes
list2 string Yes
delimiters string No ,

listExtends()

Returns a list of the components the specified one extends (inclusive)

Examples

<cfdump var="#application.fapi.extends(mycomponent path,'farcry.core.packages.types.types')#" />

Arguments

Name Type Required Default Options Description
path string Yes The package path of the component

listFilter()

Filters the items in a list though a regular expression, and returns a new list of items that match the regular expression.

Examples

var newList = application.fapi.listFilter("one,two,three,four", "^[ot]", ",")
//newList = "one,two,three"

Arguments

Name Type Required Default Options Description
list string Yes The list being filtered
filter string Yes The regular expression to filter by
delimiters string No , Delimiters used by list

listIntersection()

Returns the items in list2 that are also in list2

Arguments

Name Type Required Default Options Description
list1 string Yes
list2 string Yes
delimiters string No ,

listMerge()

Adds items from the second list to the first, where they aren't already present

Arguments

Name Type Required Default Options Description
list1 string Yes The list being built on
list2 string Yes The list being added
delimiters string No , The delimiters used the lists

listReverse()

Corrects a URL with the specified query string values removed, replaced, or added. New values can be specified with a query string, struct, or named arguments. Also fixes friendly url query variables.

Examples

Put the list of plugins in order of greatest precendence:
<cfdump var="#application.fapi.listReverse(application.plugins)#" />

Arguments

Name Type Required Default Options Description
list string Yes
delimiters string No ,

listSlice()

Corrects a URL with the specified query string values removed, replaced, or added. New values can be specified with a query string, struct, or named arguments. Also fixes friendly url query variables.

Examples

Get the first two, last three, and second through forth items in a list:
<cfset colours = "blue,green,yellow,orange,red,purple" />
<cfoutput>
    #application.fapi.listSlice(list=colours,end=2)#<br />
    #application.fapi.listSlice(list=colours,start=-3)#<br />
    #application.fapi.listSlice(list=colours,start=2,end=4)#<br />
</cfoutput>

Arguments

Name Type Required Default Options Description
list string Yes The list being sliced
start numeric No 1 The start index of the slice. Negative numbers are reverse indexes: -1 is last item.
end numeric No -1 The end index of the slice. Negative values are reverse indexes: -1 is last item.
delimiters string No , Delimiters used by list

prettyDate()

Provides date formatting in the style of Twitter's timeline: "just now", "5 minutes ago", "yesterday", "2 weeks ago".

Examples

#application.fapi.prettyDate(myUglyDate)# 

Arguments

Name Type Required Default Options Description
uglyDate string Yes
bUseTime boolean No true Should the comparison include the time part in its equation.

registerCSS()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Register a CSS library into the application:
<cfset application.fapi.registerCSS(    id="jquery-ui",
                                        baseHREF="#application.url.webtop#/thirdparty/jquery/css/base",
                                        lFiles="ui.core.css,ui.resizable.css,ui.accordion.css,ui.dialog.css,ui.slider.css,ui.tabs.css,ui.datepicker.css,ui.progressbar.css,ui.theme.css") />

Arguments

Name Type Required Default Options Description
id String Yes
lCombineIDs String No
baseHREF String No
hostname String No
lFiles String No
media String No all
condition String No Used to wrap a conditional statement around the link tag.
prepend String No Any CSS code you wish to have placed before the library.
append String No Any CSS code you wish to have placed after the library.
bCombine String No true Should the files be combined into a single cached js file.

registerJS()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Register a JS library into the application:
<cfset application.fapi.registerJS(    id="jquery",
                                    baseHREF="#application.url.webtop#/thirdparty/jquery/js",
                                    lFiles="jquery-1.3.2.min.js,ui.core.js,ui.accordion.js,ui.datepicker.js,ui.dialog.js,ui.draggable.js,ui.droppable.js,ui.progressbar.js,ui.resizable.js,ui.selectable.js,ui.slider.js,ui.sortable.js,ui.tabs.js,effects.core.js,effects.blind.js,effects.bounce.js,effects.clip.js,effects.drop.js,effects.explode.js,effects.fold.js,effects.highlight.js,effects.pulsate.js,effects.scale.js,effects.shake.js,effects.slide.js,effects.transfer.js") />

Arguments

Name Type Required Default Options Description
id String Yes
lCombineIDs String No
baseHREF String No
hostname String No
lFiles String No
condition String No Used to wrap a conditional statement around the script tag.
prepend String No Any JS code you wish to have placed before the library.
append String No Any JS code you wish to have placed after the library.
bCombine String No true Should the files be combined into a single cached js file.

removeFromObjectBroker()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Clear the object and it's webskins from the cache:
<cfset application.fapi.removeFromObjectBroker(stObj.objectid) />

Arguments

Name Type Required Default Options Description
lObjectIDs string Yes
typename string Yes

removeMSWordChars()

Attempts to strip out all MS Word chars that tend to mess up html display and cause xhtml validation to fail. This also attempts to maintain compatibility with languages other than English. If you modify this method, please run the unit tests.

Examples

var clean = application.fapi.removeMSWordChars("my possible bad thing")

Arguments

Name Type Required Default Options Description
dirtyText string Yes

RFC822ToDate()

Valid RSS feeds will have the date displayed in RFC 822 format which looks like: Tue, 07 Jul 2009 10:35:38 +0800 This function is used to parse that information into a coldfusion datetime. If you do not pass in the date string it uses getHttpTimeString() by default which will be the current date time.

Examples

var mydate = application.fapi.RFC822ToDate("Tue, 07 Jul 2009 10:35:38 +0800")

Arguments

Name Type Required Default Options Description
dt string Yes [runtime expression]

setAncestorsCacheByForm()

This is generally used by tags to dynamically assign cacheByForm to the webskin that called it and its ancestors.

Arguments

Name Type Required Default Options Description
None

setAncestorsCacheByRoles()

This is generally used by tags to dynamically assign cacheByRoles to the webskin that called it and its ancestors.

Arguments

Name Type Required Default Options Description
None

setAncestorsCacheByURL()

This is generally used by tags to dynamically assign cacheByURL to the webskin that called it and its ancestors.

Arguments

Name Type Required Default Options Description
None

setAncestorsCacheByVars()

This is generally used by tags to dynamically assign cacheByVar's to the webskin that called it and its ancestors.

Arguments

Name Type Required Default Options Description
keys String Yes This is a list of setCacheVar names to be dynamically assigned.

setAncestorsCacheFlushOnFormPost()

This is generally used by tags to dynamically assign cacheFlushOnFormPost to the webskin that called it and its ancestors.

Arguments

Name Type Required Default Options Description
None

setConfig()

Due to restrictions across the various databases FarCry supports, null dates are NOT supported. To deal with this the formtools have been designed to use certain dates as null. Pass a date into this function to determine if it is a FarCry null date.

Examples

Set a config value:
<cfset application.fapi.setConfig('admin','adminemail', '[email protected]') />

Arguments

Name Type Required Default Options Description
key String Yes The Config Key identifying the config form the property is located in.
name String Yes The name of the config property you wish to retrieve a value for.
value String Yes The value to set the config item to.

setData()

Retrieve the properties of the selected object after an objectadmin action.

Examples

Save changes to an object:
<cfset application.fapi.setData(stProperties=stObj) />

Arguments

Name Type Required Default Options Description
objectid string No The objectid for which object is to be set
typename string No The typename of the objectid. Pass in to avoid having to lookup the type.
stProperties String No [runtime expression]
dsn string No [runtime expression]
dbtype string No [runtime expression]
dbowner string No [runtime expression]
bSessionOnly string No false
bAfterSave boolean No true This allows the developer to skip running the types afterSave function.

showFarcryDate()

Due to restrictions across the various databases FarCry supports, null dates are NOT supported. To deal with this the formtools have been designed to use certain dates as null. Pass a date into this function to determine if it is a FarCry null date.

Examples

In a news webskin check to see if it should still be published:
<cfif not application.fapi.showFarcryDate(stObj.expirydate) or stObj.expirydate() gt now()>
    <cfoutput>
        <h2>#stObj.title#</h2>
        <p>#stObj.teaser#</p>
    </cfoutput>
</cfif>

Arguments

Name Type Required Default Options Description
date String Yes The date to check

struct()

This Package has been deprecated.

Performs a deep merge on two structs.

Examples

var stNewOne = application.fapi.structMerge(stOne, stTwo, true)

Arguments

Name Type Required Default Options Description
None

structCreate()

This Package has been deprecated.

Create and populate a struct. With newer versions of Coldfusion this method is a bit less useful since you can often create structs using the {} notation. For example {a=5,b="How now brown cow",c=url}.

Examples

<cfdump var="#application.fapi.struct(a=5,b="How now brown cow",c=url)#" />

Arguments

Name Type Required Default Options Description
None

structMerge()

Performs a deep merge on two structs.

Examples

var stNewOne = application.fapi.structMerge(stOne, stTwo, true)

Arguments

Name Type Required Default Options Description
struct1 struct Yes
struct2 struct Yes
replace boolean No true

structToNamePairs()

Builds a named pair string from a structure

Arguments

Name Type Required Default Options Description
st struct Yes
delimiter String No &
Quotes String No

success()

Returns a standard return structure from a function when it is successfull

Arguments

Name Type Required Default Options Description
message string No
detail string No
type string No
name string No
errNumber string No
stackTrace string No
tagContext array No [runtime expression]

throw()

Due to restrictions across the various databases FarCry supports, null dates are NOT supported. To deal with this the formtools have been designed to use certain dates as null. Pass a date into this function to determine if it is a FarCry null date.

Examples

In a webskin output a link for a file property:
<cfif len(stObj.brochure)>
    <cfoutput><a href="#application.fapi.getFileWebRoot()##stObj.brochure#">Brochure</a></cfoutput>
</cfif>

Arguments

Name Type Required Default Options Description
message string No
errorcode string No
detail string No
extendedinfo string No
object object No
type string No