[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2237
  • Last Modified:

Database execution error in coldfusion components

I am trying to extends the CF components internal.ulisting that provides with the list of item and also invold worrkflow processing. My extending madule looks exactly the same as the original module , the only different is I added a few stored procedure. Andwhen I ran the components I am getting the error: Database Exception - in C:\Hotbanana\hb50\display.cfc : line 2795
          Error Executing Database Query.

The extended component:
<cfcomponent displayname="courseschedule2" extends="hb50.internal.ulisting">
      <cfset this.DATATYPES = enum("item,category,config")>
      <cfset this.ALIGN = enum("left,right")>
      <cfset this.IMAGE_ALIGN = enum("left,right,inline")>
      <cfset this.COLUMN_LAYOUT = enum("single,double")>
      <cfset this.DISPLAY_TYPES = enum("full,memo,trimmed")>
      <cfset this.DATE_LAYOUT_TYPES = enum("oneline,twolines")>
      <cfset this.MAX_ITEMS = 5>
      <cfset this.PRIVATE_IMAGE = '<img src="images/lock.gif" width="9" height="10" border="0" align="absmiddle">'>
      
      <cffunction name="init" access="public" returntype="any" output="false">
            <cfargument name="companyID" required="true" type="numeric">            
            <cfargument name="webid" required="false" default="0">
            <cfargument name="datatype" required="false" default="0">

            <cfset super.init(companyID, arguments.webID, arguments.datatype)>            
            
            <cfset this.slash = getFileSeparator()>
            
            <!--- create objects --->
            <cfset this.category = createObject("component", "hb50.category").init(companyID)>
            <cfset this.workflow = getObject("hb50.workflow",companyID,true)>
            <cfset this.display = getObject("hb50.display",companyID,true)>
            <cfset this.media = getObject("hb50.media",companyID,true)>
            <cfset this.navigation = getObject("hb50.navigation",companyID,true)>
            
            <!--- configuration data --->
            <cfxml casesensitive="no" variable="this.xmlConfigData">
                  <cfoutput>
                        <data>
                              <!--- <item varname="blnDescription" title="Description" type="#this.TYPES.BOOLEAN#" default="1" required="false"/> --->
                              <item varname="blnAbstract" title="Abstract" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnDate" title="Date" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnImage" title="Image" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnLink" title="Link" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnResource" title="Related Information" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnAddress" title="Address" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnPhone" title="Phone" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnFax" title="Fax" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnEmail" title="Email" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnCategoryListing" title="Category Listing" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnCategoryPageContent" title="Show Page Content" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnCategoryDescription" title="Show Category Description" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnCategorySearch" title="Show Category Search Form" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnCategoryImage" title="Show Category Image" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnCategoryImageWrap" title="Wrap Text" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="intCategoryImageAlign" title="Category Image Alignment" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="intCategoryImageWidth" title="Category Image width" type="#this.TYPES.NUMBER#" required="false"/>                              
                              <item varname="intCategoryImageHeight" title="Category Image Height" type="#this.TYPES.NUMBER#" required="false"/>
                              <item varname="intCategoryLayoutType" title="Category Layout" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="blnCategoryPagination" title="Show Pagination" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="intCategoryDisplayItems" title="Items to Display" type="#this.TYPES.NUMBER#" required="false"/>
                              <item varname="blnItemListingPageContent" title="Show Page Content" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnItemListingDescription" title="Show Item Description" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="intItemListingDescriptionType" title="Item Description Type" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="intItemListingDescriptionLength" title="Item Description Length" type="#this.TYPES.SELECT#" default="300" required="false"/>
                              <item varname="txtItemListingDescriptionAction" title="Call To Action" type="#this.TYPES.TEXT#" default="more..." required="false"/>
                              <item varname="blnItemListingSearch" title="Show Item Search Form" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnItemListingAnchor" title="Show Item Anchor" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnItemListingTitle" title="Show Item Title" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="intItemListingDateLayoutType" title="Date Layout Type" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="intItemListingLayoutType" title="Item Listing Layout" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="blnItemListingImage" title="Show Item Image" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnItemListingImageWrap" title="Wrap Text" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="intItemListingImageWidth" title="Image Width" type="#this.TYPES.NUMBER#" required="false"/>
                              <item varname="intItemListingImageHeight" title="Image Height" type="#this.TYPES.NUMBER#" required="false"/>
                              <item varname="intItemListingImageAlign" title="Item Image Alignment" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="blnItemListingPagination" title="Show Pagination" type="#this.TYPES.BOOLEAN#" required="false"/>                              
                              <item varname="intItemListingDisplayItems" title="Items to Display" type="#this.TYPES.NUMBER#" required="false"/>
                              <item varname="blnItemDetail" title="Item Detail Page" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnItemDetailPageContent" title="Show Page Content" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnItemDetailResource" title="Show Ralated Resources" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="txtItemDetailResourceCaption" title="Related Resource Caption" type="#this.TYPES.TEXT#" required="false"/>
                              <item varname="blnItemDetailImage" title="Show Image" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="intItemDetailImageAlign" title="Item Image Alignment" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="intItemDetailImageWidth" title="Item Image width" type="#this.TYPES.NUMBER#" required="false"/>
                              <item varname="intItemDetailImageHeight" title="Item Image Height" type="#this.TYPES.NUMBER#" required="false"/>
                              <item varname="blnNotification" title="Send Notification" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="txtNotificationFromEmail" title="From Email" type="#this.TYPES.TEXT#" default="#this.qryCompany.txtEmail#" required="false"/>
                              <item varname="txtNotificationFromName" title="From Name" type="#this.TYPES.TEXT#" required="false"/>
                              <item varname="txtNotificationSubject" title="Notification Subject" type="#this.TYPES.TEXT#" required="false"/>
                              <item varname="txtNotificationMessage" title="Notification Message" type="#this.TYPES.HTML#" required="false"/>
                              <item varname="blnSecurityEnabled" title="Enable" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="intRoleIDs" title="Access Role(s)" type="#this.TYPES.SELECT#" required="false" insert="false" multiple="true"/>
                              <item varname="intWebID" title="Web ID" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="intCompanyID" title="Company ID" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="blnDeleted" title="Deleted" type="#this.TYPES.BOOLEAN#" required="false"/>
                        </data>
                  </cfoutput>
            </cfxml>
            
            <cfscript>
                  this.configData = newFormData();
                  this.configData.itemname = "Config";
                  this.configData.itemsname = "Configs";
                  this.configData.tablename = "tblCourseListingSettings";

                  this.configData.datatype = this.DATATYPES.CONFIG;
                              
                  this.configData.navid = this.navid;
                  this.configData.subid = this.subid;
                  this.configData.tabid = this.tabid;
                  
                  this.configData.webid = this.webid;
                  this.configData.link = this.link;
                  this.configData.varID = "intID";

                  this.configData.columns = xmlDataToArray(this.xmlConfigData);
                                    
                  this.configData.tabs[1] = StructNew();
                  this.configData.tabs[1].caption = "Fields";
                  this.configData.tabs[1].columnlist = "blnAbstract,blnDate,blnImage,blnLink,blnResource,blnAddress,blnPhone,blnFax,blnEmail";

                  this.configData.tabs[2] = StructNew();
                  this.configData.tabs[2].caption ="Category Listing";
                  this.configData.tabs[2].columnlist = "blnCategoryListing,blnCategoryPageContent,blnCategoryDescription,blnCategorySearch,blnCategoryImage,blnCategoryImageWrap,blnCategoryImageAlign,intCategoryImageWidth,intCategoryImageHeight,blnCategoryPagination,intCategoryDisplayItems,intCategoryLayoutType";
                                                
                  this.configData.tabs[3] = StructNew();
                  this.configData.tabs[3].caption ="Item Listing";
                  this.configData.tabs[3].columnlist = "blnItemListingPageContent,blnItemListingTitle,intItemListingDateLayoutType,blnItemListingDescription,intItemListingDescriptionType,intItemListingDescriptionLength,txtItemListingDescriptionAction,blnItemListingSearch,blnItemListingAnchor,intItemListingLayoutType,blnItemListingImage,blnItemListingImageWrap,intItemListingImageWidth,intItemListingImageHeight,intItemListingImageAlign,blnItemListingPagination,intItemListingDisplayItems";
                  
                  this.configData.tabs[4] = StructNew();
                  this.configData.tabs[4].caption ="Item Detail";
                  this.configData.tabs[4].columnlist = "blnItemDetail,blnItemDetailPageContent,blnItemDetailResource,txtItemDetailResourceCaption,blnItemDetailImage,intItemDetailImageAlign,intItemDetailImageWidth,intItemDetailImageHeight";
                  
                  this.configData.tabs[5] = StructNew();
                  this.configData.tabs[5].caption ="Notification";
                  this.configData.tabs[5].columnlist = "blnNotification,txtNotificationFromEmail,txtNotificationFromName,txtNotificationSubject";
                  
                  this.configData.tabs[6] = StructNew();
                  this.configData.tabs[6].caption = "Notification Message";
                  this.configData.tabs[6].columnList = "txtNotificationMessage";
                  
                  this.configData.tabs[7] = StructNew();
                  this.configData.tabs[7].caption = "Security";
                  this.configData.tabs[7].columnList = "blnSecurityEnabled,intRoleIDs";
                  
                  this.configData.blnWorkflow = false;
                  this.configData.blnApproval = false;
                  this.configData.blnLock = false;
                  this.configData.blnVersion = false;
                  this.configData.blnDelete = false;
                  this.configData.blnPreview = false;
                  this.configData.blnCategory = false;
                  this.configData.blnScheduling = false;
                  this.configData.blnMeta = false;
                  this.configData.blnResources = false;
                  this.configData.blnOrder = false;
                  this.configData.blnExtraColumns = false;
            </cfscript>            

            <cfset this.workflow.verifyColumns(this.configData)>
            <cfset qryConfig = getConfigQuery()>
            
            <!--- form data --->
            <cfxml casesensitive="no" variable="this.xmlData">
                  <cfoutput>
                        <data>
                              <!--- set required to false and changed type to hidden--->
                              <item varname="txtTitle" title="Title" type="#this.TYPES.HIDDEN#" required="false"/>
                              <item varname="intCategoryID" title="Category" type="#this.TYPES.CATEGORY#" required="true"/>
                              <!--- added field--->
                              <item varname="blnCCSSLink" title="Link to Course Schedule?" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="txtAbstract" title="Abstract" type="#this.TYPES.MEMO#" required="false"/>
                              <cfif qryConfig.blnDate is 1>
                                    <item varname="dtDate" title="Date" type="#this.TYPES.DATE#" required="false"/>
                              </cfif>
                              <cfif qryConfig.blnImage is 1>
                                    <item varname="intImageID" title="Image" type="#this.TYPES.MEDIA#" ext="jpeg,jpg,jpe,gif,png" required="true"/>
                              </cfif>
                              <cfif qryConfig.blnLink is 1>
                                    <item varname="txtLink" title="Link" type="#this.TYPES.TEXT#" required="false"/>
                              </cfif>
                              <cfif qryConfig.blnAddress is 1>
                                    <item varname="txtAddress" title="Address" type="#this.TYPES.TEXT#" required="false"/>
                                    <item varname="txtCity" title="City" type="#this.TYPES.TEXT#" required="false"/>
                                    <item varname="txtProvince" title="Province" type="#this.TYPES.TEXT#" required="false"/>
                                    <item varname="txtCountry" title="Country" type="#this.TYPES.TEXT#" required="false"/>
                                    <item varname="txtPostalCode" title="Postal Code" type="#this.TYPES.TEXT#" required="false"/>
                              </cfif>
                              <cfif qryConfig.blnPhone is 1>
                                    <item varname="txtPhone" title="Phone" type="#this.TYPES.TEXT#" required="false"/>
                                    <item varname="txtTollFree" title="Toll Free" type="#this.TYPES.TEXT#" required="false"/>
                              </cfif>
                              <cfif qryConfig.blnFax is 1>
                                    <item varname="txtFax" title="Fax" type="#this.TYPES.TEXT#" required="false"/>
                              </cfif>
                              <cfif qryConfig.blnEmail is 1>
                                    <item varname="txtEmail" title="Email" type="#this.TYPES.TEXT#" required="false"/>
                              </cfif>
                              <item varname="blnNotification" title="Send Notification" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="blnPrivate" title="Private" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <!--- changed txtdescription required to false--->      
                              <item varname="txtDescription" title="Description" type="#this.TYPES.HTML#" required="false"/>
                        </data>
                  </cfoutput>
            </cfxml>
            
            <cfif isDefined("this.xmlData.data.frontend.xmltext")>
                  <cfset this.frontendDisplay = this.xmlData.data.frontend.xmltext>
            </cfif>
            
            <!--- added stored procedure to pull course numbers, titles for drop-down--->      
            <cfstoredproc datasource='#this.datasource#' procedure='qryCourseNumbers'>
                  <cfprocresult name='qryCourseNumbers'>                  
                  <cfprocparam type='In' cfsqltype='CF_SQL_varCHAR' variable='@AY' value='07-08' null='no'></cfprocparam>
                  <cfswitch expression="#this.companyid#">
                  <cfcase value="2">
                  <cfprocparam type='in' cfsqltype='cf_sql_varchar' variable='@dept' value='PSL' null='no'></cfprocparam>
                  <cfprocparam type='in' cfsqltype='cf_sql_varchar' variable='@dept2' value='PSL' null='no'></cfprocparam>
                  </cfcase>
                  <cfcase value="9">
                  <cfprocparam type='in' cfsqltype='cf_sql_varchar' variable='@dept' value='business' null='no'></cfprocparam>
                  <cfprocparam type='in' cfsqltype='cf_sql_varchar' variable='@dept2' value='undergraduate' null='no'></cfprocparam>
                  </cfcase>
                  <cfcase value="10">
                  <cfprocparam type='in' cfsqltype='cf_sql_varchar' variable='@dept' value='education' null='no'></cfprocparam>
                  <cfprocparam type='in' cfsqltype='cf_sql_varchar' variable='@dept2' value='education' null='no'></cfprocparam>
                  </cfcase>
      
    </cfswitch>
                  </cfstoredproc>      
            
                  
            <cfscript>
                  this.formData = newFormData();
                  this.formData.columns = xmlDataToArray(this.xmlData);
                  this.formData.tablename = "tblCourseListing";
                  this.formData.title = "Course Details";
                  tabCount = 1;
                  
                  x = StructNew();
                  x.title = 'Course Number/Title';
                  x.varname = 'intCourseID';
                  x.required = true;
                  x.type = TYPES.SELECT;
                  x.query = qryCourseNumbers;
                  x.displayVar = "CourseName";
                  x.valueVar = "CourseID";                  
                  x.onChange = "txtTitle.value=intCourseID.options[intCourseID.selectedIndex].text;";
                  ArrayPrepend(this.formData.columns, x);      
                  
                  this.formData.tabs[tabCount] = StructNew();
                  this.formData.tabs[tabCount].caption = "Details";
                  this.formData.tabs[tabCount].columnlist = "txtTitle,intCategoryID,intCourseID,blnCCSSLink";
                  if (qryConfig.blnImage is 1) {
                        this.formData.tabs[tabCount].columnlist = this.formData.tabs[tabCount].columnlist & ',intImageID';
                  }
                  
                  if (qryConfig.blnLink is 1) {
                        this.formData.tabs[tabCount].columnlist = this.formData.tabs[tabCount].columnlist & ',txtLink';
                  }
                  if (qryConfig.blnSecurityEnabled is 1) {
                        this.formData.tabs[tabCount].columnlist = this.formData.tabs[tabCount].columnlist & ',blnPrivate';
                  }
                  
                  
                  
                  
                  
                  
                  if (qryConfig.blnDate is 1) {
                        tabCount = tabcount + 1;
                        this.formData.tabs[tabCount] = StructNew();
                        this.formData.tabs[tabCount].caption = "Date";
                        this.formData.tabs[tabCount].columnlist = 'dtDate';
                  }
                  
                  if (qryConfig.blnAddress is 1 OR qryConfig.blnPhone is 1 OR qryConfig.blnFax is 1 OR qryConfig.blnEmail is 1) {
                        tabCount = tabCount + 1;
                        this.formData.tabs[tabCount] = StructNew();
                        this.formData.tabs[tabCount].caption = "Address";
                        this.formData.tabs[tabCount].columnlist = '';
                  }
                  
                  if (qryConfig.blnAddress is 1) {
                        this.formData.tabs[tabCount].columnlist = ListAppend(this.formData.tabs[tabCount].columnlist,'txtAddress,txtCity,txtProvince,txtCountry,txtPostalCode');
                  }
                  if (qryConfig.blnPhone is 1) {
                        this.formData.tabs[tabCount].columnlist = ListAppend(this.formData.tabs[tabCount].columnlist,'txtPhone,txtTollFree');
                  }
                  if (qryConfig.blnFax is 1) {                        
                        this.formData.tabs[tabCount].columnlist = ListAppend(this.formData.tabs[tabCount].columnlist,'txtFax');
                  }
                  if (qryConfig.blnEmail is 1) {
                        this.formData.tabs[tabCount].columnlist = ListAppend(this.formData.tabs[tabCount].columnlist,'txtEmail');
                  }
                  if (qryConfig.blnAbstract is 1) {
                        tabCount = tabCount + 1;
                        this.formData.tabs[tabCount] = StructNew();
                        this.formData.tabs[tabCount].caption = "Abstract";
                        this.formData.tabs[tabCount].columnlist = "txtAbstract";
                  }
                  
                  tabCount = tabCount + 1;
                  this.formData.tabs[tabCount] = StructNew();
                  this.formData.tabs[tabCount].caption = "Body";
                  this.formData.tabs[tabCount].columnlist = "txtDescription";
                  
                  this.formData.notificationTabIndex = 0;
                  if (qryConfig.blnNotification is 1) {
                        tabCount = tabCount + 1;
                        this.formData.tabs[tabCount] = StructNew();
                        this.formData.tabs[tabCount].caption = "Notification";
                        this.formData.tabs[tabCount].columnlist = "blnNotification";
                        this.formData.notificationTabIndex = tabCount;
                  }

                  this.formData.webid = this.webid;
                  this.formData.datatype = this.DATATYPES.ITEM;
                  this.formData.navid = this.navid;
                  this.formData.subid = this.subid;
                  this.formData.tabid = this.tabid;
                  this.formData.link = this.link;                  
                  this.formData.varID = "intID";

                  this.formData.blnWorkflow = true;
                  this.formData.blnApproval = true;
                  this.formData.blnLock = true;
                  this.formData.blnVersion = true;
                  this.formData.blnDelete = true;
                  this.formData.blnPreview = true;
                  this.formData.blnCategory = true;
                  this.formData.blnScheduling = true;
                  this.formData.blnMeta = true;                  
                  this.formData.blnResources = true;
                  this.formData.blnTranslate = true;
                  this.formData.blnOrder = true;
            </cfscript>

            <!--- category data --->
            <cfxml casesensitive="no" variable="this.xmlCatData">
                  <cfoutput>
                        <data>
                              <item varname="txtTitle" title="Title" type="#this.TYPES.TEXT#" required="true"/>
                              <item varname="intImageID" title="Image" type="#this.TYPES.MEDIA#" required="true" ext="jpeg,jpg,jpe,gif,png"/>
                              <item varname="blnShowCategoryTitle" title="Show Category Title?" type="#this.TYPES.BOOLEAN#" required="false"/>
                              <item varname="txtDescription" title="Description" type="#this.TYPES.HTML#" required="false"/>
                              <item varname="intCategoryID" title="Category" type="#this.TYPES.HIDDEN#" required="false" vartype="int"/>                              
                        </data>
                  </cfoutput>
            </cfxml>
            
            <cfscript>
                  this.catData = newFormData();
                  this.catData.itemname = "Category";
                  this.catData.itemsname = "Categories";
                  this.catData.tablename = "tblCourseListingCategory";

                  this.catData.datatype = this.DATATYPES.CATEGORY;
                              
                  this.catData.navid = this.navid;
                  this.catData.subid = this.subid;
                  this.catData.tabid = this.tabid;
                  
                  this.catData.webid = this.webid;                  
                  this.catData.link = this.link;                  
                  this.catData.varID = "intID";                  

                  this.catData.columns = xmlDataToArray(this.xmlCatData);
                                    
                  this.catData.tabs[1] = StructNew();
                  this.catData.tabs[1].caption = "Title";
                  this.catData.tabs[1].columnlist = "txtTitle,blnShowCategoryTitle,intCategoryID";
                  if (qryConfig.blnCategoryImage is 1) {
                        this.catData.tabs[1].columnlist = this.catData.tabs[1].columnlist & ",intImageID";
                  }
                                    
                  this.catData.tabs[2] = StructNew();
                  this.catData.tabs[2].caption = "Description";
                  this.catData.tabs[2].columnlist = "txtDescription";

                  this.catData.blnWorkflow = true;
                  this.catData.blnApproval = true;
                  this.catData.blnLock = true;
                  this.catData.blnVersion = true;
                  this.catData.blnDelete = true;
                  this.catData.blnPreview = false;
                  this.catData.blnCategory = false;
                  this.catData.blnScheduling = false;                  
                  this.catData.blnMeta = true;                  
                  this.catData.blnResources = false;
                  this.catData.blnOrder = true;                  
            </cfscript>
            
            <!--- notification list data --->
            <cfxml casesensitive="no" variable="this.xmlListData">
                  <cfoutput>
                        <data>
                              <item varname="intItemID" title="" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="intListID" title="" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="intCompanyID" title="" type="#this.TYPES.SELECT#" required="false"/>
                        </data>
                  </cfoutput>
            </cfxml>
            
            <cfscript>
                  this.listData = newFormData();
                  this.listData.tablename = "tblCourseListingLists";
                  this.listData.blnExtraColumns = false;

                  this.listData.columns = xmlDataToArray(this.xmlListData);
            </cfscript>
            
            <!--- role data --->
            <cfxml casesensitive="no" variable="this.xmlRoleData">
                  <cfoutput>
                        <data>
                              <item varname="intWebID" title="" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="intCompanyID" title="" type="#this.TYPES.SELECT#" required="false"/>
                              <item varname="intRoleID" title="" type="#this.TYPES.SELECT#" required="false"/>
                        </data>
                  </cfoutput>
            </cfxml>
            
            <cfscript>
                  this.roleData = newFormData();                  
                  this.roleData.tablename = "tblCourseListingRole";
                  this.roleData.blnExtraColumns = false;
                  this.roleData.columns = xmlDataToArray(this.xmlRoleData);
            </cfscript>
            
            <cfreturn this />
      </cffunction>

      <!--- returns query of all data -- containing at least some minimal set of columns --->
      <cffunction name="getQuery" access="private" returntype="query">
            <cfif (this.datatype is this.DATATYPES.CATEGORY)>
                  <cfreturn this.workflow.getQuery(this.catData) />
            <cfelse>
                  <cfreturn this.workflow.getQuery(this.formData) />
            </cfif>
      </cffunction>

      <!--- return list of ulisting categories --->
      <cffunction name="getCategoryQuery" access="private" returntype="query">
            <cfset var qryCategory = ''>
            
            <cfquery name="qryCategory" datasource="#this.datasource#" cachedwithin="#this.queryCache#">
                  SELECT       NAV.intID, NAV.intOrder, ULCAT.blnShowCategoryTitle,
                  ULCAT.txtTitle, ULCAT.intCategoryID, ULCAT.blnLive, ULCAT.txtDescription, ULCAT.intImageID, ULCAT.intItemID
                  FROM       tblNavigation AS NAV
                  LEFT JOIN #this.catData.tablename# AS ULCAT
                        ON      ULCAT.intCategoryID = NAV.intID AND ULCAT.blnLive = 1
                  WHERE       NAV.intParentID = #this.webid#
                  AND       NAV.blnCategory = 1
                  AND       ULCAT.blnLive = 1
                  AND       NAV.blnDeleted = 0
                  <cfif isDefined('ckeywords')>
                        AND (ULCAT.txtTitle LIKE N'%#ckeywords#%' OR ULCAT.txtDescription LIKE N'%#ckeywords#%')
                  </cfif>
                  ORDER BY NAV.intOrder
            </cfquery>

            <cfreturn qryCategory />            
      </cffunction>
      
      <cffunction name="getItemQuery" access="public" returntype="query" output="false">
            <cfargument name="qryConfig" type="query" required="false">
            <cfargument name="blnLive" type="boolean" default="false" required="no">
            <cfset var qryItem = ''>
            
            <cfquery name="qryItem" datasource="#this.datasource#" cachedwithin="#this.queryCache#">
                  SELECT      
                        <cfif this.formData.blnCategory>
                           isnull(isnull(tblItem.intCategoryID, #this.formData.tablename#.intCategoryID), 0) AS intCategoryID,
                        </cfif>
                        #this.formData.tablename#.*, tblItem.intID, tblItem.intOrder as intItemOrder
                        FROM tblItem
                        INNER JOIN #this.formData.tablename#
                              ON      tblItem.intID = #this.formData.tablename#.intItemID      
                        <cfif arguments.blnLive>
                              AND #this.formData.tablename#.blnLive = 1
                        </cfif>
                        LEFT JOIN tblItemLock ON tblItem.intID = tblItemLock.intItemID
                                                                  AND tblItemLock.intID IN (SELECT TOP 1 intID FROM tblItemLock WHERE intItemID = tblItem.intID)
                        LEFT JOIN tblNavigation ON tblItem.intWebID = tblNavigation.intID
                        WHERE tblItem.intDataType = #val(this.formData.datatype)#
                        AND tblNavigation.intCompanyID = #this.companyID#
                        AND tblItem.blnDeleted = 0
                        AND tblItem.intWebID = #this.formData.webid#
                        <cfif arguments.blnLive is true AND this.formData.blnScheduling>
                              AND (#this.formData.tablename#.dtStart IS NULL OR #this.formData.tablename#.dtStart <= #getODBCNow()#)
                              AND (#this.formData.tablename#.dtEnd IS NULL OR #this.formData.tablename#.dtEnd >= #getODBCNow()#)
                        </cfif>
                        <cfif isDefined("URL.c") and Val(URL.c)>
                              AND #this.formData.tablename#.intCategoryID = #URL.c#
                        </cfif>
                        <cfif isDefined("ikeywords") and Len(Trim(ikeywords))>
                              AND (#this.formData.tablename#.txtTitle LIKE N'%#ikeywords#%' OR #this.formData.tablename#.txtDescription LIKE '%#ikeywords#%'
                                          <cfif qryConfig.blnAbstract is 1>OR #this.formData.tablename#.txtAbstract LIKE '%##ikeywords##%'</cfif>
                                          <cfif qryConfig.blnAddress is 1>
                                                OR #this.formData.tablename#.txtAddress LIKE N'%#ikeywords#%' OR #this.formData.tablename#.txtCity LIKE '%#ikeywords#%'
                                                OR #this.formData.tablename#.txtProvince LIKE N'%#ikeywords#%' OR #this.formData.tablename#.txtProvince LIKE '%#ikeywords#%'
                                                OR #this.formData.tablename#.txtCountry LIKE N'%#ikeywords#%' OR #this.formData.tablename#.txtCountry LIKE '%#ikeywords#%'
                                                OR #this.formData.tablename#.txtPostalCode LIKE N'%#ikeywords#%' OR #this.formData.tablename#.txtPostalCode LIKE '%#ikeywords#%'
                                          </cfif>
                                          <cfif qryConfig.blnLink is 1>
                                                OR #this.formData.tablename#.txtLink LIKE N'%#ikeywords#%'
                                          </cfif>)      
                        </cfif>
                         ORDER BY
                        <cfif qryConfig.blnDate is 1>
                              #this.formData.tablename#.dtDate DESC,
                        </cfif>
                        <cfif this.formData.blnOrder>
                              tblItem.intOrder
                        <cfelse>
                              #this.formData.tablename#.#this.formData.sortcolumn# #this.formData.sortdirection#
                        </cfif>
            </cfquery>
            <cfreturn qryItem />
      </cffunction>
      <!--- /getItemQuery --->
      
      <!--- returns ulisting config settings --->
      <cffunction name="getConfigQuery" access="public" returntype="query">
            <cfset var qryConfig = ''>
            <cfquery name="qryConfig" datasource="#this.datasource#" maxrows="1" cachedwithin="#this.queryCache#">
                  SELECT       TOP 1 *
                  FROM       #this.configData.tablename#
                  WHERE       blnDeleted = 0 AND intCompanyID = #this.companyID# AND intWebID = #this.webid#
            </cfquery>
            
            <cfreturn qryConfig />
      </cffunction>
      
      
      <!--- returns ulisting roles used for accessing private items --->
      <cffunction name="getRoleQuery" access="private" returntype="query">
            <cfset var qryRoles = ''>
            
            <cfquery name="qryRoles" datasource="#this.datasource#">
                  SELECT       intWebID, intCompanyID, intRoleID
                  FROM       #this.roleData.tablename#
                  WHERE       intWebID = <cfqueryparam value="#this.webID#" cfsqltype="cf_sql_integer">
                  AND       intCompanyID = <cfqueryparam value="#this.CompanyID#" cfsqltype="cf_sql_integer">
            </cfquery>
            
            <cfreturn qryRoles />
      </cffunction>
      
      <!--- returns ulisting roles as a comma-delimited list --->
      <cffunction name="getListRoles" access="private" returntype="string" output="false">
            <cfset var qryRoles = getRoleQuery()>
            <cfset var listRoles = ValueList(qryRoles.intRoleID)>
            
            <cfreturn listRoles />
      </cffunction>
      
      
      <!--- returns the URL of the login page for extranet --->
      <cffunction name="getLoginURL" access="private" returntype="string" output="false">
            <cfset var loginURL = ''>
            
            <cfquery name="qryLoginPage" datasource="#this.datasource#">
                  SELECT       TOP 1 tblNavigation.intID
                  FROM       tblNavigation LEFT JOIN tblPlugin ON tblNavigation.intPluginID = tblPlugin.intID
                  WHERE       tblPlugin.txtType = <cfqueryparam value='extranet login' cfsqltype="cf_sql_varchar">
                  AND       tblNavigation.blnDeleted = <cfqueryparam value="0" cfsqltype="cf_sql_tinyint">
                  AND       tblNavigation.blnActive = <cfqueryparam value="1" cfsqltype="cf_sql_tinyint">
                  AND       intCompanyID = <cfqueryparam value="#this.CompanyID#" cfsqltype="cf_sql_integer">
            </cfquery>      
            
            <cfif qryLoginPage.recordCount GT 0>
                  <cfset loginURL = this.qryCompany.txtWeb & "/" & this.navigation.getDirectory(qryLoginPage.intID) & "index.cfm">
            </cfif>
            
            <cfreturn loginURL />
      </cffunction>
      
      
      <!--- returns list of text columns to be searched --->
      <cffunction name="getSearchColumns" access="public" returntype="string">
            <cfset var i = 0>
            <cfset var list = "">
            
            <cfloop from="1" to="#ArrayLen(this.formData.columns)#" index="i">
                  <cfif ListFindNoCase("#TYPES.TEXT#,#TYPES.HTML#", this.formData.columns[i].type)>
                        <cfset list = ListAppend(list, this.formData.columns[i].varname)>
                  </cfif>
            </cfloop>

            <cfif this.formData.blnMeta>
                  <cfset list = ListAppend(list, "txtMetaKeywords")>
                  <cfset list = ListAppend(list, "txtMetaDescription")>
            </cfif>

            <cfreturn list>
      </cffunction>

      <!--- returns list of text columns to be searched --->
      <cffunction name="getCategorySearchColumns" access="public" returntype="string">
            <cfset var i = 0>
            <cfset var list = "">
            
            <cfloop from="1" to="#ArrayLen(this.catData.columns)#" index="i">
                  <cfif ListFindNoCase("#TYPES.TEXT#,#TYPES.HTML#", this.catData.columns[i].type)>
                        <cfset list = ListAppend(list, this.catData.columns[i].varname)>
                  </cfif>
            </cfloop>

            <cfif this.catData.blnMeta>
                  <cfset list = ListAppend(list, "txtMetaKeywords")>
                  <cfset list = ListAppend(list, "txtMetaDescription")>
            </cfif>

            <cfreturn list>
      </cffunction>
      
      <!--- checks whether the logged in user has access to the ulisting private items --->
      <cffunction name="privateAccess" access="private" returntype="boolean">
            <cfif NOT isDefined("SESSION.loggedIn") OR SESSION.loggedIn is false>
                  <cfreturn false>      
            </cfif>
            
            <!--- if they don't belong to a role, they won't have access --->
            <cfif not ListLen(SESSION.rolelist)>
                  <cfreturn false>
            </cfif>

            <!--- otherwise, check getListRoles() to see if one of their roles is allowed --->
            <cfset listRoles = getListRoles()>
            
            <cfif not ListLen(listRoles)>
                  <cfreturn false>
            </cfif>
            
            <cfloop list="#listRoles#" delimiters="," index="i">
                  <cfset temp = ListFind(SESSION.rolelist,i)>
                  <cfif temp neq 0>
                        <cfbreak>
                  </cfif>
            </cfloop>
            
            <cfif temp neq 0>
                  <cfreturn true>
            <cfelse>
                  <cfreturn false>
            </cfif>
      </cffunction>
      
      <!--- returns a public interface for this listing tool --->
      <cffunction name="getFrontEnd" access="public" returntype="struct">
            <!--- <cfset var qryAll = getPublicQuery()> --->
            <cfset var qryConfig = getConfigQuery()>
            <cfset var qryAll = getItemQuery(qryConfig, true)>
            <cfset var output = StructNew()>
            
            <!--- get the URL of the login page for extranet --->
            <cfset this.loginURL = getLoginURL()>
            
            <!--- start row for paging --->
            <cfparam name="URL.sr" default="1">
            <cfif URL.sr LTE 0>
                  <cfset URL.sr = 1>
            </cfif>

            <!--- listing --->
            <cfset output.title = "">
            <cfset output.body = "">
            <cfset output.meta = StructNew()>
            <cfset output.meta.keywords = ''>
            <cfset output.meta.description = ''>
            
            <!--- assume that we only use login.cfc and not loginview.cfc --->
            <cfif isDefined("URL.logout")>
                  <!--- save the SESSION navid of the current page --->
                  <cfif StructKeyExists(SESSION, "navid")>
                        <cfset tmpNavID = SESSION.navid>
                  </cfif>
                  <!--- flush the session --->
                  <cfset StructClear(SESSION)>
                  <!--- reset some SESSION variables --->
                  <cfset SESSION.loggedIn = false>
                  <cfif Val(tmpNavID)>
                        <cfset SESSION.navid = tmpNavID>
                  </cfif>
            </cfif>      
            
            <!--- need to check if loggedin extranet user belongs to role(s) specified
                  to access the private ulisting items This has been replace with a lock and redirect for item detail page --->
            <cfif qryConfig.blnSecurityEnabled IS 1 and (qryConfig.blnItemListingDescription or qryConfig.blnItemListingAnchor)>
                  <cfif not privateAccess()>
                        <cfset qryAll = SelectFrom(qryAll,"blnPrivate", 0)>
                  </cfif>
            </cfif>
                  
                  
            <!--- output item details --->                        
            <cfif isDefined("URL.i")>
                  <cfif qryConfig.blnItemDetailPageContent is 0>
                        <cfset output.blnHideContent = true>
                  </cfif>
                  <cfset qryItem = SelectFrom(qryAll, "intItemID", Val(URL.i))>
                  <cfset output.title = qryItem.txtTitle>
                  <cfset output.body = getItemDetail(qryConfig, qryItem)>
                  <cfreturn output />
            </cfif>
            
            <!--- if item anchors are set --->
            <cfif qryConfig.blnItemListingAnchor is 1>
                  <cfif qryConfig.blnItemListingPageContent is 0>
                        <cfset output.blnHideContent = true>
                  </cfif>
                  <cfset output.body = getAnchoredListing(qryConfig, qryAll)>
                  <cfreturn output />
            </cfif>                        
            
            <cfif isDefined("FORM.c") AND Val(FORM.c)>
                  <cfset URL.c = FORM.c>
            </cfif>
            
            <!--- output item listing of the category --->
            <cfif qryConfig.blnCategoryListing is 0 OR isDefined("URL.c")>
                  <cfif qryConfig.blnItemListingPageContent is 0>
                        <cfset output.blnHideContent = true>
                  </cfif>
                  <!--- <cfset qryItems = SelectFrom(qryAll, "intCategoryID", Val(URL.c))> --->
                  <cfset output.body = getItemListing(qryConfig, qryAll)>
                  <cfreturn output />
            </cfif>
            
            <cfif qryConfig.blnCategoryPageContent is 0>
                  <cfset output.blnHideContent = true>
            </cfif>
            
            <!--- output category listing --->                  
            <cfset output.body = getCategoryListing(qryConfig, qryAll)>
            
            <cfreturn output />
      </cffunction>

      <!--- return listing of all categories --->
      <cffunction name="getCategoryListing" access="private" returntype="string" output="false">
            <cfargument name="qryConfig" type="query" required="true">
            <cfargument name="qryAll" type="query" required="true">

            <cfset var qryDistinctCats = ''>
            <cfset var qryCategories = ''>
            <cfset var qryAllCategories = getCategoryQuery()>
            <cfset var listingOutput = ''>
            <cfset var thepagination = ''>                        
            
            <cfif isDefined("URL.c")>
                  <cfset qryCategories = qryAllCategories>
            <cfelse>
                  <cfquery name="qryDistinctCats" dbtype="query">
                        SELECT DISTINCT intCategoryID
                        FROM       qryAll
                  </cfquery>

                  <cfquery name="qryCategories" dbtype="query">
                        SELECT       qryAllCategories.*
                        FROM       qryAllCategories, qryDistinctCats
                        WHERE       qryAllCategories.intCategoryID = qryDistinctCats.intCategoryID
                        ORDER BY qryAllCategories.intOrder
                  </cfquery>
            </cfif>
            
            <cfsavecontent variable="listingOutput">
                  <!--- output search form is category search is enabled --->
                  <cfif qryConfig.blnCategorySearch is 1>
                        <cfoutput>
                        <form name="hbsrchmod" id="hbsrchmod" method="post" action="#SCRIPT_NAME#">
                              <input type="text" name="ckeywords" id="hbsrchkey" <cfif isDefined('ckeywords')>value="#ckeywords#"</cfif>/>
                              <input type="submit" name="hbsrchbtn" id="hbsrchbtn" value="Search" />
                        </form>
                        </cfoutput>                                                
                  </cfif>
                  
                  <!--- total number of categories --->
                  <cfset recordsToDisplay = qryCategories.recordCount>      
                  
                  <cfif recordsToDisplay is 0>
                        <p>There are no categories to display.</p>
                  <cfelse>                        
           
                        <!--- if paging enabled --->
                        <cfif qryConfig.blnCategoryPagination is 1>
                              <cfset recordsToDisplay = Val(qryConfig.intCategoryDisplayItems)>
                              <cfif qryConfig.intCategoryLayoutType is this.COLUMN_LAYOUT.DOUBLE>
                                    <cfset recordsToDisplay = recordsToDisplay * 2>
                              </cfif>
                              <cfset thepagination = this.display.getPaginationDisplay(qryCategories.recordCount, recordsToDisplay, URL.sr, '')>
                        </cfif>
                                          
                        <cfif Len(Trim(thepagination))><cfoutput>#thepagination#</cfoutput></cfif>
                        <div id="hbcatmod">
                              <cfif qryConfig.intCategoryLayoutType is this.COLUMN_LAYOUT.DOUBLE> <!--- double columns --->                                                                              
                                    <cfset count = 1>                                    
                                    <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay#">
                                          <cfif count mod 2 is 1>
                                          <div class="hbcatrow">
                                                <div class="hbcatcollft">
                                          <cfelse>
                                                <div class="hbcatcolrht">
                                          </cfif>
                                                <cfif qryConfig.blnCategoryImage is 1 and Val(intImageID)> <!--- with image --->
                                                      <cfif qryConfig.intCategoryImageAlign is this.IMAGE_ALIGN.INLINE> <!--- image inline --->
                                                            <img src="#this.workflow.setSSLPrefix(this.media.getURL(intImageID,Val(qryConfig.intCategoryImageWidth),Val(qryConfig.intCategoryImageHeight)),this.webid)#" class="hbcatinl" border="0"/>
                                                            <h5><a href="#SCRIPT_NAME#?c=#intCategoryID#">#txtTitle#</a></h5>
                                                      <cfelse> <!--- image left or right --->
                                                            <h5><a href="#SCRIPT_NAME#?c=#intCategoryID#">#txtTitle#</a></h5>
                                                            <img src="#this.workflow.setSSLPrefix(this.media.getURL(intImageID,Val(qryConfig.intCategoryImageWidth),Val(qryConfig.intCategoryImageHeight)),this.webid)#" <cfif qryConfig.intCategoryImageAlign EQ this.IMAGE_ALIGN.LEFT>class="hbcatlft"<cfelse>class="hbcatrht"</cfif> border="0" />
                                                      </cfif>
                                                <cfelse> <!--- without image --->
                                                      <h5><a href="#SCRIPT_NAME#?c=#intCategoryID#">#txtTitle#</a></h5>
                                                </cfif>                                                                              
                                                <cfif qryConfig.blnCategoryDescription is 1>
                                                      <!--- convertTokens() --->
                                                      #this.workflow.convertTokens(txtDescription,false,this.webid)#
                                                </cfif>
                                                </div>
                                          <cfif count mod 2 is 0>
                                                <div class="clr">&nbsp;</div>
                                          </div>
                                          </cfif>
                                          <cfset count = count + 1>
                                    </cfoutput>
                                    <cfif count mod 2 is 0>
                                          <div class="clr">&nbsp;</div>
                                    </div>
                                    </cfif>                                    
                              <cfelse> <!--- one column --->
                                    <cfif qryConfig.blnCategoryImage is 1>
                                          <cfif qryConfig.intCategoryImageAlign is this.IMAGE_ALIGN.LEFT or qryConfig.intCategoryImageAlign is this.IMAGE_ALIGN.RIGHT>
                                                <cfif qryConfig.blnCategoryImageWrap is 1 >
                                                      <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay#">
                                                            <h5><a href="#SCRIPT_NAME#?c=#intCategoryID#">#txtTitle#</a></h5>
                                                            <cfif intImageID gt 0><a href="#SCRIPT_NAME#?c=#intCategoryID#"><img src="#this.media.getURL(intImageID,Val(qryConfig.intCategoryImageWidth),Val(qryConfig.intCategoryImageHeight))#" <cfif qryConfig.intCategoryImageAlign is this.IMAGE_ALIGN.LEFT>class="hbcatlft"<cfelse>class="hbcatrht"</cfif> border="0" /></a></cfif>
                                                            <cfif qryConfig.blnCategoryDescription is 1>#this.workflow.convertTokens(txtDescription)#</cfif>
                                                            <div class="clr">&nbsp;</div>
                                                      </cfoutput>
                                                <cfelse>      
                                                      <cfset roundedWidth = roundImageWidth(Val(qryConfig.intCategoryImageWidth))>                                          
                                                      <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay#">
                                                            <cfif qryConfig.intCategoryImageAlign is this.IMAGE_ALIGN.LEFT>
                                                            <div class="hbcatlft#roundedWidth#"><cfif intImageID GT 0><img src="#this.media.getURL(intImageID,Val(qryConfig.intCategoryImageWidth),Val(qryConfig.intCategoryImageHeight))#" border="0"/></cfif></div>
                                                            <div class="hbcatrht#roundedWidth#">
                                                            <cfelse>
                                                            <div class="hbcatrht#roundedWidth#"><cfif intImageID GT 0><img src="#this.media.getURL(intImageID,Val(qryConfig.intCategoryImageWidth),Val(qryConfig.intCategoryImageHeight))#"  border="0"/></cfif></div>
                                                            <div class="hbcatlft#roundedWidth#">      
                                                            </cfif>
                                                            <h5><a href="#SCRIPT_NAME#?c=#intCategoryID#">#txtTitle#</a></h5>
                                                            <cfif qryConfig.blnCategoryDescription is 1>#this.workflow.convertTokens(txtDescription)#</cfif>
                                                            </div>
                                                            <div class="clr">&nbsp;</div>
                                                      </cfoutput>                                          
                                                </cfif>                                          
                                          <cfelse> <!--- this.IMAGE_ALIGN.INLINE --->
                                                <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay#">
                                                      <cfif intImageID GT 0><img src="#this.workflow.setSSLPrefix(this.media.getURL(intImageID,Val(qryConfig.intCategoryImageWidth),Val(qryConfig.intCategoryImageHeight)),this.webid)#"  border="0"  /></cfif>
                                                      <h5><a href="#SCRIPT_NAME#?c=#intCategoryID#">#txtTitle#</a></h5>
                                                      <cfif qryConfig.blnCategoryDescription is 1>#this.workflow.convertTokens(txtDescription)#</cfif>
                                                      <div class="clr">&nbsp;</div>
                                                </cfoutput>
                                          </cfif>
                                    <cfelse>
                                          <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay#">
                                                <h5><a href="#SCRIPT_NAME#?c=#intCategoryID#">#txtTitle#</a></h5>
                                                <cfif qryConfig.blnCategoryDescription is 1>#this.workflow.convertTokens(txtDescription)#</cfif>
                                                <div class="clr">&nbsp;</div>
                                          </cfoutput>
                                    </cfif>
                              </cfif> <!--- column layout --->                                                                  
                        </div>
                        <cfif Len(Trim(thepagination))><cfoutput>#thepagination#</cfoutput></cfif>                  
                  </cfif>
            </cfsavecontent>
            
            <cfreturn listingOutput>
      </cffunction>
      <!--- /getCategoryListing --->
      
      
      <!--- return listing of all items under the category --->
      <cffunction name="getItemListing" access="private" returntype="string" output="false">
            <cfargument name="qryConfig" type="query" required="true">
            <cfargument name="qryAll" type="query" required="true">
                              
            <cfscript>
                  var listingOutput = '';
                  var thepagination = '';
                  var infoList = '';
                  var addressLine1 = '';
                  var addressLine2 = '';
                  var roundedWidth = 0;
                  var count = 0;
                  var qryItems = #arguments.qryAll#;
                  var txtURL = '';
                  var txtItemLink = '';
                  var loginLink = this.loginURL;
            </cfscript>
            
            <cfif isDefined("URL.c") and Val(URL.c)>
                  <cfset qryItems = SelectFrom(qryAll,'intCategoryID',URL.c)>
            </cfif>      
                  
            <cfsavecontent variable="listingOutput">
                  <!--- <cfif qryConfig.blnSecurityEnabled is 1 AND Len(Trim(rids)) AND NOT ( isDefined("SESSION.loggedIn_#this.webid#") AND SESSION['loggedIn_#this.webid#'] ) AND Len(Trim(loginLink))> --->
                    <cfif qryConfig.blnSecurityEnabled IS 1 AND (qryConfig.blnItemListingAnchor or qryConfig.blnItemListingDescription) IS 1 AND NOT ( isDefined("SESSION.loggedIn") AND SESSION['loggedIn'] ) AND Len(Trim(loginLink))><!--- loggedIn_#this.webid# --->
                        <cfset loginLink = loginLink & '?wid=#this.webid#'>
                        <cfif isDefined("URL.c")>
                              <cfset loginLink = loginLink & '&cid=#URL.c#'>
                        </cfif>
                        <cfoutput><p><a href="#loginLink#">Login</a> to view secured items</p></cfoutput>
                  </cfif>
                  
                  
                  <!--- output the search form if item listing search is enabled --->
                  <cfif qryConfig.blnItemListingSearch is 1>
                        <cfset qryCategories = getCategoryQuery()>
                        <cfoutput>                              
                        <form name="frmSearch" id="hbsrchmod" method="post" action="#SCRIPT_NAME#">
                              <input type="text" name="ikeywords" id="hbsrchkey" <cfif isDefined('ikeywords')>value="#ikeywords#"</cfif> />
                              <select name="c" id="hbsrchsel">
                                    <option value="0">All</option>
                                    <cfloop query="qryCategories">
                                          <option value="#qryCategories.intCategoryID#" <cfif isDefined("URL.c") AND qryCategories.intCategoryID is URL.c>selected</cfif>>#qryCategories.txtTitle#</option>
                                    </cfloop>      
                              </select>
                              <input type="submit" name="hbsrchbtn" id="hbsrchbtn" value="Search" />
                        </form>
                        </cfoutput>      
                  </cfif>
                  
                  <!--- total number of items --->
                  <cfset recordsToDisplay = qryItems.recordCount>            
                  
                  <cfif recordsToDisplay is 0>
                        <p>There are no items to display.</p>
                  <cfelse>                        
                        <!--- if paging is enabled --->
                        <cfif qryConfig.blnItemListingPagination is 1>
                              <cfset recordsToDisplay = Val(qryConfig.intItemListingDisplayItems)>
                              <cfif qryConfig.intItemListingLayoutType is this.COLUMN_LAYOUT.DOUBLE>
                                    <cfset recordsToDisplay = recordsToDisplay * 2>
                              </cfif>
                              <cfset thepagination = this.display.getPaginationDisplay(qryItems.recordCount, recordsToDisplay, URL.sr, '')>
                        </cfif>
                        
                        <cfset callAction = 'more...'>
                        <cfif Len(Trim(qryConfig.txtItemListingDescriptionAction))>
                              <cfset callAction = qryConfig.txtItemListingDescriptionAction>
                        </cfif>                        
                                          
                        <cfif Len(Trim(thepagination))><cfoutput>#thepagination#</cfoutput></cfif>
                              
                        <div id="hblistmod">                  
                              <cfif qryConfig.intItemListingLayoutType is this.COLUMN_LAYOUT.DOUBLE> <!--- double columns --->
                                    <cfset count = 1>
                                    
                                    <cfoutput query="qryItems" startrow="#URL.sr#" maxrows="#recordsToDisplay#">                                    
                                          <cfif count MOD 2 is 1>
                                          <div class="hblistrow">
                                                <div class="hblistcollft">
                                          <cfelse>
                                                <div class="hblistcolrht">
                                          </cfif>
                                                      <cfset txtTarget = ''>
                                                      <cfif qryConfig.blnItemDetail is 1>                                                                  
                                                            <cfset txtURL = "#SCRIPT_NAME#?i=#intItemID#">
                                                      <cfelseif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                                            <cfif REFindNoCase("http[s]://",txtLink)>
                                                                  <cfset txtURL = txtLink>
                                                            <cfelse>
                                                                  <cfset txtURL = "http://#txtLink#">
                                                            </cfif>
                                                            <cfset txtTarget = 'target="_blank"'>
                                                      <cfelse>
                                                            <cfset txtURL = ''>
                                                      </cfif>
                                                      <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingImage is 1 AND qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.INLINE AND Val(intImageID)>
                                                             <cfif Len(Trim(txtURL))>
                                                                  <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight))#" border="0" class="hblistinl" /></a>
                                                            <cfelse>
                                                                  <img src="#this.workflow.setSSLPrefix(this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight)),this.webid)#" border="0" class="hblistinl" />                                                                  
                                                            </cfif>                                                       
                                                       </cfif>                                                       
                                                      <cfif qryConfig.blnItemListingTitle is 1>
                                                            <cfif Len(Trim(txtURL))>
                                                                  <h5><a href="#txtURL#" #txtTarget#>#txtTitle#</a><cfif blnPrivate> #this.PRIVATE_IMAGE#</cfif></h5>
                                                            <cfelse>
                                                                  <h5>#txtTitle#<cfif blnPrivate> #this.PRIVATE_IMAGE#</cfif></h5>
                                                            </cfif>
                                                      </cfif>
                                                      <cfset infoList = ''>                                                                                                
                                                      <cfif qryConfig.blnDate is 1 AND isDate(dtDate)><cfset infoList = infoList & '<li>#DateFormat(dtDate, 'mmmm dd, yyyy')#</li>'></cfif>
                                                      <cfif qryConfig.blnAddress is 1>
                                                            <cfset addressLine1 = ''>
                                                            <cfset addressLine2 = ''>
                                                            <cfset addressLine1 = addressLine1 & '#txtAddress#'>
                                                            <cfif Len(Trim(txtCity))><cfset addressLine2 = addressLine2 & '#txtCity#,'></cfif>
                                                            <cfif Len(Trim(txtProvince))><cfset addressLine2 = addressLine2 & ' #txtProvince#,'></cfif>
                                                            <cfif Len(Trim(txtPostalCode))><cfset addressLine2 = addressLine2 & ' #txtPostalCode#'></cfif>
                                                            <cfset addressLine2 = addressLine2 & ' #txtCountry#'>
                                                            <cfif Len(Trim(addressLine1))><cfset infoList = infoList & '<li>#addressLine1#</li>'></cfif>
                                                            <cfif Len(Trim(addressLine2))><cfset infoList = infoList & '<li>#addressLine2#</li>'></cfif>
                                                      </cfif>
                                                      <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtPhone))><cfset infoList = infoList & '<li>Phone: #txtPhone#</li>'></cfif>
                                                      <cfif qryConfig.blnFax is 1 AND Len(Trim(txtFax))><cfset infoList = infoList & '<li>Fax: #txtFax#</li>'></cfif>
                                                      <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtTollFree))><cfset infoList = infoList & '<li>Toll-Free: #txtTollFree#</li>'></cfif>
                                                      <cfif qryConfig.blnEmail is 1 AND Len(Trim(txtEmail))><cfset infoList = infoList & '<li>Email: <a href="mailto:#txtEmail#">#txtEmail#</a></li>'></cfif>
                                                      <cfif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                                            <cfif REFindNoCase("http[s]://",txtLink)>
                                                                  <cfset txtItemLink = txtLink>
                                                            <cfelse>
                                                                  <cfset txtItemLink = "http://#txtLink#">
                                                            </cfif>
                                                            <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#txtLink#</a></li>'>
                                                      </cfif>
                                                      <cfif Len(Trim(infoList))>
                                                            <ul>
                                                                  #infoList#                                                      
                                                            </ul>
                                                      <cfelse>
                                                            <br />
                                                      </cfif>
                                                      <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingImage is 1 AND qryConfig.intItemListingImageAlign NEQ this.IMAGE_ALIGN.INLINE AND Val(intImageID)>                                                            
                                                            <cfif Len(Trim(txtURL))>
                                                                  <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight))#" border="0" <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.LEFT>class="hblistlft"<cfelse>class="hblistrht"</cfif>/></a>
                                                            <cfelse>
                                                                  <img src="#this.workflow.setSSLPrefix(this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight)),this.webid)#" border="0" <cfif qryConfig.intItemListingImageAlign EQ this.IMAGE_ALIGN.LEFT>class="hblistlft"<cfelse>class="hblistrht"</cfif>/>                                                            
                                                            </cfif>
                                                      </cfif>      
                                                      <cfif qryConfig.blnItemListingDescription is 1>
                                                            <cfif qryConfig.intItemListingDescriptionType is this.DISPLAY_TYPES.MEMO>
                                                                  #txtAbstract#
                                                            <cfelseif qryConfig.intItemListingDescriptionType is this.DISPLAY_TYPES.TRIMMED AND Val(qryConfig.intItemListingDescriptionLength)>      
                                                                  <!--- Thomas Auguest 29 2006: More... option doesn't work for two column item listing. START --->
                                                                  <!--- <cfif Len(Trim(txtURL))>
                                                                        #this.display.memoFormat(txtDescription, qryConfig.intItemListingDescriptionLength, ' [ <a href="#txtURL#">#callAction#</a> ]')#
                                                                  <cfelse>
                                                                        #this.display.memoFormat(txtDescription, qryConfig.intItemListingDescriptionLength, '')#
                                                                  </cfif> --->
                                                                  #this.display.memoFormat(txtDescription, qryConfig.intItemListingDescriptionLength, ' [ <a href="#SCRIPT_NAME#?i=#intItemID#">#callAction#</a> ]')#
                                                                  <!--- Thomas Auguest 29 2006: More... option doesn't work for two column item listing. END--->
                                                            <cfelse> <!--- full --->
                                                                  <!--- convertTokens() --->
                                                                  #this.workflow.convertTokens(txtDescription,false,this.webid)#
                                                            </cfif>                                                      
                                                      </cfif>
                                                </div>                                                
                                          <cfif count MOD 2 is 0>            
                                                <div class="clr">&nbsp;</div>                                                
                                          </div>
                                          </cfif>
                                          <cfset count = count + 1>                                          
                                    </cfoutput>
                                    <cfif count MOD 2 is 0>
                                          <div class="clr">&nbsp;</div>
                                    </div>
                                    </cfif>      
                              <cfelse> <!--- single column --->
                                    <cfif qryConfig.blnDate is 1 AND qryConfig.intItemListingDateLayoutType is this.DATE_LAYOUT_TYPES.ONELINE>
                                                                              
                                          <cfoutput query="qryItems" startrow="#URL.sr#" maxrows="#recordsToDisplay#">
                                                <div class="hblistlft"><cfif isDate(dtDate)><strong><a href="#SCRIPT_NAME#?i=#intItemID#">#DateFormat(dtDate,'mmm dd, yyyy')#</a></strong></cfif></div>
                                                <div class="hblistrht75">
                                                      <cfif qryConfig.blnItemListingTitle is 1><strong><a href="#SCRIPT_NAME#?i=#intItemID#">#txtTitle#</a></strong></cfif>
                                                      <cfif qryConfig.blnItemListingDescription is 1>
                                                            <cfif qryConfig.intItemListingDescriptionType is this.DISPLAY_TYPES.MEMO>
                                                                  #txtAbstract#
                                                            <cfelseif qryConfig.intItemListingDescriptionType is this.DISPLAY_TYPES.TRIMMED AND Val(qryConfig.intItemListingDescriptionLength)>      
                                                                  #this.display.memoFormat(txtDescription, qryConfig.intItemListingDescriptionLength, ' [ <a href="#SCRIPT_NAME#?i=#intItemID#">#callAction#</a> ]')#
                                                            <cfelse> <!--- full --->
                                                                  <!--- convertTokens() --->
                                                                  #this.workflow.convertTokens(txtDescription,false,this.webid)#
                                                            </cfif>                                                      
                                                      </cfif>
                                                </div>
                                          </cfoutput>
                                    <cfelse> <!--- no date or date layout is two line --->
                                          <cfset roundedWidth = roundImageWidth(Val(qryConfig.intItemListingImageWidth))>                                          
                                          <cfoutput query="qryItems" startrow="#URL.sr#" maxrows="#recordsToDisplay#">
                                                <cfset txtTarget = ''>                                          
                                                <cfif qryConfig.blnItemDetail is 1>
                                                      <cfset txtURL = '#SCRIPT_NAME#?i=#intItemID#'>
                                                <cfelseif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                                      <cfif REFindNoCase("http[s]://",txtLink)>
                                                            <cfset txtURL = txtLink>
                                                      <cfelse>
                                                            <cfset txtURL = "http://#txtLink#">
                                                      </cfif>
                                                      <cfset txtTarget = 'target="_blank"'>
                                                <cfelse>
                                                      <cfset txtURL = ''>      
                                                </cfif>
                                                <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingImage is 1 AND Val(intImageID)>                                                      
                                                      <cfif qryConfig.blnItemListingImageWrap is 1 OR qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.INLINE AND Val(intImageID)> <!--- image wrap --->
                                                            <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.RIGHT> <!--- image right --->
                                                                  
                                                                  <cfif Len(Trim(txtURL))>                                                                        
                                                                        <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight))#" border="0" class="hblistrht"/></a>
                                                                  <cfelse>
                                                                        <img src="#this.workflow.setSSLPrefix(this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight)),this.webid)#" border="0" class="hblistrht"/>
                                                                  </cfif>                                                                  
                                                            <cfelse> <!--- image left or inline --->      
                                                                  <cfif Len(Trim(txtURL))>
                                                                        <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight))#" border="0" <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.LEFT>class="hblistlft"<cfelse>class="hblistinl"</cfif> /></a>
                                                                  <cfelse>
                                                                        <img src="#this.workflow.setSSLPrefix(this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight)),this.webid)#" border="0" <cfif qryConfig.intItemListingImageAlign EQ this.IMAGE_ALIGN.LEFT>class="hblistlft"<cfelse>class="hblistinl"</cfif> />                                                                        
                                                                  </cfif>
                                                            </cfif>
                                                      <cfelse> <!--- image no wrap --->                                                                                                                        
                                                            <cfif Len(Trim(txtURL))>
                                                                  <div <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.LEFT>class="hblistlft"<cfelse>class="hblistrht"</cfif>><a href="#txtURL#"><img src="#this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight))#" border="0"/></a></div>
                                                                  <div <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.LEFT>class="hblistrht#roundedWidth#"<cfelse>class="hblistlft#roundedWidth#"</cfif>>
                                                            <cfelse>
                                                                  <div <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.LEFT>class="hblistlft"<cfelse>class="hblistrht"</cfif>><img src="#this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight))#" border="0"/></div>
                                                                  <div <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.LEFT>class="hblistrht#roundedWidth#"<cfelse>class="hblistlft#roundedWidth#"</cfif>>
                                                            </cfif>
                                                      </cfif>                                                                                                                                                                  
                                                </cfif>
                                                <cfif qryConfig.blnItemListingTitle is 1>
                                                      <cfif Len(Trim(txtURL))>
                                                            <h5><a href="#txtURL#" #txtTarget#>#txtTitle#</a><cfif blnPrivate> #this.PRIVATE_IMAGE#</cfif></h5>
                                                      <cfelse>
                                                            <h5>#txtTitle#<cfif blnPrivate> #this.PRIVATE_IMAGE#</cfif></h5>
                                                      </cfif>                                                      
                                                </cfif>
                                                <cfset infoList = ''>                                                                                                
                                                <cfif qryConfig.blnDate is 1 AND isDate(dtDate)><cfset infoList = infoList & '<li>#DateFormat(dtDate, 'mmmm dd, yyyy')#</li>'></cfif>
                                                <cfif qryConfig.blnAddress is 1>
                                                      <cfset addressLine1 = ''>
                                                      <cfset addressLine2 = ''>
                                                      <cfset addressLine1 = addressLine1 & '#txtAddress#'>
                                                      <cfif Len(Trim(txtCity))><cfset addressLine2 = addressLine2 & '#txtCity#,'></cfif>
                                                      <cfif Len(Trim(txtProvince))><cfset addressLine2 = addressLine2 & ' #txtProvince#,'></cfif>
                                                      <cfif Len(Trim(txtPostalCode))><cfset addressLine2 = addressLine2 & ' #txtPostalCode#'></cfif>
                                                      <cfset addressLine2 = addressLine2 & ' #txtCountry#'>
                                                      <cfif Len(Trim(addressLine1))><cfset infoList = infoList & '<li>#addressLine1#</li>'></cfif>
                                                      <cfif Len(Trim(addressLine2))><cfset infoList = infoList & '<li>#addressLine2#</li>'></cfif>
                                                </cfif>
                                                <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtPhone))><cfset infoList = infoList & '<li>Phone: #txtPhone#</li>'></cfif>
                                                <cfif qryConfig.blnFax is 1 AND Len(Trim(txtFax))><cfset infoList = infoList & '<li>Fax: #txtFax#</li>'></cfif>
                                                <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtTollFree))><cfset infoList = infoList & '<li>Toll-Free: #txtTollFree#</li>'></cfif>
                                                <cfif qryConfig.blnEmail is 1 AND Len(Trim(txtEmail))><cfset infoList = infoList & '<li>Email: <a href="mailto:#txtEmail#">#txtEmail#</a></li>'></cfif>
                                                <cfif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                                      <cfif REFindNoCase("http[s]://",txtLink)>
                                                            <cfset txtItemLink = txtLink>
                                                      <cfelse>
                                                            <cfset txtItemLink = "http://#txtLink#">
                                                      </cfif>
                                                      <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#txtLink#</a></li>'>
                                                </cfif>
                                                <cfif Len(Trim(infoList))>
                                                      <ul>
                                                            #infoList#                                                      
                                                      </ul>
                                                </cfif>
                                                
                                                <cfif qryConfig.blnItemListingDescription is 1>
                                                      <cfif qryConfig.intItemListingDescriptionType is this.DISPLAY_TYPES.MEMO>
                                                            #txtAbstract#
                                                      <cfelseif qryConfig.intItemListingDescriptionType is this.DISPLAY_TYPES.TRIMMED AND Val(qryConfig.intItemListingDescriptionLength)>      
                                                            #this.display.memoFormat(txtDescription, qryConfig.intItemListingDescriptionLength, ' [ <a href="#SCRIPT_NAME#?i=#intItemID#">#callAction#</a> ]')#
                                                      <cfelse> <!--- full --->
                                                            <!--- convertTokens() --->
                                                            #this.workflow.convertTokens(txtDescription,false,this.webid)#
                                                      </cfif>                                                      
                                                </cfif>
                                                <div class="clr">&nbsp;</div>
                                                <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingImage is 1 AND qryConfig.blnItemListingImageWrap is 0 AND Val(intImageID)>
                                                </div>
                                                </cfif>                                    
                                          </cfoutput>                                          
                                    </cfif>
                              </cfif>                              
                        </div>
                        <cfif Len(Trim(thepagination))><cfoutput>#thepagination#</cfoutput></cfif>                        
                  </cfif>
            </cfsavecontent>
            
            <cfreturn listingOutput />
      </cffunction>
      <!--- /getItemListing --->
      
      <!--- return listing of all items with anchors --->
      <cffunction name="getAnchoredListing" access="private" returntype="string" output="false">
            <cfargument name="qryConfig" type="query" required="true">
            <cfargument name="qryAll" type="query" required="true">
            
            <cfscript>
                  var listingOutput = '';
                  var infoList = '';
                  var addressLine1 = '';
                  var addressLine2 = '';
                  var roundedWidth = 0;
                  var count = 0;
                  var txtURL = '';
                  var txtTarget = '';
                  var txtItemLink = '';
                  var loginLink = this.loginURL;
                  
                  var qryAllCategories = getCategoryQuery();
                  var qryItems = #arguments.qryAll#;
            </cfscript>
            
            <cfsavecontent variable="listingOutput">
                  <cfset nItemCount = qryItems.recordCount>
                  
                  <cfif nItemCount is 0>
                        <p>There are no items to display.</p>
                  <cfelse>
                        <!--- re-order the items by intCategoryID --->
                        <cfquery name="qryAll" dbtype="query">
                              SELECT      *
                              FROM      qryAll
                              ORDER BY intCategoryID
                        </cfquery>
                        
                        <!--- Provide Login link if items are secure --->
                        <cfif Arguments.qryConfig.blnSecurityEnabled IS 1 AND (qryConfig.blnItemListingAnchor or qryConfig.blnItemListingDescription) IS 1 AND NOT ( isDefined("SESSION.loggedIn") AND SESSION['loggedIn'] ) AND Len(Trim(loginLink))><!--- loggedIn_#this.webid# --->
                              <cfset loginLink = loginLink & '?wid=#this.webid#'>
                              <cfif isDefined("URL.c")>
                                    <cfset loginLink = loginLink & '&cid=#URL.c#'>
                              </cfif>
                              <cfoutput><p><a href="#loginLink#">Login</a> to view secured items</p></cfoutput>
                        </cfif>
                        <div id="anchorlisting">
                        <a name="item0"></a>
                        <cfloop query="qryAllCategories">
                              <cfset qryItems = SelectFrom(qryAll,'intCategoryID',qryAllCategories.intID)>
                              <cfoutput>
                              <cfif qryAllCategories.blnShowCategoryTitle eq "1">
                              <h2>#qryAllCategories.txtTitle#</h2>
                              </cfif>
                              <cfif qryConfig.blnCategoryDescription eq "1">
                              <p>#qryAllCategories.txtDescription#</p>
                              </cfif>
                              
                              <ul>
                              </cfoutput>
                              <cfoutput query="qryItems">
                                    <!--- Donny: missing url parameter
                                    <li><strong><a href="#SCRIPT_NAME###item#currentRow#">#txtTitle#</a></strong></li> --->
                                    <li><strong><a href="#SCRIPT_NAME#<cfif Len(Trim(QUERY_STRING))>?#QUERY_STRING#</cfif>##item#count + currentRow#">#qryItems.txtTitle#</a></strong></li>
                              </cfoutput>
                              </ul>
                              <cfset count = count + qryItems.recordCount>
                        </cfloop>
                        <div class="clr">&nbsp;</div>
                        <cfset count = 0>
                        <cfloop query="qryAllCategories">
                              <cfset qryItems = SelectFrom(qryAll,'intCategoryID',qryAllCategories.intID)>
                              <ul id="dottedtop">
                              <cfoutput query="qryItems">
                                    <cfset roundedWidth = roundImageWidth(Val(qryConfig.intItemListingImageWidth))>
                                    <li>
                                          <h5><a name="item#count + currentRow#"></a>#txtTitle#<cfif blnPrivate> #this.PRIVATE_IMAGE#</cfif></h5>
                                          <!--- <strong>#qryAllCategories.txtTitle#</strong><br /> --->
                                          <div id="hblistmod">
                                          <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingImage is 1>
                                                <cfif qryConfig.blnItemListingImageWrap is 1 OR qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.INLINE AND Val(intImageID)> <!--- image wrap --->
                                                      <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.RIGHT> <!--- image right --->
                                                            <img src="#this.workflow.setSSLPrefix(this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight)),this.webid)#" border="0" class="hblistrht"/>
                                                      <cfelse> <!--- image left or inline --->      
                                                            <img src="#this.workflow.setSSLPrefix(this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight)),this.webid)#" border="0" <cfif qryConfig.intItemListingImageAlign EQ this.IMAGE_ALIGN.LEFT>class="hblistlft"<cfelse>class="hblistinl"</cfif> />
                                                      </cfif>
                                                <cfelseif Val(intImageID)> <!--- image no wrap --->                                                            
                                                      <div <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.LEFT>class="hblistlft"<cfelse>class="hblistrht"</cfif>><img src="#this.media.getURL(intImageID,Val(qryConfig.intItemListingImageWidth),Val(qryConfig.intItemListingImageHeight))#" border="0"/></div>
                                                      <div <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.LEFT>class="hblistrht#roundedWidth#"<cfelse>class="hblistlft#roundedWidth#"</cfif>>
                                                </cfif>
                                          </cfif>
                                          <cfset infoList = ''>                                                                                                
                                          <cfif qryConfig.blnDate is 1 AND isDate(dtDate)><cfset infoList = infoList & '<li>#DateFormat(dtDate, 'mmmm dd, yyyy')#</li>'></cfif>
                                          <cfif qryConfig.blnAddress is 1>
                                                <cfset addressLine1 = ''>
                                                <cfset addressLine2 = ''>
                                                <cfset addressLine1 = addressLine1 & '#txtAddress#'>
                                                <cfif Len(Trim(txtCity))><cfset addressLine2 = addressLine2 & '#txtCity#,'></cfif>
                                                <cfif Len(Trim(txtProvince))><cfset addressLine2 = addressLine2 & ' #txtProvince#,'></cfif>
                                                <cfif Len(Trim(txtPostalCode))><cfset addressLine2 = addressLine2 & ' #txtPostalCode#'></cfif>
                                                <cfset addressLine2 = addressLine2 & ' #txtCountry#'>
                                                <cfif Len(Trim(addressLine1))><cfset infoList = infoList & '<li>#addressLine1#</li>'></cfif>
                                                <cfif Len(Trim(addressLine2))><cfset infoList = infoList & '<li>#addressLine2#</li>'></cfif>
                                          </cfif>
                                          <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtPhone))><cfset infoList = infoList & '<li>Phone: #txtPhone#</li>'></cfif>
                                          <cfif qryConfig.blnFax is 1 AND Len(Trim(txtFax))><cfset infoList = infoList & '<li>Fax: #txtFax#</li>'></cfif>
                                          <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtTollFree))><cfset infoList = infoList & '<li>Toll-Free: #txtTollFree#</li>'></cfif>
                                          <cfif qryConfig.blnEmail is 1 AND Len(Trim(txtEmail))><cfset infoList = infoList & '<li>Email: <a href="mailto:#txtEmail#">#txtEmail#</a></li>'></cfif>
                                          <cfif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                                <cfif REFindNoCase("http[s]://",txtLink)>
                                                      <cfset txtItemLink = txtLink>
                                                <cfelse>
                                                      <cfset txtItemLink = "http://#txtLink#">
                                                </cfif>
                                                <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#txtLink#</a></li>'>
                                          </cfif>
                                          <cfif Len(Trim(infoList))>
                                                <ul>
                                                      #infoList#                                                      
                                                </ul>
                                          </cfif>
                                          <!--- convertTokens() --->
                                          #this.workflow.convertTokens(txtDescription,false,this.webid)#
                                          <!--- Donny: missing url parameter
                                          <p><a href="#SCRIPT_NAME###item0">Back to top</a></p> --->
                                          
                                          <cfstoredproc procedure="getCourseDesc" datasource="#this.datasource#">
                              <cfprocresult name="getCourseDesc">
                              <cfprocparam cfsqltype="cf_sql_varchar" type="in" value="07-08">
                              <cfprocparam cfsqltype="cf_sql_integer" type="in" value="#qryItems.intcourseid#">
                              </cfstoredproc>
                              
                              <cfstoredproc procedure="getPreqList" datasource="#this.datasource#">
                              <cfprocresult name="getPreqList">
                              <cfprocparam cfsqltype="cf_sql_integer" type="in" value="#qryItems.intcourseid#">
                              </cfstoredproc>
                              
                              
                                    <cfif getcoursedesc.coursedescription neq ""><p>#getcoursedesc.coursedescription# </p></cfif>
                                    <cfif getcoursedesc.catalognotes neq ""><p>#getcoursedesc.catalognotes#</p></cfif>
                              
                              
                              <cfif getPreqList.recordcount neq 0>
                              <p><em>Prerequisite(s):</em>
                              <cfloop query="getPreqList">
                                    <cfif #preq_flag# eq "C">
                                          #left(CourseNumber,3)#.#right(CourseNumber,3)# #CourseTitle#<cfif #Currentrow# lt #Recordcount#>,<cfelse>.</cfif>
                                    <cfelse>
                                          &nbsp;#lstPrerequisitesID#&nbsp;
                                    </cfif>            
                              </cfloop></p>
                              </cfif>
                              
                                    <cfif qryItems.blnCCSSLink eq "1">
                               <p><img src="/images/CCSSicon.gif" title="See When This Course is Offered" alt="See When This Course is Offered" border="0"> <a href="/courseschedule/index.cfm?action=search&coursenumberlookup=#getcoursedesc.coursenumber###courselist" target="_blank">See when this course is offered (opens a new browser window)</a></p>
                              </cfif>
                                          
                                          <p><a href="#SCRIPT_NAME#<cfif Len(Trim(QUERY_STRING))>?#QUERY_STRING#</cfif>##item0">Back to top</a></p>
                                          <div class="clr">&nbsp;</div>
                                          <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingImage is 1 AND qryConfig.blnItemListingImageWrap is 0>
                                                </div>
                                          </cfif>
                                          </div>
                                    </li>
                              </cfoutput>
                              </ul>
                              <cfset count = count + qryItems.recordCount>
                        </cfloop>
                        </div>
                  </cfif>
            </cfsavecontent>
            
            <cfreturn listingOutput />
      </cffunction>
      <!--- /getAnchoredListing --->      
      <!--- output the details of specified item in the front end --->
      <cffunction name="getItemDetail" access="private" returntype="string" output="false">
            <cfargument name="qryConfig" type="query" required="true">
            <cfargument name="qryItem" type="query" required="true">            

            <cfset var detailOutput = ''>
            <cfset var txtItemLink = ''>
            <!--- Login redirect to login page --->
            <cfset var loginLink = this.loginURL>
            
            <cfif qryConfig.blnSecurityEnabled is 1 AND qryItem.recordCount AND qryItem.blnPrivate is 1>
                  <cfif NOT (isDefined("SESSION.loggedIn") AND SESSION['loggedIn']) AND Len(Trim(loginLink))>
                  
                        <cfset loginLink = loginLink & '?wid=#this.webid#'>
                        <cfif isDefined("URL.c")>
                              <cfset loginLink = loginLink & '&cid=#URL.c#'>
                        </cfif>
                        <cfset loginLink = loginLink & '&iid=#qryItem.intItemID#'>
                        <cflocation url="#loginLink#" addtoken="no">
                  </cfif>                  
            </cfif>
            
            <cfsavecontent variable="detailOutput">
                  <cfif qryItem.recordCount is 0>
                        <p>The item is not found.</p>
                  <cfelse>
                        <div id="hbdetmod">
                              <cfoutput query="qryItem" maxrows="1">
                                    <!--- <h5>#txtTitle#<cfif blnPrivate> #this.PRIVATE_IMAGE#</cfif></h5> --->
                                    <cfif blnPrivate> #this.PRIVATE_IMAGE#</cfif>
                                    <cfset infoList = ''>                                                                                                
                                    <cfif qryConfig.blnDate is 1 AND isDate(dtDate)><cfset infoList = infoList & '<li>#DateFormat(dtDate, 'mmmm dd, yyyy')#</li>'></cfif>
                                    <cfif qryConfig.blnAddress is 1>
                                          <cfset addressLine = ''>
                                          <cfset addressLine = addressLine & '#txtAddress#'>
                                          <cfif Len(Trim(txtCity))><cfset addressLine = addressLine & ' #txtCity#,'></cfif>
                                          <cfif Len(Trim(txtProvince))><cfset addressLine = addressLine & ' #txtProvince#,'></cfif>
                                          <cfif Len(Trim(txtPostalCode))><cfset addressLine = addressLine & ' #txtPostalCode#'></cfif>
                                          <cfset addressLine = addressLine & ' #txtCountry#'>
                                          <cfif Len(Trim(addressLine))><cfset infoList = infoList & '<li>#addressLine#</li>'></cfif>
                                    </cfif>
                                    <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtPhone))><cfset infoList = infoList & '<li>Phone: #txtPhone#</li>'></cfif>
                                    <cfif qryConfig.blnFax is 1 AND Len(Trim(txtFax))><cfset infoList = infoList & '<li>Fax: #txtFax#</li>'></cfif>
                                    <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtTollFree))><cfset infoList = infoList & '<li>Toll-Free: #txtTollFree#</li>'></cfif>
                                    <cfif qryConfig.blnEmail is 1 AND Len(Trim(txtEmail))><cfset infoList = infoList & '<li>Email: <a href="mailto:#txtEmail#">#txtEmail#</a></li>'></cfif>
                                    <cfif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                          <cfif REFindNoCase("http[s]://",txtLink)>
                                                <cfset txtItemLink = txtLink>
                                          <cfelse>
                                                <cfset txtItemLink = "http://#txtLink#">
                                          </cfif>
                                          <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#txtLink#</a></li>'>
                                    </cfif>
                                    <cfif Len(Trim(infoList))>
                                          <ul>
                                                #infoList#                                                      
                                          </ul>
                                    </cfif>
                                    <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemDetailImage is 1 AND Val(intImageID)><img src="#this.media.getURL(intImageID,Val(qryConfig.intItemDetailImageWidth),Val(qryConfig.intItemDetailImageHeight))#"  border="0" <cfif qryConfig.intItemDetailImageAlign is this.IMAGE_ALIGN.LEFT>class="hbdetlft"<cfelseif qryConfig.intItemDetailImageAlign is this.IMAGE_ALIGN.RIGHT>class="hbdetrht"<cfelse>class="hbdetinl"</cfif> /></cfif>
                                    <!--- convertTokens() --->
                                    <p>#this.workflow.convertTokens(txtDescription,false,this.webid)#</p>                              
                                    <cfif qryConfig.blnResource is 1>
                                          <cfset addlResources = this.media.getAdditionalResources(Val(intResourceID))>                                           
                                          <cfif ArrayLen(addlResources)>
                                          <br/>
                                          <strong>#qryConfig.txtItemDetailResourceCaption#:</strong><br />
                                          <ul>
                                                <cfloop from="1" to="#ArrayLen(addlResources)#" index="i">
                                                      <li><a href="#addlResources[i].link#" <cfif addlResources[i].blnNewWindow>target="_blank"</cfif>><img src="images/#addlResources[i].icon#" width="18" height="18" border="0" alt=""></a> <a href="#addlResources[i].link#" target="_blank">#addlResources[i].title#</a><cfif val(addlResources[i].filesize)> [#round(addlResources[i].filesize / 1024)# kb]</cfif> </li>
                                                </cfloop>
                                          </ul>
                                          </cfif>
                                    </cfif>      
                              </cfoutput>
                        </div>
                  </cfif>
            </cfsavecontent>
            
            <cfreturn detailOutput />
      </cffunction>
      <!--- /getItemDetail --->
      
      <cffunction name="roundImageWidth" access="private" returntype="numeric" output="false">
            <cfargument name="width" type="numeric" required="true">
            <cfset var w75 = 75>
            <cfset var w150 = 150>
            <cfset var w225 = 225>
            <cfset var w300 = 300>
            
            <cfif width lte w75>
                  <cfreturn w75 />
            <cfelseif width lte w150>
                  <cfreturn w150 />
            <cfelseif width lte w225>
                  <cfreturn w225 />
            <cfelse>
                  <cfreturn w300 />
            </cfif>            
      </cffunction>

      <!--- Hot Banana Console tabs --->
      <cffunction name="getTabs" access="public" returntype="any">
            <cfxml variable="xmlNav">
                  <cfoutput>
                        <item>
                              <item caption="#XMLFormat(translate(this.formData.itemsname))#" id="#this.DATATYPES.ITEM#"/>
                              <cfif this.formData.blnCategory>
                                    <item caption="#XMLFormat(translate('Categories'))#" id="#this.DATATYPES.CATEGORY#"/>
                              </cfif>
                              <item caption="#XMLFormat(translate('Config'))#" id="#this.DATATYPES.CONFIG#"/>
                        </item>
                  </cfoutput>
            </cfxml>
            
            <cfreturn xmlNav />
      </cffunction>

      <!--- returns hotbanana back end interface --->
      <cffunction name="getBackEnd" access="public" returntype="string">
            <cfset this.workflow.verifyColumns(this.catData)>
            <cfset this.workflow.verifyColumns(this.formData)>
            <cfset this.workflow.verifyColumns(this.listData)>
            <cfset this.workflow.verifyColumns(this.roleData)>
                  
            <cfif (this.datatype is this.DATATYPES.CATEGORY)>
                  <cfreturn getCategoryBackEnd()>
            <cfelseif (this.datatype is this.DATATYPES.ITEM)>
                  <cfreturn getItemBackEnd()>
            <cfelse>
                  <cfreturn getConfigBackEnd()>
            </cfif>
      </cffunction>

      <!--- returns hotbanana back end of the categories tab --->
      <cffunction name="getCategoryBackEnd" access="private" returntype="string">      
            <cfparam name="txtTitle" default="">
            
            <cfquery name="qryNavCategoryOrder" datasource="#this.datasource#">
                  UPDATE       tblNavigation
                  SET            tblNavigation.intOrder =
                        (SELECT tblItem.intOrder
                         FROM       tblItem
                         LEFT JOIN tblCourseListingCategory
                         ON       tblItem.intID = tblCourseListingCategory.intItemID
                         AND       tblCourseListingCategory.blnLive = 1
                         WHERE       intDatatype = #this.DATATYPES.CATEGORY#
                         AND       intWebID = #this.webid#
                         AND       tblNavigation.intID = tblCourseListingCategory.intCategoryID)
                  WHERE       intParentID = #this.webid#
                  AND       blnCategory = 1
                  AND       blnDeleted = 0
            </cfquery>

            <cfif isDefined("FORM.button")>
                  <!--- <cfif (NOT isDefined("FORM.intCategoryID"))>
                        <cfset qryCategory = selectFrom(this.workflow.getQuery(this.catData), "intItemID", FORM.id)>
                        <cfset FORM.intCategoryID = qryCategory.intCategoryID>
                  </cfif> --->

                  <cfif FORM.button is translate("Delete")>
                        <!--- <cfset FORM.intCategoryID = val(FORM.intCategoryID)> --->
                        <cfset this.category.deleteCategory(val(FORM.intCategoryID))>
                        <cfset this.display.setActionMsg(this.workflow.processForm(this.catData))>
                  <cfelseif FORM.button is translate("Restore")>
                        <cfset this.category.restoreCategory(val(FORM.intCategoryID))>
                        <cfset this.display.setActionMsg(this.workflow.processForm(this.catData))>
                  <cfelse>
                        <cfif (isDefined("FORM.intCategoryID") AND FORM.intCategoryID gt 0)>
                              <!---  we need to see if the category was approved before we set the actual category title --->
                              <cfset this.display.setActionMsg(this.workflow.processForm(this.catData))>
                              <cfset qryCategory = selectFrom(this.workflow.getQuery(this.catData), "intItemID", FORM.id)>
                              <cfif (NOT isDefined("qryCategory.blnApproved")) or (qryCategory.blnApproved is 1)>
                                    <cfset this.category.updateCategory(FORM.intCategoryID,qryCategory.txtTitle)>
                              </cfif>
                        <cfelse>
                              <cfset FORM.intCategoryID = this.category.addCategory(this.webid,txtTitle)>
                              <cfset this.display.setActionMsg(this.workflow.processForm(this.catData))>
                        </cfif>
                  </cfif>
            </cfif>

            <!--- <cfset this.formData.query = this.workflow.getQuery(this.formData)> --->

            <cfset qryRecords = this.workflow.getQuery(this.catData)>
            <!--- <cfset qryRecords = getCategoryQuery()> --->            

            <!--- <cfset qryPublic = this.workflow.getPublicQuery(this.formData)> --->
            <cfset qryPublic = getItemQuery(qryConfig,false)>
            <cfset extraColumn = ArrayNew(1)>

            <!--- Donny's note: caculate no. of item for each category --->
            <cfoutput query="qryRecords">
                  <cfquery name="qryItemCount" dbtype="query">
                        SELECT DISTINCT intItemID
                        FROM       qryPublic
                        WHERE       intCategoryID = #Val(qryRecords.intCategoryID)#
                  </cfquery>
                  <cfset count = qryItemCount.recordcount>
                  <cfset ArrayAppend(extraColumn, count)>
                  <cfset this.category.setActive(qryRecords.intCategoryID, (count GT 0))>
            </cfoutput>
            
            <cfset QueryAddColumn(qryRecords, "numRecords", extraColumn)>
            <cfset this.catData.query = qryRecords>

            <cfif (isDefined("mode") and mode is "edit")>
                  <!--- disable delete if there are associated items to this category --->
                  <cfif isDefined("id") and Val(id)>
                        <cfset extraValue = selectFrom(qryRecords, "intItemID", id).numRecords>
                        <cfif (extraValue gt 0)>
                              <cfset this.catData.blnDelete = false>
                        </cfif>
                  </cfif>
                  <cfreturn this.display.getAddEdit(this.catData)>
            </cfif>

            <cfreturn this.display.getListing(this.catData,"txtTitle","Category","numRecords","Items",this.link)>
      </cffunction>
      <!--- /getCategoryBackEnd --->

      <!--- executes scheduled task --->
      <cffunction name="runTask" access="public" output="false">
            <cfargument name="itemid" type="numeric" required="true">
            <cfargument name="itemuid" type="string" required="true">
            <cfargument name="listIds" type="string" required="true">
                        
            <cffile action="delete" file="#this.qryCompany.txtPath##this.slash#tasks#this.slash#UListingNotification_#arguments.itemuid#.cfm">
            <cfschedule action="delete" task="#this.datasource#_#this.companyID#_UListingNotification_#arguments.itemuid#">            
            
            <cfset sendNotification(itemid,listIds)>
      </cffunction>
      
      <!--- schedule a task that will send the communication out --->      
      <cffunction name="scheduleTask" access="private" output="false">            
            <cfargument name="itemid" type="numeric" required="true">
            <cfset var startDateTime = ''>
            <cfset var listIds = ''>
            
            <cfquery name="qryItem" datasource="#this.datasource#" maxrows="1">
                  SELECT       TOP 1 intID, intUID, dtStart, dtEnd, blnLive
                  FROM       #this.formData.tablename#
                  WHERE       intID = <cfqueryparam value="#itemid#" cfsqltype="cf_sql_integer">
            </cfquery>      
            
            <cfquery name="qryNotificationLists" datasource="#this.datasource#" maxrows="1">
                  SELECT       TOP 1 intListID
                  FROM       #this.listData.tablename#
                  WHERE       intItemID = <cfqueryparam value="#itemID#" cfsqltype="cf_sql_integer">
                  AND            intCompanyID = <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer">
            </cfquery>
                                    
            <cfif qryItem.recordCount is 0 OR Val(qryItem.blnLive) is 0 OR qryNotificationLists.recordCount is 0>
                  <cfreturn "Schedule failed">
            </cfif>      
            <cfset startDateTime = qryItem.dtStart>
            <cfset listIds = ValueList(qryNotificationLists.intListID)>
            <cfif NOT isDate(startDateTime) OR DateDiff("n", startDateTime, now()) GTE 0>                  
                  <cfset sendNotification(itemid,listIds)>
                  <cfreturn "Task run">                  
            </cfif>
      
            <cfset itemuid = qryItem.intUID>
                                    
            <cfset taskcfm = '<cfset createObject("component","hb50.internal.ulisting").init(#this.CompanyID#,#this.webid#,0).runTask(#itemid#,"#itemuid#","#listIds#")>'>            
            
            <cfif not DirectoryExists('#this.qryCompany.txtPath##this.slash#tasks')>
                  <cfdirectory action="create" directory="#this.qryCompany.txtPath##this.slash#tasks" mode="775">
            </cfif>
            <cffile action="write" file="#this.qryCompany.txtPath##this.slash#tasks#this.slash#UListingNotification_#itemuid#.cfm" output="#taskcfm#" mode="775">
            <cfschedule action="update" task="#this.datasource#_#this.companyID#_UListingNotification_#itemuid#" operation="httprequest"
                              startDate="#DateFormat(startDateTime, 'mm/dd/yyyy')#" startTime="#TimeFormat(startDateTime, 'hh:mm tt')#" interval="Once"
                              url="#this.qryCompany.txtWeb#/tasks/UListingNotification_#itemuid#.cfm?requestTimeout=10000">
                        
            <cfreturn "Task scheduling OK">
      </cffunction>
      
      <cffunction name="sendNotification" access="private" returntype="any" output="false">
            <cfargument name="itemID" type="numeric" required="true">
            <cfargument name="listIds" type="string" required="true">
            
            <cfset var contactManager = getObject("hb50.plugins.generic.contactmanager",this.companyID,true)>
            <cfset var qryRecipients = contactManager.getRecipientsInLists(listIds)>
            <cfset var htmlBody = ''>
            <cfset var emailFooter = getEmailFooter()>
            <cfset var fromEmail = this.qryCompany.txtEmail>
            <cfset var toEmail = ''>
            <cfset var subject = "Update Notification">
            <cfset var qryItem = ''>
            <cfset var pageTitle = ''>
            <cfset var pageURL = ''>
            
            <cfif Len(Trim(listIds)) is 0>
                  <cfreturn 0 />
            </cfif>
                  
            <cfif qryRecipients.recordCount is 0>
                  <cfreturn 0 />
            </cfif>
                  
            <cfquery name="qryItem" datasource="#this.datasource#" maxrows="1">
                  SELECT      TOP 1 intItemID
                  FROM      #this.formData.tablename#
                  WHERE      intID = <cfqueryparam value="#val(arguments.itemID)#" cfsqltype="cf_sql_integer">
            </cfquery>
                  
            <cfset qryConfig = getConfigQuery()>
            
            <cfif Len(Trim(qryConfig.txtNotificationSubject))>
                  <cfset subject = qryConfig.txtNotificationSubject>
            </cfif>
            <cfif Len(Trim(qryConfig.txtNotificationFromEmail))>
                  <cfset fromEmail = qryConfig.txtNotificationFromEmail>
                  <cfif Len(Trim(qryConfig.txtNotificationFromName))>
                        <cfset fromEmail = '"#qryConfig.txtNotificationFromName#" <#fromEmail#>'>
                  </cfif>
            </cfif>            
                                    
            <cfset pageTitle = this.navigation.getCaption(this.webID)>
            <cfset pageURL = '#this.navigation.getURL(this.webID)#?i=#qryItem.intItemID#'>
            
            <cfsavecontent variable="htmlBody">
                  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
                  <html>
                  <head>
                  <title><cfoutput>#this.qryCompany.txtTitle# -  #subject#</cfoutput></title>
                  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                  <style>
                        body {font:12px arial;}
                        a {color:#000000;}                              
                  </style>
                  <cfoutput>
                  <title>#subject#</title>
                  <script src="SpryAssets/SpryCollapsiblePanel.js" type="text/javascript"></script>
                  <link href="SpryAssets/SpryCollapsiblePanel.css" rel="stylesheet" type="text/css">
                  </head>
                        
                  <body>
                  <div id="CollapsiblePanel2" class="CollapsiblePanel">
                    <div class="CollapsiblePanelTab" tabindex="0">Tab</div>
                    <div class="CollapsiblePanelContent">Content</div>
                </div>
                        <div id="CollapsiblePanel1" class="CollapsiblePanel">
                          <div class="CollapsiblePanelTab" tabindex="0">Tab</div>
                          <div class="CollapsiblePanelContent">Content</div>
                </div>                              
            #this.workflow.convertTokens(qryConfig.txtNotificationMessage)#<br/>
                        <a href="#pageURL#" target="_blank">#pageURL#</a><br/>
                        <p>#emailFooter#</p>
                      <script type="text/javascript">
<!--
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel1");
var CollapsiblePanel2 = new Spry.Widget.CollapsiblePanel("CollapsiblePanel2");
//-->
</script>
                  </body>
                  </html>
                  </cfoutput>
            </cfsavecontent>
                        
            <cfset communication = getObject("hb50.communication",this.companyID,true)>
                        
            <cfif Len(Trim(fromEmail))>                  
                  <cfloop query="qryRecipients">                        
                        <cfset toEmail = qryRecipients.txtEmail>
                        <cfif Len(Trim(toEmail))>
                              <cftry>
                              <cfset communication.sendTextHTML(toEmail,fromEmail,subject, htmlBody, "")>
                              <cfcatch></cfcatch>
                              </cftry>
                        </cfif>
                  </cfloop>                  
            </cfif>                        
      </cffunction>
      
      <cffunction name="getEmailFooter" access="private" returntype="string">
            <cfset emailFooter = '#this.qryCompany.txtTitle#<br/>Phone: #this.qryCompany.txtTelephone#<br/>Email: #this.qryCompany.txtEmail#'>
            <cftry>                              
                  <cfquery name="qryDisplaySettings" datasource="#this.datasource#" maxrows="1" cachedwithin="#this.queryCache#">
                        SELECT       TOP 1 intCompanyID, txtEmailFooter
                        FROM       tblDisplaySettings
                        WHERE       intCompanyID = #this.companyID#
                  </cfquery>
                  <cfset emailFooter = this.workflow.convertTokens(qryDisplaySettings.txtEmailFooter)>                              
                  <cfcatch></cfcatch>
            </cftry>
            
            <cfreturn emailFooter />
      </cffunction>
      
      
      <!--- returns hotbanana back end of the items tab --->
      <cffunction name="getItemBackEnd" access="private" returntype="string">
            <!--- <cfsetting showdebugoutput="yes"> --->            
            <cfset this.display.setActionMsg(this.workflow.processForm(this.formData))>            
            
            <cfif isDefined("FORM.intListIds") AND Len(Trim(FORM.intListIds))>
                  <cfquery name="qryItem" datasource="#this.datasource#" maxrows="1">                              
                        SELECT       TOP 1 intID, intUID, blnLive
                        FROM       #this.formData.tablename#
                        WHERE       intItemID = <cfqueryparam value="#Val(FORM.id)#" cfsqltype="cf_sql_integer">
                        ORDER BY dtAdded DESC
                  </cfquery>

                  <!--- notification list data --->
                  <cfif qryItem.recordCount AND isDefined("FORM.intListIds") AND Len(Trim(FORM.intListIds))>
                        <cfloop list="#FORM.intListIds#" index="idx">
                              <cfquery name="qryAddList" datasource="#this.datasource#">
                                    INSERT INTO #this.listData.tablename#
                                          (intItemID,intListID,intCompanyID)
                                    VALUES (
                                          <cfqueryparam value="#qryItem.intID#" cfsqltype="cf_sql_integer">,
                                          <cfqueryparam value="#idx#" cfsqltype="cf_sql_integer">,
                                          <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer">)
                              </cfquery>
                        </cfloop>
                  </cfif>
                  
                  <cfif FORM.button is Translate("Check in")>
                        <cfif isDefined("FORM.blnNotification")  AND Val(qryItem.blnLive)>                                    
                              <cfset scheduleTask(Val(qryItem.intID))>
                        </cfif>                              
                  <cfelse>                                                            
                        <cfif fileexists("#this.qryCompany.txtPath##this.slash#tasks#this.slash#UListingNotification_#qryItem.intUID#.cfm")>
                              <cffile action="delete" file="#this.qryCompany.txtPath##this.slash#tasks#this.slash#UListingNotification_#qryItem.intUID#.cfm">
                              <cfschedule action="delete" task="#this.datasource#_#this.companyID#_UListingNotification_#qryItem.intUID#">
                        </cfif>
                  </cfif>                        
            </cfif>
            
            <cfif isDefined("FORM.button") AND FORM.button is Translate("Approve") AND isDefined("FORM.id") AND Val(FORM.id)>
                  <cftrace text="U Listing: Approved items"/>
                  <cfquery name="qryApprovedItem" datasource="#this.datasource#" maxrows="1">
                        SELECT       TOP 1 blnNotification, intID, intUID
                        FROM       #this.formData.tablename#
                        WHERE       intItemID = <cfqueryparam value="#Val(FORM.id)#" cfsqltype="cf_sql_integer">
                        AND            blnLive = <cfqueryparam value="1" cfsqltype="cf_sql_bit">
                        ORDER BY dtAdded DESC
                  </cfquery>
                  <cfif qryApprovedItem.recordCount AND qryApprovedItem.blnNotification is 1>
                        <cfquery name="qryNotificationLists" datasource="#this.datasource#" maxrows="1">
                              SELECT       TOP 1 intListID
                              FROM       #this.listData.tablename#
                              WHERE       intItemID = <cfqueryparam value="#qryApprovedItem.intID#" cfsqltype="cf_sql_integer">
                              AND            intCompanyID = <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer">  
                        </cfquery>
                        <cfif qryNotificationLists.recordCount>
                              <cftrace text="U Listing: schedule notification task for approved item"/>
                              <cfset scheduleTask(qryApprovedItem.intID)>
                        <cfelse>                        
                              <cfif fileexists("#this.qryCompany.txtPath##this.slash#tasks#this.slash#UListingNotification_#qryApprovedItem.intUID#.cfm")>
                                    <cftrace text="U Listing: remove scheduled task for approved item"/>
                                    <cffile action="delete" file="#this.qryCompany.txtPath##this.slash#tasks#this.slash#UListingNotification_#qryApprovedItem.intUID#.cfm">
                                    <cfschedule action="delete" task="#this.datasource#_#this.companyID#_UListingNotification_#qryApprovedItem.intUID#">
                              </cfif>
                        </cfif>
                  </cfif>
            </cfif>
            
            <cfset this.formData.query = getQuery()>

            <!--- check if category should be active after every save --->
            <cfif isDefined("FORM.intCategoryID") AND Val(FORM.intCategoryID)>
                  <!--- <cfset qryRecords = this.workflow.getQuery(this.catData)> --->
                  <!--- <cfset qryPublic = this.workflow.getPublicQuery(this.formData)> --->
                  <cfset qryRecords = getCategoryQuery()>
                  <cfset qryPublic = getItemQuery(qryConfig,true)>
                  <cfoutput query="qryRecords">
                        <cfquery name="qryItemCount" dbtype="query">
                              SELECT DISTINCT intItemID
                              FROM       qryPublic
                              WHERE       intCategoryID = #Val(qryRecords.intCategoryID)#
                        </cfquery>
                        <cfset count = qryItemCount.recordcount>
                        <cfset this.category.setActive(qryRecords.intCategoryID, (count GT 0))>
                  </cfoutput>
            </cfif>
            
            <cfif isDefined("URL.id") AND Val(URL.id)>
                  <cfset FORM.id = URL.id>
            </cfif>
            
            <cfif (isSet("mode", "edit"))>
                  <cfif this.formData.notificationTabIndex GT 0>
                        <cfset this.contactManager = getObject("hb50.plugins.generic.contactmanager",this.companyID,true)>
                        <cftry>
                              <cfset qryLists = this.contactManager.getListQuery()>
                        <cfcatch><cfset qryLists = QueryNew("intID,txtTitle")></cfcatch>
                        </cftry>
                        
                        <cfset listingLists = "">
                        <cfif isDefined("FORM.id") and Val(FORM.id)>
                              <!--- version stuff --->
                              <cfquery name="qryVersion" datasource="#this.datasource#">
                                    SELECT       UL.intID, UL.blnNotification, UL.intItemID, UL.blnLive<!--- , tblItem.blnDeleted, tblItem.blnApproved --->
                                    FROM       #this.formData.tablename# AS UL
                                    LEFT JOIN tblItem ON tblItem.intID = UL.intItemID
                                    WHERE       UL.intItemID = <cfqueryparam value="#Val(FORM.id)#" cfsqltype="cf_sql_integer">
                                    ORDER BY UL.blnLive DESC, UL.dtAdded DESC
                              </cfquery>
                              <cfparam name="FORM.intVersionID" default="#qryVersion.intID#">
                              <!--- <cfquery name="qryVersion" dbtype="query">
                                    SELECT       *
                                    FROM       qryVersion
                                    ORDER BY blnLive DESC, dtAdded DESC
                              </cfquery> --->
                                                
                              <cfset qryListingItem = selectFrom(qryVersion, this.formData.varID, val(FORM.intVersionID))>
                              <cfquery name="qryListingLists" datasource="#this.datasource#">
                                    SELECT       intListID
                                    FROM       #this.listData.tablename#
                                    WHERE       intItemID = <cfqueryparam value="#Val(qryListingItem.intID)#" cfsqltype="cf_sql_integer">
                                    AND       intCompanyID = <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer">
                              </cfquery>
                              <cfset listingLists = ValueList(qryListingLists.intListID)>
                        </cfif>
                                                            
                        <cfsavecontent variable="notificationTab">
                              <cfoutput>
                              <script language="JavaScript" type="text/javascript">
                              function jsAddContactList() {
                                    if (document.frmAddEdit.intListIds.selectedIndex != 0) {
                                          return false;
                                    }
                                    jsPopup('addContactList','callback=jsUpdateListSelect');
                                    return false;                                    
                              }
                              function jsUpdateListSelect(listID, listTitle) {
                                    var size = document.frmAddEdit.intListIds.options.length;
                                    document.frmAddEdit.intListIds.options[size] = new Option(listTitle, listID);
                                    document.frmAddEdit.intListIds.selectedIndex = size;
                              }
                                                            
                              function jsViewRecipients() {
                                    if (document.frmAddEdit.intListIds.selectedIndex <= 0) {
                                          alert("Please select a list.");
                                          return;
                                    }
                                    var form = document.frmAddEdit;
                                    var tempAction = form.action;
                                    window.open('', 'recipientsWindow', 'height=450,width=350,innerHeight=200,innerWidth=250,location=no,menubar=no,resizable=yes,titlebar=yes,toolbar=no,scrollbars=yes');
                                    form.action = '#this.qryCompany.txtHBWeb#/popup/viewRecipientsInLists.cfm';
                                    form.target = 'recipientsWindow';
                                    form.submit();
                                    form.action = tempAction;
                                    form.target = '';
                              }
                              
                              function jsExtraValidate() {
                                    if (document.frmAddEdit.blnNotification.checked) {
                                          if (!confirm('Notification will be sent, continue?')) {
                                                return false;
                                          }                                          
                                    }
                                    return true;
                              }
                              var submitted = false;
                              function jsPreSubmit() {                                          
                                    var valid = jsValidate() && jsExtraValidate();
                                    if (valid) {
                                          if (submitted) return false;
                                          submitted = true;
                                          document.body.onbeforeunload = null;
                                    }
                                    return valid;
                              }
                              document.frmAddEdit.onsubmit = jsPreSubmit;
                              </script>      
                              <div id="blnNotification"></div>                        
                              <div style="padding:10px;">
                                    <fieldset>
                                    <legend><input type="checkbox" name="blnNotification" <cfif isDefined("qryListingItem") AND qryListingItem.blnNotification is 1>checked</cfif>> Send Notification </legend>
                                    <table cellpadding="5">
                                          <tr>
                                                <td class="formCaption">List: <br />
                                                      <select name="intListIds" class="formTextBox" style="width:235px;height:150px;" multiple="true" onchange="jsAddContactList();">
                                                            <option value="-1">Add a new list</option>
                                                            <cfloop query="qryLists">
                                                                  <option value="#qryLists.intID#" <cfif ListFind(listingLists,qryLists.intID)>selected</cfif>>#qryLists.txtTitle#</option>
                                                            </cfloop>
                                                      </select><br />
                                                      <input type="button" onclick="jsViewRecipients();" class="buttons" value="View Recipients" style="width:110px;">                                                      
                                                </td>
                                          </tr>
                                    </table>
                                    </fieldset>
                              </div>
                              </cfoutput>
                        </cfsavecontent>      
                        <cfset this.formData.tabs[this.formData.notificationTabIndex].body = notificationTab>
                  </cfif>
                  
                  <cfreturn this.display.getAddEdit(this.formData) />
            </cfif>
            
            <!--- if nothing else has been returned, return the generic listing --->
            <cfreturn this.display.getListing(this.formData,"txtTitle","Item","dtAdded","Saved",this.link) />
      </cffunction>
      <!--- /getItemBackEnd --->

      <!--- returns hotbanana back end of the config tab --->
      <cffunction name="getConfigBackEnd" access="private" returntype="string">
            <cfif isDefined("FORM.button")>
                  <cfset FORM.intWebID = this.webid>
                  <cfset FORM.intCompanyID = this.companyID>
                              
                  <!--- let workflow take care of the button actions --->
                  <cfset this.display.setActionMsg(this.workflow.processForm(this.configData))>
                  
                  <!--- role stuff --->
                  <!--- <cfset qryOldRoles = getRoleQuery()>
                  <cfset oldRoles = ValueList(qryOldRoles.intRoleID)> --->
                  <cfset oldRoles = getListRoles()>
                  <cfset newRoles = ''>
                  <cfif isDefined("FORM.intRoleIDs") AND Len(Trim(FORM.intRoleIDs))>
                        <cfset newRoles = Trim(FORM.intRoleIDs)>
                        
                        <cfloop list="#newRoles#" index="roleID">
                              <cfset listIndex = ListFind(oldRoles,roleID)>
                              <cftrace text="newRoles = #newRoles# listIndex = #listIndex#"/>
                              
                              <!--- if new role in in old list --->
                              <cfif listIndex GT 0>
                                    <!--- remove the role from the old list --->
                                    <cfset oldRoles = ListDeleteAt(oldRoles,listIndex)>
                              <cfelse>
                                    <cftrace text="insert role"/>
                                    <cfquery name="qryAddRole" datasource="#this.datasource#">
                                          INSERT INTO #this.roleData.tablename#
                                                (intWebID, intCompanyID, intRoleID)
                                          VALUES (
                                                <cfqueryparam value="#this.webID#" cfsqltype="cf_sql_integer">,
                                                <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer">,
                                                <cfqueryparam value="#roleID#" cfsqltype="cf_sql_integer">)                                                
                                    </cfquery>
                              </cfif>
                        </cfloop>
                        <!--- delete an unmatched old roles from the db --->
                        <cfif Len(Trim(oldRoles))>
                              <cfquery name="qryDeleteRoles" datasource="#this.datasource#">
                                    DELETE FROM
                                          #this.roleData.tablename#
                                    WHERE       intWebID = <cfqueryparam value="#this.webID#" cfsqltype="cf_sql_integer">
                                    AND       intCompanyID= <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer">
                                    AND       intRoleID IN (<cfqueryparam value="#oldRoles#" list="true" cfsqltype="cf_sql_integer">)
                              </cfquery>
                        </cfif>
                  </cfif>
                              
                  <cfobjectcache action="clear" />
                  <cfcache action="flush">
            </cfif>
            
            <cfset this.workflow.verifyColumns(this.configData)>
            <cfset qryConfig = getConfigQuery()>
            <cfset this.configData.query = qryConfig>
            
            <cfsavecontent variable="tabTwo">
                  <script language="JavaScript" type="text/javascript">
                        function jsPositiveNumber(theItem,msg,tab) {
                              if (!theItem.value) {
                                    jsTabSwitch(tab);
                                    alert(msg);
                                    return false;
                              }
                              if (isNaN(theItem.value) || Number(theItem.value) <= 0) {
                                    jsTabSwitch(tab);
                                    alert(msg);
                                    return false;
                              }
                              return true;
                        }
                        function jsExtraValidate() {                              
                              var form = document.frmAddEdit;                              
                              if (!form.blnImage.checked && (form.blnItemListingImage.checked || form.blnItemDetailImage.checked)) {
                                    form.blnItemListingImage.checked = false;
                                    form.blnItemDetailImage.checked = false;
                              }
                              if (form.blnCategoryListing.checked) {                                    
                                    if (form.blnCategoryPagination.checked && !jsPositiveNumber(form.intCategoryDisplayItems,'Number of items to diplay is not valid.',2)) {
                                          return false;
                                    }                                    
                                    if (form.blnCategoryImage.checked && 
                                                (!jsPositiveNumber(form.intCategoryImageWidth,'Image Width is not valid.',2) || !jsPositiveNumber(form.intCategoryImageHeight,'Image Height is not valid.',2) ) ) {
                                          return false;
                                    }
                              }
                              if (form.blnItemListingDescription.checked && !jsPositiveNumber(form.intItemListingDescriptionLength,'Description length is not valid.',3)) {
                                    return false;
                              }
                              if (form.blnItemListingPagination.checked && !jsPositiveNumber(form.intItemListingDisplayItems,'Number of items to display is not valid.',3)) {
                                    return false;
                              }
                              if (form.blnItemListingImage.checked && 
                                    (!jsPositiveNumber(form.intItemListingImageWidth,'Image width is not valid.',3) || !jsPositiveNumber(form.intItemListingImageHeight, 'Image height is not valid.',3) ) ) {
                                    return false;
                              }
                              if (form.blnItemDetailResource.checked && !form.txtItemDetailResourceCaption.value) {
                                    jsTabSwitch(4);
                                    alert('Related information caption is required.');
                                    return false;
                              }
                              if (form.blnItemDetailImage.checked && 
                                           (!jsPositiveNumber(form.intItemDetailImageWidth, 'Image width is not valid.', 4) || !jsPositiveNumber(form.intItemDetailImageHeight, 'Image height is not valid.',4)) ) {
                                    return false;
                              }
                              if (form.blnNotification.checked) {
                                    if (!form.txtNotificationFromEmail.value) {
                                          jsTabSwitch(5);
                                          alert('From Email is required.');
                                          return false;
                                    }
                                    if (!form.txtNotificationSubject.value) {
                                          jsTabSwitch(5);
                                          alert('Notification Subject is required.');
                                          return false;
                                    }
                              }
                              return true;
                        }
                        
                        var submitted = false;
                        function jsPreSubmit() {                                          
                              var valid = jsExtraValidate();
                              if (valid) {
                                    if (submitted) return false;
                                    submitted = true;
                                    document.body.onbeforeunload = null;
                              }
                              return valid;
                        }
                        document.frmAddEdit.onsubmit = jsPreSubmit;
                  </script>
                  
                  <cfoutput>
                        <div id="blnCategoryListing"></div>
                        <div id="blnCategoryPageContent"></div>
                        <div id="blnCategoryDescription"></div>
                        <div id="blnCategorySearch"></div>
                        <div id="blnCategoryPagination"></div>
                        <div id="blnCategoryPagination"></div>
                        <div id="blnCategoryImage"></div>
                        <div id="intCategoryDisplayItems"></div>                  
                        <div id="intCategoryImageWidth"></div>
                        <div id="intCategoryImageHeight"></div>
                        <div id="intCategoryImageAlign"></div>
                        <div id="blnCategoryImageWrap"></div>
                        <div id="intCategoryLayoutType"></div>
                        
                        <div style="padding:10px;" class="formCaption">
                              <fieldset>
                                    <legend><input type="checkBox" name="blnCategoryListing" <cfif qryConfig.blnCategoryListing is 1>checked</cfif>> Category Listing &nbsp; </legend>
                                    <table width="100%" cellspacing="0" cellpadding="7" border="0">
                                          <tr>
                                                <td class="formCaption">
                                                      &nbsp;<input type="checkbox" name="blnCategoryPageContent" <cfif qryConfig.blnCategoryPageContent is 1>checked</cfif>> Show Page Content &nbsp;&nbsp;&nbsp;
                                                      <input type="checkbox" name="blnCategoryDescription" <cfif qryConfig.blnCategoryDescription is 1>checked</cfif>> Show Description &nbsp;&nbsp;&nbsp;                                                
                                                      <input type="checkbox" name="blnCategorySearch" <cfif qryConfig.blnCategorySearch is 1>checked</cfif>> Search Form
                                                </td>
                                          </tr>
                                          <tr>
                                                <td>
                                                      <fieldset>
                                                            <legend><input type="checkbox" name="blnCategoryPagination" <cfif qryConfig.blnCategoryPagination is 1>checked</cfif>> Pagination</legend>
                                                            <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                                  <tr>
                                                                        <td class="formCaption"><input type="text" name="intCategoryDisplayItems" <cfif qryConfig.recordCount is 0>value="#this.MAX_ITEMS#"<cfelse>value="#qryConfig.intCategoryDisplayItems#"</cfif> class="formTextBox" style="width:70px;"> items to display</td>
                                                                  </tr>
                                                            </table>                                          
                                                      </fieldset>
                                                </td>                                                
                                          </tr>
                                          <tr>
                                                <td>
                                                      <fieldset>
                                                            <legend><input type="checkbox" name="blnCategoryImage" <cfif qryConfig.blnCategoryImage is 1>checked</cfif>> Category Image</legend>
                                                            <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                                  <tr>
                                                                        <td class="formCaption">
                                                                              Width: <input type="text" name="intCategoryImageWidth" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value="#qryConfig.intCategoryImageWidth#"</cfif> style="width:70px;" class="formTextBox"> &nbsp;&nbsp;&nbsp;
                                                                              Height: <input type="text" name="intCategoryImageHeight" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value="#qryConfig.intCategoryImageHeight#"</cfif> style="width:70px;" class="formTextBox">
                                                                        </td>
                                                                        <td class="formCaption">
                                                                              <input type="checkbox" name="blnCategoryImageWrap" <cfif qryConfig.blnCategoryImageWrap is 1>checked</cfif>> Wrap Text
                                                                        </td>
                                                                  </tr>
                                                                  <tr>
                                                                        <td class="formCaption" colspan="2">
                                                                              Align: <input type="radio" name="intCategoryImageAlign" value="#this.IMAGE_ALIGN.LEFT#" <cfif qryConfig.intCategoryImageAlign is this.IMAGE_ALIGN.LEFT>checked</cfif>> Left
                                                                              &nbsp; <input type="radio" name="intCategoryImageAlign" value="#this.IMAGE_ALIGN.RIGHT#" <cfif qryConfig.intCategoryImageAlign is this.IMAGE_ALIGN.RIGHT OR qryConfig.recordCount is 0>checked</cfif>> Right
                                                                              &nbsp; <input type="radio" name="intCategoryImageAlign" value="#this.IMAGE_ALIGN.INLINE#" <cfif qryConfig.intCategoryImageAlign is this.IMAGE_ALIGN.INLINE>checked</cfif>> Inline                                                                        
                                                                        </td>
                                                                  </tr>
                                                            </table>
                                                      </fieldset>
                                                </td>
                                          </tr>
                                          <tr>
                                                <td>
                                                      <fieldset>
                                                            <legend>Layout</legend>
                                                            <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                                  <tr>
                                                                        <td class="formCaption">
                                                                              <input type="radio" name="intCategoryLayoutType" value="#this.COLUMN_LAYOUT.SINGLE#" <cfif qryConfig.intCategoryLayoutType is this.COLUMN_LAYOUT.SINGLE OR qryConfig.recordCount is 0>checked</cfif>> Single Column
                                                                              &nbsp;&nbsp;&nbsp; <input type="radio" name="intCategoryLayoutType" value="#this.COLUMN_LAYOUT.DOUBLE#" <cfif qryConfig.intCategoryLayoutType is this.COLUMN_LAYOUT.DOUBLE>checked</cfif>> Double Column
                                                                        </td>
                                                                  </tr>
                                                            </table>
                                                      </fieldset>
                                                </td>
                                          </tr>
                                    </table>
                              </fieldset>
                        </div>
                  </cfoutput>      
            </cfsavecontent>
            <cfset this.configData.tabs[2].body = tabTwo>
            
            <cfsavecontent variable="tabThree">
                  <cfoutput>
                  <div id="blnItemListingPageContent"></div>
                  <div id="blnItemListingTitle"></div>
                  <div id="intItemListingDateLayoutType"></div>
                  <div id="blnItemListingDescription"></div>
                  <div id="intItemListingDescriptionType"></div>
                  <div id="intItemListingDescriptionLength"></div>
                  <div id="blnItemListingSearch"></div>
                  <div id="blnItemListingAnchor"></div>
                  <div id="blnItemListingImage"></div>
                  <div id="intItemListingImageAlign"></div>
                  <div id="intItemListingLayoutType"></div>
                  <div id="blnItemListingImageWrap"></div>
                  <div id="intItemListingImageWidth"></div>
                  <div id="intItemListingImageHeight"></div>
                  <div id="blnItemListingPagination"></div>
                  <div id="intItemListingDisplayItems"></div>
                  <div id="txtItemListingDescriptionAction"></div>
                  
                  <div style="padding:10px;" class="formCaption">
                        <fieldset>
                              <table width="100%" cellspacing="0" cellpadding="7" border="0">
                                    <tr>
                                          <td class="formCaption">
                                                &nbsp;<input type="checkbox" name="blnItemListingPageContent" <cfif qryConfig.blnItemListingPageContent is 1>checked</cfif>> Show Page Content &nbsp;&nbsp;&nbsp;
                                                <input type="checkbox" name="blnItemListingSearch" <cfif qryConfig.blnItemListingSearch is 1>checked</cfif>> Search Form &nbsp;&nbsp;&nbsp;
                                                <input type="checkbox" name="blnItemListingAnchor" <cfif qryConfig.blnItemListingAnchor is 1>checked</cfif>> Item Anchor &nbsp;&nbsp;&nbsp;
                                                <input type="checkbox" name="blnItemListingTitle" <cfif qryConfig.recordCount is 0 OR qryConfig.blnItemListingTitle is 1>checked</cfif>> Show Title
                                          </td>
                                    </tr>
                                    <tr>
                                          <td>
                                                <fieldset>
                                                      <legend>Date Layout</legend>
                                                      <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                            <tr>
                                                                  <td class="formCaption">
                                                                        <input type="radio" name="intItemListingDateLayoutType" value="#this.DATE_LAYOUT_TYPES.TWOLINES#" <cfif qryConfig.intItemListingDateLayoutType is this.DATE_LAYOUT_TYPES.TWOLINES OR qryConfig.recordCount is 0>checked</cfif>> Title Date on different lines &nbsp;&nbsp;&nbsp;
                                                                        <input type="radio" name="intItemListingDateLayoutType" value="#this.DATE_LAYOUT_TYPES.ONELINE#" <cfif qryConfig.intItemListingDateLayoutType is this.DATE_LAYOUT_TYPES.ONELINE>checked</cfif>> Date - Title on one line                                                                         
                                                                  </td>
                                                            </tr>
                                                      </table>
                                                </fieldset>
                                          </td>
                                    </tr>
                                    <tr>
                                          <td>
                                                <fieldset>
                                                      <legend><input type="checkbox" name="blnItemListingDescription" <cfif qryConfig.blnItemListingDescription is 1>checked</cfif>> Description</legend>
                                                      <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                            <tr>
                                                                  <td class="formCaption">Display: </td>
                                                                  <td class="formCaption" colspan="3">
                                                                        <input type="radio" name="intItemListingDescriptionType" value="#this.DISPLAY_TYPES.FULL#" <cfif qryConfig.intItemListingDescriptionType is this.DISPLAY_TYPES.FULL>checked</cfif>> Full
                                                                  </td>
                                                            </tr>
                                                            <tr>
                                                                  <td class="formCaption">&nbsp;</td>
                                                                  <td class="formCaption" colspan="3">                                                                  
                                                                        <input type="radio" name="intItemListingDescriptionType" value="#this.DISPLAY_TYPES.MEMO#" <cfif qryConfig.intItemListingDescriptionType is this.DISPLAY_TYPES.MEMO>checked</cfif>> Abstract
                                                                  </td>
                                                            </tr>
                                                                  <td>&nbsp;</td>                                                                        
                                                                  <td class="formCaption">
                                                                        <input type="radio" name="intItemListingDescriptionType" value="#this.DISPLAY_TYPES.TRIMMED#" <cfif qryConfig.intItemListingDescriptionType is this.DISPLAY_TYPES.TRIMMED OR qryConfig.recordCount is 0>checked</cfif>> Trimmed
                                                                  </td>
                                                                  <td class="formCaption">
                                                                        Length: <input type="text" name="intItemListingDescriptionLength" <cfif qryConfig.recordCount is 0>value="250"<cfelse>value="#qryConfig.intItemListingDescriptionLength#"</cfif> class="formTextBox" style="width:70px;">
                                                                  </td>
                                                                  <td class="formCaption">
                                                                        Action: <input type="text" name="txtItemListingDescriptionAction" <cfif qryConfig.recordCount is 0>value="more..."<cfelse>value="#qryConfig.txtItemListingDescriptionAction#"</cfif> class="formTextBox" style="width:150px;">
                                                                  </td>
                                                            </tr>
                                                      </table>                                          
                                                </fieldset>
                                          </td>                                                
                                    </tr>
                                    <tr>
                                          <td>
                                                <fieldset>
                                                      <legend><input type="checkbox" name="blnItemListingPagination" <cfif qryConfig.blnItemListingPagination is 1>checked</cfif>> Pagination</legend>
                                                      <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                            <tr>
                                                                  <td class="formCaption"><input type="text" name="intItemListingDisplayItems" <cfif qryConfig.recordCount is 0>value="#this.MAX_ITEMS#"<cfelse>value="#qryConfig.intItemListingDisplayItems#"</cfif> class="formTextBox" style="width:70px;"> items to display</td>
                                                            </tr>
                                                      </table>                                          
                                                </fieldset>
                                          </td>                                                
                                    </tr>
                                    <tr>
                                          <td>
                                                <fieldset>
                                                      <legend><input type="checkbox" name="blnItemListingImage" <cfif qryConfig.blnItemListingImage is 1>checked</cfif>> Item Image</legend>
                                                      <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                            <tr>
                                                                  <td class="formCaption">
                                                                        Width: <input type="text" name="intItemListingImageWidth" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value="#qryConfig.intItemListingImageWidth#"</cfif> style="width:70px;" class="formTextBox"> &nbsp;&nbsp;&nbsp;
                                                                        Height: <input type="text" name="intItemListingImageHeight" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value="#qryConfig.intItemListingImageHeight#"</cfif> style="width:70px;" class="formTextBox">
                                                                  </td>
                                                                  <td class="formCaption">
                                                                        <input type="checkbox" name="blnItemListingImageWrap" <cfif qryConfig.blnItemListingImageWrap is 1>checked</cfif>> Wrap Text
                                                                  </td>
                                                            </tr>
                                                            <tr>
                                                                  <td class="formCaption" colspan="2">
                                                                        Align <input type="radio" name="intItemListingImageAlign" value="#this.IMAGE_ALIGN.LEFT#" <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.LEFT>checked</cfif>> Left
                                                                        &nbsp; <input type="radio" name="intItemListingImageAlign" value="#this.IMAGE_ALIGN.RIGHT#" <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.RIGHT OR qryConfig.recordCount is 0>checked</cfif>> Right
                                                                        &nbsp; <input type="radio" name="intItemListingImageAlign" value="#this.IMAGE_ALIGN.INLINE#" <cfif qryConfig.intItemListingImageAlign is this.IMAGE_ALIGN.INLINE>checked</cfif>> Inline
                                                                  </td>
                                                            </tr>
                                                      </table>
                                                </fieldset>
                                          </td>
                                    </tr>
                                    <tr>
                                          <td>
                                                <fieldset>
                                                      <legend>Layout</legend>
                                                      <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                            <tr>
                                                                  <td class="formCaption">
                                                                        <input type="radio" name="intItemListingLayoutType" value="#this.COLUMN_LAYOUT.SINGLE#" <cfif qryConfig.intItemListingLayoutType is this.COLUMN_LAYOUT.SINGLE OR qryConfig.recordCount is 0>checked</cfif>> Single Column
                                                                        &nbsp;&nbsp;&nbsp; <input type="radio" name="intItemListingLayoutType" value="#this.COLUMN_LAYOUT.DOUBLE#" <cfif qryConfig.intItemListingLayoutType is this.COLUMN_LAYOUT.DOUBLE>checked</cfif>> Double Column
                                                                  </td>
                                                            </tr>
                                                      </table>
                                                </fieldset>
                                          </td>
                                    </tr>
                              </table>
                        </fieldset>
                  </div>                  
                  </cfoutput>      
            </cfsavecontent>
            <cfset this.configData.tabs[3].body = tabThree>
            
            <cfsavecontent variable="tabFour">
                  <cfoutput>
                        <div id="blnItemDetail"></div>
                        <div id="blnItemDetailPageContent"></div>
                        <div id="blnItemDetailResource"></div>
                        <div id="txtItemDetailResourceCaption"></div>
                        <div id="blnItemDetailImage"></div>
                        <div id="intItemDetailImageWidth"></div>
                        <div id="intItemDetailImageHeight"></div>
                        <div id="intItemDetailImageAlign"></div>
                        
                        <div style="padding:10px;" class="formCaption">
                              <fieldset>
                                    <legend><input type="checkBox" name="blnItemDetail" <cfif qryConfig.blnItemDetail is 1>checked</cfif>> Item Detail Page</legend>
                                    <table width="100%" cellspacing="0" cellpadding="7" border="0">
                                          <tr>
                                                <td class="formCaption">
                                                      &nbsp;<input type="checkbox" name="blnItemDetailPageContent" <cfif qryConfig.blnItemDetailPageContent is 1>checked</cfif>> Show Page Content                                                
                                                </td>
                                          </tr>
                                          <tr>
                                                <td>
                                                      <fieldset>
                                                            <legend><input type="checkbox" name="blnItemDetailResource" <cfif qryConfig.blnItemDetailResource is 1>checked</cfif>> Related Information</legend>
                                                            <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                                  <tr>
                                                                        <td class="formCaption">Caption: <input type="text" name="txtItemDetailResourceCaption" <cfif qryConfig.recordCount is 0>value="Related Information"<cfelse>value="#qryConfig.txtItemDetailResourceCaption#"</cfif> class="formTextBox" style="width:235px;"></td>
                                                                  </tr>
                                                            </table>                                          
                                                      </fieldset>
                                                </td>                                                
                                          </tr>
                                          <tr>
                                                <td>
                                                      <fieldset>
                                                            <legend><input type="checkbox" name="blnItemDetailImage" <cfif qryConfig.blnItemDetailImage is 1>checked</cfif>> Item Image</legend>
                                                            <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                                  <tr>
                                                                        <td class="formCaption">
                                                                              Width: <input type="text" name="intItemDetailImageWidth" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value="#qryConfig.intItemDetailImageWidth#"</cfif> style="width:70px;" class="formTextBox"> &nbsp;&nbsp;&nbsp;
                                                                              Height: <input type="text" name="intItemDetailImageHeight" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value="#qryConfig.intItemDetailImageHeight#"</cfif> style="width:70px;" class="formTextBox">
                                                                        </td>
                                                                        <td class="formCaption">
                                                                              Align &nbsp;&nbsp;&nbsp; <input type="radio" name="intItemDetailImageAlign" value="#this.IMAGE_ALIGN.LEFT#" <cfif qryConfig.intItemDetailImageAlign is this.IMAGE_ALIGN.LEFT>checked</cfif>> Left
                                                                              &nbsp;&nbsp;&nbsp; <input type="radio" name="intItemDetailImageAlign" value="#this.IMAGE_ALIGN.RIGHT#" <cfif qryConfig.intItemDetailImageAlign is this.IMAGE_ALIGN.RIGHT OR qryConfig.recordCount is 0>checked</cfif>> Right
                                                                              &nbsp;&nbsp;&nbsp; <input type="radio" name="intItemDetailImageAlign" value="#this.IMAGE_ALIGN.INLINE#" <cfif qryConfig.intItemDetailImageAlign is this.IMAGE_ALIGN.INLINE>checked</cfif>> Inline
                                                                        </td>
                                                                  </tr>
                                                            </table>
                                                      </fieldset>
                                                </td>
                                          </tr>
                                          <tr>
                                                <td>&nbsp;</td>
                                          </tr>
                                    </table>
                              </fieldset>
                        </div>                  
                  </cfoutput>      
            </cfsavecontent>
            <cfset this.configData.tabs[4].body = tabFour>
            
            <cfsavecontent variable="tabFive">
                  <cfoutput>
                        <div id="blnNotification"></div>
                        <div style="padding:10px;" class="formCaption">
                              <fieldset>
                                    <legend><input type="checkBox" name="blnNotification" <cfif qryConfig.blnNotification is 1>checked</cfif>> Send Notification</legend>
                                    <table width="100%" cellspacing="0" cellpadding="7" border="0">
                                          <tr>
                                                <td class="formCaption">From Email: <span class="txtRequired">*</span><br />
                                                      <input type="text" name="txtNotificationFromEmail" value="#qryConfig.txtNotificationFromEmail#" style="width:225px;">
                                                </td>
                                                <td class="formCaption">From Name:<br />
                                                      <input type="text" name="txtNotificationFromName" value="#qryConfig.txtNotificationFromName#" style="width:225px;">
                                                </td>
                                          </tr>
                                          <tr>
                                                <td class="formCaption">Notification Subject: <span class="txtRequired">*</span><br />
                                                      <input type="text" name="txtNotificationSubject" value="#qryConfig.txtNotificationSubject#" style="width:225px;">
                                                </td>
                                                <td>&nbsp;</td>
                                          </tr>
                                    </table>
                              </fieldset>
                        </div>      
                  </cfoutput>            
            </cfsavecontent>
            <cfset this.configData.tabs[5].body = tabFive>
            
            <!--- extranet role stuff --->
            <cfset this.extranet = getObject("hb50.extranet", this.companyID,true)>
            <cfset qryRoles = this.extranet.getRoleQuery()>
            
            <cfset selectedRoles = getListRoles()>
            
            <cfsavecontent variable="tabSeven">
                  <cfoutput>
                  <div id="blnSecurityEnabled"></div>
                  <div style="padding:10px;" class="formCaption">
                        <fieldset>
                              <legend><input type="checkBox" name="blnSecurityEnabled" <cfif qryConfig.blnSecurityEnabled is 1>checked</cfif>> Enable</legend>
                              <table width="100%" cellspacing="0" cellpadding="7" border="0">
                                    <tr>
                                          <td class="formCaption">Access Role(s):<br />
                                                <select name="intRoleIDs" style="width:235px;height:120px;" multiple="true" class="formTextBox">
                                                      <cfloop query="qryRoles">
                                                            <option value="#qryRoles.intRoleID#" <cfif ListFind(selectedRoles, qryRoles.intRoleID)>selected</cfif>>#qryRoles.txtTitle#</option>
                                                      </cfloop>
                                                </select>
                                          </td>
                                    </tr>
                              </table>
                        </fieldset>
                  </div>      
                  </cfoutput>
            </cfsavecontent>
            <cfset this.configData.tabs[7].body = tabSeven>
                        
            <cfif qryConfig.recordCount>
                  <cfset URL.id = qryConfig.intID>
            </cfif>
            <cfsavecontent variable="jsHack">
                  <script>
                  document.getElementById('innerTab1').style.overflow ='auto';
                  document.getElementById('innerTab2').style.overflow ='auto';
                  document.getElementById('innerTab3').style.overflow ='auto';
                  document.getElementById('innerTab4').style.overflow ='auto';
                  </script>
            </cfsavecontent>
            
            <cfreturn this.display.getAddEdit(this.configData) & jsHack>
      </cffunction>
      <!--- /getConfigBackEnd --->
            
      <cffunction name="install" access="public" returntype="struct">
            <cfset var returnStruct = StructNew()>
            
            <cfif isDefined("this.formData")>
                  <cfset this.workflow.verifyColumns(this.formData)>
                  <cfif StructKeyExists(this.formData, 'tablename')>
                        <cfset returnStruct.itemTable = this.formData.tablename>
                  </cfif>
            </cfif>

            <cfif isDefined("this.catData")>
                  <cfset this.workflow.verifyColumns(this.catData)>
                  <cfif StructKeyExists(this.catData, 'tablename')>
                        <cfset returnStruct.categoryTable = this.catData.tablename>
                  </cfif>
            </cfif>
                        
            <cfset this.workflow.verifyColumns(this.configData)>
            <cfset this.workflow.verifyColumns(this.listData)>
            <cfset this.workflow.verifyColumns(this.roleData)>
            
            <cfreturn returnStruct>
      </cffunction>

      <!--- Donny: needed by "hb50\popups\rte\insertlink.cfc" --->
      <cffunction name="getPublicQuery" access="public" returntype="query">      
            <cfif (this.datatype is this.DATATYPES.CATEGORY)>
                  <cfreturn this.workflow.getPublicQuery(this.catData) />
            <cfelse>
                  <cfreturn this.workflow.getPublicQuery(this.formData) />
            </cfif>
      </cffunction>
      
      <!--- returns the formatting of a single item in html, for the public side (or preview).
              scope can be any struct containing all the variables (form, query, etc.)
       --->      
      <cffunction name="getItemDisplay" access="public" returntype="string">
            <cfargument name="scope" required="true" type="any">
            
            <cfset var qryConfig = getConfigQuery()>
            
            <cfsavecontent variable="output">
                  <cfoutput>
                        <div id="hbdetmod">
                        <h5>#scope.txtTitle#<cfif scope.blnPrivate> #this.PRIVATE_IMAGE#</cfif></h5>
                              <cfset infoList = ''>                                                                                                
                              <cfif qryConfig.blnDate is 1 AND isDefined("scope.dtDate") AND isDate(scope.dtDate)><cfset infoList = infoList & '<li>#DateFormat(scope.dtDate, 'mmmm dd, yyyy')#</li>'></cfif>
                              <cfif qryConfig.blnAddress is 1>
                                    <cfset addressLine = ''>
                                    <cfif  isDefined("scope.txtAddress")><cfset addressLine = addressLine & '#scope.txtAddress#'></cfif>
                                    <cfif isDefined("scope.txtCity") AND Len(Trim(scope.txtCity))><cfset addressLine = addressLine & ' #scope.txtCity#,'></cfif>
                                    <cfif isDefined("scope.txtProvince") AND Len(Trim(scope.txtProvince))><cfset addressLine = addressLine & ' #scope.txtProvince#,'></cfif>
                                    <cfif isDefined("scope.txtPostalCode") AND Len(Trim(scope.txtPostalCode))><cfset addressLine = addressLine & ' #scope.txtPostalCode#'></cfif>
                                    <cfif isDefined("scope.txtCountry")><cfset addressLine = addressLine & ' #scope.txtCountry#'></cfif>
                                    <cfif Len(Trim(addressLine))><cfset infoList = infoList & '<li>#addressLine#</li>'></cfif>
                              </cfif>
                              <cfif qryConfig.blnPhone is 1 and isDefined("scope.txtPhone") AND Len(Trim(scope.txtPhone))><cfset infoList = infoList & '<li>Phone: #scope.txtPhone#</li>'></cfif>
                              <cfif qryConfig.blnFax is 1 and isDefined("scope.txtFax") AND Len(Trim(scope.txtFax))><cfset infoList = infoList & '<li>Fax: #scope.txtFax#</li>'></cfif>
                              <cfif qryConfig.blnPhone is 1 and isDefined("scope.txtTollFree") AND Len(Trim(scope.txtTollFree))><cfset infoList = infoList & '<li>Toll-Free: #scope.txtTollFree#</li>'></cfif>
                              <cfif qryConfig.blnEmail is 1 and isDefined("scope.txtEmail") AND Len(Trim(scope.txtEmail))><cfset infoList = infoList & '<li>Email: <a href="mailto:#scope.txtEmail#">#scope.txtEmail#</a></li>'></cfif>
                              <cfif qryConfig.blnLink is 1 and isDefined("scope.txtLink") AND Len(Trim(scope.txtLink))>
                                    <cfif REFindNoCase("http[s]://",scope.txtLink)>
                                          <cfset txtItemLink = scope.txtLink>
                                    <cfelse>
                                          <cfset txtItemLink = "http://#scope.txtLink#">
                                    </cfif>
                                    <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#scope.txtLink#</a></li>'>
                              </cfif>
                              <cfif Len(Trim(infoList))>
                                    <ul>
                                          #infoList#                                                      
                                    </ul>
                              </cfif>
                              <cfif qryConfig.blnImage is 1 and qryConfig.blnItemDetailImage is 1 and Val(scope.intImageID)><img src="#this.media.getURL(scope.intImageID,Val(qryConfig.intCategoryImageWidth),Val(qryConfig.intCategoryImageHeight))#"  border="0" <cfif qryConfig.intItemDetailImageAlign is this.IMAGE_ALIGN.LEFT>class="hbdetlft"<cfelseif qryConfig.intItemDetailImageAlign is this.IMAGE_ALIGN.RIGHT>class="hbdetrht"<cfelse>class="hbdetinl"</cfif> /></cfif>
                        <p>#this.workflow.convertTokens(scope.txtDescription,false,this.webid)#</p>                              
                              <!---  <!--- not support yet --->
                              <cfif qryConfig.blnResource is 1>
                                    <cfset addlResources = this.media.getPreviewAdditionalResources(scope.resources))>                                           
                                    <cfif ArrayLen(addlResources)>
                                    <br/>
                                    <strong>#qryConfig.txtItemDetailResourceCaption#:</strong><br />
                                    <ul>
                                          <cfloop from="1" to="#ArrayLen(addlResources)#" index="i">
                                                <li><a href="#addlResources[i].link#" <cfif addlResources[i].blnNewWindow>target="_blank"</cfif>><img src="images/#addlResources[i].icon#" width="18" height="18" border="0" alt=""></a> <a href="#addlResources[i].link#" target="_blank">#addlResources[i].title#</a><cfif val(addlResources[i].filesize)> [#round(addlResources[i].filesize / 1024)# kb]</cfif> </li>
                                          </cfloop>
                                    </ul>
                                    </cfif>
                              </cfif>
                              --->
                        </div>
                  </cfoutput>
            </cfsavecontent>

            <cfreturn output />
      </cffunction>


      <!--- adds a category to this tool, returns the new ID --->
      <cffunction name="addCategory" access="public" returntype="numeric">
            <cfargument name="txtTitle" required="true" type="string">

            <cfset FORM.intCategoryID = this.category.addCategory(this.webid,txtTitle)>
            <!--- back up form --->
            <cfset formCopy = duplicate(FORM)>
            <cfset FORM.txtTitle = FORM.intCategoryID_add_title>
            <cfset FORM.txtDescription = "">
            <cfset FORM.txtMetaDescription = "">
            <cfset FORM.txtMetaKeywords = "">
            <cfset StructDelete(FORM, "id")>
            <cfset this.workflow.doAction(SESSION.userid, this.workflow.ADD, "Added", this.catData)>
            <!--- restore form --->
            <cfset StructClear(FORM)>
            <cfset StructAppend(FORM, formCopy)>
            
            <cfreturn FORM.intCategoryID>
      </cffunction>
</cfcomponent>


the display.cfc componet

<!--- $HBVersion:5.5h3$ --->
<!--- Copyright 1999 ?2007 Hot Banana Software, Inc.
For additional information visit www.hotbanana.com 
Hot Banana is a trademark owned by J.L. Halsey --->

<cfcomponent displayname="display" extends="hb50.object">
      <cffunction name="init" access="public" returntype="any" output="false">
            <cfargument name="companyID" required="true" type="numeric">

            <cfscript>
                  super.init(arguments.companyID);
      
                  this.workflow = getObject("hb50.workflow", arguments.companyID, true);
                  this.actionmsg = '';
                  this.treenavrefresh = false;
      
                  return this;
            </cfscript>
      </cffunction>

      <!--- Returns a formatted listing of data --->
      <cffunction name="getListing" access="public" returntype="string" output="false">
            <cfargument name="formData" type="struct" required="true" />
            <!--- the column name that will be printed out and hyperlinked (ie, txtTitle) --->
            <cfargument name="printColumn" type="string" required="true" />
            <!--- the title of the column that will be printed out and hyperlinked (ie, 'Title') --->
            <cfargument name="printTitle" type="string" required="true" />
            <!--- the extra column name that will be printed out (usually the Sort By column) --->
            <cfargument name="extraColumn" type="string" required="true" />
            <!--- the title of the extra column that will be printed out (ie, 'Category') --->
            <cfargument name="extraTitle" type="string" required="true" />
            <!--- the link to the edit page (ie, page.cfm?tool=12&tab=options) --->
            <cfargument name="linkURL" type="string" required="true" />
            <!--- the column containing the link: overrides linkURL if provided --->
            <cfargument name="linkColumn" type="string" required="false" />
            <!--- the target of the link, in case we want it to open somewhere else for some reason --->
            <cfargument name="linkTarget" type="string" required="false" />
            <!--- should the listing go ahead and search through the results (set to false if they get filtered before this function) --->
            <cfargument name="blnSearchListing" type="boolean" required="false" default="true" />
            
            <cfscript>
                  var i = 1;
                  var searchURL = '';
                  var qryRecords = QueryNew('');
                  var idColumn = formData.varID;
                  var output = '';
                  var buttons = '';
                  var recordID = 0;
                  var title = '';
                  var noHtmlTitle = '';
                  var extraValue = '';
                  var link = '';
                  var capSize = 60;
                  var text = '';
                  
                  if (formData.blnWorkflow)
                        idColumn = "intItemID";
            </cfscript>
            
            <cfparam name="URL.order" default="intOrder">
            <cfparam name="URL.sortorder" default="asc">
            <cfparam name="URL.catid" default="0">
            <cfparam name="URL.statusid" default="0">
            <cfparam name="URL.keywords" default="">
            <cfparam name="URL.pagination" default="#Val(SESSION.pagination)#" type="numeric">
            <cfparam name="URL.SR" default="1">
            
            <cfif isDefined("FORM.keywords")>
                  <cfif isDefined("FORM.catid")>
                        <cfset URL.catid = FORM.catid>
                  </cfif>
                  <cfif isDefined("FORM.statusid")>
                        <cfset URL.statusid = FORM.statusid>
                  </cfif>
                  <cfset URL.keywords = FORM.keywords>
            </cfif>
            <cfset searchURL = "&catid=#catid#&statusid=#statusid#&keywords=#keywords#">

            <cfif not isQuery(formData.query)>
                  <cfset formData.query = this.workflow.getQuery(formData)>
            </cfif>
            <cfset qryRecords = formData.query>
            
            <cfset qryRecords = sortListing(qryRecords, printColumn, extraColumn)>
            <cfif arguments.blnSearchListing>
                  <cfset qryRecords = searchListing(qryRecords, keywords, catID, statusID, printColumn)>
            </cfif>

            <cfif isDefined("FORM.pagenumber")>
                  <cfset URL.SR = 1 + ((Val(FORM.pagenumber) - 1) * URL.pagination)>
            </cfif>
            <cfset URL.SR = max(min(URL.SR,qryRecords.recordcount - (qryRecords.recordcount mod URL.pagination) + 1), 1)>

            <cfsavecontent variable="output">
                  <cfoutput>
                        #getStatus()#
                        
                        <div id="pagination" style="position:absolute; left:396px; top:294px; width:82px; height:15px; z-index:20" class="bevelEmbossStatus">
                              <div id="paginationText" style="position:absolute; left:3px; top:1px; width:67px; height:11px; z-index:20; overflow: hidden;"><nobr>#translate("Items/Page")# #pagination#</nobr></div>
                              <div id="paginationSelect" style="position:absolute; left:64px; top:-2px; width:15px; height:15px; z-index:20"><a href="##" onclick="P7_autoLayers(4,'paginationList'); document.frmPagination.pagination.focus();"><img src="images/btn_status_arrow.gif" width="15" height="15" border="0"></a></div>
                              <div id="paginationList" style="position:absolute; left:-1px; top:-99px; width:141px; height:102px; z-index:20; visibility: hidden;">
                              <form name="frmPagination" method="post" action="">
                                    <select class="selectSmall" style="width:82;" name="pagination" size="7" onchange="window.location = '#arguments.linkURL#&sortorder=#sortorder#&order=#order##searchURL#&pagination=' + this.options[this.selectedIndex].value;" onblur="P7_autoLayers(4,'');">
                                          <option value="5"<cfif URL.pagination is 5> selected</cfif>>5</option>
                                          <option value="10"<cfif URL.pagination is 10> selected</cfif>>10</option>
                                          <option value="25"<cfif URL.pagination is 25> selected</cfif>>25</option>
                                          <option value="50"<cfif URL.pagination is 50> selected</cfif>>50</option>
                                          <option value="100"<cfif URL.pagination is 100> selected</cfif>>100</option>
                                          <option value="250"<cfif URL.pagination is 250> selected</cfif>>250</option>
                                          <option value="500"<cfif URL.pagination is 500> selected</cfif>>500</option>
                                    </select>
                              </form></div>
                        </div>
                        <div id="total" style="position:absolute; left:481px; top:294px; width:62px; height:15px; z-index:5" class="bevelEmbossStatus">
                              <div id="totalText" align="right" style="position:absolute; left:3px; top:1px; width:55px; height:11px; z-index:5">#translate("Total")#:#qryRecords.recordcount#</div>
                        </div>
      
                        <cfsavecontent variable="buttons">
                              <form action="#arguments.linkURL#" method="post">
                                    <input type="hidden" name="id" id="edit_id" value="">
                                    <input type="hidden" name="mode" value="edit">
                                    <cfloop from="1" to="#ArrayLen(formData.listbuttons)#" index="i">
                                          <cfif not StructKeyExists(formData.listbuttons[i], "width")>
                                                <cfset formData.listbuttons[i].width = 100>
                                          </cfif>
                                          <input name="addbutton" type="submit" class="buttons" value="#translate(formData.listbuttons[i].title)#" style="width: #formData.listbuttons[i].width#px"
                                                <cfif StructKeyExists(formData.listbuttons[i], "onClick")>
                                                      onClick="#formData.listbuttons[i].onClick#"
                                                </cfif>
                                          />
                                    </cfloop>
                                    <cfif formData.blnAdd>
                                          <input name="addbutton" type="submit" class="buttons" value="#translate("Add #formData.itemname#")#"
                                           onClick="this.form.id.value = '';"/>
                                    </cfif>
                                    <cfif formData.blnEdit>
                                          <input name="addbutton" type="submit" class="buttons" value="#translate("Edit #formData.itemname#")#"
                                           onClick="if (this.form.id.value == '') { alert('#translate("Please click on an item to edit.")#'); return false; }"/>
                                    </cfif>
                                    <cfif formData.blnOrder>
                                          <script language="JavaScript">
                                                function jsCustomOrder () {
                                                      window.open('popup/order.cfm?webid=#formData.webid#&datatype=#formData.datatype#', '', 'scrollbars=no,width=300,height=265,resizable=yes');
                                                      return false;
                                                }
                                          </script>
                                          <input name="order" type="submit" class="buttons" value="#translate("Order Items")#" onClick='return jsCustomOrder();'/>
                                    </cfif>
                              </form>
                        </cfsavecontent>
                        #getButtonLayer(buttons)#
      
                        #getSearchBar(formData, arguments.linkURL)#
      
                        <div id="header" style="position:absolute; visibility:visible; left:1px; top:1px; width:540px; height:20px; z-index:2;">
                              <table style="background-color:##EEEEEE" border="0" cellspacing="1" cellpadding="0">
                              <tr>
                                  <td width="20" height="21" class="toolHeader">
                                        <img src="images/shim.gif" width="20" height="1" border="0">
                                          </td>
                                <td width="363" class="toolHeader">
                                                <cfif arguments.linkURL is "">
                                                      #translate(arguments.printTitle)#
                                                <cfelse>
                                                      <a href="#arguments.linkURL#<cfif arguments.linkURL contains "?">&<cfelse>?</cfif>pagination=#URL.pagination#&order=title#searchURL#&sortorder=<cfif URL.order is "title" and URL.sortorder is "asc">desc<cfelse>asc</cfif>">#translate(printTitle)#</a>
                                                      <cfif URL.order is "title">
                                                            <cfif URL.sortorder is "asc">
                                                                  <img src="images/btn_move_up.gif" width="9" height="9" border="0" align="absmiddle">
                                                            <cfelse>
                                                                  <img src="images/btn_move_down.gif" width="9" height="9" border="0" align="absmiddle">
                                                            </cfif>
                                                      </cfif>
                                                </cfif>
                                                <cfif qryRecords.recordcount gt URL.pagination>
                                                      <div id="Layer1" style="position:absolute; left:222px; top:1px; width:157px; height:15px; z-index:4; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: ##666666;">
                                                            <form action="#Left(arguments.linkURL, Find('?', arguments.linkURL) - 1)#?#Right(arguments.linkURL, Len(arguments.linkURL) - Find('?', arguments.linkURL))#&pagination=#URL.pagination#&sortorder=#sortorder#&order=#order##searchURL#" method="post">
                                                                  <div align="right">
                                                                        <cfif SR gt 1>
                                                                              <a href="#Left(arguments.linkURL, Find('?', arguments.linkURL) - 1)#?#Right(arguments.linkURL, Len(arguments.linkURL) - Find('?', arguments.linkURL))#&pagination=#URL.pagination#&sortorder=#sortorder#&order=#order##searchURL#&SR=#SR - URL.pagination#"><img src="images/btn_back.gif" width="11" height="11" border="0"></a>
                                                                        </cfif>
                                                                        PAGE
                                                                          <input name="pagenumber" type="text" style="height:18px; width:32px; font-family: Arial, Helvetica, sans-serif; font-size: 10px;" value="#Ceiling(SR / URL.pagination)#" size="3" onEnter='this.form.submit();'/>
                                                                        OF #Ceiling(qryRecords.recordCount / URL.pagination)#
                                                                        <cfif SR lte qryRecords.recordcount - URL.pagination>
                                                                              <a href="#Left(arguments.linkURL, Find('?', arguments.linkURL) - 1)#?#Right(arguments.linkURL, Len(arguments.linkURL) - Find('?', arguments.linkURL))#&pagination=#URL.pagination#&sortorder=#sortorder#&order=#order##searchURL#&SR=#SR + URL.pagination#"><img src="images/btn_next.gif" width="11" height="11" border="0"></a>
                                                                        </cfif>
                                                                  </div>
                                                            </form>
                                                      </div>
                                                </cfif>
                                          </td>
                                        <td width="120" class="toolHeader">
                                                <cfif arguments.linkURL is "">#translate(arguments.extraTitle)#<cfelse><a href="#arguments.linkURL#<cfif arguments.linkURL contains "?">&<cfelse>?</cfif>pagination=#URL.pagination#&order=date#searchURL#&sortorder=<cfif url.order is "date" and url.sortorder is "asc">desc<cfelse>asc</cfif>">#translate(extraTitle)#</a> <cfif URL.order is "date"><cfif URL.sortorder is "asc"><img src="images/btn_move_up.gif" width="9" height="9" border="0" align="absmiddle"><cfelse><img src="images/btn_move_down.gif" width="9" height="9" border="0" align="absmiddle"></cfif></cfif></cfif>
                                          </td>
                                </tr>
                              </table>
                        </div>
                  </cfoutput>
                  
                  <script>
                        function setEditID(id) {
                              var lastID = document.getElementById('edit_id').value;
                              var lastRow = document.getElementById('row1_' + lastID + '');
                              if (lastRow)
                                    lastRow.style.background = '#FFFFFF';
                              var lastRow = document.getElementById('row2_' + lastID + '');
                              if (lastRow)
                                    lastRow.style.background = '#FFFFFF';
                              var lastRow = document.getElementById('row3_' + lastID + '');
                              if (lastRow)
                                    lastRow.style.background = '#FFFFFF';
                                    
                              document.getElementById('edit_id').value = id;
                              document.getElementById('row1_' + id + '').style.background = '#EEEEEE';
                              document.getElementById('row2_' + id + '').style.background = '#EEEEEE';
                              document.getElementById('row3_' + id + '').style.background = '#EEEEEE';
                        }
                  </script>
                                                      
                  <div id="listing" style="position:absolute; visibility:visible; left:1px; top:1px; width:540px; height:261px; z-index:1; overflow:scroll;">
                        <table style="background-color:#EEEEEE" border="0" cellspacing="1" cellpadding="0">
                              <tr>
                                    <td width="20" height="21" class="toolHeader"><img src="images/shim.gif" width="20" height="1" border="0"></td>
                                     <td width="363" class="toolHeader">&nbsp;</td>
                                     <td width="120" class="toolHeader">&nbsp;</td>
                               </tr>
                              <cfoutput query="qryRecords" startrow="#SR#" maxrows="#URL.pagination#">
                                    <cfset recordID = qryRecords[idColumn]>
                                    <cfset title = qryRecords[arguments.printColumn]>
                                    <cfif Len(arguments.extraColumn)>
                                          <cfset extraValue = qryRecords[arguments.extraColumn]>
                                    <cfelse>
                                          <cfset extraValue = "">
                                    </cfif>
                                     <cfif isDefined("arguments.linkColumn") and Len(arguments.linkColumn)>
                                          <cfset link = qryRecords[arguments.linkColumn]>
                                    <cfelse>
                                          <cfsavecontent variable="link">#arguments.linkURL#<cfif arguments.linkURL contains "?">&<cfelse>?</cfif>mode=edit&id=#recordID#&listparam=#URLEncodedFormat("order=#order#&sortorder=#sortorder#&sr=#sr#&pagination=#url.pagination##searchURL#")#</cfsavecontent>
                                    </cfif>
                                    <cfset noHtmlTitle = ReReplace(title, "<[^>]+>", "", "ALL")>
                                    <cfif Len(noHtmlTitle) gt capSize>
                                          <cfset title = Left(title, 60 + Len(title) - Len(noHtmlTitle)) & "...">
                                    </cfif>

                                    <cfsavecontent variable="text"><a href="#link#" <cfif isDefined("arguments.linkTarget") and Len(arguments.linkTarget)>target="#arguments.linkTarget#"</cfif>><cfif not Len(Trim(title))>no title</cfif>#title#</a></cfsavecontent>

                                    <cfif isDate(extraValue)>
                                          <cftry>
                                                <cfset extraValue = '#LSDateFormat(extraValue, "mmm d, yyyy")# #LSTimeFormat(extraValue, "h:mmtt")#' />
                                                <cfcatch></cfcatch>
                                          </cftry>
                                    </cfif>

                                    <tr>
                                           <td height="21" class="toolList" id="row1_#recordID#" onclick="javascript:setEditID('#recordID#');">#getIcon(qryRecords, currentrow)#</td>
                                           <td class="toolList" id="row2_#recordID#" onclick="javascript:setEditID('#recordID#');">#text#<cfif isDefined("qryRecords.blnFeatured") and qryRecords.blnFeatured is 1> <img src="images/butFeature.gif" width="16" height="16" border="0" alt="#translate("Featured")#" align="bottom"></cfif></td>
                                           <td class="toolList" id="row3_#recordID#" onclick="javascript:setEditID('#recordID#');">#extraValue#</td>
                                    </tr>
                              </cfoutput>
                              <cfif not qryRecords.recordcount>
                                    <cfoutput>
                                    <tr>
                                           <td height="20" bgcolor="##FFFFFF" align="center" valign="center" style="cursor:none;">&nbsp;</td>
                                           <td bgcolor="##FFFFFF" class="formCaption" style="padding:5px;">#translate("There are no records.")#</td>
                                           <td bgcolor="##FFFFFF">&nbsp;</td>
                                    </tr>
                                    </cfoutput>
                              </cfif>
                     </table>
                  </div>
            </cfsavecontent>

            <cfreturn output />
      </cffunction>

      <cffunction name="getSearchBar" access="public" returntype="string" output="false">
            <cfargument name="formData" type="struct" required="true" />
            <cfargument name="linkURL" type="string" required="true" />
            
            <cfset var searchbar = '' />
            <cfset var category  = '' />
            <cfset var qryCategory = '' />
            
            <cfsavecontent variable="searchbar">
                  <cfoutput>
                        <form action="#arguments.linkURL#<cfif arguments.linkURL contains "?">&<cfelse>?</cfif>pagination=#URL.pagination#" method="post">
                              <input type="text" id="searchKeywords" name="keywords" class="searchBox" value="#HTMLEditFormat(URL.keywords)#" style="width: <cfif formData.blnCategory and formData.blnStatus>220<cfelseif formData.blnCategory or formData.blnStatus>349<cfelse>478</cfif>px;"/>
                              <cfif formData.blnStatus>
                                    <select name="statusID" class="searchSelect" onChange='this.form.submit();'>
                                          <option value="0" selected>#translate("Status")# ...</option>
                                          <option value="#this.workflow.STATUS.ACTIVE#" <cfif URL.statusID is this.workflow.STATUS.ACTIVE>selected</cfif>>#translate("Active")#</option>
                                    <cfif formData.blnScheduling>
                                          <option value="#this.workflow.STATUS.PENDING#" <cfif URL.statusID is this.workflow.STATUS.PENDING>selected</cfif>>#translate("Pending")#</option>
                                          <option value="#this.workflow.STATUS.EXPIRED#" <cfif URL.statusID is this.workflow.STATUS.EXPIRED>selected</cfif>>#translate("Expired")#</option>
                                    </cfif>
                                    <cfif formData.blnLock>
                                          <option value="#this.workflow.STATUS.LOCK#" <cfif URL.statusID is this.workflow.STATUS.LOCK>selected</cfif>>#translate("Locked")#</option>
                                    </cfif>
                                    <cfif formData.blnApproval>
                                           <option value="#this.workflow.STATUS.UNAPPROVED#" <cfif URL.statusID is this.workflow.STATUS.UNAPPROVED>selected</cfif>>#translate("Unapproved")#</option>
                                    </cfif>
                                    <cfif formData.blnRestore and formData.blnDelete and SESSION.blnRestore>
                                          <option value="#this.workflow.STATUS.DELETED#" <cfif URL.statusID is this.workflow.STATUS.DELETED>selected</cfif>>#translate("Deleted")#</option>
                                    </cfif>
                                    </select>
                              </cfif>
                              <cfif formData.blnCategory>
                                    <cfparam name="URL.catID" default="0">
                                    <cfset category = createObject("component", "hb50.category").init(this.CompanyID)>
                                    <cfset qryCategory = category.getCategories(formData.webid)>
                                    <select name="catID" class="searchSelect" onChange='this.form.submit();'>
                                          <cfif StructKeyExists(formData, 'categoryname')>
                                                <option value="0" selected>#formData.categoryname# ...</option>
                                          <cfelse>
                                                <option value="0" selected>#translate("Category")# ...</option>
                                          </cfif>
                                          <cfloop query="qryCategory">
                                                <option value="#qryCategory.intID#"<cfif URL.catID is qryCategory.intID> selected</cfif>>#qryCategory["txtTitle"][currentRow]#</option>
                                          </cfloop>
                                    </select>
                              </cfif>
                              <input type="submit" name="Submit" value="#translate("SEARCH")#" class="buttons" style="width:60px"/>
                        </form>
                  </cfoutput>
            </cfsavecontent>
            
            <cfreturn getToolbarLayer(searchbar)>
      </cffunction>

      <!--- sorts records based on url parameters, originating from getListing() --->
      <cffunction name="sortListing" access="public" returntype="query" output="false">
            <cfargument name="qryRecords" type="query" required="true">
            <cfargument name="printColumn" type="string" required="true">
            <cfargument name="extraColumn" type="string" required="true">

            <cfif isDefined("URL.order")>
                  <cfif URL.order is "title">
                        <cfquery name="qryRecords" dbtype="query">
                              SELECT      *, UPPER(#arguments.printColumn#) AS sortPrintColumn
                              FROM       qryRecords
                              ORDER BY sortPrintColumn <cfif isDefined("URL.sortorder") and URL.sortorder is "desc">DESC</cfif>
                        </cfquery>
                  <cfelseif URL.order is "date">
                        <cfquery name="qryRecords" dbtype="query">
                              SELECT       *
                              FROM       qryRecords
                              ORDER BY #arguments.extraColumn# <cfif isDefined("URL.sortorder") and URL.sortorder is "desc">DESC</cfif>
                        </cfquery>
                  </cfif>
            </cfif>

            <cfreturn qryRecords />
      </cffunction>

      <!--- search records based on url parameters, originating from getListing() --->
      <cffunction name="searchListing" access="public" returntype="query" output="false">
            <cfargument name="qryRecords" type="query" required="true">
            <cfargument name="keywords" type="string" required="true">
            <cfargument name="catID" type="numeric" required="true">
            <cfargument name="statusID" type="numeric" required="true">
            <cfargument name="printColumn" type="string" required="true">

            <cfset var qryNewRecords = ''>

            <cfquery name="qryNewRecords" dbtype="query">
                  SELECT       *
                  FROM       qryRecords
                  WHERE       1 = 1
                  <cfif catID and ListFindNoCase(qryRecords.columnlist, "intCategoryID")>
                        AND      intCategoryID = #arguments.catID#
                  </cfif>
                  <cfif ListFindNoCase(qryRecords.columnlist, "intStatusID")>
                        <cfif Val(statusID)>
                              AND intStatusID = #Val(arguments.statusID)#
                        <cfelse>
                              AND intStatusID != #this.workflow.STATUS.DELETED#
                        </cfif>
                  </cfif>
                  <cfif ListLen(keywords, " ")>
                        AND (1 = 2
                              <cfloop list="#arguments.keywords#" delimiters=" " index="i">
                                    OR LOWER(#arguments.printColumn#) LIKE '%#LCase(i)#%'
                              </cfloop>
                        )
                  </cfif>
            </cfquery>

            <cfreturn qryNewRecords />
      </cffunction>

      <!--- returns the status icon of the item for the listing form --->
      <cffunction name="getIcon" access="public" returntype="string" output="false">
            <cfargument name="qryRecords" type="query" required="true" />
            
            <cfscript>
                  var status = -1;
                  var lockmsg = '';
                  var qryLockUsers = '';
                  var image = '';
            </cfscript>
            
            <cfif ListFindNoCase(qryRecords.columnlist, "intStatusID")>
                  <cfset status = qryRecords.intStatusID>
                  
                  <cfif status is this.workflow.STATUS.ACTIVE>
                        <cfreturn '<img src="images/btn_active.gif" width="16" height="18" border="0" alt="#translate("Active")#" title="#translate("Active")#">'>
                  <cfelseif status is this.workflow.STATUS.INACTIVE>
                        <cfreturn '<img src="images/btn_unactive.gif" width="16" height="18" border="0" alt="#translate("Inactive")#" title="#translate("Inactive")#">'>
                  <cfelseif status is this.workflow.STATUS.DELETED>
                        <cfreturn '<img src="images/btn_deleted.gif" width="16" height="18" border="0" alt="#translate("Deleted")#" title="#translate("Deleted")#">'>
                  <cfelseif status is this.workflow.STATUS.UNAPPROVED>
                        <cfreturn '<img src="images/btn_approval.gif" width="16" height="18" border="0" alt="#translate("Waiting For Approval")#" title="#translate("Waiting For Approval")#">'>
                  <cfelseif status is this.workflow.STATUS.UNTRANSLATED>
                        <cfreturn '<img src="images/btn_translate.gif" width="16" height="18" border="0" alt="#translate("Waiting For Translation")#" title="#translate("Waiting For Translation")#">'>
                  <cfelseif status is this.workflow.STATUS.UNSHARED>
                        <cfreturn '<img src="images/btn_notshared.gif" width="16" height="18" border="0" alt="#translate("Not Shared")#" title="#translate("Not Shared")#">'>
                  <cfelseif status is this.workflow.STATUS.CLONED>
                        <cfreturn '<img src="images/btn_cloned.gif" width="16" height="18" border="0" alt="#translate("Cloned")#" title="#translate("Cloned")#">'>      
                  <cfelseif status is this.workflow.STATUS.LOCK>
                        <!--- if it's locked, we want to find out the administrator's name who locked it --->
                        <cfset qryLockUsers = this.workflow.getLockUsers(qryRecords.intItemID)>
                        
                        <cfif selectFrom(qryLockUsers, "intUserID", SESSION.userid).recordcount>
                              <cfreturn '<img src="images/btn_extranet.gif" width="16" height="18" border="0" alt="#translate("Locked")#" title="#translate("Locked")#">'>
                        </cfif>
                        <cfif qryLockUsers.recordcount is 1>
                              <cfif not isDefined("this.access")>
                                    <cfset this.access = createObject("component", "hb50.access").init(this.CompanyID)>
                              </cfif>
                              <!--- in case the user doesnt exist, or something goes wrong, we'll do this try & catch --->
                              <cftry>
                                    <cfset lockmsg = translate("Locked by") & " " & this.access.getUserData(qryLockUsers.intUserID).realname>
                                    <cfcatch></cfcatch>
                              </cftry>
                        <cfelse>
                              <cfset lockmsg = translate('Locked and waiting for approval')>
                        </cfif>

                        <cfset image = '<img src="images/btn_lock.gif" width="16" height="18" border="0" alt="#lockmsg#" title="#lockmsg#">'>
                        
                        <cfreturn image />
                  <cfelseif status is this.workflow.STATUS.PENDING>
                        <cfif StructKeyExists(qryRecords, 'dtStart')>
                              <cfreturn '<img src="images/btn_pending.gif" width="16" height="18" border="0" alt="#translate("Pending until")# #DateFormat(qryRecords.dtStart, "mmmm d, yyyy")# at #TimeFormat(qryRecords.dtStart, "h:mm tt")#" title="#translate("Pending until")# #DateFormat(qryRecords.dtStart, "mmmm d, yyyy")# at #TimeFormat(qryRecords.dtStart, "h:mm tt")#">'>
                        <cfelse>
                              <cfreturn '<img src="images/btn_pending.gif" width="16" height="18" border="0" alt="#translate("Pending")#" title="#translate("Pending")#">'>
                        </cfif>
                  <cfelseif status is this.workflow.STATUS.EXPIRED>
                        <cfif StructKeyExists(qryRecords, 'dtEnd')>
                              <cfreturn '<img src="images/btn_expired.gif" width="16" height="18" border="0" alt="#translate("Expired on")# #DateFormat(qryRecords.dtEnd, "mmmm d, yyyy")# at #TimeFormat(qryRecords.dtEnd, "h:mm tt")#" title="#translate("Expired on")# #DateFormat(qryRecords.dtEnd, "mmmm d, yyyy")# at #TimeFormat(qryRecords.dtEnd, "h:mm tt")#">'>
                        <cfelse>
                              <cfreturn '<img src="images/btn_expired.gif" width="16" height="18" border="0" alt="#translate("Expired")#" title="#translate("Expired")#">'>
                        </cfif>
                  <cfelse>
                        <cfreturn '&nbsp;' />
                  </cfif>
            
            <!--- Jason: hack to display the link validation status icon (DAM) --->      
            <cfelseif ListFindNoCase(qryRecords.columnlist, "blnValidateLink")>
                  <cfif Val(qryRecords.blnValidateLink)>
                        <cfreturn '<img src="images/ico_pass.gif" border="0" align="absmiddle" alt="#translate("Valid Link")#" title="#translate("Valid Link")#">' />
                  <cfelse>
                        <cfreturn '<img src="images/ico_alert.gif" border="0" align="absmiddle" alt="#translate("Invalid Link")#" title="#translate("Invalid Link")#">' />      
                  </cfif>
            </cfif>

            <cfreturn "&nbsp;" />
      </cffunction>

      <!--- wraps buttonCode in the layer that buttons need to go in.
              you can only use it once or other buttons will just overlap in the same spot.
      --->
      <cffunction name="getButtonLayer" access="public" returntype="string" output="false">
            <cfargument name="buttonCode" type="string" required="true">

            <cfsavecontent variable="output">
                  <div id="Buttons" style="position:absolute; left:-1px; top:269px; width:544px; height:22px; z-index:16" align="right">
                        <cfoutput>#buttonCode#</cfoutput>
                  </div>
            </cfsavecontent>
            
            <cfreturn output />
      </cffunction>

      <!--- wraps toolbarCode in the layer that the toolbar needs to go in.
              only use this once per template
      --->
      <cffunction name="getToolbarLayer" access="public" returntype="string" output="false">
            <cfargument name="toolbarCode" type="string" required="true">

            <cfsavecontent variable="output">
                  <div id="Search" style="position:absolute; left:-1px; top:-45px; width:543px; height:200px; z-index:-1;">
                        <cfoutput>#toolbarCode#</cfoutput>
                  </div>
            </cfsavecontent>
            
            <cfreturn output />
      </cffunction>

      <!--- wraps code in the inner layer. only use this once per template --->
      <cffunction name="getInnerLayer" access="public" returntype="string" output="false">
            <cfargument name="code" type="string" required="true">
            <cfargument name="name" type="string" required="false" default="innerLayer">
            <cfargument name="scrolling" type="boolean" required="false" default="false">
            <cfargument name="auto" type="boolean" required="false" default="false">

            <cfsavecontent variable="output">
                  <div id="<cfoutput>#name#</cfoutput>" style="overflow:<cfif scrolling><cfif auto>auto<cfelse>scroll</cfif><cfelse>none</cfif>; position:absolute; left:0px; top:0px; width:543px; height:263px;">
                        <cfoutput>#code#</cfoutput>
                  </div>
            </cfsavecontent>
            
            <cfreturn output />
      </cffunction>

      <!--- Returns 'content' formatted with the minimal formatting needed for a 'box', ie., for add/edit --->
      <cffunction name="getBox" access="public" returntype="string" output="false">
            <cfargument name="title" type="string" required="true">
            <cfargument name="body" type="string" required="true">

            <cfreturn body />
      </cffunction>

      <!--- Returns the pagination structure --->
      <cffunction name="getPagination" access="public" returntype="struct" output="false">
            <cfargument name="Records" type="numeric" required="true">
            <cfargument name="RecordsToDisplay" type="numeric" required="true">
            <cfargument name="SR" type="numeric" required="false" default="1">

            <cfscript>
                  var output = StructNew();
                  var prefix = 2;
                  var numShow = 5;
                  var curPage = 0;

                  SR = Min(Max(1, arguments.SR), arguments.Records);
                  curPage = Ceiling(SR / arguments.RecordsToDisplay);                  
                  
                  output.SR = SR;
                  output.Records = arguments.Records;
                  output.RecordsToDisplay = arguments.RecordsToDisplay;
                  output.prev = 0;
                  output.next = 0;
                  
                  output.numPages = Ceiling(arguments.Records / arguments.RecordsToDisplay);
                  output.startPage = Max(1, min(output.numPages - numShow + 1, curPage - prefix));
                  output.endPage = Min(output.startPage + numShow - 1, output.numPages);
                  output.lastPage = (output.numPages - 1) * arguments.RecordsToDisplay + 1;

                  if (SR gte arguments.RecordsToDisplay)
                        output.prev = SR - arguments.RecordsToDisplay;

                  if ((SR + arguments.RecordsToDisplay) lte arguments.Records)
                        output.next = SR + arguments.RecordsToDisplay;

                  return output;
            </cfscript>
      </cffunction>

      <!--- does a standard pagination, for public use when we don't implement a custom one --->
      <cffunction name="getPaginationDisplay" access="public" returntype="string" output="false">
            <cfargument name="Records" type="numeric" required="true" />
            <cfargument name="RecordsToDisplay" type="numeric" required="true" />
            <cfargument name="SR" type="numeric" required="false" default="1" />
            
            <cfscript>
                  var pag = StructNew();
                  var page = '';
                  var num = 0;
                  var startrow = 0;
            </cfscript>
            
            <cfif arguments.Records lte arguments.RecordsToDisplay or arguments.RecordsToDisplay gt arguments.Records>
                  <cfreturn '' />
            </cfif>

            <cfset pag = getPagination(arguments.Records, arguments.RecordsToDisplay, arguments.SR)>
            <cfset page = getCurrentURL()>
            
            <!--- Added by Daniel --->
            <cfif Find("?", page) lte 0>
                  <cfset page = page & "?">
            <cfelse>
                  <cfset page = page & "&">
            </cfif>

            <cfsavecontent variable="output">
                  <cfoutput>
                        <div id="hbpagestop">
                              <ul>
                                    <li><a <cfif arguments.SR gt 1>href="#page#SR=#pag.prev#"<cfelse>disabled</cfif> title="Previous Page" class="prev"><em>&lsaquo;&lsaquo;</em>Previous</a></li>
                                    <cfloop from="#pag.startPage#" to="#pag.endPage#" index="num">
                                          <cfset startrow = (num-1) * arguments.RecordsToDisplay + 1>
                                          <cfif startrow is arguments.SR>
                                                <li>#num#</li>
                                          <cfelse>
                                                <li><a href="#page#SR=#startrow#" title="Page #num#">#num#</a></li>
                                          </cfif>
                                    </cfloop>
                                    <li><a <cfif pag.next>href="#page#SR=#pag.next#"<cfelse>disabled</cfif> title="Next Page" class="next">Next<em>&rsaquo;&rsaquo;</em></a></li>
                              </ul>
                              <p>#SR#-#Min(arguments.SR + arguments.RecordsToDisplay - 1, arguments.Records)# of #arguments.Records#</p>
                        </div>
                  </cfoutput>
            </cfsavecontent>

            <cfreturn output />
      </cffunction>

      <!--- returns a form broken into a number of tabs --->
      <cffunction name="getFormTabs" access="public" returntype="string" output="false">
            <cfargument name="formData" type="any" required="true">
            <cfargument name="qryData" type="query" required="false">
            
            <cfscript>
                  var tabs = Duplicate(formdata.tabs);
                  var htmltabs = '';
                  var x = '';
                  var y = '';
                  var size = 0;
                  var maxTabs = 6;
                  var i = '';
                  var tabstyle = '';
                  var listMode = '';
                  
                  if (isDefined("formdata.maxTabs") and Val(formdata.maxTabs))
                        maxTabs = formdata.maxTabs;
            </cfscript>

            <cfif ArrayLen(tabs) is 0>
                  <cfset htmltabs = ArrayNew(1)>
                  <cfset x = StructNew()>
                  <cfset x.caption = formData.title>
                  <cfset x.columnlist = "">
                  
                  <cfloop from="1" to="#ArrayLen(formData.columns)#" index="key">
                        <cfif ListFind("#TYPES.HTML#,#TYPES.LIST#", formData.columns[key].type)>
                              <cfset y = StructNew()>
                              <cfset y.caption = formData.columns[key].title>
                              <cfset y.columnlist = formData.columns[key].varname>
                              <cfset ArrayAppend(htmltabs, y)>
                        <cfelse>
                              <cfset x.columnlist = ListAppend(x.columnlist, formData.columns[key].varname)>
                        </cfif>
                  </cfloop>
                  
                  <cfif ListLen(x.columnlist)>
                        <cfset ArrayAppend(tabs, x)>
                  </cfif>
                  <cfif ArrayLen(htmltabs)>
                        <cfloop from="1" to="#ArrayLen(htmltabs)#" index="i">
                              <cfset ArrayAppend(tabs, htmltabs[i])>
                        </cfloop>
                  </cfif>
            </cfif>
            
            <cfscript>
                  //content containers
                  if (formData.blnContainers) {
                        x = StructNew();
                        x.caption = "Content Containers";
                        x.columnlist = "containers";
                        ArrayAppend(tabs, x);
                  }
                  
                  //tagging
                  if (formData.blnTagging) {
                        x = StructNew();
                        x.caption = "Tagging";
                        x.columnlist = "tagging";
                        x.scroll = true;
                        x.auto = true;
                        ArrayAppend(tabs, x);
                  }
            </cfscript>
            
            <cfif formData.blnMeta>
                  <cfsavecontent variable="editForm">
                        <div class="txtMetaType"><input type="text" name="txtMetaType" class="formTextbox" style="width: 50px; border: 1;" disabled="true"></div>
                        <div class="txtMetaName"><input type="text" name="txtMetaName" class="formTextbox" style="width: 130px; border: 1;" disabled="true"></div>
                        <div class="txtMetaValue"><input type="text" name="txtMetaValue" class="formTextbox" style="width: 347px; border: 1;" disabled="true"></div>
                  </cfsavecontent>
                  <cfsavecontent variable="httpHeader">
                        <table class="tableOutline" border="0" cellspacing="1" cellpadding="0">
                                <tr>
                                     <td width="150" height="21" class="toolHeader">HTTP-Equiv</td>
                                     <td width="377" class="toolHeader">Content</td>
                                </tr>
                        </table>
                  </cfsavecontent>
                  <cfsavecontent variable="nameHeader">
                        <table class="tableOutline" border="0" cellspacing="1" cellpadding="0">
                                <tr>
                                     <td width="50" height="21" class="toolHeader">Type</td>
                                     <td width="130" height="21" class="toolHeader">Name</td>
                                     <td width="347" class="toolHeader">Content</td>
                                </tr>
                        </table>
                  </cfsavecontent>
                  
                  <cfscript>
                        listMode = '<div class="txtMetaType">,</div>#CHR(13)##CHR(10)#<div class="txtMetaName">,</div>#CHR(13)##CHR(10)#<div class="txtMetaValue">,</div>';
                                          
                        x = StructNew();
                        x.varname = "txtNameValues";
                        x.title = "Advanced Meta";
                        x.type = TYPES.LIST;
                        x.collist = 'txtMetaType,txtMetaName,txtMetaValue';
                        
                        x.headerText = nameHeader;
                        x.editHTML = editForm;
                        x.listHTML = listMode;
                        x.required = false;
                        x.display = false;
                        ArrayAppend(formData.columns, x);
      
                        x = StructNew();
                        x.caption = "Basic Meta";
                        x.columnlist = "txtMeta";
                        ArrayAppend(tabs, x);
      
                        x = StructNew();
                        x.caption = "Advance Meta";
                        x.columnlist = "txtNameValues";
                        ArrayAppend(tabs, x);
                  </cfscript>
            </cfif>
            
            <cfscript>
                  //additional resources
                  if (formData.blnResources) {
                        x = StructNew();
                        x.caption = "Related Info";
                        x.columnlist = "resources";
                        ArrayAppend(tabs, x);
                  }
                  //scheduling
                  if (formData.blnScheduling) {
                        x = StructNew();
                        x.caption = "Schedule";
                        x.columnlist = "dtStart,dtEnd";
                        ArrayAppend(tabs, x);
                  }
            </cfscript>
            
            <cfsavecontent variable="output">
                  <cfoutput>
                        <cfset size = ArrayLen(tabs)>
                        <cfif size gt maxTabs>
                              <cfset size = maxTabs>
                        </cfif>
                        
                        <cfloop from="1" to="#size#" index="i">
                              <cfoutput>
                                    <div id="edit#i#" style="position:absolute; left:5px; top:-15px; width:525px; height:15px; z-index:3;">
                                          <table border="0" cellspacing="0" cellpadding="0" align="right" class="tabSmall">
                                                <tr>
                                                <cfloop from="1" to="#size#" index="j">
                                                      <cfif i is j>
                                                            <cfset tabstyle = "Y">
                                                      <cfelse>
                                                            <cfset tabstyle = "N">
                                                      </cfif>
                                                      <td class="tabsml#tabstyle#l"><img src="images/shim.gif" width="11" height="15"></td>
                                                      <td class="tabsml#tabstyle#c"><a onclick="jsTabSwitch(#j#);">#translate(tabs[j].caption)#</a></td>
                                                      <td class="tabsml#tabstyle#r"><img src="images/shim.gif" width="11" height="15"></td>
                                                </cfloop>
                                                <cfif size LT ArrayLen(tabs)>
                                                      <td><img src="images/shim.gif" width="11" height="15"></td>
                                                      <td valign="top"><a onclick="jsTabSwitch(#size + 1#);"><img src="images/btn_next.gif" title="more"></a></td>
                                                      <td><img src="images/shim.gif" width="6" height="15"></td>
                                                </cfif>
                                                </tr>
                                          </table>
                                    </div>
                              </cfoutput>
                      </cfloop>
            
                        <cfset size = size + 1>
                        <cfloop from="#size#" to="#Arraylen(tabs)#" index="i">
                              <cfoutput>
                                    <div id="edit#i#" style="position:absolute; left:5px; top:-15px; width:525px; height:15px; z-index:3;">
                                          <table border="0" cellspacing="0" cellpadding="0" align="right" class="tabSmall">
                                                <tr>
                                                    <td><img src="images/shim.gif" width="6" height="15"></td>
                                                      <td valign="top"><a onclick="jsTabSwitch(#size - 1#);"><img src="images/btn_back.gif" title="more"></a></td>
                                                      <td><img src="images/shim.gif" width="11" height="15"></td>
                                                <cfloop from="#size#" to="#ArrayLen(tabs)#" index="j">
                                                      <cfif i is j>
                                                            <cfset tabstyle = "Y">
                                                      <cfelse>
                                                            <cfset tabstyle = "N">
                                                      </cfif>
                                                      <td class="tabsml#tabstyle#l"><img src="images/shim.gif" width="11" height="15"></td>
                                                      <td class="tabsml#tabstyle#c"><a onclick="jsTabSwitch(#j#);">#translate(tabs[j].caption)#</a></td>
                                                      <td class="tabsml#tabstyle#r"><img src="images/shim.gif" width="11" height="15"></td>
                                                </cfloop>
                                                </tr>
                                          </table>
                                    </div>
                              </cfoutput>
                      </cfloop>
                        
                        <!--- put these in reverse order so that the first tab ends up on top
                                I don't know why this works, but it fixed a problem where I couldn't put the focus into a text input.
                        --->
                        <cfloop to="1" from="#ArrayLen(tabs)#" step="-1" index="k">
                              <cfif not StructKeyExists(tabs[k], "body")>
                                    <cfinvoke method="getForm" returnvariable="formhtml">
                                          <cfinvokeargument name="formData" value="#formData#">
                                          <cfif isDefined("qryData")>
                                                <cfinvokeargument name="qryData" value="#qryData#">
                                          </cfif>
                                          <cfinvokeargument name="columnNames" value="#tabs[k].columnlist#">
                                    </cfinvoke>
                                    <cfset tabs[k].body = formhtml>
                              </cfif>
                              #getInnerLayer(tabs[k].body, "innerTab#k#", (StructKeyExists(tabs[k], "scroll") and tabs[k].scroll), (StructKeyExists(tabs[k], "auto") and tabs[k].auto))#
                        </cfloop>
            
                        <script language="JavaScript">
                              var tabList = new Array();
                              <cfloop from="1" to="#ArrayLen(tabs)#" index="i">
                                    tabList[#i#] = '#tabs[i].caption#';
                              </cfloop>
                              
                              function jsTabSwitch(tab) {
                                    document.body.onbeforeunload = null;
                                    P7_autoLayers(4,'edit' + tab,'edit','innerTab' + tab);
                                    <cfloop from="1" to="#ArrayLen(tabs)#" index="j">
                                          if (tab == #j#) {
                                                <cfloop list="#tabs[j].columnlist#" index="varname">
                                                      if (document.getElementById('#varname#') != undefined) {
                                                            document.getElementById('#varname#').style.display = 'block';
                                                      }
                                                </cfloop>
                                                <cfloop from="1" to="#ArrayLen(formData.columns)#" index="key">
                                                      <cfset i = formData.columns[key]>
            
                                                      <cfif ListFindNoCase(tabs[j].columnlist, i.varname) and i.type is this.TYPES.HTML>
                                                            turnEditOn_#i.varname# ()
                                                      </cfif>
            
                                                      <cfif not ListFindNoCase(tabs[j].columnlist, i.varname)>
                                                            if (document.getElementById('#i.varname#') != undefined) {
                                                                  document.getElementById('#i.varname#').style.display = 'none';
                                                            }
                                                      </cfif>
                                                </cfloop>
                                          }
                                    </cfloop>
                                    
                                    switch(tabList[tab].toLowerCase()) {
                                          case 'overview':
                                                document.getElementById('settingsOverviewChanged').value = 1;
                                                break;
                                          case 'extranet':
                                                document.getElementById('settingsExtranetChanged').value = 1;
                                                break;
                                          case 'sharing':
                                                document.getElementById('settingsSharingChanged').value = 1;
                                                break;
                                          case 'workflow':
                                                document.getElementById('settingsWorkflowChanged').value = 1;
                                                break;
                                          case 'conversion':
                                                document.getElementById('settingsConversionChanged').value = 1;
                                                break;
                                          case 'campaign':
                                                document.getElementById('settingsCampaignChanged').value = 1;
                                                break;
                                          case 'blog':
                                                document.getElementById('settingsBlogChanged').value = 1;
                                                break;
                                          case 'webtrends&reg;':
                                                document.getElementById('settingsWTODChanged').value = 1;
                                                break;
                                          case 'google sitemaps':
                                                document.getElementById('settingsGoogleSitemapChanged').value = 1;
                                                break;
                                    }
                              }
                              <!--- this fixes some bug where you can't put in focus --->
                              <cfloop from="#ArrayLen(tabs)#" to="1" index="j" step="-1">
                                    P7_autoLayers(4,'edit#j#','edit','innerTab#j#');
                              </cfloop>
                              jsTabSwitch(1);
                        </script>
                  </cfoutput>
            </cfsavecontent>

            <cfreturn output />
      </cffunction>

      <!--- returns the add/edit form fields, based on data in formData, and filled in with values from qryData --->
      <cffunction name="getForm" access="public" returntype="string" output="false">
            <cfargument name="formData" type="any" required="true">
            <cfargument name="qryData" type="query" required="false">
            <cfargument name="columnNames" type="string" required="false">
            
            <cfscript>
                  var media = '';
                  var output = '';
                  var blnInherit = false;
                  var contentcontainer = '';
                  var tagMgr = '';
                  var value = '';
                  var i = '';
                  var count = 1;
                  var key = '';
            </cfscript>

            <!--- if columnNames is "resources", then this form is the additional resources form --->
            <cfif isDefined("columnNames") and columnNames is "resources">
                  <cfset media = createObject("component", "hb50.media").init(this.CompanyID)>
                  <cfsavecontent variable="output">
                        <img src="images/shim.gif" height="13" width="1" alt="">
                        <div align="center">
                              <cfoutput>
                                    <cfif isDefined("qryData.intResourceID")>
                                          #media.getAdditionalResourcesForm("resources", qryData.intResourceID)#
                                    <cfelse>
                                          #media.getAdditionalResourcesForm("resources")#
                                    </cfif>
                              </cfoutput>
                        </div>
                  </cfsavecontent>
                  
                  <cfreturn output />
            </cfif>

            <!--- Donny: Basic Meta Tag version
            if columnNames is "txtMeta", then this form is the meta data --->
            <cfif isDefined("columnNames") and columnNames is "txtMeta">
                  <cfsavecontent variable="output">
                        <cfoutput>
                              <!--- retrieve keywords and description, will be copies from formData.query to formData.metaquery --->
                              <cfstoredproc datasource="#this.datasource#" procedure="getContentMeta" debug="yes">
                                    <cfprocparam cfsqltype="cf_sql_integer" value="#formData.webid#" type="in">
                                    <cfprocresult name="qryMeta">
                              </cfstoredproc>
      
                              <cfif not(isDefined("URL.id") and Val(URL.id) and isDefined("FORM.intVersionID") and Val(FORM.intVersionID))>
                                    <!--- Donny: for global metatag in Admin. > Website Control > Meta Data --->
                                    <cfquery name="qryData" datasource="#this.datasource#" cachedwithin="#this.queryCache#">
                                          SELECT       txtMetaKeywords, txtMetaDescription
                                          FROM       tblCompany
                                          WHERE       intCompanyID = #Val(this.companyID)#
                                    </cfquery>
                              </cfif>
      
                              <cfset blnInherit = ((not isDefined("qryData.txtMetaKeywords")) or (not isDefined("qryData.txtMetaDescription")) or (qryData.txtMetaKeywords is "" and qryData.txtMetaDescription is ""))>
      
                              <script>
                                    function jsMetaDisable(form, checked) {
                                          form.txtMetaKeywords.disabled = !checked;
                                          form.txtMetaDescription.disabled = !checked;
                                          
                                          if (checked){
                                                form.btnDelete_txtNameValues.style.visibility = "";
                                                form.btnMetaTag_txtNameValues.style.visibility = "";
                                          } else {
                                                form.btnDelete_txtNameValues.style.visibility = "hidden";
                                                form.btnMetaTag_txtNameValues.style.visibility = "hidden";
                                          }
                                    }
      
                                    <cfif (not blnInherit)>
                                          document.frmAddEdit.btnDelete_txtNameValues.style.visibility = ""
                                          document.frmAddEdit.btnMetaTag_txtNameValues.style.visibility = ""
                                    </cfif>
                                    
                                    onclick="jsMetaDisable(this.form, this.checked);"
                              </script>
                              <div class="default" style="padding: 17px; display: none;" id="txtMeta">
                                    <!--- todo :: 952 :: KJ :: 7 dec 2006 :: Change "Meta Data" [text] to "Metadata" [text] --->
                                    <input name="blnInherit" type="checkbox" <cfif not blnInherit> checked</cfif> onclick="jsMetaDisable(this.form, this.checked);"> #translate("Use Custom Metadata")#<br /><br />
                                    #this.language.translate("Enter any extra words you would like associated with this item.")#<br />
                                    #this.language.translate("These words will help this item show up in more search results.")#<br />
                                    <br />
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                          <tr>
                                                <td width="50%">
                                                      <font class="formCaption">#translate("Keywords")#:</font><br />
                                                      <textarea style="width: 240px; height: 130px;" class="formTextarea" name="txtMetaKeywords"<cfif blnInherit> disabled</cfif>><cfif blnInherit>#qryMeta.txtMetaKeywords#<cfelseif isDefined("qryData.txtMetaKeywords")>#qryData.txtMetaKeywords#</cfif></textarea>
                                                </td>
                                                <td width="50%">
                                                      <font class="formCaption">#translate("Description")#:</font><br />
                                                      <textarea style="width: 240px; height: 130px;" class="formTextarea" name="txtMetaDescription"<cfif blnInherit> disabled</cfif>><cfif blnInherit>#qryMeta.txtMetaDescription#<cfelseif isDefined("qryData.txtMetaDescription")>#qryData.txtMetaDescription#</cfif></textarea>
                                                </td>
                                          </tr>
                                    </table>
                              </div>
                        </cfoutput>
                  </cfsavecontent>
                  
                  <cfreturn output />
            </cfif>
            
            <!--- content containers petite tab --->
            <cfif isDefined("columnNames") and columnNames is "containers">
                  <cfset contentcontainer = createObject("component", "hb50.contentcontainers").init(this.CompanyID) />
                  <cfsavecontent variable="output">
                        <cfoutput>
                              <cfif isDefined('URL.id') and Val(URL.id)>
                                    #contentcontainer.getContentContainerForm("containers", Val(URL.id))#
                              <cfelse>
                                    #contentcontainer.getContentContainerForm("containers")#
                              </cfif>
                        </cfoutput>
                  </cfsavecontent>
                  
                  <cfreturn output />
            </cfif>
            
            <!--- tagging petite tab --->
            <cfif isDefined("columnNames") and columnNames is "tagging">
                  <!--- Jason: should we cache this tagging object?! --->
                  <cfset tagMgr = getObject("hb50.internal.CTagManager", this.CompanyID, true)>
                  <cfsavecontent variable="output">
                        <cfoutput>
                              <cfif isDefined('URL.id') and Val(URL.id)>
                                    #tagMgr.getTaggingForm("tagging", Val(URL.id))#
                              <cfelse>
                                    #tagMgr.getTaggingForm("tagging")#
                              </cfif>
                        </cfoutput>
                  </cfsavecontent>
                  
                  <cfreturn output />
            </cfif>
            
            <!--- if columnNames is "dtSchedule", then this form is the scheduling --->
            <cfif isDefined("columnNames") and columnNames is "dtStart,dtEnd">
                  <cfsavecontent variable="output">
                        <cfoutput>
                              <script type="text/javascript" src="js/swfobject.js"></script>
                              <!--- this div is set display:block; so that the flash will show up in opera (one time only). weird bug. --->
                              <div id="dtStart" style="display: block;" class="padding17">
                                    <cfif isDefined("qryData.dtStart") and isDate(qryData.dtStart)>
                                          <cfset value = qryData.dtStart>
                                    <cfelse>
                                          <cfset value = now()>
                                    </cfif>
                                    <input type="hidden" id="dtStart_hidden" name="dtStart_hidden" value="#DateFormat(value, "mmm-dd-yy")#">
                                    <fieldset class="formFieldset">
                                          <legend>
                                                <input name="dtStart_chk" type="checkbox" <cfif isDefined("qryData.dtStart") and qryData.dtStart neq "">checked</cfif>> #translate("Start Date and Time")#
                                          </legend>
                                          <table width="100%" border="0" cellspacing="12" class="formCaption">
                                                <tr>
                                                      <td width="210" >
                                                            <div id="flash_swf_start">
                                                            </div>
                                                            <script type="text/javascript">
                                                                  //not needed unless you want to reference the flash movie object later
                                                                  //var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
                                                                  
                                                                  // Handle all the the FSCommand messages in a Flash movie. Uncomment
                                                                  function dtStartflash_DoFSCommand(command, args)
                                                                  {
                                                                        //the line below is left as a guide in case you want to reference
                                                                        //the movie object
                                                                    //var weekviewObj = InternetExplorer ? weekview : document.dt;
                                                                    
                                                                    //alert(args);
                                                                    document.getElementById('dtStart_hidden').value = args;
                                                                  }
                                                                  // Hook for Internet Explorer
                                                                  if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
                                                                          navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1)
                                                                  {
                                                                        document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                                                        document.write('on error resume next \n');
                                                                        document.write('Sub dtStartflash_FSCommand(ByVal command, ByVal args)\n');
                                                                        document.write('  call dtStartflash_DoFSCommand(command, args)\n');
                                                                        document.write('end sub\n');
                                                                        document.write('</SCRIPT\> \n');
                                                                  }      
                                                               var so = new SWFObject("flash/weekview.swf", "dtStartflash", "200", "31", "7", "##336699");
                                                               so.addVariable("day","#Day(value)#");
                                                               so.addVariable("month","#Month(value)#");
                                                               so.addVariable("year","#Year(value)#");
                                                               so.write("flash_swf_start");
                                                            </script>
                                                      </td>
                                                      <td valign="top" align="left">
                                                            <input type="text" class="formTextbox" name="dtStart_time" id="dtStart_time" value="#TimeFormat(value, "h:MM tt")#" style="width: 50px;" maxlength="8">
                                                      </td>
                                                </tr>
                                          </table>
                                    </fieldset>      
                              </div>
                              <div id="dtEnd" style="display: block;" class="padding17">      
                                    <cfif isDefined("qryData.dtEnd") and isDate(qryData.dtEnd)>
                                          <cfset value = qryData.dtEnd>
                                    <cfelse>
                                          <cfset value = now()>
                                    </cfif>
                                    <input type="hidden" id="dtEnd_hidden" name="dtEnd_hidden" value="#DateFormat(value, "mmm-dd-yy")#">
                                    <fieldset class="formFieldset">
                                          <legend>
                                                <input type="checkbox" name="dtEnd_chk" <cfif isDefined("qryData.dtEnd") and qryData.dtEnd neq "">checked</cfif>> #translate("End Date and Time")#
                                          </legend>
                                          <table width="100%" border="0" cellspacing="12" class="formCaption">
                                                <tr>
                                                      <td width="210">
                                                            <div id="flash_swf_end">
                                                            </div>
                                                            <script type="text/javascript">                                                                  
                                                                  //not needed unless you want to reference the flash movie object later
                                                                  //var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
                                                                  
                                                                  // Handle all the the FSCommand messages in a Flash movie
                                                                  function dtEndflash_DoFSCommand(command, args)
                                                                  {
                                                                        //the line below is left as a guide in case you want to reference
                                                                        //the movie object
                                                                    //var weekviewObj = InternetExplorer ? weekview : document.weekview;
                                                                    
                                                                    //alert(args);
                                                                    document.getElementById('dtEnd_hidden').value = args;
                                                                  }
                                                                  // Hook for Internet Explorer
                                                                  if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
                                                                          navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1)
                                                                  {
                                                                        document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                                                        document.write('on error resume next \n');
                                                                        document.write('Sub dtEndflash_FSCommand(ByVal command, ByVal args)\n');
                                                                        document.write('  call dtEndflash_DoFSCommand(command, args)\n');
                                                                        document.write('end sub\n');
                                                                        document.write('</SCRIPT\> \n');
                                                                  }
                                                               var so = new SWFObject("flash/weekview.swf", "dtEndflash", "200", "31", "7", "##336699");
                                                               so.addVariable("day","#Day(value)#");
                                                               so.addVariable("month","#Month(value)#");
                                                               so.addVariable("year","#Year(value)#");
                                                               so.write("flash_swf_end");
                                                            </script>
                                                      </td>
                                                      <td valign="top" align="left">
                                                            <input type="text" class="formTextbox" name="dtEnd_time" id="dtEnd_time" value="#TimeFormat(value, "h:MM tt")#" style="width: 50px;" maxlength="8">
                                                      </td>
                                                </tr>
                                          </table>
                                    </fieldset>
                              </div>
                        </cfoutput>
                  </cfsavecontent>
                  
                  <cfreturn output />
            </cfif>

            <cfsavecontent variable="output">
                  <cfoutput>
                        <!--- First, display all the types that fit within a half row --->
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="formCaption">
                        <cfloop from="1" to="#ArrayLen(formData.columns)#" index="key">
                              <cfset i = formData.columns[key]>
                              
                              <cfif (not isDefined("columnNames")) or ListFindNoCase(columnNames, i.varname)>
                                    <!--- display all the non-html first (and assume HTML only shows up at end) --->
                                    <cfif not ListFind("#TYPES.HTML#,#TYPES.LIST#", i.type)>
                                            <cfif count mod 2 is 1>
                                                <tr>
                                            </cfif>
                                          <td width="50%" valign="<cfif i.type is TYPES.BOOLEAN>bottom<cfelse>top</cfif>">
                                                <cfif isDefined("qryData")>
                                                      #getFormItemDisplay(formData, i, qryData)#
                                                <cfelse>
                                                      #getFormItemDisplay(formData, i)#
                                                </cfif>
                                          </td>
                                            <cfif count mod 2 is 0>
                                                </tr>
                                            </cfif>
                                            <cfset count = count + 1>
                                      </cfif>
                                 </cfif>
                        </cfloop>
                        <cfif count mod 2 is 0>
                              <td>&nbsp;</td></tr>
                        </cfif>
            
                        <!--- display the types that require a full tab --->
                        <cfloop from="1" to="#ArrayLen(formData.columns)#" index="key">
                              <cfset i = formData.columns[key]>
                              <cfif (not isDefined("columnNames")) or ListFindNoCase(columnNames, i.varname)>
                                    <cfif ListFind("#TYPES.HTML#,#TYPES.LIST#", i.type)>
                                          <!--- display only html --->
                                          <tr>
                                                <td colspan="2" valign="top">
                                                <cfif isDefined("qryData")>
                                                      #getFormItemDisplay(formData, i, qryData)#
                                                <cfelse>
                                                      #getFormItemDisplay(formData, i)#
                                                </cfif>
                                                </td>
                                          </tr>
                                    </cfif>
                              </cfif>
                        </cfloop>
                        </table>
            
                        <!--- if there is a TYPE type, this javascript needs to come after all the form elements --->
                        <cfloop from="1" to="#ArrayLen(formData.columns)#" index="key">
                              <cfset i = formData.columns[key]>
                              <cfif i.type is TYPES.TYPE and ((not isDefined("columnNames")) or ListFindNoCase(columnNames, i.varname))>
                                    <script language="JavaScript">
                                          function hideAllForm() {
                                                <cfloop from="1" to="#ArrayLen(formData.columns)#" index="key">
                                                      <cfset k = formData.columns[key]>
                                                      <cfif k.type neq TYPES.TYPE>
                                                            document.getElementById('#k.varname#').style.display = 'none';
                                                      </cfif>
                                                </cfloop>
                                          }
                                          function changeType() {
                                                var type = document.getElementById('#i.varname#_select').selectedIndex;
                                                hideAllForm();
                                                <cfloop from="1" to="#ArrayLen(i.options)#" index="k">
                                                      if (type == #i.options[k].value#) {
                                                            <cfloop list="#i.options[k].fields#" index="varname">
                                                                  document.getElementById('#varname#').style.display = 'block';
                                                            </cfloop>
                                                      }
                                                </cfloop>
                                          }
                                          changeType();
                                    </script>
                                    <cfbreak>
                              </cfif>
                        </cfloop>
                  </cfoutput>
            </cfsavecontent>

            <cfreturn output />
      </cffunction>

      <cffunction name="getVersionForm" access="public" returntype="string" hint="Returns Version select box" output="false">
            <cfargument name="qryVersion" required="true" type="query">
            <cfargument name="intVersionID" required="true" type="numeric">
            <cfargument name="link" required="true" type="string">
            <cfargument name="formName" required="false" default="frmVersion">
            
            <cfscript>
                  var options = '';
                  var currentVersion = translate("Active Version");
                  var output = '';
            </cfscript>
                        
            <cfsavecontent variable="options">
                  <cfoutput query="qryVersion">
                        <cfif qryVersion.blnLive is 0 and arguments.intVersionID is qryVersion.intID>
                              <cfset currentVersion = "#DateFormat(qryVersion.dtAdded, "mmm dd yyyy")# #TimeFormat(qryVersion.dtAdded, "h:MMtt")#">
                        </cfif>
                        <option value="#qryVersion.intID#" <cfif arguments.intVersionID is qryVersion.intID>selected</cfif>><cfif qryVersion.blnLive is 1>#translate("Active Version")#<cfelse>#DateFormat(qryVersion.dtAdded, "mmm dd yyyy")# #TimeFormat(qryVersion.dtAdded, "h:MMtt")#</cfif></option>
                  </cfoutput>
            </cfsavecontent>
            <cfsavecontent variable="output">
                  <cfoutput>
                        <div id="versions" style="position:absolute; left:396px; top:294px; width:147px; height:15px; z-index:50" class="bevelEmbossStatus">
                              <div id="versionText" style="position:absolute; left:3px; top:1px; width:120px; height:11px; z-index:7">#currentVersion#</div>
                              <div id="versionsSelect" style="position:absolute; left:130px; top:-2px; width:15px; height:15px; z-index:6"><a onmouseover="this.style.cursor = 'pointer'; this.style.cursor = 'hand'; document.body.onbeforeunload = null;" onmouseout="if (window.jsSaveWarning) jsSaveWarning();" onclick="document.getElementById('versionList').style.visibility = 'visible'; document.getElementById('intVersionID').style.visibility = 'visible'; document.getElementById('intVersionID').focus();"><img src="images/btn_status_arrow.gif" width="15" height="15" border="0"></a></div>
                              <div id="versionList" style="position:absolute; left:-1px; top:-99px; width:141px; height:102px; z-index:6; visibility: hidden;">
                                    <form name="#arguments.formName#" action="#arguments.link#&versionid=value" method="post">
                                          <select class="selectSmall" style="width:147; visibility: hidden;" id="intVersionID" name="intVersionID" size="7" onChange='this.blur(); this.form.submit();' onblur="document.getElementById('versionList').style.visibility = 'hidden'; this.style.visibility = 'hidden';">
                                                #options#
                                          </select>
                                    </form>
                              </div>
                        </div>
                  </cfoutput>
            </cfsavecontent>
            
            <cfreturn output />
      </cffunction>

      <cffunction name="getLanguageForm" access="public" returntype="string" hint="Returns Version select box" output="false">
            <cfargument name="formName" required="false" default="frmLanguage">

            <cfif not (isDefined("id") and Val(id))>
                  <cfreturn "">
            </cfif>

            <!--- do the options, and also figure out which option we want to be displayed by default --->
            <cfquery name="qryTranslations" datasource="#this.datasource#" cachedwithin="#this.queryCache#">
                  SELECT       IT.intItemID, IT.intTranslateID, C.txtTitle
                  FROM       tblItemTranslate IT
                  LEFT JOIN tblItem I
                  ON             IT.intTranslateID = I.intID
                  LEFT JOIN tblNavigation N
                  ON             I.intWebID = N.intID
                  LEFT JOIN tblCompany C
                  ON             N.intCompanyID = C.intID
                  WHERE       IT.intItemID = #Val(id)#
                  OR            IT.intItemID IN
                                    (SELECT tblItemTranslate.intItemID
                                     FROM       tblItemTranslate
                                     WHERE       intTranslateID = #Val(id)#)
            </cfquery>

            <cfif not qryTranslations.recordCount>
                  <cfreturn "" />
            </cfif>

            <cfset currentVersion = translate("Original")>
            <cfset selectedIndex = 0>
            <cfsavecontent variable="options">
                  <cfoutput><option value="#qryTranslations.intItemID#">#translate("Original")#</option></cfoutput>
                  <cfoutput query="qryTranslations">
                        <option value="#intTranslateID#" <cfif intTranslateID is id>selected</cfif>>#txtTitle#</option>
                        <cfif intTranslateID is id>
                              <cfset currentVersion = txtTitle>
                              <cfset selectedIndex = currentrow>
                        </cfif>
                  </cfoutput>
            </cfsavecontent>

            <cfsavecontent variable="output">
                  <cfoutput>
                        <script>
                              function jsLaunchTranslation (itemID) {
                                    //window.open('popup.cfm?p=languageview&i=' + itemID + '', '', 'help=no,resizable=yes,scroll=no,status=no,modal=yes');
                                    showModelessDialog('popup.cfm?p=languageview&i=' + itemID + '', '', 'help=no;resizable=yes;scroll=no;status=no;center=yes');
                              }
                        </script>
                        <div id="languages" style="position:absolute; left:249px; top:294px; width:147px; height:15px; z-index:8" class="bevelEmbossStatus">
                              <div id="languageText" style="position:absolute; left:3px; top:1px; width:120px; height:11px; z-index:7">#currentVersion#</div>
                              <div id="languagesSelect" style="position:absolute; left:130px; top:-2px; width:15px; height:15px; z-index:6"><a onmouseover="this.style.cursor = 'pointer'; this.style.cursor = 'hand'; document.body.onbeforeunload = null;" onmouseout="if (window.jsSaveWarning) jsSaveWarning();" onclick="document.getElementById('languageList').style.visibility = 'visible'; document.getElementById('intLanguageID').focus();"><img src="images/btn_status_arrow.gif" width="15" height="15" border="0"></a></div>
                              <div id="languageList" style="position:absolute; left:-1px; top:-99px; width:141px; height:102px; z-index:6; visibility: hidden;">
                                    <select class="selectSmall" style="width:147;" id="intLanguageID" name="i" size="7" onclick='this.blur(); if (this.selectedIndex != #selectedIndex#) jsLaunchTranslation(this.value); this.selectedIndex = #selectedIndex#' onblur="document.getElementById('languageList').style.visibility = 'hidden';">
                                          #options#
                                    </select>
                              </div>
                        </div>
                  </cfoutput>
            </cfsavecontent>
            
            <cfreturn output />
      </cffunction>

      <!--- sets the treenav refresh status to true --->
      <cffunction name="refreshTreeNav" access="public" output="false">
            <cfargument name="newSubID" required="false" type="numeric">

            <cfif isDefined("arguments.newSubID")>
                  <cfset this.treenavsubid = arguments.newSubID>
            </cfif>
            <cfset this.treenavrefresh = true>
      </cffunction>

      <!--- sets the action message to be used by getStatus() --->
      <cffunction name="setActionMsg" access="public" output="false">
            <cfargument name="actionmsg" required="true" type="string">
            <cfargument name="blnTranslate" required="false" type="boolean" default="true">

            <cfif arguments.blnTranslate>
                  <cfset this.actionmsg = translate(arguments.actionmsg)>
            <cfelse>
                  <cfset this.actionmsg = arguments.actionmsg>
            </cfif>
      </cffunction>

      <!--- refresh the treenav --->
      <cffunction name="getStatus" access="public" output="false">
            <cfset var status = '' />
            <cfparam name="this.treenavsubid" default="0">
            
            <cfset status = '<div id="status" style="position:absolute; left:0px; top:294px; width:393px; height:15px; z-index:5" class="bevelEmbossStatus"><img src="images/shim.gif" width="3" height="13" align="absmiddle"><font color="##CC0000">#this.actionmsg#</font></div><div id="fakepagination" style="position:absolute; left:396px; top:294px; width:82px; height:15px; z-index:0" class="bevelEmbossStatus"></div><div id="faketotal" style="position:absolute; left:481px; top:294px; width:62px; height:15px; z-index:0" class="bevelEmbossStatus"></div>'>
            <!--- if there is an action msg, refresh