pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

cfm private pastebin - collaborative debugging tool What's a private pastebin?


Posted by BenNadelPost on Thu 10 Jul 16:30
report abuse | download | new post

  1. <cfcomponent
  2.         displayname="StatsFilter"
  3.         output="false"
  4.         hint="A bean which models the StatsFilter form.">
  5.  
  6.  
  7.         <!---
  8.         PROPERTIES
  9.         --->
  10.         <cfset variables.instance = StructNew() />
  11.  
  12.         <!---
  13.         INITIALIZATION / CONFIGURATION
  14.         --->
  15.         <cffunction name="init" access="public" returntype="StatsFilter" output="false">
  16.                 <cfargument name="ActivityTypeID" type="string" required="false" default="" />
  17.                 <cfargument name="DateRangeCode" type="string" required="false" default="" />
  18.                 <cfargument name="ActivityCode" type="string" required="false" default="" />
  19.                 <cfargument name="ChallengerID" type="string" required="false" default="" />
  20.                 <cfargument name="SelectedValueType" type="string" required="false" default="" />
  21.                 <cfargument name="ShowStandardMetric" type="string" required="false" default="" />
  22.                 <cfargument name="layout" type="string" required="false" default="" />
  23.  
  24.                 <!--- run setters --->
  25.                 <cfset setActivityTypeID(arguments.ActivityTypeID) />
  26.                 <cfset setDateRangeCode(arguments.DateRangeCode) />
  27.                 <cfset setActivityCode(arguments.ActivityCode) />
  28.                 <cfset setChallengerID(arguments.ChallengerID) />
  29.                 <cfset setSelectedValueType(arguments.SelectedValueType) />
  30.                 <cfset setShowStandardMetric(arguments.ShowStandardMetric) />
  31.                 <cfset setLayout(arguments.layout) />
  32.                 <cfreturn this />
  33.         </cffunction>
  34.  
  35.         <!---
  36.         PUBLIC FUNCTIONS
  37.         --->
  38.         <cffunction name="setMemento" access="public" returntype="StatsFilter" output="false">
  39.                 <cfargument name="memento" type="struct" required="yes"/>
  40.                 <cfset variables.instance = arguments.memento />
  41.                 <cfreturn this />
  42.         </cffunction>
  43.         <cffunction name="getMemento" access="public"returntype="struct" output="false" >
  44.                 <cfreturn variables.instance />
  45.         </cffunction>
  46.  
  47.         <!---
  48.         ACCESSORS
  49.         --->
  50.         <cffunction name="setActivityTypeID" access="public" returntype="void" output="false">
  51.                 <cfargument name="ActivityTypeID" type="string" required="true" />
  52.                 <cfset variables.instance.ActivityTypeID = arguments.ActivityTypeID />
  53.         </cffunction>
  54.         <cffunction name="getActivityTypeID" access="public" returntype="string" output="false">
  55.                 <cfreturn variables.instance.ActivityTypeID />
  56.         </cffunction>
  57.  
  58.         <cffunction name="setDateRangeCode" access="public" returntype="void" output="false">
  59.                 <cfargument name="DateRangeCode" type="string" required="true" />
  60.                 <cfset variables.instance.DateRangeCode = arguments.DateRangeCode />
  61.         </cffunction>
  62.         <cffunction name="getDateRangeCode" access="public" returntype="string" output="false">
  63.                 <cfreturn variables.instance.DateRangeCode />
  64.         </cffunction>
  65.        
  66.         <cffunction name="getDateRangeStruct" access="public" returntype="struct" output="false">
  67.                 <cfset var drs = structNew() />
  68.                 <cfset var x = "" />
  69.                 <cfloop from="0" to="#max(0, getDaysInRange())#" index="x">
  70.                         <cfset drs[ x ] = 0 />
  71.                 </cfloop>
  72.         
  73.                 <cfreturn drs />
  74.         </cffunction>
  75.        
  76.         <cffunction name="getDaysInRange" access="public" returntype="string" output="false">
  77.                 <cfreturn ceiling( getEndDate() - getStartDate() ) />
  78.         </cffunction>
  79.  
  80.        
  81.         <cffunction name="getActivityCode" access="public" output="false" returntype="string">
  82.                 <cfreturn variables.instance.ActivityCode />
  83.         </cffunction>
  84.        
  85.         <cffunction name="setActivityCode" access="public" output="false" returntype="void">
  86.                 <cfargument name="ActivityCode" type="string" required="true" />
  87.                 <cfset variables.instance.ActivityCode = arguments.ActivityCode />
  88.         </cffunction>
  89.        
  90.         <cffunction name="getEndDate" output="false" access="public" returntype="string" hint="I calculate the start date">
  91.                 <cfreturn now() />
  92.         </cffunction>
  93.  
  94.         <cffunction name="getStartDate" output="false" access="public" returntype="string" hint="I calulate the end date">
  95.                 <cfset var drc = getDateRangeCode()  />
  96.                 <cfset var rtnDate = dateFormat( now(), 'yyyy/mm/dd')  />
  97.                 <cfif drc IS "Yesterday">
  98.                         <cfset rtnDate = dateFormat( now() -1, 'yyyy/mm/dd') />
  99.                 <cfelseif drc IS "LastWeek">
  100.                         <cfset rtnDate = dateFormat( now() -7, 'yyyy/mm/dd') />
  101.                 <cfelseif drc IS "Last2Weeks">
  102.                         <cfset rtnDate = dateFormat( now() -14, 'yyyy/mm/dd') />
  103.                 <cfelseif drc IS "LastMonth">
  104.                         <cfset rtnDate = dateFormat( dateAdd("m", -1, now() ) -1, 'yyyy/mm/dd') />
  105.                 <cfelseif drc IS "Last2Months">
  106.                         <cfset rtnDate = dateFormat( dateAdd("m", -2, now() ) -1, 'yyyy/mm/dd') />
  107.                 <cfelseif drc IS "Last3Months">
  108.                         <cfset rtnDate = dateFormat( dateAdd("m", -3, now() ) -1, 'yyyy/mm/dd') />
  109.                 <cfelseif drc IS "AllTime">
  110.                         <cfset rtnDate = dateFormat( createDate(2007, 12, 26) , 'yyyy/mm/dd')  />
  111.                 </cfif>
  112.        
  113.                 <cfreturn rtnDate />           
  114.         </cffunction>
  115.  
  116.         <cffunction name="setChallengerID" access="public" returntype="void" output="false">
  117.                 <cfargument name="ChallengerID" type="string" required="true" />
  118.                 <cfset variables.instance.ChallengerID = arguments.ChallengerID />
  119.         </cffunction>
  120.         <cffunction name="getChallengerID" access="public" returntype="string" output="false">
  121.                 <cfreturn variables.instance.ChallengerID />
  122.         </cffunction>
  123.        
  124.         <cffunction name="getChallenger" access="public" output="false" returntype="any">
  125.                 <cfreturn  getTransfer().get("Member", getChallengerID() ) />
  126.         </cffunction>
  127.        
  128.         <cffunction name="getCurrentMemberID" access="public" returntype="string" output="false">
  129.                 <cfreturn getCurrentMember().getMemberID()  />
  130.         </cffunction>
  131.  
  132.         <cffunction name="getCurrentMember" access="public" output="false" returntype="any">
  133.                 <cfreturn variables.instance.CurrentMember />
  134.         </cffunction>
  135.        
  136.         <cffunction name="setCurrentMember" access="public" output="false" returntype="void">
  137.                 <cfargument name="CurrentMember" type="any" required="true" />
  138.                 <cfset variables.instance.CurrentMember = arguments.CurrentMember />
  139.         </cffunction>
  140.        
  141.         <cffunction name="getMemberIDList" access="public" output="false" returntype="string">
  142.                 <cfset var midList = getCurrentMember().getMemberID() />
  143.                 <cfif hasChallengerID()>
  144.                         <cfset midList = listAppend( midlist, getChallengerID() ) />
  145.                 </cfif>
  146.                
  147.                 <cfreturn midList />
  148.         </cffunction>
  149.  
  150.         <cffunction name="getSelectedValueType" access="public" output="false" returntype="string">
  151.                 <cfset var rtn = "distance" />
  152.                 <cfif len( trim ( variables.instance.SelectedValueType ) ) AND variables.instance.SelectedValueType IS  "time" OR variables.instance.SelectedValueType IS  "weight">
  153.                         <cfset rtn =  variables.instance.SelectedValueType />
  154.                 </cfif>
  155.                 <cfreturn rtn />
  156.         </cffunction>
  157.  
  158.         <cffunction name="setSelectedValueType" access="public" output="false" returntype="void">
  159.                 <cfargument name="SelectedValueType" type="string" required="true" />
  160.                 <cfset variables.instance.SelectedValueType = arguments.SelectedValueType />
  161.         </cffunction>
  162.        
  163.         <cffunction name="getShowStandardMetric" access="public" output="false" returntype="string">
  164.                 <cfset var rtn = true />
  165.                 <cfif len( trim( variables.instance.ShowStandardMetric ) )>
  166.                         <cfset rtn = variables.instance.ShowStandardMetric />
  167.                 </cfif>
  168.                 <cfreturn rtn />
  169.         </cffunction>
  170.        
  171.         <cffunction name="setShowStandardMetric" access="public" output="false" returntype="void">
  172.                 <cfargument name="ShowStandardMetric" type="string" required="true" />
  173.                 <cfset variables.instance.ShowStandardMetric = arguments.ShowStandardMetric />
  174.         </cffunction>   
  175.  
  176.         <cffunction name="getStatColumn" access="public" output="false" returntype="string">
  177.                 <cfset var rtn = "ElapsedTimeHours" />
  178.                 <cfif hasSelectedValueType() AND getSelectedValueType() IS NOT "ElapsedTimeHours">
  179.                         <cfset rtn = "standardValue" />
  180.                         <cfif hasShowStandardMetric() AND getShowStandardMetric() IS false>
  181.                                 <cfset rtn = "metricValue" />
  182.                         </cfif>
  183.                 </cfif>
  184.                 <cfreturn rtn />
  185.         </cffunction>
  186.  
  187.         <cffunction name="getUnitColumn" access="public" output="false" returntype="string">
  188.                 <cfset var rtn = "Hours" />
  189.                 <cfif hasSelectedValueType() AND getSelectedValueType() IS NOT "ElapsedTimeHours">
  190.                         <cfset rtn = "standardUnit" />
  191.                         <cfif hasShowStandardMetric() AND getShowStandardMetric() IS false>
  192.                                 <cfset rtn = "metricUnit" />
  193.                         </cfif>
  194.                 </cfif>
  195.                 <cfreturn rtn />
  196.         </cffunction>
  197.  
  198.         <cffunction name="getLayout" access="public" output="false" returntype="string">
  199.                 <cfreturn variables.instance.Layout />
  200.         </cffunction>
  201.        
  202.         <cffunction name="setLayout" access="public" output="false" returntype="void">
  203.                 <cfargument name="Layout" type="string" required="true" />
  204.                 <cfset variables.instance.Layout = arguments.Layout />
  205.         </cffunction>
  206.  
  207.         <cffunction name="hasDateRange" output="false" access="public" returntype="boolean" hint="">
  208.                 <cfreturn len( trim( getDateRangeCode() ) ) GT 0 />
  209.         </cffunction>
  210.         <cffunction name="hasActivityTypeID" output="false" access="public" returntype="boolean" hint="">
  211.                 <cfreturn val( getActivityTypeID() )  GT 0 />   
  212.         </cffunction>
  213.         <cffunction name="hasActivityCode" output="false" access="public" returntype="boolean" hint="">
  214.                 <cfreturn len( trim(getActivityCode() ) )  GT 0 />     
  215.         </cffunction>
  216.         <cffunction name="hasChallengerID" output="false" access="public" returntype="boolean" hint="">
  217.                 <cfreturn val( getChallengerID() ) GT 0 />     
  218.         </cffunction>
  219.         <cffunction name="hasSelectedValueType" output="false" access="public" returntype="boolean" hint="">
  220.                 <cfreturn len( trim(getSelectedValueType() ) )  GT 0 /> 
  221.         </cffunction>
  222.         <cffunction name="hasShowStandardMetric" output="false" access="public" returntype="boolean" hint="">
  223.                 <cfreturn len( trim(getShowStandardMetric() ) )  GT 0 />       
  224.         </cffunction>
  225.         <cffunction name="hasLayout" output="false" access="public" returntype="boolean" hint="">
  226.                 <cfreturn len( trim(getLayout() ) )  GT 0 />   
  227.         </cffunction>
  228.        
  229.        
  230.         <cffunction name="hasTypeRequirements" output="false" access="public" returntype="boolean" hint="">
  231.                 <cfreturn hasSelectedValueType() />
  232.         </cffunction>
  233.        
  234.        
  235.         <cffunction name="requireTime" output="false" access="public" returntype="boolean" hint="">
  236.                 <cfset var rtnVal = false />
  237.                 <cfif listFind( getSelectedValueType(), "time") >
  238.                         <cfset rtnVal = true />
  239.                 </cfif>
  240.                 <cfreturn rtnVal />
  241.         </cffunction>
  242.  
  243.         <cffunction name="requireDistance" output="false" access="public" returntype="boolean" hint="">
  244.                 <cfset var rtnVal = false />
  245.                 <cfif listFind( getSelectedValueType(), "distance") >
  246.                         <cfset rtnVal = true />
  247.                 </cfif>
  248.                 <cfreturn rtnVal />
  249.         </cffunction>
  250.  
  251.         <cffunction name="requireWeight" output="false" access="public" returntype="boolean" hint="">
  252.                 <cfset var rtnVal = false />
  253.                 <cfif listFind( getSelectedValueType(), "weight") >
  254.                         <cfset rtnVal = true />
  255.                 </cfif>
  256.                 <cfreturn rtnVal />
  257.         </cffunction>
  258.        
  259.         <cffunction name="getTransfer" access="public" output="false" returntype="any">
  260.                 <cfreturn variables.instance.Transfer />
  261.         </cffunction>
  262.        
  263.         <cffunction name="setTransfer" access="public" output="false" returntype="void">
  264.                 <cfargument name="Transfer" type="any" required="true" />
  265.                 <cfset variables.instance.Transfer = arguments.Transfer />
  266.         </cffunction>
  267.  
  268.         <cffunction name="makeHumanFilterString" output="false" access="public" returntype="any" hint="I make a human readable string ">
  269.                 <cfset var rtn = "" />
  270.                 <cfif hasDateRange()>
  271.                         <cfset rtn = " #spaceCap(getDateRangeCode())#" />
  272.                 </cfif>
  273.                 <cfif hasActivityCode() >
  274.                         <cfset rtn = " #spaceCap(getActivityCode())#" />
  275.                 </cfif>
  276.                 <cfif len( trim( rtn ) )>
  277.                         <cfset rtn = " for #rtn#" />
  278.                 </cfif>
  279.                 <cfreturn rtn />               
  280.         </cffunction>
  281.        
  282.         <cffunction name="makeFilterString" output="false" access="public" returntype="string" hint="">
  283.                 <cfargument name="exceptionList" type="string" default=""/>
  284.                 <cfset var rtn = "" />
  285.                 <cfif hasDateRange() AND ListFindNoCase( exceptionList, "DateRangeCode" ) IS false>
  286.                         <cfset rtn = rtn & "&DateRangeCode=#getDateRangeCode()#" />
  287.                 </cfif>
  288.                 <cfif hasActivityTypeID() AND ListFindNoCase( exceptionList, "ActivityTypeID" ) IS false>
  289.                         <cfset rtn = rtn & "&ActivityTypeID=#getActivityTypeID()#" />
  290.                 </cfif>
  291.                 <cfif hasChallengerID() AND ListFindNoCase( exceptionList, "ChallengerID" ) IS false>
  292.                         <cfset rtn = rtn & "&ChallengerID=#getChallengerID()#" />
  293.                 </cfif>
  294.                 <cfif hasShowStandardMetric() AND ListFindNoCase( exceptionList, "ShowStandardMetric" ) IS false>
  295.                         <cfset rtn = rtn & "&ShowStandardMetric=#getShowStandardMetric()#" />
  296.                 </cfif>
  297.                 <cfif hasSelectedValueType() AND ListFindNoCase( exceptionList, "SelectedValueType" ) IS false>
  298.                         <cfset rtn = rtn & "&SelectedValueType=#getSelectedValueType()#" />
  299.                 </cfif>
  300.                 <cfreturn rtn />
  301.         </cffunction>
  302.        
  303.         <cffunction name="loadChartStyleSheet" output="false" access="public" returntype="string" hint="">
  304.                 <cfset var sheet = "white_pipe" />
  305.                 <cfif hasSelectedValueType()>
  306.                         <cfset sheet = sheet & "_" & getSelectedValueType() />                 
  307.                         <cfif getShowStandardMetric() is true AND listfind("distance,time", getSelectedValueType()) >
  308.                                 <cfset sheet = sheet & "_standard" />
  309.                         <cfelseif listfind("distance,time", getSelectedValueType())  >
  310.                                 <cfset sheet = sheet & "_metric" />
  311.                         </cfif>
  312.                 </cfif>
  313.                 <cfreturn lcase(sheet) & ".xml" />
  314.         </cffunction>
  315.  
  316.         <!---   Date: 5/23/2008  Usage:  --->
  317.         <cffunction name="SpaceCap" output="false" access="private" returntype="string" hint="">
  318.                 <cfargument name="text" type="string" default=""/>
  319.                 <cfreturn REReplace( REReplace(text, "([.^[:digit:]])", " \1","all"), "([.^[:upper:]])", " \1","all") />
  320.         </cffunction>
  321.  
  322.  
  323. </cfcomponent>

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me