/customtags/tooltip.cfm
http://raihan.googlecode.com/ · ColdFusion · 58 lines · 34 code · 2 blank · 22 comment · 1 complexity · 5db5293b3fef653b5c49665db697a509 MD5 · raw file
- <!--- Custom tag for Tooltips - jTip --->
- <!---
- WRITTEN BY: Michael Sprague, msprague@hamilton.edu
- VERSION: 0.7 (beta 1)
- UPDATED: 8/26/2008
- USAGE:
- <cf_tooltip
- sourcefortooltip="tooltiptest.cfm" - File to load via Ajax (optional)
- tooltip="Content for toolip" - Static (non-ajax) content for the tooltip (optional)
- tipcaption="This is the title bar" (optional)
- pathTojQuery="/js/jQuery126-min.js" - path to the jQuery library (optional)
- pathTojTip="/js/jTip.inline-support.js" - path to the jTip (inline version) file (optional)
- pathTojqTipCSS="/js/jTip/css/global.css"" - path to the desired CSS file (must include images folder in same folder) (optional)
- >
- Any element here.
- </cf_tooltip>
-
- --->
- <cfparam name="caller.tooltipnum" default="0" />
- <cfparam name="caller.jTipIncluded" default="0" />
- <cfparam name="caller.jQueryIncluded" default="0" />
- <cfswitch expression="#ThisTag.ExecutionMode#">
- <!--- Start tag processing --->
- <cfcase value="start">
- <cfparam name="attributes.tooltip" default="" />
- <cfparam name="attributes.sourcefortooltip" default="" />
- <cfparam name="attributes.tipcaption" default="" />
- <cfparam name="attributes.pathTojQuery" default="/js/jQuery126-min.js" />
- <cfparam name="attributes.pathTojTip" default="/js/jTip.inline-support.js" />
- <cfparam name="attributes.pathTojTipCSS" default="/js/jTip/css/global.css" />
- <cfset caller.tooltipnum = caller.tooltipnum + 1 />
- <cfif attributes.tooltip IS "" and attributes.sourcefortooltip IS "">ERROR: Name is required for a cf_window.<cfabort /></cfif>
-
- <cfif NOT caller.jQueryIncluded>
- <script src='<cfoutput>#attributes.pathTojQuery#</cfoutput>' type='text/javascript'></script>
- <cfset caller.jQueryIncluded = 1 />
- </cfif>
- <cfif NOT caller.jTipIncluded>
- <script src='<cfoutput>#attributes.pathTojTip#</cfoutput>' type='text/javascript'></script>
- <link href="<cfoutput>#attributes.pathTojTipCSS#</cfoutput>" rel="stylesheet" rev="stylesheet" />
- <cfset caller.jTipIncluded = 1 />
- </cfif>
- <cfif attributes.sourcefortooltip GT "">
- <cfoutput><span href="#attributes.sourcefortooltip#" name="#attributes.tipcaption#" id="jTip#caller.tooltipnum#" class="jTip">
- </cfoutput>
- <cfelse>
- <cfoutput><span style="display:none;" id="tooltip#caller.tooltipnum#">#attributes.tooltip#</span></cfoutput>
- <cfoutput><span href="tip.htm?contentId=tooltip#caller.tooltipnum#" name="#attributes.tipcaption#" id="jTip#caller.tooltipnum#" class="jTip"></cfoutput>
- </cfif>
- </cfcase>
- <!--- End tag processing --->
- <cfcase value="end">
- </span>
- </cfcase>
- </cfswitch>