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