919 - 926 - 9847

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Part 3

In this installment we're going to be installing FarCry, and tweaking our Apache settings a bit. To let ya'll know upfront, there's still a few issues with FarCry and functions that are named the same as internal Railo functions. I know these changes were placed into trunk at one point, but it doesn't seem like they migrated over to the 5.1.6 release. That's OK, I've got a fairly stable pull of the core trunk files from a few weeks back that I'll be linking on the site this evening. I'll verify that this fixes the odd "function cannot be named" stuff going on. The current trunk files are not allowing the overview page to come up, but then again this is trunk we're talking about... life on the bleeding edge sometimes leads to a paper cut ;).

[More]

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Part 2

Right... part 2. We're going to install Railo in this section. It's going to be a much smaller ride than part 1 ;). But first, some knowledge.

I've learned that:

  • I'm not a fan of CentOS. I prefer the debian distros. Why? I've not really ever had a need to play with SELinux, or IPTables. Why does that matter? Both of these things have caused me grief whilst putting this together as both are enabled by default in both the _64 and i386 builds of 5.3.
  • You must turn off IPTables on each boot of the system. I'm sure there's a way to make this automatic, but I really haven't tracked it down yet. Yes, it would not be an issue if I just set it up... surely this will be a blog posting down the line, but I don't require it for now.
  • I had originally done the write up for part 1 with an _64 build. Everything was great until I got to the point where I needed to build mod_caucho. I could not find a way to successfully build that, and it appeared to be an issue with apsx. I didn't really want to spend my entire day chasing down rabit holes, so I switched to the i386 build. It's at this point that I learned that SELinux was preventing Apache from talking to Caucho. Again, not wanting to chase my tail endlessly, I just disabled SELinux for now.
  • Use PUTTY! I can never get copy/paste to play nice between my VM command line screen and windows. So, I'll just minimize the VM and use PUTTY to terminal (over SSH) into virtual box. In this way, you can also keep several screens up at one time.

[More]

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Part 1

Woah... not such a catchy title, but it's descriptive, non?

This all began as a quest to be able to provide a VPS solution to the lowest bidder situation. Their host provides CentOS machines at a fairly reasonable price, but that price would not include the cost of a ColdFusion license. My framework of choice is FarCry, and lately the Daemonites have taken great strides in keeping the framework compatible with Railo. This is the thorny path towards creating a Linux virtual machine with FarCry, MySQL, Railo, and Apache (oh... and SES URLs).

We'll start by just getting the basics of the system running and in place.

  • Everything I'm doing is as the root user... yes, not cool, but this just development. Typically, you should really use sudo to do all of this.
  • Grab a VMware image of CentOS 5.2. You can find one here: http://www.vmware.com/appliances/directory/1309. VMplayer can be found here: http://www.vmware.com/download/player/
  • Turn off IPTABLES for testing... yes, not the best idea for production, but this is development. I could not figure out why the heck Apache wasn't serving pages outside the local install, and it was the firewall blocking it. In production, you should really turn this feature on. I'm not addressing how to do so for this excercise.

    • /etc/init.d/iptables save
      /etc/init.d/iptables stop
  • Enable RPMforge packages. This will allow us to install phpMyAdmin through yum.
    • http://wiki.centos.org/AdditionalResources/Repositories/RPMForge (source)
    • Download either i386 or _64 RPM dependant on your OS type version
      • http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
      • http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
    • Import GPG key
      rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
    • Install it (replace the RPM with the name)
      rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm
  • We need to install apache (well, not NEED, but we're not using Tomcat here)
    • http://www.railo.ch/blog/index.cfm/2008/11/12/Installing-ResinRailo-on-CentOS (source)
    • yum install httpd httpd-devel openssl-devel
  • We need to install MySQL
    • http://www.ozzu.com/unix-linux-forum/centos-and-apache-php-mysql-t69484.html (source)
    • vi /etc/yum.repos.d/CentOS-Base.repo
    • change enable=1 for centosplus
    • yum install mysql-server mysql
  • I installed PHP/PHPmyadmin - just for DB administration
      yum install php php-mysql phpmyadmin
      cd /usr/share/phpmyadmin/
      vi config.inc.php
    • enter a value in $cfg['blowfish_secret'] = '<something>';
    • vi /etc/httpd/conf.d/phpmyadmin.conf
    • change the allow line to (yes, yes... but this is a test environ) to Allow from all
  • We need to install a JVM... this part just sucks. Unlike other distros, no precompiled version really meets our needs.
    • http://j2eeinaction.blogspot.com/2009/02/install-java-6-on-centos-52.html (source)
    • Go to http://java.sun.com/javase/downloads/index.jsp (grab the JDK!). You can browse to a download link and post that into your VM as something like the following
    • wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u14-linux-x64-rpm.bin?BundledLineItemUUID=CXFIBe.pePAAAAEioR0Hk1t8&OrderID=CgtIBe.pcWUAAAEilh0Hk1t8&ProductID=tPxIBe.oz2IAAAEhmh0zLjfT&FileName=/jdk-6u14-linux-x64-rpm.bin
    • rename that long ugly file to jdk.rpm.bin
    • mv <stupid long name> jdk.rpm.bin
    • chmod 700 jdk.rpm.bin
      ./jdk.rpm.bin
      /usr/sbin/alternatives --config java
  • Start Apache and MySQL at reboot
      /sbin/chkconfig httpd --level 2345 on
      /sbin/chkconfig mysqld --level 2345 on

And that's it. You have Apache serving pages at http://yoursite/ and phpMyAdmin at http://yoursite/phpmyadmin. Next up on the chopping block, adding Railo into the mix.

Addendum to FarCry and IONIC rewriting

I tried to use IONIC and FarCry. I really did. I spent several days/weeks (eh, I have 5 kids man... I've rather lost track of the exact time) trying to make this filter work the new friendly URLs created by FarCry. The previous blog posting appeared to work, except... several areas of the admin became unworkable. Mostly areas like the library picker. Also, I ran into the odd issue where you'd want to append URL variables not working. Jeff Coughlin and I also posted to the IONIC boards hoping for some assistance (guidance?) but in the end, it's still just broken. Heck, I even tried various version of the filter. In any case, it just never worked 100% and I've since given up.

So, where does that leave us? You can either switch to Apache. Or, you can start using the Helicon rewriting filter. There IS a free version of this filter, BUT... the downside is you're limited to either one website or ALL websites. The per server license for the full blown suite is about $99, but I hate having to pay for this filter for some reason. I'm just cheap, I suppose. Or, maybe it's due to everyone thinking the "ColdFusion" types are already pricey to begin with? At any rate, the free version works for me. Failing that I'm planning to switch to Apache for those cases where I need multiple site support.

Add bulk file uploads to FarCry 5.x

If you look in the content administration section of the FarCry admin, you'll find a handy little flex tool for uploading multiple images. Sadly, there is no matching tool for uploading bulk documents.

Have no fear, as the source will set you free! The flex UI component that pulls off the Image uploads is also available from the Daemonites at http://svn1.cvsdude.com/modius/farcry/flexUI/multipleImageUploader/trunk/. It is, however, a tad out of date. And unless you know flex... it's a bit of a pain as well to get it up and running. However, I've included a handy little zip that contains a complete working flex project if you should so choose.

So, I changed the flex UI piece to be named "Multiple Files Upload" and also changed the default CFM files being called (you can pass values in) to the correct file upload pieces. The files you'll need are:


farcry\core\webtop\admin\bulkfileUpload.cfm
farcry\core\webtop\admin\multipleFilesUploader.cfm
farcry\core\webtop\admin\ui\swf\multipleUploaderFile.swf

You'll also need to add a link to the webtop in your customadmin\customadmin.xml like (this goes into the current "content" section):


<subsection id="contentpublishing" sequence="10" label="Content Publishing">
            <menu id="MediaLibraryContent" sequence="20" label="Media Assets">
                <menuitem id="bulkfileupload" sequence="31" label="Bulk File Upload" link="/admin/multipleFilesUploader.cfm" />
            </menu>
        </subsection>

Reload your application, and that's it. You should now have the ability to upload multiple flies (.pdf, .doc, .zip only... you can modify the flex/swf to accept other attachments as well).

UPDATE: I added a new URL param, fileList and extension. You can now control the file list through the multipleFilesUploader.cfm. Updated the zip to reflect this.

Files

FarCry 5.1 and the Ionic ISAPI rewrite filter for friendly URLs

The 5.1 version of the framework got a big 'ol kick in the pants (especially for a point release) with the entire friendly URL engine undergoing a rewrite (hah). I upgraded one my works in progress for Meteorsite from the 5.02 to 5.1 recently and noticed that my older friendly URLs were no longer being built by the buildlink tag, but they still worked when called with the older /go/ syntax. Hmm... time to investigate.

It turns out, you no longer need to prefix the friendly URL with a search term any longer. No more /go/ or /this/ or /something/ is required. Now, mysite.com/lets-start-this-party will work. Hey, I think it's cool at least, and the VP of marketing at my last job would have loved not having to prefix everything with a /go/.

The magic behind all of this some rather nifty REGEX string to manipulate the URL, and a new piece in the framework that verifies that friendly URLs are working (which broke my current FUs). Once you manage to pass the FU check (http://yoursite.com/pingFU returns a success), your FUs will work as desired. The REGEX and setup instructions can be found on the FarCry WIKI.

Everything was all good until... well, we're on windows, and not running Apache or the the Helicon rewrite filter. Instead, we're running the Ionic filter, and it seems the rewrite rule just doesn't work all that well based on what's in the docs. So began my quest to make that #@$#$ rewrite rule work for the Ionic filter. So, let's first run through how to install the Ionic filter.

Installing the Ionic filter

  1. If you just want to test with a single website, grab the IONIC 1.2.15. If you want to use this on multiple sites on the same machine, grab 2.0a. It really doesn't matter as the script works on both.
  2. Inside the zip, you'll find a lib folder. The two different code branches have diffrerent DLLs names and INI names.
    • 1.2.15: Doesn't matter where you put it, just not in the webroot. Put the IsapiRewrite4.dll and IsapiRewrite4.ini file in a separate folder (good to only have them in there by themselves).
    • 2.0a: Again, put it where you want, but not in the webroot (for 2 of 3 files). Put the IirfGlobal.ini and Iirf.dll in the same folder. Place a Iirf.ini in your webroot.
  3. The script I send should be used in either case for either Iirf.ini, or IsapiRewrite4.ini. Don't touch the IirfGlobal.ini, it only takes the options already in the file.
  4. Windows permissions seem to be the biggest gotcha here. The files all seem to need, at minimum, IIS_WPG and IUSER_. Mine also have Users, SYSTEM, and Administrators if it just the first two don't work for you.
  5. Open up the IIS Admin tool.
  6. Click on web service extensions, and add a new extension for "Ionic Rewriter" (doesn't matter, but I think you need to be consistant here) and choose the appropriate DLL (depending on 1.2.15, 2.0a). Be sure to check the box to set for allowed.
  7. Depending on the level you want to filter at (all sites, just one site) right click and get properties. Click on the ISAPI Filters tab and add the appropriate DLL and click apply or OK (doesn't matter).
  8. Restart the IIS admin (should restart all of the various services too).

My current rewrite script - constantly evolving


# Firstly, let's make sure that the URL is not an admin
# function. The "!" does not work here
# So it was removed. Added [L] to stop processing other
# rules for recursion issues. If you have .xxx files that
# take a URL param, add it here
RewriteCond %{HTTP_URL} (^/farcry|^/webtop|^/flex2gateway|^/flashserviReces|^/cfide|\.cfm|\.swf|\.xml)($|/)
RewriteRule ^(.*)$ $1 [L]

# Next, if it doesn't match the above, let's to see if
# there's a "?" in the string and rewrite it to be
# a "&". This is to catch cases like
# /something/?this=here. We stop processing here to
# prevent going all circular in our logic by using the "[L]".
RewriteCond %{HTTP_URL} (.*)(\?)(.*)
RewriteRule (.*)(\?)(.*) /index.cfm?furl=$1&$3 [L]

# This was junked as the first rule replaced it, but
# leaving it here just in case commented out
#RewriteCond %{HTTP_URL} (^\.index.cfm)
#RewriteRule ^(.*)$ $1

# Last, failing all else, rewrite the string to the
# normal furl sequence. Removed the checking
# for a space from the WIKI sequence as it breaks for IONIC.
RewriteRule ^([a-zA-Z0-9\/\-\%:\[\]\{\}\|\;\<\>\?\,\*\!\@\#\$\(\)\^_`~]*)$ /index.cfm?furl=$1

Be sure to follow all of the directions in that WIKI entry, in addition to what I've provided here. At this point, it works for everything that I've thrown at it. Going to /cfide, or /farcry works. Going to the normal .cfm files works, and my flash players all work. I've run into the odd issue where I've tried to reference the application.url.conjurer URL, but I've since switched to buildlink to replace calls to that variable. The other odd issue is that the first condition was having case sensitivity issues.

Cool FarCry 5.1 feature you may have missed

I'm not even sure when I noticed this, but there's a now a Country and State formtool type (fttype). The Meteorsite project needed a tours page that includes state information. I'm fairly sure that it's going to just be North America for now, but we can always hash that out later.

The Country type is pretty well defined out of the box, but the State type only includes information relevant to the Auzzie's (which makes sense, really). So, let's extend our new state type and include the provinces from Canada, and the US states.

Copy the /farcry/core/packages/formtools/state.cfc to your local /farcry/projects/packages/formtools/state.cfc. You'll need to change the extend to farcry.core.packages.formtools.state in the state.cfc. The following is the additions to the getState function.


<!--- North America - USA --->
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","AL") /><cfset querysetcell(q,"name","ALABAMA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","AK") /><cfset querysetcell(q,"name","ALASKA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />    
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","AS") /><cfset querysetcell(q,"name","AMERICAN SAMOA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","AZ") /><cfset querysetcell(q,"name","ARIZONA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","AR") /><cfset querysetcell(q,"name","ARKANSAS") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","CA") /><cfset querysetcell(q,"name","CALIFORNIA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","CO") /><cfset querysetcell(q,"name","COLORADO") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","CT") /><cfset querysetcell(q,"name","CONNECTICUT") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","DE") /><cfset querysetcell(q,"name","DELAWARE") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","DC") /><cfset querysetcell(q,"name","DISTRICT OF COLUMBIA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","FM") /><cfset querysetcell(q,"name","FEDERATED STATES OF MICRONESIA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","FL") /><cfset querysetcell(q,"name","FLORIDA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","GA") /><cfset querysetcell(q,"name","GEORGIA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","GU") /><cfset querysetcell(q,"name","GUAM") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","HI") /><cfset querysetcell(q,"name","HAWAII") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","ID") /><cfset querysetcell(q,"name","IDAHO") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","IL") /><cfset querysetcell(q,"name","ILLINOIS") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","IN") /><cfset querysetcell(q,"name","INDIANA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","IA") /><cfset querysetcell(q,"name","IOWA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","KS") /><cfset querysetcell(q,"name","KANSAS") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","KY") /><cfset querysetcell(q,"name","KENTUCKY") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","LA") /><cfset querysetcell(q,"name","LOUISIANA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","ME") /><cfset querysetcell(q,"name","MAINE") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","MH") /><cfset querysetcell(q,"name","MARSHALL ISLANDS") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","MD") /><cfset querysetcell(q,"name","MARYLAND") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","MA") /><cfset querysetcell(q,"name","MASSACHUSETTS") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","MI") /><cfset querysetcell(q,"name","MICHIGAN") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","MN") /><cfset querysetcell(q,"name","MINNESOTA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","MS") /><cfset querysetcell(q,"name","MISSISSIPPI") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","MO") /><cfset querysetcell(q,"name","MISSOURI") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","MT") /><cfset querysetcell(q,"name","MONTANA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NE") /><cfset querysetcell(q,"name","NEBRASKA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NV") /><cfset querysetcell(q,"name","NEVADA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NH") /><cfset querysetcell(q,"name","NEW HAMPSHIRE") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NJ") /><cfset querysetcell(q,"name","NEW JERSEY") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NM") /><cfset querysetcell(q,"name","NEW MEXICO") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NY") /><cfset querysetcell(q,"name","NEW YORK") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NC") /><cfset querysetcell(q,"name","NORTH CAROLINA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","ND") /><cfset querysetcell(q,"name","NORTH DAKOTA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","MP") /><cfset querysetcell(q,"name","NORTHERN MARIANA ISLANDS") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","OH") /><cfset querysetcell(q,"name","OHIO") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","OK") /><cfset querysetcell(q,"name","OKLAHOMA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","OR") /><cfset querysetcell(q,"name","OREGON") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","PW") /><cfset querysetcell(q,"name","PALAU") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","PA") /><cfset querysetcell(q,"name","PENNSYLVANIA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","PR") /><cfset querysetcell(q,"name","PUERTO RICO") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","RI") /><cfset querysetcell(q,"name","RHODE ISLAND") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","SC") /><cfset querysetcell(q,"name","SOUTH CAROLINA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","SD") /><cfset querysetcell(q,"name","SOUTH DAKOTA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","TN") /><cfset querysetcell(q,"name","TENNESSEE") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","TX") /><cfset querysetcell(q,"name","TEXAS") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","UT") /><cfset querysetcell(q,"name","UTAH") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","VT") /><cfset querysetcell(q,"name","VERMONT") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","VI") /><cfset querysetcell(q,"name","VIRGIN ISLANDS") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","VA") /><cfset querysetcell(q,"name","VIRGINIA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","WA") /><cfset querysetcell(q,"name","WASHINGTON") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","WV") /><cfset querysetcell(q,"name","WEST VIRGINIA") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","WI") /><cfset querysetcell(q,"name","WISCONSIN") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","WY") /><cfset querysetcell(q,"name","WYOMING") /><cfset querysetcell(q,"countrycode","US") /><cfset querysetcell(q,"countryname","United States of America") />
            
            <!--- North America - Canada--->
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","AB") /><cfset querysetcell(q,"name","Alberta") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","BC") /><cfset querysetcell(q,"name","British Columbia") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","MB") /><cfset querysetcell(q,"name","Manitoba") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NB") /><cfset querysetcell(q,"name","New Brunswick") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NL") /><cfset querysetcell(q,"name","Newfoundland and Labrador") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NT") /><cfset querysetcell(q,"name","Northwest Territories") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NS") /><cfset querysetcell(q,"name","Nova Scotia") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","NU") /><cfset querysetcell(q,"name","Nunavut") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","ON") /><cfset querysetcell(q,"name","Ontario") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","PE") /><cfset querysetcell(q,"name","Prince Edward Island") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","QC") /><cfset querysetcell(q,"name","Quebec") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","SK") /><cfset querysetcell(q,"name","Saskatchewan") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            <cfset queryaddrow(q) /><cfset querysetcell(q,"code","YT") /><cfset querysetcell(q,"name","Yukon") /><cfset querysetcell(q,"countrycode","CA") /><cfset querysetcell(q,"countryname","Canada") />
            

And, there you go. Ready made dropdowns to capture state information. You'd set the cfproperty to call this like the example below. You can specify a delimited list of country codes in ftCountries to grab from, or leave the property blank to grab all states in the getStates funtion.


<cfproperty ftseq="7" ftfieldset="Tour Event Overview" ftwizardStep="General Details" name="state" type="string" hint="State." fttype="state" ftCountries="US,CA" required="no" default="" ftLabel="State" />

Error when entering lots of text view the body tag of a FarCry content item

I forgot that I've seen this before, but I had a client trying to enter text (quite a bit, in fact) and it kept failing. After finally getting all of the information on the incident, it turns out that the following error was being generated:


ErrorContext WDDX packet parse error at line 1, column 32001.
Message WDDX packet parse error at line 1, column 32001. XML
document structures must start and end within the same entity..
StackTrace coldfusion.wddx.WddxDeserializationException: WDDX
packet parse error at line 1, column 32001. XML document
structures must start and end within the same entity

I google'd around a bit before I found the answer. We're storing the body field as a CLOB (at least, I'm pretty sure that's what it is). The default buffer size for this in the ColdFusion administrator is 32k. My text input went beyond that. Whoops. So, I made sure to check the box for CLOB (and turned on BLOB for good measure) and set the size to 128k. Problem solved, and now they can enter a very long string of text into the database. Just throwing this out there in case anyone else stumbles upon this issue.

So, I hacked my FarCry core tonight... but the result is pretty cool.

I have a client request to add filtering by category in the Open Library picker. In fact, really thinking on this, it seems odd that this ability isn't there anyway. What the heck good is categorizing all of your images if you can't find an easy way to filter them out?

So, it's with that in mind, I set out trying to get this functionality in place. I had to hack up /farcry/core/webtop/facade/library.cfm to do this, so it's an at your own risk operation. The problem I run into is that the formtools tag and the wizard tag call this library picker. Unless you extend every object that uses these tags (because you can't extend a tag that I see), I'm kind of stuck editing this one file. Mayhap Mat Bryant is following along and can offer up some advice?

At any rate, here is what I did to add a drop down category list to filter results by.

First, you need to add a new cfparam at the top of the file. This ensures that our field is defined, in case it's blank.


<cfparam name="session.stLibraryFilter['#request.ftJoin#'].category" default="" />

Next, add the following into the ft:processForm action="search". This catches our new form field.


<cfset session.stLibraryFilter['#request.ftJoin#'].category = lCase(form.filtercat)>

Add this to processForm action="Refresh". This clears out the category value when the Refresh button is clicked.


<cfset session.stLibraryFilter[request.ftJoin].category = "" />

Next, add this block below the cfif block that catches the presence of the .criteria value. This will create a query to return our filtered data.


<cfif len(session.stLibraryFilter[request.ftJoin].category)>
    <cfset oCat = createObject("component", "farcry.core.packages.types.category") />
    <cfset qSearchResults2 = oCat.getDataQuery(lCategoryIDs="#session.stLibraryFilter[request.ftJoin].category#"
        ,typename="#request.ftJoin#"
        ,maxRows="100"
        ,bMatchAll="0"
        ,sqlOrderBy="label ASC",
        lFields="label"
        ) /
>

    
    <cfset filterCriteria = session.stLibraryFilter[request.ftJoin].Criteria />
    <cfif NOT qSearchResults2.RecordCount>
        <cfoutput><h3>No Results matched search. All records have been returned</h3></cfoutput>
        <cfset session.stLibraryFilter['#request.ftJoin#'].qResults = queryNew("objectid,label") />
        
    <cfelse>
        <cfif qSearchResults2.RecordCount GT 100>
            <cfoutput><h3>#qSearchResults2.RecordCount# results matched search. Results have been limited to 100.</h3></cfoutput>
            
            <cfquery dbtype="query" name="qSearchResults_inside" maxrows="100">
            SELECT objectid as key, label FROM qSearchResults2
            <cfif len(filterCriteria)>
                WHERE label like '%#filterCriteria#%'
            </cfif>
            </cfquery>
        <cfelse>
            <cfquery dbtype="query" name="qSearchResults_inside" >
            SELECT objectid as [key], label FROM qSearchResults2
            <cfif len(filterCriteria)>
                WHERE LOWER(label) like '%#filterCriteria#%'
            </cfif>
            </cfquery>    
        </cfif>
        <cfset session.stLibraryFilter['#request.ftJoin#'].qResults = qSearchResults_inside />
    </cfif>
            
    
</cfif>

Last, we need to modify the form. Add this select into the last cell (or create one). This populates the select list from all of the categories in the system.


<cfset oCategory = createObject("component",'farcry.core.packages.farcry.category')>
        <cfset rootID = application.catid['root'] >
        <cfset qCategory = oCategory.getAllCategories() />
        
        <cfoutput><select id="filtercat" name="filtercat">
                <option></option>
        </cfoutput>
        <cfloop query=qCategory>
            <cfoutput><option value="#objectid#" <cfif objectid EQ session.stLibraryFilter[request.ftJoin].category>selected</cfif>>#objectname#</option></cfoutput>
        </cfloop>
        <cfoutput></select></cfoutput>

And, it's done. The only issue I'm seeing is that the category seems to stick around, where the text filter does not. I'm still working on why that would be, and I cannot find the variables used for the storage of those values anywhere else. However, it's a small price to pay.

I need to clarify where that first param needs to be. There's a line that set's request.ftJoin = url.ftJoin. The param must be below this cfset! I'm not sure if this is new, but this tripped me up today.

To answer Jeff's question, see the screenshots attached.

Unfiltered content:

Filter by keyword:

Filter by category:

Filter by category and keyword:

New register feature in FarCry 5

I've been wanting to write this up for a few weeks, and tonight appears to be the night. My most recent project has a members area that's integral to the site. Now, what's nice about FarCry is it already has a user management system.

Now, I usually create a custom login for each project, as most people want all the aspects of the site to match their look and feel. Silly, right ;). Anyway, I'm poking around in the default login template, and I came across this:


<ft:farcryButtonPanel>                    
                    <cfoutput><ul class="loginForgot"></cfoutput>
                        <sec:CheckPermission webskinpermission="forgotPassword" type="farUser">
                            <cfoutput>
                                <li><skin:buildLink type="farUser" view="forgotPassword">Forgot Password</skin:buildLink></li></cfoutput>
                        </sec:CheckPermission>
                        <sec:CheckPermission webskinpermission="forgotUserID" type="farUser">
                            <cfoutput>
                                <li><skin:buildLink type="farUser" view="forgotUserID">Forgot UserID</skin:buildLink></li></cfoutput>                        
                            <cfoutput>
                                <li><skin:buildLink type="farUser" view="registerNewUser">Register New User</skin:buildLink></li></cfoutput>
                        </sec:CheckPermission>
                    <cfoutput></ul></cfoutput>

                </ft:farcryButtonPanel>

I'm thinking, "Wow, that's cool. Looks like they have a forgotten username/password templates there, that's new". But then I hit that last one, the registerNewUser template. And my mind found a happy place... a really really happy place. I know that the register user one wasn't there in the 4.0 builds, I wonder if it works? It turns out that it does, and it works really very well. So, here's how you enable self user registration.

By default, anonymous cannot view the templates required to create a user. There's several templates involved here, and they reside in the dmProfile/farUser webskin folders. I spent the better part of two hours trying to figure out WHY I couldn't see the bloody template. And here's why I couldn't. You need log into the webtop and enable access to the correct templates.

So, log into the webtop and browser to the "Admin" tab, and then on the left hand navigation choose the "Roles" link. When the roles load into the main content section, choose to edit the anonymous role. Now, I spent forever looking in permissions, but it's actually the Webskin link which needs to be addressed. You need to double click on the following to give Anonymous access to view them:

farUser.registerConfirmation farUser.registerConfirmationAccepted farUser.registerConfirmationEmail farUser.registerEditNewUser farUser.registerNewUser dmProfile.registerEditNewProfile

And, that's it. You can now allow users to self register. Well, Ok, that's not quite the end. You need to style the above pages to match your look and feel. You'll likely also want to flesh out the basic information sent in the confirmation email template to suite your tastes. Did I ever mention how much I like FarCry ;).

More Entries