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