| 1 | <!----------------------------------------------------------------------- |
|---|
| 2 | Author : Oscar Arevalo |
|---|
| 3 | Date : February 13, 2006 |
|---|
| 4 | Description : |
|---|
| 5 | General handler for my ColdboxReader application. |
|---|
| 6 | |
|---|
| 7 | Modification History: |
|---|
| 8 | feb/13/2006 - Oscar Arevalo |
|---|
| 9 | -Created the template. |
|---|
| 10 | aug/20/2006 - Luis Majano |
|---|
| 11 | - Modified for 1.1.0 |
|---|
| 12 | -----------------------------------------------------------------------> |
|---|
| 13 | <cfcomponent name="ehGeneral" extends="coldbox.system.eventhandler"> |
|---|
| 14 | |
|---|
| 15 | <cffunction name="onAppStart" access="public" returntype="void" output="false"> |
|---|
| 16 | <!--- Instantiate ColdBox Service ---> |
|---|
| 17 | <cfset application.cbService = CreateObject("component","#getSetting("AppMapping")#.components.coldboxService").init(getDatasource("coldboxreader"))> |
|---|
| 18 | </cffunction> |
|---|
| 19 | |
|---|
| 20 | <cffunction name="onRequestStart" access="public" returntype="void" output="false"> |
|---|
| 21 | <!--- Session param ---> |
|---|
| 22 | <cfparam name="session.userID" default=""> |
|---|
| 23 | <cfparam name="session.username" default=""> |
|---|
| 24 | <!--- EXIT HANDLERS: ---> |
|---|
| 25 | <cfset rc.xehSearch = "ehFeed.doSearchByTerm"> |
|---|
| 26 | </cffunction> |
|---|
| 27 | |
|---|
| 28 | <cffunction name="onException" access="public" returntype="void" output="false"> |
|---|
| 29 | <!--- My own Exception Handler ---> |
|---|
| 30 | <!--- Log error ---> |
|---|
| 31 | <cfset var exceptionBean = getValue("ExceptionBean")> |
|---|
| 32 | <!--- Do per Type Validations, example here ---> |
|---|
| 33 | <cfif exceptionBean.getType eq "Framework.plugins.settings.EventSyntaxInvalidException"> |
|---|
| 34 | <cfset getPlugin("messagebox").setMessage("warning", "No page found with that syntax.")> |
|---|
| 35 | <!--- Relocate to default event ---> |
|---|
| 36 | <cfset setNextEvent()> |
|---|
| 37 | <cfelse> |
|---|
| 38 | <cfset getPlugin("logger").logErrorWithBean(exceptionBean)> |
|---|
| 39 | </cfif> |
|---|
| 40 | </cffunction> |
|---|
| 41 | |
|---|
| 42 | <cffunction name="dspStart" access="public" returntype="void" output="false"> |
|---|
| 43 | <!--- EXIT HANDLERS: ---> |
|---|
| 44 | <cfset rc.xehReader = "ehGeneral.dspReader"> |
|---|
| 45 | <cfset setView("vwMain")> |
|---|
| 46 | </cffunction> |
|---|
| 47 | |
|---|
| 48 | <cffunction name="dspReader" access="public" returntype="void" output="false"> |
|---|
| 49 | <cfset var obj = application.cbService.getdao("feed")> |
|---|
| 50 | <!--- EXIT HANDLERS: ---> |
|---|
| 51 | <cfset rc.xehViewFeed = "ehFeed.dspViewFeed"> |
|---|
| 52 | <cfset rc.xehShowTags = "ehFeed.dspAllTags"> |
|---|
| 53 | <cfset rc.xehShowInfo = "ehGeneral.dspInfo"> |
|---|
| 54 | <cfset rc.xehAccountActions = "ehUser.dspAccountActions"> |
|---|
| 55 | <!--- Get Feeds ---> |
|---|
| 56 | <cfset rc.qryFeeds = obj.getAllFeeds()> |
|---|
| 57 | <cfquery name="rc.qryTopFeeds" dbtype="query" maxrows="8"> |
|---|
| 58 | SELECT * |
|---|
| 59 | FROM rc.qryFeeds |
|---|
| 60 | ORDER BY Views DESC |
|---|
| 61 | </cfquery> |
|---|
| 62 | <cfset setView("vwReader")> |
|---|
| 63 | </cffunction> |
|---|
| 64 | |
|---|
| 65 | <cffunction name="dspInfo" access="public" returntype="void" output="false"> |
|---|
| 66 | <!--- EXIT HANDLERS: ---> |
|---|
| 67 | <cfset rc.xehLogin = "ehUser.dspLogin"> |
|---|
| 68 | <cfset rc.xehSignup = "ehUser.dspSignUp"> |
|---|
| 69 | <cfset setView("vwInfo")> |
|---|
| 70 | </cffunction> |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | </cfcomponent> |
|---|