Changeset 2345

Show
Ignore:
Timestamp:
06/24/09 20:13:47 (15 months ago)
Author:
lmajano
Message:

Layouts External Locations is now finalized.

Location:
coldbox/trunk
Files:
2 added
5 modified

Legend:

Unmodified
Added
Removed
  • coldbox/trunk/system/config/config.xsd

    r2286 r2345  
    6262                                                                        <xs:enumeration value="IOCDefinitionFile" /> 
    6363                                                                        <xs:enumeration value="IOCObjectCaching" /> 
     64                                                                        <xs:enumeration value="LayoutsExternalLocation" />       
    6465                                                                        <xs:enumeration value="MessageboxStyleOverride" /> 
    6566                                                                        <xs:enumeration value="ModelsExternalLocation" /> 
  • coldbox/trunk/system/plugins/Renderer.cfc

    r2211 r2345  
    3737                        instance.appMapping = controller.getSetting("AppMapping"); 
    3838                        instance.viewsExternalLocation = controller.getSetting('ViewsExternalLocation'); 
     39                        instance.layoutsExternalLocation = controller.getSetting('LayoutsExternalLocation'); 
    3940                         
    4041                        /* Inject UDF For Views/Layouts */ 
     
    197198        <!--- Render the layout ---> 
    198199        <cffunction name="renderLayout" access="Public" hint="Renders the current layout + view Combinations if declared." output="false" returntype="any"> 
    199                 <cfset var cbox_RederedLayout = ""> 
    200200                <cfset var Event = controller.getRequestService().getContext()> 
    201201                <cfset var rc = event.getCollection()> 
    202202                <cfset var cbox_CurrentLayout = Event.getcurrentLayout()> 
     203                <cfset var cbox_layoutPath = ""> 
     204                <cfset var cbox_RederedLayout = ""> 
    203205                 
    204206                <!--- Check if no view has been set. ---> 
     
    219221                        <cfif cbox_CurrentLayout eq ""> 
    220222                                <cfset cbox_RederedLayout = renderView()> 
    221                         <cfelse> 
    222                                 <cfsavecontent variable="cbox_RederedLayout"><cfoutput><cfinclude template="/#instance.appMapping#/#instance.layoutsConvention#/#cbox_CurrentLayout#"></cfoutput></cfsavecontent> 
     223                        <cfelse>                         
     224                                <!--- The Layout Path is by convention or external?? ---> 
     225                                <cfset cbox_layoutPath = "/#instance.appMapping#/#instance.layoutsConvention#/#cbox_CurrentLayout#"> 
     226                                <!--- Check if View does not exists in Conventions ---> 
     227                                <cfif not fileExists(expandPath(cbox_layoutPath))> 
     228                                        <!--- Set the Path to be the External Location ---> 
     229                                        <cfset cbox_layoutPath = "#instance.layoutsExternalLocation#/#cbox_CurrentLayout#"> 
     230                                        <!--- Verify the External Location now ---> 
     231                                        <cfif not fileExists(expandPath(cbox_layoutPath))> 
     232                                                <cfthrow message="Layout not located"  
     233                                                                 detail="The layout: #cbox_layoutPath# could not be located in the conventions folder or in the external location. Please verify the layout name"  
     234                                                                 type="Renderer.LayoutNotFoundException"> 
     235                                        </cfif> 
     236                                </cfif> 
     237                                <!--- RenderLayout ---> 
     238                                <cfsavecontent variable="cbox_RederedLayout"><cfoutput><cfinclude template="#cbox_layoutPath#"></cfoutput></cfsavecontent> 
    223239                        </cfif> 
    224240                <cfset controller.getDebuggerService().timerEnd(timerHash)> 
  • coldbox/trunk/system/plugins/XMLParser.cfc

    r2294 r2345  
    205205                        //return settings 
    206206                        return settingsStruct; 
    207                 }//end of try 
     207                } 
    208208                catch( Any Exception ){ 
    209209                        throw("Error Loading Framework Configuration.","#Exception.Message# #Exception.Detail#","ColdBox.plugins.XMLParser.ColdboxSettingsParsingException"); 
     
    633633                        } 
    634634                         
     635                        /* ::::::::::::::::::::::::::::::::::::::::: EXTERNAL LAYOUTS LOCATION :::::::::::::::::::::::::::::::::::::::::::: */ 
     636                         
     637                        /* check for LayoutsExternalLocation */ 
     638                        if( structKeyExists(configStruct,"LayoutsExternalLocation") and configStruct["LayoutsExternalLocation"] neq "" ){ 
     639                                /* Verify the locations, do relative to the app mapping first */ 
     640                                if( directoryExists(controller.getAppRootPath() & configStruct["LayoutsExternalLocation"]) ){ 
     641                                        configStruct["LayoutsExternalLocation"] = "/" & ConfigStruct["AppMapping"] & "/" & configStruct["LayoutsExternalLocation"]; 
     642                                } 
     643                                else if( not directoryExists(expandPath(configStruct["LayoutsExternalLocation"])) ){ 
     644                                        throw("LayoutsExternalLocation could not be found.","The directories tested was relative and expanded using #configStruct['LayoutsExternalLocation']#. Please verify your setting.","XMLParser.ConfigXMLParsingException"); 
     645                                } 
     646                                /* Cleanup */ 
     647                                if ( right(configStruct["LayoutsExternalLocation"],1) eq "/" ){ 
     648                                         configStruct["LayoutsExternalLocation"] = left(configStruct["LayoutsExternalLocation"],len(configStruct["LayoutsExternalLocation"])-1); 
     649                                } 
     650                        }else{ 
     651                                configStruct["LayoutsExternalLocation"] = ""; 
     652                        } 
     653                         
    635654                        /* ::::::::::::::::::::::::::::::::::::::::: MAIL SETTINGS :::::::::::::::::::::::::::::::::::::::::::: */ 
    636655                         
  • coldbox/trunk/testharness/config/coldbox.xml.cfm

    r2285 r2345  
    4343                <Setting name="RequestContextDecorator"         value="coldbox.testharness.model.myRequestContextDecorator" /> 
    4444                <Setting name="ProxyReturnCollection"           value="false"/> 
     45                 
     46                <Setting name="LayoutsExternalLocation"     value="extlayouts" /> 
    4547        </Settings> 
    4648 
  • coldbox/trunk/testharness/handlers/ehGeneral.cfc

    r2285 r2345  
    203203                <cfscript> 
    204204                var rc = Event.getCollection(); 
     205                //external location; 
     206                event.setLayout("ext"); 
    205207                Event.setView("tags/test1"); 
    206208                </cfscript>