Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor typos and cleanup

...

The webtop administration area in FarCry is fully configurable. This includes the addition of your own functionality and the modification or removal of existing areas of the webtop. Within your project you will find a sub-directory called .projectName/customadmin and all code pertaining to modifying the webtop for your application should be stored there.

...

If you've used the scaffold utility to build an administration screen for your custom content type you will find a subdiretory subdirectory called .projectName/customadmin/customlists complete with a simple ColdFusion template referencing the object admin custom tag:

Code Block
titleSample Object Admin Scaffold
<cfsetting enablecfoutputonly="true">

<cfimport taglib="/farcry/core/tags/formtools" prefix="ft" />
<cfimport taglib="/farcry/core/tags/admin/" prefix="admin" />

<!--- set up page header --->
<admin:header title="Case Studies" />

<ft:objectAdmin
	title="Case Studies"
	typenametypeName="dmcasestudydmCaseStudy"
	plugin="daeBase"
	ColumnListcolumnList="title,urlWebSite,datetimelastupdated"
	SortableColumnssortableColumns=""
	lFilterFields=""
	sqlorderbysqlOrderBy="" />

<admin:footer />

<cfsetting enablecfoutputonly="no">

...

Walkthrough: Object Admin Customisation

  1. Open all the . projectName/customlists templates created by the scaffold utility for editing.
  2. Update the attributes to provide more appropriate column lists, and filterable fields.

Webtop XML

FarCry webtop tabs (sections), drop downs (sub-sections) and menu items are managed through the webtop.xml document. You can supplement this XML file, or even override sections of the document simply by adding an appropriately formatted customadmin.xml document to your projects ..project's projectName/customadmin folder. FarCry merges webtop.xml and customadmin.xml and uses the resulting xml document object to build the UI for the webtop. The XML document is also used to nominate all the relevant permissions for access to areas of the webtop.

...

Tip
titleMultiple Webtop Configs

In fact the framework will automatically merge all suitable webtop configuration xml files it finds. So you can have multiple files in your . projectName/customadmin folder if needed. The scaffold utility will produce multiple files by default. Configs will also be merged from active plugins.

...

<webtop> has no attributes, except an optional 'mergeType' (see Modifying Core Admin section below).

Common Node Attributes

Except for webtop; web top has no attributes, except an optional 'mergeType'. See
Merging section below.(Not including <webtop>; see Webtop above)

Attribute

Purpose

ID id

Uniquely identifies the node

Permission permission

FarCry permission required for the user to be able to access the screen element that results from the node .

Label label

Text to display on the resulting screen element, ; this can be either straight text, or it could be a coldfusion ColdFusion expression/variable to evaluate (see labelType attribute) .

LabelType labelType

Possible values are 'text' (default), 'expression', and 'evaluate'. Default behavior is 'text'. If ; if set to 'expression' or 'evaluate' , the value of the label attribute is passed to the coldfusion ColdFusion Evaluate function, and the result is what gets displayed .

MergeType mergeType

See Modifying Core Admin section below

Attributes of the

...

<subsection> Node

Attribute

Purpose

Sidebar sidebar

Path to a page to use as the left side bar. The sidebar; the path is relative to the FarCry admin section root (e. Ex: g. sidebar="custom/sidebar.cfm" Ex: ; sidebar="admin/customadmin.cfm?module=....")

Content content

Path to a page to use as the content pane (right side). The ; the path is relative to the FarCry admin section root (e. Ex: g. content="inc/content.html" Ex: ; content="admin/customadmin.cfm?module=....")

Attributes of the

...

<menuitem> Node

Attribute

Purpose

Link link

Path the link carries the user to (in the content pane). The ; the path is relative to the farcry FarCry admin section root (e.g. Ex: link="content/dmimage.cfm" Ex: ; link="admin/customadmin.cfm?module=....")

Custom Admin

Creating custom admin sections is very easy. The customadmin.xml file in .projectName/myproject/customadmin/ has the same format as the core's webtop.xml file (nodes and attributes described above).

Tip
titleConfig File Names

You can give your webtop config file any name (must not include spaces and must have the .xml extension) and you can have multiple files. Essentially any file ending in .xml found in the .projectName/myproject/customadmin folder will be processed. ; "customadmin.xml" is just a common name.

To Add a Custom Admin Section:

Add a <section...> <section> node to your customadmin.xml with all the appropriate <subsection...>, <menu...>, <menuitem...> <subsection>, <menu>, <menuitem> nodes within.

Modifying Core Admin

...

To replace an entire core admin section, implement the same node in your customadmin.xml. Be sure to include the ID id attribute and make it the same as the existing section in the core. Add a MERGETYPE mergeType="replace" attribute to your section node.

For Exampleexample, to replace the core's security section:

Code Block
titleReplacing A Section
<webtop>
  <section id="security" mergetypemergeType="replace" permission="blah" ...>
    <!-- implement whatever subsections/menus/menuitems -->
    <!-- you would like to in here -->
  </section>
</webtop>

...

Replacing a subsection, menu, or menuitem is very similar. You will have to include all parent nodes of the node you are replacing, and their ID id attributes must match the corresponding nodes in the core's webtop.xml file.

For Exampleexample, to replace the core's 'User' menu of the 'User Management' subsection of the 'Security' section:

...

Tip
titleReplacing Config

When you do a replace, you must supply all of the normally required attributes (such as sidebar, content, label) of the node you are replacing.

...

A duplicate node is one that exists in the core and also exists in customadmin.xml, with the same value for the ID id attribute (same goes for the parents of this node). This is no different than the case above where we had to include the parents with correct ID id's to
replace a certain child node.

When a duplicate node is encountered while merging the webtops, MERGETYPE mergeType="merge" is assumed, if no mergetype mergeType attribute is present.

...

mergeType="merge"

Any attributes in the core's node that are also implemented in the customadmin duplicate will be overwritten by the values in the customadmin duplicate. Attributes of the customadmin duplicate that are NOT in the corresponding core's node are added.

The children of a customadmin duplicate are appended to the corresponding core node's array of children. If a child of a customadmin duplicate does NOT have a corresponding duplicate in the core, it is added as it is. Otherwise, it is merged with the corresponding
duplicate in the core following the normal merge rules (based on their mergetype mergeType attributes).

...

mergeType="mergeNoReplace"

This will behave mostly the same as "merge", " except existing core attributes will NOT be overwritten. New attributes will still be appended.

...

  1. Open the all the *.xml files under . projectName/myproject/customadmin for editing.
  2. Merge all the XML files into a single file called customadmin.xml.
  3. Tidy up the XML by removing all the extraneous webtop, section and subsection elements.
  4. Place all menus under a single section called "Super" .
    Code Block
    <webtop>
      <section id="super" label="Super">
        <subsection id="SuperSubSection" label="Super Section">
          <!-- your menus go here! -->
        </subsection>
      </section>
    </webtop>