Changeset 2615

Show
Ignore:
Timestamp:
08/29/09 00:46:04 (4 years ago)
Author:
lmajano
Message:

New event handler: MissingTemplateHandler? that taps into cf8's onMissingTemplate() handler

Location:
coldbox/trunk
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • coldbox/trunk/ApplicationTemplate/Application.cfc

    r2194 r2615  
    6565        </cffunction> 
    6666         
    67         <!--- on Session Start ---> 
    68         <cffunction name="onSessionStart" returnType="void" output="false">                      
    69                 <cfset super.onSessionStart()> 
    70                 <!--- WHATEVER YOU WANT BELOW ---> 
    71         </cffunction> 
    72          
    73         <!--- on Session End ---> 
    74         <cffunction name="onSessionEnd" returnType="void" output="false"> 
    75                 <!--- ************************************************************* ---> 
    76                 <cfargument name="sessionScope" type="struct" required="true"> 
    77                 <cfargument name="appScope"     type="struct" required="false"> 
    78                 <!--- ************************************************************* ---> 
    79                 <cfset super.onSessionEnd(argumentCollection=arguments)> 
    80                 <!--- WHATEVER YOU WANT BELOW ---> 
    81         </cffunction> 
    82          
    8367</cfcomponent> 
  • coldbox/trunk/ApplicationTemplate/Application_noinheritance.cfc

    r2194 r2615  
    8989        </cffunction> 
    9090         
     91        <!--- OnMissing Template ---> 
     92        <cffunction     name="onMissingTemplate" access="public" returntype="boolean" output="true" hint="I execute when a non-existing CFM page was requested."> 
     93                <cfargument name="template"     type="string" required="true"   hint="I am the template that the user requested."/> 
     94                <cfreturn appScope.cbBootstrap.onMissingTemplate(argumentCollection=arguments)> 
     95        </cffunction> 
     96         
    9197</cfcomponent> 
  • coldbox/trunk/ApplicationTemplate/config/coldbox.xml.cfm

    r2502 r2615  
    3030                <Setting name="SessionStartHandler"             value=""/> 
    3131                <Setting name="SessionEndHandler"                       value=""/> 
     32                <Setting name="MissingTemplateHandler"          value=""/> 
    3233                 
    3334                <!-- Extension Points --> 
  • coldbox/trunk/ApplicationTemplateRemote/Application.cfc

    r2236 r2615  
    6565        </cffunction> 
    6666         
    67         <!--- on Session Start ---> 
    68         <cffunction name="onSessionStart" returnType="void" output="false">                      
    69                 <cfset super.onSessionStart()> 
    70                 <!--- WHATEVER YOU WANT BELOW ---> 
    71         </cffunction> 
    72          
    73         <!--- on Session End ---> 
    74         <cffunction name="onSessionEnd" returnType="void" output="false"> 
    75                 <!--- ************************************************************* ---> 
    76                 <cfargument name="sessionScope" type="struct" required="true"> 
    77                 <cfargument name="appScope"     type="struct" required="false"> 
    78                 <!--- ************************************************************* ---> 
    79                 <cfset super.onSessionEnd(argumentCollection=arguments)> 
    80                 <!--- WHATEVER YOU WANT BELOW ---> 
    81         </cffunction> 
    82          
    8367</cfcomponent> 
  • coldbox/trunk/ApplicationTemplateRemote/Application_noinheritance.cfc

    r2236 r2615  
    8989        </cffunction> 
    9090         
     91        <!--- OnMissing Template ---> 
     92        <cffunction     name="onMissingTemplate" access="public" returntype="boolean" output="true" hint="I execute when a non-existing CFM page was requested."> 
     93                <cfargument name="template"     type="string" required="true"   hint="I am the template that the user requested."/> 
     94                <cfreturn appScope.cbBootstrap.onMissingTemplate(argumentCollection=arguments)> 
     95        </cffunction> 
     96         
    9197</cfcomponent> 
  • coldbox/trunk/ApplicationTemplateRemote/config/coldbox.xml.cfm

    r2502 r2615  
    2626                <Setting name="SessionStartHandler"             value=""/> 
    2727                <Setting name="SessionEndHandler"                       value=""/> 
     28                <Setting name="MissingTemplateHandler"          value=""/> 
    2829                 
    2930                <!-- Extension Points --> 
  • coldbox/trunk/ApplicationTemplateSimple/Application.cfc

    r2461 r2615  
    6565        </cffunction> 
    6666         
    67         <!--- on Session Start ---> 
    68         <cffunction name="onSessionStart" returnType="void" output="false">                      
    69                 <cfset super.onSessionStart()> 
    70                 <!--- WHATEVER YOU WANT BELOW ---> 
    71         </cffunction> 
    72          
    73         <!--- on Session End ---> 
    74         <cffunction name="onSessionEnd" returnType="void" output="false"> 
    75                 <!--- ************************************************************* ---> 
    76                 <cfargument name="sessionScope" type="struct" required="true"> 
    77                 <cfargument name="appScope"     type="struct" required="false"> 
    78                 <!--- ************************************************************* ---> 
    79                 <cfset super.onSessionEnd(argumentCollection=arguments)> 
    80                 <!--- WHATEVER YOU WANT BELOW ---> 
    81         </cffunction> 
    82          
    8367</cfcomponent> 
  • coldbox/trunk/ApplicationTemplateSimple/config/coldbox.xml.cfm

    r2502 r2615  
    2929                <Setting name="SessionStartHandler"             value=""/> 
    3030                <Setting name="SessionEndHandler"                       value=""/> 
     31                <Setting name="MissingTemplateHandler"          value=""/> 
    3132                 
    3233                <!-- Error/Exception Handling --> 
  • coldbox/trunk/system/Coldbox.cfc

    r2524 r2615  
    275275        </cffunction> 
    276276         
     277        <!--- OnMissing Template ---> 
     278        <cffunction     name="onMissingTemplate" access="public" returntype="boolean" output="true" hint="I execute when a non-existing CFM page was requested."> 
     279                <cfargument name="template"     type="string" required="true"   hint="I am the template that the user requested."/> 
     280                <cfset var cbController = ""> 
     281                <cfset var event = ""> 
     282                 
     283                <cflock type="readonly" name="#getAppHash()#" timeout="#getLockTimeout()#" throwontimeout="true"> 
     284                        <cfset cbController = application[locateAppKey()]> 
     285                </cflock>        
     286                 
     287                <cfscript> 
     288                        //Execute Missing Template Handler 
     289                        if ( len(cbController.getSetting("MissingTemplateHandler")) ){ 
     290                                // Save missing template in RC and right handler for this call. 
     291                                event = cbController.getRequestService().getContext(); 
     292                                event.setValue("missingTemplate",arguments.template); 
     293                                event.setValue(cbController.getSetting("EventName"),cbController.getSetting("MissingTemplateHandler")); 
     294                                 
     295                                //Process it 
     296                                processColdBoxRequest(); 
     297                                 
     298                                // Return processed 
     299                                return true; 
     300                        } 
     301                         
     302                        return false; 
     303                </cfscript> 
     304        </cffunction> 
     305         
    277306        <!--- Session Start ---> 
    278307        <cffunction name="onSessionStart" returnType="void" output="false" hint="An onSessionStart method to use or call from your Application.cfc"> 
  • coldbox/trunk/system/config/config.xsd

    r2555 r2615  
    5656                                                                        <xs:enumeration value="LayoutsExternalLocation" />       
    5757                                                                        <xs:enumeration value="MessageboxStyleOverride" /> 
     58                                                                        <xs:enumeration value="MissingTemplateHandler"/> 
    5859                                                                        <xs:enumeration value="PluginsExternalLocation" /> 
    5960                                                                        <xs:enumeration value="onInvalidEvent"/>         
  • coldbox/trunk/system/plugins/XMLParser.cfc

    r2607 r2615  
    449449                                fwSettingsStruct["FlashURLPersistScope"] = configStruct["FlashURLPersistScope"]; 
    450450                        } 
     451                        //Check for Missing Template Handler 
     452                        if ( not StructKeyExists(configStruct, "MissingTemplateHandler") ) 
     453                                configStruct["MissingTemplateHandler"] = ""; 
     454                         
    451455                </cfscript> 
    452456        </cffunction>