Wizards (PLPs)

Some quick notes from the farcry-dev mailing list by Beenish to get you started on PLPs (until we get some much needed documentation in place:

Using PLP's is alot simpler then you think it is and the Brendan Sisson example is way out of date and missing too much stuff. Infact I think it's easier using a plp rather then writing your own edit handler and alot faster too.

All you need to do is copy and paste everything from farcry_core/packages/types/_dmNews to <your_application_name>/packages/types/<your_customtype_folder>. The only files I use are edit.cfm and under the plpEdit folder I use start.cfm, categories.cfm and complete.cfm and dump the rest. You can use them if you want.

Then I delete the form fields that aren't needed and add all my form fields into start.cfm, like:

<label for="fieldname"><b>fieldlabel</b>
	<input type="text" name="fieldname" id="fieldname" /><br />
</label>

Don't even think about anything else in that file.

I'm using ctStaff as my custom type here. In edit.cfm change the line
that says:

<cfset tempObject =
CreateObject("component",application.types.dmnews.typepath)> to
<cfset tempObject =
CreateObject("component",application.types._ctStaff.typepath)>. (line
27)

Don't really know what this line does.

Change <cfset
cancelCompleteURL="#application.url.farcry#/content/dmnews.cfm"> to
<cfset
cancelCompleteURL="#application.url.farcry#/admin/customadmin.cfm?module=._ctStaff/list.cfm">
(line 31) to return to your list page if you click cancel in plp.

Change stepDir="/farcry/farcry_core/packages/types/_dmNews/plpEdit" to
stepDir="/farcry/#application.applicationname#/packages/types/_ctStaff/plpEdit"
(line 40).

Comment out or delete the lines that say

<widgets:plpstep name="#application.adminBundle[session.dmProfile.locale].bodyLC#" template="body.cfm">
<widgets:plpstep name="#application.adminBundle[session.dmProfile.locale].relatedLC#" template="related.cfm">

because they are not being used. Keep them if you decide to use them.

Thats all the changes to make to edit.cfm. 3 lines to edit 2 to comment out!

Don't need to make any changes to categories.cfm or to complete.cfm. They are a pure copy and paste. Don't need to write any code to add, update or delete. It's all taken care of. Shouldn't take you more then 20-30min to do the first time.

Before you do all this make sure you have your list.cfm page set up and
in your custom type cfc you have:

<cffunction name="edit" access="public">
	<cfargument name="objectid" required="yes" type="UUID">
	<!--- getData for object edit --->
	<cfset stObj = this.getData(arguments.objectid)>
	<!--- hack to make arguments available to included file --->
	<cfset stArgs = arguments>
	<cfinclude template="_ctStaff/edit.cfm">
</cffunction>.

list.cfm (under <application_name>/customadmin/ctStaff) should be:

<cfsetting enablecfoutputonly="yes">
	<cfimport taglib="/farcry/farcry_core/tags/admin/" prefix="admin">
	<cfimport taglib="/farcry/farcry_core/tags/widgets/" prefix="widgets">

	<!--- set up page header --->
	<admin:header>

	<widgets:typeadmin
		typename="ctStaff"
		title="Provet Staff"
		description="Staff Object"
		handlerRoot="/#application.applicationname#/handlers"
		metadata = "True"
		permissionset="news"
		>
	 </widgets:typeadmin>

	<!--- setup footer --->
	<admin:footer>
<cfsetting enablecfoutputonly="no">

It took me a really long time to get to this point with the extreme lack of documentation but it is really simple once you get your head around it. I hope this helps others too.

Good Luck
Beenish