Jake Churchill

… on Flex, ColdFusion, FarCry, and much more …

  • Home
  • About
  • Projects

20

Apr

Farcry Logging In And Out

Posted by Jake Churchill  Published in Farcry

A brief discussion of logging in and out in Farcry. Farcry handles redirection beautifully (in my opinion). This is important when using a custom login page and/or members only section. If a user clicks on a link that is part of your member’s only section, you display the login form. But, how do you get them to the correct page once they’ve logged in? I say, very easily, that’s how.

Here’s an example of a members login link:

<a href="#application.config.general.adminserver#/farcry/login.cfm?returnUrl=#cgi.script_name#?#cgi.query_string#">Members Login</a>

You see, the login page that is referenced here first looks to see if you have a custom login form. If not it displays the default. All the default login pages can take a returnUrl parameter which is the page to re-direct the user to after a successful login takes place. In this case, #cgi.script_name#?#cgi.query_string# will pass something like index.cfm?objectid=0FE24133-9027-F64A-79D83E62FD5FF288 to the login page. Of course, that object id is based on the page they have requested.

Now, what about logging out? Why, that’s even easier! Here’s an example of that link:

<a href="#application.config.general.adminserver##cgi.script_name#?logout=1&#cgi.query_string#">Logout</a>

This is just a link to the page the user has requested with logout=1 passed somewhere in teh query string. The index.cfm conjurer page will automatically clear out the user’s session if this is detected.

Pretty slick, huh? Farcry really is a beautiful tool!

no comment

20

Apr

Create A Custom Farcry Login Page

Posted by Jake Churchill  Published in Farcry

This is post number three for today in a series I like to call “Farcry is AWESOME!” I previously explained how to set up Branch Specific Permissions in the site tree. You can view that post at http://jake.cfwebtools.com/index.cfm/2007/4/20/Site-Tree-Branch-Specific-Permission. Then I discussed setting up a members only section of a site so a user has to log in to view certain content. You can view that post at http://jake.cfwebtools.com/index.cfm/2007/4/20/Farcry-Members-Only-Section. There’s one more thing I want to discuss really fast and that’s the login page.

Specifically, when setting up a members only section, it is not very nice to be re-directed to the default blue login page of farcry then back to the site. You’ve spent all this time skinning your site and setting up your nav classes to wow your customer that this could possibly dissatisfy them. So, to avoid that I suggest a custom login page that has the same look and feel as the rest of your site. Here’s how you’d do it…


continue reading "Create A Custom Farcry Login Page"

no comment

20

Apr

Farcry Members Only Section

Posted by Jake Churchill  Published in Farcry

I’ve had a request recently to create a members only section in a farcry site that I developed. I knew this capability was already in farcry, but I had no idea how to do it. So, for anyone else trying to accomplish this, here’s what I did…

First, copy the Anonymous policy group and map it to a users group. The reason we use the Anonymous policy group is because other groups have webtop admin rights so if a general site user logs in and is part of any other group, they will be able to inadvertently access webtop functions by right clicking to access the dynamic menu in the site or by manually entering http://sitename/farcry in the url. This is most-likely not something you will want to give the average user access to.

Once you have the user group and policy group created and have added users to the new user group, create branch specific permissions for the members only section of the website. Remove view permissions from the Anonymous policy and set view permissions for the new group. An anonymous user should not have access to view this branch but the new group you created will.

Ideally, this is all you need to do to have members only access to certain areas of your site. If a user is browsing the site and attempts to view the members only section, they will be prompted to log in. Once the user logs in he/she will be granted access.

If you followed these instructions, the user will be sent to the farcry login page to login but will be redirected to the page they requested. This is not a very appealing way to do this because most of the time you would want a login form styled inside the site you are working on.

no comment

20

Apr

Site Tree Branch Specific Permission

Posted by Jake Churchill  Published in Farcry

So, you’ve got a farcry site up and running and are pretty proud of yourself. That’s great. Now, your client comes to you and says they want a more complicated group policy set up. The default in farcry is to have Contributors, Publishers and Site Administrators. Contributors get access to create and edit content and must request approval from Publishers and Site Admins. Publishers can create, edit, delete and approve content and don’t really need approval from anyone. Site Admins get access to everything including the Admin and Security tabs which are not often used.

Some clients might want something more complicated than that. For example, let’s say we have a site tree (a big one) and the client has a group of people they want to be contributors for part of the site tree and another group of contributors for another part. By default, a contributor has access to the whole site. So, what do you do? Try creating branch specific permissions. Here’s how you do it…


continue reading "Site Tree Branch Specific Permission"

no comment

12

Jan

Farcry Category Selection

Posted by Jake Churchill  Published in Farcry

The categoryAssociation is usually used to select categories. I ran into a problem with that because it doesn’t natively restrict the selection to a single category, which I needed. So, after some digging, I found that using a combination of the functions included in application.factory.ocategory got me the result I was looking for.

Specifically, I had a category called calendar under root which I knew would always be there. I needed a list of the categories under calendar. Here’s what I did:


Throw this code inside the select tag and you get this:

<label for="filterBy"><b>Filter By:</b>
			<select name="filterBy">
				<option value="" <cfif len(trim(stObj.filterBy)) eq 0>selected</cfif>>No Filter</option>
				<cfset qCalCats = application.factory.oTree.getDescendants(application.factory.ocategory.getCategoryID('calendar', application.catid.root))>
				<cfloop from="1" to="#qCalCats.recordcount#" index="i">
					<cfset pre = " ">
					<cfif qCalCats.nLevel[i] gt 2>
						<cfloop from="3" to="#qCalCats.nLevel[i]#" index="j">
							<cfset pre = pre & "- ">
						</cfloop>
					</cfif>
					<option value="#qCalCats.objectName[i]#" <cfif stObj.filterBy eq qCalCats.objectName[i]>selected</cfif>>#pre##qCalCats.objectName[i]#</option>
				</cfloop>
			</select><br>
		</label>
no comment

12

Jan

Farcry Embed Quicktime with tinyMCE

Posted by Jake Churchill  Published in Farcry

I ran into an issue recently where tinyMCE would not allow me to embed a quicktime movie. If you look in the tinyMCE config in the Admin page you will see a list of acceptable HTML tags. embed is not one by default (on FC 3.0.2). I added embed to the acceptable tags but this would still not work. So I worked around it and here’s how:

I created a new InsertHTML snippet for embedding quicktime movies. For more information on InsertHTML snippets, see my blog post on that.

Here’s the code for the snippet:

<!--- @@displayname: Embed Quicktime Movie --->
<!--- @@author: Jake Churchill --->
<cfoutput>
<!-- startEmbed::<embed src="/files/#stObj.filename#" width="330" height="256" autoplay="true" controller="true" quality="high" bgcolor="##ffffff" pluginspage="http://www.apple.com/quicktime/download/" />::endEmbed -->
<!-- delete -->
<br /><br />#stObj.filename# embedded successfully!<br />Note: if you wish to remove this file, you must use the "HTML" button and delete the source.<br />This text will not be displayed when the page is viewed.<br /><br />
<!-- end delete -->
</cfoutput>


continue reading "Farcry Embed Quicktime with tinyMCE"

no comment

12

Jan

Farcry insertHTML templates

Posted by Jake Churchill  Published in Farcry

Here’s a really cool trick that I use for clients all the time. In the webtop, when editing the body of an HTML page, below the main tinyMCE editor text area are 2 select boxes for images and files.

The default action for inserting an image is to insert the thumbnail with a link to the full-sized image. But, what if you don’t want that? What if you just want the thumbnail and nothing else?

Inside your /project_folder/webskins/dmImage folder, create a file called InsertHTML_thumbnail.cfm. Call it whatever you want, just make sure InsertHTML_ is at the beginning of it.

Inside that file, please the following code:

<!--- @@displayname: Thumbnail only --->
<!--- @@author: Jake Churchill --->

<cfoutput>
<img src="#application.url.webroot#/images/#stObj.thumbnail#" alt="">
</cfoutput>

Now, go back to the webtop and edit the body again. Under the images select box you now have a dropdown. The dropdown displays all of the HTML snippets that are available. The name displayed is what you put in @@displayname: in the file.

Now, what if you want a text link to say a PDF file?

Put the following code in /project_folder/webskins/dmFile:

<!--- @@displayname: Link to PDF --->
<!--- @@author: Jake Churchill --->

<cfoutput>
<a href="/files/#stObj.filename#" target="_blank">#stObj.label#</a>
</cfoutput>

This will give you a text link with the label of the PDF file (label as entered into the file library). The link will open a new window and display the PDF file, assuming the correct plugin is available on the client machine.

no comment

12

Dec

Farcry – dmInclude not giving display method

Posted by Jake Churchill  Published in Farcry

This is a known farcry bug but one that I run into constantly so I finally took the time to fix it on my install.

When creating a new dmInclude object you are supposed to be given a display method dropdown but it never shows up. Why you ask? I’ll tell you why. And by the way, I have only confirmed this for farcry version 3.0.2 and it only seems to happen if the install uses the pliant webskin.

When you create a new Include it calls /farcry_core/packages/types/_dmInclude/edit.cfm. On line 110 of that file a widget called displayMethodSelector is called. This file is at /farcry_core/tags/widgets/. edit.cfm passes a parameter called prefix set to “displayPage”. Line 33 of /farcry_core/tags/widgets/displayMethodSelector.cfm calls listTemplates.cfm which is in /farcry_core/tags/navajo/ and passes it the attributes.prefix variable that it got from edit.cfm (still “displayPage”). listTemplates.cfm has code on lines 24-31 that looks like this:

<cfdirectory action="LIST" filter="*.cfm" name="qTemplates" directory="#attributes.path#">

<!--- This is to overcome casesensitivity issues on mac/linux machines --->
<cfquery name="qTemplates" dbtype="query">
	SELECT *
	FROM qTemplates
	WHERE lower(qTemplates.name) LIKE <cfqueryparam cfsqltype="cf_sql_varchar" value="#attributes.prefix#%">
</cfquery>

I praise Daemon for doing this case sensitivity check to make sure their product works on all systems. However, I have to scold them for the default value of the prefix variable.

This code is looking for all files in the /project_name/webskin/dmInclude directory with the prefix of “displayPage” but the example files in that directory have the prefix of “display”. THAT is why there’s nothing in the dropdown.

There are 2 ways to fix this but I will only recommend 1. The first, and strongly recommended fix is to change the file names from “display…” to “displayPage…” inside the /project_name/webskin/dmInclude directory. The second and far less recommended way to fix it is to change the default value of the prefix variable in /farcry_core/packages/types/_dmInclude/edit.cfm to “display”.

I recommend the first way of fixing this because in all the other type classes “displayPage” is the standard prefix so it would be a reasonable assumption that “displayPage” is what they meant but it just didn’t come out that way.

To fix this for future installs (if you are using the pliant webskin) go to /farcry_pliant/webskin/dmInclude and rename those files to be “displayPage…”.

no comment

12

Dec

Farcry Navigation (extending dmNavigation)

Posted by Jake Churchill  Published in Farcry

I came across problem today in that a client has a menu tree that I built in Farcry. Works perfectly, except for the fact that one of the menu items does not correspond with a page that would be displayed in the content area. This single menu item was to be a pop-up window. So, I had 2 options. Do it the easy way:

In navigation file:

if (qNav.objectName[i] eq "Video Testimonial") {
    // Write Javascript popup instead of a normal link
}

Or do it the Right way.

It took 3 hours of time but I did it the right way *pats himself on the back.

The way to accomplish this is to extend the dmNavigation class and I did so in such a way that you might want to copy it because it makes a lot of sense. I’m even considering submitting this to Daemon’s wiki.

If you search my blog I wrote about this before but that project required adding navigation node specific CSS code. This is much more applicable.

First, I created a new file called dmNavigation.cfc in /project_name/packages/types/. I created a sub directory there called _dmNavigation and copied edit.cfm from /farcry_core/packages/types/_dmnavigation/.

I created a bunch of new properties in my dmNavigation.cfc file and, of course, I extended farcry.farcry_core.packages.types.dmNavigation. (I’ll copy the entire code from that file shortly). Then I added the new form fields and some validation for submission in the edit.cfm file. Then I overwrote the edit function by writing a new edit function in my custom dmNavigation.cfc file. Finally, I changed the nav.cfm file that actually writes out the menu structure. (more on that later)


continue reading "Farcry Navigation (extending dmNavigation)"

no comment

28

Nov

Farcry Quick Links

Posted by Jake Churchill  Published in Farcry

Quick links is an interesting concept that can be very useful. It just so happens that Farcry is excellent at dynamically generating them.

First of all, the way I’m using quick links is I am putting a select box somewhere in the header. The user selects something from the dropdown and goes there :)

Let’s go over what we need to make this work…

First, you need a way to create quick links. I have a tutorial available for download about this. Basically, create a new Navigation node under Root called Quick Links (or whatever you want) and set the alias to “quicklinks.” The alias part is very important, what it’s named is not.

Within that Navigation node, create other navigation nodes but do NOT create HTML pages corresponding to them. If you right click on the Node inside the Site tree and select Navigation you will be fine. If you do this through Quick Site Builder you have to make sure to uncheck the part about creating HTML pages. Go into each of the navigation nodes and set the Symbolic Link to one of the pages/nodes you’ve already created. (If you do this in Quick Site Builder you have to go into each node separately. If you create them through the Site Tree you can do it right then.

Quicklinks FAQ

continue reading "Farcry Quick Links"

no comment

Search

Blog Feed

  • Add blog to any reader
  • Comments Rss
February 2012
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
272829  

 

February 2012
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
272829  

Subscribe to Blog

Your email:

Subscribe   Unsubscribe

Archives

Categories

  • Browsers (3)
  • CFEclipse (2)
  • ColdFusion (7)
  • CSS (9)
  • Farcry (33)
    • Farcry Examples (2)
    • Farcry Users (1)
  • Flash (1)
  • Flex (14)
  • Javascript (5)
  • Life & Fun (3)
  • Microsoft Office (1)
  • Misc (4)
  • Random Posts (1)
  • SQL (2)
  • Uncategorized (2)

Blogroll

  • Axel Jensen
  • Ben Forta
  • Coldfusion Muse
  • Fullasagoog
  • Nicole Rutter
  • Ray Camden
  • Sandy Clark
  • Stillnet Studios

Recent Posts

  • FCKEditor Firefox 3.6 Bug (Year 2010 Bug)
  • ColdFusion using Java for regex replace
  • ColdFusion VirtualMerchant CFC
  • Farcry Navigation Move Permissions
  • Delete Mail via POP Script

Recent Comments

  • James Moberg on FCKEditor Firefox 3.6 Bug (Year 2010 Bug)
  • Jake Churchill on ColdFusion using Java for regex replace
  • Ben Nadel on ColdFusion using Java for regex replace
  • Peter Boughton on ColdFusion using Java for regex replace
  • Peter Boughton on ColdFusion using Java for regex replace

Recent Post

  • FCKEditor Firefox 3.6 Bug (Year 2010 Bug)
  • ColdFusion using Java for regex replace
  • ColdFusion VirtualMerchant CFC
  • Farcry Navigation Move Permissions
  • Delete Mail via POP Script
  • Flex 2 Datagrid not highlighting row (UPDATE)
  • Flex 2 Datagrid not highlighting row
  • Flex Dynamic casting of data
  • Reboot XP PC over Remote Desktop
  • Dynamically instantiate a class

Recent Comments

  • James Moberg in FCKEditor Firefox 3.6 Bug (Year 2010 Bug)
  • Jake Churchill in ColdFusion using Java for regex replace
  • Ben Nadel in ColdFusion using Java for regex replace
  • Peter Boughton in ColdFusion using Java for regex replace
  • Peter Boughton in ColdFusion using Java for regex replace
  • Matthew in ColdFusion using Java for regex replace
  • Matthew in ColdFusion using Java for regex replace
  • Jake Churchill in Flex Channel.Connect.Failed error NetConnection.Ca…
  • Flex Guy in Flex Channel.Connect.Failed error NetConnection.Ca…
  • Dexter in Flex Custom Preloader without SWF
© 2008 Jake Churchill is proudly powered by WordPress
Theme designed by Roam2Rome