PageRenderTime 2ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/customtags/tooltip.cfm

http://raihan.googlecode.com/
ColdFusion | 58 lines | 34 code | 2 blank | 22 comment | 1 complexity | 5db5293b3fef653b5c49665db697a509 MD5 | raw file
 1<!--- Custom tag for Tooltips - jTip --->
 2<!---
 3WRITTEN BY: Michael Sprague, msprague@hamilton.edu
 4VERSION: 0.7 (beta 1)
 5UPDATED: 8/26/2008
 6
 7USAGE: 
 8<cf_tooltip 
 9		sourcefortooltip="tooltiptest.cfm" - File to load via Ajax (optional)
10		tooltip="Content for toolip" - Static (non-ajax) content for the tooltip  (optional)
11		tipcaption="This is the title bar" (optional)
12		pathTojQuery="/js/jQuery126-min.js" - path to the jQuery library (optional)
13		pathTojTip="/js/jTip.inline-support.js" - path to the jTip (inline version) file (optional)
14		pathTojqTipCSS="/js/jTip/css/global.css"" - path to the desired CSS file (must include images folder in same folder) (optional)
15		>
16		Any element here.
17</cf_tooltip>
18
19		
20--->
21<cfparam name="caller.tooltipnum" default="0" />
22<cfparam name="caller.jTipIncluded" default="0" />
23<cfparam name="caller.jQueryIncluded" default="0" />
24
25<cfswitch expression="#ThisTag.ExecutionMode#">
26	<!--- Start tag processing --->
27	<cfcase value="start">
28		<cfparam name="attributes.tooltip" default="" />
29		<cfparam name="attributes.sourcefortooltip" default="" />
30		<cfparam name="attributes.tipcaption" default="" />
31		<cfparam name="attributes.pathTojQuery" default="/js/jQuery126-min.js" />
32		<cfparam name="attributes.pathTojTip" default="/js/jTip.inline-support.js" />
33		<cfparam name="attributes.pathTojTipCSS" default="/js/jTip/css/global.css" />
34		<cfset caller.tooltipnum = caller.tooltipnum + 1 />
35		<cfif attributes.tooltip IS "" and attributes.sourcefortooltip IS "">ERROR: Name is required for a cf_window.<cfabort /></cfif>
36		
37		<cfif NOT caller.jQueryIncluded>
38			<script src='<cfoutput>#attributes.pathTojQuery#</cfoutput>' type='text/javascript'></script>
39			<cfset caller.jQueryIncluded = 1 />
40		</cfif>
41		<cfif NOT caller.jTipIncluded>
42			<script src='<cfoutput>#attributes.pathTojTip#</cfoutput>' type='text/javascript'></script>
43			<link href="<cfoutput>#attributes.pathTojTipCSS#</cfoutput>" rel="stylesheet" rev="stylesheet" />
44			<cfset caller.jTipIncluded = 1 />
45		</cfif>
46		<cfif attributes.sourcefortooltip GT "">
47		<cfoutput><span href="#attributes.sourcefortooltip#" name="#attributes.tipcaption#" id="jTip#caller.tooltipnum#" class="jTip">	
48		</cfoutput>
49		<cfelse>
50			<cfoutput><span style="display:none;" id="tooltip#caller.tooltipnum#">#attributes.tooltip#</span></cfoutput>
51			<cfoutput><span href="tip.htm?contentId=tooltip#caller.tooltipnum#" name="#attributes.tipcaption#" id="jTip#caller.tooltipnum#" class="jTip"></cfoutput>
52		</cfif>
53	</cfcase>
54	<!--- End tag processing --->
55	<cfcase value="end">
56		</span>
57	</cfcase>
58</cfswitch>