Changeset 1667
- Timestamp:
- 08/09/08 23:30:28 (5 years ago)
- Location:
- coldbox/trunk/CodeDepot/projects/sidebar
- Files:
-
- 1 added
- 5 modified
-
Application.cfc (modified) (1 diff)
-
config/coldbox.xml.cfm (modified) (1 diff)
-
includes/sidebar/sideBar.cfm (modified) (1 diff)
-
includes/sidebar/sideBar.xml.cfm (added)
-
interceptors/sideBar.cfc (modified) (3 diffs)
-
views/home.cfm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
coldbox/trunk/CodeDepot/projects/sidebar/Application.cfc
r1666 r1667 55 55 <cfsetting enablecfoutputonly="no"> 56 56 57 <!--- SideBar: Hack. Needs to be in the interceptor buffer --->58 59 57 <cfreturn true> 60 58 </cffunction> -
coldbox/trunk/CodeDepot/projects/sidebar/config/coldbox.xml.cfm
r1666 r1667 237 237 --> 238 238 <Interceptor class="sidebar.interceptors.sideBar"> 239 <Property name="isEnabled">true</Property> 239 <!-- Enabled true/false, else leave blank --> 240 <Property name="isEnabled"></Property> 240 241 <!-- Y offset, else leave blank --> 241 242 <Property name="yOffset"></Property> 242 <!-- Links (JSON array of objects), else leave blank -->243 <Property name="links"> 243 <!-- Links (JSON array of objects), else leave blank 244 e.g. 244 245 [ 245 246 {"desc":"ColdBox Live Docs","href":"http:\/\/ortus.svnrepository.com\/coldbox\/trac.cgi"} 246 247 ,{"desc":"ColdBox API","href":"http:\/\/www.coldboxframework.com\/api\/"} 247 248 ,{"desc":"ColdBox Forums","href":"http:\/\/groups.google.com\/group\/coldbox"} 248 ,{"desc":"Coldfusion Live Docs","href":"http:\/\/livedocs.adobe.com\/coldfusion\/8\/htmldocs\/help.html?content=Part_3_CFML_Ref_1.html"} 249 ] 250 </Property> 249 ,{"desc":"My API","href":"http:\/\/localhost\/myApi/"} 250 ,{"desc":"My Database Schema","href":"http:\/\/localhost\/myDatabaseSchema.pdf"} 251 ,{"desc":"My Batch File","href":"C:\/\/Batch Files\/myBatch.bat"} 252 ,{"desc":"My Program","href":"C:\/\/Program Files\/My Program.exe"} 253 ] 254 --> 255 <Property name="links"></Property> 251 256 252 257 <!-- Width of the sidebar including visible width, else leave blank --> -
coldbox/trunk/CodeDepot/projects/sidebar/includes/sidebar/sideBar.cfm
r1666 r1667 68 68 <cfset clearCacheHref = currentURL & "&clearCache=1"> 69 69 </cfif> 70 70 71 71 <cfoutput> 72 72 <div id="SideBarContainer" style="visibility:hidden;position:absolute;left:0px;top:#sideBar.yOffset#px;z-index:20;width:#sideBar.width#px"> -
coldbox/trunk/CodeDepot/projects/sidebar/interceptors/sideBar.cfc
r1666 r1667 5 5 6 6 Modification History: 7 8 Todo: implement postRender, so we can discard the plugin 7 08/08/2008 evdlinden : getRenderedSideBar(), onException() 8 08/09/2008 evdlinden : postRender appendToBuffer, onException appendToBuffer, xmlParse of sideBar properties 9 9 -----------------------------------------------------------------------> 10 10 <cfcomponent name="sideBar" output="true" extends="coldbox.system.interceptor"> … … 13 13 14 14 <cffunction name="Configure" access="public" returntype="void" hint="This is the configuration method for your interceptors" output="false" > 15 15 16 <cfscript> 17 // Read SideBar XML 18 readSideBarXML(); 19 16 20 /* Start processing properties */ 17 if( not propertyExists( 'isEnabled') or not isBoolean(getproperty('isEnabled')) ){18 setProperty('isEnabled', true);21 if( not propertyExists( 'isEnabled') or not isBoolean(getproperty('isEnabled') ) ){ 22 setProperty('isEnabled', getPropertyDefault('isEnabled') ); 19 23 } 20 if( not propertyExists( 'yOffset') or not isNumeric(getproperty('yOffset')) ){21 setProperty('yOffset', 100);24 if( not propertyExists( 'yOffset') or not isNumeric(getproperty('yOffset') ) ){ 25 setProperty('yOffset', getPropertyDefault('yOffset')); 22 26 } 23 if( not propertyExists( 'links') or not isArray(getproperty('links')) ){24 setProperty('links', ArrayNew(1));27 if( not propertyExists( 'links') or not isArray(getproperty('links') ) ){ 28 setProperty('links', getPropertyDefault('links') ); 25 29 } 26 30 if( not propertyExists('width') or not isNumeric(getproperty('width')) ){ 27 setProperty('width', 200);31 setProperty('width', getPropertyDefault('width') ); 28 32 } 29 33 if( not propertyExists('visibleWidth') or not isNumeric(getproperty('visibleWidth')) ){ 30 setProperty( 'visibleWidth',12);34 setProperty( 'visibleWidth', getPropertyDefault('visibleWidth') ); 31 35 } 32 36 if( not propertyExists('imagePath') or not REFindNoCase("[A-Z]",getproperty('imagePath')) ){ 33 setProperty( 'imagePath',"includes/sideBar/sideBar.png");37 setProperty( 'imagePath', getPropertyDefault('imagePath') ); 34 38 } 35 39 if( not propertyExists('cssPath') or not REFindNoCase("[A-Z]",getproperty('cssPath')) ){ 36 setProperty( 'cssPath',"includes/sidebar/sideBar.css");40 setProperty( 'cssPath', getPropertyDefault('cssPath') ); 37 41 } 38 42 if( not propertyExists('imageVAlign') or not ListFindNoCase('top,middle,bottom', getproperty('imageVAlign') ) ){ 39 setProperty( 'imageVAlign',"middle");43 setProperty( 'imageVAlign', getPropertyDefault('imageVAlign') ); 40 44 } 41 45 </cfscript> … … 86 90 </cffunction> 87 91 92 <cffunction name="setPropertyDefault" access="private" returntype="void"> 93 <cfargument name="propertyName" required="true" type="string"> 94 <cfargument name="propertyValue" required="true" type="any"> 95 <cfset StructInsert(getSideBarDefaults(), arguments.propertyName, arguments.propertyValue)> 96 </cffunction> 97 98 <cffunction name="getPropertyDefault" access="private" returntype="any"> 99 <cfargument name="propertyName" required="true" type="string"> 100 <cfreturn StructFind(getSideBarDefaults(), arguments.propertyName)> 101 </cffunction> 102 103 <cffunction name="getSideBarDefaults" access="private" returntype="struct"> 104 <!--- SideBarDefaults exists ? ---> 105 <cfif not propertyExists('sideBarDefaults')> 106 <cfset setProperty('sideBarDefaults',StructNew())> 107 </cfif> 108 <cfreturn getproperty('sideBarDefaults')> 109 </cffunction> 110 111 <cffunction name="readSideBarXML" access="private" returntype="void"> 112 <cfset var i = 0> 113 <cfset var k = 0> 114 <cfset var sideBarXMLDoc = ''> 115 <cfset var sideBarXML = ''> 116 <cfset var properties = ''> 117 <cfset var property = StructNew()> 118 119 <cftry> 120 <!--- Read SideBar XML ---> 121 <cffile action="read" file="#ExpandPath('includes/sidebar/sideBar.xml.cfm')#" variable="sideBarXMLDoc"> 122 <!--- Parse XML ---> 123 <cfset sideBarXML = XmlParse(sideBarXMLDoc)> 124 <!--- Set xml properties array ---> 125 <cfset properties = sideBarXML['Sidebar']['Properties']['Property']> 126 127 <!--- Loop properties ---> 128 <cfloop index="i" from="1" to="#ArrayLen(properties)#"> 129 <!--- Property has properties? ---> 130 <cfif properties[i].xmlAttributes['name'] EQ "links"> 131 <!--- Decode JSON ---> 132 <cfset property.value = getPlugin('JSON').decode( properties[i].xmlText )> 133 <cfelse> 134 <cfset property.value = properties[i].xmlText> 135 </cfif> 136 <cfset setPropertyDefault(properties[i].xmlAttributes['name'],property.value)> 137 </cfloop> 138 139 <cfcatch type="any"> 140 <cfthrow message="SideBar: xml file default properties read error. Check default SideBar.xml file ." detail="#cfcatch.message#"> 141 </cfcatch> 142 </cftry> 143 </cffunction> 88 144 </cfcomponent> -
coldbox/trunk/CodeDepot/projects/sidebar/views/home.cfm
r1649 r1667 2 2 <h1>#Event.getValue("welcomeMessage")#</h1> 3 3 <h5>You are running #getSetting("codename",1)# #getSetting("version",1)# (#getsetting("suffix",1)#)</h5> 4 5 6 7 4 8 </cfoutput> 9 10 11
