Changeset 766

Show
Ignore:
Timestamp:
06/23/07 03:53:26 (6 years ago)
Author:
lmajano
Message:

Ticket #192
UDF library mixins

Location:
coldbox/trunk/src/system
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • coldbox/trunk/src/system/eventhandler.cfc

    r650 r766  
    2828                        setController(arguments.controller); 
    2929                        //Inject user dependencies. 
    30                         includeUDF(); 
     30                        includeUDF(getController().getSetting("UDFLibraryFile")); 
    3131                        return this; 
    3232                </cfscript> 
     
    3939<!------------------------------------------- PRIVATE -------------------------------------------> 
    4040 
    41         <!--- ************************************************************* ---> 
    42  
    43         <cffunction name="includeUDF" access="private" hint="Injects the UDF Library if found and exists. Called only by the framework." output="false" returntype="void"> 
    44                 <!--- check if UDFLibraryFile is defined  ---> 
    45                 <cfif controller.getSetting("UDFLibraryFile") neq ""> 
    46                         <!--- Check if file exists on app's includes ---> 
    47                         <cfif fileExists("#controller.getSetting("ApplicationPath",1)#/#controller.getSetting("UDFLibraryFile")#")> 
    48                                 <cfinclude template="/#controller.getSetting("AppMapping")#/#controller.getSetting("UDFLibraryFile")#"> 
    49                         <cfelseif fileExists(ExpandPath("#controller.getSetting("UDFLibraryFile")#"))> 
    50                                 <cfinclude template="#controller.getSetting("UDFLibraryFile")#"> 
    51                         <cfelse> 
    52                                 <cfthrow type="Framework.eventhandler.UDFLibraryNotFoundException" message="Error loading UDFLibraryFile.  The file declared in the config.xml: #getSetting("UDFLibraryFile")# was not found in your application's include directory or in the following location: #ExpandPath(getSetting("UDFLibraryFile"))#. Please make sure you verify the file's location."> 
    53                         </cfif> 
    54                 </cfif> 
    55         </cffunction> 
    56  
    57         <!--- ************************************************************* ---> 
    58  
    5941</cfcomponent> 
  • coldbox/trunk/src/system/frameworkSupertype.cfc

    r650 r766  
    9696        </cffunction> 
    9797 
    98  
     98        <!--- ************************************************************* ---> 
     99         
     100         
    99101<!------------------------------------------- FRAMEWORK FACADES -------------------------------------------> 
    100102 
     
    192194 
    193195<!------------------------------------------- UTILITY METHODS -------------------------------------------> 
    194  
     196         
     197        <cffunction name="includeUDF" access="private" hint="Injects a UDF Library into the handler." output="false" returntype="void"> 
     198                <!--- ************************************************************* ---> 
     199                <cfargument name="udflibrary" required="true" type="string" hint="The UDF library to inject."> 
     200                <!--- ************************************************************* ---> 
     201                <cfset var UDFFullPath = ExpandPath(arguments.udflibrary)> 
     202                <cfset var UDFRelativePath = ExpandPath("/" & getController().getSetting("AppMapping") & "/" & arguments.udflibrary)> 
     203                 
     204                <!--- check if UDFLibraryFile is defined  ---> 
     205                <cfif arguments.udflibrary neq ""> 
     206                        <!--- Check if file exists on declared relative ---> 
     207                        <cfif fileExists(UDFRelativePath)> 
     208                                <cfinclude template="/#getController().getSetting("appMapping")#/#arguments.udflibrary#"> 
     209                        <cfelseif fileExists(UDFFullPath)> 
     210                                <cfinclude template="#arguments.udflibrary#">                    
     211                        <cfelse> 
     212                                <cfthrow type="Framework.eventhandler.UDFLibraryNotFoundException"  
     213                                         message="Error loading UDFLibraryFile. The UDF library was not found in your application's include directory or in the location you specified: <strong>#UDFCheckPath#</strong>. Please make sure you verify the file's location."> 
     214                        </cfif> 
     215                </cfif> 
     216        </cffunction> 
     217         
    195218        <cffunction name="throw" access="private" hint="Facade for cfthrow" output="false"> 
    196219                <!--- ************************************************************* ---> 
  • coldbox/trunk/src/system/plugins/renderer.cfc

    r743 r766  
    4747                 
    4848                <!--- Inject UDF For Views/Layouts ---> 
    49                 <cfset includeUDF()> 
     49                <cfset includeUDF(getController().getSetting("UDFLibraryFile"))> 
    5050                 
    5151                <cfreturn this> 
     
    132132<!------------------------------------------- PRIVATE -------------------------------------------> 
    133133 
    134         <cffunction name="includeUDF" access="private" hint="UDF Mixin Injection. Called only by the framework." output="false" returntype="void"> 
    135                 <!--- check if UDFLibraryFile is defined  ---> 
    136                 <cfif controller.getSetting("UDFLibraryFile") neq ""> 
    137                         <!--- Check if file exists on app's includes ---> 
    138                         <cfif fileExists("#controller.getSetting("ApplicationPath",1)#/#controller.getSetting("UDFLibraryFile")#")> 
    139                                 <cfinclude template="/#getappMapping()#/#controller.getSetting("UDFLibraryFile")#"> 
    140                         <cfelseif fileExists(ExpandPath("#controller.getSetting("UDFLibraryFile")#"))> 
    141                                 <cfinclude template="#controller.getSetting("UDFLibraryFile")#"> 
    142                         <cfelse> 
    143                                 <cfthrow type="Framework.plugins.renderer.UDFLibraryNotFoundException" message="Error loading UDFLibraryFile.  The file declared in the config.xml: #controller.getSetting("UDFLibraryFile")# was not found in your application's include directory or in the following location: #ExpandPath(controller.getSetting("UDFLibraryFile"))#. Please make sure you verify the file's location."> 
    144                         </cfif> 
    145                 </cfif> 
    146         </cffunction> 
    147          
    148134        <!--- ************************************************************* ---> 
    149135