PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/wheels/tests/_assets/controllers/Filtering.cfc

http://cfwheels.googlecode.com/
ColdFusion CFScript | 45 lines | 38 code | 7 blank | 0 comment | 0 complexity | f2740ad6aae63120fd1d57e3ba2a7151 MD5 | raw file
 1<cfcomponent extends="Controller">
 2
 3	<cffunction name="init">
 4		<cfset aStr.testArg1 = 1>
 5		<cfset aStr.testArg2 = 2>
 6		<cfset filters(through="dir", testArg=1, except="doNotRun")>
 7		<cfset filters(through="str", strArguments=Duplicate(aStr))>
 8		<cfset filters(through="both", bothArguments=Duplicate(aStr), testArg=1)>
 9		<cfset filters(through="pub,priv", only="index,actOne,actTwo")>
10	</cffunction>
11
12	<cffunction name="dir">
13		<cfset request.filterTests.dirTest = arguments.testArg>
14	</cffunction>
15
16	<cffunction name="str">
17		<cfset request.filterTests.strTest = StructCount(arguments) & arguments.testArg1>
18	</cffunction>
19
20	<cffunction name="both">
21		<cfset request.filterTests.bothTest = StructCount(arguments) & arguments.testArg>
22		<cfif NOT IsDefined("request.filterTests.test") OR request.filterTests.test IS "bothpubpriv">
23			<cfset request.filterTests.test = "">
24		</cfif>
25		<cfset request.filterTests.test = request.filterTests.test & "both">
26	</cffunction>
27
28	<cffunction name="pub">
29		<cfset request.filterTests.pubTest = true>
30		<cfif NOT IsDefined("request.filterTests.test") OR request.filterTests.test IS "bothpubpriv">
31			<cfset request.filterTests.test = "">
32		</cfif>
33		<cfset request.filterTests.test = request.filterTests.test & "pub">
34		<cfset request.filterTests.pubTest = true>
35	</cffunction>
36
37	<cffunction name="priv" access="private">
38		<cfset request.filterTests.privTest = true>
39		<cfif NOT IsDefined("request.filterTests.test") OR request.filterTests.test IS "bothpubpriv">
40			<cfset request.filterTests.test = "">
41		</cfif>
42		<cfset request.filterTests.test = request.filterTests.test & "priv">
43	</cffunction>
44
45</cfcomponent>