919 - 926 - 9847

FarCry plugin breakdown - Part II

First, an addendum. Matthew Bryant pointed out that I had forgetton wrap my objectAdmin tag within an <admin> call. This would explain why my wizzardStep and CSS formating wasn't happening correctly. The updated zip can be found at this location

Let's begin Part II by looking at the customadmin files. These files are responsible for generating the menu at the top of the FarCry administrator, and for providing the links on the left hand pane.

First up, the massMailer.xml:


<?xml version="1.0" encoding="utf-8"?>
<webtop>
    <section mergetype="merge" id="massMailerSection" label="Mass Mailer" labeltype="value">
        <subsection mergetype="merge" id="massMailerSubSection" label="Mass Mailer" labeltype="value">
            <menu mergeType="merge" id="massMailerMenu" label="Mass Mailer" labelType="value">
                <menuitem mergeType="merge" id="massMailer" label="Mass Mailer" link="/admin/customadmin.cfm?module=customlists/massMailer.cfm&plugin=massMailer" />
                <menuitem mergeType="merge" id="massMailerList" label="Mass Mailer List" link="/admin/customadmin.cfm?module=customlists/massMailerList.cfm&plugin=massMailer" />
                <menuitem mergeType="merge" id="massMailerUser" label="Mass Mailer User" link="/admin/customadmin.cfm?module=customlists/massMailerUser.cfm&plugin=massMailer" />
            </menu>
        </subsection>
    </section>
</webtop>

FarCry gives you the ability merge changes to the look and feel of the webtop via XML files. The above should be fairly straightforward to follow.

  • Section - Creates a new tab within the webtop
  • Subsection - Creates the subsection within the specified tab. More than one subsection may be created, and a drop down list of choices will be presented if more than one subsection exists.
  • Menu - The navigation for the subsection
  • Menuitem - Navigation links within the subsection
    • Link - The FarCry custom admin parser
    • Module - The location of your customadmin files. In this case, customadmin/massMailerxxx.cfm
    • Plugin - The name of the plugin for the module

Now, let's look at the files behind the link from above:


<cfsetting enablecfoutputonly="true">

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

<!--- set up page header --->
<admin:header title="Mass Mailer Admin" />

<tags:objectAdmin
    title="Mass Mailer User"
    typename="massMailerUser"
    ColumnList="label"
    SortableColumns="label"
    lFilterFields="label"
    plugin="massMailer"
    sqlorderby="datetimelastUpdated desc" />


<admin:footer />

<cfsetting enablecfoutputonly="false">

Let's start our simplest object, the massMailerUser. We need to first import the formtools and admin tags. The <admin></admin> tags allows to setup nifty things like pagination, and also bring along page styling. The formtools tags will automagically style the inputs on our pages based on the CFCs we created before. Neat, huh?

We need a call to objectAdmin to display our main menu details. The arguments are:

  • Title - The title displayed at the top of the details page
  • Typename - Very important! This is the type we plan to display
  • Columnlist - Comma seperated list of list columns to display. This could be any column within the type specific database table. Label, action, and datetimecreated are the default
  • SortableColumns - Uh... no further explanation required
  • lFilterFields - Fields on which to allow filters (restrict results)
  • plugin - Plugin to use as a base
  • sqlorderby - Order in which records are displayed in the details page

This set of options should see us through most of what we need to get done. The massMailerList uses much the same call, just a different typename. Things get different for massMailer however.


<cfsetting enablecfoutputonly="true">

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

<!--- set up page header --->
<admin:header title="Mass Mailer Admin" />

<tags:objectAdmin
    title="Mass Mailer User"
    typename="massMailerUser"
    ColumnList="label"
    SortableColumns="label"
    lFilterFields="label"
    plugin="massMailer"
    sqlorderby="datetimelastUpdated desc" />


<admin:footer />

<cfsetting enablecfoutputonly="false">

There is two things of note here. One is the array of buttons. You can override most of the default behavior of FarCry, and in this case, we need to add the "Send" email functionality. You will need to delve into objectAdmin and typeAdmin to sort out what values are expected here.

The other thing to note is our send functionality. It waits for the form to submit with our "Send" value, then calls to our plugins/massMailer/packages/types/massMailer.cfc with the objectID of the particular massMailer. If you recall from part one, there's a function within our CFC to handle this call, along with the send.cfm file.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)