Ignore:
Timestamp:
06/27/10 00:24:54 (23 months ago)
Author:
mattlevine
Message:
  1. Adding the ability to have theme local contentRenderer.cfc files. Like the eventHandler.cfc it is loaded during the onApplicationLoad event.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.2/www/requirements/mura/MuraScope.cfc

    r2418 r2434  
    2121        </cfif> 
    2222        <cfreturn this> 
     23</cffunction> 
     24 
     25<cffunction name="OnMissingMethod" access="public" returntype="any" output="false" hint="Handles missing method exceptions."> 
     26<cfargument name="MissingMethodName" type="string" required="true" hint="The name of the missing method." /> 
     27<cfargument name="MissingMethodArguments" type="struct" required="true"/> 
     28        <cfset var local=structNew()> 
     29        <cfset var object=""> 
     30         
     31        <cfif len(MissingMethodName)> 
     32                 
     33                <cfif isObject(getEvent()) and structKeyExists(variables.instance.event,MissingMethodName)> 
     34                        <cfset object=variables.instance.event> 
     35                <cfelseif isObject(getThemeRenderer()) and structKeyExists(getThemeRenderer(),MissingMethodName)> 
     36                        <cfset object=getThemeRenderer()> 
     37                <cfelseif isObject(getContentRenderer()) and structKeyExists(getContentRenderer(),MissingMethodName)> 
     38                        <cfset object=getContentRenderer()> 
     39                <cfelseif isObject(getContentBean()) and structKeyExists(getContentBean(),MissingMethodName)> 
     40                        <cfset object=getContentBean()> 
     41                <cfelse> 
     42                        <cfthrow message="The method '#arguments.MissingMethodName#' is not defined"> 
     43                </cfif> 
     44         
     45                <cfsavecontent variable="local.thevalue2"> 
     46                <cfif not structIsEmpty(MissingMethodArguments)> 
     47                        <cfinvoke component="#object#" method="#MissingMethodName#" argumentcollection="#MissingMethodArguments#" returnvariable="local.theValue1"> 
     48                <cfelse> 
     49                        <cfinvoke component="#object#" method="#MissingMethodName#" returnvariable="local.theValue1"> 
     50                </cfif> 
     51                </cfsavecontent> 
     52                 
     53                <cfif isDefined("local.theValue1")> 
     54                        <cfreturn local.theValue1> 
     55                <cfelseif isDefined("local.theValue2")> 
     56                        <cfreturn local.theValue2> 
     57                <cfelse> 
     58                        <cfreturn ""> 
     59                </cfif> 
     60        <cfelse> 
     61                <cfreturn ""> 
     62        </cfif> 
    2363</cffunction> 
    2464 
     
    4484</cffunction> 
    4585 
     86<cffunction name="getThemeRenderer" output="false" returntype="any"> 
     87        <cfreturn event("themeRenderer")> 
     88</cffunction> 
     89 
    4690<cffunction name="getContentBean" output="false" returntype="any"> 
    4791        <cfreturn event("contentBean")> 
     
    83127        </cfif> 
    84128        <cfreturn this> 
    85 </cffunction> 
    86  
    87 <cffunction name="OnMissingMethod" access="public" returntype="any" output="false" hint="Handles missing method exceptions."> 
    88 <cfargument name="MissingMethodName" type="string" required="true" hint="The name of the missing method." /> 
    89 <cfargument name="MissingMethodArguments" type="struct" required="true"/> 
    90         <cfset var local=structNew()> 
    91         <cfset var object=""> 
    92          
    93         <cfif len(MissingMethodName)> 
    94                  
    95                 <cfif isObject(getEvent()) and structKeyExists(variables.instance.event,MissingMethodName)> 
    96                         <cfset object=variables.instance.event> 
    97                 <cfelseif isObject(getContentRenderer()) and structKeyExists(getContentRenderer(),MissingMethodName)> 
    98                         <cfset object=getContentRenderer()> 
    99                 <cfelseif isObject(getContentBean()) and structKeyExists(getContentBean(),MissingMethodName)> 
    100                         <cfset object=getContentBean()> 
    101                 <cfelse> 
    102                         <cfthrow message="The method '#arguments.MissingMethodName#' is not defined"> 
    103                 </cfif> 
    104          
    105                 <cfsavecontent variable="local.thevalue2"> 
    106                 <cfif not structIsEmpty(MissingMethodArguments)> 
    107                         <cfinvoke component="#object#" method="#MissingMethodName#" argumentcollection="#MissingMethodArguments#" returnvariable="local.theValue1"> 
    108                 <cfelse> 
    109                         <cfinvoke component="#object#" method="#MissingMethodName#" returnvariable="local.theValue1"> 
    110                 </cfif> 
    111                 </cfsavecontent> 
    112                  
    113                 <cfif isDefined("local.theValue1")> 
    114                         <cfreturn local.theValue1> 
    115                 <cfelseif isDefined("local.theValue2")> 
    116                         <cfreturn local.theValue2> 
    117                 <cfelse> 
    118                         <cfreturn ""> 
    119                 </cfif> 
    120         <cfelse> 
    121                 <cfreturn ""> 
    122         </cfif> 
    123129</cffunction> 
    124130 
Note: See TracChangeset for help on using the changeset viewer.