New location for FarCry subversion repositories

The folks at Daemon have completed some migrations with their subversion repositories which directly effects FarCry. Notes from the farcry-dev groups:

All URL’s should be replaced with this repo location:
https://modius.svn.cvsdude.com/farcry

All project folders are relative to this root. For example, the p520
branch for FarCry 5.2.x is available here:
https://modius.svn.cvsdude.com/farcry/core/branches/p520/

You can re-checkout or use the “relocate” command if your SVN client
supports.

No Comments

Hiding the FarCry tray on the front end

Came across this nice tip a little while ago from AJ Mercer on the farcry-dev group.

It hides the FarCry “tray” which is visible on the front end of your website to users who are logged in to FarCry. I happen to have a use case for this at the moment so it was good timing.

Simply put this code snippet in any template there you don’t want the tray appearing. Personally I put this in /config/_serverSpecificRequestScope.cfm so it’s picked up on every page request as I never wanted it to appear.

<cfset request.mode.bAdmin = false>

Thanks AJ :)

2 Comments

Prototype/scriptaculous issue with Sortable.create()

I’ve been doing some custom sorting within FarCry using the prototype/scriptaculous libraries as they already exist in the FarCry framework by default.

I was having trouble getting the Sortable.create() to work properly and the main docs site for scriptaculous seems severely lacking in examples. Basically the “sorting” action was happening fine but no event was being fired “onUpdate”. No exception was being thrown, just that nothing was happening after the drag/drop.

The solution came from google (where else?) on the rubyonrails groups thanks to a fellow named Chris.

Straight from the board:

I had the same problem, and the issue is probably in your markup. Each
item of the 'sortable' has to be named in the format 'string_integer'.
So this will work:

<ul id="makeMeSortable">
   <li id="item_1"></li>
   <li id="item_2"></li>
   <li id="item_3"></li>
</ul>

and this will NOT work:

<ul id="makeMeSortable">
   <li id="firstitem"></li>
   <li id="seconditem"></li>
   <li id="thirditem"></li>
</ul>

Wait, read that again. Are you serious?

Yep…you have to split your “id” value with a string, then an underscore followed by an integer. This is truly the dumbest thing I’ve found in a while. Hall of famer for sure.

Just posting here to help anyone else who spends more time than necessary getting this (simple) task working.

No Comments

Setting application variables in FarCry

I just thought I’d write up some quick thoughts on setting application scoped variables in FarCry as it occured to me that it could be a little confusing to non-FarCry developers.

It doesn’t really matter which framework you use, you can theoretically set you application variables anywhere you want, but ideally you want to follow some sort of methodology and consistency both with the rest of your development team and of course the framework you happen to be using.

FarCry has (somewhat) recently added a “farcryConstructor.cfm” inside the project webroot (www). A quick peek inside suggests that this is where application vars are set, this is re-inforced by checking Application.cfc which has a bascially empty OnApplicationStart() in terms of setting project application vars.

Sample of farcryConstructor.cfm:

<cfset THIS.sessionmanagement = true  />
<cfset THIS.sessiontimeout = createTimeSpan(0,0,20,0) />
<cfset THIS.applicationtimeout = createTimeSpan(2,0,0,0) />
<cfset THIS.clientmanagement = false />
...

There is also the /config directory which has been in existence for several versions and contains, you guessed it, “configuration” files. Namely:

  • _serverSpecificRequestScope.cfm
  • _serverSpecificVars.cfm
  • _serverSpecificVarsAfterInit.cfm

So where do you add your custom project application vars? The options we have so far are:

  • www/farcryConstuctor.cfm
  • www/Application.cfc
  • config/_serverSpecificxxx.cfm

Well farcryConstructor.cfm could seem like an ideal place, after all it’s the “constructor”. But it is generated from the installation routine and as such ignores any custom variables which are set inside it. So steer clear of this one.

OnApplicationStart() would also be a logical place inside Application.cfc. After all that’s probably where all your configuration happens in non-framework applications. This will indeed work as expected, but it’s not really the ideal place for your project config information.

It’s probably best to follow the “FarCry way” of doing things which is to utilise the files inside your /config directory. This should be the first place anyone in your development team goes to look for any custom project properties or application scoped variables.

Let’s look at the 3 /config files:

_serverSpecificRequestScope.cfm
This file is run after /core/tags/farcry/_requestScope.cfm
It enables us to both override the default farcry request scope variables and also add our own

_serverSpecificVars.cfm
THIS WILL BE INCLUDED BEFORE THE FARCRY INIT IS RUN BUT ONLY ON APPLICATION INITIALISATION.

_serverSpecificVarsAfterInit.cfm
THIS WILL BE INCLUDED AFTER THE FARCRY INIT HAS BEEN RUN BUT ONLY ON APPLICATION INITIALISATION.

I would therefore use _serverSpecificVars.cfm for all your application scoped variables as it is run once on application initialisation. If you need to make a change here you need to update the application.

I’d use _serverSpecificRequestScope.cfm for all your request scoped variables. This template is basically like OnRequestStart() in Application.cfc, i.e. it is executed on each page request.

Hope that helps some people :)

No Comments

Setting the sort order for custom admin items in FarCry

I’ve wanted to be able to control the sort order of menu and menuitems in the customadmin.xml (or equivalent) file for quite a while but hadn’t found how to do it. Only today did I find the ability, I believe it’s a FarCry 5+ feature which was why I didn’t see it before.

The answer is simple, just add a “sequence” attribute to your menu or menuitem tag:

<menu mergeType="merge" sequence="1" id="farcry_studentsonlineadminSubSection" label="Homepage Content" labelType="value">
	<menuitem id="boardlinks" sequence="1" label="Board Links" link="/admin/customadmin.cfm?module=customlists/boardlinks_data.cfm" />
	<menuitem id="boardlinks_sort" sequence="2" label="Board Links Sort Order" link="/admin/customadmin.cfm?module=customlists/boardlinks_sort.cfm" />
	<menuitem id="calendar" sequence="3" label="Calendar" link="/admin/customadmin.cfm?module=customlists/lu_calendar.cfm" />
	<menuitem id="faq" sequence="4" label="FAQ's" link="/admin/customadmin.cfm?module=customlists/lu_faq.cfm" />
</menu>

You can read more cool things you can do with your custom objectadmin on the FarCry docs site.

No Comments