root/trunk/website/org/captcha/captchaServiceConfigBean.cfc @ 5

Revision 5, 19.8 kB (checked in by DanWilson, 17 years ago)

Initial Commit Of ModelGlue? Website (upgrade to blogcfc 511)

RevLine 
[5]1<!---
2Copyright: (c) 2007 Maestro Publishing, LLC
3Author: Peter J. Farrell (pjf@maestropublishing.com)
4License:
5Copyright 2007 Maestro Publishing, LLC
6
7Licensed under the Apache License, Version 2.0 (the "License");
8you may not use this file except in compliance with the License.
9You may obtain a copy of the License at
10
11    http://www.apache.org/licenses/LICENSE-2.0
12
13Unless required by applicable law or agreed to in writing, software
14distributed under the License is distributed on an "AS IS" BASIS,
15WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16See the License for the specific language governing permissions and
17limitations under the License.
18
19$Id: captchaServiceConfigBean.cfc 6056 2007-05-13 20:16:22Z pfarrell $
20--->
21<cfcomponent
22        displayname="captchaServiceConfigBean"
23        output="false"
24        hint="A bean which models the captchaServiceConfigBean form.">
25
26        <!---
27        PROPERTIES
28        --->
29        <cfset variables.instance = StructNew() />
30
31        <!---
32        INITIALIZATION / CONFIGURATION
33        --->
34        <cffunction name="init" access="public" returntype="captchaServiceConfigBean" output="false">
35                <cfargument name="outputDirectory" type="string" required="false" default="img/" />
36                <cfargument name="outputDirectoryIsRelative" type="boolean" required="false" default="TRUE" />
37                <cfargument name="hashValidPeriod" type="numeric" required="false" default="1800000" />
38                <cfargument name="jpegQuality" type="numeric" required="false" default="0.90" />
39                <cfargument name="jpegUseBaseline" type="boolean" required="false" default="TRUE" />
40                <cfargument name="useAntiAlias" type="boolean" required="false" default="TRUE" />
41                <cfargument name="randStrType" type="string" required="false" default="alpha" />
42                <cfargument name="randStrLen" type="numeric" required="false" default="6" />
43                <cfargument name="width" type="numeric" required="false" default="250" />
44                <cfargument name="height" type="numeric" required="false" default="75" />
45                <cfargument name="fontsize" type="numeric" required="false" default="30" />
46                <cfargument name="leftOffset" type="numeric" required="false" default="20" />
47                <cfargument name="shearXRange" type="numeric" required="false" default="25" />
48                <cfargument name="shearYRange" type="numeric" required="false" default="25" />
49                <cfargument name="fontColor" type="string" required="false" default="light" />
50                <cfargument name="backgroundColor" type="string" required="false" default="dark" />
51                <cfargument name="useGradientBackground" type="boolean" required="false" default="TRUE" />
52                <cfargument name="backgroundColorUseCyclic" type="boolean" required="false" default="TRUE" />
53                <cfargument name="useOvals" type="boolean" required="false" default="TRUE" />
54                <cfargument name="ovalColor" type="string" required="false" default="medium" />
55                <cfargument name="ovalUseTransparency" type="boolean" required="false" default="TRUE" />
56                <cfargument name="minOvals" type="numeric" required="false" default="15" />
57                <cfargument name="maxOvals" type="numeric" required="false" default="20" />
58                <cfargument name="useBackgroundLines" type="boolean" required="false" default="TRUE" />
59                <cfargument name="backgroundLineColor" type="string" required="false" default="medium" />
60                <cfargument name="backgroundLineUseTransparency" type="boolean" required="false" default="TRUE" />
61                <cfargument name="backgroundMinLines" type="numeric" required="false" default="5" />
62                <cfargument name="backgroundMaxLines" type="numeric" required="false" default="10" />
63                <cfargument name="useForegroundLines" type="boolean" required="false" default="TRUE" />
64                <cfargument name="foregroundlineColor" type="string" required="false" default="light" />
65                <cfargument name="foregroundLineUseTransparency" type="boolean" required="false" default="TRUE" />
66                <cfargument name="foregroundMinLines" type="numeric" required="false" default="5" />
67                <cfargument name="foregroundMaxLines" type="numeric" required="false" default="10" />
68                <cfargument name="definedFonts" type="array" required="false" default="#ArrayNew(1)#" />
69
70                <cfscript>
71                        // run setters
72                        setOutputDirectory(arguments.outputDirectory);
73                        setOutputDirectoryIsRelative(arguments.outputDirectoryIsRelative);
74                        setHashValidPeriod(arguments.hashValidPeriod);
75                        setJpegQuality(arguments.jpegQuality);
76                        setJpegUseBaseline(arguments.jpegUseBaseline);
77                        setUseAntiAlias(arguments.useAntiAlias);
78                        setRandStrType(arguments.randStrType);
79                        setRandStrLen(arguments.randStrLen);
80                        setWidth(arguments.width);
81                        setHeight(arguments.height);
82                        setFontsize(arguments.fontsize);
83                        setLeftOffset(arguments.leftOffset);
84                        setShearXRange(arguments.shearXRange);
85                        setShearYRange(arguments.shearYRange);
86                        setFontColor(arguments.fontColor);
87                        setBackgroundColor(arguments.backgroundColor);
88                        setUseGradientBackground(arguments.useGradientBackground);
89                        setBackgroundColorUseCyclic(arguments.backgroundColorUseCyclic);
90                        setUseOvals(arguments.useOvals);
91                        setOvalColor(arguments.ovalColor);
92                        setOvalUseTransparency(arguments.ovalUseTransparency);
93                        setMinOvals(arguments.minOvals);
94                        setMaxOvals(arguments.maxOvals);
95                        setUseBackgroundLines(arguments.useBackgroundLines);
96                        setBackgroundLineColor(arguments.backgroundLineColor);
97                        setBackgroundLineUseTransparency(arguments.backgroundLineUseTransparency);
98                        setBackgroundMinLines(arguments.backgroundMinLines);
99                        setBackgroundMaxLines(arguments.backgroundMaxLines);
100                        setUseForegroundLines(arguments.useForegroundLines);
101                        setForegroundlineColor(arguments.foregroundlineColor);
102                        setForegroundLineUseTransparency(arguments.foregroundLineUseTransparency);
103                        setForegroundMinLines(arguments.foregroundMinLines);
104                        setForegroundMaxLines(arguments.foregroundMaxLines);
105                        setDefinedFonts(arguments.definedFonts);
106                </cfscript>
107
108                <cfreturn this />
109        </cffunction>
110
111        <!---
112        PUBLIC FUNCTIONS
113        --->
114        <cffunction name="setMemento" access="public" returntype="captchaServiceConfigBean" output="false">
115                <cfargument name="memento" type="struct" required="true"/>
116                <cfset variables.instance = arguments.memento />
117                <cfreturn this />
118        </cffunction>
119        <cffunction name="getMemento" access="public"returntype="struct" output="false" >
120                <cfreturn variables.instance />
121        </cffunction>
122
123        <!---
124        ACCESSORS
125        --->
126        <cffunction name="setOutputDirectory" access="private" returntype="void" output="false">
127                <cfargument name="outputDirectory" type="string" required="true" />
128                <cfset variables.instance.outputDirectory = trim(arguments.outputDirectory) />
129        </cffunction>
130        <cffunction name="getOutputDirectory" access="public" returntype="string" output="false">
131                <cfreturn variables.instance.outputDirectory />
132        </cffunction>
133
134        <cffunction name="setOutputDirectoryIsRelative" access="private" returntype="void" output="false">
135                <cfargument name="outputDirectoryIsRelative" type="boolean" required="true" />
136                <cfset variables.instance.outputDirectoryIsRelative = trim(arguments.outputDirectoryIsRelative) />
137        </cffunction>
138        <cffunction name="getOutputDirectoryIsRelative" access="public" returntype="boolean" output="false">
139                <cfreturn variables.instance.outputDirectoryIsRelative />
140        </cffunction>
141       
142        <cffunction name="setHashValidPeriod" access="private" returntype="void" output="false">
143                <cfargument name="hashValidPeriod" type="numeric" required="true" />
144                <cfset variables.instance.hashValidPeriod = trim(arguments.hashValidPeriod) />
145        </cffunction>
146        <cffunction name="getHashValidPeriod" access="public" returntype="numeric" output="false">
147                <cfreturn variables.instance.hashValidPeriod />
148        </cffunction>
149
150        <cffunction name="setJpegQuality" access="private" returntype="void" output="false">
151                <cfargument name="jpegQuality" type="numeric" required="true" />
152                <cfset variables.instance.jpegQuality = trim(arguments.jpegQuality) />
153        </cffunction>
154        <cffunction name="getJpegQuality" access="public" returntype="numeric" output="false">
155                <cfreturn variables.instance.jpegQuality />
156        </cffunction>
157
158        <cffunction name="setJpegUseBaseline" access="private" returntype="void" output="false">
159                <cfargument name="jpegUseBaseline" type="boolean" required="true" />
160                <cfset variables.instance.jpegUseBaseline = trim(arguments.jpegUseBaseline) />
161        </cffunction>
162        <cffunction name="getJpegUseBaseline" access="public" returntype="boolean" output="false">
163                <cfreturn variables.instance.jpegUseBaseline />
164        </cffunction>
165
166        <cffunction name="setUseAntiAlias" access="private" returntype="void" output="false">
167                <cfargument name="useAntiAlias" type="boolean" required="true" />
168                <cfset variables.instance.useAntiAlias = trim(arguments.useAntiAlias) />
169        </cffunction>
170        <cffunction name="getUseAntiAlias" access="public" returntype="boolean" output="false">
171                <cfreturn variables.instance.useAntiAlias />
172        </cffunction>
173
174        <cffunction name="setRandStrType" access="private" returntype="void" output="false">
175                <cfargument name="randStrType" type="string" required="true" />
176                <cfset variables.instance.randStrType = trim(arguments.randStrType) />
177        </cffunction>
178        <cffunction name="getRandStrType" access="public" returntype="string" output="false">
179                <cfreturn variables.instance.randStrType />
180        </cffunction>
181
182        <cffunction name="setRandStrLen" access="private" returntype="void" output="false">
183                <cfargument name="randStrLen" type="numeric" required="true" />
184                <cfset variables.instance.randStrLen = trim(arguments.randStrLen) />
185        </cffunction>
186        <cffunction name="getRandStrLen" access="public" returntype="numeric" output="false">
187                <cfreturn variables.instance.randStrLen />
188        </cffunction>
189
190        <cffunction name="setWidth" access="private" returntype="void" output="false">
191                <cfargument name="width" type="numeric" required="true" />
192                <cfset variables.instance.width = trim(arguments.width) />
193        </cffunction>
194        <cffunction name="getWidth" access="public" returntype="numeric" output="false">
195                <cfreturn variables.instance.width />
196        </cffunction>
197
198        <cffunction name="setHeight" access="private" returntype="void" output="false">
199                <cfargument name="height" type="numeric" required="true" />
200                <cfset variables.instance.height = trim(arguments.height) />
201        </cffunction>
202        <cffunction name="getHeight" access="public" returntype="numeric" output="false">
203                <cfreturn variables.instance.height />
204        </cffunction>
205
206        <cffunction name="setFontsize" access="private" returntype="void" output="false">
207                <cfargument name="fontsize" type="numeric" required="true" />
208                <cfset variables.instance.fontsize = trim(arguments.fontsize) />
209        </cffunction>
210        <cffunction name="getFontsize" access="public" returntype="numeric" output="false">
211                <cfreturn variables.instance.fontsize />
212        </cffunction>
213
214        <cffunction name="setLeftOffset" access="private" returntype="void" output="false">
215                <cfargument name="leftOffset" type="numeric" required="true" />
216                <cfset variables.instance.leftOffset = trim(arguments.leftOffset) />
217        </cffunction>
218        <cffunction name="getLeftOffset" access="public" returntype="numeric" output="false">
219                <cfreturn variables.instance.leftOffset />
220        </cffunction>
221
222        <cffunction name="setShearXRange" access="private" returntype="void" output="false">
223                <cfargument name="shearXRange" type="numeric" required="true" />
224                <cfset variables.instance.shearXRange = trim(arguments.shearXRange) />
225        </cffunction>
226        <cffunction name="getShearXRange" access="public" returntype="numeric" output="false">
227                <cfreturn variables.instance.shearXRange />
228        </cffunction>
229
230        <cffunction name="setShearYRange" access="private" returntype="void" output="false">
231                <cfargument name="shearYRange" type="numeric" required="true" />
232                <cfset variables.instance.shearYRange = trim(arguments.shearYRange) />
233        </cffunction>
234        <cffunction name="getShearYRange" access="public" returntype="numeric" output="false">
235                <cfreturn variables.instance.shearYRange />
236        </cffunction>
237
238        <cffunction name="setFontColor" access="private" returntype="void" output="false">
239                <cfargument name="fontColor" type="string" required="true" />
240                <cfset variables.instance.fontColor = trim(arguments.fontColor) />
241        </cffunction>
242        <cffunction name="getFontColor" access="public" returntype="string" output="false">
243                <cfreturn variables.instance.fontColor />
244        </cffunction>
245
246        <cffunction name="setBackgroundColor" access="private" returntype="void" output="false">
247                <cfargument name="backgroundColor" type="string" required="true" />
248                <cfset variables.instance.backgroundColor = trim(arguments.backgroundColor) />
249        </cffunction>
250        <cffunction name="getBackgroundColor" access="public" returntype="string" output="false">
251                <cfreturn variables.instance.backgroundColor />
252        </cffunction>
253
254        <cffunction name="setUseGradientBackground" access="private" returntype="void" output="false">
255                <cfargument name="useGradientBackground" type="boolean" required="true" />
256                <cfset variables.instance.useGradientBackground = trim(arguments.useGradientBackground) />
257        </cffunction>
258        <cffunction name="getUseGradientBackground" access="public" returntype="boolean" output="false">
259                <cfreturn variables.instance.useGradientBackground />
260        </cffunction>
261
262        <cffunction name="setBackgroundColorUseCyclic" access="private" returntype="void" output="false">
263                <cfargument name="backgroundColorUseCyclic" type="boolean" required="true" />
264                <cfset variables.instance.backgroundColorUseCyclic = trim(arguments.backgroundColorUseCyclic) />
265        </cffunction>
266        <cffunction name="getBackgroundColorUseCyclic" access="public" returntype="boolean" output="false">
267                <cfreturn variables.instance.backgroundColorUseCyclic />
268        </cffunction>
269
270        <cffunction name="setUseOvals" access="private" returntype="void" output="false">
271                <cfargument name="useOvals" type="boolean" required="true" />
272                <cfset variables.instance.useOvals = trim(arguments.useOvals) />
273        </cffunction>
274        <cffunction name="getUseOvals" access="public" returntype="boolean" output="false">
275                <cfreturn variables.instance.useOvals />
276        </cffunction>
277
278        <cffunction name="setOvalColor" access="private" returntype="void" output="false">
279                <cfargument name="ovalColor" type="string" required="true" />
280                <cfset variables.instance.ovalColor = trim(arguments.ovalColor) />
281        </cffunction>
282        <cffunction name="getOvalColor" access="public" returntype="string" output="false">
283                <cfreturn variables.instance.ovalColor />
284        </cffunction>
285
286        <cffunction name="setOvalUseTransparency" access="private" returntype="void" output="false">
287                <cfargument name="ovalUseTransparency" type="boolean" required="true" />
288                <cfset variables.instance.ovalUseTransparency = trim(arguments.ovalUseTransparency) />
289        </cffunction>
290        <cffunction name="getOvalUseTransparency" access="public" returntype="boolean" output="false">
291                <cfreturn variables.instance.ovalUseTransparency />
292        </cffunction>
293
294        <cffunction name="setMinOvals" access="private" returntype="void" output="false">
295                <cfargument name="minOvals" type="numeric" required="true" />
296                <cfset variables.instance.minOvals = trim(arguments.minOvals) />
297        </cffunction>
298        <cffunction name="getMinOvals" access="public" returntype="numeric" output="false">
299                <cfreturn variables.instance.minOvals />
300        </cffunction>
301
302        <cffunction name="setMaxOvals" access="private" returntype="void" output="false">
303                <cfargument name="maxOvals" type="numeric" required="true" />
304                <cfset variables.instance.maxOvals = trim(arguments.maxOvals) />
305        </cffunction>
306        <cffunction name="getMaxOvals" access="public" returntype="numeric" output="false">
307                <cfreturn variables.instance.maxOvals />
308        </cffunction>
309
310        <cffunction name="setUseBackgroundLines" access="private" returntype="void" output="false">
311                <cfargument name="useBackgroundLines" type="boolean" required="true" />
312                <cfset variables.instance.useBackgroundLines = trim(arguments.useBackgroundLines) />
313        </cffunction>
314        <cffunction name="getUseBackgroundLines" access="public" returntype="boolean" output="false">
315                <cfreturn variables.instance.useBackgroundLines />
316        </cffunction>
317
318        <cffunction name="setBackgroundLineColor" access="private" returntype="void" output="false">
319                <cfargument name="backgroundLineColor" type="string" required="true" />
320                <cfset variables.instance.backgroundLineColor = trim(arguments.backgroundLineColor) />
321        </cffunction>
322        <cffunction name="getBackgroundLineColor" access="public" returntype="string" output="false">
323                <cfreturn variables.instance.backgroundLineColor />
324        </cffunction>
325
326        <cffunction name="setBackgroundLineUseTransparency" access="private" returntype="void" output="false">
327                <cfargument name="backgroundLineUseTransparency" type="boolean" required="true" />
328                <cfset variables.instance.backgroundLineUseTransparency = trim(arguments.backgroundLineUseTransparency) />
329        </cffunction>
330        <cffunction name="getBackgroundLineUseTransparency" access="public" returntype="boolean" output="false">
331                <cfreturn variables.instance.backgroundLineUseTransparency />
332        </cffunction>
333
334        <cffunction name="setBackgroundMinLines" access="private" returntype="void" output="false">
335                <cfargument name="backgroundMinLines" type="numeric" required="true" />
336                <cfset variables.instance.backgroundMinLines = trim(arguments.backgroundMinLines) />
337        </cffunction>
338        <cffunction name="getBackgroundMinLines" access="public" returntype="numeric" output="false">
339                <cfreturn variables.instance.backgroundMinLines />
340        </cffunction>
341
342        <cffunction name="setBackgroundMaxLines" access="private" returntype="void" output="false">
343                <cfargument name="backgroundMaxLines" type="numeric" required="true" />
344                <cfset variables.instance.backgroundMaxLines = trim(arguments.backgroundMaxLines) />
345        </cffunction>
346        <cffunction name="getBackgroundMaxLines" access="public" returntype="numeric" output="false">
347                <cfreturn variables.instance.backgroundMaxLines />
348        </cffunction>
349
350        <cffunction name="setUseForegroundLines" access="private" returntype="void" output="false">
351                <cfargument name="useForegroundLines" type="boolean" required="true" />
352                <cfset variables.instance.useForegroundLines = trim(arguments.useForegroundLines) />
353        </cffunction>
354        <cffunction name="getUseForegroundLines" access="public" returntype="boolean" output="false">
355                <cfreturn variables.instance.useForegroundLines />
356        </cffunction>
357
358        <cffunction name="setForegroundlineColor" access="private" returntype="void" output="false">
359                <cfargument name="foregroundlineColor" type="string" required="true" />
360                <cfset variables.instance.foregroundlineColor = trim(arguments.foregroundlineColor) />
361        </cffunction>
362        <cffunction name="getForegroundlineColor" access="public" returntype="string" output="false">
363                <cfreturn variables.instance.foregroundlineColor />
364        </cffunction>
365
366        <cffunction name="setForegroundLineUseTransparency" access="private" returntype="void" output="false">
367                <cfargument name="foregroundLineUseTransparency" type="boolean" required="true" />
368                <cfset variables.instance.foregroundLineUseTransparency = trim(arguments.foregroundLineUseTransparency) />
369        </cffunction>
370        <cffunction name="getForegroundLineUseTransparency" access="public" returntype="boolean" output="false">
371                <cfreturn variables.instance.foregroundLineUseTransparency />
372        </cffunction>
373
374        <cffunction name="setForegroundMinLines" access="private" returntype="void" output="false">
375                <cfargument name="foregroundMinLines" type="numeric" required="true" />
376                <cfset variables.instance.foregroundMinLines = trim(arguments.foregroundMinLines) />
377        </cffunction>
378        <cffunction name="getForegroundMinLines" access="public" returntype="numeric" output="false">
379                <cfreturn variables.instance.foregroundMinLines />
380        </cffunction>
381
382        <cffunction name="setForegroundMaxLines" access="private" returntype="void" output="false">
383                <cfargument name="foregroundMaxLines" type="numeric" required="true" />
384                <cfset variables.instance.foregroundMaxLines = trim(arguments.foregroundMaxLines) />
385        </cffunction>
386        <cffunction name="getForegroundMaxLines" access="public" returntype="numeric" output="false">
387                <cfreturn variables.instance.foregroundMaxLines />
388        </cffunction>
389
390        <cffunction name="setDefinedFonts" access="private" returntype="void" output="false">
391                <cfargument name="definedFonts" type="array" required="true" />
392                <cfset variables.instance.definedFonts = arguments.definedFonts />
393        </cffunction>
394        <cffunction name="getDefinedFonts" access="public" returntype="array" output="false">
395                <cfreturn variables.instance.definedFonts />
396        </cffunction>
397
398</cfcomponent>
Note: See TracBrowser for help on using the browser.