root/coldbox/trunk/ApplicationTemplate/handlers/general.cfc @ 2103

Revision 2103, 3.6 kB (checked in by lmajano, 4 years ago)

First run of refactorings

Line 
1<!-----------------------------------------------------------------------
2Author   :      Your Name
3Date     :      September 25, 2005
4Description :                   
5        This is a ColdBox event handler for general methods.
6
7Please note that the extends needs to point to the eventhandler.cfc
8in the ColdBox system directory.
9extends = coldbox.system.EventHandler
10       
11----------------------------------------------------------------------->
12<cfcomponent name="general" extends="coldbox.system.EventHandler" output="false">
13       
14        <!--- Event Caching Suffix: It will be appended to every event cached key. This can be a locale, dynamic, etc. --->
15        <cfset this.EVENT_CACHE_SUFFIX = "">
16        <!--- Pre Handler Execute only if action in this list --->
17        <cfset this.PREHANDLER_ONLY = "">
18        <!--- Pre Handler Do not execute if action in this except list --->
19        <cfset this.PREHANDLER_EXCEPT = "">
20        <!--- Post Handler Execute only if action in this list --->
21        <cfset this.POSTHANDLER_ONLY = "">
22        <!--- Post Handler Do not execute if action in this except list --->
23        <cfset this.POSTHANDLER_EXCEPT = "">
24       
25<!------------------------------------------- CONSTRUCTOR ------------------------------------------>
26
27        <!--- This init is mandatory, including the super.init(). --->
28        <cffunction name="init" access="public" returntype="general" output="false">
29                <cfargument name="controller" type="any">
30                <cfset super.init(arguments.controller)>
31                <!--- Any constructor code here --->
32                <cfreturn this>
33        </cffunction>
34
35<!----------------------------------------- IMPLICIT EVENTS ------------------------------------------>
36
37        <!--- UNCOMMENT HANDLER IMPLICIT EVENTS
38       
39        <!--- preHandler --->
40        <cffunction name="preHandler" access="public" returntype="void" output="false" hint="Executes before any event in this handler">
41                <cfargument name="Event" type="any" required="yes">
42                <cfset var rc = event.getCollection()>
43                <cfscript>     
44       
45                </cfscript>
46        </cffunction>
47       
48        <!--- postHandler --->
49        <cffunction name="postHandler" access="public" returntype="void" output="false" hint="Executes after any event in this handler">
50                <cfargument name="Event" type="any" required="yes">
51                <cfset var rc = event.getCollection()>
52                <cfscript>     
53       
54                </cfscript>
55        </cffunction>
56       
57        <!--- onMissingAction --->
58        <cffunction name="onMissingAction" access="public" returntype="void" output="false" hint="Executes if a request action (method) is not found in this handler">
59                <cfargument name="Event"                        type="any" required="yes">
60                <cfargument name="MissingAction"        type="any" required="true" hint="The requested action string"/>
61                <cfset var rc = event.getCollection()>
62                <cfscript>     
63       
64                </cfscript>
65        </cffunction>
66       
67        --->
68
69<!------------------------------------------- PUBLIC EVENTS ------------------------------------------>
70
71        <!--- Default Action --->
72        <cffunction name="index" access="public" returntype="void" output="false">
73                <cfargument name="Event" type="any">
74                <!--- RC Reference --->
75                <cfset var rc = event.getCollection()>
76               
77                <!--- Do Your Logic Here to prepare a view --->
78                <cfset Event.setValue("welcomeMessage","Welcome to ColdBox!")> 
79               
80                <!--- Set the View To Display, after Logic --->
81                <cfset Event.setView("home")>
82        </cffunction>
83       
84        <!--- Do Something Action --->
85        <cffunction name="doSomething" access="public" returntype="void" output="false">
86                <cfargument name="Event" type="any">
87                <!--- RC Reference --->
88                <cfset var rc = event.getCollection()>
89               
90                <!--- Do Your Logic Here, call to models, etc.--->
91
92                <!--- Set the next event to run, after Logic, this relocates the browser--->
93                <cfset setNextEvent("general.index")>
94        </cffunction>
95
96<!------------------------------------------- PRIVATE EVENTS ------------------------------------------>
97
98       
99</cfcomponent>
Note: See TracBrowser for help on using the browser.