Using the Coldfusion filemanager standalone as a file interface
Posted by Paul Klinkenberg in CFML , jQuery + Javascript on December 4, 2010
Someone asked me today if you could use the Coldfusion filemanager plugin for CKeditor as a standalone application. That's a great idea, I thought. It can replace the regular file upload fields.
You can view a working example here.
CKeditor 3 with FREE coldfusion filemanager, version 2.1
Posted by Paul Klinkenberg in CFML , jQuery + Javascript on November 17, 2010
I finally found time to update the coldfusion filemanager for the CKeditor 3. Check the long list of changes underneath! Also read the original blog post for more info on this filemanager.
I released the first versions in February/March 2010, as you can read in this blog post. Since publishing it, I noticed it had some user interface issues. These issues were mostly javascript-related, and were already existent in the original code by the Core Five labs. But nevertheless, they needed to be fixed.
Railo tip: get a query's columnlist case-sensitive
Posted by Paul Klinkenberg in Railo on November 16, 2010
A member of the Railo mailing list asked if he could get the columnlist of a query object case-sensitive. Because #queryObject.columnlist# always returns it uppercase.
One good answer was to look at #getMetaData(queryObject)#, which returns an array with structs with keys isCaseSensitive, name, typeName.
So that's an option, to just loop over that array.
But I knew it must be easier, so I looked in the Railo source code, and found this simple solution:
<cfset caseSensitiveColumnList = queryObject.getColumnlist(false) />
<cfset upperCaseColumnList = queryObject.getColumnlist() />
Pretty cool eeh? Start using Railo today!
NOTE: see the comments underneath; if you typed the actual column names in the SELECT statement, like in "SELECT userID, userName from users", then the case you used there will be returned. But if you used "SELECT * from users", then the actual table column names are returned.
Railo tip: use a custom function for the cfdirectory "filter" attribute
Posted by Paul Klinkenberg in Railo on November 14, 2010
While searching for something else which had to do with cfdirectory, I saw a lot of questions about the filter attribute of cfdirectory. With this attribute, you can filter the results by extensions or part of the file/directory name. For example "*.gif".
The first question that a lot of people have, is whether they can use multiple file filters. The answer is: Yes. You just need to delimit the file filters by a pipe character, like this: "*.gif|*.jpg|*.png".
Another question was whether you could disallow some files or directories from the listing. Now that's much more complicated, or at least you need to write some extra lines of code to remove these from the original directory listing...
Except on Railo! Because with Railo, you can use a custom function as the filter argument, like this:
<cfdirectory action="list" directory="/test/" recurse="true" name="qFiles" filter="#theFilter#" />
<cfdump var="#qFiles#" />
<cffunction name="theFilter" returntype="boolean">
<cfargument name="fullpath" type="string" />
<!--- disallow a certain directory --->
<cfif refindNoCase("[/\\]DisallowedDirectory[/\\]", arguments.fullPath)>
<cfreturn false />
<!--- allow certain extensions --->
<cfelseif refindNoCase("\.(swf|jpe?g|gif|png)$", arguments.fullPath)>
<cfreturn true />
<cfelse>
<cfreturn false />
</cfif>
</cffunction>
As you can see, the function returns a boolean value "true" or "false". True means that the file or directory will be included into the listing, and when False, it will not.
Pretty cool eeh! Start using Railo today ;-)
By the way, when you test this code on ACF 8 or 9, it does not throw an error, but instead just returns zero records.
RegexSafe() function for coldfusion
It will probably already be out there somewhere, but I couldn't find it: a function which makes a string regular-expression-safe to use.
[Skip skip delete remove etcetera]
Edit 15 nov. 2010: See Peter Boughton's comment underneath; the function I thought of could have been made a LOT simpler, so I am just posting his much appreciated code here:
<cffunction name="regExSafe" returntype="string" access="public" output="no">
<cfargument name="text" type="string" required="yes" />
<cfreturn rereplace(arguments.text, "(?=[\[\]\\^$.|?*+()])", "\", "all") />
</cffunction>
Thanks Peter!
Have tested this on ACF 8 and Railo 3.2.0.001.
Recent Comments