Changeset 1700

Show
Ignore:
Timestamp:
08/14/08 15:19:24 (5 months ago)
Author:
evdlinden
Message:

CSS, JS and Image file, can be in directories outside the webroot!!
includesDirectory value can be defined in ColdBoxSideBar?.xml.cfm
Make sure to adjust this when testing. On release, the includes directory will be
/coldbox/includes/coldboxsidebar/

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • coldbox/trunk/CodeDepot/projects/sidebar/includes/coldboxsidebar/ColdBoxSideBar.cfm

    r1692 r1700  
    1212-----------------------------------------------------------------------> 
    1313 
    14 <cfhtmlhead text='<script language="javascript" src="includes/coldboxsidebar/_ColdBoxSideBar.js" type="text/javascript"></script>' /> 
    15 <cfhtmlhead text='<link rel="stylesheet" href="#getproperty('cssPath')#" type="text/css" media="screen">' /> 
    16  
     14<cfhtmlhead text='<script language="javascript" src="#TRIM(getproperty('jsPath'))#" type="text/javascript"></script>' /> 
     15<cfhtmlhead text='<link rel="stylesheet" href="#TRIM(getproperty('cssPath'))#" type="text/css" media="screen">' /> 
    1716<cfoutput> 
     17<!--  
     18ColdBox SideBar: created on 7/31/2008 by Ernst van der Linden (evdlinden@gmail.com | http://evdlinden.behindthe.net) 
     19 --> 
    1820<div id="ColdBoxSideBarContainer" style="visibility:hidden;position:absolute;left:0px;top:#getproperty('yOffset')#px;z-index:9999;width:#getproperty('width')#px"> 
    1921        <div id="ColdBoxSideBar" style="position:absolute;left:-#( getproperty('invisibleWidth'))#px;top:0;z-Index:9999;" onmouseover="coldBoxSideBar.moveOut()" onmouseout="coldBoxSideBar.moveBack()"> 
     
    2224                        <tr> 
    2325                                <td class="ColdBoxSideBarTop" width="#getproperty('invisibleWidth')#" nowrap><h1>Settings</h1></td> 
    24                                 <td background="" rowspan="#(12 + ArrayLen(local.links))#" width="#getproperty('visibleWidth')#" nowrap class="ColdBoxSideBarImgBar" valign="#getproperty('imageVAlign')#" align="left"><img src="#getproperty('imagePath')#" width="22" height="160" border="0" /></td> 
     26                                <td background="" rowspan="#(12 + ArrayLen(local.links))#" width="#getproperty('visibleWidth')#" nowrap class="ColdBoxSideBarImgBar" valign="#getproperty('imageVAlign')#" align="left"><img src="#TRIM(getproperty('imagePath'))#" width="22" height="160" border="0" /></td> 
    2527                        </tr> 
    2628                        <tr> 
  • coldbox/trunk/CodeDepot/projects/sidebar/includes/coldboxsidebar/ColdBoxSideBar.xml.cfm

    r1691 r1700  
    77Modification History: 
    8808/12/2008 evdlinden : isScroll property implemented. SideBar changed to ColdBoxSideBar: css, image 
     908/14/2008 evdlinden : imgPath,cssPAth and jsPath now in interceptor. 
    910--> 
    1011<Sidebar> 
     
    4243                        <Property name="visibleWidth">12</Property> 
    4344                         
    44                         <!--Full path from the application's root. --> 
    45                         <Property name="imagePath">includes/coldboxsideBar/ColdBoxSideBar.png</Property> 
    46                          
    4745                        <!-- Vertical alignment of the image: top,middle or bottom  --> 
    4846                        <Property name="imageVAlign">middle</Property> 
    4947                         
    50                         <!--Full path from the application's root --> 
    51                         <Property name="cssPath">includes/coldboxsidebar/_ColdBoxSideBar.css</Property> 
    52  
     48                        <!-- includes directory: normally /coldbox/includes/coldboxsidebar/ --> 
     49                        <Property name="includesDirectory">/sidebar/includes/coldboxsidebar/</Property> 
     50                         
    5351        </Properties> 
    5452</Sidebar> 
  • coldbox/trunk/CodeDepot/projects/sidebar/interceptors/coldboxSideBar.cfc

    r1691 r1700  
    2121                        // Read SideBar XML 
    2222                        readSideBarXML(); 
     23                        // Set css default path 
     24                        setPropertyDefault('cssPath','#CGI.SCRIPT_NAME#?sbContent=css'); 
     25                        // Set image default path 
     26                        setPropertyDefault('imagePath','#CGI.SCRIPT_NAME#?sbContent=img'); 
     27                        // Set js path 
     28                        setProperty( 'jsPath', '#CGI.SCRIPT_NAME#?sbContent=js' ); 
     29                                                 
     30                        // URL params which are used by the sideBar 
     31                        setProperty( 'urlParamNameList', "fwreinit,debugmode,dumpVar,sbIsClearCache,sbClearScope,sbIsClearLog,sbIsEnabled"); 
    2332                         
    2433                        /* Start processing properties */ 
     
    4857                                setProperty( 'imagePath', getPropertyDefault('imagePath') ); 
    4958                        } 
     59                        if( not propertyExists('imageVAlign') or not ListFindNoCase('top,middle,bottom', getproperty('imageVAlign') ) ){ 
     60                                setProperty( 'imageVAlign', getPropertyDefault('imageVAlign') ); 
     61                        } 
    5062                        if( not propertyExists('cssPath') or not REFindNoCase("[A-Z]",getproperty('cssPath')) ){ 
    5163                                setProperty( 'cssPath', getPropertyDefault('cssPath') ); 
    52                         } 
    53                         if( not propertyExists('imageVAlign') or not ListFindNoCase('top,middle,bottom', getproperty('imageVAlign') ) ){ 
    54                                 setProperty( 'imageVAlign', getPropertyDefault('imageVAlign') ); 
    5564                        } 
    5665                        // Calculate and set invisible width 
    5766                        setProperty( 'invisibleWidth', ( getproperty('width') - getproperty('visibleWidth') ) ); 
    5867                         
    59                         // URL params which are used by the sideBar 
    60                         setProperty( 'urlParamNameList', "fwreinit,debugmode,dumpVar,sbIsClearCache,sbClearScope,sbIsClearLog,sbIsEnabled"); 
    61                          
    6268                </cfscript> 
    6369        </cffunction> 
     
    6571<!------------------------------------------- INTERCEPTION POINTS -------------------------------------------> 
    6672 
    67         <cffunction name="afterAspectsLoad" access="public" returntype="void" output="false"> 
     73        <cffunction name="afterAspectsLoad" access="public" returntype="void" output="true"> 
    6874                <cfargument name="event" required="true" type="coldbox.system.beans.requestContext"> 
    6975                 
    7076                <cfset var rc = event.getCollection()> 
    71  
     77                <cfset var contentType = ''> 
     78                <cfset var fileContent = ''> 
     79                <cfset var filePath = ''> 
     80                 
    7281                <!--- Set isEnabled property after environmentControl interception ---> 
    7382                <cfif not settingExists('ColdBoxSideBar') or not isBoolean( getSetting('ColdBoxSideBar') )> 
     
    8392                 
    8493                <cfset var rc = event.getCollection()> 
     94 
     95                <!--- Get Content(js,css,img) of SideBar?  ---> 
     96                <cfif settingExists('ColdBoxSideBar') AND isBoolean( getSetting('ColdBoxSideBar') ) AND getSetting('ColdBoxSideBar') AND ListFindNoCase("css,js,img",event.getValue('sbContent',''))> 
     97                        <!--- Get binary content ---> 
     98                        <cfswitch expression="#rc.sbContent#"> 
     99                                <cfcase value="css"> 
     100                                        <cfset contentType = 'text/css'> 
     101                                        <cfset filePath = ExpandPath( getPropertyDefault('includesDirectory') & '_ColdBoxSideBar.css')> 
     102                                </cfcase> 
     103                                <cfcase value="js"> 
     104                                        <cfset contentType = 'text/js'> 
     105                                        <cfset filePath = ExpandPath( getPropertyDefault('includesDirectory') & '_ColdBoxSideBar.js')> 
     106                                </cfcase> 
     107                                <cfcase value="img"> 
     108                                        <cfset contentType = 'image/png'> 
     109                                        <cfset filePath = ExpandPath( getPropertyDefault('includesDirectory') & 'ColdBoxSideBar.png')> 
     110                                </cfcase> 
     111                        </cfswitch> 
     112                        <!--- Output binary file content  ---> 
     113                        <cfcontent type="#contentType#" variable="#getFileContent(filePath,true)#"> 
     114                        <cfabort> 
     115                </cfif> 
    85116 
    86117                <!--- Enable/disable the sidebar through url? Has been enabled in config? ---> 
     
    248279        </cffunction> 
    249280 
     281        <cffunction name="getFileContent" access="private" returntype="any"> 
     282                <cfargument name="filePath" type="string" required="true"> 
     283                <cfargument name="isBinary" type="boolean" default="false" required="false"> 
     284                 
     285                <cfset var fileContent = ''> 
     286                <cfset var readType = 'read'> 
     287                 
     288                <!--- Binary read? ---> 
     289                <cfif arguments.isBinary> 
     290                        <cfset readType = 'readbinary'> 
     291                </cfif> 
     292                 
     293                <!--- Absolute filePath? ---> 
     294                 
     295                <!--- read the file binary data ---> 
     296                <cffile action="#readType#" file="#arguments.filePath#" variable="fileContent"> 
     297 
     298                <cfreturn fileContent>                           
     299        </cffunction> 
     300 
    250301</cfcomponent> 

Copyright 2006 ColdBox Framework by Luis Majano