Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added a missing word "be" in which appears to be the benchmark for

...

We can invent things as we need them to showcase aspects of the technology without being constrained by the more traditional, user focused goals of a typical application. It also has the potential of being a lot more complex than your average "build a blog in 10 minutes" exercise which appears to be the benchmark for determining the viability of many frameworks.

...

Code Block
<!--- ./packages/types/superHero.cfc --->
<cfcomponent name="superHero" extends="farcry.core.packages.types.types" output="false" displayname="Super Hero">

	<cfproperty
 
		name="title" type="string" default="" hint="Super hero title." />
	<cfproperty

		name="secretHideout" type="string" hint="The secret hideout location of the super hero" />
	<cfproperty 
		name="teaser" type="longchar" default="" hint="Mini intro for super hero biography." />
	<cfproperty 
		name="biography" type="longchar" default="" hint="Super hero biography." />
	<cfproperty

		name="imgHero" type="string" hint="The image of the hero" />

</cfcomponent>

...

  1. Create a new file called superHero.cfc and save this into your project's ./packages/types directory.
  2. Copy the following code into this file, save and review with the instructor
    Code Block
    <!--- ./packages/types/superHero.cfc --->
    <cfcomponent name="superHero" extends="farcry.core.packages.types.types" output="false" displayname="Super Hero">
    
    	<cfproperty
     
    		name="title" type="string" default="" hint="Super hero title." />
    	<cfproperty
    
    		name="secretHideout" type="string" hint="The secret hideout location of the super hero" />
    	<cfproperty
    
    		name="teaser" type="longchar" default="" hint="Mini intro for super hero biography." />
    	<cfproperty
    
    		name="biography" type="longchar" default="" hint="Super hero biography." />
    	<cfproperty
    
    		name="imgHero" type="string" hint="The image of the hero" />
    
    </cfcomponent>
    
  3. Go to the FarCry Webtop and deploy the content type: ADMIN > Developer Utilities > COAPI Tools > Types
  4. Locate your new content type, "superHero" and select DEPLOY.
  5. Click on the [Scaffold] button now to create an Administration scaffold
  6. Select the checkbox next to "Create type admin interface",
    1. put in a title for your administration list
    2. select label and imgHero as the fields to appear in your list
      Info
      titleBasic Scaffolding

      The Scaffold option for deployed content types generates some sample code you can use to get started right away.
      "Create type admin interface" creates a small XML file that generates a menu item for you in the FarCry webtop.
      The framework provides a default edit handler and display view so no need to add anything else here just yet.

  7. Reload your Application. This time you will need to update the [Webtop] option
  8. Go to the Content Tab. Locate your Super Hero admin and create some Heroes (or Villains!)
    Info
    titleEditing Content Types

    When you created your first superHero object you may have noticed a rudimentary edit handler allowing you to key in details, save and update. That's not actually part of the scaffold code that was generated at all. The edit handler is dynamically generated at run time based on the metadata associated with the superHero component's cfproperty tags. Ok. So its pretty minimalist now but wait.. it's only the beginning.

    Warning
    titleWait Up!

    Make sure you understand the concept of extends, displayname and property type before the instructor starts babbling on about something else.

...

Code Block
<!--- ./packages/types/superHero.cfc --->
<cfcomponent name="superHero" extends="farcry.core.packages.types.types" output="false" displayname="Super Hero">

	<cfproperty

		name="title" type="string" default="" hint="Super hero title."
		ftSeq="1" ftFieldset="General Details" ftLabel="Title" />
	<cfproperty

		name="secretHideout" type="string" hint="The secret hideout location of the super hero"
		ftSeq="2" ftFieldset="General Details" ftLabel="Secret Hideout" />
	<cfproperty

		name="teaser" type="longchar" default="" hint="Mini intro for super hero biography." 
		ftSeq="3" ftFieldset="General Details" ftLabel="Teaser" />
	<cfproperty 
		name="biography" type="longchar" default="" hint="Super hero biography."
		ftSeq="4" ftFieldset="General Details" ftLabel="Biography"

		ftType="richtext" />
	<cfproperty

		name="imgHero" type="string" hint="The source image to upload"
		ftSeq="10" ftFieldset="Imagery" ftLabel="Hero Image"

		ftType="image" ftDestination="/images/superHero/imgHero" ftImageWidth="120" ftImageHeight="120" ftAutoGenerateType="fitInside" />
</cfcomponent>

...

Code Block
titleExample ftType="richtext" Formtool Control
<cfproperty

	name="Body" type="longchar" hint="Main body of content." required="no" default=""

	ftSeq="12" ftFieldset="Body" ftWizardStep="Body" ftLabel="Body"
	ftType="richtext"
 
	ftImageArrayField="aObjectIDs" ftImageTypename="dmImage" ftImageField="StandardImage" 
	ftTemplateTypeList="dmImage,dmFile,dmNavigation,dmHTML" ftTemplateWebskinPrefixList="insertHTML"
	ftTemplateSnippetWebskinPrefix="insertSnippet" />
<cfproperty  
	name="aObjectIDs" type="array" 
	hint="Holds objects to be displayed at this particular node.  Can be of mixed types." required="no" default=""

	ftSeq="13" ftFieldset="Relationships" ftWizardStep="Body" ftLabel="Associated Media"
	ftJoin="dmImage,dmFile,dmFlash" bSyncStatus="true" />

...

  1. Open the ./packages/superHero.cfc
  2. Add Wizard Steps using the ftWizardStep formtool metadata
    Code Block
    <!--- ./packages/types/superHero.cfc --->
    <cfcomponent name="superHero" extends="farcry.core.packages.types.types" output="false" displayname="Super Hero">
    
    	<cfproperty
    
    		name="title" type="string" default="" hint="Super hero title."
    		ftSeq="1" ftFieldset="General Details" ftWizardStep="Teaser Information" ftLabel="Title" ftValidation="required" />
    	<cfproperty
    
    		name="secretHideout" type="string" hint="The secret hideout location of the super hero"
    		ftSeq="2" ftFieldset="General Details" ftWizardStep="Teaser Information" ftLabel="Secret Hideout" />
    	<cfproperty
    
    		name="teaser" type="longchar" default="" hint="Mini intro for super hero biography."
    
    		ftSeq="3" ftFieldset="General Details" ftWizardStep="Teaser Information" ftLabel="Teaser" />
    	<cfproperty 
    		name="biography" type="longchar" default="" hint="Super hero biography."
    		ftSeq="4" ftFieldset="General Details" ftWizardStep="Biography Details" ftLabel="Biography"
    		ftType="richtext" />
    	<cfproperty 
    		name="imgHero" type="string" hint="The source image to upload"
    		ftSeq="10" ftFieldset="Imagery" ftWizardStep="Imagery" ftLabel="Hero Image" 
    		ftType="image" ftDestination="/images/superHero/imgHero" ftImageWidth="120" ftImageHeight="120" ftAutoGenerateType="fitInside" />
    
    </cfcomponent>
    
  3. Make sure that each <cfproperty> has a relevant ftWizardStep entry
  4. Reload the formtool metadata and test that your wizard works.

...