Changeset 1755

Show
Ignore:
Timestamp:
09/01/08 14:21:56 (4 months ago)
Author:
lmajano
Message:

testing of new set next event combinations

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • coldbox/trunk/system/controller.cfc

    r1754 r1755  
    279279 
    280280        <!--- Set Next Event ---> 
    281         <cffunction name="setNextEvent" access="Public" returntype="void" hint="I Set the next event to run and relocate the browser to that event."  output="false"> 
     281        <cffunction name="setNextEvent" access="Public" returntype="void" hint="I Set the next event to run and relocate the browser to that event. If you are in SES mode, this method will use routing instead"  output="false"> 
    282282                <!--- ************************************************************* ---> 
    283283                <cfargument name="event"                        hint="The name of the event to run."                    type="string" required="No" default="#getSetting("DefaultEvent")#" > 
    284284                <cfargument name="queryString"          hint="The query string to append, if needed."   type="string" required="No" default="" > 
    285                 <cfargument name="addToken"                     hint="Wether to add the tokens or not. Default is false" type="boolean" required="false" default="false"      > 
     285                <cfargument name="addToken"                     hint="Whether to add the tokens or not. Default is false" type="boolean" required="false" default="false"     > 
    286286                <cfargument name="persist"                      hint="What request collection keys to persist in the relocation" required="false" type="string" default=""> 
    287                 <cfargument name="varStruct"            required="false" type="struct" hint="A structure key-value pairs to persist."
     287                <cfargument name="varStruct"            hint="A structure key-value pairs to persist." required="false" type="struct" default="#structNew()#"
    288288                <!--- ************************************************************* ---> 
    289289                <cfset var EventName = getSetting("EventName")> 
    290290                <cfset var frontController = listlast(cgi.script_name,"/")> 
     291                <cfset var oRequestContext = getRequestService().getContext()> 
     292                <cfset var routeString = 0> 
    291293                 
    292294                <!--- Cleanup Event ---> 
     
    295297                </cfif> 
    296298                 
    297                 <!--- Persistance Logic ---> 
    298                 <cfset persistVariables(argumentCollection=arguments)> 
    299                  
    300                 <!--- Push Timers ---> 
    301                 <cfset pushTimers()> 
    302                  
    303                 <!--- Check if query String needs appending ---> 
    304                 <cfif len(trim(arguments.queryString)) eq 0> 
    305                         <cflocation url="#frontController#?#EventName#=#arguments.event#" addtoken="#arguments.addToken#"> 
     299                <!--- Are we in SES Mode? ---> 
     300                <cfif oRequestContext.isSES()> 
     301                        <!--- setup the route ---> 
     302                        <cfset routeString = replace(arguments.event,".","/","all")> 
     303                        <cfif len(trim(arguments.queryString))> 
     304                                <cfset routeString = routeString & "/" & replace(arguments.queryString,"&","/","all")> 
     305                                <cfset routeString = replace(routeString,"=","/","all")> 
     306                        </cfif> 
     307                        <!--- Relocate with routing ---> 
     308                        <cfset setNextRoute(route=routeString, 
     309                                                                persist=arguments.persist,varStruct=arguments.varStruct, 
     310                                                                addToken=arguments.addToken)> 
     311                 
    306312                <cfelse> 
    307                         <cflocation url="#frontController#?#EventName#=#arguments.event#&#arguments.queryString#" addtoken="#arguments.addToken#"> 
     313                        <!--- Persistance Logic ---> 
     314                        <cfset persistVariables(argumentCollection=arguments)> 
     315                        <!--- Push Timers ---> 
     316                        <cfset pushTimers()> 
     317                        <!--- Check if query String needs appending ---> 
     318                        <cfif len(trim(arguments.queryString)) eq 0> 
     319                                <cflocation url="#frontController#?#EventName#=#arguments.event#" addtoken="#arguments.addToken#"> 
     320                        <cfelse> 
     321                                <cflocation url="#frontController#?#EventName#=#arguments.event#&#arguments.queryString#" addtoken="#arguments.addToken#"> 
     322                        </cfif>          
    308323                </cfif> 
    309324        </cffunction> 
     
    314329                <cfargument name="route"                        hint="The route to relocate to, do not prepend the baseURL or /." type="string" required="yes" > 
    315330                <cfargument name="persist"                      hint="What request collection keys to persist in the relocation" required="false" type="string" default=""> 
    316                 <cfargument name="varStruct"            required="false" type="struct" hint="A structure key-value pairs to persist."> 
     331                <cfargument name="varStruct"            hint="A structure key-value pairs to persist." required="false" type="struct"> 
    317332                <cfargument name="addToken"                     hint="Wether to add the tokens or not. Default is false" type="boolean" required="false" default="false"        > 
    318333                <!--- ************************************************************* ---> 
  • coldbox/trunk/testharness/config/routes.cfm

    r1612 r1755  
    5959        Else, htmlBaseURL and sesBaseURL should be the same. 
    6060---> 
    61 <cfset setBaseURL("http://#getSetting('MyBaseURL')#/coldbox/testharness/index.cfm")> 
     61<cfset setBaseURL("http://#cgi.http_host#/#getSetting('AppMapping')#/index.cfm")> 
    6262 
    6363 
     
    111111 
    112112<!--- STANDARD COLDBOX COURSES, DO NOT MODIFY UNLESS YOU DON'T LIKE THEM ---> 
    113 <cfset addCourse(":handler/:action/:id-numeric?")> 
     113<cfset addCourse(":handler/:action?/:id-numeric?")> 
    114114<!--- <cfset addCourse(":handler/:action?/:id?")> ---> 
    115115 
  • coldbox/trunk/testharness/handlers/default.cfc

    r1751 r1755  
    4848         
    4949        <!--- RSS ---> 
    50         <!--- rss ---> 
    5150        <cffunction name="rss" access="public" returntype="void" output="false" hint=""> 
    5251                <cfargument name="Event" type="coldbox.system.beans.requestContext" required="yes"> 
     
    6968        </cffunction> 
    7069         
     70        <!--- testRoute ---> 
     71        <cffunction name="testRoute" access="public" returntype="void" output="false" hint=""> 
     72                <cfargument name="Event" type="coldbox.system.beans.requestContext" required="yes"> 
     73            <cfset var rc = event.getCollection()> 
     74             
     75            <cfset getPlugin("messagebox").setMessage("warning","I am relocating from <strong>default.testRoute</strong>")> 
     76             
     77            <cfset setNextEvent('default.index',"page=2&issues=1")> 
     78        </cffunction> 
     79         
    7180<!------------------------------------------- PRIVATE ------------------------------------------->               
    7281 
  • coldbox/trunk/testharness/handlers/ehGeneral.cfc

    r1605 r1755  
    1515<cfcomponent name="ehGeneral" extends="baseHandler" output="false" autowire="true"> 
    1616 
    17 <!--- Autowire Properties ---> 
    18 <cfproperty name="myMailSettings" type="ioc" scope="instance"> 
    19  
    20  
    21         <!--- ************************************************************* ---> 
     17        <!--- Autowire Properties ---> 
     18        <cfproperty name="myMailSettings" type="ioc" scope="instance"> 
    2219 
    2320        <cffunction name="init" access="public" returntype="any" output="false"> 
     
    2825        </cffunction> 
    2926 
    30         <!--- ************************************************************* ---> 
    31  
    32         <cffunction name="onRequestStart" access="public" output="false" returntype="void"> 
    33                 <cfargument name="Event" type="coldbox.system.beans.requestContext"> 
    34         </cffunction> 
    35  
    36         <!--- ************************************************************* ---> 
    37          
    3827        <cffunction name="onApplicationStart" access="public" output="false" returntype="void"> 
    3928                <cfargument name="Event" type="coldbox.system.beans.requestContext"> 
     
    5241        </cffunction> 
    5342 
    54         <!--- ************************************************************* ---> 
    55          
    56         <cffunction name="onRequestEnd" access="public" output="false" returntype="void"> 
    57                 <cfargument name="Event" type="coldbox.system.beans.requestContext"> 
    58         </cffunction> 
    59  
    60         <!--- ************************************************************* ---> 
    6143         
    6244        <cffunction name="onSessionStart" access="public" output="false" returntype="void"> 
     
    6850        </cffunction> 
    6951 
    70         <!--- ************************************************************* ---> 
    71          
    7252        <cffunction name="onSessionEnd" access="public" output="false" returntype="void"> 
    7353                <cfargument name="Event" type="coldbox.system.beans.requestContext"> 
     
    7858        </cffunction> 
    7959 
    80         <!--- ************************************************************* ---> 
    81  
    8260        <cffunction name="preHandler" access="public" output="false" returntype="void"> 
    8361                <cfargument name="Event" type="coldbox.system.beans.requestContext"> 
     
    9573                </cfscript> 
    9674        </cffunction> 
    97  
    98         <!--- ************************************************************* ---> 
    9975 
    10076        <cffunction name="dspHello" access="public" returntype="void" output="false"> 
     
    10985 
    11086                <cfset getPlugin("timer").start("New Instance Creation")> 
     87                 
    11188                <!--- Get a new instance plugin ---> 
    11289                <cfset event.setValue("mylogger", getPlugin("logger",false,true) )> 
     
    11693                <!--- Create a tracer message ---> 
    11794                <cfset logger.tracer("Starting dspHello. Using default name")> 
    118  
    11995                <cfset logger.tracer("arguments: #arguments.toString()#")> 
    12096 
     
    137113 
    138114                <!--- Java Loader ---> 
    139                  
    140115                <cfif getColdboxOCM().lookup("isColdfusionMX7") and getColdboxOCM().get("isColdfusionMX7") eq true> 
    141116                        <cfset Event.setvalue("HelloWorldObj", getPlugin("JavaLoader").create("HelloWorld").init())> 
     
    148123                <cfset Event.setValue("MyQuote", renderView("vwQuote"))> 
    149124                 
    150                 <!--- Cache for 5 minutes. ---> 
    151                 <cfset cacheParams.timeout = 5> 
    152                  
    153125                <!--- Run Private Event ---> 
    154126                <cfset runEvent(event="ehGeneral.myPrivateEvent",private=1)> 
     
    157129                <cfset Event.setView(name="vwHello",cache=true,cacheTimeout=5)> 
    158130        </cffunction> 
    159  
    160         <!--- ************************************************************* ---> 
    161131 
    162132        <cffunction name="doChangeLocale" access="public" returntype="void" output="false"> 
     
    167137        </cffunction> 
    168138 
    169         <!--- ************************************************************* ---> 
    170          
    171139        <cffunction name="testflash" access="public" output="false" returntype="void"> 
    172140                <cfargument name="Event" type="coldbox.system.beans.requestContext"> 
     
    175143                rc.lname = "majano"; 
    176144                rc.fname = "luis"; 
    177                 setNextEvent(event='ehGeneral.dspHello',persist='lname,fname'); 
     145                setNextEvent(event='ehGeneral.dspFlash',persist='lname,fname'); 
     146                </cfscript> 
     147        </cffunction> 
     148         
     149        <cffunction name="dspFlash" access="public" output="false" returntype="void"> 
     150                <cfargument name="Event" type="coldbox.system.beans.requestContext"> 
     151                <cfscript> 
     152                var rc = event.getCollection(); 
     153                 
     154                event.setView("dspFlash"); 
    178155                </cfscript> 
    179156        </cffunction> 
     
    259236                <cfset event.setView('vwLoginForm')> 
    260237        </cffunction> 
     238         
    261239<!------------------------------------------- PRIVATE METHDOS -------------------------------------------> 
    262240         
  • coldbox/trunk/testharness/layouts/Layout.Main.cfm

    r1425 r1755  
    4848    <td width="77" height="30" align="center" bgcolor="#eeeeee" valign="top"> 
    4949    <cfoutput> 
    50     #renderView("navigation",true,1)# 
     50    #renderView("navigation")# 
    5151    </cfoutput> 
    5252    </td> 
  • coldbox/trunk/testharness/views/navigation.cfm

    r1751 r1755  
    11<cfoutput> 
    2 <p><a href="index.cfm">#getresource("homebutton")#</a></p> 
    3 <p><a href="index.cfm?#getController().getSetting("eventName")#=log.ehTest.dspApi">Call Package Event</a></p> 
    4 <p><a href="index.cfm?fwreinit=1">RELOAD</a></p> 
    5 <p><a href="index.cfm?#getController().getSetting("eventName")#=testing">Error</a></p> 
    6 <p><a href="index.cfm?#getController().getSetting("eventName")#=ehGeneral.doColdboxFactoryTests">ColdBox Factory Tests</a></p> 
    7 <p><a href="index.cfm?#getController().getSetting("eventName")#=ehGeneral.testflash">Test Flash Persist</a></p> 
    8 <p><a href="index.cfm?#getController().getSetting("eventName")#=ehGeneral.purgeEvents">Purge All Events</a></p> 
     2<p><a href="#getSetting("sesbaseURL")#">#getresource("homebutton")#</a></p> 
     3<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=log.ehTest.dspApi">Call Package Event</a></p> 
     4<p><a href="#getSetting("sesbaseURL")#?fwreinit=1">RELOAD</a></p> 
     5<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=testing">Error</a></p> 
     6<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehGeneral.doColdboxFactoryTests">ColdBox Factory Tests</a></p> 
     7<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehGeneral.testflash">Test Flash Persist</a></p> 
     8<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehGeneral.purgeEvents">Purge All Events</a></p> 
    99<hr> 
    10 <p><a href="index.cfm?#getController().getSetting("eventName")#=ehGeneral.dspFolderTester1">Test Folder Layout 1</a></p> 
    11 <p><a href="index.cfm?#getController().getSetting("eventName")#=ehGeneral.dspFolderTester2">Test Folder Layout 2</a></p> 
     10<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehGeneral.dspFolderTester1">Test Folder Layout 1</a></p> 
     11<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehGeneral.dspFolderTester2">Test Folder Layout 2</a></p> 
    1212<hr> 
    13 <p><a href="index.cfm?#getController().getSetting("eventName")#=ehTest.dspExternal">External Handler</a></p> 
    14 <p><a href="index.cfm?#getController().getSetting("eventName")#=ehGeneral.externalview">External View</a></p> 
    15 <p><a href="index.cfm?#getController().getSetting("eventName")#=ehSecure.dspUser">Security Int Test</a></p> 
    16 <p><a href="index.cfm?#getController().getSetting("eventName")#=default.implicit">Implicit Views</a></p> 
    17 <p><a href="index.cfm?#getController().getSetting("eventName")#=default.rss">RSS Reader</a></p> 
     13<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehTest.dspExternal">External Handler</a></p> 
     14<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehGeneral.externalview">External View</a></p> 
     15<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehSecure.dspUser">Security Int Test</a></p> 
     16<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=default.implicit">Implicit Views</a></p> 
     17<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=default.rss">RSS Reader</a></p> 
     18<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=default.testroute">Test SetNextEvent Route</a></p> 
     19<p><a href="#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=default">Default Handler</a></p> 
    1820</cfoutput> 
  • coldbox/trunk/testharness/views/vwHello.cfm

    r1695 r1755  
    3333 
    3434<hr> 
    35 <strong>Flash Persistance Test: </strong> <br /> 
    36 Fname = #event.getValue("fname","")#<br /> 
    37 Lname = #event.getValue("lname","")#<br /> 
    38  
    39 <hr> 
    40 <input type="button" name="logentries" value="Call custom Plugin & Flash Tracer" onClick="window.location = 'index.cfm?#getController().getSetting("eventName")#=ehGeneral.docustomplugin'"> 
     35<input type="button" name="logentries" value="Call custom Plugin & Flash Tracer" onClick="window.location = '#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehGeneral.docustomplugin'"> 
    4136<cfif Event.getValue("usecustomplugin",false)> 
    4237        <cfdump var="#getMyPlugin("myclientstorage").getvar("MyCustomVariable")#" label="Custom Variable"> 
     
    5651 
    5752<hr> 
    58 <input type="button" name="logentries" value="Log Entries" onClick="window.location = 'index.cfm?#getController().getSetting("eventName")#=ehGeneral.doLog'"> 
    59 <input type="button" name="logentries" value="Clear Log" onClick="window.location = 'index.cfm?#getController().getSetting("eventName")#=ehGeneral.doClearLog'"> 
     53<input type="button" name="logentries" value="Log Entries" onClick="window.location = '#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehGeneral.doLog'"> 
     54<input type="button" name="logentries" value="Clear Log" onClick="window.location = '#getSetting("sesbaseURL")#?#getController().getSetting("eventName")#=ehGeneral.doClearLog'"> 
    6055File Size: #NumberFormat(getPlugin("Utilities").FileSize(getSetting("ColdboxLogsLocation")))# bytes 
    6156 
  • coldbox/trunk/testharness/views/vwQuote.cfm

    r1509 r1755  
    11<h2>Vistanme Despacio que tengo Prisa</h2> 
    2  
     2<cfoutput>#getPlugin("messagebox").renderit()#</cfoutput> 
    33<p><Cfoutput>#event.getValue("test","Nothing")#</Cfoutput></p> 

Copyright 2006 ColdBox Framework by Luis Majano