Charlie Arehart, CTO [email protected] BlueDragon A New Platform for Fusebox 4.
An Introduction to Fusebox 4
-
Upload
bevis-powers -
Category
Documents
-
view
43 -
download
0
description
Transcript of An Introduction to Fusebox 4
An Introduction to FB4
An Introduction to Fusebox 4
If written directions alone would suffice, libraries wouldn't need to have the rest of the universities attached.
—Judith Martin (aka "Miss Manners")
An Introduction to FB4
State of Fusebox The last two years have seen:
increased corporate acceptance of Fusebox increased developer acceptance of Fusebox increased demand in job postings for Fusebox no new version of Fusebox…
An Introduction to FB4
Fusebox: What's in it for the client? Less risk in software projects Greater "project visibility" Not locked into a non-standardized framework
An Introduction to FB4
Fusebox: What's in it for managers? Reduces costs of deployment Reduces cost of tools and training Allows better allocation of resources
An Introduction to FB4
Fusebox: What's in it for me? Helps good programmers produce great results Lets you distinguish yourself from your competition Helps stop the madness
An Introduction to FB4
FB4: It's all new! XML file defines overall application parameters:
Fusebox.xml
XML file defines individual circuits: Circuit.xml a permissions attribute for fuseactions Plugins allow developer extensions of core Fusebox Content components Change in way layouts are handled Parsing cycle
An Introduction to FB4
FB4: It's just the same! Core files process a fuseaction request Circuits provide logical groupings of fuseactions Fuses hold the code
dsp for display act for action qry for query lay for layout
An Introduction to FB4
Write fuses: qryAllUsers.cfm<cf_querysim>
AllUsersuserID,firstName,lastName,newsletters100|Stan|Cox|19200|Haywood U.|Buzzoff|5300|Marge|Inoferror|11
</cf_querysim>
An Introduction to FB4
Write fuses: dspUserList.cfm<h2>User List</h2><table border="0"><cfoutput query="AllUsers">
<tr><td><strong><a href="#self#?
fuseaction=#xfa.editUser#&userID=#userID#">#lastName#</a></strong>,#firstName#</td></tr>
</cfoutput></table><br><cfoutput>| <a href="#self#?fuseaction=#xfa.newUser#">New user</a> |</cfoutput>
An Introduction to FB4
Write fuses: qryNewsletters.cfm<cf_querysim>
NewslettersnewsletterID,newsletterName1|Journal of Misanthropy2|Today's Mendicant4|Spotlight on Great Managers8|WaffleWorld16|GeekWeek
</cf_querysim>
An Introduction to FB4
Write fuses: qryUserInfo.cfm<cf_querysim>
AllUsersuserID,firstName,lastName,newsletters100|Stan|Cox|19200|Haywood U.|Buzzoff|5300|Marge|Inoferror|11
</cf_querysim>
<cfquery dbtype="query" name="UserInfo">SELECT * FROM AllUsers WHERE userID = #attributes.userID#
</cfquery>
An Introduction to FB4
Write fuses: dspUserInfoForm.cfm<cf_<h2>User Profile</h2><cfoutput><form action="#self#?fuseaction=#xfa.submitForm#"
method="post"><table border="0" align="left" width="500">
<tr><td align="right">First name: </td><td><input type="Text" name="firstName"
value="#UserInfo.firstName#" /></td></tr><tr>
<td align="right">Last name: </td><td><input type="Text" name="lastName"
value="#UserInfo.lastName#" /></td></tr>
An Introduction to FB4
Write fuses: dspUserInfoForm.cfm<tr>
<td align="right">Newsletters: </td><td><cfloop query="Newsletters">
<input type="Checkbox" name="newsletters" value="#Newsletters.newsletterID#" <cfif BitAnd(Newsletters.newsletterID, UserInfo.newsletters)> checked</cfif>> #newsletterName#<br>
</cfloop></td>
</tr><tr>
<td colspan="2" align="center"><input type="Submit" value=" ok " />
</td></tr>
An Introduction to FB4
Write fuses: dspUserInfoForm.cfm </table><input type="Hidden" name="userID" value="#UserInfo.userID#" />
</form>
</cfoutput>
An Introduction to FB4
Write fuses: qryUserInfoEmpty.cfm
<cf_querysim>UserInfouserID,firstName,lastName,newsletters""|""|""|0
</cf_querysim>
An Introduction to FB4
Write test harnesses!!! Make sure that all your fuses fulfill their contract For this, you will need to use the Fusedocs
An Introduction to FB4
Define how/what fuseactions the Users circuit will handle: circuit.xml
<circuit access="public"><fuseaction name="list">
<xfa name="editUser" value="Users.edit" /><xfa name="newUser" value="Users.new" /><include template="qryAllUsers.cfm" /><include template="dspUserList.cfm" />
</fuseaction>
<fuseaction name="edit"><xfa name="submitForm" value="Users.doEdit" /><xfa name="home" value="Users.list" /><include template="qryNewsletters.cfm" /><include template="qryUserInfo.cfm" /><include template="dspUserInfoForm.cfm" />
</fuseaction>
An Introduction to FB4
<fuseaction name="new"><xfa name="submitForm" value="Users.doNew" /><xfa name="home" value="Users.list" /><set name="dsn" value="OurApp" /><do action="query.getNewsletters" /><include template="dspUserInfoForm.cfm" />
</fuseaction>
<fuseaction name="doEdit"></fuseaction>
<fuseaction name="doNew"></fuseaction>
</circuit>
Define how/what fuseactions the Users circuit will handle: circuit.xml
An Introduction to FB4
Define the configuration for the Fusebox application: fusebox.xml
<?xml version="1.0" encoding="UTF-8"?><fusebox>
<circuits><circuit alias="Users" path="circuits/Users/"
parent=""/></circuits>
An Introduction to FB4
Define the configuration for the Fusebox application: fusebox.xml
<parameters><parameter name="fuseactionVariable"
value="fuseaction" /><parameter name="defaultFuseaction"
value="Users.list" /><parameter name="precedenceFormOrUrl"
value="form"/><parameter name="reparse" value="true" /><parameter name="execute" value="true" /><parameter name="mode" value="development"/><parameter name="parseWithComments"
value="true" />
(continued)
An Introduction to FB4
Define the configuration for the Fusebox application: fusebox.xml
<parameter name="scriptFileDelimiter" value="cfm"/><parameter name="maskedFileDelimiters"
value="htm,cfm,cfml,php,php4,asp,aspx"/></parameters>
<globalfuseactions><preprocess></preprocess><postprocess></postprocess>
</globalfuseactions>
(continued)
An Introduction to FB4
Define the configuration for the Fusebox application: fusebox.xml
<plugins><phase name="preProcess"></phase><phase name="preFuseaction"></phase><phase name="postFuseaction"></phase><phase name="fuseactionException"></phase><phase name="postProcess"></phase><phase name="processError"></phase></plugins>
</fusebox>
An Introduction to FB4
The Fusebox grammar include
<include template="dspProducts" /> set
<set name="dsn" value="FruitProducts" /> xfa
<xfa name="success" value="home.main" /> do
<do action="home.listProducts" /> relocate
<relocate url="http://techspedition.com" /> if loop
An Introduction to FB4
Good Stuff in Fusebox 41. Language/version-neutral syntax2. Extensibility through plugins3. Improved performance4. No gut-wrenching changes5. Can execute multiple fuseactions in same HTTP request
(reduces <cfmodule> calls)6. Very flexible content components7. Less need to understand the Fusebox API