Galleon ColdFusion 9 fix, and pagination UI update

I got my forums back up and in the process of doing so - found two interesting issues.

First - Image.cfc (which is from the open source ImageCFC project) made use of a CFC method called Throw. This allowed code in the CFC to do:

<cfset throw("Paris Hilton recommend some awesome new shoes. Shaweet!")>

Unfortunately this conflicts with ColdFusion 9's built in support for throwing via script. My "fix" was to simply rename all the throw calls to xc989082903480983894840894328093289042389. Now the code does:

<cfset xc989082903480983894840894328093289042389("code readability ftw!")>

Ok... I lie. I just renamed it mythrow, and updated the method definition as well.

Now for the UI issue. The ColdFusion/General forum has a ginormous number of threads. This created the following "interesting" UI:

That's awesome, isn't it? All it needs is a unicorn or two to spruce it up.

So I thought that wouldn't fly. What I ended up doing is simply adding some logic to say - if there are so many pages, switch to a drop down:

<p>Page: <cfif attributes.pages gt 10> <select onChange="document.location.href=this.options[this.selectedIndex].value"> <cfloop index="x" from=1 to="#attributes.pages#"> <option value="#cgi.script_name#?#qs#&page=#x#" <cfif url.page is x>selected</cfif>>Page #x#</option> </cfloop> </select> <cfelse> <cfloop index="x" from=1 to="#attributes.pages#"> <cfif url.page is not x><a href="#cgi.script_name#?#qs#&page=#x#">#x#</a><cfelse>#x#</cfif> </cfloop> </cfif> </p>

Which results in:

Somewhat better I think. Full City Media, who did the original skin for Galleon 2, is sending me over a small CSS tweak for it that I'll include in the new version shipping tomorrow morning.

Archived Comments

Comment 1 by Michael Evangelista posted on 7/25/2009 at 5:20 AM

Aw... I thought it would end with 'oh yeah and you can moderate comments now, too ". Ok not really.

Comment 2 by Raymond Camden posted on 7/25/2009 at 11:07 PM

Sorry - not yet.

Comment 3 by Adrian Lynch posted on 8/1/2009 at 12:58 PM

Ha! There's nothing worse than when a new ColdFusion introduces a new function that overwrites one you've made earlier. sleep() anyone?

You'd think Adobe would have the decency to check with everyone first!

NEW FOR COLDFUSION 10: xc989082903480983894840894328093289042389()

D'oh!

Comment 4 by Raymond Camden posted on 8/2/2009 at 12:07 AM

@Adrian: Well, to be fair, any new function has a chance of conflicting with a UDF you wrote. :)

Comment 5 by James Moberg posted on 4/16/2010 at 4:09 AM

Have you considered using this open source pagination CFC?
http://www.dopefly.com/proj...

Here are some live examples:
http://www.dopefly.com/proj...

Comment 6 by Raymond Camden posted on 4/16/2010 at 4:03 PM

Nope, didn't think to. I need to next time as I've written too many pagination systems.