Photo from Chile

Using the Mura FW/1 Connector Plugin

Several months ago Pat Santora of Blue River and I developed a Mura plugin that would allow a developer to take an existing FW/1 application and deploy it within a Mura page. I was interested in this as I saw a need for a lightweight framework that I could use for my plugins, and by coincidence Pat happened to be working on something similar. So we joined forces and the FW/1 Connector Plugin was born.

The plugin was finally released yesterday so I thought it prudent to author a post about how to use the plugin.

Overview

The FW/1 Connector plugin can be used to incorporate an FW/1 application into Mura. Each plugin can be assigned to an individual FW/1 application. As long as each FW/1 application has a unique applicationKey, you can have as many FW/1 applications running inside Mura as you please.

Requirements

  1. The FW/1 framework.cfc must be installed in a path that maps to org.corfield. You can do this via a mapping in the CF administrator or you can place the org.corfield folder in Mura's requirements folder.
  2. Your FW/1 application must also reside in a path mapped to CF. Again, this can be accomplished via a mapping in the CF administrator or you can create a folder for your application in Mura's requirements folder.

Installing the Plugin

Download the latest version of the plugin from the Mura App Store, and install it via the Mura Administrator.

From the Mura admin screen, click on Site Settings, on the right-hand side of the yellow menu bar. You should see two tabs, Current Sites and Plugins. Click the Plugins tab and you will see a list of any installed plugins, above which is a form that allows you to browse for a zip file on your local machine. Choose a the file that you downloaded and click the Deploy button. You'll see the Plugin Settings page for the FW/1 Connector Plugin. Provide values for the following settings:

  1. Plugin Name (Alias) - This is the name that you're going to give to this instance of the plugin. Remember that you can install multiple instances of the plugin each of which can point to a different FW/1 application.
  2. FW/1 Application Key - This must be the same value as specified in variables.framework.applicationKey inside your FW/1 application.
  3. Mapping to your application - This is the dot notation mapping to your FW/1 application. For example, if you placed your application into a folder called myFW1App in Mura's requirements folder, then the value of this setting would be myFW1App.
  4. FW/1 Event Name - This is the name of the URL or form variable used to specify the desired action in your FW/1 application. The default value in all FW/1 applications is action, but this can be overridden by specifying a value for variables.framework.action.

Choose which sites you would like the plugin to be available to, and click Update. The FW/1 Connector plugin is now installed and ready to be used.

Configuring your FW/1 Application to Work with the Plugin

The following keys must be set in the variables.framework structure within the Application.cfc file of your application:

  1. applicationKey - This must be a unique value for each FW/1 application that you wish to embed, and must correspond to the FW/1 Application Key specified in the Plugin Settings as discussed above.
  2. base - This must be the path to the directory containing the layouts and views folders, either as a mapped path or a webroot-relative path (i.e., it must start with / and expand to a full file system path).

Using the doEvent Method

You will use the plugin's doEvent() method to fire off events within your FW/1 application. It accepts the following two arguments:

  1. event - This is Mura's event object.
  2. action (optional) - This is the action to be passed to your FW/1 application via a URL variable. If not provided the default action of your FW/1 application will be called.
    Note: This argument is actually mandatory for now, as there is currently an issue with Mura and FW/1's SES URL scheme. If that issue gets resolved (and I've submitted a patch for it) then this argument will be optional again.

Calling an FW/1 Event from within Mura

As described above, you call an FW/1 event by calling the doEvent() method of the FW/1 plugin. The plugin itself will reside in Mura's event object, in a key with the same name as specified in the FW/1 Application Key setting.

For example, if you used a value of myFW1App for the FW/1 Application Key setting, then the plugin would be accessible via event.myFW1App. This gives you access to the plugin, which allows you to call its doEvent() method as required.

The following are two examples of ways in which you might call an FW/1 event. Note that these examples assume that the value of the FW/1 Application Key setting is myFW1App:

  1. By using the Mura tag:
    [mura]event.myFW1App.doEvent(event,'main.showLogin')[/mura]
  2. From within a cfm or component that has access to the Mura event:
    event.myFW1App.doEvent(event,'main.showLogin')

That's pretty much all there is to it. Now go forth and create plugins!

TweetBacks
Comments
Hi,

I try to test the plug-in with the template application found on Mura website for the FW=1 Plug-In

On one of my public page I add the following line

event.myFW1App.doEvent(event,'main.default')

Now when I load the page, It redirect me to the mura login page.

Why ?

Also on the application.cfc of the template we have :

<cfinclude template="../mappings.cfm">

What is this file ? If I leave this line there there is a file not found error.

Thanks


Thanks
# Posted By Patrick Desroches | 2/28/10 1:09 AM
Hi,

When I am logged in as admin.

If I go to the same page I get mix of the admin layout and public with a Hello FW/1! inside.

Very weird problem

Thanks for any help
# Posted By Patrick Desroches | 2/28/10 1:15 AM
Patrick,

BlueRiver are the official owners are developers of the plugin (I just helped a bit), so you should refer to them for support. Your best bet would be to post a question on their support forum at http://www.getmura.com/forum/
# Posted By Bob Silverberg | 3/4/10 10:27 AM
Could you show an example of using the plgin to leverage the fw/1 application as a displayobject on the front of a site?
# Posted By Lauw | 3/31/10 8:28 AM
Hi Bob,

The link to http://www.getmura.com/index.cfm/app-store/plugins... no longer works. Is this plugin still available? I realise there is now the Mura FW/1 Template plugin available, however I have a few issues with using that (in particular the GPL licence).

What's your recommendation for integrating Mura and FW/1 as of today (March 2011).
# Posted By Andrew Myers | 3/17/11 1:03 AM
Ditto what Andrew said, I'm looking to develop a similar plugin for coldbox applications and would like to find the connector plugin to see a similar approach.
# Posted By Ben Dalton | 3/24/11 11:52 AM
This is a test. I'm having issues with comments being flagged.
# Posted By Bob Silverberg | 3/24/11 5:37 PM
Sorry for the delay in responding guys. I haven't done much with Mura in awhile, so I don't have a more up-to-date approach. If the fw1 connector is no longer available I'd suggest you contact Blue River about that, as it should be available somewhere.
# Posted By Bob Silverberg | 3/24/11 5:51 PM