...
Custom FarCry types are components kept in the farcry_yourproject/packages/types/ directory. Your custom type component should have a bCustomType="1" attribute in the component tag.
The naming convention for type component filenames is abTypeNameabcTypeName, where ab abc are your initials. For example, core components are prefixed with dm for daemon.
Attribute | Description |
---|---|
bCustomType | Set to 1 |
bScheduled | Used by ruleHandpicked to identify the types it can use |
bUseInTree | Specifies whether the type can be used in the site tree |
displayName | The name of the type |
extends | farcry.farcry_core.packages.types.types |
Note | ||
---|---|---|
| ||
bCustomType component metadata is deprecated. I believe FarCry automatically assigns this metadata if the component sits outside of the ocre code base. GB20050202 |
The Types Base Component
The component that you are creating needs to extend the types component in the FarCry core packages directory (or another core type like dmHTML). Use the package path "farcry.farcry_core.packages.types.types". This base class provides standard functions for managing the database, plugging into the administration console, and being displayed on the website. Most of these will be covered in other sections.
...
- boolean
- date
- numeric (any number)
- string (255 8bit characters)
- nstring (255 16bit characters)
- uuid
- variablename ????
- color (20 characters)
- email (up to 255 characters)
- longchar (long text)
- array (one dimensional, up to 255 characters per elementobject reference)
You can also use the default and required attributes.
FarCry Data Types correspond to specific column data types depending on the supported database. FarCry 3.0.0 introduced a new Compound Array Property that allows for more than a simple object reference.
Deploying the Type
Implementing the new FarCry type, and changes to the name or properties is done by "Deploying" them. Go to the Admin tab of the administration console, select COAPI Management from the drop down list, and click on the Type Classes option.
...
If the component is sound but hasn't been deployed by FarCry, you will see a message asking whether you wish to deploy your new type. Similar messages and options are provided when FarCry detects that a deployed type has been changed (new, changed or removed properties).NOTE: array
Warning | ||
---|---|---|
| ||
Array properties are not detected properly - deploying them does implement the necessary database changes, but FarCry will not recognise them and will continue to display the deploy message. |
Managing Types
In order to manage your custom type in the FarCry administration console you will have to implement further functions and files.
...
In the farcry_yourproject/customadmin directory, create another directory with the name of your custom type. This directory will be used to store all the management modules for the new type. In this directory create an empty cfm file for the type management list, for example listabMyType.cfm. NOTE:
Note |
---|
this file will be accessed as a module. ie via a cfmodule call |
The first thing to do with this file is to add the standard administration console menus and styles. These are contained in the admin tag library.
To create the header, use the header tag. This tag has a title attribute, which you can set to whatever title you're using for the page.
...
The list, buttons, and search are inserted with another set of tags, called widgets.
No Format |
---|
<widgets:typeAdmin typename="abYourType" permissionset="news" title="Manage YourType"> </widgets:typeAdmin> |
...
The default set of columns is created in farcry_core/packages/farcry/typeadmin.cfc getDefaultColumns function. But if you wish, you can replace these default columns with your own.
To do this, use the typeAdminColumn tag from the widgets library inside the typeAdmin tag.
No Format |
---|
<widgets:typeAdmin typename="abYourType" permissionset="news" title="Manage YourType"> <widgets:typeAdminColumn title="Colour" columntype="variable" value="colourprop" /> </widgets:typeAdmin> |
...
The default set of buttons is created in farcry_core/packages/farcry/typeadmin.cfc getDefaultButtons function. But if you wish, you can replace these default buttons with your own.
To do this, use the typeAdminButton tag from the widgets library inside the typeAdmin tag.
No Format |
---|
<widgets:typeAdmin typename="abYourType" permissionset="news" title="Manage YourType"> <widgets:typeAdminButton buttontype="custom" name="dosomethingunique" value="Do This" url=http://yoursite/abc.cfm /> </widgets:typeAdmin> |
...
Attribute | Description |
---|---|
link | A link to the page or module. To link to a custom module like listabMyType, use "/farcry/admin/customadmin.cfm?module=abMyType/listabMType.cfm". Customadmin.cfm looks in the farcry_yourproject/customadmin directory for the specified file and loads it as a module. |
Tip | ||
---|---|---|
| ||
Comprehensive detail on modifying the web top using customadmin.xml can be found in the Custom Admin how-to. |
Editing a Record
When a user clicks on the edit icon of a record, the administration console loads /farcry/conjuror/invocation.cfm?objectid=#objectid#&typename=abMyType&ref=typeadmin. This template imports the console header and footer, and calls on the abMyType.edit function to create the form and handle form postback.
...