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

/wheels/events/onapplicationstart/settings.cfm

http://cfwheels.googlecode.com/
ColdFusion | 247 lines | 237 code | 10 blank | 0 comment | 30 complexity | 439c0b284fdeafdc317aef675b468bd7 MD5 | raw file
  1<cfscript>
  2	// rewrite settings based on web server rewrite capabilites
  3	application.wheels.rewriteFile = "rewrite.cfm";
  4	if (Right(request.cgi.script_name, 12) == "/" & application.wheels.rewriteFile)
  5		application.wheels.URLRewriting = "On";
  6	else if (Len(request.cgi.path_info))
  7		application.wheels.URLRewriting = "Partial";
  8	else
  9		application.wheels.URLRewriting = "Off";
 10
 11	// set datasource name to same as the folder the app resides in unless the developer has set it with the global setting already
 12	if (StructKeyExists(this, "dataSource"))
 13		application.wheels.dataSourceName = this.dataSource;
 14	else
 15		application.wheels.dataSourceName = LCase(ListLast(GetDirectoryFromPath(GetBaseTemplatePath()), Right(GetDirectoryFromPath(GetBaseTemplatePath()), 1)));
 16	application.wheels.dataSourceUserName = "";
 17	application.wheels.dataSourcePassword = "";
 18	application.wheels.transactionMode = "commit"; // use 'commit', 'rollback' or 'none' to set default transaction handling for creates, updates and deletes
 19
 20	// cache settings
 21	application.wheels.cacheFileChecking = false;
 22	application.wheels.cacheImages = false;
 23	application.wheels.cacheModelInitialization = false;
 24	application.wheels.cacheControllerInitialization = false;
 25	application.wheels.cacheRoutes = false;
 26	application.wheels.cacheActions = false;
 27	application.wheels.cachePages = false;
 28	application.wheels.cachePartials = false;
 29	application.wheels.cacheQueries = false;
 30	application.wheels.cacheFunctions = false;
 31	application.wheels.cachePlugins = true;
 32	if (application.wheels.environment != "design")
 33	{
 34		application.wheels.cacheFileChecking = true;
 35		application.wheels.cacheImages = true;
 36		application.wheels.cacheModelInitialization = true;
 37		application.wheels.cacheControllerInitialization = true;
 38		application.wheels.cacheRoutes = true;
 39	}
 40	if (application.wheels.environment != "design" && application.wheels.environment != "development")
 41	{
 42		application.wheels.cacheActions = true;
 43		application.wheels.cachePages = true;
 44		application.wheels.cachePartials = true;
 45		application.wheels.cacheQueries = true;
 46		application.wheels.cacheFunctions = true;
 47	}
 48
 49	// debugging and error settings
 50	application.wheels.showDebugInformation = true;
 51	application.wheels.showErrorInformation = true;
 52	application.wheels.sendEmailOnError = false;
 53	application.wheels.errorEmailSubject = "Error";
 54	application.wheels.excludeFromErrorEmail = "";
 55	if (request.cgi.server_name Contains ".")
 56		application.wheels.errorEmailAddress = "webmaster@" & Reverse(ListGetAt(Reverse(request.cgi.server_name), 2,".")) & "." & Reverse(ListGetAt(Reverse(request.cgi.server_name), 1, "."));
 57	else
 58		application.wheels.errorEmailAddress = "";
 59	if (application.wheels.environment == "production")
 60	{
 61		application.wheels.showErrorInformation = false;
 62		application.wheels.sendEmailOnError = true;
 63	}
 64	if (application.wheels.environment != "design" && application.wheels.environment != "development")
 65		application.wheels.showDebugInformation = false;
 66
 67	// asset path settings
 68	// assetPaths can be struct with two keys,  http and https, if no https struct key, http is used for secure and non-secure
 69	// ex. {http="asset0.domain1.com,asset2.domain1.com,asset3.domain1.com", https="secure.domain1.com"}
 70	application.wheels.assetQueryString = false;
 71	application.wheels.assetPaths = false;
 72	if (application.wheels.environment != "design" && application.wheels.environment != "development")
 73		application.wheels.assetQueryString = true;
 74
 75	// paths
 76	application.wheels.controllerPath = "controllers";
 77
 78	// miscellaneous settings
 79	application.wheels.tableNamePrefix = "";
 80	application.wheels.obfuscateURLs = false;
 81	application.wheels.reloadPassword = "";
 82	application.wheels.softDeleteProperty = "deletedAt";
 83	application.wheels.timeStampOnCreateProperty = "createdAt";
 84	application.wheels.timeStampOnUpdateProperty = "updatedAt";
 85	application.wheels.ipExceptions = "";
 86	application.wheels.overwritePlugins = true;
 87	application.wheels.deletePluginDirectories = true;
 88	application.wheels.loadIncompatiblePlugins = true;
 89	application.wheels.loadDefaultRoutes = true;
 90	application.wheels.automaticValidations = true;
 91	application.wheels.setUpdatedAtOnCreate = true;
 92	application.wheels.useExpandedColumnAliases = false;
 93	
 94	// if session management is enabled in the application we default to storing flash data in the session scope, if not we use a cookie
 95	if (StructKeyExists(this, "sessionManagement") && this.sessionManagement)
 96	{
 97		application.wheels.sessionManagement = true;
 98		application.wheels.flashStorage = "session";
 99	}
100	else
101	{
102		application.wheels.sessionManagement = false;
103		application.wheels.flashStorage = "cookie";
104	}
105
106	// caching settings
107	application.wheels.cacheStorage = "memory"; // this setting is used to tell wheels where to store cache items, possible future storage items include ehCache, memcached, file, softReference
108	application.wheels.cacheStrategy = "age";
109	application.wheels.maximumItemsToCache = 5000;
110	application.wheels.cacheCullPercentage = 10;
111	application.wheels.cacheCullInterval = 5;
112	application.wheels.cacheDatePart = "n";
113	application.wheels.defaultCacheTime = 60;
114	application.wheels.clearQueryCacheOnReload = true;
115	application.wheels.cacheQueriesDuringRequest = true;
116	
117	// possible formats for provides
118	application.wheels.formats = {};
119	application.wheels.formats.html = "text/html";
120	application.wheels.formats.xml = "text/xml";
121	application.wheels.formats.json = "text/json";
122	application.wheels.formats.csv = "text/csv";
123	application.wheels.formats.pdf = "application/pdf";
124	application.wheels.formats.xls = "application/vnd.ms-excel";
125	application.wheels.formats.js = "text/javascript";
126
127	// function defaults
128	application.wheels.functions = {};
129	application.wheels.functions.autoLink = {link="all"};
130	application.wheels.functions.average = {distinct=false, parameterize=true, ifNull=""};
131	application.wheels.functions.belongsTo = {joinType="inner"};
132	application.wheels.functions.buttonTo = {onlyPath=true, host="", protocol="", port=0, text="", confirm="", image="", disable=""};
133	application.wheels.functions.buttonTag = {type="submit", value="save", content="Save changes", image="", disable=""};
134	application.wheels.functions.caches = {time=60, static=false};
135	application.wheels.functions.checkBox = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors", checkedValue=1, unCheckedValue=0};
136	application.wheels.functions.checkBoxTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", value=1};
137	application.wheels.functions.count = {parameterize=true};
138	application.wheels.functions.create = {parameterize=true, reload=false};
139	application.wheels.functions.dateSelect = {label=false, labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors", includeBlank=false, order="month,day,year", separator=" ", startYear=Year(Now())-5, endYear=Year(Now())+5, monthDisplay="names"};
140	application.wheels.functions.dateSelectTags = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, order="month,day,year", separator=" ", startYear=Year(Now())-5, endYear=Year(Now())+5, monthDisplay="names"};
141	application.wheels.functions.dateTimeSelect = {label=false, labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors", includeBlank=false, dateOrder="month,day,year", dateSeparator=" ", startYear=Year(Now())-5, endYear=Year(Now())+5, monthDisplay="names", timeOrder="hour,minute,second", timeSeparator=":", minuteStep=1, separator=" - "};
142	application.wheels.functions.dateTimeSelectTags = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, dateOrder="month,day,year", dateSeparator=" ", startYear=Year(Now())-5, endYear=Year(Now())+5, monthDisplay="names", timeOrder="hour,minute,second", timeSeparator=":", minuteStep=1, separator=" - "};
143	application.wheels.functions.daySelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false};
144	application.wheels.functions.delete = {parameterize=true};
145	application.wheels.functions.deleteAll = {reload=false, parameterize=true, instantiate=false};
146	application.wheels.functions.deleteByKey = {reload=false};
147	application.wheels.functions.deleteOne = {reload=false};
148	application.wheels.functions.distanceOfTimeInWords = {includeSeconds=false};
149	application.wheels.functions.errorMessageOn = {prependText="", appendText="", wrapperElement="span", class="errorMessage"};
150	application.wheels.functions.errorMessagesFor = {class="errorMessages", showDuplicates=true};
151	application.wheels.functions.excerpt = {radius=100, excerptString="...", stripTags="false", wholeWords="false"};
152	application.wheels.functions.exists = {reload=false, parameterize=true};
153	application.wheels.functions.fileField = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors"};
154	application.wheels.functions.fileFieldTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel=""};
155	application.wheels.functions.findAll = {reload=false, parameterize=true, perPage=10, order="", group="", returnAs="query", returnIncluded=true};
156	application.wheels.functions.findByKey = {reload=false, parameterize=true, returnAs="object"};
157	application.wheels.functions.findOne = {reload=false, parameterize=true, returnAs="object"};
158	application.wheels.functions.flashKeep = {};
159	application.wheels.functions.flashMessages = {class="flashMessages", includeEmptyContainer="false", lowerCaseDynamicClassValues=false};
160	application.wheels.functions.hasMany = {joinType="outer", dependent=false};
161	application.wheels.functions.hasOne = {joinType="outer", dependent=false};
162	application.wheels.functions.hiddenField = {};
163	application.wheels.functions.highlight = {class="highlight"};
164	application.wheels.functions.hourSelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false};
165	application.wheels.functions.imageTag = {};
166	application.wheels.functions.includePartial = {layout="", spacer="", dataFunction=true};
167	application.wheels.functions.javaScriptIncludeTag = {type="text/javascript", head=false};
168	application.wheels.functions.linkTo = {onlyPath=true, host="", protocol="", port=0};
169	application.wheels.functions.mailTo = {encode=false};
170	application.wheels.functions.maximum = {parameterize=true, ifNull=""};
171	application.wheels.functions.minimum = {parameterize=true, ifNull=""};
172	application.wheels.functions.minuteSelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, minuteStep=1};
173	application.wheels.functions.monthSelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, monthDisplay="names"};
174	application.wheels.functions.nestedProperties = {autoSave=true, allowDelete=false, sortProperty="", rejectIfBlank=""};
175	application.wheels.functions.paginationLinks = {windowSize=2, alwaysShowAnchors=true, anchorDivider=" ... ", linkToCurrentPage=false, prepend="", append="", prependToPage="", prependOnFirst=true, prependOnAnchor=true, appendToPage="", appendOnLast=true, appendOnAnchor=true, classForCurrent="", name="page", showSinglePage=false, pageNumberAsParam=true};
176	application.wheels.functions.passwordField = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors"};
177	application.wheels.functions.passwordFieldTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel=""};
178	application.wheels.functions.radioButton = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors"};
179	application.wheels.functions.radioButtonTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel=""};
180	application.wheels.functions.redirectTo = {onlyPath=true, host="", protocol="", port=0, addToken=false, statusCode=302, delay=false};
181	application.wheels.functions.renderPage = {layout=""};
182	application.wheels.functions.renderWith = {layout=""};
183	application.wheels.functions.renderPageToString = {layout=true};
184	application.wheels.functions.renderPartial = {layout="", dataFunction=true};
185	application.wheels.functions.save = {parameterize=true, reload=false};
186	application.wheels.functions.secondSelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false};
187	application.wheels.functions.select = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors", includeBlank=false, valueField="", textField=""};
188	application.wheels.functions.selectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, multiple=false, valueField="", textField=""};
189	application.wheels.functions.sendEmail = {layout=false, detectMultipart=true};
190	application.wheels.functions.sendFile = {disposition="attachment"};
191	application.wheels.functions.simpleFormat = {wrap=true, escapeHtml=false};
192	application.wheels.functions.startFormTag = {onlyPath=true, host="", protocol="", port=0, method="post", multipart=false, spamProtection=false};
193	application.wheels.functions.styleSheetLinkTag = {type="text/css", media="all", head=false};
194	application.wheels.functions.submitTag = {value="Save changes", image="", disable=""};
195	application.wheels.functions.sum = {distinct=false, parameterize=true, ifNull=""};
196	application.wheels.functions.textArea = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors"};
197	application.wheels.functions.textAreaTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel=""};
198	application.wheels.functions.textField = {label="useDefaultLabel", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors"};
199	application.wheels.functions.textFieldTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel=""};
200	application.wheels.functions.timeAgoInWords = {includeSeconds=false};
201	application.wheels.functions.timeSelect = {label=false, labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", errorElement="span", errorClass="fieldWithErrors", includeBlank=false, order="hour,minute,second", separator=":", minuteStep=1};
202	application.wheels.functions.timeSelectTags = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, order="hour,minute,second", separator=":", minuteStep=1};
203	application.wheels.functions.timeUntilInWords = {includeSeconds=false};
204	application.wheels.functions.toggle = {save=true};
205	application.wheels.functions.truncate = {length=30, truncateString="..."};
206	application.wheels.functions.update = {parameterize=true, reload=false};
207	application.wheels.functions.updateAll = {reload=false, parameterize=true, instantiate=false};
208	application.wheels.functions.updateByKey = {reload=false};
209	application.wheels.functions.updateOne = {reload=false};
210	application.wheels.functions.updateProperty = {parameterize=true};
211	application.wheels.functions.updateProperties = {parameterize=true};
212	application.wheels.functions.URLFor = {onlyPath=true, host="", protocol="", port=0};
213	application.wheels.functions.validatesConfirmationOf = {message="[property] should match confirmation"};
214	application.wheels.functions.validatesExclusionOf = {message="[property] is reserved", allowBlank=false};
215	application.wheels.functions.validatesFormatOf = {message="[property] is invalid", allowBlank=false};
216	application.wheels.functions.validatesInclusionOf = {message="[property] is not included in the list", allowBlank=false};
217	application.wheels.functions.validatesLengthOf = {message="[property] is the wrong length", allowBlank=false, exactly=0, maximum=0, minimum=0, within=""};
218	application.wheels.functions.validatesNumericalityOf = {message="[property] is not a number", allowBlank=false, onlyInteger=false, odd="", even="", greaterThan="", greaterThanOrEqualTo="", equalTo="", lessThan="", lessThanOrEqualTo=""};
219	application.wheels.functions.validatesPresenceOf = {message="[property] can't be empty"};
220	application.wheels.functions.validatesUniquenessOf = {message="[property] has already been taken", allowBlank=false};
221	application.wheels.functions.verifies = {handler=""};
222	application.wheels.functions.wordTruncate = {length=5, truncateString="..."};
223	application.wheels.functions.yearSelectTag = {label="", labelPlacement="around", prepend="", append="", prependToLabel="", appendToLabel="", includeBlank=false, startYear=Year(Now())-5, endYear=Year(Now())+5};
224
225	// set a flag to indicate that all settings have been loaded
226	application.wheels.initialized = true;
227
228	// mime types
229	application.wheels.mimetypes = {
230		txt="text/plain"
231		,gif="image/gif"
232		,jpg="image/jpg"
233		,jpeg="image/jpg"
234		,pjpeg="image/jpg"
235		,png="image/png"
236		,wav="audio/wav"
237		,mp3="audio/mpeg3"
238		,pdf="application/pdf"
239		,zip="application/zip"
240		,ppt="application/powerpoint"
241		,pptx="application/powerpoint"
242		,doc="application/word"
243		,docx="application/word"
244		,xls="application/excel"
245		,xlsx="application/excel"
246	};
247</cfscript>