Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
154 lines (130 sloc) 5.89 KB
This file is part of muraFW1
(c) Stephen J. Withington, Jr. |
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Document: Application.cfc
Author: Steve Withington |
<cfcomponent extends="fw1">
<cfinclude template="../../config/applicationSettings.cfm" />
<cfinclude template="../../config/mappings.cfm" />
<cfinclude template="../mappings.cfm" />
<cfset variables.framework = getFramework() />
<!--- ********************** fw/1-specific *************************** --->
<cffunction name="setupApplication" output="false">
var local = StructNew();
<cflock type="exclusive" timeout="50">
// THIS IS CRITICIAL!! This is what gives this FW/1 app access to it's own pluginConfig within Mura CMS
// in the setupRequest() it is also assigned to request.context to allow you to access the pluginConfig with 'rc.pc' OR 'rc.pluginConfig'
application[variables.framework.applicationKey].pluginConfig = application.pluginManager.getConfig(ID=variables.framework.applicationKey);
local.pc = application[variables.framework.applicationKey].pluginConfig;
<cffunction name="setupRequest">
var local = StructNew();
request.context.isAdminRequest = isAdminRequest();
request.context.isFrontEndRequest = isFrontEndRequest();
if ( StructKeyExists(url, application.configBean.getAppReloadKey()) ) {
// rc.$
if ( not StructKeyExists(request.context, '$') ) {
request.context.$ = application.serviceFactory.getBean('muraScope');
if ( StructKeyExists(session, 'siteid') ) {
} else {
// rc.pc and rc.pluginConfig
request.context.pc = application[variables.framework.applicationKey].pluginConfig;
request.context.pluginConfig = application[variables.framework.applicationKey].pluginConfig;
request.context.action = request.context[variables.framework.action];
<cffunction name="onMissingView" output="true">
<cfargument name="rc" />
var local = StructNew();
local.eMessage = "The page you're looking for ";
// rc.action SHOULD always be there, but just in case...
if ( StructKeyExists(arguments.rc, 'action') ) {
local.eMessage = local.eMessage & '<em>' & rc.action & '</em> ';
local.eMessage = local.eMessage & " doesn't exist.";
rc.errors = ArrayNew(1);
ArrayAppend(rc.errors, local.eMessage);
// forward to appropriate error screen
if ( isFrontEndRequest() ) {
} else {
<!--- this should only be used for dev --->
<cffunction name="onError" output="true">
<cfdump var="#arguments#" label="arguments" />
<cfdump var="#request#" label="request" />
<cfabort />
<!--- ********************** HELPERS / Mura-specific *************************** --->
<cffunction name="secureRequest" output="false">
<cfif isAdminRequest() and not ( isDefined('session.mura') and listFindNoCase(session.mura.memberships,'S2') )>
<cfif not StructKeyExists(session,'siteID') or not application.permUtility.getModulePerm(getBeanFactory('pluginConfig').getValue('moduleID'),session.siteid)>
<cflocation url="#application.configBean.getContext()#/admin/" addtoken="false" />
<cffunction name="isAdminRequest" output="false" returntype="boolean">
if ( StructKeyExists(request, 'context') and ListFirst(request.context[variables.framework.action], ':') eq 'admin' ) {
return true;
} else {
return false;
<cffunction name="isFrontEndRequest" output="false" returntype="boolean">
<cfreturn StructKeyExists(request, 'murascope') />
<!--- apparently needed for CF8 (thanks Grant Shepert!) --->
<cffunction name="getFramework" output="false" returntype="any">
<cfset var framework = StructNew() />
<cfinclude template="fw1config.cfm" />
<cfreturn framework />
<cffunction name="buildURL" access="public" output="false" hint="Appends compatDisplay to query string if the current template is in compactDisplay mode.">
<cfargument name="action" type="string" />
<cfargument name="path" type="string" default="#variables.framework.baseURL#" />
<cfargument name="queryString" type="string" default="" />
<cfif StructKeyExists(request.context, "compactDisplay")
and IsBoolean(request.context.compactDisplay)
and not REFindNoCase('&?compactDisplay=[true|false]',arguments.action)
and not REFindNoCase('&?compactDisplay=[true|false]',arguments.queryString)>
<cfif not Find('?',arguments.action)>
<cfset arguments.queryString = ListAppend(arguments.queryString,"compactDisplay=#request.context.compactDisplay#","&") />
<cfset arguments.action = ListAppend(arguments.action, "compactDisplay=#request.context.compactDisplay#","&") />
<cfreturn super.buildURL(argumentCollection=arguments)/>
Something went wrong with that request. Please try again.