erikTsomik
asked on
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="courseschedul e2" extends="hb50.internal.uli sting">
      <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(comp anyID)>
           <cfset this.workflow = getObject("hb50.workflow", companyID, true)>
           <cfset this.display = getObject("hb50.display",c ompanyID,t rue)>
           <cfset this.media = getObject("hb50.media",com panyID,tru e)>
           <cfset this.navigation = getObject("hb50.navigation ",companyI D,true)>
          Â
           <!--- configuration data --->
           <cfxml casesensitive="no" variable="this.xmlConfigDa ta">
                 <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="blnCategoryListin g" title="Category Listing" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="blnCategoryPageCo ntent" title="Show Page Content" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="blnCategoryDescri ption" 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="blnCategoryImageW rap" title="Wrap Text" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="intCategoryImageA lign" title="Category Image Alignment" type="#this.TYPES.SELECT#" required="false"/>
                            <item varname="intCategoryImageW idth" title="Category Image width" type="#this.TYPES.NUMBER#" required="false"/>                           Â
                            <item varname="intCategoryImageH eight" title="Category Image Height" type="#this.TYPES.NUMBER#" required="false"/>
                            <item varname="intCategoryLayout Type" title="Category Layout" type="#this.TYPES.SELECT#" required="false"/>
                            <item varname="blnCategoryPagina tion" title="Show Pagination" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="intCategoryDispla yItems" title="Items to Display" type="#this.TYPES.NUMBER#" required="false"/>
                            <item varname="blnItemListingPag eContent" title="Show Page Content" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="blnItemListingDes cription" title="Show Item Description" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="intItemListingDes criptionTy pe" title="Item Description Type" type="#this.TYPES.SELECT#" required="false"/>
                            <item varname="intItemListingDes criptionLe ngth" title="Item Description Length" type="#this.TYPES.SELECT#" default="300" required="false"/>
                            <item varname="txtItemListingDes criptionAc tion" title="Call To Action" type="#this.TYPES.TEXT#" default="more..." required="false"/>
                            <item varname="blnItemListingSea rch" title="Show Item Search Form" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="blnItemListingAnc hor" title="Show Item Anchor" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="blnItemListingTit le" title="Show Item Title" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="intItemListingDat eLayoutTyp e" title="Date Layout Type" type="#this.TYPES.SELECT#" required="false"/>
                            <item varname="intItemListingLay outType" title="Item Listing Layout" type="#this.TYPES.SELECT#" required="false"/>
                            <item varname="blnItemListingIma ge" title="Show Item Image" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="blnItemListingIma geWrap" title="Wrap Text" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="intItemListingIma geWidth" title="Image Width" type="#this.TYPES.NUMBER#" required="false"/>
                            <item varname="intItemListingIma geHeight" title="Image Height" type="#this.TYPES.NUMBER#" required="false"/>
                            <item varname="intItemListingIma geAlign" title="Item Image Alignment" type="#this.TYPES.SELECT#" required="false"/>
                            <item varname="blnItemListingPag ination" title="Show Pagination" type="#this.TYPES.BOOLEAN# " required="false"/>                           Â
                            <item varname="intItemListingDis playItems" 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="blnItemDetailPage Content" title="Show Page Content" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="blnItemDetailReso urce" title="Show Ralated Resources" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="txtItemDetailReso urceCaptio n" title="Related Resource Caption" type="#this.TYPES.TEXT#" required="false"/>
                            <item varname="blnItemDetailImag e" title="Show Image" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="intItemDetailImag eAlign" title="Item Image Alignment" type="#this.TYPES.SELECT#" required="false"/>
                            <item varname="intItemDetailImag eWidth" title="Item Image width" type="#this.TYPES.NUMBER#" required="false"/>
                            <item varname="intItemDetailImag eHeight" title="Item Image Height" type="#this.TYPES.NUMBER#" required="false"/>
                            <item varname="blnNotification" title="Send Notification" type="#this.TYPES.BOOLEAN# " required="false"/>
                            <item varname="txtNotificationFr omEmail" title="From Email" type="#this.TYPES.TEXT#" default="#this.qryCompany. txtEmail#" required="false"/>
                            <item varname="txtNotificationFr omName" title="From Name" type="#this.TYPES.TEXT#" required="false"/>
                            <item varname="txtNotificationSu bject" title="Notification Subject" type="#this.TYPES.TEXT#" required="false"/>
                            <item varname="txtNotificationMe ssage" title="Notification Message" type="#this.TYPES.HTML#" required="false"/>
                            <item varname="blnSecurityEnable d" 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.xmlCon figData);
                                Â
                 this.configData.tabs[1] = StructNew();
                 this.configData.tabs[1].ca ption = "Fields";
                 this.configData.tabs[1].co lumnlist = "blnAbstract,blnDate,blnIm age,blnLin k,blnResou rce,blnAdd ress,blnPh one,blnFax ,blnEmail" ;
                 this.configData.tabs[2] = StructNew();
                 this.configData.tabs[2].ca ption ="Category Listing";
                 this.configData.tabs[2].co lumnlist = "blnCategoryListing,blnCat egoryPageC ontent,bln CategoryDe scription, blnCategor ySearch,bl nCategoryI mage,blnCa tegoryImag eWrap,blnC ategoryIma geAlign,in tCategoryI mageWidth, intCategor yImageHeig ht,blnCate goryPagina tion,intCa tegoryDisp layItems,i ntCategory LayoutType ";
                                           Â
                 this.configData.tabs[3] = StructNew();
                 this.configData.tabs[3].ca ption ="Item Listing";
                 this.configData.tabs[3].co lumnlist = "blnItemListingPageContent ,blnItemLi stingTitle ,intItemLi stingDateL ayoutType, blnItemLis tingDescri ption,intI temListing Descriptio nType,intI temListing Descriptio nLength,tx tItemListi ngDescript ionAction, blnItemLis tingSearch ,blnItemLi stingAncho r,intItemL istingLayo utType,bln ItemListin gImage,bln ItemListin gImageWrap ,intItemLi stingImage Width,intI temListing ImageHeigh t,intItemL istingImag eAlign,bln ItemListin gPaginatio n,intItemL istingDisp layItems";
                Â
                 this.configData.tabs[4] = StructNew();
                 this.configData.tabs[4].ca ption ="Item Detail";
                 this.configData.tabs[4].co lumnlist = "blnItemDetail,blnItemDeta ilPageCont ent,blnIte mDetailRes ource,txtI temDetailR esourceCap tion,blnIt emDetailIm age,intIte mDetailIma geAlign,in tItemDetai lImageWidt h,intItemD etailImage Height";
                Â
                 this.configData.tabs[5] = StructNew();
                 this.configData.tabs[5].ca ption ="Notification";
                 this.configData.tabs[5].co lumnlist = "blnNotification,txtNotifi cationFrom Email,txtN otificatio nFromName, txtNotific ationSubje ct";
                Â
                 this.configData.tabs[6] = StructNew();
                 this.configData.tabs[6].ca ption = "Notification Message";
                 this.configData.tabs[6].co lumnList = "txtNotificationMessage";
                Â
                 this.configData.tabs[7] = StructNew();
                 this.configData.tabs[7].ca ption = "Security";
                 this.configData.tabs[7].co lumnList = "blnSecurityEnabled,intRol eIDs";
                Â
                 this.configData.blnWorkflo w = false;
                 this.configData.blnApprova l = false;
                 this.configData.blnLock = false;
                 this.configData.blnVersion = false;
                 this.configData.blnDelete = false;
                 this.configData.blnPreview = false;
                 this.configData.blnCategor y = false;
                 this.configData.blnSchedul ing = false;
                 this.configData.blnMeta = false;
                 this.configData.blnResourc es = false;
                 this.configData.blnOrder = false;
                 this.configData.blnExtraCo lumns = false;
           </cfscript>           Â
           <cfset this.workflow.verifyColumn s(this.con figData)>
           <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.da ta.fronten d.xmltext" )>
                 <cfset this.frontendDisplay = this.xmlData.data.frontend .xmltext>
           </cfif>
          Â
           <!--- added stored procedure to pull course numbers, titles for drop-down--->     Â
           <cfstoredproc datasource='#this.datasour ce#' procedure='qryCourseNumber s'>
                 <cfprocresult name='qryCourseNumbers'>                Â
                 <cfprocparam type='In' cfsqltype='CF_SQL_varCHAR' variable='@AY' value='07-08' null='no'></cfprocparam>
                 <cfswitch expression="#this.companyi d#">
                 <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.xmlDat a);
                 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=intCourseI D.options[ intCourseI D.selected Index].tex t;";
                 ArrayPrepend(this.formData .columns, x);     Â
                Â
                 this.formData.tabs[tabCoun t] = StructNew();
                 this.formData.tabs[tabCoun t].caption = "Details";
                 this.formData.tabs[tabCoun t].columnl ist = "txtTitle,intCategoryID,in tCourseID, blnCCSSLin k";
                 if (qryConfig.blnImage is 1) {
                      this.formData.tabs[tabCoun t].columnl ist = this.formData.tabs[tabCoun t].columnl ist & ',intImageID';
                 }
                Â
                 if (qryConfig.blnLink is 1) {
                      this.formData.tabs[tabCoun t].columnl ist = this.formData.tabs[tabCoun t].columnl ist & ',txtLink';
                 }
                 if (qryConfig.blnSecurityEnab led is 1) {
                      this.formData.tabs[tabCoun t].columnl ist = this.formData.tabs[tabCoun t].columnl ist & ',blnPrivate';
                 }
                Â
                Â
                Â
                Â
                Â
                Â
                 if (qryConfig.blnDate is 1) {
                      tabCount = tabcount + 1;
                      this.formData.tabs[tabCoun t] = StructNew();
                      this.formData.tabs[tabCoun t].caption = "Date";
                      this.formData.tabs[tabCoun t].columnl ist = '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[tabCoun t] = StructNew();
                      this.formData.tabs[tabCoun t].caption = "Address";
                      this.formData.tabs[tabCoun t].columnl ist = '';
                 }
                Â
                 if (qryConfig.blnAddress is 1) {
                      this.formData.tabs[tabCoun t].columnl ist = ListAppend(this.formData.t abs[tabCou nt].column list,'txtA ddress,txt City,txtPr ovince,txt Country,tx tPostalCod e');
                 }
                 if (qryConfig.blnPhone is 1) {
                      this.formData.tabs[tabCoun t].columnl ist = ListAppend(this.formData.t abs[tabCou nt].column list,'txtP hone,txtTo llFree');
                 }
                 if (qryConfig.blnFax is 1) {                      Â
                      this.formData.tabs[tabCoun t].columnl ist = ListAppend(this.formData.t abs[tabCou nt].column list,'txtF ax');
                 }
                 if (qryConfig.blnEmail is 1) {
                      this.formData.tabs[tabCoun t].columnl ist = ListAppend(this.formData.t abs[tabCou nt].column list,'txtE mail');
                 }
                 if (qryConfig.blnAbstract is 1) {
                      tabCount = tabCount + 1;
                      this.formData.tabs[tabCoun t] = StructNew();
                      this.formData.tabs[tabCoun t].caption = "Abstract";
                      this.formData.tabs[tabCoun t].columnl ist = "txtAbstract";
                 }
                Â
                 tabCount = tabCount + 1;
                 this.formData.tabs[tabCoun t] = StructNew();
                 this.formData.tabs[tabCoun t].caption = "Body";
                 this.formData.tabs[tabCoun t].columnl ist = "txtDescription";
                Â
                 this.formData.notification TabIndex = 0;
                 if (qryConfig.blnNotification is 1) {
                      tabCount = tabCount + 1;
                      this.formData.tabs[tabCoun t] = StructNew();
                      this.formData.tabs[tabCoun t].caption = "Notification";
                      this.formData.tabs[tabCoun t].columnl ist = "blnNotification";
                      this.formData.notification TabIndex = 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.blnSchedulin g = 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="blnShowCategoryTi tle" 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.xmlCat Data);
                                Â
                 this.catData.tabs[1] = StructNew();
                 this.catData.tabs[1].capti on = "Title";
                 this.catData.tabs[1].colum nlist = "txtTitle,blnShowCategoryT itle,intCa tegoryID";
                 if (qryConfig.blnCategoryImag e is 1) {
                      this.catData.tabs[1].colum nlist = this.catData.tabs[1].colum nlist & ",intImageID";
                 }
                                Â
                 this.catData.tabs[2] = StructNew();
                 this.catData.tabs[2].capti on = "Description";
                 this.catData.tabs[2].colum nlist = "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.blnExtraColu mns = false;
                 this.listData.columns = xmlDataToArray(this.xmlLis tData);
           </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.blnExtraColu mns = false;
                 this.roleData.columns = xmlDataToArray(this.xmlRol eData);
           </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(thi s.catData) />
           <cfelse>
                 <cfreturn this.workflow.getQuery(thi s.formData ) />
           </cfif>
      </cffunction>
      <!--- return list of ulisting categories --->
      <cffunction name="getCategoryQuery" access="private" returntype="query">
           <cfset var qryCategory = ''>
          Â
           <cfquery name="qryCategory" datasource="#this.datasour ce#" cachedwithin="#this.queryC ache#">
                 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.datasour ce#" cachedwithin="#this.queryC ache#">
                 SELECT     Â
                      <cfif this.formData.blnCategory>
                        isnull(isnull(tblItem.intC ategoryID, #this.formData.tablename#. intCategor yID), 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.datatyp e)#
                      AND tblNavigation.intCompanyID = #this.companyID#
                      AND tblItem.blnDeleted = 0
                      AND tblItem.intWebID = #this.formData.webid#
                      <cfif arguments.blnLive is true AND this.formData.blnSchedulin g>
                            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#. intCategor yID = #URL.c#
                      </cfif>
                      <cfif isDefined("ikeywords") and Len(Trim(ikeywords))>
                            AND (#this.formData.tablename# .txtTitle LIKE N'%#ikeywords#%' OR #this.formData.tablename#. txtDescrip tion LIKE '%#ikeywords#%'
                                       <cfif qryConfig.blnAbstract is 1>OR #this.formData.tablename#. txtAbstrac t 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#. txtProvinc e LIKE N'%#ikeywords#%' OR #this.formData.tablename#. txtProvinc e LIKE '%#ikeywords#%'
                                            OR #this.formData.tablename#. txtCountry LIKE N'%#ikeywords#%' OR #this.formData.tablename#. txtCountry LIKE '%#ikeywords#%'
                                            OR #this.formData.tablename#. txtPostalC ode LIKE N'%#ikeywords#%' OR #this.formData.tablename#. txtPostalC ode 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.form Data.sortc olumn# #this.formData.sortdirecti on#
                      </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.datasour ce#" maxrows="1" cachedwithin="#this.queryC ache#">
                 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.datasour ce#">
                 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.intRole ID)>
          Â
           <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.datasour ce#">
                 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.getDirecto ry(qryLogi nPage.intI D) & "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.formDat a.columns) #" index="i">
                 <cfif ListFindNoCase("#TYPES.TEX T#,#TYPES. HTML#", this.formData.columns[i].t ype)>
                      <cfset list = ListAppend(list, this.formData.columns[i].v arname)>
                 </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="getCategorySearchCol umns" access="public" returntype="string">
           <cfset var i = 0>
           <cfset var list = "">
          Â
           <cfloop from="1" to="#ArrayLen(this.catData .columns)# " index="i">
                 <cfif ListFindNoCase("#TYPES.TEX T#,#TYPES. HTML#", this.catData.columns[i].ty pe)>
                      <cfset list = ListAppend(list, this.catData.columns[i].va rname)>
                 </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.loggedI n") 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.blnSecurityEnabl ed IS 1 and (qryConfig.blnItemListingD escription or qryConfig.blnItemListingAn chor)>
                 <cfif not privateAccess()>
                      <cfset qryAll = SelectFrom(qryAll,"blnPriv ate", 0)>
                 </cfif>
           </cfif>
                Â
                Â
           <!--- output item details --->                      Â
           <cfif isDefined("URL.i")>
                 <cfif qryConfig.blnItemDetailPag eContent 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.blnItemListingAn chor is 1>
                 <cfif qryConfig.blnItemListingPa geContent is 0>
                      <cfset output.blnHideContent = true>
                 </cfif>
                 <cfset output.body = getAnchoredListing(qryConf ig, 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.blnCategoryListi ng is 0 OR isDefined("URL.c")>
                 <cfif qryConfig.blnItemListingPa geContent 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.blnCategoryPageC ontent is 0>
                 <cfset output.blnHideContent = true>
           </cfif>
          Â
           <!--- output category listing --->                Â
           <cfset output.body = getCategoryListing(qryConf ig, 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.intCatego ryID = qryDistinctCats.intCategor yID
                      ORDER BY qryAllCategories.intOrder
                 </cfquery>
           </cfif>
          Â
           <cfsavecontent variable="listingOutput">
                 <!--- output search form is category search is enabled --->
                 <cfif qryConfig.blnCategorySearc h is 1>
                      <cfoutput>
                      <form name="hbsrchmod" id="hbsrchmod" method="post" action="#SCRIPT_NAME#">
                            <input type="text" name="ckeywords" id="hbsrchkey" <cfif isDefined('ckeywords')>val ue="#ckeyw ords#"</cf if>/>
                            <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.blnCategoryPagin ation is 1>
                            <cfset recordsToDisplay = Val(qryConfig.intCategoryD isplayItem s)>
                            <cfif qryConfig.intCategoryLayou tType is this.COLUMN_LAYOUT.DOUBLE>
                                 <cfset recordsToDisplay = recordsToDisplay * 2>
                            </cfif>
                            <cfset thepagination = this.display.getPagination Display(qr yCategorie s.recordCo unt, recordsToDisplay, URL.sr, '')>
                      </cfif>
                                      Â
                      <cfif Len(Trim(thepagination))>< cfoutput># thepaginat ion#</cfou tput></cfi f>
                      <div id="hbcatmod">
                            <cfif qryConfig.intCategoryLayou tType 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.intCategoryImage Align is this.IMAGE_ALIGN.INLINE> <!--- image inline --->
                                                       <img src="#this.workflow.setSSL Prefix(thi s.media.ge tURL(intIm ageID,Val( qryConfig. intCategor yImageWidt h),Val(qry Config.int CategoryIm ageHeight) ),this.web id)#" class="hbcatinl" border="0"/>
                                                       <h5><a href="#SCRIPT_NAME#?c=#int CategoryID #">#txtTit le#</a></h 5>
                                                  <cfelse> <!--- image left or right --->
                                                       <h5><a href="#SCRIPT_NAME#?c=#int CategoryID #">#txtTit le#</a></h 5>
                                                       <img src="#this.workflow.setSSL Prefix(thi s.media.ge tURL(intIm ageID,Val( qryConfig. intCategor yImageWidt h),Val(qry Config.int CategoryIm ageHeight) ),this.web id)#" <cfif qryConfig.intCategoryImage Align EQ this.IMAGE_ALIGN.LEFT>clas s="hbcatlf t"<cfelse> class="hbc atrht"</cf if> border="0" />
                                                  </cfif>
                                            <cfelse> <!--- without image --->
                                                  <h5><a href="#SCRIPT_NAME#?c=#int CategoryID #">#txtTit le#</a></h 5>
                                            </cfif>                                                                       Â
                                            <cfif qryConfig.blnCategoryDescr iption is 1>
                                                  <!--- convertTokens() --->
                                                  #this.workflow.convertToke ns(txtDesc ription,fa lse,this.w ebid)#
                                            </cfif>
                                            </div>
                                       <cfif count mod 2 is 0>
                                            <div class="clr"> </div>
                                       </div>
                                       </cfif>
                                       <cfset count = count + 1>
                                 </cfoutput>
                                 <cfif count mod 2 is 0>
                                       <div class="clr"> </div>
                                 </div>
                                 </cfif>                                 Â
                            <cfelse> <!--- one column --->
                                 <cfif qryConfig.blnCategoryImage is 1>
                                       <cfif qryConfig.intCategoryImage Align is this.IMAGE_ALIGN.LEFT or qryConfig.intCategoryImage Align is this.IMAGE_ALIGN.RIGHT>
                                            <cfif qryConfig.blnCategoryImage Wrap is 1 >
                                                  <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay #">
                                                       <h5><a href="#SCRIPT_NAME#?c=#int CategoryID #">#txtTit le#</a></h 5>
                                                       <cfif intImageID gt 0><a href="#SCRIPT_NAME#?c=#int CategoryID #"><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intCate goryImageW idth),Val( qryConfig. intCategor yImageHeig ht))#" <cfif qryConfig.intCategoryImage Align is this.IMAGE_ALIGN.LEFT>clas s="hbcatlf t"<cfelse> class="hbc atrht"</cf if> border="0" /></a></cfif>
                                                       <cfif qryConfig.blnCategoryDescr iption is 1>#this.workflow.convertTo kens(txtDe scription) #</cfif>
                                                       <div class="clr"> </div>
                                                  </cfoutput>
                                            <cfelse>     Â
                                                  <cfset roundedWidth = roundImageWidth(Val(qryCon fig.intCat egoryImage Width))>                                      Â
                                                  <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay #">
                                                       <cfif qryConfig.intCategoryImage Align is this.IMAGE_ALIGN.LEFT>
                                                       <div class="hbcatlft#roundedWid th#"><cfif intImageID GT 0><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intCate goryImageW idth),Val( qryConfig. intCategor yImageHeig ht))#" border="0"/></cfif></div>
                                                       <div class="hbcatrht#roundedWid th#">
                                                       <cfelse>
                                                       <div class="hbcatrht#roundedWid th#"><cfif intImageID GT 0><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intCate goryImageW idth),Val( qryConfig. intCategor yImageHeig ht))#"  border="0"/></cfif></div>
                                                       <div class="hbcatlft#roundedWid th#">     Â
                                                       </cfif>
                                                       <h5><a href="#SCRIPT_NAME#?c=#int CategoryID #">#txtTit le#</a></h 5>
                                                       <cfif qryConfig.blnCategoryDescr iption is 1>#this.workflow.convertTo kens(txtDe scription) #</cfif>
                                                       </div>
                                                       <div class="clr"> </div>
                                                  </cfoutput>                                      Â
                                            </cfif>                                      Â
                                       <cfelse> <!--- this.IMAGE_ALIGN.INLINE --->
                                            <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay #">
                                                  <cfif intImageID GT 0><img src="#this.workflow.setSSL Prefix(thi s.media.ge tURL(intIm ageID,Val( qryConfig. intCategor yImageWidt h),Val(qry Config.int CategoryIm ageHeight) ),this.web id)#"  border="0"  /></cfif>
                                                  <h5><a href="#SCRIPT_NAME#?c=#int CategoryID #">#txtTit le#</a></h 5>
                                                  <cfif qryConfig.blnCategoryDescr iption is 1>#this.workflow.convertTo kens(txtDe scription) #</cfif>
                                                  <div class="clr"> </div>
                                            </cfoutput>
                                       </cfif>
                                 <cfelse>
                                       <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay #">
                                            <h5><a href="#SCRIPT_NAME#?c=#int CategoryID #">#txtTit le#</a></h 5>
                                            <cfif qryConfig.blnCategoryDescr iption is 1>#this.workflow.convertTo kens(txtDe scription) #</cfif>
                                            <div class="clr"> </div>
                                       </cfoutput>
                                 </cfif>
                            </cfif> <!--- column layout --->                                                            Â
                      </div>
                      <cfif Len(Trim(thepagination))>< cfoutput># thepaginat ion#</cfou tput></cfi f>                Â
                 </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,'intCate goryID',UR L.c)>
           </cfif>     Â
                Â
           <cfsavecontent variable="listingOutput">
                 <!--- <cfif qryConfig.blnSecurityEnabl ed is 1 AND Len(Trim(rids)) AND NOT ( isDefined("SESSION.loggedI n_#this.we bid#") AND SESSION['loggedIn_#this.we bid#'] ) AND Len(Trim(loginLink))> --->
                  <cfif qryConfig.blnSecurityEnabl ed IS 1 AND (qryConfig.blnItemListingA nchor or qryConfig.blnItemListingDe scription) IS 1 AND NOT ( isDefined("SESSION.loggedI n") 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.blnItemListingSe arch 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')>val ue="#ikeyw ords#"</cf if> />
                            <select name="c" id="hbsrchsel">
                                 <option value="0">All</option>
                                 <cfloop query="qryCategories">
                                       <option value="#qryCategories.intC ategoryID# " <cfif isDefined("URL.c") AND qryCategories.intCategoryI D is URL.c>selected</cfif>>#qry Categories .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.blnItemListingPa gination is 1>
                            <cfset recordsToDisplay = Val(qryConfig.intItemListi ngDisplayI tems)>
                            <cfif qryConfig.intItemListingLa youtType is this.COLUMN_LAYOUT.DOUBLE>
                                 <cfset recordsToDisplay = recordsToDisplay * 2>
                            </cfif>
                            <cfset thepagination = this.display.getPagination Display(qr yItems.rec ordCount, recordsToDisplay, URL.sr, '')>
                      </cfif>
                     Â
                      <cfset callAction = 'more...'>
                      <cfif Len(Trim(qryConfig.txtItem ListingDes criptionAc tion))>
                            <cfset callAction = qryConfig.txtItemListingDe scriptionA ction>
                      </cfif>                      Â
                                      Â
                      <cfif Len(Trim(thepagination))>< cfoutput># thepaginat ion#</cfou tput></cfi f>
                           Â
                      <div id="hblistmod">                Â
                            <cfif qryConfig.intItemListingLa youtType 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=#intItemI D#">
                                                  <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.blnItemListingIm age is 1 AND qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.INLINE AND Val(intImageID)>
                                                        <cfif Len(Trim(txtURL))>
                                                             <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intItem ListingIma geWidth),V al(qryConf ig.intItem ListingIma geHeight)) #" border="0" class="hblistinl" /></a>
                                                       <cfelse>
                                                             <img src="#this.workflow.setSSL Prefix(thi s.media.ge tURL(intIm ageID,Val( qryConfig. intItemLis tingImageW idth),Val( qryConfig. intItemLis tingImageH eight)),th is.webid)# " border="0" class="hblistinl" />                                                            Â
                                                       </cfif>                                                  Â
                                                  </cfif>                                                  Â
                                                  <cfif qryConfig.blnItemListingTi tle 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))><cf set addressLine2 = addressLine2 & ' #txtProvince#,'></cfif>
                                                       <cfif Len(Trim(txtPostalCode))>< cfset addressLine2 = addressLine2 & ' #txtPostalCode#'></cfif>
                                                       <cfset addressLine2 = addressLine2 & ' #txtCountry#'>
                                                       <cfif Len(Trim(addressLine1))><c fset infoList = infoList & '<li>#addressLine1#</li>'> </cfif>
                                                       <cfif Len(Trim(addressLine2))><c fset 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))><cf set 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.blnItemListingIm age is 1 AND qryConfig.intItemListingIm ageAlign NEQ this.IMAGE_ALIGN.INLINE AND Val(intImageID)>                                                       Â
                                                       <cfif Len(Trim(txtURL))>
                                                             <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intItem ListingIma geWidth),V al(qryConf ig.intItem ListingIma geHeight)) #" border="0" <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.LEFT>clas s="hblistl ft"<cfelse >class="hb listrht"</ cfif>/></a >
                                                       <cfelse>
                                                             <img src="#this.workflow.setSSL Prefix(thi s.media.ge tURL(intIm ageID,Val( qryConfig. intItemLis tingImageW idth),Val( qryConfig. intItemLis tingImageH eight)),th is.webid)# " border="0" <cfif qryConfig.intItemListingIm ageAlign EQ this.IMAGE_ALIGN.LEFT>clas s="hblistl ft"<cfelse >class="hb listrht"</ cfif>/>                                                       Â
                                                       </cfif>
                                                  </cfif>     Â
                                                  <cfif qryConfig.blnItemListingDe scription is 1>
                                                       <cfif qryConfig.intItemListingDe scriptionT ype is this.DISPLAY_TYPES.MEMO>
                                                             #txtAbstract#
                                                       <cfelseif qryConfig.intItemListingDe scriptionT ype is this.DISPLAY_TYPES.TRIMMED AND Val(qryConfig.intItemListi ngDescript ionLength) >     Â
                                                             <!--- Thomas Auguest 29 2006: More... option doesn't work for two column item listing. START --->
                                                             <!--- <cfif Len(Trim(txtURL))>
                                                                  #this.display.memoFormat(t xtDescript ion, qryConfig.intItemListingDe scriptionL ength, ' [ <a href="#txtURL#">#callActio n#</a> ]')#
                                                             <cfelse>
                                                                  #this.display.memoFormat(t xtDescript ion, qryConfig.intItemListingDe scriptionL ength, '')#
                                                             </cfif> --->
                                                             #this.display.memoFormat(t xtDescript ion, qryConfig.intItemListingDe scriptionL ength, ' [ <a href="#SCRIPT_NAME#?i=#int ItemID#"># callAction #</a> ]')#
                                                             <!--- Thomas Auguest 29 2006: More... option doesn't work for two column item listing. END--->
                                                       <cfelse> <!--- full --->
                                                             <!--- convertTokens() --->
                                                             #this.workflow.convertToke ns(txtDesc ription,fa lse,this.w ebid)#
                                                       </cfif>                                                 Â
                                                  </cfif>
                                            </div>                                            Â
                                       <cfif count MOD 2 is 0>           Â
                                            <div class="clr"> </div>                                            Â
                                       </div>
                                       </cfif>
                                       <cfset count = count + 1>                                      Â
                                 </cfoutput>
                                 <cfif count MOD 2 is 0>
                                       <div class="clr"> </div>
                                 </div>
                                 </cfif>     Â
                            <cfelse> <!--- single column --->
                                 <cfif qryConfig.blnDate is 1 AND qryConfig.intItemListingDa teLayoutTy pe is this.DATE_LAYOUT_TYPES.ONE LINE>
                                                                       Â
                                       <cfoutput query="qryItems" startrow="#URL.sr#" maxrows="#recordsToDisplay #">
                                            <div class="hblistlft"><cfif isDate(dtDate)><strong><a href="#SCRIPT_NAME#?i=#int ItemID#"># DateFormat (dtDate,'m mm dd, yyyy')#</a></strong></cfif ></div>
                                            <div class="hblistrht75">
                                                  <cfif qryConfig.blnItemListingTi tle is 1><strong><a href="#SCRIPT_NAME#?i=#int ItemID#"># txtTitle#< /a></stron g></cfif>
                                                  <cfif qryConfig.blnItemListingDe scription is 1>
                                                       <cfif qryConfig.intItemListingDe scriptionT ype is this.DISPLAY_TYPES.MEMO>
                                                             #txtAbstract#
                                                       <cfelseif qryConfig.intItemListingDe scriptionT ype is this.DISPLAY_TYPES.TRIMMED AND Val(qryConfig.intItemListi ngDescript ionLength) >     Â
                                                             #this.display.memoFormat(t xtDescript ion, qryConfig.intItemListingDe scriptionL ength, ' [ <a href="#SCRIPT_NAME#?i=#int ItemID#"># callAction #</a> ]')#
                                                       <cfelse> <!--- full --->
                                                             <!--- convertTokens() --->
                                                             #this.workflow.convertToke ns(txtDesc ription,fa lse,this.w ebid)#
                                                       </cfif>                                                 Â
                                                  </cfif>
                                            </div>
                                       </cfoutput>
                                 <cfelse> <!--- no date or date layout is two line --->
                                       <cfset roundedWidth = roundImageWidth(Val(qryCon fig.intIte mListingIm ageWidth)) >                                      Â
                                       <cfoutput query="qryItems" startrow="#URL.sr#" maxrows="#recordsToDisplay #">
                                            <cfset txtTarget = ''>                                      Â
                                            <cfif qryConfig.blnItemDetail is 1>
                                                  <cfset txtURL = '#SCRIPT_NAME#?i=#intItemI D#'>
                                            <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.blnItemListingIm age is 1 AND Val(intImageID)>                                                 Â
                                                  <cfif qryConfig.blnItemListingIm ageWrap is 1 OR qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.INLINE AND Val(intImageID)> <!--- image wrap --->
                                                       <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.RIGHT> <!--- image right --->
                                                            Â
                                                             <cfif Len(Trim(txtURL))>                                                                  Â
                                                                  <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intItem ListingIma geWidth),V al(qryConf ig.intItem ListingIma geHeight)) #" border="0" class="hblistrht"/></a>
                                                             <cfelse>
                                                                  <img src="#this.workflow.setSSL Prefix(thi s.media.ge tURL(intIm ageID,Val( qryConfig. intItemLis tingImageW idth),Val( qryConfig. intItemLis tingImageH eight)),th is.webid)# " border="0" class="hblistrht"/>
                                                             </cfif>                                                            Â
                                                       <cfelse> <!--- image left or inline --->     Â
                                                             <cfif Len(Trim(txtURL))>
                                                                  <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intItem ListingIma geWidth),V al(qryConf ig.intItem ListingIma geHeight)) #" border="0" <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.LEFT>clas s="hblistl ft"<cfelse >class="hb listinl"</ cfif> /></a>
                                                             <cfelse>
                                                                  <img src="#this.workflow.setSSL Prefix(thi s.media.ge tURL(intIm ageID,Val( qryConfig. intItemLis tingImageW idth),Val( qryConfig. intItemLis tingImageH eight)),th is.webid)# " border="0" <cfif qryConfig.intItemListingIm ageAlign EQ this.IMAGE_ALIGN.LEFT>clas s="hblistl ft"<cfelse >class="hb listinl"</ cfif> />                                                                  Â
                                                             </cfif>
                                                       </cfif>
                                                  <cfelse> <!--- image no wrap --->                                                                                                              Â
                                                       <cfif Len(Trim(txtURL))>
                                                             <div <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.LEFT>clas s="hblistl ft"<cfelse >class="hb listrht"</ cfif>><a href="#txtURL#"><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intItem ListingIma geWidth),V al(qryConf ig.intItem ListingIma geHeight)) #" border="0"/></a></div>
                                                             <div <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.LEFT>clas s="hblistr ht#rounded Width#"<cf else>class ="hblistlf t#roundedW idth#"</cf if>>
                                                       <cfelse>
                                                             <div <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.LEFT>clas s="hblistl ft"<cfelse >class="hb listrht"</ cfif>><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intItem ListingIma geWidth),V al(qryConf ig.intItem ListingIma geHeight)) #" border="0"/></div>
                                                             <div <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.LEFT>clas s="hblistr ht#rounded Width#"<cf else>class ="hblistlf t#roundedW idth#"</cf if>>
                                                       </cfif>
                                                  </cfif>                                                                                                                                                    Â
                                            </cfif>
                                            <cfif qryConfig.blnItemListingTi tle 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))><cf set addressLine2 = addressLine2 & ' #txtProvince#,'></cfif>
                                                  <cfif Len(Trim(txtPostalCode))>< cfset addressLine2 = addressLine2 & ' #txtPostalCode#'></cfif>
                                                  <cfset addressLine2 = addressLine2 & ' #txtCountry#'>
                                                  <cfif Len(Trim(addressLine1))><c fset infoList = infoList & '<li>#addressLine1#</li>'> </cfif>
                                                  <cfif Len(Trim(addressLine2))><c fset 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))><cf set 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.blnItemListingDe scription is 1>
                                                  <cfif qryConfig.intItemListingDe scriptionT ype is this.DISPLAY_TYPES.MEMO>
                                                       #txtAbstract#
                                                  <cfelseif qryConfig.intItemListingDe scriptionT ype is this.DISPLAY_TYPES.TRIMMED AND Val(qryConfig.intItemListi ngDescript ionLength) >     Â
                                                       #this.display.memoFormat(t xtDescript ion, qryConfig.intItemListingDe scriptionL ength, ' [ <a href="#SCRIPT_NAME#?i=#int ItemID#"># callAction #</a> ]')#
                                                  <cfelse> <!--- full --->
                                                       <!--- convertTokens() --->
                                                       #this.workflow.convertToke ns(txtDesc ription,fa lse,this.w ebid)#
                                                  </cfif>                                                 Â
                                            </cfif>
                                            <div class="clr"> </div>
                                            <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingIm age is 1 AND qryConfig.blnItemListingIm ageWrap is 0 AND Val(intImageID)>
                                            </div>
                                            </cfif>                                 Â
                                       </cfoutput>                                      Â
                                 </cfif>
                            </cfif>                           Â
                      </div>
                      <cfif Len(Trim(thepagination))>< cfoutput># thepaginat ion#</cfou tput></cfi f>                      Â
                 </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.blnSec urityEnabl ed IS 1 AND (qryConfig.blnItemListingA nchor or qryConfig.blnItemListingDe scription) IS 1 AND NOT ( isDefined("SESSION.loggedI n") 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,'intCate goryID',qr yAllCatego ries.intID )>
                            <cfoutput>
                            <cfif qryAllCategories.blnShowCa tegoryTitl e eq "1">
                            <h2>#qryAllCategories.txtT itle#</h2>
                            </cfif>
                            <cfif qryConfig.blnCategoryDescr iption eq "1">
                            <p>#qryAllCategories.txtDe scription# </p>
                            </cfif>
                           Â
                            <ul>
                            </cfoutput>
                            <cfoutput query="qryItems">
                                 <!--- Donny: missing url parameter
                                 <li><strong><a href="#SCRIPT_NAME###item# currentRow #">#txtTit le#</a></s trong></li > --->
                                 <li><strong><a href="#SCRIPT_NAME#<cfif Len(Trim(QUERY_STRING))>?# QUERY_STRI NG#</cfif> ##item#cou nt + currentRow#">#qryItems.txt Title#</a> </strong>< /li>
                            </cfoutput>
                            </ul>
                            <cfset count = count + qryItems.recordCount>
                      </cfloop>
                      <div class="clr"> </div>
                      <cfset count = 0>
                      <cfloop query="qryAllCategories">
                            <cfset qryItems = SelectFrom(qryAll,'intCate goryID',qr yAllCatego ries.intID )>
                            <ul id="dottedtop">
                            <cfoutput query="qryItems">
                                 <cfset roundedWidth = roundImageWidth(Val(qryCon fig.intIte mListingIm ageWidth)) >
                                 <li>
                                       <h5><a name="item#count + currentRow#"></a>#txtTitle #<cfif blnPrivate> #this.PRIVATE_IMAGE#</cfif ></h5>
                                       <!--- <strong>#qryAllCategories. txtTitle#< /strong><b r /> --->
                                       <div id="hblistmod">
                                       <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingIm age is 1>
                                            <cfif qryConfig.blnItemListingIm ageWrap is 1 OR qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.INLINE AND Val(intImageID)> <!--- image wrap --->
                                                  <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.RIGHT> <!--- image right --->
                                                       <img src="#this.workflow.setSSL Prefix(thi s.media.ge tURL(intIm ageID,Val( qryConfig. intItemLis tingImageW idth),Val( qryConfig. intItemLis tingImageH eight)),th is.webid)# " border="0" class="hblistrht"/>
                                                  <cfelse> <!--- image left or inline --->     Â
                                                       <img src="#this.workflow.setSSL Prefix(thi s.media.ge tURL(intIm ageID,Val( qryConfig. intItemLis tingImageW idth),Val( qryConfig. intItemLis tingImageH eight)),th is.webid)# " border="0" <cfif qryConfig.intItemListingIm ageAlign EQ this.IMAGE_ALIGN.LEFT>clas s="hblistl ft"<cfelse >class="hb listinl"</ cfif> />
                                                  </cfif>
                                            <cfelseif Val(intImageID)> <!--- image no wrap --->                                                       Â
                                                  <div <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.LEFT>clas s="hblistl ft"<cfelse >class="hb listrht"</ cfif>><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intItem ListingIma geWidth),V al(qryConf ig.intItem ListingIma geHeight)) #" border="0"/></div>
                                                  <div <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.LEFT>clas s="hblistr ht#rounded Width#"<cf else>class ="hblistlf t#roundedW idth#"</cf if>>
                                            </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))><cf set addressLine2 = addressLine2 & ' #txtProvince#,'></cfif>
                                            <cfif Len(Trim(txtPostalCode))>< cfset addressLine2 = addressLine2 & ' #txtPostalCode#'></cfif>
                                            <cfset addressLine2 = addressLine2 & ' #txtCountry#'>
                                            <cfif Len(Trim(addressLine1))><c fset infoList = infoList & '<li>#addressLine1#</li>'> </cfif>
                                            <cfif Len(Trim(addressLine2))><c fset 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))><cf set 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.convertToke ns(txtDesc ription,fa lse,this.w ebid)#
                                       <!--- Donny: missing url parameter
                                       <p><a href="#SCRIPT_NAME###item0 ">Back to top</a></p> --->
                                      Â
                                       <cfstoredproc procedure="getCourseDesc" datasource="#this.datasour ce#">
                            <cfprocresult name="getCourseDesc">
                            <cfprocparam cfsqltype="cf_sql_varchar" type="in" value="07-08">
                            <cfprocparam cfsqltype="cf_sql_integer" type="in" value="#qryItems.intcourse id#">
                            </cfstoredproc>
                           Â
                            <cfstoredproc procedure="getPreqList" datasource="#this.datasour ce#">
                            <cfprocresult name="getPreqList">
                            <cfprocparam cfsqltype="cf_sql_integer" type="in" value="#qryItems.intcourse id#">
                            </cfstoredproc>
                           Â
                           Â
                                 <cfif getcoursedesc.coursedescri ption neq ""><p>#getcoursedesc.cours edescripti on# </p></cfif>
                                 <cfif getcoursedesc.catalognotes neq ""><p>#getcoursedesc.catal ognotes#</ p></cfif>
                           Â
                           Â
                            <cfif getPreqList.recordcount neq 0>
                            <p><em>Prerequisite(s):</e m>
                            <cfloop query="getPreqList">
                                 <cfif #preq_flag# eq "C">
                                       #left(CourseNumber,3)#.#ri ght(Course Number,3)# #CourseTitle#<cfif #Currentrow# lt #Recordcount#>,<cfelse>.</ cfif>
                                 <cfelse>
                                       #lstPrerequisitesID#
                                 </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/inde x.cfm?acti on=search& coursenumb erlookup=# getcoursed esc.course number###c ourselist" 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_STRI NG#</cfif> ##item0">B ack to top</a></p>
                                       <div class="clr"> </div>
                                       <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingIm age is 1 AND qryConfig.blnItemListingIm ageWrap 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.blnSecurityEnabl ed is 1 AND qryItem.recordCount AND qryItem.blnPrivate is 1>
                 <cfif NOT (isDefined("SESSION.logged In") 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))><cf set addressLine = addressLine & ' #txtProvince#,'></cfif>
                                       <cfif Len(Trim(txtPostalCode))>< cfset addressLine = addressLine & ' #txtPostalCode#'></cfif>
                                       <cfset addressLine = addressLine & ' #txtCountry#'>
                                       <cfif Len(Trim(addressLine))><cf set 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))><cf set 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.blnItemDetailIma ge is 1 AND Val(intImageID)><img src="#this.media.getURL(in tImageID,V al(qryConf ig.intItem DetailImag eWidth),Va l(qryConfi g.intItemD etailImage Height))#"  border="0" <cfif qryConfig.intItemDetailIma geAlign is this.IMAGE_ALIGN.LEFT>clas s="hbdetlf t"<cfelsei f qryConfig.intItemDetailIma geAlign is this.IMAGE_ALIGN.RIGHT>cla ss="hbdetr ht"<cfelse >class="hb detinl"</c fif> /></cfif>
                                 <!--- convertTokens() --->
                                 <p>#this.workflow.convertT okens(txtD escription ,false,thi s.webid)#< /p>                           Â
                                 <cfif qryConfig.blnResource is 1>
                                       <cfset addlResources = this.media.getAdditionalRe sources(Va l(intResou rceID))>                                       Â
                                       <cfif ArrayLen(addlResources)>
                                       <br/>
                                       <strong>#qryConfig.txtItem DetailReso urceCaptio n#:</stron g><br />
                                       <ul>
                                            <cfloop from="1" to="#ArrayLen(addlResource s)#" index="i">
                                                  <li><a href="#addlResources[i].li nk#" <cfif addlResources[i].blnNewWin dow>target ="_blank"< /cfif>><im g src="images/#addlResources [i].icon#" width="18" height="18" border="0" alt=""></a> <a href="#addlResources[i].li nk#" target="_blank">#addlResou rces[i].ti tle#</a><c fif val(addlResources[i].files ize)> [#round(addlResources[i].f ilesize / 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(transl ate(this.f ormData.it emsname))# " id="#this.DATATYPES.ITEM#" />
                            <cfif this.formData.blnCategory>
                                 <item caption="#XMLFormat(transl ate('Categ ories'))#" id="#this.DATATYPES.CATEGO RY#"/>
                            </cfif>
                            <item caption="#XMLFormat(transl ate('Confi g'))#" 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.verifyColumn s(this.cat Data)>
           <cfset this.workflow.verifyColumn s(this.for mData)>
           <cfset this.workflow.verifyColumn s(this.lis tData)>
           <cfset this.workflow.verifyColumn s(this.rol eData)>
                Â
           <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.datasour ce#">
                 UPDATE       tblNavigation
                 SET            tblNavigation.intOrder =
                      (SELECT tblItem.intOrder
                       FROM       tblItem
                       LEFT JOIN tblCourseListingCategory
                       ON       tblItem.intID = tblCourseListingCategory.i ntItemID
                       AND       tblCourseListingCategory.b lnLive = 1
                       WHERE       intDatatype = #this.DATATYPES.CATEGORY#
                       AND       intWebID = #this.webid#
                       AND       tblNavigation.intID = tblCourseListingCategory.i ntCategory ID)
                 WHERE       intParentID = #this.webid#
                 AND       blnCategory = 1
                 AND       blnDeleted = 0
           </cfquery>
           <cfif isDefined("FORM.button")>
                 <!--- <cfif (NOT isDefined("FORM.intCategor yID"))>
                      <cfset qryCategory = selectFrom(this.workflow.g etQuery(th is.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.deleteCatego ry(val(FOR M.intCateg oryID))>
                      <cfset this.display.setActionMsg( this.workf low.proces sForm(this .catData)) >
                 <cfelseif FORM.button is translate("Restore")>
                      <cfset this.category.restoreCateg ory(val(FO RM.intCate goryID))>
                      <cfset this.display.setActionMsg( this.workf low.proces sForm(this .catData)) >
                 <cfelse>
                      <cfif (isDefined("FORM.intCatego ryID") 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.workf low.proces sForm(this .catData)) >
                            <cfset qryCategory = selectFrom(this.workflow.g etQuery(th is.catData ), "intItemID", FORM.id)>
                            <cfif (NOT isDefined("qryCategory.bln Approved") ) or (qryCategory.blnApproved is 1)>
                                 <cfset this.category.updateCatego ry(FORM.in tCategoryI D,qryCateg ory.txtTit le)>
                            </cfif>
                      <cfelse>
                            <cfset FORM.intCategoryID = this.category.addCategory( this.webid ,txtTitle) >
                            <cfset this.display.setActionMsg( this.workf low.proces sForm(this .catData)) >
                      </cfif>
                 </cfif>
           </cfif>
           <!--- <cfset this.formData.query = this.workflow.getQuery(thi s.formData )> --->
           <cfset qryRecords = this.workflow.getQuery(thi s.catData) >
           <!--- <cfset qryRecords = getCategoryQuery()> --->           Â
           <!--- <cfset qryPublic = this.workflow.getPublicQue ry(this.fo rmData)> --->
           <cfset qryPublic = getItemQuery(qryConfig,fal se)>
           <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.intCategor yID)#
                 </cfquery>
                 <cfset count = qryItemCount.recordcount>
                 <cfset ArrayAppend(extraColumn, count)>
                 <cfset this.category.setActive(qr yRecords.i ntCategory ID, (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(th is.catData )>
           </cfif>
           <cfreturn this.display.getListing(th is.catData ,"txtTitle ","Categor y","numRec ords","Ite ms",this.l ink)>
      </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.txt Path##this .slash#tas ks#this.sl ash#UListi ngNotifica tion_#argu ments.item uid#.cfm">
           <cfschedule action="delete" task="#this.datasource#_#t his.compan yID#_UList ingNotific ation_#arg uments.ite muid#">           Â
          Â
           <cfset sendNotification(itemid,li stIds)>
      </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.datasour ce#" 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.datasour ce#" 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.recor dCount is 0>
                 <cfreturn "Schedule failed">
           </cfif>     Â
           <cfset startDateTime = qryItem.dtStart>
           <cfset listIds = ValueList(qryNotificationL ists.intLi stID)>
           <cfif NOT isDate(startDateTime) OR DateDiff("n", startDateTime, now()) GTE 0>                Â
                 <cfset sendNotification(itemid,li stIds)>
                 <cfreturn "Task run">                Â
           </cfif>
     Â
           <cfset itemuid = qryItem.intUID>
                                Â
           <cfset taskcfm = '<cfset createObject("component"," hb50.inter nal.ulisti ng").init( #this.Comp anyID#,#th is.webid#, 0).runTask (#itemid#, "#itemuid# ","#listId s#")>'>           Â
          Â
           <cfif not DirectoryExists('#this.qry Company.tx tPath##thi s.slash#ta sks')>
                 <cfdirectory action="create" directory="#this.qryCompan y.txtPath# #this.slas h#tasks" mode="775">
           </cfif>
           <cffile action="write" file="#this.qryCompany.txt Path##this .slash#tas ks#this.sl ash#UListi ngNotifica tion_#item uid#.cfm" output="#taskcfm#" mode="775">
           <cfschedule action="update" task="#this.datasource#_#t his.compan yID#_UList ingNotific ation_#ite muid#" operation="httprequest"
                            startDate="#DateFormat(sta rtDateTime , 'mm/dd/yyyy')#" startTime="#TimeFormat(sta rtDateTime , 'hh:mm tt')#" interval="Once"
                            url="#this.qryCompany.txtW eb#/tasks/ UListingNo tification _#itemuid# .cfm?reque stTimeout= 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.ge neric.cont actmanager ",this.com panyID,tru e)>
           <cfset var qryRecipients = contactManager.getRecipien tsInLists( 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.datasour ce#" maxrows="1">
                 SELECT      TOP 1 intItemID
                 FROM      #this.formData.tablename#
                 WHERE      intID = <cfqueryparam value="#val(arguments.item ID)#" cfsqltype="cf_sql_integer" >
           </cfquery>
                Â
           <cfset qryConfig = getConfigQuery()>
          Â
           <cfif Len(Trim(qryConfig.txtNoti ficationSu bject))>
                 <cfset subject = qryConfig.txtNotificationS ubject>
           </cfif>
           <cfif Len(Trim(qryConfig.txtNoti ficationFr omEmail))>
                 <cfset fromEmail = qryConfig.txtNotificationF romEmail>
                 <cfif Len(Trim(qryConfig.txtNoti ficationFr omName))>
                      <cfset fromEmail = '"#qryConfig.txtNotificati onFromName #" <#fromEmail#>'>
                 </cfif>
           </cfif>           Â
                                Â
           <cfset pageTitle = this.navigation.getCaption (this.webI D)>
           <cfset pageURL = '#this.navigation.getURL(t his.webID) #?i=#qryIt em.intItem ID#'>
          Â
           <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.qry Company.tx tTitle# -  #subject#</cfoutput></titl e>
                 <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/SpryCollap siblePanel .js" type="text/javascript"></s cript>
                 <link href="SpryAssets/SpryColla psiblePane l.css" rel="stylesheet" type="text/css">
                 </head>
                     Â
                 <body>
                 <div id="CollapsiblePanel2" class="CollapsiblePanel">
                  <div class="CollapsiblePanelTab " tabindex="0">Tab</div>
                  <div class="CollapsiblePanelCon tent">Cont ent</div>
             </div>
                      <div id="CollapsiblePanel1" class="CollapsiblePanel">
                       <div class="CollapsiblePanelTab " tabindex="0">Tab</div>
                       <div class="CollapsiblePanelCon tent">Cont ent</div>
             </div>                           Â
           #this.workflow.convertToke ns(qryConf ig.txtNoti ficationMe ssage)#<br />
                      <a href="#pageURL#" target="_blank">#pageURL#< /a><br/>
                      <p>#emailFooter#</p>
                   <script type="text/javascript">
<!--
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePan el("Collap siblePanel 1");
var CollapsiblePanel2 = new Spry.Widget.CollapsiblePan el("Collap siblePanel 2");
//-->
</script>
                 </body>
                 </html>
                 </cfoutput>
           </cfsavecontent>
                     Â
           <cfset communication = getObject("hb50.communicat ion",this. companyID, true)>
                     Â
           <cfif Len(Trim(fromEmail))>                Â
                 <cfloop query="qryRecipients">                      Â
                      <cfset toEmail = qryRecipients.txtEmail>
                      <cfif Len(Trim(toEmail))>
                            <cftry>
                            <cfset communication.sendTextHTML (toEmail,f romEmail,s ubject, htmlBody, "")>
                            <cfcatch></cfcatch>
                            </cftry>
                      </cfif>
                 </cfloop>                Â
           </cfif>                      Â
      </cffunction>
     Â
      <cffunction name="getEmailFooter" access="private" returntype="string">
           <cfset emailFooter = '#this.qryCompany.txtTitle #<br/>Phon e: #this.qryCompany.txtTeleph one#<br/>E mail: #this.qryCompany.txtEmail# '>
           <cftry>                           Â
                 <cfquery name="qryDisplaySettings" datasource="#this.datasour ce#" maxrows="1" cachedwithin="#this.queryC ache#">
                      SELECT       TOP 1 intCompanyID, txtEmailFooter
                      FROM       tblDisplaySettings
                      WHERE       intCompanyID = #this.companyID#
                 </cfquery>
                 <cfset emailFooter = this.workflow.convertToken s(qryDispl aySettings .txtEmailF ooter)>                           Â
                 <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.workf low.proces sForm(this .formData) )>           Â
          Â
           <cfif isDefined("FORM.intListIds ") AND Len(Trim(FORM.intListIds)) >
                 <cfquery name="qryItem" datasource="#this.datasour ce#" 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.datasour ce#">
                                 INSERT INTO #this.listData.tablename#
                                       (intItemID,intListID,intCo mpanyID)
                                 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.blnNotific ation")  AND Val(qryItem.blnLive)>                                 Â
                            <cfset scheduleTask(Val(qryItem.i ntID))>
                      </cfif>                           Â
                 <cfelse>                                                       Â
                      <cfif fileexists("#this.qryCompa ny.txtPath ##this.sla sh#tasks#t his.slash# UListingNo tification _#qryItem. intUID#.cf m")>
                            <cffile action="delete" file="#this.qryCompany.txt Path##this .slash#tas ks#this.sl ash#UListi ngNotifica tion_#qryI tem.intUID #.cfm">
                            <cfschedule action="delete" task="#this.datasource#_#t his.compan yID#_UList ingNotific ation_#qry Item.intUI D#">
                      </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.datasour ce#" 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.recordCoun t AND qryApprovedItem.blnNotific ation is 1>
                      <cfquery name="qryNotificationLists " datasource="#this.datasour ce#" maxrows="1">
                            SELECT       TOP 1 intListID
                            FROM       #this.listData.tablename#
                            WHERE       intItemID = <cfqueryparam value="#qryApprovedItem.in tID#" cfsqltype="cf_sql_integer" >
                            AND            intCompanyID = <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer" > Â
                      </cfquery>
                      <cfif qryNotificationLists.recor dCount>
                            <cftrace text="U Listing: schedule notification task for approved item"/>
                            <cfset scheduleTask(qryApprovedIt em.intID)>
                      <cfelse>                      Â
                            <cfif fileexists("#this.qryCompa ny.txtPath ##this.sla sh#tasks#t his.slash# UListingNo tification _#qryAppro vedItem.in tUID#.cfm" )>
                                 <cftrace text="U Listing: remove scheduled task for approved item"/>
                                 <cffile action="delete" file="#this.qryCompany.txt Path##this .slash#tas ks#this.sl ash#UListi ngNotifica tion_#qryA pprovedIte m.intUID#. cfm">
                                 <cfschedule action="delete" task="#this.datasource#_#t his.compan yID#_UList ingNotific ation_#qry ApprovedIt em.intUID# ">
                            </cfif>
                      </cfif>
                 </cfif>
           </cfif>
          Â
           <cfset this.formData.query = getQuery()>
           <!--- check if category should be active after every save --->
           <cfif isDefined("FORM.intCategor yID") AND Val(FORM.intCategoryID)>
                 <!--- <cfset qryRecords = this.workflow.getQuery(thi s.catData) > --->
                 <!--- <cfset qryPublic = this.workflow.getPublicQue ry(this.fo rmData)> --->
                 <cfset qryRecords = getCategoryQuery()>
                 <cfset qryPublic = getItemQuery(qryConfig,tru e)>
                 <cfoutput query="qryRecords">
                      <cfquery name="qryItemCount" dbtype="query">
                            SELECT DISTINCT intItemID
                            FROM       qryPublic
                            WHERE       intCategoryID = #Val(qryRecords.intCategor yID)#
                      </cfquery>
                      <cfset count = qryItemCount.recordcount>
                      <cfset this.category.setActive(qr yRecords.i ntCategory ID, (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.notification TabIndex GT 0>
                      <cfset this.contactManager = getObject("hb50.plugins.ge neric.cont actmanager ",this.com panyID,tru e)>
                      <cftry>
                            <cfset qryLists = this.contactManager.getLis tQuery()>
                      <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.datasour ce#">
                                 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.datasour ce#">
                                 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.intLi stIds.sele ctedIndex != 0) {
                                       return false;
                                 }
                                 jsPopup('addContactList',' callback=j sUpdateLis tSelect');
                                 return false;                                 Â
                            }
                            function jsUpdateListSelect(listID, listTitle) {
                                 var size = document.frmAddEdit.intLis tIds.optio ns.length;
                                 document.frmAddEdit.intLis tIds.optio ns[size] = new Option(listTitle, listID);
                                 document.frmAddEdit.intLis tIds.selec tedIndex = size;
                            }
                                                      Â
                            function jsViewRecipients() {
                                 if (document.frmAddEdit.intLi stIds.sele ctedIndex <= 0) {
                                       alert("Please select a list.");
                                       return;
                                 }
                                 var form = document.frmAddEdit;
                                 var tempAction = form.action;
                                 window.open('', 'recipientsWindow', 'height=450,width=350,inne rHeight=20 0,innerWid th=250,loc ation=no,m enubar=no, resizable= yes,titleb ar=yes,too lbar=no,sc rollbars=y es');
                                 form.action = '#this.qryCompany.txtHBWeb #/popup/vi ewRecipien tsInLists. cfm';
                                 form.target = 'recipientsWindow';
                                 form.submit();
                                 form.action = tempAction;
                                 form.target = '';
                            }
                           Â
                            function jsExtraValidate() {
                                 if (document.frmAddEdit.blnNo tification .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.onbeforeunlo ad = null;
                                 }
                                 return valid;
                            }
                            document.frmAddEdit.onsubm it = jsPreSubmit;
                            </script>     Â
                            <div id="blnNotification"></div >                      Â
                            <div style="padding:10px;">
                                 <fieldset>
                                 <legend><input type="checkbox" name="blnNotification" <cfif isDefined("qryListingItem" ) AND qryListingItem.blnNotifica tion 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,qryL ists.intID )>selected </cfif>>#q ryLists.tx tTitle#</o ption>
                                                       </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.fo rmData.not ificationT abIndex].b ody = notificationTab>
                 </cfif>
                Â
                 <cfreturn this.display.getAddEdit(th is.formDat a) />
           </cfif>
          Â
           <!--- if nothing else has been returned, return the generic listing --->
           <cfreturn this.display.getListing(th is.formDat a,"txtTitl e","Item", "dtAdded", "Saved",th is.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.workf low.proces sForm(this .configDat a))>
                Â
                 <!--- role stuff --->
                 <!--- <cfset qryOldRoles = getRoleQuery()>
                 <cfset oldRoles = ValueList(qryOldRoles.intR oleID)> --->
                 <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,list Index)>
                            <cfelse>
                                 <cftrace text="insert role"/>
                                 <cfquery name="qryAddRole" datasource="#this.datasour ce#">
                                       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.datasour ce#">
                                 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.verifyColumn s(this.con figData)>
           <cfset qryConfig = getConfigQuery()>
           <cfset this.configData.query = qryConfig>
          Â
           <cfsavecontent variable="tabTwo">
                 <script language="JavaScript" type="text/javascript">
                      function jsPositiveNumber(theItem,m sg,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.ch ecked)) {
                                 form.blnItemListingImage.c hecked = false;
                                 form.blnItemDetailImage.ch ecked = false;
                            }
                            if (form.blnCategoryListing.c hecked) {                                 Â
                                 if (form.blnCategoryPaginatio n.checked && !jsPositiveNumber(form.int CategoryDi splayItems ,'Number of items to diplay is not valid.',2)) {
                                       return false;
                                 }                                 Â
                                 if (form.blnCategoryImage.che cked &&Â
                                            (!jsPositiveNumber(form.in tCategoryI mageWidth, 'Image Width is not valid.',2) || !jsPositiveNumber(form.int CategoryIm ageHeight, 'Image Height is not valid.',2) ) ) {
                                       return false;
                                 }
                            }
                            if (form.blnItemListingDescri ption.chec ked && !jsPositiveNumber(form.int ItemListin gDescripti onLength,' Descriptio n length is not valid.',3)) {
                                 return false;
                            }
                            if (form.blnItemListingPagina tion.check ed && !jsPositiveNumber(form.int ItemListin gDisplayIt ems,'Numbe r of items to display is not valid.',3)) {
                                 return false;
                            }
                            if (form.blnItemListingImage. checked &&Â
                                 (!jsPositiveNumber(form.in tItemListi ngImageWid th,'Image width is not valid.',3) || !jsPositiveNumber(form.int ItemListin gImageHeig ht, 'Image height is not valid.',3) ) ) {
                                 return false;
                            }
                            if (form.blnItemDetailResourc e.checked && !form.txtItemDetailResourc eCaption.v alue) {
                                 jsTabSwitch(4);
                                 alert('Related information caption is required.');
                                 return false;
                            }
                            if (form.blnItemDetailImage.c hecked &&Â
                                       (!jsPositiveNumber(form.in tItemDetai lImageWidt h, 'Image width is not valid.', 4) || !jsPositiveNumber(form.int ItemDetail ImageHeigh t, 'Image height is not valid.',4)) ) {
                                 return false;
                            }
                            if (form.blnNotification.chec ked) {
                                 if (!form.txtNotificationFrom Email.valu e) {
                                       jsTabSwitch(5);
                                       alert('From Email is required.');
                                       return false;
                                 }
                                 if (!form.txtNotificationSubj ect.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.onbeforeunlo ad = null;
                            }
                            return valid;
                      }
                      document.frmAddEdit.onsubm it = jsPreSubmit;
                 </script>
                Â
                 <cfoutput>
                      <div id="blnCategoryListing"></ div>
                      <div id="blnCategoryPageContent "></div>
                      <div id="blnCategoryDescription "></div>
                      <div id="blnCategorySearch"></d iv>
                      <div id="blnCategoryPagination" ></div>
                      <div id="blnCategoryPagination" ></div>
                      <div id="blnCategoryImage"></di v>
                      <div id="intCategoryDisplayItem s"></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.blnCategoryListi ng is 1>checked</cfif>> Category Listing </legend>
                                 <table width="100%" cellspacing="0" cellpadding="7" border="0">
                                       <tr>
                                            <td class="formCaption">
                                                  <input type="checkbox" name="blnCategoryPageConte nt" <cfif qryConfig.blnCategoryPageC ontent is 1>checked</cfif>> Show Page Content
                                                  <input type="checkbox" name="blnCategoryDescripti on" <cfif qryConfig.blnCategoryDescr iption is 1>checked</cfif>> Show Description                                            Â
                                                  <input type="checkbox" name="blnCategorySearch" <cfif qryConfig.blnCategorySearc h is 1>checked</cfif>> Search Form
                                            </td>
                                       </tr>
                                       <tr>
                                            <td>
                                                  <fieldset>
                                                       <legend><input type="checkbox" name="blnCategoryPaginatio n" <cfif qryConfig.blnCategoryPagin ation is 1>checked</cfif>> Pagination</legend>
                                                       <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                             <tr>
                                                                  <td class="formCaption"><input type="text" name="intCategoryDisplayIt ems" <cfif qryConfig.recordCount is 0>value="#this.MAX_ITEMS#" <cfelse>va lue="#qryC onfig.intC ategoryDis playItems# "</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="intCategoryImageWidt h" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value ="#qryConf ig.intCate goryImageW idth#"</cf if> style="width:70px;" class="formTextBox">
                                                                        Height: <input type="text" name="intCategoryImageHeig ht" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value ="#qryConf ig.intCate goryImageH eight#"</c fif> style="width:70px;" class="formTextBox">
                                                                  </td>
                                                                  <td class="formCaption">
                                                                        <input type="checkbox" name="blnCategoryImageWrap " <cfif qryConfig.blnCategoryImage Wrap is 1>checked</cfif>> Wrap Text
                                                                  </td>
                                                             </tr>
                                                             <tr>
                                                                  <td class="formCaption" colspan="2">
                                                                        Align: <input type="radio" name="intCategoryImageAlig n" value="#this.IMAGE_ALIGN.L EFT#" <cfif qryConfig.intCategoryImage Align is this.IMAGE_ALIGN.LEFT>chec ked</cfif> > Left
                                                                        <input type="radio" name="intCategoryImageAlig n" value="#this.IMAGE_ALIGN.R IGHT#" <cfif qryConfig.intCategoryImage Align is this.IMAGE_ALIGN.RIGHT OR qryConfig.recordCount is 0>checked</cfif>> Right
                                                                        <input type="radio" name="intCategoryImageAlig n" value="#this.IMAGE_ALIGN.I NLINE#" <cfif qryConfig.intCategoryImage Align is this.IMAGE_ALIGN.INLINE>ch ecked</cfi f>> 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="intCategoryLayoutTyp e" value="#this.COLUMN_LAYOUT .SINGLE#" <cfif qryConfig.intCategoryLayou tType is this.COLUMN_LAYOUT.SINGLE OR qryConfig.recordCount is 0>checked</cfif>> Single Column
                                                                        <input type="radio" name="intCategoryLayoutTyp e" value="#this.COLUMN_LAYOUT .DOUBLE#" <cfif qryConfig.intCategoryLayou tType is this.COLUMN_LAYOUT.DOUBLE> checked</c fif>> Double Column
                                                                  </td>
                                                             </tr>
                                                       </table>
                                                  </fieldset>
                                            </td>
                                       </tr>
                                 </table>
                            </fieldset>
                      </div>
                 </cfoutput>     Â
           </cfsavecontent>
           <cfset this.configData.tabs[2].bo dy = tabTwo>
          Â
           <cfsavecontent variable="tabThree">
                 <cfoutput>
                 <div id="blnItemListingPageCont ent"></div >
                 <div id="blnItemListingTitle">< /div>
                 <div id="intItemListingDateLayo utType"></ div>
                 <div id="blnItemListingDescript ion"></div >
                 <div id="intItemListingDescript ionType">< /div>
                 <div id="intItemListingDescript ionLength" ></div>
                 <div id="blnItemListingSearch"> </div>
                 <div id="blnItemListingAnchor"> </div>
                 <div id="blnItemListingImage">< /div>
                 <div id="intItemListingImageAli gn"></div>
                 <div id="intItemListingLayoutTy pe"></div>
                 <div id="blnItemListingImageWra p"></div>
                 <div id="intItemListingImageWid th"></div>
                 <div id="intItemListingImageHei ght"></div >
                 <div id="blnItemListingPaginati on"></div>
                 <div id="intItemListingDisplayI tems"></di v>
                 <div id="txtItemListingDescript ionAction" ></div>
                Â
                 <div style="padding:10px;" class="formCaption">
                      <fieldset>
                            <table width="100%" cellspacing="0" cellpadding="7" border="0">
                                 <tr>
                                       <td class="formCaption">
                                            <input type="checkbox" name="blnItemListingPageCo ntent" <cfif qryConfig.blnItemListingPa geContent is 1>checked</cfif>> Show Page Content
                                            <input type="checkbox" name="blnItemListingSearch " <cfif qryConfig.blnItemListingSe arch is 1>checked</cfif>> Search Form
                                            <input type="checkbox" name="blnItemListingAnchor " <cfif qryConfig.blnItemListingAn chor is 1>checked</cfif>> Item Anchor
                                            <input type="checkbox" name="blnItemListingTitle" <cfif qryConfig.recordCount is 0 OR qryConfig.blnItemListingTi tle 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="intItemListingDateLa youtType" value="#this.DATE_LAYOUT_T YPES.TWOLI NES#" <cfif qryConfig.intItemListingDa teLayoutTy pe is this.DATE_LAYOUT_TYPES.TWO LINES OR qryConfig.recordCount is 0>checked</cfif>> Title Date on different lines
                                                                  <input type="radio" name="intItemListingDateLa youtType" value="#this.DATE_LAYOUT_T YPES.ONELI NE#" <cfif qryConfig.intItemListingDa teLayoutTy pe is this.DATE_LAYOUT_TYPES.ONE LINE>check ed</cfif>> Date - Title on one line                                                                  Â
                                                             </td>
                                                       </tr>
                                                  </table>
                                            </fieldset>
                                       </td>
                                 </tr>
                                 <tr>
                                       <td>
                                            <fieldset>
                                                  <legend><input type="checkbox" name="blnItemListingDescri ption" <cfif qryConfig.blnItemListingDe scription is 1>checked</cfif>> Description</legend>
                                                  <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                       <tr>
                                                             <td class="formCaption">Displa y: </td>
                                                             <td class="formCaption" colspan="3">
                                                                  <input type="radio" name="intItemListingDescri ptionType" value="#this.DISPLAY_TYPES .FULL#" <cfif qryConfig.intItemListingDe scriptionT ype is this.DISPLAY_TYPES.FULL>ch ecked</cfi f>> Full
                                                             </td>
                                                       </tr>
                                                       <tr>
                                                             <td class="formCaption"> </td>
                                                             <td class="formCaption" colspan="3">                                                            Â
                                                                  <input type="radio" name="intItemListingDescri ptionType" value="#this.DISPLAY_TYPES .MEMO#" <cfif qryConfig.intItemListingDe scriptionT ype is this.DISPLAY_TYPES.MEMO>ch ecked</cfi f>> Abstract
                                                             </td>
                                                       </tr>
                                                             <td> </td>                                                                  Â
                                                             <td class="formCaption">
                                                                  <input type="radio" name="intItemListingDescri ptionType" value="#this.DISPLAY_TYPES .TRIMMED#" <cfif qryConfig.intItemListingDe scriptionT ype is this.DISPLAY_TYPES.TRIMMED OR qryConfig.recordCount is 0>checked</cfif>> Trimmed
                                                             </td>
                                                             <td class="formCaption">
                                                                  Length: <input type="text" name="intItemListingDescri ptionLengt h" <cfif qryConfig.recordCount is 0>value="250"<cfelse>value ="#qryConf ig.intItem ListingDes criptionLe ngth#"</cf if> class="formTextBox" style="width:70px;">
                                                             </td>
                                                             <td class="formCaption">
                                                                  Action: <input type="text" name="txtItemListingDescri ptionActio n" <cfif qryConfig.recordCount is 0>value="more..."<cfelse>v alue="#qry Config.txt ItemListin gDescripti onAction#" </cfif> class="formTextBox" style="width:150px;">
                                                             </td>
                                                       </tr>
                                                  </table>                                      Â
                                            </fieldset>
                                       </td>                                            Â
                                 </tr>
                                 <tr>
                                       <td>
                                            <fieldset>
                                                  <legend><input type="checkbox" name="blnItemListingPagina tion" <cfif qryConfig.blnItemListingPa gination is 1>checked</cfif>> Pagination</legend>
                                                  <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                       <tr>
                                                             <td class="formCaption"><input type="text" name="intItemListingDispla yItems" <cfif qryConfig.recordCount is 0>value="#this.MAX_ITEMS#" <cfelse>va lue="#qryC onfig.intI temListing DisplayIte ms#"</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.blnItemListingIm age 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="intItemListingImageW idth" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value ="#qryConf ig.intItem ListingIma geWidth#"< /cfif> style="width:70px;" class="formTextBox">
                                                                  Height: <input type="text" name="intItemListingImageH eight" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value ="#qryConf ig.intItem ListingIma geHeight#" </cfif> style="width:70px;" class="formTextBox">
                                                             </td>
                                                             <td class="formCaption">
                                                                  <input type="checkbox" name="blnItemListingImageW rap" <cfif qryConfig.blnItemListingIm ageWrap is 1>checked</cfif>> Wrap Text
                                                             </td>
                                                       </tr>
                                                       <tr>
                                                             <td class="formCaption" colspan="2">
                                                                  Align <input type="radio" name="intItemListingImageA lign" value="#this.IMAGE_ALIGN.L EFT#" <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.LEFT>chec ked</cfif> > Left
                                                                  <input type="radio" name="intItemListingImageA lign" value="#this.IMAGE_ALIGN.R IGHT#" <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.RIGHT OR qryConfig.recordCount is 0>checked</cfif>> Right
                                                                  <input type="radio" name="intItemListingImageA lign" value="#this.IMAGE_ALIGN.I NLINE#" <cfif qryConfig.intItemListingIm ageAlign is this.IMAGE_ALIGN.INLINE>ch ecked</cfi f>> 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="intItemListingLayout Type" value="#this.COLUMN_LAYOUT .SINGLE#" <cfif qryConfig.intItemListingLa youtType is this.COLUMN_LAYOUT.SINGLE OR qryConfig.recordCount is 0>checked</cfif>> Single Column
                                                                  <input type="radio" name="intItemListingLayout Type" value="#this.COLUMN_LAYOUT .DOUBLE#" <cfif qryConfig.intItemListingLa youtType is this.COLUMN_LAYOUT.DOUBLE> checked</c fif>> Double Column
                                                             </td>
                                                       </tr>
                                                  </table>
                                            </fieldset>
                                       </td>
                                 </tr>
                            </table>
                      </fieldset>
                 </div>                Â
                 </cfoutput>     Â
           </cfsavecontent>
           <cfset this.configData.tabs[3].bo dy = tabThree>
          Â
           <cfsavecontent variable="tabFour">
                 <cfoutput>
                      <div id="blnItemDetail"></div>
                      <div id="blnItemDetailPageConte nt"></div>
                      <div id="blnItemDetailResource" ></div>
                      <div id="txtItemDetailResourceC aption"></ div>
                      <div id="blnItemDetailImage"></ div>
                      <div id="intItemDetailImageWidt h"></div>
                      <div id="intItemDetailImageHeig ht"></div>
                      <div id="intItemDetailImageAlig n"></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">
                                                  <input type="checkbox" name="blnItemDetailPageCon tent" <cfif qryConfig.blnItemDetailPag eContent is 1>checked</cfif>> Show Page Content                                            Â
                                            </td>
                                       </tr>
                                       <tr>
                                            <td>
                                                  <fieldset>
                                                       <legend><input type="checkbox" name="blnItemDetailResourc e" <cfif qryConfig.blnItemDetailRes ource is 1>checked</cfif>> Related Information</legend>
                                                       <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                             <tr>
                                                                  <td class="formCaption">Captio n: <input type="text" name="txtItemDetailResourc eCaption" <cfif qryConfig.recordCount is 0>value="Related Information"<cfelse>value= "#qryConfi g.txtItemD etailResou rceCaption #"</cfif> class="formTextBox" style="width:235px;"></td>
                                                             </tr>
                                                       </table>                                      Â
                                                  </fieldset>
                                            </td>                                            Â
                                       </tr>
                                       <tr>
                                            <td>
                                                  <fieldset>
                                                       <legend><input type="checkbox" name="blnItemDetailImage" <cfif qryConfig.blnItemDetailIma ge 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="intItemDetailImageWi dth" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value ="#qryConf ig.intItem DetailImag eWidth#"</ cfif> style="width:70px;" class="formTextBox">
                                                                        Height: <input type="text" name="intItemDetailImageHe ight" <cfif qryConfig.recordCount is 0>value="100"<cfelse>value ="#qryConf ig.intItem DetailImag eHeight#"< /cfif> style="width:70px;" class="formTextBox">
                                                                  </td>
                                                                  <td class="formCaption">
                                                                        Align <input type="radio" name="intItemDetailImageAl ign" value="#this.IMAGE_ALIGN.L EFT#" <cfif qryConfig.intItemDetailIma geAlign is this.IMAGE_ALIGN.LEFT>chec ked</cfif> > Left
                                                                        <input type="radio" name="intItemDetailImageAl ign" value="#this.IMAGE_ALIGN.R IGHT#" <cfif qryConfig.intItemDetailIma geAlign is this.IMAGE_ALIGN.RIGHT OR qryConfig.recordCount is 0>checked</cfif>> Right
                                                                        <input type="radio" name="intItemDetailImageAl ign" value="#this.IMAGE_ALIGN.I NLINE#" <cfif qryConfig.intItemDetailIma geAlign is this.IMAGE_ALIGN.INLINE>ch ecked</cfi f>> Inline
                                                                  </td>
                                                             </tr>
                                                       </table>
                                                  </fieldset>
                                            </td>
                                       </tr>
                                       <tr>
                                            <td> </td>
                                       </tr>
                                 </table>
                            </fieldset>
                      </div>                Â
                 </cfoutput>     Â
           </cfsavecontent>
           <cfset this.configData.tabs[4].bo dy = 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">*</spa n><br />
                                                  <input type="text" name="txtNotificationFromE mail" value="#qryConfig.txtNotif icationFro mEmail#" style="width:225px;">
                                            </td>
                                            <td class="formCaption">From Name:<br />
                                                  <input type="text" name="txtNotificationFromN ame" value="#qryConfig.txtNotif icationFro mName#" style="width:225px;">
                                            </td>
                                       </tr>
                                       <tr>
                                            <td class="formCaption">Notifi cation Subject: <span class="txtRequired">*</spa n><br />
                                                  <input type="text" name="txtNotificationSubje ct" value="#qryConfig.txtNotif icationSub ject#" style="width:225px;">
                                            </td>
                                            <td> </td>
                                       </tr>
                                 </table>
                            </fieldset>
                      </div>     Â
                 </cfoutput>           Â
           </cfsavecontent>
           <cfset this.configData.tabs[5].bo dy = 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.blnSecurityEnabl ed 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)>select ed</cfif>> #qryRoles. txtTitle#< /option>
                                                  </cfloop>
                                            </select>
                                       </td>
                                 </tr>
                            </table>
                      </fieldset>
                 </div>     Â
                 </cfoutput>
           </cfsavecontent>
           <cfset this.configData.tabs[7].bo dy = tabSeven>
                     Â
           <cfif qryConfig.recordCount>
                 <cfset URL.id = qryConfig.intID>
           </cfif>
           <cfsavecontent variable="jsHack">
                 <script>
                 document.getElementById('i nnerTab1') .style.ove rflow ='auto';
                 document.getElementById('i nnerTab2') .style.ove rflow ='auto';
                 document.getElementById('i nnerTab3') .style.ove rflow ='auto';
                 document.getElementById('i nnerTab4') .style.ove rflow ='auto';
                 </script>
           </cfsavecontent>
          Â
           <cfreturn this.display.getAddEdit(th is.configD ata) & jsHack>
      </cffunction>
      <!--- /getConfigBackEnd --->
          Â
      <cffunction name="install" access="public" returntype="struct">
           <cfset var returnStruct = StructNew()>
          Â
           <cfif isDefined("this.formData") >
                 <cfset this.workflow.verifyColumn s(this.for mData)>
                 <cfif StructKeyExists(this.formD ata, 'tablename')>
                      <cfset returnStruct.itemTable = this.formData.tablename>
                 </cfif>
           </cfif>
           <cfif isDefined("this.catData")>
                 <cfset this.workflow.verifyColumn s(this.cat Data)>
                 <cfif StructKeyExists(this.catDa ta, 'tablename')>
                      <cfset returnStruct.categoryTable = this.catData.tablename>
                 </cfif>
           </cfif>
                     Â
           <cfset this.workflow.verifyColumn s(this.con figData)>
           <cfset this.workflow.verifyColumn s(this.lis tData)>
           <cfset this.workflow.verifyColumn s(this.rol eData)>
          Â
           <cfreturn returnStruct>
      </cffunction>
      <!--- Donny: needed by "hb50\popups\rte\insertlin k.cfc" --->
      <cffunction name="getPublicQuery" access="public" returntype="query">     Â
           <cfif (this.datatype is this.DATATYPES.CATEGORY)>
                 <cfreturn this.workflow.getPublicQue ry(this.ca tData) />
           <cfelse>
                 <cfreturn this.workflow.getPublicQue ry(this.fo rmData) />
           </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)><cfse t infoList = infoList & '<li>#DateFormat(scope.dtD ate, 'mmmm dd, yyyy')#</li>'></cfif>
                            <cfif qryConfig.blnAddress is 1>
                                 <cfset addressLine = ''>
                                 <cfif  isDefined("scope.txtAddres s")><cfset addressLine = addressLine & '#scope.txtAddress#'></cfi f>
                                 <cfif isDefined("scope.txtCity") AND Len(Trim(scope.txtCity))>< cfset addressLine = addressLine & ' #scope.txtCity#,'></cfif>
                                 <cfif isDefined("scope.txtProvin ce") AND Len(Trim(scope.txtProvince ))><cfset addressLine = addressLine & ' #scope.txtProvince#,'></cf if>
                                 <cfif isDefined("scope.txtPostal Code") AND Len(Trim(scope.txtPostalCo de))><cfse t addressLine = addressLine & ' #scope.txtPostalCode#'></c fif>
                                 <cfif isDefined("scope.txtCountr y")><cfset addressLine = addressLine & ' #scope.txtCountry#'></cfif >
                                 <cfif Len(Trim(addressLine))><cf set 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>'></c fif>
                            <cfif qryConfig.blnFax is 1 and isDefined("scope.txtFax") AND Len(Trim(scope.txtFax))><c fset infoList = infoList & '<li>Fax: #scope.txtFax#</li>'></cfi f>
                            <cfif qryConfig.blnPhone is 1 and isDefined("scope.txtTollFr ee") 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.txtEma il#">#scop e.txtEmail #</a></li> '></cfif>
                            <cfif qryConfig.blnLink is 1 and isDefined("scope.txtLink") AND Len(Trim(scope.txtLink))>
                                 <cfif REFindNoCase("http[s]://", scope.txtL ink)>
                                       <cfset txtItemLink = scope.txtLink>
                                 <cfelse>
                                       <cfset txtItemLink = "http://#scope.txtLink#">
                                 </cfif>
                                 <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#scope.txt Link#</a>< /li>'>
                            </cfif>
                            <cfif Len(Trim(infoList))>
                                 <ul>
                                       #infoList#                                                 Â
                                 </ul>
                            </cfif>
                            <cfif qryConfig.blnImage is 1 and qryConfig.blnItemDetailIma ge is 1 and Val(scope.intImageID)><img src="#this.media.getURL(sc ope.intIma geID,Val(q ryConfig.i ntCategory ImageWidth ),Val(qryC onfig.intC ategoryIma geHeight)) #"  border="0" <cfif qryConfig.intItemDetailIma geAlign is this.IMAGE_ALIGN.LEFT>clas s="hbdetlf t"<cfelsei f qryConfig.intItemDetailIma geAlign is this.IMAGE_ALIGN.RIGHT>cla ss="hbdetr ht"<cfelse >class="hb detinl"</c fif> /></cfif>
                      <p>#this.workflow.convertT okens(scop e.txtDescr iption,fal se,this.we bid)#</p>                           Â
                            <!---  <!--- not support yet --->
                            <cfif qryConfig.blnResource is 1>
                                 <cfset addlResources = this.media.getPreviewAddit ionalResou rces(scope .resources ))>                                       Â
                                 <cfif ArrayLen(addlResources)>
                                 <br/>
                                 <strong>#qryConfig.txtItem DetailReso urceCaptio n#:</stron g><br />
                                 <ul>
                                       <cfloop from="1" to="#ArrayLen(addlResource s)#" index="i">
                                            <li><a href="#addlResources[i].li nk#" <cfif addlResources[i].blnNewWin dow>target ="_blank"< /cfif>><im g src="images/#addlResources [i].icon#" width="18" height="18" border="0" alt=""></a> <a href="#addlResources[i].li nk#" target="_blank">#addlResou rces[i].ti tle#</a><c fif val(addlResources[i].files ize)> [#round(addlResources[i].f ilesize / 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_tit le>
           <cfset FORM.txtDescription = "">
           <cfset FORM.txtMetaDescription = "">
           <cfset FORM.txtMetaKeywords = "">
           <cfset StructDelete(FORM, "id")>
           <cfset this.workflow.doAction(SES SION.useri d, 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.compa nyID);
     Â
                 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=optio ns) --->
           <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.pagi nation)#" 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(for mData)>
           </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. recordcoun t - (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/Pag e")# #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,' pagination List'); document.frmPagination.pag ination.fo cus();"><i mg src="images/btn_status_arr ow.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#&sorto rder=#sort order#&ord er=#order# #searchURL #&paginati on=' + this.options[this.selected Index].val ue;" 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</optio n>
                                       <option value="250"<cfif URL.pagination is 250> selected</cfif>>250</optio n>
                                       <option value="500"<cfif URL.pagination is 500> selected</cfif>>500</optio n>
                                 </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("Tot al")#:#qry Records.re cordcount# </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.lis tbuttons)# " index="i">
                                       <cfif not StructKeyExists(formData.l istbuttons [i], "width")>
                                            <cfset formData.listbuttons[i].wi dth = 100>
                                       </cfif>
                                       <input name="addbutton" type="submit" class="buttons" value="#translate(formData .listbutto ns[i].titl e)#" style="width: #formData.listbuttons[i].w idth#px"
                                            <cfif StructKeyExists(formData.l istbuttons [i], "onClick")>
                                                  onClick="#formData.listbut tons[i].on Click#"
                                            </cfif>
                                       />
                                 </cfloop>
                                 <cfif formData.blnAdd>
                                       <input name="addbutton" type="submit" class="buttons" value="#translate("Add #formData.itemname#")#"
                                       onClick="this.form.id.valu e = '';"/>
                                 </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.c fm?webid=# formData.w ebid#&data type=#form Data.datat ype#', '', 'scrollbars=no,width=300,h eight=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.print Title)#
                                            <cfelse>
                                                  <a href="#arguments.linkURL#< cfif arguments.linkURL contains "?">&<cfelse>?</cfif>pagin ation=#URL .paginatio n#&order=t itle#searc hURL#&sort order=<cfi f URL.order is "title" and URL.sortorder is "asc">desc<cfelse>asc</cfi f>">#trans late(print Title)#</a >
                                                  <cfif URL.order is "title">
                                                       <cfif URL.sortorder is "asc">
                                                             <img src="images/btn_move_up.gi f" 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.li nkURL, Find('?', arguments.linkURL) - 1)#?#Right(arguments.linkU RL, Len(arguments.linkURL) - Find('?', arguments.linkURL))#&pagin ation=#URL .paginatio n#&sortord er=#sortor der#&order =#order##s earchURL#" method="post">
                                                             <div align="right">
                                                                  <cfif SR gt 1>
                                                                        <a href="#Left(arguments.link URL, Find('?', arguments.linkURL) - 1)#?#Right(arguments.linkU RL, Len(arguments.linkURL) - Find('?', arguments.linkURL))#&pagin ation=#URL .paginatio n#&sortord er=#sortor der#&order =#order##s earchURL#& 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.record Count / URL.pagination)#
                                                                  <cfif SR lte qryRecords.recordcount - URL.pagination>
                                                                        <a href="#Left(arguments.link URL, Find('?', arguments.linkURL) - 1)#?#Right(arguments.linkU RL, Len(arguments.linkURL) - Find('?', arguments.linkURL))#&pagin ation=#URL .paginatio n#&sortord er=#sortor der#&order =#order##s earchURL#& 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.ex traTitle)# <cfelse><a href="#arguments.linkURL#< cfif arguments.linkURL contains "?">&<cfelse>?</cfif>pagin ation=#URL .paginatio n#&order=d ate#search URL#&sorto rder=<cfif url.order is "date" and url.sortorder is "asc">desc<cfelse>asc</cfi f>">#trans late(extra Title)#</a > <cfif URL.order is "date"><cfif URL.sortorder is "asc"><img src="images/btn_move_up.gi f" 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></cf if>
                                       </td>
                          </tr>
                            </table>
                      </div>
                 </cfoutput>
                Â
                 <script>
                      function setEditID(id) {
                            var lastID = document.getElementById('e dit_id').v alue;
                            var lastRow = document.getElementById('r ow1_' + lastID + '');
                            if (lastRow)
                                 lastRow.style.background = '#FFFFFF';
                            var lastRow = document.getElementById('r ow2_' + lastID + '');
                            if (lastRow)
                                 lastRow.style.background = '#FFFFFF';
                            var lastRow = document.getElementById('r ow3_' + lastID + '');
                            if (lastRow)
                                 lastRow.style.background = '#FFFFFF';
                                Â
                            document.getElementById('e dit_id').v alue = id;
                            document.getElementById('r ow1_' + id + '').style.background = '#EEEEEE';
                            document.getElementById('r ow2_' + id + '').style.background = '#EEEEEE';
                            document.getElementById('r ow3_' + 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:#E EEEEE" 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"> < /td>
                                  <td width="120" class="toolHeader"> < /td>
                            </tr>
                            <cfoutput query="qryRecords" startrow="#SR#" maxrows="#URL.pagination#" >
                                 <cfset recordID = qryRecords[idColumn]>
                                 <cfset title = qryRecords[arguments.print Column]>
                                 <cfif Len(arguments.extraColumn) >
                                       <cfset extraValue = qryRecords[arguments.extra Column]>
                                 <cfelse>
                                       <cfset extraValue = "">
                                 </cfif>
                                  <cfif isDefined("arguments.linkC olumn") and Len(arguments.linkColumn)>
                                       <cfset link = qryRecords[arguments.linkC olumn]>
                                 <cfelse>
                                       <cfsavecontent variable="link">#arguments .linkURL#< cfif arguments.linkURL contains "?">&<cfelse>?</cfif>mode= edit&id=#r ecordID#&l istparam=# URLEncoded Format("or der=#order #&sortorde r=#sortord er#&sr=#sr #&paginati on=#url.pa gination## searchURL# ")#</cfsav econtent>
                                 </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.linkT arget") and Len(arguments.linkTarget)> target="#a rguments.l inkTarget# "</cfif>>< cfif not Len(Trim(title))>no title</cfif>#title#</a></c fsaveconte nt>
                                 <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:setEdi tID('#reco rdID#');"> #getIcon(q ryRecords, currentrow)#</td>
                                       <td class="toolList" id="row2_#recordID#" onclick="javascript:setEdi tID('#reco rdID#');"> #text#<cfi f isDefined("qryRecords.blnF eatured") 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:setEdi tID('#reco rdID#');"> #extraValu e#</td>
                                 </tr>
                            </cfoutput>
                            <cfif not qryRecords.recordcount>
                                 <cfoutput>
                                 <tr>
                                       <td height="20" bgcolor="##FFFFFF" align="center" valign="center" style="cursor:none;">  ;</td>
                                       <td bgcolor="##FFFFFF" class="formCaption" style="padding:5px;">#tran slate("The re are no records.")#</td>
                                       <td bgcolor="##FFFFFF"> < /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>pagin ation=#URL .paginatio n#" method="post">
                            <input type="text" id="searchKeywords" name="keywords" class="searchBox" value="#HTMLEditFormat(URL .keywords) #" style="width: <cfif formData.blnCategory and formData.blnStatus>220<cfe lseif formData.blnCategory or formData.blnStatus>349<cfe lse>478</c fif>px;"/>
                            <cfif formData.blnStatus>
                                 <select name="statusID" class="searchSelect" onChange='this.form.submit ();'>
                                       <option value="0" selected>#translate("Statu s")# ...</option>
                                       <option value="#this.workflow.STAT US.ACTIVE# " <cfif URL.statusID is this.workflow.STATUS.ACTIV E>selected </cfif>>#t ranslate(" Active")#< /option>
                                 <cfif formData.blnScheduling>
                                       <option value="#this.workflow.STAT US.PENDING #" <cfif URL.statusID is this.workflow.STATUS.PENDI NG>selecte d</cfif>># translate( "Pending") #</option>
                                       <option value="#this.workflow.STAT US.EXPIRED #" <cfif URL.statusID is this.workflow.STATUS.EXPIR ED>selecte d</cfif>># translate( "Expired") #</option>
                                 </cfif>
                                 <cfif formData.blnLock>
                                       <option value="#this.workflow.STAT US.LOCK#" <cfif URL.statusID is this.workflow.STATUS.LOCK> selected</ cfif>>#tra nslate("Lo cked")#</o ption>
                                 </cfif>
                                 <cfif formData.blnApproval>
                                       <option value="#this.workflow.STAT US.UNAPPRO VED#" <cfif URL.statusID is this.workflow.STATUS.UNAPP ROVED>sele cted</cfif >>#transla te("Unappr oved")#</o ption>
                                 </cfif>
                                 <cfif formData.blnRestore and formData.blnDelete and SESSION.blnRestore>
                                       <option value="#this.workflow.STAT US.DELETED #" <cfif URL.statusID is this.workflow.STATUS.DELET ED>selecte d</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(for mData.webi d)>
                                 <select name="catID" class="searchSelect" onChange='this.form.submit ();'>
                                       <cfif StructKeyExists(formData, 'categoryname')>
                                            <option value="0" selected>#formData.categor yname# ...</option>
                                       <cfelse>
                                            <option value="0" selected>#translate("Categ ory")# ...</option>
                                       </cfif>
                                       <cfloop query="qryCategory">
                                            <option value="#qryCategory.intID# "<cfif URL.catID is qryCategory.intID> selected</cfif>>#qryCatego ry["txtTit le"][curre ntRow]#</o ption>
                                       </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.printColu mn#) 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.DELE TED#
                      </cfif>
                 </cfif>
                 <cfif ListLen(keywords, " ")>
                      AND (1 = 2
                            <cfloop list="#arguments.keywords# " delimiters=" " index="i">
                                 OR LOWER(#arguments.printColu mn#) 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.ACTIV E>
                      <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.INACT IVE>
                      <cfreturn '<img src="images/btn_unactive.g if" width="16" height="18" border="0" alt="#translate("Inactive" )#" title="#translate("Inactiv e")#">'>
                 <cfelseif status is this.workflow.STATUS.DELET ED>
                      <cfreturn '<img src="images/btn_deleted.gi f" width="16" height="18" border="0" alt="#translate("Deleted") #" title="#translate("Deleted ")#">'>
                 <cfelseif status is this.workflow.STATUS.UNAPP ROVED>
                      <cfreturn '<img src="images/btn_approval.g if" width="16" height="18" border="0" alt="#translate("Waiting For Approval")#" title="#translate("Waiting For Approval")#">'>
                 <cfelseif status is this.workflow.STATUS.UNTRA NSLATED>
                      <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.UNSHA RED>
                      <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.CLONE D>
                      <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 (qryRecord s.intItemI D)>
                     Â
                      <cfif selectFrom(qryLockUsers, "intUserID", SESSION.userid).recordcoun t>
                            <cfreturn '<img src="images/btn_extranet.g if" 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.C ompanyID)>
                            </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(qr yLockUsers .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.PENDI NG>
                      <cfif StructKeyExists(qryRecords , 'dtStart')>
                            <cfreturn '<img src="images/btn_pending.gi f" width="16" height="18" border="0" alt="#translate("Pending until")# #DateFormat(qryRecords.dtS tart, "mmmm d, yyyy")# at #TimeFormat(qryRecords.dtS tart, "h:mm tt")#" title="#translate("Pending until")# #DateFormat(qryRecords.dtS tart, "mmmm d, yyyy")# at #TimeFormat(qryRecords.dtS tart, "h:mm tt")#">'>
                      <cfelse>
                            <cfreturn '<img src="images/btn_pending.gi f" width="16" height="18" border="0" alt="#translate("Pending") #" title="#translate("Pending ")#">'>
                      </cfif>
                 <cfelseif status is this.workflow.STATUS.EXPIR ED>
                      <cfif StructKeyExists(qryRecords , 'dtEnd')>
                            <cfreturn '<img src="images/btn_expired.gi f" width="16" height="18" border="0" alt="#translate("Expired on")# #DateFormat(qryRecords.dtE nd, "mmmm d, yyyy")# at #TimeFormat(qryRecords.dtE nd, "h:mm tt")#" title="#translate("Expired on")# #DateFormat(qryRecords.dtE nd, "mmmm d, yyyy")# at #TimeFormat(qryRecords.dtE nd, "h:mm tt")#">'>
                      <cfelse>
                            <cfreturn '<img src="images/btn_expired.gi f" width="16" height="18" border="0" alt="#translate("Expired") #" title="#translate("Expired ")#">'>
                      </cfif>
                 <cfelse>
                      <cfreturn ' ' />
                 </cfif>
          Â
           <!--- Jason: hack to display the link validation status icon (DAM) --->     Â
           <cfelseif ListFindNoCase(qryRecords. columnlist , "blnValidateLink")>
                 <cfif Val(qryRecords.blnValidate Link)>
                      <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 " " />
      </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#</cf output>
                 </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#</c foutput>
                 </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#</cfou tput>" style="overflow:<cfif scrolling><cfif auto>auto<cfelse>scroll</c fif><cfels e>none</cf if>; 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.Re cords, 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;</e m>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=#p ag.next#"< cfelse>dis abled</cfi f> title="Next Page" class="next">Next<em>&rsaq uo;&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.maxTa bs") 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.col umns)#" index="key">
                      <cfif ListFind("#TYPES.HTML#,#TY PES.LIST#" , formData.columns[key].type )>
                            <cfset y = StructNew()>
                            <cfset y.caption = formData.columns[key].titl e>
                            <cfset y.columnlist = formData.columns[key].varn ame>
                            <cfset ArrayAppend(htmltabs, y)>
                      <cfelse>
                            <cfset x.columnlist = ListAppend(x.columnlist, formData.columns[key].varn ame)>
                      </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"><inpu t 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-Eq uiv</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</t d>
                                  <td width="130" height="21" class="toolHeader">Name</t d>
                                  <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">,</di v>';
                                      Â
                      x = StructNew();
                      x.varname = "txtNameValues";
                      x.title = "Advanced Meta";
                      x.type = TYPES.LIST;
                      x.collist = 'txtMetaType,txtMetaName,t xtMetaValu e';
                     Â
                      x.headerText = nameHeader;
                      x.editHTML = editForm;
                      x.listHTML = listMode;
                      x.required = false;
                      x.display = false;
                      ArrayAppend(formData.colum ns, 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#); ">#transla te(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#); ">#transla te(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].bod y, "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.onbeforeunlo ad = 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.dis play = 'block';
                                                  }
                                            </cfloop>
                                            <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="key">
                                                  <cfset i = formData.columns[key]>
          Â
                                                  <cfif ListFindNoCase(tabs[j].col umnlist, i.varname) and i.type is this.TYPES.HTML>
                                                       turnEditOn_#i.varname# ()
                                                  </cfif>
          Â
                                                  <cfif not ListFindNoCase(tabs[j].col umnlist, i.varname)>
                                                       if (document.getElementById(' #i.varname #') != undefined) {
                                                             document.getElementById('# i.varname# ').style.d isplay = 'none';
                                                       }
                                                  </cfif>
                                            </cfloop>
                                       }
                                 </cfloop>
                                Â
                                 switch(tabList[tab].toLowe rCase()) {
                                       case 'overview':
                                            document.getElementById('s ettingsOve rviewChang ed').value = 1;
                                            break;
                                       case 'extranet':
                                            document.getElementById('s ettingsExt ranetChang ed').value = 1;
                                            break;
                                       case 'sharing':
                                            document.getElementById('s ettingsSha ringChange d').value = 1;
                                            break;
                                       case 'workflow':
                                            document.getElementById('s ettingsWor kflowChang ed').value = 1;
                                            break;
                                       case 'conversion':
                                            document.getElementById('s ettingsCon versionCha nged').val ue = 1;
                                            break;
                                       case 'campaign':
                                            document.getElementById('s ettingsCam paignChang ed').value = 1;
                                            break;
                                       case 'blog':
                                            document.getElementById('s ettingsBlo gChanged') .value = 1;
                                            break;
                                       case 'webtrends®':
                                            document.getElementById('s ettingsWTO DChanged') .value = 1;
                                            break;
                                       case 'google sitemaps':
                                            document.getElementById('s ettingsGoo gleSitemap Changed'). 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','in nerTab#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.Co mpanyID)>
                 <cfsavecontent variable="output">
                      <img src="images/shim.gif" height="13" width="1" alt="">
                      <div align="center">
                            <cfoutput>
                                 <cfif isDefined("qryData.intReso urceID")>
                                       #media.getAdditionalResour cesForm("r esources", qryData.intResourceID)#
                                 <cfelse>
                                       #media.getAdditionalResour cesForm("r esources") #
                                 </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.datasour ce#" 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.intVersion ID") and Val(FORM.intVersionID))>
                                 <!--- Donny: for global metatag in Admin. > Website Control > Meta Data --->
                                 <cfquery name="qryData" datasource="#this.datasour ce#" cachedwithin="#this.queryC ache#">
                                       SELECT       txtMetaKeywords, txtMetaDescription
                                       FROM       tblCompany
                                       WHERE       intCompanyID = #Val(this.companyID)#
                                 </cfquery>
                            </cfif>
     Â
                            <cfset blnInherit = ((not isDefined("qryData.txtMeta Keywords") ) or (not isDefined("qryData.txtMeta Descriptio n")) or (qryData.txtMetaKeywords is "" and qryData.txtMetaDescription is ""))>
     Â
                            <script>
                                 function jsMetaDisable(form, checked) {
                                       form.txtMetaKeywords.disab led = !checked;
                                       form.txtMetaDescription.di sabled = !checked;
                                      Â
                                       if (checked){
                                            form.btnDelete_txtNameValu es.style.v isibility = "";
                                            form.btnMetaTag_txtNameVal ues.style. visibility = "";
                                       } else {
                                            form.btnDelete_txtNameValu es.style.v isibility = "hidden";
                                            form.btnMetaTag_txtNameVal ues.style. visibility = "hidden";
                                       }
                                 }
     Â
                                 <cfif (not blnInherit)>
                                       document.frmAddEdit.btnDel ete_txtNam eValues.st yle.visibi lity = ""
                                       document.frmAddEdit.btnMet aTag_txtNa meValues.s tyle.visib ility = ""
                                 </cfif>
                                Â
                                 onclick="jsMetaDisable(thi s.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(thi s.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">#trans late("Keyw ords")#:</ font><br />
                                                  <textarea style="width: 240px; height: 130px;" class="formTextarea" name="txtMetaKeywords"<cfi f blnInherit> disabled</cfif>><cfif blnInherit>#qryMeta.txtMet aKeywords# <cfelseif isDefined("qryData.txtMeta Keywords") >#qryData. txtMetaKey words#</cf if></texta rea>
                                            </td>
                                            <td width="50%">
                                                  <font class="formCaption">#trans late("Desc ription")# :</font><b r />
                                                  <textarea style="width: 240px; height: 130px;" class="formTextarea" name="txtMetaDescription"< cfif blnInherit> disabled</cfif>><cfif blnInherit>#qryMeta.txtMet aDescripti on#<cfelse if isDefined("qryData.txtMeta Descriptio n")>#qryDa ta.txtMeta Descriptio n#</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.getConte ntContaine rForm("con tainers", Val(URL.id))#
                            <cfelse>
                                 #contentcontainer.getConte ntContaine rForm("con tainers")#
                            </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.C TagManager ", this.CompanyID, true)>
                 <cfsavecontent variable="output">
                      <cfoutput>
                            <cfif isDefined('URL.id') and Val(URL.id)>
                                 #tagMgr.getTaggingForm("ta gging", Val(URL.id))#
                            <cfelse>
                                 #tagMgr.getTaggingForm("ta gging")#
                            </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"></sc ript>
                            <!--- 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(c ommand, 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('d tStart_hid den').valu e = args;
                                                             }
                                                             // Hook for Internet Explorer
                                                             if (navigator.appName && navigator.appName.indexOf( "Microsoft ") != -1 &&Â
                                                                   navigator.userAgent.indexO f("Windows ") != -1 && navigator.userAgent.indexO f("Windows 3.1") == -1)
                                                             {
                                                                  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                                                  document.write('on error resume next \n');
                                                                  document.write('Sub dtStartflash_FSCommand(ByV al command, ByVal args)\n');
                                                                  document.write('  call dtStartflash_DoFSCommand(c ommand, 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","#M onth(value )#");
                                                         so.addVariable("year","#Ye ar(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(com mand, 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('d tEnd_hidde n').value = args;
                                                             }
                                                             // Hook for Internet Explorer
                                                             if (navigator.appName && navigator.appName.indexOf( "Microsoft ") != -1 &&Â
                                                                   navigator.userAgent.indexO f("Windows ") != -1 && navigator.userAgent.indexO f("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(com mand, 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","#M onth(value )#");
                                                         so.addVariable("year","#Ye ar(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.col umns)#" 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#,#TY PES.LIST#" , i.type)>
                                        <cfif count mod 2 is 1>
                                            <tr>
                                        </cfif>
                                       <td width="50%" valign="<cfif i.type is TYPES.BOOLEAN>bottom<cfels e>top</cfi f>">
                                            <cfif isDefined("qryData")>
                                                  #getFormItemDisplay(formDa ta, i, qryData)#
                                            <cfelse>
                                                  #getFormItemDisplay(formDa ta, 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> </td></tr>
                      </cfif>
          Â
                      <!--- display the types that require a full tab --->
                      <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="key">
                            <cfset i = formData.columns[key]>
                            <cfif (not isDefined("columnNames")) or ListFindNoCase(columnNames , i.varname)>
                                 <cfif ListFind("#TYPES.HTML#,#TY PES.LIST#" , i.type)>
                                       <!--- display only html --->
                                       <tr>
                                            <td colspan="2" valign="top">
                                            <cfif isDefined("qryData")>
                                                  #getFormItemDisplay(formDa ta, i, qryData)#
                                            <cfelse>
                                                  #getFormItemDisplay(formDa ta, 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.col umns)#" 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.col umns)#" index="key">
                                                  <cfset k = formData.columns[key]>
                                                  <cfif k.type neq TYPES.TYPE>
                                                       document.getElementById('# k.varname# ').style.d isplay = 'none';
                                                  </cfif>
                                            </cfloop>
                                       }
                                       function changeType() {
                                            var type = document.getElementById('# i.varname# _select'). selectedIn dex;
                                            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.dis play = '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.dt Added, "mmm dd yyyy")# #TimeFormat(qryVersion.dtA dded, "h:MMtt")#">
                      </cfif>
                      <option value="#qryVersion.intID#" <cfif arguments.intVersionID is qryVersion.intID>selected< /cfif>><cf if qryVersion.blnLive is 1>#translate("Active Version")#<cfelse>#DateFor mat(qryVer sion.dtAdd ed, "mmm dd yyyy")# #TimeFormat(qryVersion.dtA dded, "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.cu rsor = 'pointer'; this.style.cursor = 'hand'; document.body.onbeforeunlo ad = null;" onmouseout="if (window.jsSaveWarning) jsSaveWarning();" onclick="document.getEleme ntById('ve rsionList' ).style.vi sibility = 'visible'; document.getElementById('i ntVersionI D').style. visibility = 'visible'; document.getElementById('i ntVersionI D').focus( );"><img src="images/btn_status_arr ow.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#&v ersionid=v alue" method="post">
                                       <select class="selectSmall" style="width:147; visibility: hidden;" id="intVersionID" name="intVersionID" size="7" onChange='this.blur(); this.form.submit();' onblur="document.getElemen tById('ver sionList') .style.vis ibility = '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.datasour ce#" cachedwithin="#this.queryC ache#">
                 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.recordCoun t>
                 <cfreturn "" />
           </cfif>
           <cfset currentVersion = translate("Original")>
           <cfset selectedIndex = 0>
           <cfsavecontent variable="options">
                 <cfoutput><option value="#qryTranslations.in tItemID#"> #translate ("Original ")#</optio n></cfoutp ut>
                 <cfoutput query="qryTranslations">
                      <option value="#intTranslateID#" <cfif intTranslateID is id>selected</cfif>>#txtTit le#</optio n>
                      <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 =languagev iew&i=' + itemID + '', '', 'help=no,resizable=yes,scr oll=no,sta tus=no,mod al=yes');
                                 showModelessDialog('popup. cfm?p=lang uageview&i =' + itemID + '', '', 'help=no;resizable=yes;scr oll=no;sta tus=no;cen ter=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.cu rsor = 'pointer'; this.style.cursor = 'hand'; document.body.onbeforeunlo ad = null;" onmouseout="if (window.jsSaveWarning) jsSaveWarning();" onclick="document.getEleme ntById('la nguageList ').style.v isibility = 'visible'; document.getElementById('i ntLanguage ID').focus ();"><img src="images/btn_status_arr ow.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.v alue); this.selectedIndex = #selectedIndex#' onblur="document.getElemen tById('lan guageList' ).style.vi sibility = '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.newSu bID")>
                 <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.action msg)>
           <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.act ionmsg#</f ont></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 the treenav --->
           <cfif this.treenavrefresh>
                 <cfset status = status & '<script>resetSideNav(#thi s.treenavs ubid#);</s cript>'>
           </cfif>
          Â
           <cfreturn status />
      </cffunction>
      <cffunction name="getStyles" access="public" output="false">
           <cfargument name="blnInclElement" required="false" type="boolean" default="false" />
          Â
           <cfset var styles = '' />
          Â
           <cfsavecontent variable="styles">
                 <cfoutput>
                      <cfif arguments.blnInclElement>
                            <style type="text/css" id="cssCustomStyles">
                      </cfif>
                      <!--
                            #getStyleRules()#
                      -->
                      <cfif arguments.blnInclElement>
                            </style>
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn styles />
      </cffunction>
      <cffunction name="getStyleRules" access="public" output="false">
           <cfquery name="qryStyles" datasource="#this.datasour ce#" cachedwithin="#this.queryC ache#">
                 SELECT       *
                 FROM       tblStyles
                 WHERE       intCompanyID = #this.CompanyID#
                 AND       blnDeleted = 0
           </cfquery>
          Â
           <cfsavecontent variable="rules">
                 <cfoutput>
                      <cfloop query="qryStyles">
                            .customStyle#intID# { font-size: #intSize##txtSizePtPx#; font-family: #txtFont#; color: <cfif ListLen(txtColor,'12345678 90abcdefAB CDEF') is 0>##</cfif>#txtColor#; font-style: <cfif blnItalics is 1>italic<cfelse>normal</cf if>; font-weight: <cfif blnBold is 1>bold<cfelse>normal</cfif >; }
                            <cfif Len(txtLinkColor)>
                                 .customStyle#intID# a:link { color: <cfif ListLen(txtLinkColor,'1234 567890abcd efABCDEF') is 0>##</cfif>#txtLinkColor# !important; }
                                 .customStyle#intID# a:hover { color: <cfif ListLen(txtLinkColor,'1234 567890abcd efABCDEF') is 0>##</cfif>#txtLinkColor# !important; }
                                 .customStyle#intID# a:active { color: <cfif ListLen(txtLinkColor,'1234 567890abcd efABCDEF') is 0>##</cfif>#txtLinkColor# !important; }
                            </cfif>
                            <cfif Len(txtVisitedLinkColor)>
                                 .customStyle#intID# a:visited { color: <cfif ListLen(txtVisitedLinkColo r,'1234567 890abcdefA BCDEF') is 0>##</cfif>#txtVisitedLink Color# !important; }
                            </cfif>
                      </cfloop>
                      table { font-size: 1.0em; }
                      .tableNoBorder { font-size: 1.0em; border: 0; }
     Â
                      table.tableSingleBorder { border: 1px solid ##000000; }
                      table.tableSingleBorder td { border: 1px solid ##000000; }
     Â
                      table.tableDoubleBorder { border: 2px solid ##000000; }
                      table.tableDoubleBorder td { border: 2px solid ##000000; }
     Â
                      .clickToEnlarge { font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: ##000000; font-style: normal; font-weight: normal; }
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn rules />
      </cffunction>
      <!--- returns add/edit form for a particular item --->
      <cffunction name="getAddEdit" access="public" returntype="string" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfif not isQuery(formData.query)>
                 <cfset formData.query = this.workflow.getQuery(for mData)>
           </cfif>
           <cfif formData.blnMeta>
                 <!--- Donny: retrieve and populate advance meta data --->
                 <cfif isDefined("FORM.id") and Val(FORM.id)>
                      <cfset URL.id = FORM.id>
                 </cfif>
                 <cfif isDefined("URL.id") and Val(URL.id)>
                      <cfif not isDefined("FORM.intVersion ID") or Val(FORM.intVersionID) is 0>
                            <!--- retrieve the MetaID if not passed in lookup --->
                            <cfquery name="qryCurrentMetaID" datasource="#this.datasour ce#" cachedwithin="#this.queryC ache#">
                                 SELECT       TOP 1 intID
                                 FROM       #formData.tablename#
                                 WHERE       intItemID = #URL.id#
                                 <!--- see if we are grabbing the live version --->
                                 <cfif isDefined("formData.query. blnlive") and Val(formData.query.blnlive ) is 1>
                                       <!--- live --->
                                       AND blnLive = 1
                                 </cfif>
                                 <!--- added by Jason --->
                                 <!--- see if VersionID is appended to the URL --->
                                 <cfif isDefined("URL.versionid") and Val(URL.versionid)>
                                       AND intID = #URL.versionid#
                                 </cfif>
                                 <!--- end added by Jason --->
                                 ORDER BY dtAdded DESC;
                            </cfquery>
                            <cfset FORM.intVersionID = Val(qryCurrentMetaID.intID )>
                      </cfif>
                 </cfif>
                Â
                 <cfscript>
                      // retrieve the other metatags (other than keywords and description)
                      this.htmlhead = createObject('component'," hb50.util. htmlhead") ;
                      this.htmlhead.init(this.Co mpanyId,tr ue,0,0);
                      txtNameValues = "";
                      txtHTTPValues = "";
                      if (isDefined("URL.id") and isDefined("FORM.intVersion ID")) {
                            metaTags = this.htmlhead.getMetaTags( Val(URL.id ), FORM.intVersionID);
                            // format the metatag needed in "formData" variable
                            for (i=1; i lte ArrayLen(metaTags); i=i+1) {
                                 if (StructKeyExists(metatags[ i], "name")) {
                                       txtNameValues = txtNameValues & 'Normal,' & metatags[i].name & ',' & metatags[i].content & chr(13) & chr(10);
                                 } else if (StructKeyExists(metatags[ i], "httpequiv")) {
                                       txtNameValues = txtNameValues & 'HTTP-Eq,' & metatags[i].httpequiv & ',' & metatags[i].content & chr(13) & chr(10);
                                 }
                            }
                      }
                 </cfscript>
                 <cfscript>
                      metaFormData.query = QueryNew('intID,txtNameVal ues,txtHTT PValues');
                      QueryAddRow(metaFormData.q uery);
                      QuerySetCell(metaFormData. query, "intID", "1");
                      QuerySetCell(metaFormData. query, "txtNameValues", txtNameValues);
                      QuerySetCell(metaFormData. query, "txtHTTPValues", txtHTTPValues);
                      // save to "formData"
                      formData.metaQuery = metaFormData.query;
                 </cfscript>
           </cfif>
           <cfsavecontent variable="body">
                 <cfoutput>
                      #getStyles(true)#
                      #getStatus()#
                      <cfif formData.blnMeta>
                            <style type="text/css">
                            <!--
                                 .txtMetaName, .txtMetaValue, .txtMetaType {
                                       font-family: Arial, Helvetica, sans-serif;
                                       font-size: 11px;
                                       color: ##666666;
                                       padding: 5px;
                                       font-weight: normal;
                                       background-color: ##FFFFFF;
                                       cursor: hand;
                                       float: left;
                                       overflow: hidden;
                                       border-left: 1px solid ##999999;
                                 }
                                 .txtMetaType { width: 54px; }
                                 .txtMetaName { width: 135px; }
                                 .txtMetaValue { width: 330px; }
                            -->
                            </style>
                      </cfif>
                      <cfif formData.blnPreview>
                            <script language='JavaScript'>
                                 function previewItem(form) {
                                       var tempAction = form.action;
                                       if (window.jsValidate && !jsValidate())
                                            return false;
     Â
                                       var previewWindow = window.open('', 'previewWindow', 'height=700,width=800,inne rHeight=70 0,innerWid th=800,loc ation=no,m enubar=no, resizable= yes,titleb ar=yes,too lbar=no,sc rollbars=y es');
                                       form.action = '#this.qryCompany.txtWeb#/ preview.cf m?navid=#f ormData.na vid#&subid =#formData .subid#&ta bid=#formD ata.tabid# <cfif isDefined("URL.id") and Val(URL.id)>&citemID=#URL. id#</cfif> ';
                                       form.target = 'previewWindow';
     Â
                                       // put in hidden Preview Mode variable
                                       var hiddenItem = document.createElement('in put');
                                       hiddenItem.type = 'hidden';
                                       hiddenItem.id = 'hot_banana_preview_mode';
                                       hiddenItem.name = 'hot_banana_preview_mode';
                                       hiddenItem.value = 1;
                                       form.appendChild(hiddenIte m);
     Â
                                       form.submit();
                                       previewWindow.focus();
                                       form.action = tempAction;
                                       form.target = '';
     Â
                                       // should remove hidden Preview Mode variable
                                       try{
                                            form.removeChild(hiddenIte m);
                                       } catch(e) {
                                            hiddenItem.removeNode();
                                       }
     Â
                                       return false;
                                 }
                                Â
                                 function previewWorkflow(form,blnMo dified) {
                                       var tempAction = form.action;
                                       if (window.jsValidate && !jsValidate()) return false;
     Â
                                       var previewWindow = window.open('', 'previewWindow', 'height=700,width=800,inne rHeight=70 0,innerWid th=800,loc ation=no,m enubar=no, resizable= yes,titleb ar=yes,too lbar=no,sc rollbars=y es');
                                       form.action = '#this.qryCompany.txtWeb#/ preview.cf m?navid=#f ormData.na vid#&subid =#formData .subid#&ta bid=#formD ata.tabid# <cfif isDefined("URL.id") and Val(URL.id)>&citemID=#URL. id#</cfif> ';
                                       form.target = 'previewWindow';
     Â
                                       // put in hidden Preview Mode variable
                                       var hiddenItem = document.createElement('in put');
                                       hiddenItem.type = 'hidden';
                                       hiddenItem.id = 'hot_banana_preview_mode';
                                       hiddenItem.name = 'hot_banana_preview_mode';
                                       hiddenItem.value = 1;
                                       form.appendChild(hiddenIte m);
                                      Â
                                       // put in hidden preview mod/current variable
                                       if(blnModified == false)
                                       {
                                            var hiddenItem = document.createElement('in put');
                                            hiddenItem.type = 'hidden';
                                            hiddenItem.id = 'hot_banana_preview_curren t';
                                            hiddenItem.name = 'hot_banana_preview_curren t';
                                            hiddenItem.value = 1;
                                            form.appendChild(hiddenIte m);
                                       }
     Â
                                       form.submit();
                                       previewWindow.focus();
                                       form.action = tempAction;
                                       form.target = '';
     Â
                                       // should remove hidden Preview Mode variable
                                       try{
                                            form.removeChild(hiddenIte m);
                                       } catch(e) {
                                            hiddenItem.removeNode();
                                       }
     Â
                                       return false;
                                 }
     Â
                                 function analyzeItem(form) {
                                       var tempAction = form.action;
                                       if (window.jsValidate && !jsValidate()) return false;
     Â
                                       var analyzeWindow = window.open('', 'analyzeWindow', 'height=700,width=800,inne rHeight=70 0,innerWid th=800,loc ation=no,m enubar=no, resizable= yes,titleb ar=yes,too lbar=no,sc rollbars=y es');
                                       form.action = '#this.qryCompany.txtWeb#/ analytics. cfm?navid= #formData. navid#&sub id=#formDa ta.subid#& tabid=#for mData.tabi d#<cfif isDefined("URL.id") and Val(URL.id)>&I=#URL.id#&ci temID=#URL .id#</cfif >';
                                       form.target = 'analyzeWindow';
     Â
                                       // put in hidden Preview Mode variable
                                       var hiddenItem = document.createElement('in put');
                                       hiddenItem.type = 'hidden';
                                       hiddenItem.id = 'hot_banana_preview_mode';
                                       hiddenItem.name = 'hot_banana_preview_mode';
                                       hiddenItem.value = 1;
                                       form.appendChild(hiddenIte m);
     Â
                                       form.submit();
                                       analyzeWindow.focus();
                                       form.action = tempAction;
                                       form.target = '';
     Â
                                       // should remove hidden Preview Mode variable
                                       try{
                                            form.removeChild(hiddenIte m);
                                       } catch(e) {
                                            hiddenItem.removeNode();
                                       }
     Â
                                       return false;
                                 }
                            </script>
                      </cfif>
     Â
                      <cfif isDefined("addbutton") and isDefined("FORM.ID") and Val(FORM.ID)>
                            <cftrace text="Setting URL.ID"/>
                            <cfset URL.ID = Val(FORM.ID)>
                      </cfif>
                      <!--- <cfsetting showdebugoutput="yes"> --->
     Â
                      <cfif isDefined("URL.ID") and Val(URL.ID)> <!--- editing / viewing --->
                            <cfif formData.blnApproval and this.workflow.canApprove(V al(URL.id) , SESSION.userid)>
                                 #getApproveForm(formData, URL.ID)#
                            <cfelseif formData.blnLock and this.workflow.isLocked(Val (URL.ID), SESSION.userid)>
                                 <cfquery name="qryItemLock" datasource="#this.datasour ce#" cachedwithin="#this.queryC ache#">
                                       SELECT      blnApproval, intUserID, dtAdded
                                       FROM       tblItemLock
                                       WHERE       intItemID = #Val(URL.ID)#
                                 </cfquery>
     Â
                                 <cfif not isDefined("this.access")>
                                       <cfset this.access = createObject("component", "hb50.access").init(this.C ompanyID)>
                                 </cfif>
                                 <cfif qryItemLock.blnApproval>
                                       #translate("This item is awaiting approval from")#:
                                       <blockquote>
                                            <cfloop query="qryItemLock">
                                                  <cftry>
                                                       #this.access.getUserData(i ntUserID). realname#< br>
                                                       <cfcatch></cfcatch>
                                                  </cftry>
                                            </cfloop>
                                       </blockquote>
                                 <cfelse>
                                       #translate("This item was locked by")# #this.access.getUserData(q ryItemLock .intUserID ).realname # #DateFormat(qryItemLock.dt Added, "mmmm d, yyyy")#.
                                 </cfif>
                                 <form action="#formData.link#" method="post"><input type="submit" value="#translate("Go Back")#" class="buttons"></form>
     Â
                            <cfelse>
                                 <cfif isDefined("URL.versionID") >
                                       #getEditForm(formData, URL.ID, URL.versionID)#
                                 <cfelse>
                                       #getEditForm(formData, URL.ID)#
                                 </cfif>
                            </cfif>
                      <cfelse> <!--- adding --->
                            #getAddForm(formData)#
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn body />
      </cffunction>
      <cffunction name="getAddForm" access="public" returntype="string" hint="Returns Default Add Form" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="formName" required="false" default="frmAddEdit">
           <cfargument name="jsValidate" required="false" default="jsValidate">
           <cfsavecontent variable="output">
                 <cfoutput>
                      #getJSValidate(formData)#
     Â
                      <script language="JavaScript">
                            var submitted = false;
                            <!--- Notification --->
                            function jsConfirmNotification() {
                                 if (confirm('Send Update Notification to Subscribers?')) {
                                       document.#formName#.HB_sen dNotificat ion.value = 1;
                                 }
                                 return true;
                            }
     Â
                            function jsCarefulSubmit() {
                                 var valid = #jsValidate#();
     Â
                                 if (valid) {
                                       if (submitted) return false;
                                       document.body.onbeforeunlo ad = null;
                                       submitted = true;
                                 }
     Â
                                 return valid;
                            }
                      </script>
     Â
                      <table border="0" cellpadding="0" cellspacing="0">
                            <form name="#formName#" action="#formData.link#<cf if isDefined("URL.listparam") >&#URLDeco de(URL.lis tparam)#</ cfif>" method="post" enctype="multipart/form-da ta" onSubmit="return jsCarefulSubmit();" <cfif isDefined("formData.target ")>target= "#formData .target#"< /cfif>>
                                 <tr>
                                       <td>
                                            #getFormTabs(formData)#
                     Â
                                            <cfsavecontent variable="buttons">
                                                  <cfif ArrayLen(formData.addbutto ns)>
                                                       <cfset addbuttons = formData.addbuttons>
                                                  <cfelse>
                                                       <cfset addbuttons = getAddButtons(formData)>
                                                  </cfif>
                                                  <!--- notification --->
                                                  <input type="hidden" name="HB_sendNotification" value="0">
                                                  <cfloop from="1" to="#ArrayLen(addbuttons)# " index="i">
                                                       <input <cfif StructKeyExists(addbuttons [i], "name")>name="#addbuttons[ i].name#"< cfelse>nam e="button" </cfif> type="submit" class="buttons" value="#translate(addbutto ns[i].titl e)#"
                                                             <cfif StructKeyExists(addbuttons [i], "width")>style="width: #addbuttons[i].width#px"</ cfif>
                                                             <cfif StructKeyExists(addbuttons [i], "onClick")>onClick="#addbu ttons[i].o nClick#"
                                                             <cfelseif addbuttons[i].title is "Check In" and isDefined("this.qryCompany .blnNotifi cation") and Val(this.qryCompany.blnNot ification) and isDefined("formData.blnNot ification" ) and formData.blnNotification>
                                                             <cftry>
                                                                  <cfset notifier = getObject("hb50.plugins.ge neric.noti fier",this .companyID ,true)>
                                                                  <cfif notifier.getNotifierListsB yWebID(Val (formData. webid)).re cordCount>
                                                                        onClick="return jsConfirmNotification();"
                                                                  </cfif>
                                                                  <cfcatch></cfcatch>
                                                             </cftry>
                                                             </cfif>
                                                             <cfif StructKeyExists(addbuttons [i], "disabled")>disabled="#add buttons[i] .disabled# "</cfif>
                                                       >
                                                  </cfloop>
                                            </cfsavecontent>
                                            #getButtonLayer(buttons)#
                                       </td>
                                 </tr>
                            </form>
                      </table>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn output />
      </cffunction>
      <cffunction name="getAddButtons" returntype="array" access="private" output="false">
           <cfargument name="formData" type="struct" required="true">
           <cfset var addbuttons = ArrayNew(1)>
           <cfset var notifier = ''>
           <cfif formData.blnPreview>
                 <cfset x = StructNew()>
                 <cfset x.title = "Keyword Analysis">
                 <cfset x.width = 130>
                 <cfset x.onclick = "return analyzeItem(this.form);">
                 <cfset ArrayAppend(addbuttons, x)>
                 <cfset x = StructNew()>
                 <cfset x.title = "Preview">
                 <cfset x.onclick = "return previewItem(this.form);">
                 <cfset ArrayAppend(addbuttons, x)>
           </cfif>
           <cfif formData.blnLock>
                 <cfset x = StructNew()>
                 <cfset x.title = "Save">
                 <cfset ArrayAppend(addbuttons, x)>
                 <cfset x = StructNew()>
                 <cfset x.title = "Check In">
                 <!--- notification --->
                 <cfif isDefined("this.qryCompany .blnNotifi cation") and Val(this.qryCompany.blnNot ification) and isDefined("formData.blnNot ification" ) and formData.blnNotification>
                      <cftry>
                            <cfset notifier = getObject("hb50.plugins.ge neric.noti fier",this .companyID ,true)>
                            <cfif notifier.getNotifierListsB yWebID(Val (formData. webid)).re cordCount>
                                 <cfset x.onClick = "return jsConfirmNotification();">
                            </cfif>
                      <cfcatch></cfcatch>
                      </cftry>
                 </cfif>
                 <cfset ArrayAppend(addbuttons, x)>
           <cfelse>
                 <cfset x = StructNew()>
                 <cfset x.title = "Add">
                 <cfset ArrayAppend(addbuttons, x)>
           </cfif>
           <cfreturn addButtons />
      </cffunction>
      <cffunction name="getEditForm" access="public" returntype="string" hint="Returns Default Edit Form" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="ID" required="true" type="any">
           <cfargument name="versionID" required="false" type="any">
           <cfargument name="formName" required="false" default="frmAddEdit">
           <cfargument name="jsValidate" required="false" default="jsValidate">
          Â
           <cfscript>
                 var qryUnorderedVersion = QueryNew('');
                 var qryVersion = QueryNew('');
                 var versionLink = '';
                 var qryCurrent = QueryNew('');
                 var editbuttons = ArrayNew(1);
                 var buttons = '';
           </cfscript>
           <cfif formData.blnVersion>
                 <!--- version stuff --->                Â
                 <cfquery name="qryUnorderedVersion" datasource="#this.datasour ce#">
                      SELECT       #formData.tablename#.*, tblItem.blnDeleted
                      FROM       #formData.tablename#
                      LEFT JOIN tblItem
                      ON            tblItem.intID = #formData.tablename#.intIt emID
                      WHERE       #formData.tablename#.intIt emID = #arguments.ID#
                      ORDER BY dtAdded DESC
                 </cfquery>
                Â
                 <cfif qryUnorderedVersion.record Count gt 0>
                      <cfif isDefined("arguments.versi onID")>
                            <cfparam name="FORM.intVersionID" default="#arguments.versio nID#">
                      <cfelse>
                            <cfset "FORM.intVersionID" = qryUnorderedVersion.intID>
                      </cfif>
                      <cfquery name="qryVersion" dbtype="query">
                            SELECT      *
                            FROM       qryUnorderedVersion
                            ORDER BY blnLive DESC, dtAdded DESC
                      </cfquery>
                      <cfif formData.blnVersion and FORM.intVersionID neq qryUnorderedVersion.intID>
                            <!--- Donny: grabbing the wrong version?! --->
                            <cfset qryCurrent = selectFrom(qryVersion, formData.varID, FORM.intVersionID)>
                            <!--- <cfset qryCurrent = selectFrom(qryVersion, formData.varID, qryUnorderedVersion.intID) > --->
                      <cfelseif isDefined("formData.query" ) and isQuery(formData.query)>
                            <!--- if we select from qryVersion we loose additional columns in formData.query --->
                            <cfset qryCurrent = selectFrom(formData.query, formData.varID, FORM.intVersionID)>
                      <cfelse>
                            <cfset qryCurrent = selectFrom(qryVersion, formData.varID, FORM.intVersionID)>
                      </cfif>
                       <cfset versionLink = "#formData.link#&mode=edit &ID=#argum ents.ID#">
                 <cfelse>
                      <cfset qryCurrent = selectFrom(formData.query, "intItemID", arguments.ID)>
                 </cfif>
           <cfelseif formData.blnWorkflow>
                 <cfset qryCurrent = selectFrom(formData.query, "intItemID", arguments.ID)>
           <cfelse>
                 <cfset qryCurrent = selectFrom(formData.query, formData.varID, arguments.ID)>
           </cfif>
          Â
           <cfsavecontent variable="output">
                 <cfoutput>
                      #getJSValidate(formData)#
     Â
                      <script language="JavaScript">
                            var submitted = false;
                            //notification
                            function jsConfirmNotification(addN ote) {
                                 if (confirm('Send Update Notification to Subscribers when page goes live?')) {
                                       document.#formName#.HB_sen dNotificat ion.value = 1;
                                 }
                                Â
                                 if(addNote == true)                           Â
                                       jsApproveNote();
                                 return true;
                            }
                           Â
                            function jsApproveNote()
                            {
                                 if (window.showModalDialog)
                                 {
                                       // modal window
                                       window.showModalDialog('po pup/edit_r eason_moda l.cfm', window, 'resizable: no; help: no; status: no; scroll: no; ');
                                       return true;
                                 }
                                 //else
                                 //{
                                       // pop-up window
                                       //window.open('popup/edit_ reason.cfm ', '', 'scrollbars=no,width=280,h eight=150' );
                                       //return true;
                                 //}
                            }
                           Â
                            function jsCarefulSubmit() {
                                 var valid = #jsValidate#();
     Â
                                 if (valid) {
                                       if (submitted) return false;
                                      Â
                                       document.body.onbeforeunlo ad = null;
                                       submitted = true;
                                 }
     Â
                                 return valid;
                            }
                      </script>
     Â
                      <table border="0" cellpadding="0" cellspacing="0">
                            <form name="#formName#" action="#formData.link#<cf if isDefined("URL.listparam") >&#URLDeco de(URL.lis tparam)#</ cfif>" method="post" enctype="multipart/form-da ta" onSubmit="return jsCarefulSubmit();" <cfif isDefined("formData.target ")>target= "#formData .target#"< /cfif>>
                                 <input type="hidden" name="ID" value="#arguments.ID#">
                                 <tr>
                                       <td>
                                            #getFormTabs(formData, qryCurrent)#
                Â
                                            <cfsavecontent variable="buttons">
                                                  <cfset editbuttons = getEditButtons(formData, qryCurrent)>
                                                 Â
                                                  <!--- notification --->
                                                  <input type="hidden" name="HB_sendNotification" value="0">
                                                  <input type="hidden" name="txtEditReason" id="txtEditReason" value="">
                                                  <cfloop from="1" to="#ArrayLen(editbuttons) #" index="i">
                                                       <input <cfif StructKeyExists(editbutton s[i], "name")>name="#editbuttons [i].name#" <cfelse>na me="button "</cfif> type="submit" class="buttons" id="#editbuttons[i].title# _btn" value="#translate(editbutt ons[i].tit le)#"
                                                       <cfif StructKeyExists(editbutton s[i], "width")>style="width: #editbuttons[i].width#px"< /cfif>
                                                       <cfif StructKeyExists(editbutton s[i], "onClick")>onClick="#editb uttons[i]. onClick#"
          Â
                                                       <cfelseif editbuttons[i].title is "Check In" AND isDefined("this.qryCompany .blnNotifi cation") AND Val(this.qryCompany.blnNot ification) AND isDefined("formData.blnNot ification" ) AND formData.blnNotification>
                                                             <cftry>
                                                                  <cfset notifier = getObject("hb50.plugins.ge neric.noti fier",this .companyID ,true)>
                                                                  <cfif notifier.getNotifierListsB yWebID(Val (formData. webid)).re cordCount>
                                                                        <cfif getAddNote(formData) is true>
                                                                             onClick="return jsConfirmNotification(true );"
                                                                        <cfelse>
                                                                             onClick="return jsConfirmNotification(fals e);"
                                                                        </cfif>
                                                                  </cfif>
                                                             <cfcatch></cfcatch>
                                                             </cftry>
                                                       </cfif>
                                                       <cfif editbuttons[i].title is "Check In">
                                                             <cfif getAddNote(formData) is true>
                                                                  onClick="return jsApproveNote();"
                                                             </cfif>
                                                       </cfif>
                                                       <cfif StructKeyExists(editbutton s[i], "disabled")>disabled="#edi tbuttons[i ].disabled #"</cfif>
                                                       >
                                                  </cfloop>
                                            </cfsavecontent>
                                            #getButtonLayer(buttons)#
                                       </td>
                                 </tr>
                            </form>
                      </table>
                      <cfif formData.blnVersion and isDefined("FORM.intVersion ID") and Len(versionLink)>
                            #getVersionForm(qryVersion , Val(FORM.intVersionID), versionLink)#
                      </cfif>
                     Â
                      <cfif formData.blnWorkflow and formData.blnTranslate>
                            #getLanguageForm()#
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
     Â
      <!--- this function determines if we should display the edit note popup --->
      <cffunction name="getAddNote" returntype="boolean" access="private">
           <cfargument name="formData" type="any" required="true">
           <!--- if this is a super user or at the last level of the approval,
                  do not popup an edit box --->
           <cfif SESSION.superuser>
                 <cfreturn false />
           </cfif>
           <!--- get this user's moderator level --->
           <cfquery name="qryCurrentMod" datasource="#this.datasour ce#">
                 SELECT       intLevel
                 FROM       tblModerator
                 JOIN       tblUserGroup
                 ON            tblUserGroup.intGroupID = tblModerator.intModeratorI D
                 JOIN       tblUser
                 ON            tblUserGroup.intUserID = tblUser.intID
                 WHERE       tblUser.intID = <cfqueryparam value="#SESSION.userid#" cfsqltype="cf_sql_integer" >
                 AND       tblModerator.intNavID = <cfqueryparam value="#formData.webid#" cfsqltype="cf_sql_integer" >
           </cfquery>
           <!--- get the highest moderator level for this page --->
           <cfquery name="qryTopMod" datasource="#this.datasour ce#">
                 SELECT       intLevel
                 FROM       tblModerator
                 WHERE       intNavID = <cfqueryparam value="#formData.webid#" cfsqltype="cf_sql_integer" >
                 ORDER BY intLevel DESC
           </cfquery>
           <!--- if we are the big cahoona, then do not display popup --->
           <cfif qryCurrentMod.recordCount and qryTopMod.recordCount>
                 <cfif qryCurrentMod.intLevel is qryTopMod.intLevel>
                      <cfreturn false />
                 </cfif>
           <cfelseif NOT qryTopMod.recordCount>
                 <!--- workflow does not exist for this page so do not add note --->
                 <cfreturn false />
           </cfif>
          Â
           <cfreturn true />
      </cffunction>
      <cffunction name="getEditButtons" returntype="array" access="private" output="false">
           <cfargument name="formData" type="struct" required="true">
           <cfargument name="qryCurrent" type="query" required="true">
           <cfscript>
                 var editbuttons = ArrayNew(1);
                 var notifier = '';
                 var x = '';
                 var idx = 1;
                 var length = ArrayLen(formData.editbutt ons);
                Â
                 //use user-defined edit buttons
                 if (not isDefined('formData.append Editbutton s') and length) {
                      editbuttons = formData.editbuttons;
                      return editbuttons;
                 }
          Â
                 if (isDefined("qryCurrent.bln Deleted") and qryCurrent.blnDeleted is 1) {
                      if (formData.blnRestore) {
                            x = StructNew();
                            x.title = "Restore";
                            ArrayAppend(editbuttons, x);
                      }
                     Â
                      x = StructNew();
                      x.title = "Go Back";
                      ArrayAppend(editbuttons, x);
                 }
                 else {
                      if (formData.blnDelete) {
                            x = StructNew();
                            x.title = "Delete";
                            x.onclick = "jsValidationRequired = false; return confirm('#JSStringFormat(t ranslate(" Are you sure you want to delete this item?"))#');";
                            ArrayAppend(editbuttons, x);
                      }
                      if (formData.blnPreview) {
                            x = StructNew();
                            x.title = "Keyword Analysis";
                            x.width = 130;
                            x.onclick = "return analyzeItem(this.form);";
                            ArrayAppend(editbuttons, x);
                            x = StructNew();
                            x.title = "Preview";
                            x.onclick = "return previewItem(this.form);";
                            ArrayAppend(editbuttons, x);
                      }
                      x = StructNew();
                      x.title = "Save";
                      ArrayAppend(editbuttons, x);
                     Â
                      if (formData.blnLock) {
                            x = StructNew();
                            x.title = "Check In";
                           Â
                            //notification
                            if (isDefined("this.qryCompan y.blnNotif ication") and Val(this.qryCompany.blnNot ification) and isDefined("formData.blnNot ification" ) and formData.blnNotification) {
                                 try {
                                       notifier = getObject("hb50.plugins.ge neric.noti fier", this.companyID, true);
                                       if (notifier.getNotifierLists ByWebID(Va l(formData .webid)).r ecordCount ) {
                                            if (getAddNote(formData) is true)
                                                  x.onClick = "return jsConfirmNotification(true );";
                                            else
                                                  x.onClick = "return jsConfirmNotification(fals e);";
                                       }
                                       else {
                                            if (getAddNote(formData) is true)
                                                  x.onClick = "return jsApproveNote();";
                                       }
                                 }
                                 catch (Any excpt) {}
                            }
                            ArrayAppend(editbuttons, x);
                      }
                 }
                Â
                 //append user-defined editbuttons
                 if (isDefined('formData.appen dEditbutto ns') and formData.appendEditbuttons is true and length) {
                      for (idx = 1; idx lte length; idx = idx + 1)
                            ArrayAppend(editbuttons, formData.editbuttons[idx]) ;
                 }
                 return editbuttons;
           </cfscript>
      </cffunction>
      <cffunction name="getApproveForm" access="public" returntype="string" hint="Returns Default Approve Form" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="ID" required="true" type="numeric">
           <cfargument name="formName" required="false" default="frmAddEdit">
           <cfargument name="jsValidate" required="false" default="jsValidate">
           <cfset var i = 0>
           <cfset var oldMetaTags = ''>
           <cfset var newMetaTags = ''>
           <cfquery name="qryOld" datasource="#this.datasour ce#" maxrows="1">
                 SELECT      TOP 1 *
                 FROM       #formData.tablename#
                 WHERE       intItemID = #ID#
                 AND       blnLive = 1
                 ORDER BY dtAdded DESC
           </cfquery>
           <cfquery name="qryNew" datasource="#this.datasour ce#" maxrows="1">
                 SELECT       TOP 1 *
                 FROM       #formData.tablename#
                 WHERE       intItemID = #ID#
                 AND       blnLive = 0
                 ORDER BY dtAdded DESC
           </cfquery>
           <cfparam name="leftBody" default="">
           <cfparam name="rightBody" default="">
          Â
           <cfsavecontent variable="buttons">
                 <cfoutput>
                      <script language="JavaScript">
                            function jsDecline () {
                                 if (window.showModalDialog) {
                                       // modal window
                                       window.showModalDialog('po pup/declin e_reason_m odal.cfm', window, 'resizable: no; help: no; status: no; scroll: no; ');
                                       return true;
                                 } else {
                                       // pop-up window
                                       window.open('popup/decline _reason.cf m', '', 'scrollbars=no,width=280,h eight=150' );
                                       return false;
                                 }
                            }
                      </script>
                     Â
                      <input name="button" type="submit" <cfif NOT qryOld.recordCount>disable d</cfif> value="#translate("Preview Current")#" class="buttons" onclick="return previewWorkflow(this.form, false)">
                      <input name="button" type="submit" value="#translate("Preview Modified")#" class="buttons" onclick="return previewWorkflow(this.form, true)">
                      <input name="button" type="submit" value="#translate("Approve ")#" class="buttons">
                      <input name="button" type="submit" value="#translate("Decline ")#" class="buttons" onclick="return jsDecline();">
                      <input name="button" type="submit" value="#translate("Edit")# " class="buttons">
                      <input type="hidden" name="txtDeclineReason" id="txtDeclineReason" value="">
                      <!--- this is here because we need to somehow submit the form with button=Decline without 'clicking' Decline --->
                      <input type="hidden" name="button" id="fakeButton" value="" disabled>
                 </cfoutput>
           </cfsavecontent>
           <cfset numChanged = 0>
           <cfsavecontent variable="body">
                 <cfoutput>
                      <!--- in case no content is added yet --->
                      <cfif NOT qryOld.recordCount AND qryNew.recordCount>
                            <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="key">
                                       <cfset column = formData.columns[key]>
                                            <cfif column.varname EQ 'txtBody'>
                                                  <cfset rightBody = HTMLEditFormat(getItemView (formData, column, qryNew[column.varname][1]) )>
                                            </cfif>
                                 </cfloop>
                      </cfif>
                      <cfif qryOld.recordCount>
                            <table width="523" border="0" cellpadding="5" cellspacing="0" align="center">
                                 <tr>
                                       <td height="21" style="border-left: 1px solid ##999999;"><img src="images/shim.gif" width="1" height="21"></td>
                                       <td style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;"><img src="images/shim.gif" width="1" height="21"></td>
                                 </tr>
                                 <cfset numChanged = 0>
                                 <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="key">
                                       <cfset column = formData.columns[key]>
                                       <cfif (not isDefined("column.display" ) or column.display neq "false")
                                             and column.type neq TYPES.HIDDEN and (not isDefined("column.insert") or column.insert)
                                             and qryOld[column.varname][1] neq qryNew[column.varname][1]>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset compare = diff(getItemView(formData, column, qryOld[column.varname][1]) , getItemView(formData, column, qryNew[column.varname][1]) )>
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">#colum n.title#:< /span><br>
                                                  #compare.str1#
                                            <cfif column.varname EQ 'txtBody'>
                                                  <cfset leftBody = HTMLEditFormat(getItemView (formData, column, qryOld[column.varname][1]) )>
                                            </cfif>
                                       </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                            <span class="formCaption">#colum n.title#:< /span><br>
                                            #compare.str2#
                                            <cfif column.varname EQ 'txtBody'>
                                                  <cfset rightBody = HTMLEditFormat(getItemView (formData, column, qryNew[column.varname][1]) )>
                                            </cfif>
                                            </td></tr>
                                       </cfif>
                                 </cfloop>
                                 <!--- if using tblResource, we can assume that we also want to compare the file uploaded to this resource.
                                        comparing based on the table name is a Very Bad Thing to do, but I can't figure out another way to make
                                        the exception to pull this off, except making a custom approval form in resources.cfc, which i don't want to do.
                                 --->
                                 <cfif formData.tablename is "tblResource">
                                       <cfset media = createObject("component", "hb50.media").init(this.Co mpanyID)>
                                       <cfset oldView = "">
                                       <cfif Val(qryOld.intMediaID)>
                                            <cfset oldFile = media.getURL(qryOld.intMed iaID)>
                                            <cfset oldView = '<a href="#oldFile#" target="_blank">#GetFileFr omPath(old File)#</a> '>
                                       </cfif>
                                       <cfset newView = "">
                                       <cfif Val(qryNew.intMediaID)>
                                            <cfset newFile = media.getURL(qryNew.intMed iaID)>
                                            <cfset newView = '<a href="#newFile#" target="_blank">#GetFileFr omPath(new File)#</a> '>
                                       </cfif>
                                       <cfif oldView neq newView>
                                            <cfset numChanged = numChanged + 1>
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">File:< /span><br>
                                                  <span style="background-color: ##FFFF00;">#oldView#</span >
                                            </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                  <span class="formCaption">File:< /span><br>
                                                  <span style="background-color: ##FFFF00;">#newView#</span >
                                            </td></tr>
                                       </cfif>
                                 </cfif>
                                Â
                                 <!--- additional resources --->
                                 <cfif formData.blnResources>
                                       <cfset media = createObject("component", "hb50.media").init(this.Co mpanyID)>
                                      Â
                                       <cfset oldView = "">
                                       <cfif Val(qryOld.intResourceID)>
                                            <cfset oldResources = media.getAdditionalResourc es(qryOld. intResourc eID)>
                                            <cfloop from="1" to="#ArrayLen(oldResources )#" index="i">
                                                  <cfset oldView = oldView & '#oldResources[i].title#<b r>(<a href="#oldResources[i].lin k#" target="_blank">#GetFileFr omPath(old Resources[ i].link)#< /a>)<br><b r>'>
                                            </cfloop>
                                       </cfif>
                                      Â
                                       <cfset newView = "">
                                       <cfif Val(qryNew.intResourceID)>
                                            <cfset newResources = media.getAdditionalResourc es(qryNew. intResourc eID)>
                                            <cfloop from="1" to="#ArrayLen(newResources )#" index="i">
                                                  <cfset newView = newView & '#newResources[i].title#<b r>(<a href="#newResources[i].lin k#" target="_blank">#GetFileFr omPath(new Resources[ i].link)#< /a>)<br><b r>'>
                                            </cfloop>
                                       </cfif>
                                      Â
                                       <cfif oldView neq newView>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset compare = diff(oldView, newView)>
                                            <tr>
                                                  <td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                       <span class="formCaption">Additi onal Resources:</span><br>
                                                       #compare.str1#
                                                  </td>
                                                  <td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                       <span class="formCaption">Additi onal Resources:</span><br>
                                                       #compare.str2#
                                                  </td>
                                            </tr>
                                       </cfif>
                                 </cfif>
                                Â
                                 <!--- meta data --->
                                 <cfif formData.blnMeta>     Â
                                       <cfif qryOld.txtMetaKeywords neq qryNew.txtMetaKeywords>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset oldView = qryOld.txtMetaKeywords>
                                            <cfset newView = qryNew.txtMetaKeywords>
                                            <cfset compare = diff(oldView,newView)>
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">Meta Keywords:</span><br>
                                                  #compare.str1#
                                            </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                  <span class="formCaption">Meta Keywords:</span><br>
                                                  #compare.str2#
                                            </td></tr>
                                       </cfif>
                                       <cfif qryOld.txtMetaDescription neq qryNew.txtMetaDescription>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset oldView = qryOld.txtMetaDescription>
                                            <cfset newView = qryNew.txtMetaDescription>
                                            <cfset compare = diff(oldView,newView)>
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">Meta Description:</span><br>
                                                  #compare.str1#
                                            </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                  <span class="formCaption">Meta Description:</span><br>
                                                  #compare.str2#
                                            </td></tr>
                                       </cfif>
     Â
                                       <cfset this.htmlHead = createObject('component'," hb50.util. htmlhead") .init(this .companyId ,true,0,0) >
                                       <cfset oldMetaTags = this.htmlhead.getMetaTags( ID,qryOld. intID)>
                                       <cfset newMetaTags = this.htmlHead.getMetaTags( ID,qryNew. intID)>
                                       <cfif ArrayLen(oldMetaTags) OR ArrayLen(newMetaTags)>
                                            <cfif ArrayLen(oldMetaTags) GTE ArrayLen(newMetaTags)>
                                                  <cfloop from="1" to="#ArrayLen(oldMetaTags) #" index="idx">
                                                       <cfif StructKeyExists(oldMetaTag s[idx], 'name')>
                                                             <cfset tagName = oldMetaTags[idx].name>
                                                             <cfset newTagContent = getMetaTagContent(newMetaT ags, 'name', tagName)>
                                                       <cfelse>
                                                             <cfset tagName = oldMetaTags[idx].httpequiv >
                                                             <cfset newTagContent = getMetaTagContent(newMetaT ags, 'httpequiv', tagName)>
                                                       </cfif>
                                                       <cfset oldTagContent = oldMetaTags[idx].content>
     Â
                                                       <cfif oldTagContent NEQ newTagContent>
                                                             <cfset numChanged = numChanged + 1>
                                                             <cfset compare = diff(oldTagContent, newTagContent)>
                                                             <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                                  <span class="formCaption">#tagNa me#:</span ><br>
                                                                  #compare.str1#
                                                             </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                                  <span class="formCaption">#tagNa me#:</span ><br>
                                                                  #compare.str2#
                                                             </td></tr>
                                                       </cfif>
                                                  </cfloop>
                                                  <cfloop from="1" to="#ArrayLen(newMetaTags) #" index="idx">
                                                       <cfif StructKeyExists(newMetaTag s[idx], 'name')>
                                                             <cfset tagName = newMetaTags[idx].name>
                                                       <cfelse>
                                                             <cfset tagName = newMetaTags[idx].httpequiv >
                                                       </cfif>
                                                       <cfset newTagContent = newMetaTags[idx].content>
                                                       <cfset numChanged = numChanged + 1>
                                                       <cfset compare = diff('', newTagContent)>
                                                       <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                             <span class="formCaption">#tagNa me#:</span ><br>
                                                             #compare.str1#
                                                       </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                             <span class="formCaption">#tagNa me#:</span ><br>
                                                             #compare.str2#
                                                       </td></tr>
                                                  </cfloop>
                                            <cfelse>
                                                  <cfloop from="1" to="#ArrayLen(newMetaTags) #" index="idx">
                                                       <cfif StructKeyExists(newMetaTag s[idx], 'name')>
                                                             <cfset tagName = newMetaTags[idx].name>
                                                             <cfset oldTagContent = getMetaTagContent(oldMetaT ags, 'name', tagName)>
                                                       <cfelse>
                                                             <cfset tagName = newMetaTags[idx].httpequiv >
                                                             <cfset oldTagContent = getMetaTagContent(oldMetaT ags, 'httpequiv', tagName)>
                                                       </cfif>
                                                       <cfset newTagContent = newMetaTags[idx].content>
     Â
                                                       <cfif oldTagContent NEQ newTagContent>
                                                             <cfset numChanged = numChanged + 1>
                                                             <cfset compare = diff(oldTagContent, newTagContent)>
                                                             <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                                  <span class="formCaption">#tagNa me#:</span ><br>
                                                                  #compare.str1#
                                                             </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                                  <span class="formCaption">#tagNa me#:</span ><br>
                                                                  #compare.str2#
                                                             </td></tr>
                                                       </cfif>
                                                  </cfloop>
                                                  <cfloop from="1" to="#ArrayLen(oldMetaTags) #" index="idx">
                                                       <cfif StructKeyExists(oldMetaTag s[idx], 'name')>
                                                             <cfset tagName = oldMetaTags[idx].name>
                                                       <cfelse>
                                                             <cfset tagName = oldMetaTags[idx].httpequiv >
                                                       </cfif>
                                                       <cfset oldTagContent = oldMetaTags[idx].content>
                                                       <cfset numChanged = numChanged + 1>
                                                       <cfset compare = diff(oldTagContent, '')>
                                                       <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                             <span class="formCaption">#tagNa me#:</span ><br>
                                                             #compare.str1#
                                                       </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                             <span class="formCaption">#tagNa me#:</span ><br>
                                                             #compare.str2#
                                                       </td></tr>
                                                  </cfloop>
                                            </cfif>
                                       </cfif>
                                 </cfif>
                           Â
                                 <!--- scheduling --->
                                 <cfif formData.blnScheduling>
                                       <cfscript>
                                            x = StructNew();
                                            x.varname = "dtStart";
                                            x.title = "The date/time this data is scheduled to start";
                                            x.type = TYPES.DATE;
                                            x.required = true;
                                            startColumn = x;
     Â
                                            x = StructNew();
                                            x.varname = "dtEnd";
                                            x.title = "The date/time this data is scheduled to end";
                                            x.type = TYPES.DATE;
                                            x.required = true;
                                            endColumn = x;
                                       </cfscript>
                                       <cfif qryOld.dtStart neq qryNew.dtStart>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset compare = diff(getItemView(formData, startColumn, qryOld.dtStart), getItemView(formData, startColumn, qryNew.dtStart))>
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">Start Date:</span><br>
                                                  #compare.str1#
                                            </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                  <span class="formCaption">Start Date:</span><br>
                                                  #compare.str2#
                                            </td></tr>
                                       </cfif>
                                       <cfif qryOld.dtEnd neq qryNew.dtEnd>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset compare = diff(getItemView(formData, endColumn, qryOld.dtEnd), getItemView(formData, endColumn, qryNew.dtEnd))>
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">End Date:</span><br>
                                                  #compare.str1#
                                            </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                  <span class="formCaption">End Date:</span><br>
                                                  #compare.str2#
                                            </td></tr>
                                       </cfif>
                                 </cfif>
                                 <tr><td style="border-bottom: 1px solid ##999999; border-left: 1px solid ##999999;" height="1"><img src="images/shim.gif" height="1" width="1"></td><td style="border-bottom: 1px solid ##999999; border-left: 1px solid ##999999; border-right: 1px solid ##999999;" height="1"><img src="images/shim.gif" height="1" width="1"></td></tr>
                            </table>
     Â
                      <cfelse> <!--- approving a newly added item --->
                            <cfset numChanged = 1>
                            <table width="523" border="0" cellpadding="5" cellspacing="0" align="center">
                                 <tr>
                                       <td class="default">
                                            <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="key">
                                                  <cfset column = formData.columns[key]>
                                                  <cfif (not isDefined("column.display" ) or column.display neq "false") and column.type neq TYPES.HIDDEN and isDefined("qryNew.#column. varname#") >
                                                       <span class="formCaption">#colum n.title#:< /span><br>
                                                       #getItemView(formdata, column, qryNew[column.varname][1]) #<br><br>
                                                  </cfif>
                                            </cfloop>
                                      Â
                                            <!--- if using tblResource, we can assume that we also want to compare the file uploaded to this resource.
                                                   comparing based on the table name is a Very Bad Thing to do, but I can't figure out another way to make
                                                   the exception to pull this off, except making a custom approval form in resources.cfc, which i don't want to do.
                                            --->
                                            <cfif formData.tablename is "tblResource">
                                                  <cfset media = createObject("component", "hb50.media").init(this.Co mpanyID)>
                                                  <cfset newView = "">
                                                  <cfif Val(qryNew.intMediaID)>
                                                       <cfset newFile = media.getURL(qryNew.intMed iaID)>
                                                       <cfset newView = '<a href="#newFile#" target="_blank">#GetFileFr omPath(new File)#</a> '>
                                                  </cfif>
                                                  <span class="formCaption">File:< /span><br>
                                                       #newView#<br><br>
                                            </cfif>
                                       </td>
                                 </tr>
                            </table>
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfif numChanged is 0>
                 <cfset body = "There were no changes.">
           </cfif>
           <cfsavecontent variable="output">
                 <cfoutput>
                      <table border="0" cellspacing="0" cellpadding="0" align="center">
                            <form name="#formName#" action="#formData.link#<cf if isDefined("URL.listparam") >&#URLDeco de(url.lis tparam)#</ cfif>" method="post" enctype="multipart/form-da ta" <cfif isDefined("formData.target ")>target= "#formData .target#"< /cfif>>
                                 <input type="hidden" name="ID" value="#ID#">
                                 <input type="hidden" name="txtCurrentBody" id="txtCurrentBody" value="#leftBody#">
                                 <input type="hidden" name="txtBody" id="txtBody" value="#rightBody#">
                                 <tr>
                                       <td class="default">
                                       <cfif qryOld.recordcount and numChanged>
                                            <div id="header" style="position:absolute; visibility:visible; left:2px; top:0px; width:523px; height:20px; z-index:2; background-color:##ffffff; ">
                                                  <table width="525" border="0" cellspacing="0" cellpadding="0">
                                                       <tr>
                                                             <td bgcolor="##FFFFFF"><img src="images/shim.gif" width="1" height="1"></td>
                                                       </tr>
                                                  </table>
                                                  <table class="tableOutline" width="523" border="0" cellspacing="1" cellpadding="0" bgcolor="##FFFFFF">
                                                        <tr>
                                                             <td height="21" width="50%" class="toolHeader">#transl ate("Curre nt")#</td>
                                                             <td height="21" width="50%" class="toolHeader">#transl ate("Modif ied")#</td >
                                                        </tr>
                                                  </table>
                                            </div>
                                       </cfif>
                Â
                                       #getInnerLayer(body, "approval", true)#
                                       #getButtonLayer(buttons)#
                Â
                                       <cfif formData.blnWorkflow and formData.blnTranslate>
                                            #getLanguageForm()#
                                       </cfif>
                                       </td>
                                 </tr>
                            </form>
                      </table>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
      <cffunction name="getMetaTagContent" access="private" returntype="string" output="false">
           <cfargument name="tagArray" type="array" required="true">
           <cfargument name="type" type="string" required="true">
           <cfargument name="tag" type="string" required="true">
           <cfset var tagContent = ''>
           <cfset var theTag = ''>
           <cfset var aIndex = 0>
           <cfloop from="1" to="#ArrayLen(tagArray)#" index="aIndex">
                 <cfset theTag = tagArray[aIndex]>
                 <cfif StructKeyExists(theTag,typ e) and theTag[type] is tag>
                      <cfset tagContent = theTag.content>
                      <cfset ArrayDeleteAt(tagArray, aIndex)>
                      <cfreturn tagContent />
                 </cfif>
           </cfloop>
          Â
           <cfreturn tagContent />
      </cffunction>
      <!--- return the current url with form parameters encoded into the url --->
      <cffunction name="getCurrentURL" returntype="string">
           <cfset var page = CGI.SCRIPT_NAME />
           <cfset var sep = "?" />
           <cfset key = '' />
          Â
           <cfif Len(CGI.QUERY_STRING) or StructCount(FORM)>
                 <cfloop collection="#FORM#" item="key">
                      <cfif key neq "FIELDNAMES">
                            <cfset page = "#page##sep##key#=#URLEnco dedFormat( FORM[key]) #" />
                            <cfset sep = "&" />
                      </cfif>
                 </cfloop>
                 <cfif Len(CGI.QUERY_STRING)>
                      <cfset page = "#page##sep##ReReplaceNoCa se(CGI.QUE RY_STRING, '[&]?SR=[0-9]+', '')#" />
                 </cfif>
           </cfif>
           <cfreturn page />
      </cffunction>
      <!--- given two strings, returns a struct with the two strings, with changes highlighted in yellow --->
      <cffunction name="diff" returntype="any" output="false">
           <cfargument name="str1" type="string">
           <cfargument name="str2" type="string">
           <cfset var output = StructNew()>
           <cfset var start = 0> <!--- how many characters match at the start --->
           <cfset var end = 0>  <!--- how many characters match at the end --->
           <cfset var a = 0>
           <cfset var string1 = Trim(arguments.str1)>
           <cfset var string2 = Trim(arguments.str2)>           Â
           <cfset output.str1 = "">
           <cfset output.str2 = "">
           <cfif Compare(str1, str2) is 0>
                 <cfset output.str1 = str1>
                 <cfset output.str2 = str2>
                Â
                 <cfreturn output />
           </cfif>
           <!--- find the number of characters at the start of the strings that are equal (start) --->
           <cfloop from="1" to="#min(Len(string1), len(string2))#" index="a">
                 <cfif asc(mid(string1, a, 1)) is asc(mid(string2, a, 1))>
                      <cfset start = start + 1>
                 <cfelse>
                      <cfbreak>
                 </cfif>
           </cfloop>
           <!--- the number of characters after the matched chunk at the start --->
           <cfset lastLength = min(len(string1), len(string2)) - start>
           <!--- count the number of characters that are equal at the end of the strings --->
           <cfloop from="1" to="#min(lastLength, min(len(string1), len(string2)))#" index="a">
                 <cfif asc(mid(string1, len(string1) - a + 1, 1)) is asc(mid(string2, len(string2) - a + 1, 1))>
                      <cfset end = end + 1>
                 <cfelse>
                      <cfbreak>
                 </cfif>
           </cfloop>
           <!--- use starting matching chunk --->
           <cfif start gt 0>
                 <cfset output.str1 = left(string1, start)>
                 <cfset output.str2 = left(string1, start)>
           </cfif>
           <!--- append highlighted differing part (if necessary) --->
           <cfset highlight1 = max(0,len(string1) - start - end)>
           <cfif highlight1 gt 0>
                 <cfset output.str1 = output.str1 & '<span style="background-color: ##FFFF00;">' & mid(string1, start + 1, highlight1) & '</span>'>
           </cfif>
           <cfset highlight2 = max(0,len(string2) - start - end)>
           <cfif highlight2 gt 0>
                 <cfset output.str2 = output.str2 & '<span style="background-color: ##FFFF00;">' & mid(string2, start + 1, highlight2) & '</span>'>
           </cfif>
           <!--- append similar chunk on end --->
           <cfif end gt 0>
                 <cfset output.str1 = output.str1 & right(string1, end)>
                 <cfset output.str2 = output.str2 & right(string2, end)>
           </cfif>
           <cfreturn output />
      </cffunction>
      <cffunction name="getJSValidate" access="public" returntype="string" hint="Returns jsValidate cases." output="false">
           <cfargument name="formData" required="true">
           <cfargument name="formName" required="false" default="frmAddEdit">
           <cfargument name="functionName" required="false" default="jsValidate">
           <cfset isRequired = translate('is required')>
           <cfsavecontent variable="output">
                 <cfoutput>
                      <script language="JavaScript">
                            var jsValidationRequired = true;
                            function #functionName#() {
                                 // when they click delete, set jsValidationRequired to false and it won't validate the page.
                                 if (!jsValidationRequired) return true;
     Â
                                 <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="key">
                                       <cfset i = formData.columns[key]>
                                       <cfif isDefined("i.required") and i.required>
                                            <cfif i.type is TYPES.MEDIA and SESSION.blnAddResource>
                                                  if (document.#formName#.#i.va rname# != undefined && !document.#formName#.#i.va rname#.dis abled) {
                                                        if (document.getElementById(' #i.varname #_pickold' ).style.di splay == 'none') {
                                                             if (!(document.#formName#.#i. varname#_u pload.valu e &&
                                                              document.#formName#.#i.var name#_add_ title.valu e &&
                                                              document.#formName#.#i.var name#_cate gory.value )) {
                                                                         alert('#translate("A Category, Title and File are required for")# #i.title#');
                                                                        return false;
                                                             }
                                                       } else {
                                                             if (!document.#formName#.#i.v arname#.va lue) {
                                                                  alert("#translate(i.title) # #isRequired#.");
                                                                  mydiv = document.getElementById('# i.varname# ');
                                                                  if (document.#formName#.#i.va rname#.foc us && mydiv.style.display == 'block') document.#formName#.#i.var name#.focu s();
                                                                  return false;
                                                             }
                                                       }
                                                  }
                                            <cfelse>
                                                  <cfif i.type is TYPES.CATEGORY>
                                                        if (document.#formName#.#i.va rname# != undefined && !document.#formName#.#i.va rname#.dis abled
                                                             && !(document.#formName#.#i.v arname#.va lue || document.#formName#.#i.var name#_add_ title.valu e)) {
                                                  <cfelse>
                                                        <!--- Donny (20060623): document.#formName#.#i.var name#.disa bled can be undefined for disabled field --->
                                                        if (document.#formName#.#i.va rname# != undefined && document.#formName#.#i.var name#.disa bled == false && !document.#formName#.#i.va rname#.val ue) {
                                                  </cfif>
                                                             alert("#translate(i.title) # #isRequired#.");
                                                             <cfif i.type is TYPES.HTML and SESSION.richText>
                                                                  htmldiv = document.getElementById('D IV#i.varna me#');
                                                                  if (htmldiv.focus && htmldiv.style.display == 'block') htmldiv.focus();
                                                             <cfelse>
                                                                  mydiv = document.getElementById('# i.varname# ');
                                                                  try {
                                                                        document.#formName#.#i.var name#.focu s();
                                                                  } catch (e) {}
                                                             </cfif>
                                                             return false;
                                                        }
                                            </cfif>
                                       </cfif>
                                 </cfloop>
     Â
                                 return true;
                            }
                      </script>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
      <cffunction name="getXMLSelect" access="public" returntype="string" hint="Returns a select generated using an XML document" output="false">
           <cfargument name="xmlDoc" type="any" required="true">
           <cfargument name="varname" type="string" required="true">
           <cfargument name="selList" type="any" required="false" default="0">
           <cfargument name="pruneAt" type="string" required="false" default=""> <!--- used to avoid cycles --->
           <cfsavecontent variable="output">
                 <cfoutput>
                      <select name="#varname#">
                            <option value="#xmldoc.item.xmlatt ributes.id #" <cfif ListFind(selList, xmldoc.item.xmlattributes. id)>select ed</cfif>> #xmldoc.it em.xmlattr ibutes.cap tion#</opt ion>
                            #getXMLSelectRecursive(xml doc.item, varname, selList, pruneAt)#
                      </select>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn output />
      </cffunction>
      <cffunction name="getXMLSelectRecursiv e" access="public" returntype="string" hint="Returns options recursively generated using an XML document" output="false">
           <cfargument name="xmlDoc" type="any" required="true">
           <cfargument name="varname" type="string" required="true">
           <cfargument name="selList" type="any" required="true">
           <cfargument name="pruneAt" type="string" required="true">
           <cfargument name="indent" type="numeric" required="false" default="0">
           <cfargument name="showCategory" type="boolean" required="false" default="true">
           <cfsavecontent variable="output">
                 <cfoutput>
                      <cfloop from="1" to="#ArrayLen(xmlDoc.xmlch ildren)#" index="i">
                            <cfset item = xmlDoc.xmlchildren[i]>                      Â
                            <cfif not ListFindNoCase(pruneAt, item.xmlattributes.id) and (not isDefined('item.xmlattribu tes.blnCat egory') or not item.xmlattributes.blnCate gory or showCategory)>
                                 <option value="#item.xmlattributes .id#" <cfif ListFind(selList, item.xmlattributes.id)>sel ected</cfi f>>#Repeat String("&n bsp;", indent*3)##item.xmlattribu tes.captio n#</option >
                                 #getXMLSelectRecursive(ite m, varname, selList, pruneAt, indent + 1, showCategory)#
                            </cfif>
                      </cfloop>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn output />
      </cffunction>
     Â
      <!--- todo :: 931 :: KJ :: 7 dec 2006 :: Global Meta Data set up to emulate Workflow :: copy of getXMLSelectRecursive(), this new funtion is modifed return a list of ids --->
      <cffunction name="getXMLSelectRecursiv e2" access="public" returntype="string" hint="Returns options recursively generated using an XML document" output="false">
           <cfargument name="xmlDoc" type="any" required="true">
           <cfargument name="varname" type="string" required="true">
           <cfargument name="selList" type="any" required="true">
           <cfargument name="pruneAt" type="string" required="true">
           <cfargument name="indent" type="numeric" required="false" default="0">
           <cfargument name="showCategory" type="boolean" required="false" default="true">
           <cfsavecontent variable="output">
                      <cfloop from="1" to="#ArrayLen(xmlDoc.xmlch ildren)#" index="i">
                            <cfset item = xmlDoc.xmlchildren[i]>                      Â
                            <cfif not ListFindNoCase(pruneAt, item.xmlattributes.id) and (not isDefined('item.xmlattribu tes.blnCat egory') or not item.xmlattributes.blnCate gory or showCategory)>
                                 <cfoutput>,#item.xmlattrib utes.id#</ cfoutput>
                                 <cfset tempList = "#getXMLSelectRecursive2(i tem, varname, selList, pruneAt, indent + 1, showCategory)#">
                                 <cfif len(trim(tempList)) GT 0>
                                       <cfoutput>,#trim(tempList) #</cfoutpu t>
                                 </cfif>
                            </cfif>
                      </cfloop>
           </cfsavecontent>
          Â
           <cfreturn output />
      </cffunction>
      <cffunction name="memoFormat" access="public" returntype="string" output="false">
           <cfargument name="input" type="string" required="true">
           <cfargument name="length" type="numeric" required="true">
           <cfargument name="dots" type="string" required="false" default="...">
           <cfset var text = REReplace(arguments.input, "<[^>]*>"," ","all")>
           <cfif Len(text) gt arguments.length>
                 <cfset text = Left(text, length)>
                 <cfset lastSpace = Len(text) - ReFind("\s[^\s]", reverse(text))>
                 <cfset text = Left(text, lastSpace) & dots>
           </cfif>
          Â
           <cfreturn text />
      </cffunction>
      <cffunction name="getItemView" access="public" returntype="string" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="i" type="struct" required="true">
           <cfargument name="data" type="string" required="true">
           <cfset width = 225>
           <cfsavecontent variable="output">
                 <cfoutput>
                      <cfif ListFind("#TYPES.TEXT#,#TY PES.HTML#, #TYPES.MEM O#,#TYPES. NUMBER#,#T YPES.COLOU R#", i.type)>
                            #this.workflow.convertToke ns(data)#
                      <cfelseif i.type is TYPES.DATE>
                            <!--- date always has a default of now (due to the flash movie) --->
                            <cfif isDate(data)>
                                 #DateFormat(data, "mmm-dd-yy")#
                            </cfif>
                      <cfelseif ListFind("#TYPES.BOOLEAN#, #TYPES.FEA TURED#", i.type)>
                            <cfif data is 1>#translate("Yes")#<cfels e>#transla te("No")#< /cfif>
                      <cfelseif i.type is TYPES.MEDIA>
                            <cfset media = createObject("component", "hb50.media").init(this.Co mpanyID)>
                            #media.getMediaDisplay(Val (data))#
                      <cfelseif i.type is TYPES.SELECT>
                            <cfif isDefined("i.multiple") and i.multiple and isDefined("id")>
                                 <cfquery name="qryData" datasource="#this.datasour ce#" cachedwithin="#this.queryC ache#">
                                       SELECT       #i.relationValue#
                                       FROM       #i.relationTable#
                                       WHERE       #i.relationIndex# = #id#
                                 </cfquery>
                            </cfif>
                            <cfif isDefined("i.xml")>
                                 <cfset findXML = searchXMLByID(i.xml, val(data))>
                                 <cfif (not isSimpleValue(findXML)) and StructKeyExists(findXML.xm lattribute s, "caption")>
                                       #findXML[1].xmlattributes. caption#
                                 </cfif>
                            <cfelseif isDefined("i.query")>
                                 <cfquery name="qryGetList" datasource="#this.datasour ce#" cachedwithin="#this.queryC ache#">
                                       #PreserveSingleQuotes(i.qu ery)#
                                 </cfquery>
                                 <cfset qryData = selectFrom(qryGetList, i.valueVar, data)>
                                 #qryData[i.displayVar][1]#
                            </cfif>
                      <cfelseif i.type is TYPES.CATEGORY>
                            <cfset category = createObject("component", "hb50.category").init(this .CompanyID )>
                            #selectFrom(category.getCa tegories(f ormData.we bid), "intID", data).txtTitle#
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
      <cffunction name="getFormItemDisplay" access="public" returntype="string" output="false">
           <cfargument name="formData" type="any" required="true" />
           <cfargument name="i" type="struct" required="true" />
           <cfargument name="qryData" type="query" required="false" />
           <cfargument name="itemWidth" type="numeric" required="false" default="225" />
          Â
           <cfscript>
                 var lastCat = 0;
                 var count = 0;
                 var width = arguments.itemWidth;
                 var value = '';
                Â
                 //padding settings
                 var paddingLeft = 20;
                 var paddingTop = 12;
                 if (StructKeyExists(arguments .formData, 'paddingL'))
                      paddingLeft = Val(formData.paddingL);
                 if (StructKeyExists(arguments .formData, 'paddingT'))
                      paddingTop = Val(formData.paddingT);
                 if (isDefined("qryData") and qryData.recordCount and StructKeyExists(qryData, i.varname))
                      value = qryData[i.varname][1];
                 else if (isDefined("#i.varname#"))            //lets check form vars, just in case
                      value = evaluate("#i.varname#");
                 else if (StructKeyExists(i, "default"))
                      value = i.default;
           </cfscript>
           <cfsavecontent variable="output">
                 <cfoutput>
                      <div id="#i.varname#" style="display:block; <cfif i.type neq TYPES.HTML>padding-left:#p addingLeft #px; padding-top:#paddingTop#px ;</cfif>">
                      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="formCaption">
                            <cfif i.type is TYPES.HIDDEN>
                             <input type="hidden" name="#i.varname#" value="#HTMLEditFormat(val ue)#">
                            <cfelse>
                            <cfif Len(Trim(i.title)) and not ListFind("#TYPES.BOOLEAN#, #TYPES.HTM L#,#TYPES. LIST#", i.type)>
                             <tr>
                                 <td valign="top" width="#width#">#translate (i.title)# :<cfif isDefined("i.required") and i.required><span class="txtRequired"> *</span></ cfif>
                                 </td>
                             </tr>
                            </cfif>
                             <tr>
                                 <td valign="top" align="left">
                            <cfif isDefined("i.edit") and not i.edit>
                                 <input disabled class="formTextbox" style="width: #width#px;" type="Text" size="50" value="#HTMLEditFormat(get ItemView(f ormData, i, value))#" maxlength="<cfif StructKeyExists(i, "maxlength")>#val(i.maxlen gth)#<cfel se>500</cf if>">
                            <cfelseif i.type is TYPES.TYPE>
                                 <select class="formTextbox" id="#i.varname#_select" style="width: #width#px;" name="#i.varname#" onchange="javascript:chang eType();">
                                       <option value="">#translate("Selec t a type")#...</option>
                                       <cfloop from="1" to="#ArrayLen(i.options)#" index="k">
                                            <option value="#i.options[k].value #" <cfif i.options[k].value is value>selected</cfif>>#i.o ptions[k]. caption#</ option>
                                       </cfloop>
                                 </select>
                            <cfelseif i.type is TYPES.TEXT>
                                 <input class="formTextbox" style="width: #width#px;" type="Text" name="#i.varname#" id="#i.varname#_text" size="50" value="#HTMLEditFormat(val ue)#" maxlength="<cfif StructKeyExists(i, "maxlength")>#val(i.maxlen gth)#<cfel se>500</cf if>"<cfif isDefined("i.readonly") and i.readonly> readonly</cfif><cfif isDefined("i.disabled") and i.disabled> disabled</cfif><cfif isDefined("i.onChange")> onChange="#i.onChange#"</c fif>>
                            <cfelseif i.type is TYPES.COLOUR>
                                 <cfif not isDefined("this.dialogHelp erDefined" )>
                                       <object id="dlgHelper" classid="clsid:3050f819-98 b5-11cf-bb 82-00aa00b dce0b" width="0px" height="0px"></object>
                                       <cfset this.dialogHelperDefined = true>
                                 </cfif>
                                  <input class="formTextbox" style="width: #width#px;" type="Text" name="#i.varname#" id="#i.varname#_text" size="50" value="#HTMLEditFormat(val ue)#" maxlength="<cfif StructKeyExists(i, "maxlength")>#val(i.maxlen gth)#<cfel se>500</cf if>">
                                 <script>
                                       var sInitColor = null;
                                       document.getElementById('# i.varname# _text').on click = function () {
                                            try {
                                                  sColor = document.getElementById('d lgHelper') .ChooseCol orDlg(docu ment.getEl ementById( '#i.varnam e#_text'). value);
                                                  sColor = sColor.toString(16);
                                                  if (sColor.length < 6) {
                                                   var sTempString = '000000'.substring(0,6-sCo lor.length );
                                                   sColor = sTempString.concat(sColor) ;
                                                  }
                                                  document.getElementById('# i.varname# _text').va lue = sColor;
                                            } catch (e) {}
                                       }
                                 </script>
                            <cfelseif i.type is TYPES.URL>
                                 <cfif isDefined('i.dynamic') and i.dynamic>
                                       <script>
                                            function jsGetLink_#i.varname# () {
                                                  var windowLink = 'popup.cfm?p=rte.insertlin k&js=jsSet Link_#i.va rname#&ret urn=true';
                                                  var linktxt = document.getElementById('# i.varname# _hidden'). value;
                                                 Â
                                                  //Jason: append the id (sourceID) and the navid(will be converted to sourceType) from the URL to insertlink.cfc
                                                  var URLParams = window.document.location.s earch.toSt ring();
                                                  var keyvalue = '';
                                                  var sourceID = '';
                                                  var sourceType = '';
                                                  var subType = '';
                                                  URLParams = URLParams.substring(1, URLParams.length);
                                                  URLParams = URLParams.split('&');
                                                  for (var i=0; i < URLParams.length; i++) {
                                                       keyvalue = URLParams[i].split('=');
                                                       switch(keyvalue[0]) {
                                                             case 'navid':
                                                                  sourceType = keyvalue[1];
                                                                  break;
                                                             case 'id':
                                                                  sourceID = keyvalue[1];
                                                                  break;
                                                             case 'tabid':
                                                                  subType = keyvalue[1];
                                                                  break;
                                                             default:
                                                       }
                                                  }
                                                  if (sourceID == '')
                                                       sourceID = '-999';
                                                  if (sourceID != '' && sourceType != '')
                                                       windowLink += '&sourceID=' + sourceID + '&sourceType=' + sourceType + '&subType=' + subType;
                                                 Â
                                                  if (linktxt != '')
                                                       windowLink += '&link=' + escape(linktxt);
                                                  if (window.showModalDialog)
                                                       showModalDialog(windowLink , window, 'resizable: yes; help: no; status: no; scroll: no;');
                                                  else
                                                       window.open(windowLink, '', 'help=no,resizable=yes,scr oll=no,sta tus=no,mod al=yes,wid th=530,hei ght=355');
                                            }
                                            function jsSetLink_#i.varname# (link) {
                                                  document.getElementById('# i.varname# _text').in nerHTML = '<a href="#this.qryCompany.txt Web#/' + link.split('$')[0] + '" target="_blank">#translate ("Preview Link")#</a>';
                                                  document.getElementById('# i.varname# _hidden'). value = link;
                                            }
                                       </script>
                                       <img src="images/ed_link.gif" title="Insert Link" border=0 width=18 height=18 align="top" style="float:left;" onmouseover="this.style.cu rsor='hand '; this.style.cursor='pointer '; document.body.onbeforeunlo ad=null;" onmouseout="if (window.jsSaveWarning) jsSaveWarning();" onclick="jsGetLink_#i.varn ame#();">
                                       <div style="width:#width-20#px; height:25px; padding:3px; overflow:hidden;" class="formCaption" id="#i.varname#_text"><cfi f value neq ""><a <cfif REFindNoCase('http[s]*://' ,value)>hr ef="#HTMLE ditFormat( ListFirst( value, '$'))#"<cfelse>href="#this .qryCompan y.txtWeb#/ #HTMLEditF ormat(List First(valu e, '$'))#"</cfif> target="_blank">#translate ("Preview Link")#</a></cfif></div>
                                       <input type="hidden" name="#i.varname#" id="#i.varname#_hidden" value="#HTMLEditFormat(val ue)#">
                                 <cfelse>
                                       <input style="width: #width#px;" class="formTextbox" type="Text" name="#i.varname#" id="#i.varname#_text" size="50" value="#HTMLEditFormat(val ue)#" maxlength="<cfif StructKeyExists(i, "maxlength")>#Val(i.maxlen gth)#<cfel se>500</cf if>">
                                 </cfif>
                            <cfelseif i.type is TYPES.DATE>
                                 #getFormItem(TYPES.DATE, i.varname, value)#
                            <cfelseif i.type is TYPES.NUMBER>
                                 <input class="formTextbox" type="Text" name="#i.varname#" id="#i.varname#_text" size="10" value="#HTMLEditFormat(val ue)#" maxlength="10"<cfif isDefined("i.readonly") and i.readonly> readonly</cfif><cfif isDefined("i.disabled") and i.disabled> disabled</cfif>>
                            <cfelseif i.type is TYPES.BOOLEAN>
                                 <input type="checkbox" id="#i.varname#_check" name="#i.varname#" value="on"<cfif value is 1 or value is 'on'> checked</cfif><cfif isDefined("i.disabled") and i.disabled> disabled</cfif><cfif isDefined("i.onClick")> onClick="#i.onClick#"</cfi f>> #translate(i.title)#
                            <cfelseif i.type is TYPES.PASSWORD>
                                 <input class="formTextbox" size="50" style="width: #width#px;" type="password" name="#i.varname#" value="#value#" maxlength="500">
                            <cfelseif i.type is TYPES.MEDIA>
                                 <cfparam name="i.ext" default="">
                                 #getFormItem(TYPES.MEDIA, i.varname, value, i.ext)#
                            <cfelseif i.type is TYPES.SELECT>
                                 <cfif isDefined("i.multiple") and i.multiple and isDefined("id") and isDefined("i.relationTable ")>
                                       <cfquery name="qryPolicy" datasource="#this.datasour ce#" cachedwithin="#this.queryC ache#">
                                            SELECT       #i.relationValue# AS intID
                                            FROM       #i.relationTable#
                                            WHERE       #i.relationIndex# = #Val(id)#
                                       </cfquery>
                                       <cfset value = ValueList(qryPolicy.intID) >
                                 </cfif>
                                 <select class="formTextarea" name="#i.varname#" id="#i.varname#_select" style="width: #width#px;"<cfif isDefined("i.multiple") and i.multiple> multiple size="<cfif isDefined("i.multiplesize" ) and Val(i.multiplesize)>#i.mul tiplesize# <cfelse>5< /cfif>"<cf else><cfif isDefined("i.size") and Val(i.size)>size="#i.size# "</cfif></ cfif><cfif isDefined("i.onChange")> onChange="#i.onChange#"</c fif><cfif isDefined("i.disabled") and i.disabled> disabled</cfif>>
                                       <cfif not isDefined("i.selectText")>
                                            <cfset i.selectText = "Please select one...">
                                       </cfif>
                                       <cfif isDefined("i.xml")>
                                            <cfparam name="i.pruneAt" default="0">
                                            <cfparam name="i.showXMLTopItem" default="true">
     Â
                                            <cfif (ArrayLen(i.xml.item.xmlch ildren) gt 1 and Len(i.selectText)) or isDefined("i.showSelectTex t")>
                                                  <option value="">#translate(i.sele ctText)#</ option>
                                            </cfif>
     Â
                                            <!--- decide whether to use the top item or not (if it has attributes) --->
                                            <cfif i.showXMLTopItem and isDefined("i.xml.item.xmla ttributes. id")>
                                                  <cfset showCategory = true>
                                                  <cfif isDefined("i.showCategory" ) and isDefined("i.xml.item.xmla ttributes. blnCategor y")>
                                                       <cfset showCategory = i.showCategory>
                                                  </cfif>
                                                  <option value="#i.xml.item.xmlattr ibutes.id# "<cfif ListFind(value, i.xml.item.xmlattributes.i d)> selected</cfif>>#i.xml.ite m.xmlattri butes.capt ion#</opti on>
                                                  #getXMLSelectRecursive(i.x ml.item, i.varname, value, i.pruneAt, 1, showCategory)#
                                            <cfelse>
                                                  #getXMLSelectRecursive(i.x ml.item, i.varname, value, i.pruneAt, 0)#
                                            </cfif>
                                       <cfelseif isDefined("i.query")>
                                            <cfparam name="i.valueVar" default="intID">
                                            <cfparam name="i.displayVar" default="txtTitle">
                                           Â
                                            <cfif isDefined('i.datasource')>
                                                  <cfset thisDS = i.datasource>
                                            <cfelse>
                                                  <cfset thisDS = this.datasource>
                                            </cfif>
                                            <cfif IsQuery(i.query)>
                                                  <cfset qryGetList = i.query>
                                            <cfelse>
                                                  <cfquery name="qryGetList" datasource="#thisDS#">
                                                       #PreserveSingleQuotes(i.qu ery)#
                                                  </cfquery>
                                            </cfif>
                                            <cfif (qryGetList.recordcount gt 0 and len(i.selectText)) or isDefined("i.showSelectTex t")>
                                                  <option value="">#translate(i.sele ctText)#</ option>
                                            </cfif>
     Â
                                            <cfloop query="qryGetList">
                                                  <option value="#qryGetList[i.value Var][curre ntRow]#"<c fif ListFind(value, qryGetList[i.valueVar][cur rentRow])> selected</cfif>>
                                                       #qryGetList[i.displayVar][ currentRow ]#<cfif isDefined("i.displayVarExt ")> #qryGetList[i.displayVarEx t][current Row]#</cfi f><cfif isDefined("i.displayVar2") > (#qryGetList[i.displayVar2 ][currentR ow]#)</cfi f>
                                                  </option>
                                            </cfloop>
                                       </cfif>
                                 </select>
                            <cfelseif i.type is TYPES.RADIO and isDefined("i.xml")>
                                 <cfset xmlNode = i.xml.item>
                                 <cfloop from="1" to="#ArrayLen(xmlNode.xmlc hildren)#" index="idx">
                                       <cfset item = xmlNode.xmlchildren[idx]>
                                       <input type="radio" name="#i.varname#" value="#item.xmlattributes .value#"<c fif (value is "" and i.default is item.xmlattributes.value) or value is item.xmlattributes.value> checked</cfif>> #item.xmlattributes.captio n#<br/>
                                 </cfloop>
                            <cfelseif i.type is TYPES.CATEGORY>
                                 <!--- Donny: if the formdata item have query associated to it, use it. (needed by Journal.cfc) --->
                                 <cfif isDefined("i.query") and isQuery(i.query)>
                                       <cfset qryCategory = i.query>
                                 <cfelse>
                                       <cfset category = createObject("component", "hb50.category").init(this .CompanyID )>
                                       <cfset qryCategory = category.getCategories(for mData.webi d)>
                                 </cfif>
                                 <cfset addnew = ((not isDefined("i.addnew")) or i.addnew)>
                                 <div id="#i.varname#_view">
                                       <select class="formTextbox" id="#i.varname#_select" name="#i.varname#" style="width:#width#px; height:18; z-index:1;"<cfif addnew> onchange="#i.varname#_addn ew();"</cf if>>
                                            <option value="">#translate("Pleas e select one...")#</option>
                                            <cfif addnew>
                                                  <option value="">#translate("Add a new #LCase(i.title)#")#</optio n>
                                            </cfif>
                                            <cfloop query="qryCategory">
                                                  <option value="#intID#"<cfif value is intID> selected</cfif>>#qryCatego ry["txtTit le"][curre ntRow]#</o ption>
                                            </cfloop>
                                       </select>
                                 </div>
                                 <cfif addnew>
                                       <div id="#i.varname#_add" style="display: none; width: #width-15#">                                            Â
                                            <input id="#i.varname#_add_title" class="formTextbox" style="width: #width#px;" type="Text" name="#i.varname#_add_titl e" size="50" value="" maxlength="1000">
                                       </div>
                                       <script language='Javascript'>
                                            function #i.varname#_addnew() {
                                                  if (document.getElementById(' #i.varname #_select') .selectedI ndex == 1)
                                                       document.getElementById('# i.varname# _add').sty le.display = 'block';
                                                  else {
                                                       document.getElementById('# i.varname# _add').sty le.display = 'none';
                                                       document.getElementById('# i.varname# _add_title ').value = '';
                                                  }
                                            }
                                       </script>
                                 </cfif>
                            <cfelseif i.type is TYPES.UPLOAD>
                                 <!--- it's up to you to process this form element, since its outcome is always so custom --->
                                 <input class="formTextarea" style="width: #width#px;" type="file" id="#i.varname#_text" name="#i.varname#" size="21" maxlength="1000" onChange="document.getElem entById('# i.varname# _strFile_i d').value = this.value;">
                                 <cfif isDefined("i.preview") and Len(Trim(i.preview))>
                                       <div style="padding-top:5px;"># i.preview# </div>
                                 </cfif>
                                 <input type="hidden" id="#i.varname#_strFile_id " name="#i.varname#_strFile" value="">
                            <cfelseif i.type is TYPES.FEATURED>
                                 <cfif value is 1>
                                       <input type="hidden" name="blnFeatured" value="on">
                                       <b>#translate("THIS ITEM IS FEATURED.")#</b>
                                 <cfelse>
                                       <input type="checkbox" name="blnFeatured">
                                 </cfif>
                            <cfelseif i.type is TYPES.MEMO>
                                 <textarea id="#i.varname#_text" class="formTextarea" name="#i.varname#" wrap="PHYSICAL" style="width:<cfif isDefined("i.memoW") and Val(i.memoW)>#i.memoW#<cfe lse>#width #</cfif>px ; height:<cfif isDefined("i.memoH") and Val(i.memoH)>#i.memoH#<cfe lse>50</cf if>px;">#v alue#</tex tarea>
                            <cfelseif i.type is TYPES.HTML>
                                 <cfif true or SESSION.richText>
                                       <cfsavecontent variable="toolbar">
                                            <cf_htmltoolbar name="#i.varname#" datasource="#this.datasour ce#" CompanyID="#this.CompanyID #" imagepath="images" previewpage="t2.cfm" codeview="#SESSION.blnCode View#">
                                       </cfsavecontent>
                                       #getToolbarLayer(toolbar)#
                                       <cf_htmleditarea name="#i.varname#" class="formTextarea" qryname="#this.qryCompany# ">#this.wo rkflow.con vertCached Tokens(val ue, true)#</cf_htmleditarea>
                                 <cfelse>
                                       #getToolbarLayer('<div align="center">#this.langu age.transl ate("Warni ng: You need Internet Explorer 5.5 or higher in order to use the Rich Text Editor.")#</div>')#
                                       <textarea cols="37" class="formTextarea" name="#i.varname#" rows="8" wrap="PHYSICAL" style="width:545px; height:263px;">#value#</te xtarea>
                                 </cfif>
                                Â
                            <!--- Donny:  display list items e.g. meta data list (didn't modify this) --->
                            <cfelseif i.type is TYPES.LIST>
                                 <style type="text/css">
                                 <!--
                                       .item {
                                            position: relative;
                                            width:522px;
                                            left: 1px;
                                            float: left;
                                            border-left: 1px solid ##999999;;
                                            border-right: 1px solid ##999999;;
                                            border-bottom: 1px solid ##999999;;
                                       }
                                 -->
                                 </style>
                                 <div style="position: absolute; top: -43px; left: 0px; z-index: 10;">
                                       <!--- Donny: Metatag Button & List -
                                                   - no add row
                                                   - show metatag template button (depends on flag set on e.g. /hb50/internal/webcontrol. cfc) --->
                                       <cfif isDefined("formData.blnMet a") AND formData.blnMeta>
                                            <input type="reset" name="btnDelete_#i.varname #" value="#translate("Delete Row")#" onclick="return removeItem_#i.varname#();" class="buttons" style="visibility:hidden;" >
                                            <input type="reset" name="btnMetaTag_#i.varnam e#" value="#translate("Meta Data Template")#" onclick="return newMetaTag_#i.varname#('#f ormData.ti tle#');" class="buttons" style="visibility:hidden;" >
                                       <cfelse>
                                            <!--- Donny: Normal List - allow add / remove delete row --->
                                            <input type="reset" value="#translate("Add Row")#" onclick="return newItem_#i.varname#();" class="buttons">
                                            <input type="reset" name="btnDelete_#i.varname #" value="#translate("Delete Row")#" onclick="return removeItem_#i.varname#();" class="buttons">
                                       </cfif>
                                 </div>
                                 <div id="header" style="position:absolute; visibility:visible; left:1px; top:1px; width:540px; height:20px; z-index:2;">#i.headerText# </div>
                                 <div id="list_#i.varname#" style="position: absolute; top: 22; left: 0; overflow: scroll; width:541px; height:241px;" ></div>
                                 #getListColumn(i.listHTML, i.editHTML, 'list_#i.varname#', i.collist, i.varname, value, 'frmAddEdit')#
                            <cfelseif i.type is TYPES.HIDDEN>
                                 <input type="hidden" name="#i.varname#" value="#value#">
                            <cfelseif i.type is TYPES.CUSTOM>
                                 #i.html#
                            <cfelseif i.type is TYPES.DATERANGE>
                                 #getFormItem(TYPES.DATERAN GE, i.varname, value)#
                            </cfif>
                                 </td>
                             </tr>
                            </cfif>
                       </table>
                       </div>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
      <!--- turns a string formatted like
                 "value1,value2,value3
                  value1,value2,value3
                  value1,value2,value3"
            into a query with rows & columns (column names taken from collist)
      --->     Â
      <cffunction name="listColumnToQuery" access="public" returntype="query" output="false">
           <cfargument name="result" type="string" required="true">
           <cfargument name="collist" type="string" required="true">
           <cfset var query = QueryNew(collist)>
           <cfloop list="#result#" delimiters="#CHR(13)##CHR( 10)#" index="record">
                 <!--- ignore incomplete records --->
                 <cfif ListLen(collist) lte ListLen(record)>
                      <cfset QueryAddRow(query)>
                      <cfif ListLen(collist) is 2> <!--- modified to support value that contains commas - only work for 2 columns --->
                            <cfset QuerySetCell(query, ListFirst(collist), Trim(ListFirst(record)))>
                            <cfset QuerySetCell(query, ListRest(collist), Trim(ListRest(record)))>
                      <cfelse>
                            <cfloop from="1" to="#ListLen(collist)#" index="i">
                                 <cfset QuerySetCell(query, ListGetAt(collist, i), Trim(ListGetAt(record, i)))>
                            </cfloop>
                      </cfif>
                 </cfif>
           </cfloop>
           <cfreturn query />
      </cffunction>
      <cffunction name="getListColumn" access="public" returntype="string" output="false">
           <cfargument name="listHTML" type="any" required="true">
           <cfargument name="editHTML" type="any" required="true">
           <cfargument name="divName" type="any" required="true">
           <cfargument name="collist" type="any" required="true">
           <cfargument name="varname" type="any" required="true">
           <cfargument name="value" type="any" required="true">
           <cfargument name="formName" type="any" required="true">
           <cfsavecontent variable="output">
                 <cfoutput>
                      <input type="hidden" name="#varname#" value="#value#">
                      <script>
                      //<!--
                            var saveDelay_#varname# = false;
                            var idEdited_#varname# = '';
                            var dataObj_#varname# = new Object();
                            var idCount_#varname# = #ListLen(value, '#CHR(13)##CHR(10)#') + 1#;
     Â
                            <cfloop from="1" to="#ListLen(value, '#CHR(13)##CHR(10)#')#" index="i">
                                 dataObj_#varname#['#varnam e#_#i#'] = new Object();
                                 <cfif ListLen(collist) is 2> //modified to support value that contains commas - only work for 2 columns
                                       dataObj_#varname#['#varnam e#_#i#'].# ListFirst( collist)# = '#trim(JSStringFormat(List First(List GetAt(valu e, i, '#CHR(13)##CHR(10)#'))))#' ;
                                       dataObj_#varname#['#varnam e#_#i#'].# ListRest(c ollist)# = '#trim(JSStringFormat(List Rest(ListG etAt(value , i, '#CHR(13)##CHR(10)#'))))#' ;
                                 <cfelse>
                                       <cfloop from="1" to="#ListLen(collist)#" index="j">
                                            dataObj_#varname#['#varnam e#_#i#'].# ListGetAt( collist, j)# = '#trim(JSStringFormat(List GetAt(List GetAt(valu e, i, '#CHR(13)##CHR(10)#'), j)))#';
                                       </cfloop>
                                 </cfif>
                            </cfloop>
     Â
                            function getItemDisplay_#varname# (id) {
                                 var item = dataObj_#varname#[id];
                                 return ''
                                       <cfloop from="1" to="#ListLen(collist)#" index="i">
                                            <cfset col = ListGetAt(collist, i)>
                                            + '#JSStringFormat(ListGetAt (ListGetAt (listHTML, i, '#CHR(13)##CHR(10)#'), 1))#'
                                            + item.#col#
                                            + '#JSStringFormat(ListGetAt (ListGetAt (listHTML, i, '#CHR(13)##CHR(10)#'), 2))#'
                                       </cfloop>
                                            ;
                            }
     Â
                            function removeItem_#varname#() {
                                 if (idEdited_#varname# == '') {
                                       alert("#translate('Click an item to edit/delete')#");
                                       return false;
                                 }
                                 var obj = document.getElementById(id Edited_#va rname#);
                                 delete(dataObj_#varname#[i dEdited_#v arname#]);
                                 obj.outerHTML = '';
                                 idEdited_#varname# = '';
                                 updateHiddenField_#varname #();
                                 return false;
                            }
     Â
                            function saveItem_#varname#() {
                                 if (idEdited_#varname# == '') {
                                       return false;
                                 }
                                 var obj = document.getElementById(id Edited_#va rname#);
                                 <cfloop list="#collist#" index="col">
                                       dataObj_#varname#[idEdited _#varname# ].#col# = document.#formName#.#col#. value;
                                 </cfloop>
                                 obj.outerHTML = dataObj_#varname#[idEdited _#varname# ].outerhtm l.split(/> /)[0] + '>' + getItemDisplay_#varname#(i dEdited_#v arname#) + '</div>';
                                 idEdited_#varname# = '';
                                 updateHiddenField_#varname #();
                                 return false;
                            }
     Â
                            function newItem_#varname#() {
                                 var divlist = document.getElementById('# divName#') ;
                                 var newID = '#varname#_' + idCount_#varname#++ + '';
                                 if (idEdited_#varname# != '') {
                                       saveItem_#varname#();
                                 }
                                 dataObj_#varname#[newID] = new Object();
                                 <cfloop list="#collist#" index="col">
                                       dataObj_#varname#[newID].# col# = '';
                                 </cfloop>
                                 dataObj_#varname#[newID].i d = newID;
                                 divlist.innerHTML += '<div id="' + newID + '" class="item" onclick="editItem_#varname #(this)">' + getItemDisplay_#varname#(n ewID) + '</div>';
                                 updateHiddenField_#varname #();
                                 editItem_#varname#(documen t.getEleme ntById(new ID));
                                 return false;
                            }
     Â
                            // Donny: callback from Meta Data Template Modal Dialog
                            function newMetaTagItem_#varname#(m etaTagType ,metaTagNa me,metaTag Content) {
                                 if (metaTagName.length && metaTagContent.length) {
                                       var divlist = document.getElementById('# divName#') ;
                                       var newID = '#varname#_' + idCount_#varname#++ + '';
                                       if (idEdited_#varname# != '') {
                                            saveItem_#varname#();
                                       }
                                       dataObj_#varname#[newID] = new Object();
     Â
                                       // Donny: assign Name and Content to according column in #collist#
                                       <cfloop list="#collist#" index="col">
                                            <cfswitch expression="#col#">
                                                  <cfcase value="txtMetaType">
                                                       dataObj_#varname#[newID].# col# = metaTagType;
                                                  </cfcase>
                                                  <cfcase value="txtMetaName">
                                                       dataObj_#varname#[newID].# col# = metaTagName;
                                                  </cfcase>
                                                  <cfdefaultcase>
                                                       dataObj_#varname#[newID].# col# = metaTagContent;
                                                  </cfdefaultcase>
                                            </cfswitch>
                                       </cfloop>
     Â
                                       dataObj_#varname#[newID].i d = newID;
                                       divlist.innerHTML += '<div id="' + newID + '" class="item" onclick="editItem_#varname #(this)">' + getItemDisplay_#varname#(n ewID) + '</div>';
                                       updateHiddenField_#varname #();
                                       editItem_#varname#(documen t.getEleme ntById(new ID));
     Â
                                       setTimeout('saveItem_#varn ame#();', 100)
                                 }
                                 return false;
                            }
     Â
                            // Donny:  popup Meta Tag Modal Dialog
                            function newMetaTag_#varname#(title ) {
                                 showModalDialog('popup/met aDataTempl ate.cfm?va rname=#var name#&titl e='+title+ '&navid=#u rl.navid#& subid=#sub id#',windo w,'help=no ;resizable =yes;scrol l=no;statu s=no;cente r=yes');
                                 return false;
                            }
     Â
                            function editItem_#varname# (obj) {
                                 var innerhtml = obj.innerHTML;
                                 if (idEdited_#varname# != '') {
                                       saveItem_#varname#();
                                 }
                                 idEdited_#varname# = obj.id;
                                 dataObj_#varname#[idEdited _#varname# ].obj = obj;
                                 dataObj_#varname#[idEdited _#varname# ].innerhtm l = obj.innerHTML;
                                 dataObj_#varname#[idEdited _#varname# ].outerhtm l = obj.outerHTML;
                                 obj.innerHTML = '<cfoutput>#JSStringFormat (editHTML) #</cfoutpu t>';
                                 obj.onclick = '';
     Â
                                 /*Trying to make it work for FireFox (and failing)
                                 for (var i=0;i < document.#formName#.elemen ts.length; i++) {
                                       var column = document.#formName#.elemen ts[i];
                                       if (typeof(dataObj_#varname#[ idEdited_# varname#][ column.nam e]) != 'undefined') {
                                            column.value = dataObj_#varname#[idEdited _#varname# ][column.n ame];
                                            if (column.addEventListener) {
                                                  column.addEventListener('b lur', function () { saveDelay_#varname# = true; setTimeout('if (saveDelay_#varname#) saveItem_#varname#();', 100) }, true);
                                                  column.addEventListener('f ocus', function () { saveDelay_#varname# = false; }, true);
                                            } else {
                                                  column.onblur = function () { saveDelay_#varname# = true; setTimeout('if (saveDelay_#varname#) saveItem_#varname#();', 100) };
                                                  column.onfocus = function () { saveDelay_#varname# = false; };
                                            }
                                       } else {
                                            alert(column.name);
                                       }
                                 }
                                 */
                                 <cfloop list="#collist#" index="col">
                                       document.#formName#.#col#. value = dataObj_#varname#[idEdited _#varname# ].#col#;
                                       document.#formName#.#col#. onblur = function () { saveDelay_#varname# = true; setTimeout('if (saveDelay_#varname#) saveItem_#varname#();', 100) };
                                       document.#formName#.#col#. onfocus = function () { saveDelay_#varname# = false; };
                                 </cfloop>
     Â
                                 //setTimeout('document.#fo rmName#.#L istFirst(c ollist)#.f ocus();', 100);     Â
                            }
     Â
                            function editItem2_#varname# (obj) {
                                 var innerhtml = obj.innerHTML;
                                 alert('#varname#');
                                 if (idEdited_#varname# != '') {
                                       saveItem_#varname#();
                                 }
     Â
                                 idEdited_#varname# = obj.id;
                                 dataObj_#varname#[idEdited _#varname# ].obj = obj;
                                 dataObj_#varname#[idEdited _#varname# ].innerhtm l = obj.innerHTML;
                                 dataObj_#varname#[idEdited _#varname# ].outerhtm l = obj.outerHTML;
                                 obj.innerHTML = '<cfoutput>#JSStringFormat (editHTML) #</cfoutpu t>';
     Â
                                 obj.onclick = '';
                                 <cfloop list="#collist#" index="col">
                                       document.#formName#.#col#. value = dataObj_#varname#[idEdited _#varname# ].#col#;
                                       document.#formName#.#col#. onblur = function () { saveDelay_#varname# = true; setTimeout('if (saveDelay_#varname#) saveItem_#varname#();', 100) };
                                       document.#formName#.#col#. onfocus = function () { saveDelay_#varname# = false; };
                                 </cfloop>
                            }
     Â
                            function updateHiddenField_#varname #() {
                                 var field = document.#formName#.#varna me#;
                                 var str = '';
                                 for (var k in dataObj_#varname#) {
                                       str +=
                                            <cfloop from="1" to="#ListLen(collist)#" index="j">
                                                  <cfset col = ListGetAt(collist, j)>
                                                  (dataObj_#varname#[k].#col # == '' ? ' ' : dataObj_#varname#[k].#col# ) <cfif j lt ListLen(collist)>+ ','</cfif> +
                                            </cfloop>
                                            '\n';
                                 }
                                 field.value = str;
                            }
     Â
                            var divlist = document.getElementById('# divName#') ;
                            for (var k in dataObj_#varname#) {
                                 divlist.innerHTML += '<div id="' + k + '" class="item" onclick="editItem_#varname #(this)">' + getItemDisplay_#varname#(k ) + '</div>';
                            }
                            updateHiddenField_#varname #();
                      //-->
                      </script>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn output />
      </cffunction>
      <!--- returns the display for TYPES.MEDIA and TYPES.DATE --->
      <cffunction name="getFormItem" access="public" returntype="string" output="false">
           <cfargument name="type" type="any" required="true">
           <cfargument name="varname" type="any" required="true">
           <cfargument name="value" type="any" required="true">
           <cfargument name="options" type="string" required="false" default="">
           <cfargument name="width" type="numeric" required="false" default="225">
                     Â
           <cfscript>
                 var media = '';
                 var qryGetMedia = '';
                 var qryGetMediaCategory = '';
                 var qryGetMediaSorted = '';
                Â
                 var lastCat = -1;
                 var mediacount = 0;
                 var dtStart = '';
                 var chkStart = true;
                 var dtEnd = '';
                 var chkEnd = true;
           </cfscript>
           <cfsavecontent variable="output">
                 <cfoutput>
                      <!--- DATE --->
                      <cfif arguments.type is TYPES.DATE>
                            <!--- date always has a default of now (due to the flash movie) --->
                            <cfif not isDate(arguments.value)>
                                 <cfset arguments.value = now()>
                            </cfif>
                            <script type="text/javascript" src="js/swfobject.js"></sc ript>
                                Â
                            <div id="#arguments.varname#_fl ash" style="display:block">
                                 <input class="formTextbox" type="hidden" id="#arguments.varname#_hi dden" name="#arguments.varname#" size="50" style="width: #arguments.width#px;" value="#DateFormat(argumen ts.value, "mmm-dd-yy")#" maxlength="500">
                                 <div id="#arguments.varname#_da te">
                                 </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 #arguments.varname#flashOb _DoFSComma nd(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('# arguments. varname#_h idden').va lue = args;
                                       }
                                       // Hook for Internet Explorer
                                       if (navigator.appName && navigator.appName.indexOf( "Microsoft ") != -1 &&Â
                                             navigator.userAgent.indexO f("Windows ") != -1 && navigator.userAgent.indexO f("Windows 3.1") == -1)
                                       {
                                            document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                            document.write('on error resume next \n');
                                            document.write('Sub #arguments.varname#flashOb _FSCommand (ByVal command, ByVal args)\n');
                                            document.write('  call #arguments.varname#flashOb _DoFSComma nd(command , args)\n');
                                            document.write('end sub\n');
                                            document.write('</SCRIPT\> \n');
                                       }     Â
                                   var so = new SWFObject("flash/weekview. swf", "#arguments.varname#flashO b", "200", "31", "7", "##336699");
                                   <cfif IsDate(arguments.value)>
                                        so.addVariable("day","#Day (arguments .value)#") ;
                                        so.addVariable("month","#M onth(argum ents.value )#");
                                        so.addVariable("year","#Ye ar(argumen ts.value)# ");
                                   </cfif>
                                   so.write("#arguments.varna me#_date") ;
                                 </script>
                            </div>
                           Â
                      <!--- DATERANGE --->     Â
                      <cfelseif arguments.type is TYPES.DATERANGE>
                            <cfscript>
                                 //parse the date value pair ('dtStart, dtEnd')
                                 dtStart = ListFirst(arguments.value, ',');
                                 dtEnd = ListLast(arguments.value, ',');
                                Â
                                 if (Left(dtStart, 1) is 'e')
                                       dtEnd = Right(dtEnd, Len(dtEnd) - 1);
                                 else if (Left(dtEnd, 1) is 's')
                                       dtStart = Right(dtStart, Len(dtStart) - 1);
                                 else if (Len(dtStart) and Len(dtEnd)) {
                                       dtStart = Right(dtStart, Len(dtStart) - 1);
                                       dtEnd = Right(dtEnd, Len(dtEnd) - 1);
                                 }
                                Â
                                 if (not isDate(dtStart)) { dtStart = now(); chkStart = false; }
                                 if (not isDate(dtEnd)) { dtEnd = now(); chkEnd = false; }
                            </cfscript>
                            <script type="text/javascript" src="js/swfobject.js"></sc ript>
                            <script>
                                 function #arguments.varname#_dtStar t_set (day, month, year) {
                                       var element = document.getElementById('# arguments. varname#_h idden');
                                       //var element_chk = document.getElementById('# arguments. varname#_d tStart_chk ');
                                      Â
                                       if (element) {
                                            var dtArray = element.value.split(',');
                                            //alert(element.value);
                                            //alert(dtArray.length);
                                            //alert(document.frmAddEdi t.onsubmit );
                                           Â
                                            //if (dtArray.length == 2)
                                                  element.value = month + '/' + day + '/' + year + ',' + dtArray[1];
                                            //else
                                            //      element.value = month + '/' + day + '/' + year + ',null';
                                       }
                                 }
                                Â
                                 function #arguments.varname#_dtEnd_ set (day, month, year) {
                                       var element = document.getElementById('# arguments. varname#_h idden');
                                       //var element_chk = document.getElementById('# arguments. varname#_d tEnd_chk') ;
                                      Â
                                       if (element) {
                                            var dtArray = element.value.split(',');
                                            //alert(element.value);
                                            //alert(dtArray.length);
                                           Â
                                            //if (dtArray.length == 1)
                                            //      element.value = 'null,' + month + '/' + day + '/' + year;
                                            //else
                                                  element.value = dtArray[0] + ',' + month + '/' + day + '/' + year;
                                       }
                                 }                                 Â
                            </script>
                           Â
                            <font color="black">start:</font ><br />
                            <div id="#arguments.varname#_dt Start_flas h" style="display:block">                                 Â
                                 <input name="#arguments.varname#_ dtStart_ch k" id="#arguments.varname#_dt Start_chk" type="checkbox" <cfif chkStart>checked</cfif>>
                                 <div id="#arguments.varname#_st artdate">
                                 </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 #arguments.varname#dtStart flash_DoFS Command(co mmand, 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_h idden').va lue = args;
                                       }
                                       // Hook for Internet Explorer
                                       if (navigator.appName && navigator.appName.indexOf( "Microsoft ") != -1 &&Â
                                             navigator.userAgent.indexO f("Windows ") != -1 && navigator.userAgent.indexO f("Windows 3.1") == -1)
                                       {
                                            document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                            document.write('on error resume next \n');
                                            document.write('Sub #arguments.varname#dtStart flash_FSCo mmand(ByVa l command, ByVal args)\n');
                                            document.write('  call #arguments.varname#dtStart flash_DoFS Command(co mmand, args)\n');
                                            document.write('end sub\n');
                                            document.write('</SCRIPT\> \n');
                                       }     Â
                                   var so = new SWFObject("flash/weekview. swf", "#arguments.varname#dtStar tflash", "200", "31", "7", "##336699");
                                   so.addVariable("day","#Day (dtStart)# ");
                                   so.addVariable("month","#M onth(dtSta rt)#");
                                   so.addVariable("year","#Ye ar(dtStart )#");
                                   so.write("#arguments.varna me#_startd ate");
                                 </script>                                 Â
                            </div>
                            <font color="black">end:</font>< br />
                            <div id="#arguments.varname#_dt End_flash" style="display:block">
                                 <input name="#arguments.varname#_ dtEnd_chk" id="#arguments.varname#_dt End_chk" type="checkbox" <cfif chkEnd>checked</cfif>>
                                 <div id="#arguments.varname#_en ddate">
                                 </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 #arguments.varname#dtEndfl ash_DoFSCo mmand(comm and, 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_h idden').va lue = args;
                                       }
                                       // Hook for Internet Explorer
                                       if (navigator.appName && navigator.appName.indexOf( "Microsoft ") != -1 &&Â
                                             navigator.userAgent.indexO f("Windows ") != -1 && navigator.userAgent.indexO f("Windows 3.1") == -1)
                                       {
                                            document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                            document.write('on error resume next \n');
                                            document.write('Sub #arguments.varname#dtEndfl ash_FSComm and(ByVal command, ByVal args)\n');
                                            document.write('  call #arguments.varname#dtEndfl ash_DoFSCo mmand(comm and, args)\n');
                                            document.write('end sub\n');
                                            document.write('</SCRIPT\> \n');
                                       }     Â
                                   var so = new SWFObject("flash/weekview. swf", "#arguments.varname#dtEndf lash", "200", "31", "7", "##336699");
                                   so.addVariable("day","#Day (dtEnd)#") ;
                                   so.addVariable("month","#M onth(dtEnd )#");
                                   so.addVariable("year","#Ye ar(dtEnd)# ");
                                   so.write("#arguments.varna me#_enddat e");
                                 </script>
                            </div>
                            <input class="formTextbox" type="hidden" id="#arguments.varname#_hi dden" name="#arguments.varname#" size="50" style="width: #arguments.width#px;" value="#DateFormat(dtStart , "m/d/yyyy")#,#DateFormat(d tEnd, "m/d/yyyy")#" maxlength="500">
                     Â
                      <!--- MEDIA --->
                      <cfelseif arguments.type is TYPES.MEDIA>
                            <cfset media = createObject('component', 'hb50.media').init(this.Co mpanyID)>
                            <cfset qryGetMedia = media.getMediaByExt(argume nts.option s)>
                           Â
                            <cfquery name="qryGetMediaCategory" dbtype="query">
                                 SELECT DISTINCT intCategoryID, txtCategory
                                 FROM       qryGetMedia
                                 ORDER BY txtCategoryNoCase, intCategoryID
                            </cfquery>
                           Â
                            <cfquery name="qryGetMediaSorted" dbtype="query">
                                 SELECT       *
                                 FROM       qryGetMedia
                                 ORDER BY txtCategoryNoCase, intCategoryID
                            </cfquery>
                           Â
                            <script name="javascript">
                                 var pdfs#arguments.varname# = new Array();
                                 var defaultpdftext#arguments.v arname# = new Array();
                                 var defaultpdfvalue#arguments. varname# = new Array();
          Â
                                 <cfloop query="qryGetMediaSorted">
                                       <cfif lastCat neq intCategoryID>
                                            <cfif lastCat neq -1>
                                                  null];
                                            </cfif>
                                            <cfset mediacount = mediacount + 1>
                                            <cfset lastCat = intCategoryID>
                                            pdfs#arguments.varname#[#m ediacount# ] = [
                                        </cfif>
                                       '#replace(txtTitle, "'", "\'", "ALL")#','#intID#',
                                 </cfloop>
                                 <cfif qryGetMedia.recordCount neq 0>
                                       null];
                                 </cfif>
          Â
                                 function PDFUpdate#arguments.varnam e#(selCat, selPDF) {
                                       var curValue = selCat.selectedIndex;
                                        var list = pdfs#arguments.varname#[cu rValue];
          Â
                                       if (!defaultpdftext#arguments .varname#. length) {
                                              for (var i=0; i< selPDF.length; i++) {
                                                  defaultpdftext#arguments.v arname#[i] = selPDF.options[i].text;
                                                  defaultpdfvalue#arguments. varname#[i ] = selPDF.options[i].value;
                                             }
                                        }
          Â
                                        while (selPDF.options.length)
                                              selPDF.options[0] = null;
          Â
                                        if (curValue <= 0) {
                                            for(var i=0; i<defaultpdftext#arguments .varname#. length; i++)
                                                  selPDF.options[i] = new Option(defaultpdftext#argu ments.varn ame#[i], defaultpdfvalue#arguments. varname#[i ]);
                                             return;
                                        }
          Â
                                        selPDF.options[0] = new Option('#translate("Select a resource")#...', "");
                                        selPDF.options[1] = new Option('#translate("Add a new resource")#...', "");
                                        for(var i=0; i<list.length - 1; i+=2)
                                        selPDF.options[i/2 + 2] = new Option(list[i],list[i+1]);
                                        selPDF.selectedIndex = 0;
                                        selCat.options[0].text = "All Categories";
                                 }
          Â
                                 function jsNewFile_#arguments.varna me#(mySele ct) {
                                       var category = document.getElementById('# arguments. varname#_c ategory_se lect');
                                       var catid = category.options[category. selectedIn dex].value ;
                                      Â
                                       if (mySelect.options[mySelect .selectedI ndex].text == '#translate("Add a new resource")#...') {
                                            var link = 'popup/upload_file.cfm?js= jsAddFile_ #arguments .varname#& catid=' + catid + '<cfif ListLen(arguments.options) >&ext=#arg uments.opt ions#</cfi f>';
                                            if (window.showModalDialog)
                                                  showModalDialog(link, window, 'resizable: yes; help: no; status: no; scroll: no; ');
                                            else
                                                  window.open(link, '', 'help=no,resizable=yes,scr oll=no,sta tus=no,mod al=yes,wid th=300,hei ght=425');
                                       }
                                 }
          Â
                                 function jsAddFile_#arguments.varna me#(title, id, category) {
                                       var newoption = new Option(title, id);
                                       var selobj = document.getElementById('# arguments. varname#_s elect');
                                       selobj.options[selobj.opti ons.length ] = newoption;
                                       selobj.selectedIndex = selobj.options.length - 1;
                                       selobj.value = id;
                                 }
                            </script>
                           Â
                            <select class="formTextbox" style="width: #width#px;" name="#arguments.varname#_ category" id="#arguments.varname#_ca tegory_sel ect" onChange='PDFUpdate#argume nts.varnam e#(this, document.getElementById("# arguments. varname#_s elect"));' >
                                 <option value="">#translate("Selec t a file category")#...</option>
                                 <cfloop query="qryGetMediaCategory ">
                                       <option value="#qryGetMediaCategor y.intCateg oryID#">#q ryGetMedia Category.t xtCategory #</option>
                                 </cfloop>
                            </select>
                            <br>
     Â
                            <div id="#arguments.varname#_pi ckold" style="display: block;">
                                 <select class="formTextbox" name="#arguments.varname#" id="#arguments.varname#_se lect" style="width: #width#px;" onchange="jsNewFile_#argum ents.varna me#(this)" >
                                       <option value="">#translate("Selec t a resource")#...</option>
                                       <cfif SESSION.blnAddResource>
                                            <option value="">#translate("Add a new resource")#...</option>
                                       </cfif>
                                       <cfloop query="qryGetMedia">
                                            <option value="#intID#"<cfif value is intID> selected</cfif>>#txtTitle# </option>
                                       </cfloop>
                                 </select>
                            </div>
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
</cfcomponent>
        Error Executing Database Query.
The extended component:
<cfcomponent displayname="courseschedul
      <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(comp
           <cfset this.workflow = getObject("hb50.workflow",
           <cfset this.display = getObject("hb50.display",c
           <cfset this.media = getObject("hb50.media",com
           <cfset this.navigation = getObject("hb50.navigation
          Â
           <!--- configuration data --->
           <cfxml casesensitive="no" variable="this.xmlConfigDa
                 <cfoutput>
                      <data>
                            <!--- <item varname="blnDescription" title="Description" type="#this.TYPES.BOOLEAN#
                            <item varname="blnAbstract" title="Abstract" type="#this.TYPES.BOOLEAN#
                            <item varname="blnDate" title="Date" type="#this.TYPES.BOOLEAN#
                            <item varname="blnImage" title="Image" type="#this.TYPES.BOOLEAN#
                            <item varname="blnLink" title="Link" type="#this.TYPES.BOOLEAN#
                            <item varname="blnResource" title="Related Information" type="#this.TYPES.BOOLEAN#
                            <item varname="blnAddress" title="Address" type="#this.TYPES.BOOLEAN#
                            <item varname="blnPhone" title="Phone" type="#this.TYPES.BOOLEAN#
                            <item varname="blnFax" title="Fax" type="#this.TYPES.BOOLEAN#
                            <item varname="blnEmail" title="Email" type="#this.TYPES.BOOLEAN#
                            <item varname="blnCategoryListin
                            <item varname="blnCategoryPageCo
                            <item varname="blnCategoryDescri
                            <item varname="blnCategorySearch
                            <item varname="blnCategoryImage"
                            <item varname="blnCategoryImageW
                            <item varname="intCategoryImageA
                            <item varname="intCategoryImageW
                            <item varname="intCategoryImageH
                            <item varname="intCategoryLayout
                            <item varname="blnCategoryPagina
                            <item varname="intCategoryDispla
                            <item varname="blnItemListingPag
                            <item varname="blnItemListingDes
                            <item varname="intItemListingDes
                            <item varname="intItemListingDes
                            <item varname="txtItemListingDes
                            <item varname="blnItemListingSea
                            <item varname="blnItemListingAnc
                            <item varname="blnItemListingTit
                            <item varname="intItemListingDat
                            <item varname="intItemListingLay
                            <item varname="blnItemListingIma
                            <item varname="blnItemListingIma
                            <item varname="intItemListingIma
                            <item varname="intItemListingIma
                            <item varname="intItemListingIma
                            <item varname="blnItemListingPag
                            <item varname="intItemListingDis
                            <item varname="blnItemDetail" title="Item Detail Page" type="#this.TYPES.BOOLEAN#
                            <item varname="blnItemDetailPage
                            <item varname="blnItemDetailReso
                            <item varname="txtItemDetailReso
                            <item varname="blnItemDetailImag
                            <item varname="intItemDetailImag
                            <item varname="intItemDetailImag
                            <item varname="intItemDetailImag
                            <item varname="blnNotification" title="Send Notification" type="#this.TYPES.BOOLEAN#
                            <item varname="txtNotificationFr
                            <item varname="txtNotificationFr
                            <item varname="txtNotificationSu
                            <item varname="txtNotificationMe
                            <item varname="blnSecurityEnable
                            <item varname="intRoleIDs" title="Access Role(s)" type="#this.TYPES.SELECT#"
                            <item varname="intWebID" title="Web ID" type="#this.TYPES.SELECT#"
                            <item varname="intCompanyID" title="Company ID" type="#this.TYPES.SELECT#"
                            <item varname="blnDeleted" title="Deleted" type="#this.TYPES.BOOLEAN#
                      </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.xmlCon
                                Â
                 this.configData.tabs[1] = StructNew();
                 this.configData.tabs[1].ca
                 this.configData.tabs[1].co
                 this.configData.tabs[2] = StructNew();
                 this.configData.tabs[2].ca
                 this.configData.tabs[2].co
                                           Â
                 this.configData.tabs[3] = StructNew();
                 this.configData.tabs[3].ca
                 this.configData.tabs[3].co
                Â
                 this.configData.tabs[4] = StructNew();
                 this.configData.tabs[4].ca
                 this.configData.tabs[4].co
                Â
                 this.configData.tabs[5] = StructNew();
                 this.configData.tabs[5].ca
                 this.configData.tabs[5].co
                Â
                 this.configData.tabs[6] = StructNew();
                 this.configData.tabs[6].ca
                 this.configData.tabs[6].co
                Â
                 this.configData.tabs[7] = StructNew();
                 this.configData.tabs[7].ca
                 this.configData.tabs[7].co
                Â
                 this.configData.blnWorkflo
                 this.configData.blnApprova
                 this.configData.blnLock = false;
                 this.configData.blnVersion
                 this.configData.blnDelete = false;
                 this.configData.blnPreview
                 this.configData.blnCategor
                 this.configData.blnSchedul
                 this.configData.blnMeta = false;
                 this.configData.blnResourc
                 this.configData.blnOrder = false;
                 this.configData.blnExtraCo
           </cfscript>           Â
           <cfset this.workflow.verifyColumn
           <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#"
                            <item varname="intCategoryID" title="Category" type="#this.TYPES.CATEGORY
                            <!--- added field--->
                            <item varname="blnCCSSLink" title="Link to Course Schedule?" type="#this.TYPES.BOOLEAN#
                            <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"
                            </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#
                            <item varname="blnPrivate" title="Private" type="#this.TYPES.BOOLEAN#
                            <!--- changed txtdescription required to false--->     Â
                            <item varname="txtDescription" title="Description" type="#this.TYPES.HTML#" required="false"/>
                      </data>
                 </cfoutput>
           </cfxml>
          Â
           <cfif isDefined("this.xmlData.da
                 <cfset this.frontendDisplay = this.xmlData.data.frontend
           </cfif>
          Â
           <!--- added stored procedure to pull course numbers, titles for drop-down--->     Â
           <cfstoredproc datasource='#this.datasour
                 <cfprocresult name='qryCourseNumbers'>                Â
                 <cfprocparam type='In' cfsqltype='CF_SQL_varCHAR'
                 <cfswitch expression="#this.companyi
                 <cfcase value="2">
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 </cfcase>
                 <cfcase value="9">
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 </cfcase>
                 <cfcase value="10">
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 </cfcase>
     Â
  </cfswitch>
                 </cfstoredproc>     Â
          Â
                Â
           <cfscript>
                 this.formData = newFormData();
                 this.formData.columns = xmlDataToArray(this.xmlDat
                 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=intCourseI
                 ArrayPrepend(this.formData
                Â
                 this.formData.tabs[tabCoun
                 this.formData.tabs[tabCoun
                 this.formData.tabs[tabCoun
                 if (qryConfig.blnImage is 1) {
                      this.formData.tabs[tabCoun
                 }
                Â
                 if (qryConfig.blnLink is 1) {
                      this.formData.tabs[tabCoun
                 }
                 if (qryConfig.blnSecurityEnab
                      this.formData.tabs[tabCoun
                 }
                Â
                Â
                Â
                Â
                Â
                Â
                 if (qryConfig.blnDate is 1) {
                      tabCount = tabcount + 1;
                      this.formData.tabs[tabCoun
                      this.formData.tabs[tabCoun
                      this.formData.tabs[tabCoun
                 }
                Â
                 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[tabCoun
                      this.formData.tabs[tabCoun
                      this.formData.tabs[tabCoun
                 }
                Â
                 if (qryConfig.blnAddress is 1) {
                      this.formData.tabs[tabCoun
                 }
                 if (qryConfig.blnPhone is 1) {
                      this.formData.tabs[tabCoun
                 }
                 if (qryConfig.blnFax is 1) {                      Â
                      this.formData.tabs[tabCoun
                 }
                 if (qryConfig.blnEmail is 1) {
                      this.formData.tabs[tabCoun
                 }
                 if (qryConfig.blnAbstract is 1) {
                      tabCount = tabCount + 1;
                      this.formData.tabs[tabCoun
                      this.formData.tabs[tabCoun
                      this.formData.tabs[tabCoun
                 }
                Â
                 tabCount = tabCount + 1;
                 this.formData.tabs[tabCoun
                 this.formData.tabs[tabCoun
                 this.formData.tabs[tabCoun
                Â
                 this.formData.notification
                 if (qryConfig.blnNotification
                      tabCount = tabCount + 1;
                      this.formData.tabs[tabCoun
                      this.formData.tabs[tabCoun
                      this.formData.tabs[tabCoun
                      this.formData.notification
                 }
                 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.blnSchedulin
                 this.formData.blnMeta = true;                Â
                 this.formData.blnResources
                 this.formData.blnTranslate
                 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="blnShowCategoryTi
                            <item varname="txtDescription" title="Description" type="#this.TYPES.HTML#" required="false"/>
                            <item varname="intCategoryID" title="Category" type="#this.TYPES.HIDDEN#"
                      </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.xmlCat
                                Â
                 this.catData.tabs[1] = StructNew();
                 this.catData.tabs[1].capti
                 this.catData.tabs[1].colum
                 if (qryConfig.blnCategoryImag
                      this.catData.tabs[1].colum
                 }
                                Â
                 this.catData.tabs[2] = StructNew();
                 this.catData.tabs[2].capti
                 this.catData.tabs[2].colum
                 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
                 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#"
                            <item varname="intListID" title="" type="#this.TYPES.SELECT#"
                            <item varname="intCompanyID" title="" type="#this.TYPES.SELECT#"
                      </data>
                 </cfoutput>
           </cfxml>
          Â
           <cfscript>
                 this.listData = newFormData();
                 this.listData.tablename = "tblCourseListingLists";
                 this.listData.blnExtraColu
                 this.listData.columns = xmlDataToArray(this.xmlLis
           </cfscript>
          Â
           <!--- role data --->
           <cfxml casesensitive="no" variable="this.xmlRoleData
                 <cfoutput>
                      <data>
                            <item varname="intWebID" title="" type="#this.TYPES.SELECT#"
                            <item varname="intCompanyID" title="" type="#this.TYPES.SELECT#"
                            <item varname="intRoleID" title="" type="#this.TYPES.SELECT#"
                      </data>
                 </cfoutput>
           </cfxml>
          Â
           <cfscript>
                 this.roleData = newFormData();                Â
                 this.roleData.tablename = "tblCourseListingRole";
                 this.roleData.blnExtraColu
                 this.roleData.columns = xmlDataToArray(this.xmlRol
           </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(thi
           <cfelse>
                 <cfreturn this.workflow.getQuery(thi
           </cfif>
      </cffunction>
      <!--- return list of ulisting categories --->
      <cffunction name="getCategoryQuery" access="private" returntype="query">
           <cfset var qryCategory = ''>
          Â
           <cfquery name="qryCategory" datasource="#this.datasour
                 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.datasour
                 SELECT     Â
                      <cfif this.formData.blnCategory>
                        isnull(isnull(tblItem.intC
                      </cfif>
                      #this.formData.tablename#.
                      FROM tblItem
                      INNER JOIN #this.formData.tablename#
                            ON      tblItem.intID = #this.formData.tablename#.
                      <cfif arguments.blnLive>
                            AND #this.formData.tablename#.
                      </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.datatyp
                      AND tblNavigation.intCompanyID
                      AND tblItem.blnDeleted = 0
                      AND tblItem.intWebID = #this.formData.webid#
                      <cfif arguments.blnLive is true AND this.formData.blnSchedulin
                            AND (#this.formData.tablename#
                            AND (#this.formData.tablename#
                      </cfif>
                      <cfif isDefined("URL.c") and Val(URL.c)>
                            AND #this.formData.tablename#.
                      </cfif>
                      <cfif isDefined("ikeywords") and Len(Trim(ikeywords))>
                            AND (#this.formData.tablename#
                                       <cfif qryConfig.blnAbstract is 1>OR #this.formData.tablename#.
                                       <cfif qryConfig.blnAddress is 1>
                                            OR #this.formData.tablename#.
                                            OR #this.formData.tablename#.
                                            OR #this.formData.tablename#.
                                            OR #this.formData.tablename#.
                                       </cfif>
                                       <cfif qryConfig.blnLink is 1>
                                            OR #this.formData.tablename#.
                                       </cfif>)     Â
                      </cfif>
                       ORDER BY
                      <cfif qryConfig.blnDate is 1>
                            #this.formData.tablename#.
                      </cfif>
                      <cfif this.formData.blnOrder>
                            tblItem.intOrder
                      <cfelse>
                            #this.formData.tablename#.
                      </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.datasour
                 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.datasour
                 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.intRole
          Â
           <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.datasour
                 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.getDirecto
           </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.formDat
                 <cfif ListFindNoCase("#TYPES.TEX
                      <cfset list = ListAppend(list, this.formData.columns[i].v
                 </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="getCategorySearchCol
           <cfset var i = 0>
           <cfset var list = "">
          Â
           <cfloop from="1" to="#ArrayLen(this.catData
                 <cfif ListFindNoCase("#TYPES.TEX
                      <cfset list = ListAppend(list, this.catData.columns[i].va
                 </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.loggedI
                 <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,
                 <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.blnSecurityEnabl
                 <cfif not privateAccess()>
                      <cfset qryAll = SelectFrom(qryAll,"blnPriv
                 </cfif>
           </cfif>
                Â
                Â
           <!--- output item details --->                      Â
           <cfif isDefined("URL.i")>
                 <cfif qryConfig.blnItemDetailPag
                      <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.blnItemListingAn
                 <cfif qryConfig.blnItemListingPa
                      <cfset output.blnHideContent = true>
                 </cfif>
                 <cfset output.body = getAnchoredListing(qryConf
                 <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.blnCategoryListi
                 <cfif qryConfig.blnItemListingPa
                      <cfset output.blnHideContent = true>
                 </cfif>
                 <!--- <cfset qryItems = SelectFrom(qryAll, "intCategoryID", Val(URL.c))> --->
                 <cfset output.body = getItemListing(qryConfig, qryAll)>
                 <cfreturn output />
           </cfif>
          Â
           <cfif qryConfig.blnCategoryPageC
                 <cfset output.blnHideContent = true>
           </cfif>
          Â
           <!--- output category listing --->                Â
           <cfset output.body = getCategoryListing(qryConf
          Â
           <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.intCatego
                      ORDER BY qryAllCategories.intOrder
                 </cfquery>
           </cfif>
          Â
           <cfsavecontent variable="listingOutput">
                 <!--- output search form is category search is enabled --->
                 <cfif qryConfig.blnCategorySearc
                      <cfoutput>
                      <form name="hbsrchmod" id="hbsrchmod" method="post" action="#SCRIPT_NAME#">
                            <input type="text" name="ckeywords" id="hbsrchkey" <cfif isDefined('ckeywords')>val
                            <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.blnCategoryPagin
                            <cfset recordsToDisplay = Val(qryConfig.intCategoryD
                            <cfif qryConfig.intCategoryLayou
                                 <cfset recordsToDisplay = recordsToDisplay * 2>
                            </cfif>
                            <cfset thepagination = this.display.getPagination
                      </cfif>
                                      Â
                      <cfif Len(Trim(thepagination))><
                      <div id="hbcatmod">
                            <cfif qryConfig.intCategoryLayou
                                 <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
                                                  <cfif qryConfig.intCategoryImage
                                                       <img src="#this.workflow.setSSL
                                                       <h5><a href="#SCRIPT_NAME#?c=#int
                                                  <cfelse> <!--- image left or right --->
                                                       <h5><a href="#SCRIPT_NAME#?c=#int
                                                       <img src="#this.workflow.setSSL
                                                  </cfif>
                                            <cfelse> <!--- without image --->
                                                  <h5><a href="#SCRIPT_NAME#?c=#int
                                            </cfif>                                                                       Â
                                            <cfif qryConfig.blnCategoryDescr
                                                  <!--- convertTokens() --->
                                                  #this.workflow.convertToke
                                            </cfif>
                                            </div>
                                       <cfif count mod 2 is 0>
                                            <div class="clr"> </div>
                                       </div>
                                       </cfif>
                                       <cfset count = count + 1>
                                 </cfoutput>
                                 <cfif count mod 2 is 0>
                                       <div class="clr"> </div>
                                 </div>
                                 </cfif>                                 Â
                            <cfelse> <!--- one column --->
                                 <cfif qryConfig.blnCategoryImage
                                       <cfif qryConfig.intCategoryImage
                                            <cfif qryConfig.blnCategoryImage
                                                  <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay
                                                       <h5><a href="#SCRIPT_NAME#?c=#int
                                                       <cfif intImageID gt 0><a href="#SCRIPT_NAME#?c=#int
                                                       <cfif qryConfig.blnCategoryDescr
                                                       <div class="clr"> </div>
                                                  </cfoutput>
                                            <cfelse>     Â
                                                  <cfset roundedWidth = roundImageWidth(Val(qryCon
                                                  <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay
                                                       <cfif qryConfig.intCategoryImage
                                                       <div class="hbcatlft#roundedWid
                                                       <div class="hbcatrht#roundedWid
                                                       <cfelse>
                                                       <div class="hbcatrht#roundedWid
                                                       <div class="hbcatlft#roundedWid
                                                       </cfif>
                                                       <h5><a href="#SCRIPT_NAME#?c=#int
                                                       <cfif qryConfig.blnCategoryDescr
                                                       </div>
                                                       <div class="clr"> </div>
                                                  </cfoutput>                                      Â
                                            </cfif>                                      Â
                                       <cfelse> <!--- this.IMAGE_ALIGN.INLINE --->
                                            <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay
                                                  <cfif intImageID GT 0><img src="#this.workflow.setSSL
                                                  <h5><a href="#SCRIPT_NAME#?c=#int
                                                  <cfif qryConfig.blnCategoryDescr
                                                  <div class="clr"> </div>
                                            </cfoutput>
                                       </cfif>
                                 <cfelse>
                                       <cfoutput query="qryCategories" startrow="#URL.sr#" maxrows="#recordsToDisplay
                                            <h5><a href="#SCRIPT_NAME#?c=#int
                                            <cfif qryConfig.blnCategoryDescr
                                            <div class="clr"> </div>
                                       </cfoutput>
                                 </cfif>
                            </cfif> <!--- column layout --->                                                            Â
                      </div>
                      <cfif Len(Trim(thepagination))><
                 </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,'intCate
           </cfif>     Â
                Â
           <cfsavecontent variable="listingOutput">
                 <!--- <cfif qryConfig.blnSecurityEnabl
                  <cfif qryConfig.blnSecurityEnabl
                      <cfset loginLink = loginLink & '?wid=#this.webid#'>
                      <cfif isDefined("URL.c")>
                            <cfset loginLink = loginLink & '&cid=#URL.c#'>
                      </cfif>
                      <cfoutput><p><a href="#loginLink#">Login</
                 </cfif>
                Â
                Â
                 <!--- output the search form if item listing search is enabled --->
                 <cfif qryConfig.blnItemListingSe
                      <cfset qryCategories = getCategoryQuery()>
                      <cfoutput>                           Â
                      <form name="frmSearch" id="hbsrchmod" method="post" action="#SCRIPT_NAME#">
                            <input type="text" name="ikeywords" id="hbsrchkey" <cfif isDefined('ikeywords')>val
                            <select name="c" id="hbsrchsel">
                                 <option value="0">All</option>
                                 <cfloop query="qryCategories">
                                       <option value="#qryCategories.intC
                                 </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.blnItemListingPa
                            <cfset recordsToDisplay = Val(qryConfig.intItemListi
                            <cfif qryConfig.intItemListingLa
                                 <cfset recordsToDisplay = recordsToDisplay * 2>
                            </cfif>
                            <cfset thepagination = this.display.getPagination
                      </cfif>
                     Â
                      <cfset callAction = 'more...'>
                      <cfif Len(Trim(qryConfig.txtItem
                            <cfset callAction = qryConfig.txtItemListingDe
                      </cfif>                      Â
                                      Â
                      <cfif Len(Trim(thepagination))><
                           Â
                      <div id="hblistmod">                Â
                            <cfif qryConfig.intItemListingLa
                                 <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=#intItemI
                                                  <cfelseif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                                       <cfif REFindNoCase("http[s]://",
                                                             <cfset txtURL = txtLink>
                                                       <cfelse>
                                                             <cfset txtURL = "http://#txtLink#">
                                                       </cfif>
                                                       <cfset txtTarget = 'target="_blank"'>
                                                  <cfelse>
                                                       <cfset txtURL = ''>
                                                  </cfif>
                                                  <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingIm
                                                        <cfif Len(Trim(txtURL))>
                                                             <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(in
                                                       <cfelse>
                                                             <img src="#this.workflow.setSSL
                                                       </cfif>                                                  Â
                                                  </cfif>                                                  Â
                                                  <cfif qryConfig.blnItemListingTi
                                                       <cfif Len(Trim(txtURL))>
                                                             <h5><a href="#txtURL#" #txtTarget#>#txtTitle#</a>
                                                       <cfelse>
                                                             <h5>#txtTitle#<cfif blnPrivate> #this.PRIVATE_IMAGE#</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))><cf
                                                       <cfif Len(Trim(txtPostalCode))><
                                                       <cfset addressLine2 = addressLine2 & ' #txtCountry#'>
                                                       <cfif Len(Trim(addressLine1))><c
                                                       <cfif Len(Trim(addressLine2))><c
                                                  </cfif>
                                                  <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtPhone))><cfset
                                                  <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))><cf
                                                  <cfif qryConfig.blnEmail is 1 AND Len(Trim(txtEmail))><cfset
                                                  <cfif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                                       <cfif REFindNoCase("http[s]://",
                                                             <cfset txtItemLink = txtLink>
                                                       <cfelse>
                                                             <cfset txtItemLink = "http://#txtLink#">
                                                       </cfif>
                                                       <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#txtLink#<
                                                  </cfif>
                                                  <cfif Len(Trim(infoList))>
                                                       <ul>
                                                             #infoList#                                                 Â
                                                       </ul>
                                                  <cfelse>
                                                       <br />
                                                  </cfif>
                                                  <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingIm
                                                       <cfif Len(Trim(txtURL))>
                                                             <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(in
                                                       <cfelse>
                                                             <img src="#this.workflow.setSSL
                                                       </cfif>
                                                  </cfif>     Â
                                                  <cfif qryConfig.blnItemListingDe
                                                       <cfif qryConfig.intItemListingDe
                                                             #txtAbstract#
                                                       <cfelseif qryConfig.intItemListingDe
                                                             <!--- Thomas Auguest 29 2006: More... option doesn't work for two column item listing. START --->
                                                             <!--- <cfif Len(Trim(txtURL))>
                                                                  #this.display.memoFormat(t
                                                             <cfelse>
                                                                  #this.display.memoFormat(t
                                                             </cfif> --->
                                                             #this.display.memoFormat(t
                                                             <!--- Thomas Auguest 29 2006: More... option doesn't work for two column item listing. END--->
                                                       <cfelse> <!--- full --->
                                                             <!--- convertTokens() --->
                                                             #this.workflow.convertToke
                                                       </cfif>                                                 Â
                                                  </cfif>
                                            </div>                                            Â
                                       <cfif count MOD 2 is 0>           Â
                                            <div class="clr"> </div>                                            Â
                                       </div>
                                       </cfif>
                                       <cfset count = count + 1>                                      Â
                                 </cfoutput>
                                 <cfif count MOD 2 is 0>
                                       <div class="clr"> </div>
                                 </div>
                                 </cfif>     Â
                            <cfelse> <!--- single column --->
                                 <cfif qryConfig.blnDate is 1 AND qryConfig.intItemListingDa
                                                                       Â
                                       <cfoutput query="qryItems" startrow="#URL.sr#" maxrows="#recordsToDisplay
                                            <div class="hblistlft"><cfif isDate(dtDate)><strong><a href="#SCRIPT_NAME#?i=#int
                                            <div class="hblistrht75">
                                                  <cfif qryConfig.blnItemListingTi
                                                  <cfif qryConfig.blnItemListingDe
                                                       <cfif qryConfig.intItemListingDe
                                                             #txtAbstract#
                                                       <cfelseif qryConfig.intItemListingDe
                                                             #this.display.memoFormat(t
                                                       <cfelse> <!--- full --->
                                                             <!--- convertTokens() --->
                                                             #this.workflow.convertToke
                                                       </cfif>                                                 Â
                                                  </cfif>
                                            </div>
                                       </cfoutput>
                                 <cfelse> <!--- no date or date layout is two line --->
                                       <cfset roundedWidth = roundImageWidth(Val(qryCon
                                       <cfoutput query="qryItems" startrow="#URL.sr#" maxrows="#recordsToDisplay
                                            <cfset txtTarget = ''>                                      Â
                                            <cfif qryConfig.blnItemDetail is 1>
                                                  <cfset txtURL = '#SCRIPT_NAME#?i=#intItemI
                                            <cfelseif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                                  <cfif REFindNoCase("http[s]://",
                                                       <cfset txtURL = txtLink>
                                                  <cfelse>
                                                       <cfset txtURL = "http://#txtLink#">
                                                  </cfif>
                                                  <cfset txtTarget = 'target="_blank"'>
                                            <cfelse>
                                                  <cfset txtURL = ''>     Â
                                            </cfif>
                                            <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingIm
                                                  <cfif qryConfig.blnItemListingIm
                                                       <cfif qryConfig.intItemListingIm
                                                            Â
                                                             <cfif Len(Trim(txtURL))>                                                                  Â
                                                                  <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(in
                                                             <cfelse>
                                                                  <img src="#this.workflow.setSSL
                                                             </cfif>                                                            Â
                                                       <cfelse> <!--- image left or inline --->     Â
                                                             <cfif Len(Trim(txtURL))>
                                                                  <a href="#txtURL#" #txtTarget#><img src="#this.media.getURL(in
                                                             <cfelse>
                                                                  <img src="#this.workflow.setSSL
                                                             </cfif>
                                                       </cfif>
                                                  <cfelse> <!--- image no wrap --->                                                                                                              Â
                                                       <cfif Len(Trim(txtURL))>
                                                             <div <cfif qryConfig.intItemListingIm
                                                             <div <cfif qryConfig.intItemListingIm
                                                       <cfelse>
                                                             <div <cfif qryConfig.intItemListingIm
                                                             <div <cfif qryConfig.intItemListingIm
                                                       </cfif>
                                                  </cfif>                                                                                                                                                    Â
                                            </cfif>
                                            <cfif qryConfig.blnItemListingTi
                                                  <cfif Len(Trim(txtURL))>
                                                       <h5><a href="#txtURL#" #txtTarget#>#txtTitle#</a>
                                                  <cfelse>
                                                       <h5>#txtTitle#<cfif blnPrivate> #this.PRIVATE_IMAGE#</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))><cf
                                                  <cfif Len(Trim(txtPostalCode))><
                                                  <cfset addressLine2 = addressLine2 & ' #txtCountry#'>
                                                  <cfif Len(Trim(addressLine1))><c
                                                  <cfif Len(Trim(addressLine2))><c
                                            </cfif>
                                            <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtPhone))><cfset
                                            <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))><cf
                                            <cfif qryConfig.blnEmail is 1 AND Len(Trim(txtEmail))><cfset
                                            <cfif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                                  <cfif REFindNoCase("http[s]://",
                                                       <cfset txtItemLink = txtLink>
                                                  <cfelse>
                                                       <cfset txtItemLink = "http://#txtLink#">
                                                  </cfif>
                                                  <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#txtLink#<
                                            </cfif>
                                            <cfif Len(Trim(infoList))>
                                                  <ul>
                                                       #infoList#                                                 Â
                                                  </ul>
                                            </cfif>
                                           Â
                                            <cfif qryConfig.blnItemListingDe
                                                  <cfif qryConfig.intItemListingDe
                                                       #txtAbstract#
                                                  <cfelseif qryConfig.intItemListingDe
                                                       #this.display.memoFormat(t
                                                  <cfelse> <!--- full --->
                                                       <!--- convertTokens() --->
                                                       #this.workflow.convertToke
                                                  </cfif>                                                 Â
                                            </cfif>
                                            <div class="clr"> </div>
                                            <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingIm
                                            </div>
                                            </cfif>                                 Â
                                       </cfoutput>                                      Â
                                 </cfif>
                            </cfif>                           Â
                      </div>
                      <cfif Len(Trim(thepagination))><
                 </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.blnSec
                            <cfset loginLink = loginLink & '?wid=#this.webid#'>
                            <cfif isDefined("URL.c")>
                                 <cfset loginLink = loginLink & '&cid=#URL.c#'>
                            </cfif>
                            <cfoutput><p><a href="#loginLink#">Login</
                      </cfif>
                      <div id="anchorlisting">
                      <a name="item0"></a>
                      <cfloop query="qryAllCategories">
                            <cfset qryItems = SelectFrom(qryAll,'intCate
                            <cfoutput>
                            <cfif qryAllCategories.blnShowCa
                            <h2>#qryAllCategories.txtT
                            </cfif>
                            <cfif qryConfig.blnCategoryDescr
                            <p>#qryAllCategories.txtDe
                            </cfif>
                           Â
                            <ul>
                            </cfoutput>
                            <cfoutput query="qryItems">
                                 <!--- Donny: missing url parameter
                                 <li><strong><a href="#SCRIPT_NAME###item#
                                 <li><strong><a href="#SCRIPT_NAME#<cfif Len(Trim(QUERY_STRING))>?#
                            </cfoutput>
                            </ul>
                            <cfset count = count + qryItems.recordCount>
                      </cfloop>
                      <div class="clr"> </div>
                      <cfset count = 0>
                      <cfloop query="qryAllCategories">
                            <cfset qryItems = SelectFrom(qryAll,'intCate
                            <ul id="dottedtop">
                            <cfoutput query="qryItems">
                                 <cfset roundedWidth = roundImageWidth(Val(qryCon
                                 <li>
                                       <h5><a name="item#count + currentRow#"></a>#txtTitle
                                       <!--- <strong>#qryAllCategories.
                                       <div id="hblistmod">
                                       <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingIm
                                            <cfif qryConfig.blnItemListingIm
                                                  <cfif qryConfig.intItemListingIm
                                                       <img src="#this.workflow.setSSL
                                                  <cfelse> <!--- image left or inline --->     Â
                                                       <img src="#this.workflow.setSSL
                                                  </cfif>
                                            <cfelseif Val(intImageID)> <!--- image no wrap --->                                                       Â
                                                  <div <cfif qryConfig.intItemListingIm
                                                  <div <cfif qryConfig.intItemListingIm
                                            </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))><cf
                                            <cfif Len(Trim(txtPostalCode))><
                                            <cfset addressLine2 = addressLine2 & ' #txtCountry#'>
                                            <cfif Len(Trim(addressLine1))><c
                                            <cfif Len(Trim(addressLine2))><c
                                       </cfif>
                                       <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtPhone))><cfset
                                       <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))><cf
                                       <cfif qryConfig.blnEmail is 1 AND Len(Trim(txtEmail))><cfset
                                       <cfif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                            <cfif REFindNoCase("http[s]://",
                                                  <cfset txtItemLink = txtLink>
                                            <cfelse>
                                                  <cfset txtItemLink = "http://#txtLink#">
                                            </cfif>
                                            <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#txtLink#<
                                       </cfif>
                                       <cfif Len(Trim(infoList))>
                                            <ul>
                                                  #infoList#                                                 Â
                                            </ul>
                                       </cfif>
                                       <!--- convertTokens() --->
                                       #this.workflow.convertToke
                                       <!--- Donny: missing url parameter
                                       <p><a href="#SCRIPT_NAME###item0
                                      Â
                                       <cfstoredproc procedure="getCourseDesc" datasource="#this.datasour
                            <cfprocresult name="getCourseDesc">
                            <cfprocparam cfsqltype="cf_sql_varchar"
                            <cfprocparam cfsqltype="cf_sql_integer"
                            </cfstoredproc>
                           Â
                            <cfstoredproc procedure="getPreqList" datasource="#this.datasour
                            <cfprocresult name="getPreqList">
                            <cfprocparam cfsqltype="cf_sql_integer"
                            </cfstoredproc>
                           Â
                           Â
                                 <cfif getcoursedesc.coursedescri
                                 <cfif getcoursedesc.catalognotes
                           Â
                           Â
                            <cfif getPreqList.recordcount neq 0>
                            <p><em>Prerequisite(s):</e
                            <cfloop query="getPreqList">
                                 <cfif #preq_flag# eq "C">
                                       #left(CourseNumber,3)#.#ri
                                 <cfelse>
                                       #lstPrerequisitesID#
                                 </cfif>           Â
                            </cfloop></p>
                            </cfif>
                           Â
                                 <cfif qryItems.blnCCSSLink eq "1">
                            <p><img src="/images/CCSSicon.gif"
                            </cfif>
                                      Â
                                       <p><a href="#SCRIPT_NAME#<cfif Len(Trim(QUERY_STRING))>?#
                                       <div class="clr"> </div>
                                       <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemListingIm
                                            </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.blnSecurityEnabl
                 <cfif NOT (isDefined("SESSION.logged
                Â
                      <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
                                 <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))><cf
                                       <cfif Len(Trim(txtPostalCode))><
                                       <cfset addressLine = addressLine & ' #txtCountry#'>
                                       <cfif Len(Trim(addressLine))><cf
                                 </cfif>
                                 <cfif qryConfig.blnPhone is 1 AND Len(Trim(txtPhone))><cfset
                                 <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))><cf
                                 <cfif qryConfig.blnEmail is 1 AND Len(Trim(txtEmail))><cfset
                                 <cfif qryConfig.blnLink is 1 AND Len(Trim(txtLink))>
                                       <cfif REFindNoCase("http[s]://",
                                            <cfset txtItemLink = txtLink>
                                       <cfelse>
                                            <cfset txtItemLink = "http://#txtLink#">
                                       </cfif>
                                       <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#txtLink#<
                                 </cfif>
                                 <cfif Len(Trim(infoList))>
                                       <ul>
                                            #infoList#                                                 Â
                                       </ul>
                                 </cfif>
                                 <cfif qryConfig.blnImage is 1 AND qryConfig.blnItemDetailIma
                                 <!--- convertTokens() --->
                                 <p>#this.workflow.convertT
                                 <cfif qryConfig.blnResource is 1>
                                       <cfset addlResources = this.media.getAdditionalRe
                                       <cfif ArrayLen(addlResources)>
                                       <br/>
                                       <strong>#qryConfig.txtItem
                                       <ul>
                                            <cfloop from="1" to="#ArrayLen(addlResource
                                                  <li><a href="#addlResources[i].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(transl
                            <cfif this.formData.blnCategory>
                                 <item caption="#XMLFormat(transl
                            </cfif>
                            <item caption="#XMLFormat(transl
                      </item>
                 </cfoutput>
           </cfxml>
          Â
           <cfreturn xmlNav />
      </cffunction>
      <!--- returns hotbanana back end interface --->
      <cffunction name="getBackEnd" access="public" returntype="string">
           <cfset this.workflow.verifyColumn
           <cfset this.workflow.verifyColumn
           <cfset this.workflow.verifyColumn
           <cfset this.workflow.verifyColumn
                Â
           <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"
                 UPDATE       tblNavigation
                 SET            tblNavigation.intOrder =
                      (SELECT tblItem.intOrder
                       FROM       tblItem
                       LEFT JOIN tblCourseListingCategory
                       ON       tblItem.intID = tblCourseListingCategory.i
                       AND       tblCourseListingCategory.b
                       WHERE       intDatatype = #this.DATATYPES.CATEGORY#
                       AND       intWebID = #this.webid#
                       AND       tblNavigation.intID = tblCourseListingCategory.i
                 WHERE       intParentID = #this.webid#
                 AND       blnCategory = 1
                 AND       blnDeleted = 0
           </cfquery>
           <cfif isDefined("FORM.button")>
                 <!--- <cfif (NOT isDefined("FORM.intCategor
                      <cfset qryCategory = selectFrom(this.workflow.g
                      <cfset FORM.intCategoryID = qryCategory.intCategoryID>
                 </cfif> --->
                 <cfif FORM.button is translate("Delete")>
                      <!--- <cfset FORM.intCategoryID = val(FORM.intCategoryID)> --->
                      <cfset this.category.deleteCatego
                      <cfset this.display.setActionMsg(
                 <cfelseif FORM.button is translate("Restore")>
                      <cfset this.category.restoreCateg
                      <cfset this.display.setActionMsg(
                 <cfelse>
                      <cfif (isDefined("FORM.intCatego
                            <!---  we need to see if the category was approved before we set the actual category title --->
                            <cfset this.display.setActionMsg(
                            <cfset qryCategory = selectFrom(this.workflow.g
                            <cfif (NOT isDefined("qryCategory.bln
                                 <cfset this.category.updateCatego
                            </cfif>
                      <cfelse>
                            <cfset FORM.intCategoryID = this.category.addCategory(
                            <cfset this.display.setActionMsg(
                      </cfif>
                 </cfif>
           </cfif>
           <!--- <cfset this.formData.query = this.workflow.getQuery(thi
           <cfset qryRecords = this.workflow.getQuery(thi
           <!--- <cfset qryRecords = getCategoryQuery()> --->           Â
           <!--- <cfset qryPublic = this.workflow.getPublicQue
           <cfset qryPublic = getItemQuery(qryConfig,fal
           <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.intCategor
                 </cfquery>
                 <cfset count = qryItemCount.recordcount>
                 <cfset ArrayAppend(extraColumn, count)>
                 <cfset this.category.setActive(qr
           </cfoutput>
          Â
           <cfset QueryAddColumn(qryRecords,
           <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(th
           </cfif>
           <cfreturn this.display.getListing(th
      </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.txt
           <cfschedule action="delete" task="#this.datasource#_#t
          Â
           <cfset sendNotification(itemid,li
      </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.datasour
                 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
                 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.recor
                 <cfreturn "Schedule failed">
           </cfif>     Â
           <cfset startDateTime = qryItem.dtStart>
           <cfset listIds = ValueList(qryNotificationL
           <cfif NOT isDate(startDateTime) OR DateDiff("n", startDateTime, now()) GTE 0>                Â
                 <cfset sendNotification(itemid,li
                 <cfreturn "Task run">                Â
           </cfif>
     Â
           <cfset itemuid = qryItem.intUID>
                                Â
           <cfset taskcfm = '<cfset createObject("component","
          Â
           <cfif not DirectoryExists('#this.qry
                 <cfdirectory action="create" directory="#this.qryCompan
           </cfif>
           <cffile action="write" file="#this.qryCompany.txt
           <cfschedule action="update" task="#this.datasource#_#t
                            startDate="#DateFormat(sta
                            url="#this.qryCompany.txtW
                     Â
           <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.ge
           <cfset var qryRecipients = contactManager.getRecipien
           <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.datasour
                 SELECT      TOP 1 intItemID
                 FROM      #this.formData.tablename#
                 WHERE      intID = <cfqueryparam value="#val(arguments.item
           </cfquery>
                Â
           <cfset qryConfig = getConfigQuery()>
          Â
           <cfif Len(Trim(qryConfig.txtNoti
                 <cfset subject = qryConfig.txtNotificationS
           </cfif>
           <cfif Len(Trim(qryConfig.txtNoti
                 <cfset fromEmail = qryConfig.txtNotificationF
                 <cfif Len(Trim(qryConfig.txtNoti
                      <cfset fromEmail = '"#qryConfig.txtNotificati
                 </cfif>
           </cfif>           Â
                                Â
           <cfset pageTitle = this.navigation.getCaption
           <cfset pageURL = '#this.navigation.getURL(t
          Â
           <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.qry
                 <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/SpryCollap
                 <link href="SpryAssets/SpryColla
                 </head>
                     Â
                 <body>
                 <div id="CollapsiblePanel2" class="CollapsiblePanel">
                  <div class="CollapsiblePanelTab
                  <div class="CollapsiblePanelCon
             </div>
                      <div id="CollapsiblePanel1" class="CollapsiblePanel">
                       <div class="CollapsiblePanelTab
                       <div class="CollapsiblePanelCon
             </div>                           Â
           #this.workflow.convertToke
                      <a href="#pageURL#" target="_blank">#pageURL#<
                      <p>#emailFooter#</p>
                   <script type="text/javascript">
<!--
var CollapsiblePanel1 = new Spry.Widget.CollapsiblePan
var CollapsiblePanel2 = new Spry.Widget.CollapsiblePan
//-->
</script>
                 </body>
                 </html>
                 </cfoutput>
           </cfsavecontent>
                     Â
           <cfset communication = getObject("hb50.communicat
                     Â
           <cfif Len(Trim(fromEmail))>                Â
                 <cfloop query="qryRecipients">                      Â
                      <cfset toEmail = qryRecipients.txtEmail>
                      <cfif Len(Trim(toEmail))>
                            <cftry>
                            <cfset communication.sendTextHTML
                            <cfcatch></cfcatch>
                            </cftry>
                      </cfif>
                 </cfloop>                Â
           </cfif>                      Â
      </cffunction>
     Â
      <cffunction name="getEmailFooter" access="private" returntype="string">
           <cfset emailFooter = '#this.qryCompany.txtTitle
           <cftry>                           Â
                 <cfquery name="qryDisplaySettings" datasource="#this.datasour
                      SELECT       TOP 1 intCompanyID, txtEmailFooter
                      FROM       tblDisplaySettings
                      WHERE       intCompanyID = #this.companyID#
                 </cfquery>
                 <cfset emailFooter = this.workflow.convertToken
                 <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(
          Â
           <cfif isDefined("FORM.intListIds
                 <cfquery name="qryItem" datasource="#this.datasour
                      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
                      <cfloop list="#FORM.intListIds#" index="idx">
                            <cfquery name="qryAddList" datasource="#this.datasour
                                 INSERT INTO #this.listData.tablename#
                                       (intItemID,intListID,intCo
                                 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.blnNotific
                            <cfset scheduleTask(Val(qryItem.i
                      </cfif>                           Â
                 <cfelse>                                                       Â
                      <cfif fileexists("#this.qryCompa
                            <cffile action="delete" file="#this.qryCompany.txt
                            <cfschedule action="delete" task="#this.datasource#_#t
                      </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.datasour
                      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.recordCoun
                      <cfquery name="qryNotificationLists
                            SELECT       TOP 1 intListID
                            FROM       #this.listData.tablename#
                            WHERE       intItemID = <cfqueryparam value="#qryApprovedItem.in
                            AND            intCompanyID = <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer"
                      </cfquery>
                      <cfif qryNotificationLists.recor
                            <cftrace text="U Listing: schedule notification task for approved item"/>
                            <cfset scheduleTask(qryApprovedIt
                      <cfelse>                      Â
                            <cfif fileexists("#this.qryCompa
                                 <cftrace text="U Listing: remove scheduled task for approved item"/>
                                 <cffile action="delete" file="#this.qryCompany.txt
                                 <cfschedule action="delete" task="#this.datasource#_#t
                            </cfif>
                      </cfif>
                 </cfif>
           </cfif>
          Â
           <cfset this.formData.query = getQuery()>
           <!--- check if category should be active after every save --->
           <cfif isDefined("FORM.intCategor
                 <!--- <cfset qryRecords = this.workflow.getQuery(thi
                 <!--- <cfset qryPublic = this.workflow.getPublicQue
                 <cfset qryRecords = getCategoryQuery()>
                 <cfset qryPublic = getItemQuery(qryConfig,tru
                 <cfoutput query="qryRecords">
                      <cfquery name="qryItemCount" dbtype="query">
                            SELECT DISTINCT intItemID
                            FROM       qryPublic
                            WHERE       intCategoryID = #Val(qryRecords.intCategor
                      </cfquery>
                      <cfset count = qryItemCount.recordcount>
                      <cfset this.category.setActive(qr
                 </cfoutput>
           </cfif>
          Â
           <cfif isDefined("URL.id") AND Val(URL.id)>
                 <cfset FORM.id = URL.id>
           </cfif>
          Â
           <cfif (isSet("mode", "edit"))>
                 <cfif this.formData.notification
                      <cfset this.contactManager = getObject("hb50.plugins.ge
                      <cftry>
                            <cfset qryLists = this.contactManager.getLis
                      <cfcatch><cfset qryLists = QueryNew("intID,txtTitle")
                      </cftry>
                     Â
                      <cfset listingLists = "">
                      <cfif isDefined("FORM.id") and Val(FORM.id)>
                            <!--- version stuff --->
                            <cfquery name="qryVersion" datasource="#this.datasour
                                 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.datasour
                                 SELECT       intListID
                                 FROM       #this.listData.tablename#
                                 WHERE       intItemID = <cfqueryparam value="#Val(qryListingItem
                                 AND       intCompanyID = <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer"
                            </cfquery>
                            <cfset listingLists = ValueList(qryListingLists.
                      </cfif>
                                                      Â
                      <cfsavecontent variable="notificationTab"
                            <cfoutput>
                            <script language="JavaScript" type="text/javascript">
                            function jsAddContactList() {
                                 if (document.frmAddEdit.intLi
                                       return false;
                                 }
                                 jsPopup('addContactList','
                                 return false;                                 Â
                            }
                            function jsUpdateListSelect(listID,
                                 var size = document.frmAddEdit.intLis
                                 document.frmAddEdit.intLis
                                 document.frmAddEdit.intLis
                            }
                                                      Â
                            function jsViewRecipients() {
                                 if (document.frmAddEdit.intLi
                                       alert("Please select a list.");
                                       return;
                                 }
                                 var form = document.frmAddEdit;
                                 var tempAction = form.action;
                                 window.open('', 'recipientsWindow', 'height=450,width=350,inne
                                 form.action = '#this.qryCompany.txtHBWeb
                                 form.target = 'recipientsWindow';
                                 form.submit();
                                 form.action = tempAction;
                                 form.target = '';
                            }
                           Â
                            function jsExtraValidate() {
                                 if (document.frmAddEdit.blnNo
                                       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.onbeforeunlo
                                 }
                                 return valid;
                            }
                            document.frmAddEdit.onsubm
                            </script>     Â
                            <div id="blnNotification"></div
                            <div style="padding:10px;">
                                 <fieldset>
                                 <legend><input type="checkbox" name="blnNotification" <cfif isDefined("qryListingItem"
                                 <table cellpadding="5">
                                       <tr>
                                            <td class="formCaption">List: <br />
                                                  <select name="intListIds" class="formTextBox" style="width:235px;height:
                                                       <option value="-1">Add a new list</option>
                                                       <cfloop query="qryLists">
                                                             <option value="#qryLists.intID#" <cfif ListFind(listingLists,qryL
                                                       </cfloop>
                                                  </select><br />
                                                  <input type="button" onclick="jsViewRecipients(
                                            </td>
                                       </tr>
                                 </table>
                                 </fieldset>
                            </div>
                            </cfoutput>
                      </cfsavecontent>     Â
                      <cfset this.formData.tabs[this.fo
                 </cfif>
                Â
                 <cfreturn this.display.getAddEdit(th
           </cfif>
          Â
           <!--- if nothing else has been returned, return the generic listing --->
           <cfreturn this.display.getListing(th
      </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(
                Â
                 <!--- role stuff --->
                 <!--- <cfset qryOldRoles = getRoleQuery()>
                 <cfset oldRoles = ValueList(qryOldRoles.intR
                 <cfset oldRoles = getListRoles()>
                 <cfset newRoles = ''>
                 <cfif isDefined("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,list
                            <cfelse>
                                 <cftrace text="insert role"/>
                                 <cfquery name="qryAddRole" datasource="#this.datasour
                                       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.datasour
                                 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.verifyColumn
           <cfset qryConfig = getConfigQuery()>
           <cfset this.configData.query = qryConfig>
          Â
           <cfsavecontent variable="tabTwo">
                 <script language="JavaScript" type="text/javascript">
                      function jsPositiveNumber(theItem,m
                            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.
                                 form.blnItemListingImage.c
                                 form.blnItemDetailImage.ch
                            }
                            if (form.blnCategoryListing.c
                                 if (form.blnCategoryPaginatio
                                       return false;
                                 }                                 Â
                                 if (form.blnCategoryImage.che
                                            (!jsPositiveNumber(form.in
                                       return false;
                                 }
                            }
                            if (form.blnItemListingDescri
                                 return false;
                            }
                            if (form.blnItemListingPagina
                                 return false;
                            }
                            if (form.blnItemListingImage.
                                 (!jsPositiveNumber(form.in
                                 return false;
                            }
                            if (form.blnItemDetailResourc
                                 jsTabSwitch(4);
                                 alert('Related information caption is required.');
                                 return false;
                            }
                            if (form.blnItemDetailImage.c
                                       (!jsPositiveNumber(form.in
                                 return false;
                            }
                            if (form.blnNotification.chec
                                 if (!form.txtNotificationFrom
                                       jsTabSwitch(5);
                                       alert('From Email is required.');
                                       return false;
                                 }
                                 if (!form.txtNotificationSubj
                                       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.onbeforeunlo
                            }
                            return valid;
                      }
                      document.frmAddEdit.onsubm
                 </script>
                Â
                 <cfoutput>
                      <div id="blnCategoryListing"></
                      <div id="blnCategoryPageContent
                      <div id="blnCategoryDescription
                      <div id="blnCategorySearch"></d
                      <div id="blnCategoryPagination"
                      <div id="blnCategoryPagination"
                      <div id="blnCategoryImage"></di
                      <div id="intCategoryDisplayItem
                      <div id="intCategoryImageWidth"
                      <div id="intCategoryImageHeight
                      <div id="intCategoryImageAlign"
                      <div id="blnCategoryImageWrap">
                      <div id="intCategoryLayoutType"
                     Â
                      <div style="padding:10px;" class="formCaption">
                            <fieldset>
                                 <legend><input type="checkBox" name="blnCategoryListing" <cfif qryConfig.blnCategoryListi
                                 <table width="100%" cellspacing="0" cellpadding="7" border="0">
                                       <tr>
                                            <td class="formCaption">
                                                  <input type="checkbox" name="blnCategoryPageConte
                                                  <input type="checkbox" name="blnCategoryDescripti
                                                  <input type="checkbox" name="blnCategorySearch" <cfif qryConfig.blnCategorySearc
                                            </td>
                                       </tr>
                                       <tr>
                                            <td>
                                                  <fieldset>
                                                       <legend><input type="checkbox" name="blnCategoryPaginatio
                                                       <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                             <tr>
                                                                  <td class="formCaption"><input
                                                             </tr>
                                                       </table>                                      Â
                                                  </fieldset>
                                            </td>                                            Â
                                       </tr>
                                       <tr>
                                            <td>
                                                  <fieldset>
                                                       <legend><input type="checkbox" name="blnCategoryImage" <cfif qryConfig.blnCategoryImage
                                                       <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                             <tr>
                                                                  <td class="formCaption">
                                                                        Width: <input type="text" name="intCategoryImageWidt
                                                                        Height: <input type="text" name="intCategoryImageHeig
                                                                  </td>
                                                                  <td class="formCaption">
                                                                        <input type="checkbox" name="blnCategoryImageWrap
                                                                  </td>
                                                             </tr>
                                                             <tr>
                                                                  <td class="formCaption" colspan="2">
                                                                        Align: <input type="radio" name="intCategoryImageAlig
                                                                        <input type="radio" name="intCategoryImageAlig
                                                                        <input type="radio" name="intCategoryImageAlig
                                                                  </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="intCategoryLayoutTyp
                                                                        <input type="radio" name="intCategoryLayoutTyp
                                                                  </td>
                                                             </tr>
                                                       </table>
                                                  </fieldset>
                                            </td>
                                       </tr>
                                 </table>
                            </fieldset>
                      </div>
                 </cfoutput>     Â
           </cfsavecontent>
           <cfset this.configData.tabs[2].bo
          Â
           <cfsavecontent variable="tabThree">
                 <cfoutput>
                 <div id="blnItemListingPageCont
                 <div id="blnItemListingTitle"><
                 <div id="intItemListingDateLayo
                 <div id="blnItemListingDescript
                 <div id="intItemListingDescript
                 <div id="intItemListingDescript
                 <div id="blnItemListingSearch">
                 <div id="blnItemListingAnchor">
                 <div id="blnItemListingImage"><
                 <div id="intItemListingImageAli
                 <div id="intItemListingLayoutTy
                 <div id="blnItemListingImageWra
                 <div id="intItemListingImageWid
                 <div id="intItemListingImageHei
                 <div id="blnItemListingPaginati
                 <div id="intItemListingDisplayI
                 <div id="txtItemListingDescript
                Â
                 <div style="padding:10px;" class="formCaption">
                      <fieldset>
                            <table width="100%" cellspacing="0" cellpadding="7" border="0">
                                 <tr>
                                       <td class="formCaption">
                                            <input type="checkbox" name="blnItemListingPageCo
                                            <input type="checkbox" name="blnItemListingSearch
                                            <input type="checkbox" name="blnItemListingAnchor
                                            <input type="checkbox" name="blnItemListingTitle"
                                       </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="intItemListingDateLa
                                                                  <input type="radio" name="intItemListingDateLa
                                                             </td>
                                                       </tr>
                                                  </table>
                                            </fieldset>
                                       </td>
                                 </tr>
                                 <tr>
                                       <td>
                                            <fieldset>
                                                  <legend><input type="checkbox" name="blnItemListingDescri
                                                  <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                       <tr>
                                                             <td class="formCaption">Displa
                                                             <td class="formCaption" colspan="3">
                                                                  <input type="radio" name="intItemListingDescri
                                                             </td>
                                                       </tr>
                                                       <tr>
                                                             <td class="formCaption">
                                                             <td class="formCaption" colspan="3">                                                            Â
                                                                  <input type="radio" name="intItemListingDescri
                                                             </td>
                                                       </tr>
                                                             <td> </td>                                                                  Â
                                                             <td class="formCaption">
                                                                  <input type="radio" name="intItemListingDescri
                                                             </td>
                                                             <td class="formCaption">
                                                                  Length: <input type="text" name="intItemListingDescri
                                                             </td>
                                                             <td class="formCaption">
                                                                  Action: <input type="text" name="txtItemListingDescri
                                                             </td>
                                                       </tr>
                                                  </table>                                      Â
                                            </fieldset>
                                       </td>                                            Â
                                 </tr>
                                 <tr>
                                       <td>
                                            <fieldset>
                                                  <legend><input type="checkbox" name="blnItemListingPagina
                                                  <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                       <tr>
                                                             <td class="formCaption"><input
                                                       </tr>
                                                  </table>                                      Â
                                            </fieldset>
                                       </td>                                            Â
                                 </tr>
                                 <tr>
                                       <td>
                                            <fieldset>
                                                  <legend><input type="checkbox" name="blnItemListingImage"
                                                  <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                       <tr>
                                                             <td class="formCaption">
                                                                  Width: <input type="text" name="intItemListingImageW
                                                                  Height: <input type="text" name="intItemListingImageH
                                                             </td>
                                                             <td class="formCaption">
                                                                  <input type="checkbox" name="blnItemListingImageW
                                                             </td>
                                                       </tr>
                                                       <tr>
                                                             <td class="formCaption" colspan="2">
                                                                  Align <input type="radio" name="intItemListingImageA
                                                                  <input type="radio" name="intItemListingImageA
                                                                  <input type="radio" name="intItemListingImageA
                                                             </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="intItemListingLayout
                                                                  <input type="radio" name="intItemListingLayout
                                                             </td>
                                                       </tr>
                                                  </table>
                                            </fieldset>
                                       </td>
                                 </tr>
                            </table>
                      </fieldset>
                 </div>                Â
                 </cfoutput>     Â
           </cfsavecontent>
           <cfset this.configData.tabs[3].bo
          Â
           <cfsavecontent variable="tabFour">
                 <cfoutput>
                      <div id="blnItemDetail"></div>
                      <div id="blnItemDetailPageConte
                      <div id="blnItemDetailResource"
                      <div id="txtItemDetailResourceC
                      <div id="blnItemDetailImage"></
                      <div id="intItemDetailImageWidt
                      <div id="intItemDetailImageHeig
                      <div id="intItemDetailImageAlig
                     Â
                      <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">
                                                  <input type="checkbox" name="blnItemDetailPageCon
                                            </td>
                                       </tr>
                                       <tr>
                                            <td>
                                                  <fieldset>
                                                       <legend><input type="checkbox" name="blnItemDetailResourc
                                                       <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                             <tr>
                                                                  <td class="formCaption">Captio
                                                             </tr>
                                                       </table>                                      Â
                                                  </fieldset>
                                            </td>                                            Â
                                       </tr>
                                       <tr>
                                            <td>
                                                  <fieldset>
                                                       <legend><input type="checkbox" name="blnItemDetailImage" <cfif qryConfig.blnItemDetailIma
                                                       <table width="100%" cellspacing="0" cellpadding="5" border="0">
                                                             <tr>
                                                                  <td class="formCaption">
                                                                        Width: <input type="text" name="intItemDetailImageWi
                                                                        Height: <input type="text" name="intItemDetailImageHe
                                                                  </td>
                                                                  <td class="formCaption">
                                                                        Align <input type="radio" name="intItemDetailImageAl
                                                                        <input type="radio" name="intItemDetailImageAl
                                                                        <input type="radio" name="intItemDetailImageAl
                                                                  </td>
                                                             </tr>
                                                       </table>
                                                  </fieldset>
                                            </td>
                                       </tr>
                                       <tr>
                                            <td> </td>
                                       </tr>
                                 </table>
                            </fieldset>
                      </div>                Â
                 </cfoutput>     Â
           </cfsavecontent>
           <cfset this.configData.tabs[4].bo
          Â
           <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">*</spa
                                                  <input type="text" name="txtNotificationFromE
                                            </td>
                                            <td class="formCaption">From Name:<br />
                                                  <input type="text" name="txtNotificationFromN
                                            </td>
                                       </tr>
                                       <tr>
                                            <td class="formCaption">Notifi
                                                  <input type="text" name="txtNotificationSubje
                                            </td>
                                            <td> </td>
                                       </tr>
                                 </table>
                            </fieldset>
                      </div>     Â
                 </cfoutput>           Â
           </cfsavecontent>
           <cfset this.configData.tabs[5].bo
          Â
           <!--- extranet role stuff --->
           <cfset this.extranet = getObject("hb50.extranet",
           <cfset qryRoles = this.extranet.getRoleQuery
          Â
           <cfset selectedRoles = getListRoles()>
          Â
           <cfsavecontent variable="tabSeven">
                 <cfoutput>
                 <div id="blnSecurityEnabled"></
                 <div style="padding:10px;" class="formCaption">
                      <fieldset>
                            <legend><input type="checkBox" name="blnSecurityEnabled" <cfif qryConfig.blnSecurityEnabl
                            <table width="100%" cellspacing="0" cellpadding="7" border="0">
                                 <tr>
                                       <td class="formCaption">Access
                                            <select name="intRoleIDs" style="width:235px;height:
                                                  <cfloop query="qryRoles">
                                                       <option value="#qryRoles.intRoleID
                                                  </cfloop>
                                            </select>
                                       </td>
                                 </tr>
                            </table>
                      </fieldset>
                 </div>     Â
                 </cfoutput>
           </cfsavecontent>
           <cfset this.configData.tabs[7].bo
                     Â
           <cfif qryConfig.recordCount>
                 <cfset URL.id = qryConfig.intID>
           </cfif>
           <cfsavecontent variable="jsHack">
                 <script>
                 document.getElementById('i
                 document.getElementById('i
                 document.getElementById('i
                 document.getElementById('i
                 </script>
           </cfsavecontent>
          Â
           <cfreturn this.display.getAddEdit(th
      </cffunction>
      <!--- /getConfigBackEnd --->
          Â
      <cffunction name="install" access="public" returntype="struct">
           <cfset var returnStruct = StructNew()>
          Â
           <cfif isDefined("this.formData")
                 <cfset this.workflow.verifyColumn
                 <cfif StructKeyExists(this.formD
                      <cfset returnStruct.itemTable = this.formData.tablename>
                 </cfif>
           </cfif>
           <cfif isDefined("this.catData")>
                 <cfset this.workflow.verifyColumn
                 <cfif StructKeyExists(this.catDa
                      <cfset returnStruct.categoryTable
                 </cfif>
           </cfif>
                     Â
           <cfset this.workflow.verifyColumn
           <cfset this.workflow.verifyColumn
           <cfset this.workflow.verifyColumn
          Â
           <cfreturn returnStruct>
      </cffunction>
      <!--- Donny: needed by "hb50\popups\rte\insertlin
      <cffunction name="getPublicQuery" access="public" returntype="query">     Â
           <cfif (this.datatype is this.DATATYPES.CATEGORY)>
                 <cfreturn this.workflow.getPublicQue
           <cfelse>
                 <cfreturn this.workflow.getPublicQue
           </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
                            <cfset infoList = ''>                                                                                        Â
                            <cfif qryConfig.blnDate is 1 AND isDefined("scope.dtDate") AND isDate(scope.dtDate)><cfse
                            <cfif qryConfig.blnAddress is 1>
                                 <cfset addressLine = ''>
                                 <cfif  isDefined("scope.txtAddres
                                 <cfif isDefined("scope.txtCity")
                                 <cfif isDefined("scope.txtProvin
                                 <cfif isDefined("scope.txtPostal
                                 <cfif isDefined("scope.txtCountr
                                 <cfif Len(Trim(addressLine))><cf
                            </cfif>
                            <cfif qryConfig.blnPhone is 1 and isDefined("scope.txtPhone"
                            <cfif qryConfig.blnFax is 1 and isDefined("scope.txtFax") AND Len(Trim(scope.txtFax))><c
                            <cfif qryConfig.blnPhone is 1 and isDefined("scope.txtTollFr
                            <cfif qryConfig.blnEmail is 1 and isDefined("scope.txtEmail"
                            <cfif qryConfig.blnLink is 1 and isDefined("scope.txtLink")
                                 <cfif REFindNoCase("http[s]://",
                                       <cfset txtItemLink = scope.txtLink>
                                 <cfelse>
                                       <cfset txtItemLink = "http://#scope.txtLink#">
                                 </cfif>
                                 <cfset infoList = infoList & '<li><a href="#txtItemLink#" target="_blank">#scope.txt
                            </cfif>
                            <cfif Len(Trim(infoList))>
                                 <ul>
                                       #infoList#                                                 Â
                                 </ul>
                            </cfif>
                            <cfif qryConfig.blnImage is 1 and qryConfig.blnItemDetailIma
                      <p>#this.workflow.convertT
                            <!---  <!--- not support yet --->
                            <cfif qryConfig.blnResource is 1>
                                 <cfset addlResources = this.media.getPreviewAddit
                                 <cfif ArrayLen(addlResources)>
                                 <br/>
                                 <strong>#qryConfig.txtItem
                                 <ul>
                                       <cfloop from="1" to="#ArrayLen(addlResource
                                            <li><a href="#addlResources[i].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(
           <!--- back up form --->
           <cfset formCopy = duplicate(FORM)>
           <cfset FORM.txtTitle = FORM.intCategoryID_add_tit
           <cfset FORM.txtDescription = "">
           <cfset FORM.txtMetaDescription = "">
           <cfset FORM.txtMetaKeywords = "">
           <cfset StructDelete(FORM, "id")>
           <cfset this.workflow.doAction(SES
           <!--- 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.compa
     Â
                 this.workflow = getObject("hb50.workflow",
                 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=optio
           <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.pagi
           <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=#
           <cfif not isQuery(formData.query)>
                 <cfset formData.query = this.workflow.getQuery(for
           </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.
           <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(
                            <div id="paginationSelect" style="position:absolute; left:64px; top:-2px; width:15px; height:15px; z-index:20"><a href="##" onclick="P7_autoLayers(4,'
                            <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#&sorto
                                       <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</optio
                                       <option value="250"<cfif URL.pagination is 250> selected</cfif>>250</optio
                                       <option value="500"<cfif URL.pagination is 500> selected</cfif>>500</optio
                                 </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("Tot
                      </div>
     Â
                      <cfsavecontent variable="buttons">
                            <form action="#arguments.linkURL
                                 <input type="hidden" name="id" id="edit_id" value="">
                                 <input type="hidden" name="mode" value="edit">
                                 <cfloop from="1" to="#ArrayLen(formData.lis
                                       <cfif not StructKeyExists(formData.l
                                            <cfset formData.listbuttons[i].wi
                                       </cfif>
                                       <input name="addbutton" type="submit" class="buttons" value="#translate(formData
                                            <cfif StructKeyExists(formData.l
                                                  onClick="#formData.listbut
                                            </cfif>
                                       />
                                 </cfloop>
                                 <cfif formData.blnAdd>
                                       <input name="addbutton" type="submit" class="buttons" value="#translate("Add #formData.itemname#")#"
                                       onClick="this.form.id.valu
                                 </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.c
                                                  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:##
                       <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.print
                                            <cfelse>
                                                  <a href="#arguments.linkURL#<
                                                  <cfif URL.order is "title">
                                                       <cfif URL.sortorder is "asc">
                                                             <img src="images/btn_move_up.gi
                                                       <cfelse>
                                                             <img src="images/btn_move_down.
                                                       </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.li
                                                             <div align="right">
                                                                  <cfif SR gt 1>
                                                                        <a href="#Left(arguments.link
                                                                  </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.record
                                                                  <cfif SR lte qryRecords.recordcount - URL.pagination>
                                                                        <a href="#Left(arguments.link
                                                                  </cfif>
                                                             </div>
                                                       </form>
                                                  </div>
                                            </cfif>
                                       </td>
                                 <td width="120" class="toolHeader">
                                            <cfif arguments.linkURL is "">#translate(arguments.ex
                                       </td>
                          </tr>
                            </table>
                      </div>
                 </cfoutput>
                Â
                 <script>
                      function setEditID(id) {
                            var lastID = document.getElementById('e
                            var lastRow = document.getElementById('r
                            if (lastRow)
                                 lastRow.style.background = '#FFFFFF';
                            var lastRow = document.getElementById('r
                            if (lastRow)
                                 lastRow.style.background = '#FFFFFF';
                            var lastRow = document.getElementById('r
                            if (lastRow)
                                 lastRow.style.background = '#FFFFFF';
                                Â
                            document.getElementById('e
                            document.getElementById('r
                            document.getElementById('r
                            document.getElementById('r
                      }
                 </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:#E
                            <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"> <
                                  <td width="120" class="toolHeader"> <
                            </tr>
                            <cfoutput query="qryRecords" startrow="#SR#" maxrows="#URL.pagination#"
                                 <cfset recordID = qryRecords[idColumn]>
                                 <cfset title = qryRecords[arguments.print
                                 <cfif Len(arguments.extraColumn)
                                       <cfset extraValue = qryRecords[arguments.extra
                                 <cfelse>
                                       <cfset extraValue = "">
                                 </cfif>
                                  <cfif isDefined("arguments.linkC
                                       <cfset link = qryRecords[arguments.linkC
                                 <cfelse>
                                       <cfsavecontent variable="link">#arguments
                                 </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.linkT
                                 <cfif isDate(extraValue)>
                                       <cftry>
                                            <cfset extraValue = '#LSDateFormat(extraValue,
                                            <cfcatch></cfcatch>
                                       </cftry>
                                 </cfif>
                                 <tr>
                                       <td height="21" class="toolList" id="row1_#recordID#" onclick="javascript:setEdi
                                       <td class="toolList" id="row2_#recordID#" onclick="javascript:setEdi
                                       <td class="toolList" id="row3_#recordID#" onclick="javascript:setEdi
                                 </tr>
                            </cfoutput>
                            <cfif not qryRecords.recordcount>
                                 <cfoutput>
                                 <tr>
                                       <td height="20" bgcolor="##FFFFFF" align="center" valign="center" style="cursor:none;"> 
                                       <td bgcolor="##FFFFFF" class="formCaption" style="padding:5px;">#tran
                                       <td bgcolor="##FFFFFF"> <
                                 </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
                            <input type="text" id="searchKeywords" name="keywords" class="searchBox" value="#HTMLEditFormat(URL
                            <cfif formData.blnStatus>
                                 <select name="statusID" class="searchSelect" onChange='this.form.submit
                                       <option value="0" selected>#translate("Statu
                                       <option value="#this.workflow.STAT
                                 <cfif formData.blnScheduling>
                                       <option value="#this.workflow.STAT
                                       <option value="#this.workflow.STAT
                                 </cfif>
                                 <cfif formData.blnLock>
                                       <option value="#this.workflow.STAT
                                 </cfif>
                                 <cfif formData.blnApproval>
                                       <option value="#this.workflow.STAT
                                 </cfif>
                                 <cfif formData.blnRestore and formData.blnDelete and SESSION.blnRestore>
                                       <option value="#this.workflow.STAT
                                 </cfif>
                                 </select>
                            </cfif>
                            <cfif formData.blnCategory>
                                 <cfparam name="URL.catID" default="0">
                                 <cfset category = createObject("component", "hb50.category").init(this
                                 <cfset qryCategory = category.getCategories(for
                                 <select name="catID" class="searchSelect" onChange='this.form.submit
                                       <cfif StructKeyExists(formData, 'categoryname')>
                                            <option value="0" selected>#formData.categor
                                       <cfelse>
                                            <option value="0" selected>#translate("Categ
                                       </cfif>
                                       <cfloop query="qryCategory">
                                            <option value="#qryCategory.intID#
                                       </cfloop>
                                 </select>
                            </cfif>
                            <input type="submit" name="Submit" value="#translate("SEARCH"
                      </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.printColu
                            FROM       qryRecords
                            ORDER BY sortPrintColumn <cfif isDefined("URL.sortorder")
                      </cfquery>
                 <cfelseif URL.order is "date">
                      <cfquery name="qryRecords" dbtype="query">
                            SELECT       *
                            FROM       qryRecords
                            ORDER BY #arguments.extraColumn# <cfif isDefined("URL.sortorder")
                      </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.
                      AND      intCategoryID = #arguments.catID#
                 </cfif>
                 <cfif ListFindNoCase(qryRecords.
                      <cfif Val(statusID)>
                            AND intStatusID = #Val(arguments.statusID)#
                      <cfelse>
                            AND intStatusID != #this.workflow.STATUS.DELE
                      </cfif>
                 </cfif>
                 <cfif ListLen(keywords, " ")>
                      AND (1 = 2
                            <cfloop list="#arguments.keywords#
                                 OR LOWER(#arguments.printColu
                            </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.
                 <cfset status = qryRecords.intStatusID>
                Â
                 <cfif status is this.workflow.STATUS.ACTIV
                      <cfreturn '<img src="images/btn_active.gif
                 <cfelseif status is this.workflow.STATUS.INACT
                      <cfreturn '<img src="images/btn_unactive.g
                 <cfelseif status is this.workflow.STATUS.DELET
                      <cfreturn '<img src="images/btn_deleted.gi
                 <cfelseif status is this.workflow.STATUS.UNAPP
                      <cfreturn '<img src="images/btn_approval.g
                 <cfelseif status is this.workflow.STATUS.UNTRA
                      <cfreturn '<img src="images/btn_translate.
                 <cfelseif status is this.workflow.STATUS.UNSHA
                      <cfreturn '<img src="images/btn_notshared.
                 <cfelseif status is this.workflow.STATUS.CLONE
                      <cfreturn '<img src="images/btn_cloned.gif
                 <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
                     Â
                      <cfif selectFrom(qryLockUsers, "intUserID", SESSION.userid).recordcoun
                            <cfreturn '<img src="images/btn_extranet.g
                      </cfif>
                      <cfif qryLockUsers.recordcount is 1>
                            <cfif not isDefined("this.access")>
                                 <cfset this.access = createObject("component", "hb50.access").init(this.C
                            </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(qr
                                 <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.PENDI
                      <cfif StructKeyExists(qryRecords
                            <cfreturn '<img src="images/btn_pending.gi
                      <cfelse>
                            <cfreturn '<img src="images/btn_pending.gi
                      </cfif>
                 <cfelseif status is this.workflow.STATUS.EXPIR
                      <cfif StructKeyExists(qryRecords
                            <cfreturn '<img src="images/btn_expired.gi
                      <cfelse>
                            <cfreturn '<img src="images/btn_expired.gi
                      </cfif>
                 <cfelse>
                      <cfreturn ' ' />
                 </cfif>
          Â
           <!--- Jason: hack to display the link validation status icon (DAM) --->     Â
           <cfelseif ListFindNoCase(qryRecords.
                 <cfif Val(qryRecords.blnValidate
                      <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"
                 </cfif>
           </cfif>
           <cfreturn " " />
      </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#</cf
                 </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#</c
                 </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#</cfou
                      <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
                 if (SR gte arguments.RecordsToDisplay
                      output.prev = SR - arguments.RecordsToDisplay
                 if ((SR + arguments.RecordsToDisplay
                      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
           <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
                 <cfreturn '' />
           </cfif>
           <cfset pag = getPagination(arguments.Re
           <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
                                 <cfloop from="#pag.startPage#" to="#pag.endPage#" index="num">
                                       <cfset startrow = (num-1) * arguments.RecordsToDisplay
                                       <cfif startrow is arguments.SR>
                                            <li>#num#</li>
                                       <cfelse>
                                            <li><a href="#page#SR=#startrow#"
                                       </cfif>
                                 </cfloop>
                                 <li><a <cfif pag.next>href="#page#SR=#p
                            </ul>
                            <p>#SR#-#Min(arguments.SR + arguments.RecordsToDisplay
                      </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.maxTa
                      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.col
                      <cfif ListFind("#TYPES.HTML#,#TY
                            <cfset y = StructNew()>
                            <cfset y.caption = formData.columns[key].titl
                            <cfset y.columnlist = formData.columns[key].varn
                            <cfset ArrayAppend(htmltabs, y)>
                      <cfelse>
                            <cfset x.columnlist = ListAppend(x.columnlist, formData.columns[key].varn
                      </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
                      <div class="txtMetaName"><input
                      <div class="txtMetaValue"><inpu
                 </cfsavecontent>
                 <cfsavecontent variable="httpHeader">
                      <table class="tableOutline" border="0" cellspacing="1" cellpadding="0">
                             <tr>
                                  <td width="150" height="21" class="toolHeader">HTTP-Eq
                                  <td width="377" class="toolHeader">Content
                             </tr>
                      </table>
                 </cfsavecontent>
                 <cfsavecontent variable="nameHeader">
                      <table class="tableOutline" border="0" cellspacing="1" cellpadding="0">
                             <tr>
                                  <td width="50" height="21" class="toolHeader">Type</t
                                  <td width="130" height="21" class="toolHeader">Name</t
                                  <td width="347" class="toolHeader">Content
                             </tr>
                      </table>
                 </cfsavecontent>
                Â
                 <cfscript>
                      listMode = '<div class="txtMetaType">,</div
                                      Â
                      x = StructNew();
                      x.varname = "txtNameValues";
                      x.title = "Advanced Meta";
                      x.type = TYPES.LIST;
                      x.collist = 'txtMetaType,txtMetaName,t
                     Â
                      x.headerText = nameHeader;
                      x.editHTML = editForm;
                      x.listHTML = listMode;
                      x.required = false;
                      x.display = false;
                      ArrayAppend(formData.colum
     Â
                      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">
                                                  <td class="tabsml#tabstyle#c">
                                                  <td class="tabsml#tabstyle#r">
                                            </cfloop>
                                            <cfif size LT ArrayLen(tabs)>
                                                  <td><img src="images/shim.gif" width="11" height="15"></td>
                                                  <td valign="top"><a onclick="jsTabSwitch(#size
                                                  <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
                                                  <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">
                                                  <td class="tabsml#tabstyle#c">
                                                  <td class="tabsml#tabstyle#r">
                                            </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].bod
                      </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.onbeforeunlo
                                 P7_autoLayers(4,'edit' + tab,'edit','innerTab' + tab);
                                 <cfloop from="1" to="#ArrayLen(tabs)#" index="j">
                                       if (tab == #j#) {
                                            <cfloop list="#tabs[j].columnlist#
                                                  if (document.getElementById('
                                                       document.getElementById('#
                                                  }
                                            </cfloop>
                                            <cfloop from="1" to="#ArrayLen(formData.col
                                                  <cfset i = formData.columns[key]>
          Â
                                                  <cfif ListFindNoCase(tabs[j].col
                                                       turnEditOn_#i.varname# ()
                                                  </cfif>
          Â
                                                  <cfif not ListFindNoCase(tabs[j].col
                                                       if (document.getElementById('
                                                             document.getElementById('#
                                                       }
                                                  </cfif>
                                            </cfloop>
                                       }
                                 </cfloop>
                                Â
                                 switch(tabList[tab].toLowe
                                       case 'overview':
                                            document.getElementById('s
                                            break;
                                       case 'extranet':
                                            document.getElementById('s
                                            break;
                                       case 'sharing':
                                            document.getElementById('s
                                            break;
                                       case 'workflow':
                                            document.getElementById('s
                                            break;
                                       case 'conversion':
                                            document.getElementById('s
                                            break;
                                       case 'campaign':
                                            document.getElementById('s
                                            break;
                                       case 'blog':
                                            document.getElementById('s
                                            break;
                                       case 'webtrends®':
                                            document.getElementById('s
                                            break;
                                       case 'google sitemaps':
                                            document.getElementById('s
                                            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#',
                            </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.Co
                 <cfsavecontent variable="output">
                      <img src="images/shim.gif" height="13" width="1" alt="">
                      <div align="center">
                            <cfoutput>
                                 <cfif isDefined("qryData.intReso
                                       #media.getAdditionalResour
                                 <cfelse>
                                       #media.getAdditionalResour
                                 </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.datasour
                                 <cfprocparam cfsqltype="cf_sql_integer"
                                 <cfprocresult name="qryMeta">
                            </cfstoredproc>
     Â
                            <cfif not(isDefined("URL.id") and Val(URL.id) and isDefined("FORM.intVersion
                                 <!--- Donny: for global metatag in Admin. > Website Control > Meta Data --->
                                 <cfquery name="qryData" datasource="#this.datasour
                                       SELECT       txtMetaKeywords, txtMetaDescription
                                       FROM       tblCompany
                                       WHERE       intCompanyID = #Val(this.companyID)#
                                 </cfquery>
                            </cfif>
     Â
                            <cfset blnInherit = ((not isDefined("qryData.txtMeta
     Â
                            <script>
                                 function jsMetaDisable(form, checked) {
                                       form.txtMetaKeywords.disab
                                       form.txtMetaDescription.di
                                      Â
                                       if (checked){
                                            form.btnDelete_txtNameValu
                                            form.btnMetaTag_txtNameVal
                                       } else {
                                            form.btnDelete_txtNameValu
                                            form.btnMetaTag_txtNameVal
                                       }
                                 }
     Â
                                 <cfif (not blnInherit)>
                                       document.frmAddEdit.btnDel
                                       document.frmAddEdit.btnMet
                                 </cfif>
                                Â
                                 onclick="jsMetaDisable(thi
                            </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(thi
                                 #this.language.translate("
                                 #this.language.translate("
                                 <br />
                                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                       <tr>
                                            <td width="50%">
                                                  <font class="formCaption">#trans
                                                  <textarea style="width: 240px; height: 130px;" class="formTextarea" name="txtMetaKeywords"<cfi
                                            </td>
                                            <td width="50%">
                                                  <font class="formCaption">#trans
                                                  <textarea style="width: 240px; height: 130px;" class="formTextarea" name="txtMetaDescription"<
                                            </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").
                 <cfsavecontent variable="output">
                      <cfoutput>
                            <cfif isDefined('URL.id') and Val(URL.id)>
                                 #contentcontainer.getConte
                            <cfelse>
                                 #contentcontainer.getConte
                            </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.C
                 <cfsavecontent variable="output">
                      <cfoutput>
                            <cfif isDefined('URL.id') and Val(URL.id)>
                                 #tagMgr.getTaggingForm("ta
                            <cfelse>
                                 #tagMgr.getTaggingForm("ta
                            </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"></sc
                            <!--- 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
                                       <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
                                       </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(
                                                            Â
                                                             // Handle all the the FSCommand messages in a Flash movie. Uncomment
                                                             function dtStartflash_DoFSCommand(c
                                                             {
                                                                  //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('d
                                                             }
                                                             // Hook for Internet Explorer
                                                             if (navigator.appName && navigator.appName.indexOf(
                                                                   navigator.userAgent.indexO
                                                             {
                                                                  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                                                  document.write('on error resume next \n');
                                                                  document.write('Sub dtStartflash_FSCommand(ByV
                                                                  document.write('  call dtStartflash_DoFSCommand(c
                                                                  document.write('end sub\n');
                                                                  document.write('</SCRIPT\>
                                                             }     Â
                                                         var so = new SWFObject("flash/weekview.
                                                         so.addVariable("day","#Day
                                                         so.addVariable("month","#M
                                                         so.addVariable("year","#Ye
                                                         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")
                                       <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")
                                       </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(
                                                            Â
                                                             // Handle all the the FSCommand messages in a Flash movie
                                                             function dtEndflash_DoFSCommand(com
                                                             {
                                                                  //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('d
                                                             }
                                                             // Hook for Internet Explorer
                                                             if (navigator.appName && navigator.appName.indexOf(
                                                                   navigator.userAgent.indexO
                                                             {
                                                                  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                                                  document.write('on error resume next \n');
                                                                  document.write('Sub dtEndflash_FSCommand(ByVal
                                                                  document.write('  call dtEndflash_DoFSCommand(com
                                                                  document.write('end sub\n');
                                                                  document.write('</SCRIPT\>
                                                             }
                                                         var so = new SWFObject("flash/weekview.
                                                         so.addVariable("day","#Day
                                                         so.addVariable("month","#M
                                                         so.addVariable("year","#Ye
                                                         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.col
                            <cfset i = formData.columns[key]>
                           Â
                            <cfif (not isDefined("columnNames")) or ListFindNoCase(columnNames
                                 <!--- display all the non-html first (and assume HTML only shows up at end) --->
                                 <cfif not ListFind("#TYPES.HTML#,#TY
                                        <cfif count mod 2 is 1>
                                            <tr>
                                        </cfif>
                                       <td width="50%" valign="<cfif i.type is TYPES.BOOLEAN>bottom<cfels
                                            <cfif isDefined("qryData")>
                                                  #getFormItemDisplay(formDa
                                            <cfelse>
                                                  #getFormItemDisplay(formDa
                                            </cfif>
                                       </td>
                                        <cfif count mod 2 is 0>
                                            </tr>
                                        </cfif>
                                        <cfset count = count + 1>
                                  </cfif>
                             </cfif>
                      </cfloop>
                      <cfif count mod 2 is 0>
                            <td> </td></tr>
                      </cfif>
          Â
                      <!--- display the types that require a full tab --->
                      <cfloop from="1" to="#ArrayLen(formData.col
                            <cfset i = formData.columns[key]>
                            <cfif (not isDefined("columnNames")) or ListFindNoCase(columnNames
                                 <cfif ListFind("#TYPES.HTML#,#TY
                                       <!--- display only html --->
                                       <tr>
                                            <td colspan="2" valign="top">
                                            <cfif isDefined("qryData")>
                                                  #getFormItemDisplay(formDa
                                            <cfelse>
                                                  #getFormItemDisplay(formDa
                                            </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.col
                            <cfset i = formData.columns[key]>
                            <cfif i.type is TYPES.TYPE and ((not isDefined("columnNames")) or ListFindNoCase(columnNames
                                 <script language="JavaScript">
                                       function hideAllForm() {
                                            <cfloop from="1" to="#ArrayLen(formData.col
                                                  <cfset k = formData.columns[key]>
                                                  <cfif k.type neq TYPES.TYPE>
                                                       document.getElementById('#
                                                  </cfif>
                                            </cfloop>
                                       }
                                       function changeType() {
                                            var type = document.getElementById('#
                                            hideAllForm();
                                            <cfloop from="1" to="#ArrayLen(i.options)#"
                                                  if (type == #i.options[k].value#) {
                                                       <cfloop list="#i.options[k].fields
                                                             document.getElementById('#
                                                       </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.dt
                      </cfif>
                      <option value="#qryVersion.intID#"
                 </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 id="versionsSelect" style="position:absolute; left:130px; top:-2px; width:15px; height:15px; z-index:6"><a onmouseover="this.style.cu
                            <div id="versionList" style="position:absolute; left:-1px; top:-99px; width:141px; height:102px; z-index:6; visibility: hidden;">
                                 <form name="#arguments.formName#
                                       <select class="selectSmall" style="width:147; visibility: hidden;" id="intVersionID" name="intVersionID" size="7" onChange='this.blur(); this.form.submit();' onblur="document.getElemen
                                            #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.datasour
                 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.recordCoun
                 <cfreturn "" />
           </cfif>
           <cfset currentVersion = translate("Original")>
           <cfset selectedIndex = 0>
           <cfsavecontent variable="options">
                 <cfoutput><option value="#qryTranslations.in
                 <cfoutput query="qryTranslations">
                      <option value="#intTranslateID#" <cfif intTranslateID is id>selected</cfif>>#txtTit
                      <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
                                 showModelessDialog('popup.
                            }
                      </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 id="languagesSelect" style="position:absolute; left:130px; top:-2px; width:15px; height:15px; z-index:6"><a onmouseover="this.style.cu
                            <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.v
                                       #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.newSu
                 <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.action
           <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">
           <!--- if there is an action msg, refresh the treenav --->
           <cfif this.treenavrefresh>
                 <cfset status = status & '<script>resetSideNav(#thi
           </cfif>
          Â
           <cfreturn status />
      </cffunction>
      <cffunction name="getStyles" access="public" output="false">
           <cfargument name="blnInclElement" required="false" type="boolean" default="false" />
          Â
           <cfset var styles = '' />
          Â
           <cfsavecontent variable="styles">
                 <cfoutput>
                      <cfif arguments.blnInclElement>
                            <style type="text/css" id="cssCustomStyles">
                      </cfif>
                      <!--
                            #getStyleRules()#
                      -->
                      <cfif arguments.blnInclElement>
                            </style>
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn styles />
      </cffunction>
      <cffunction name="getStyleRules" access="public" output="false">
           <cfquery name="qryStyles" datasource="#this.datasour
                 SELECT       *
                 FROM       tblStyles
                 WHERE       intCompanyID = #this.CompanyID#
                 AND       blnDeleted = 0
           </cfquery>
          Â
           <cfsavecontent variable="rules">
                 <cfoutput>
                      <cfloop query="qryStyles">
                            .customStyle#intID# { font-size: #intSize##txtSizePtPx#; font-family: #txtFont#; color: <cfif ListLen(txtColor,'12345678
                            <cfif Len(txtLinkColor)>
                                 .customStyle#intID# a:link { color: <cfif ListLen(txtLinkColor,'1234
                                 .customStyle#intID# a:hover { color: <cfif ListLen(txtLinkColor,'1234
                                 .customStyle#intID# a:active { color: <cfif ListLen(txtLinkColor,'1234
                            </cfif>
                            <cfif Len(txtVisitedLinkColor)>
                                 .customStyle#intID# a:visited { color: <cfif ListLen(txtVisitedLinkColo
                            </cfif>
                      </cfloop>
                      table { font-size: 1.0em; }
                      .tableNoBorder { font-size: 1.0em; border: 0; }
     Â
                      table.tableSingleBorder { border: 1px solid ##000000; }
                      table.tableSingleBorder td { border: 1px solid ##000000; }
     Â
                      table.tableDoubleBorder { border: 2px solid ##000000; }
                      table.tableDoubleBorder td { border: 2px solid ##000000; }
     Â
                      .clickToEnlarge { font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: ##000000; font-style: normal; font-weight: normal; }
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn rules />
      </cffunction>
      <!--- returns add/edit form for a particular item --->
      <cffunction name="getAddEdit" access="public" returntype="string" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfif not isQuery(formData.query)>
                 <cfset formData.query = this.workflow.getQuery(for
           </cfif>
           <cfif formData.blnMeta>
                 <!--- Donny: retrieve and populate advance meta data --->
                 <cfif isDefined("FORM.id") and Val(FORM.id)>
                      <cfset URL.id = FORM.id>
                 </cfif>
                 <cfif isDefined("URL.id") and Val(URL.id)>
                      <cfif not isDefined("FORM.intVersion
                            <!--- retrieve the MetaID if not passed in lookup --->
                            <cfquery name="qryCurrentMetaID" datasource="#this.datasour
                                 SELECT       TOP 1 intID
                                 FROM       #formData.tablename#
                                 WHERE       intItemID = #URL.id#
                                 <!--- see if we are grabbing the live version --->
                                 <cfif isDefined("formData.query.
                                       <!--- live --->
                                       AND blnLive = 1
                                 </cfif>
                                 <!--- added by Jason --->
                                 <!--- see if VersionID is appended to the URL --->
                                 <cfif isDefined("URL.versionid")
                                       AND intID = #URL.versionid#
                                 </cfif>
                                 <!--- end added by Jason --->
                                 ORDER BY dtAdded DESC;
                            </cfquery>
                            <cfset FORM.intVersionID = Val(qryCurrentMetaID.intID
                      </cfif>
                 </cfif>
                Â
                 <cfscript>
                      // retrieve the other metatags (other than keywords and description)
                      this.htmlhead = createObject('component',"
                      this.htmlhead.init(this.Co
                      txtNameValues = "";
                      txtHTTPValues = "";
                      if (isDefined("URL.id") and isDefined("FORM.intVersion
                            metaTags = this.htmlhead.getMetaTags(
                            // format the metatag needed in "formData" variable
                            for (i=1; i lte ArrayLen(metaTags); i=i+1) {
                                 if (StructKeyExists(metatags[
                                       txtNameValues = txtNameValues & 'Normal,' & metatags[i].name & ',' & metatags[i].content & chr(13) & chr(10);
                                 } else if (StructKeyExists(metatags[
                                       txtNameValues = txtNameValues & 'HTTP-Eq,' & metatags[i].httpequiv & ',' & metatags[i].content & chr(13) & chr(10);
                                 }
                            }
                      }
                 </cfscript>
                 <cfscript>
                      metaFormData.query = QueryNew('intID,txtNameVal
                      QueryAddRow(metaFormData.q
                      QuerySetCell(metaFormData.
                      QuerySetCell(metaFormData.
                      QuerySetCell(metaFormData.
                      // save to "formData"
                      formData.metaQuery = metaFormData.query;
                 </cfscript>
           </cfif>
           <cfsavecontent variable="body">
                 <cfoutput>
                      #getStyles(true)#
                      #getStatus()#
                      <cfif formData.blnMeta>
                            <style type="text/css">
                            <!--
                                 .txtMetaName, .txtMetaValue, .txtMetaType {
                                       font-family: Arial, Helvetica, sans-serif;
                                       font-size: 11px;
                                       color: ##666666;
                                       padding: 5px;
                                       font-weight: normal;
                                       background-color: ##FFFFFF;
                                       cursor: hand;
                                       float: left;
                                       overflow: hidden;
                                       border-left: 1px solid ##999999;
                                 }
                                 .txtMetaType { width: 54px; }
                                 .txtMetaName { width: 135px; }
                                 .txtMetaValue { width: 330px; }
                            -->
                            </style>
                      </cfif>
                      <cfif formData.blnPreview>
                            <script language='JavaScript'>
                                 function previewItem(form) {
                                       var tempAction = form.action;
                                       if (window.jsValidate && !jsValidate())
                                            return false;
     Â
                                       var previewWindow = window.open('', 'previewWindow', 'height=700,width=800,inne
                                       form.action = '#this.qryCompany.txtWeb#/
                                       form.target = 'previewWindow';
     Â
                                       // put in hidden Preview Mode variable
                                       var hiddenItem = document.createElement('in
                                       hiddenItem.type = 'hidden';
                                       hiddenItem.id = 'hot_banana_preview_mode';
                                       hiddenItem.name = 'hot_banana_preview_mode';
                                       hiddenItem.value = 1;
                                       form.appendChild(hiddenIte
     Â
                                       form.submit();
                                       previewWindow.focus();
                                       form.action = tempAction;
                                       form.target = '';
     Â
                                       // should remove hidden Preview Mode variable
                                       try{
                                            form.removeChild(hiddenIte
                                       } catch(e) {
                                            hiddenItem.removeNode();
                                       }
     Â
                                       return false;
                                 }
                                Â
                                 function previewWorkflow(form,blnMo
                                       var tempAction = form.action;
                                       if (window.jsValidate && !jsValidate()) return false;
     Â
                                       var previewWindow = window.open('', 'previewWindow', 'height=700,width=800,inne
                                       form.action = '#this.qryCompany.txtWeb#/
                                       form.target = 'previewWindow';
     Â
                                       // put in hidden Preview Mode variable
                                       var hiddenItem = document.createElement('in
                                       hiddenItem.type = 'hidden';
                                       hiddenItem.id = 'hot_banana_preview_mode';
                                       hiddenItem.name = 'hot_banana_preview_mode';
                                       hiddenItem.value = 1;
                                       form.appendChild(hiddenIte
                                      Â
                                       // put in hidden preview mod/current variable
                                       if(blnModified == false)
                                       {
                                            var hiddenItem = document.createElement('in
                                            hiddenItem.type = 'hidden';
                                            hiddenItem.id = 'hot_banana_preview_curren
                                            hiddenItem.name = 'hot_banana_preview_curren
                                            hiddenItem.value = 1;
                                            form.appendChild(hiddenIte
                                       }
     Â
                                       form.submit();
                                       previewWindow.focus();
                                       form.action = tempAction;
                                       form.target = '';
     Â
                                       // should remove hidden Preview Mode variable
                                       try{
                                            form.removeChild(hiddenIte
                                       } catch(e) {
                                            hiddenItem.removeNode();
                                       }
     Â
                                       return false;
                                 }
     Â
                                 function analyzeItem(form) {
                                       var tempAction = form.action;
                                       if (window.jsValidate && !jsValidate()) return false;
     Â
                                       var analyzeWindow = window.open('', 'analyzeWindow', 'height=700,width=800,inne
                                       form.action = '#this.qryCompany.txtWeb#/
                                       form.target = 'analyzeWindow';
     Â
                                       // put in hidden Preview Mode variable
                                       var hiddenItem = document.createElement('in
                                       hiddenItem.type = 'hidden';
                                       hiddenItem.id = 'hot_banana_preview_mode';
                                       hiddenItem.name = 'hot_banana_preview_mode';
                                       hiddenItem.value = 1;
                                       form.appendChild(hiddenIte
     Â
                                       form.submit();
                                       analyzeWindow.focus();
                                       form.action = tempAction;
                                       form.target = '';
     Â
                                       // should remove hidden Preview Mode variable
                                       try{
                                            form.removeChild(hiddenIte
                                       } catch(e) {
                                            hiddenItem.removeNode();
                                       }
     Â
                                       return false;
                                 }
                            </script>
                      </cfif>
     Â
                      <cfif isDefined("addbutton") and isDefined("FORM.ID") and Val(FORM.ID)>
                            <cftrace text="Setting URL.ID"/>
                            <cfset URL.ID = Val(FORM.ID)>
                      </cfif>
                      <!--- <cfsetting showdebugoutput="yes"> --->
     Â
                      <cfif isDefined("URL.ID") and Val(URL.ID)> <!--- editing / viewing --->
                            <cfif formData.blnApproval and this.workflow.canApprove(V
                                 #getApproveForm(formData, URL.ID)#
                            <cfelseif formData.blnLock and this.workflow.isLocked(Val
                                 <cfquery name="qryItemLock" datasource="#this.datasour
                                       SELECT      blnApproval, intUserID, dtAdded
                                       FROM       tblItemLock
                                       WHERE       intItemID = #Val(URL.ID)#
                                 </cfquery>
     Â
                                 <cfif not isDefined("this.access")>
                                       <cfset this.access = createObject("component", "hb50.access").init(this.C
                                 </cfif>
                                 <cfif qryItemLock.blnApproval>
                                       #translate("This item is awaiting approval from")#:
                                       <blockquote>
                                            <cfloop query="qryItemLock">
                                                  <cftry>
                                                       #this.access.getUserData(i
                                                       <cfcatch></cfcatch>
                                                  </cftry>
                                            </cfloop>
                                       </blockquote>
                                 <cfelse>
                                       #translate("This item was locked by")# #this.access.getUserData(q
                                 </cfif>
                                 <form action="#formData.link#" method="post"><input type="submit" value="#translate("Go Back")#" class="buttons"></form>
     Â
                            <cfelse>
                                 <cfif isDefined("URL.versionID")
                                       #getEditForm(formData, URL.ID, URL.versionID)#
                                 <cfelse>
                                       #getEditForm(formData, URL.ID)#
                                 </cfif>
                            </cfif>
                      <cfelse> <!--- adding --->
                            #getAddForm(formData)#
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn body />
      </cffunction>
      <cffunction name="getAddForm" access="public" returntype="string" hint="Returns Default Add Form" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="formName" required="false" default="frmAddEdit">
           <cfargument name="jsValidate" required="false" default="jsValidate">
           <cfsavecontent variable="output">
                 <cfoutput>
                      #getJSValidate(formData)#
     Â
                      <script language="JavaScript">
                            var submitted = false;
                            <!--- Notification --->
                            function jsConfirmNotification() {
                                 if (confirm('Send Update Notification to Subscribers?')) {
                                       document.#formName#.HB_sen
                                 }
                                 return true;
                            }
     Â
                            function jsCarefulSubmit() {
                                 var valid = #jsValidate#();
     Â
                                 if (valid) {
                                       if (submitted) return false;
                                       document.body.onbeforeunlo
                                       submitted = true;
                                 }
     Â
                                 return valid;
                            }
                      </script>
     Â
                      <table border="0" cellpadding="0" cellspacing="0">
                            <form name="#formName#" action="#formData.link#<cf
                                 <tr>
                                       <td>
                                            #getFormTabs(formData)#
                     Â
                                            <cfsavecontent variable="buttons">
                                                  <cfif ArrayLen(formData.addbutto
                                                       <cfset addbuttons = formData.addbuttons>
                                                  <cfelse>
                                                       <cfset addbuttons = getAddButtons(formData)>
                                                  </cfif>
                                                  <!--- notification --->
                                                  <input type="hidden" name="HB_sendNotification"
                                                  <cfloop from="1" to="#ArrayLen(addbuttons)#
                                                       <input <cfif StructKeyExists(addbuttons
                                                             <cfif StructKeyExists(addbuttons
                                                             <cfif StructKeyExists(addbuttons
                                                             <cfelseif addbuttons[i].title is "Check In" and isDefined("this.qryCompany
                                                             <cftry>
                                                                  <cfset notifier = getObject("hb50.plugins.ge
                                                                  <cfif notifier.getNotifierListsB
                                                                        onClick="return jsConfirmNotification();"
                                                                  </cfif>
                                                                  <cfcatch></cfcatch>
                                                             </cftry>
                                                             </cfif>
                                                             <cfif StructKeyExists(addbuttons
                                                       >
                                                  </cfloop>
                                            </cfsavecontent>
                                            #getButtonLayer(buttons)#
                                       </td>
                                 </tr>
                            </form>
                      </table>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn output />
      </cffunction>
      <cffunction name="getAddButtons" returntype="array" access="private" output="false">
           <cfargument name="formData" type="struct" required="true">
           <cfset var addbuttons = ArrayNew(1)>
           <cfset var notifier = ''>
           <cfif formData.blnPreview>
                 <cfset x = StructNew()>
                 <cfset x.title = "Keyword Analysis">
                 <cfset x.width = 130>
                 <cfset x.onclick = "return analyzeItem(this.form);">
                 <cfset ArrayAppend(addbuttons, x)>
                 <cfset x = StructNew()>
                 <cfset x.title = "Preview">
                 <cfset x.onclick = "return previewItem(this.form);">
                 <cfset ArrayAppend(addbuttons, x)>
           </cfif>
           <cfif formData.blnLock>
                 <cfset x = StructNew()>
                 <cfset x.title = "Save">
                 <cfset ArrayAppend(addbuttons, x)>
                 <cfset x = StructNew()>
                 <cfset x.title = "Check In">
                 <!--- notification --->
                 <cfif isDefined("this.qryCompany
                      <cftry>
                            <cfset notifier = getObject("hb50.plugins.ge
                            <cfif notifier.getNotifierListsB
                                 <cfset x.onClick = "return jsConfirmNotification();">
                            </cfif>
                      <cfcatch></cfcatch>
                      </cftry>
                 </cfif>
                 <cfset ArrayAppend(addbuttons, x)>
           <cfelse>
                 <cfset x = StructNew()>
                 <cfset x.title = "Add">
                 <cfset ArrayAppend(addbuttons, x)>
           </cfif>
           <cfreturn addButtons />
      </cffunction>
      <cffunction name="getEditForm" access="public" returntype="string" hint="Returns Default Edit Form" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="ID" required="true" type="any">
           <cfargument name="versionID" required="false" type="any">
           <cfargument name="formName" required="false" default="frmAddEdit">
           <cfargument name="jsValidate" required="false" default="jsValidate">
          Â
           <cfscript>
                 var qryUnorderedVersion = QueryNew('');
                 var qryVersion = QueryNew('');
                 var versionLink = '';
                 var qryCurrent = QueryNew('');
                 var editbuttons = ArrayNew(1);
                 var buttons = '';
           </cfscript>
           <cfif formData.blnVersion>
                 <!--- version stuff --->                Â
                 <cfquery name="qryUnorderedVersion"
                      SELECT       #formData.tablename#.*, tblItem.blnDeleted
                      FROM       #formData.tablename#
                      LEFT JOIN tblItem
                      ON            tblItem.intID = #formData.tablename#.intIt
                      WHERE       #formData.tablename#.intIt
                      ORDER BY dtAdded DESC
                 </cfquery>
                Â
                 <cfif qryUnorderedVersion.record
                      <cfif isDefined("arguments.versi
                            <cfparam name="FORM.intVersionID" default="#arguments.versio
                      <cfelse>
                            <cfset "FORM.intVersionID" = qryUnorderedVersion.intID>
                      </cfif>
                      <cfquery name="qryVersion" dbtype="query">
                            SELECT      *
                            FROM       qryUnorderedVersion
                            ORDER BY blnLive DESC, dtAdded DESC
                      </cfquery>
                      <cfif formData.blnVersion and FORM.intVersionID neq qryUnorderedVersion.intID>
                            <!--- Donny: grabbing the wrong version?! --->
                            <cfset qryCurrent = selectFrom(qryVersion, formData.varID, FORM.intVersionID)>
                            <!--- <cfset qryCurrent = selectFrom(qryVersion, formData.varID, qryUnorderedVersion.intID)
                      <cfelseif isDefined("formData.query"
                            <!--- if we select from qryVersion we loose additional columns in formData.query --->
                            <cfset qryCurrent = selectFrom(formData.query,
                      <cfelse>
                            <cfset qryCurrent = selectFrom(qryVersion, formData.varID, FORM.intVersionID)>
                      </cfif>
                       <cfset versionLink = "#formData.link#&mode=edit
                 <cfelse>
                      <cfset qryCurrent = selectFrom(formData.query,
                 </cfif>
           <cfelseif formData.blnWorkflow>
                 <cfset qryCurrent = selectFrom(formData.query,
           <cfelse>
                 <cfset qryCurrent = selectFrom(formData.query,
           </cfif>
          Â
           <cfsavecontent variable="output">
                 <cfoutput>
                      #getJSValidate(formData)#
     Â
                      <script language="JavaScript">
                            var submitted = false;
                            //notification
                            function jsConfirmNotification(addN
                                 if (confirm('Send Update Notification to Subscribers when page goes live?')) {
                                       document.#formName#.HB_sen
                                 }
                                Â
                                 if(addNote == true)                           Â
                                       jsApproveNote();
                                 return true;
                            }
                           Â
                            function jsApproveNote()
                            {
                                 if (window.showModalDialog)
                                 {
                                       // modal window
                                       window.showModalDialog('po
                                       return true;
                                 }
                                 //else
                                 //{
                                       // pop-up window
                                       //window.open('popup/edit_
                                       //return true;
                                 //}
                            }
                           Â
                            function jsCarefulSubmit() {
                                 var valid = #jsValidate#();
     Â
                                 if (valid) {
                                       if (submitted) return false;
                                      Â
                                       document.body.onbeforeunlo
                                       submitted = true;
                                 }
     Â
                                 return valid;
                            }
                      </script>
     Â
                      <table border="0" cellpadding="0" cellspacing="0">
                            <form name="#formName#" action="#formData.link#<cf
                                 <input type="hidden" name="ID" value="#arguments.ID#">
                                 <tr>
                                       <td>
                                            #getFormTabs(formData, qryCurrent)#
                Â
                                            <cfsavecontent variable="buttons">
                                                  <cfset editbuttons = getEditButtons(formData, qryCurrent)>
                                                 Â
                                                  <!--- notification --->
                                                  <input type="hidden" name="HB_sendNotification"
                                                  <input type="hidden" name="txtEditReason" id="txtEditReason" value="">
                                                  <cfloop from="1" to="#ArrayLen(editbuttons)
                                                       <input <cfif StructKeyExists(editbutton
                                                       <cfif StructKeyExists(editbutton
                                                       <cfif StructKeyExists(editbutton
          Â
                                                       <cfelseif editbuttons[i].title is "Check In" AND isDefined("this.qryCompany
                                                             <cftry>
                                                                  <cfset notifier = getObject("hb50.plugins.ge
                                                                  <cfif notifier.getNotifierListsB
                                                                        <cfif getAddNote(formData) is true>
                                                                             onClick="return jsConfirmNotification(true
                                                                        <cfelse>
                                                                             onClick="return jsConfirmNotification(fals
                                                                        </cfif>
                                                                  </cfif>
                                                             <cfcatch></cfcatch>
                                                             </cftry>
                                                       </cfif>
                                                       <cfif editbuttons[i].title is "Check In">
                                                             <cfif getAddNote(formData) is true>
                                                                  onClick="return jsApproveNote();"
                                                             </cfif>
                                                       </cfif>
                                                       <cfif StructKeyExists(editbutton
                                                       >
                                                  </cfloop>
                                            </cfsavecontent>
                                            #getButtonLayer(buttons)#
                                       </td>
                                 </tr>
                            </form>
                      </table>
                      <cfif formData.blnVersion and isDefined("FORM.intVersion
                            #getVersionForm(qryVersion
                      </cfif>
                     Â
                      <cfif formData.blnWorkflow and formData.blnTranslate>
                            #getLanguageForm()#
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
     Â
      <!--- this function determines if we should display the edit note popup --->
      <cffunction name="getAddNote" returntype="boolean" access="private">
           <cfargument name="formData" type="any" required="true">
           <!--- if this is a super user or at the last level of the approval,
                  do not popup an edit box --->
           <cfif SESSION.superuser>
                 <cfreturn false />
           </cfif>
           <!--- get this user's moderator level --->
           <cfquery name="qryCurrentMod" datasource="#this.datasour
                 SELECT       intLevel
                 FROM       tblModerator
                 JOIN       tblUserGroup
                 ON            tblUserGroup.intGroupID = tblModerator.intModeratorI
                 JOIN       tblUser
                 ON            tblUserGroup.intUserID = tblUser.intID
                 WHERE       tblUser.intID = <cfqueryparam value="#SESSION.userid#" cfsqltype="cf_sql_integer"
                 AND       tblModerator.intNavID = <cfqueryparam value="#formData.webid#" cfsqltype="cf_sql_integer"
           </cfquery>
           <!--- get the highest moderator level for this page --->
           <cfquery name="qryTopMod" datasource="#this.datasour
                 SELECT       intLevel
                 FROM       tblModerator
                 WHERE       intNavID = <cfqueryparam value="#formData.webid#" cfsqltype="cf_sql_integer"
                 ORDER BY intLevel DESC
           </cfquery>
           <!--- if we are the big cahoona, then do not display popup --->
           <cfif qryCurrentMod.recordCount and qryTopMod.recordCount>
                 <cfif qryCurrentMod.intLevel is qryTopMod.intLevel>
                      <cfreturn false />
                 </cfif>
           <cfelseif NOT qryTopMod.recordCount>
                 <!--- workflow does not exist for this page so do not add note --->
                 <cfreturn false />
           </cfif>
          Â
           <cfreturn true />
      </cffunction>
      <cffunction name="getEditButtons" returntype="array" access="private" output="false">
           <cfargument name="formData" type="struct" required="true">
           <cfargument name="qryCurrent" type="query" required="true">
           <cfscript>
                 var editbuttons = ArrayNew(1);
                 var notifier = '';
                 var x = '';
                 var idx = 1;
                 var length = ArrayLen(formData.editbutt
                Â
                 //use user-defined edit buttons
                 if (not isDefined('formData.append
                      editbuttons = formData.editbuttons;
                      return editbuttons;
                 }
          Â
                 if (isDefined("qryCurrent.bln
                      if (formData.blnRestore) {
                            x = StructNew();
                            x.title = "Restore";
                            ArrayAppend(editbuttons, x);
                      }
                     Â
                      x = StructNew();
                      x.title = "Go Back";
                      ArrayAppend(editbuttons, x);
                 }
                 else {
                      if (formData.blnDelete) {
                            x = StructNew();
                            x.title = "Delete";
                            x.onclick = "jsValidationRequired = false; return confirm('#JSStringFormat(t
                            ArrayAppend(editbuttons, x);
                      }
                      if (formData.blnPreview) {
                            x = StructNew();
                            x.title = "Keyword Analysis";
                            x.width = 130;
                            x.onclick = "return analyzeItem(this.form);";
                            ArrayAppend(editbuttons, x);
                            x = StructNew();
                            x.title = "Preview";
                            x.onclick = "return previewItem(this.form);";
                            ArrayAppend(editbuttons, x);
                      }
                      x = StructNew();
                      x.title = "Save";
                      ArrayAppend(editbuttons, x);
                     Â
                      if (formData.blnLock) {
                            x = StructNew();
                            x.title = "Check In";
                           Â
                            //notification
                            if (isDefined("this.qryCompan
                                 try {
                                       notifier = getObject("hb50.plugins.ge
                                       if (notifier.getNotifierLists
                                            if (getAddNote(formData) is true)
                                                  x.onClick = "return jsConfirmNotification(true
                                            else
                                                  x.onClick = "return jsConfirmNotification(fals
                                       }
                                       else {
                                            if (getAddNote(formData) is true)
                                                  x.onClick = "return jsApproveNote();";
                                       }
                                 }
                                 catch (Any excpt) {}
                            }
                            ArrayAppend(editbuttons, x);
                      }
                 }
                Â
                 //append user-defined editbuttons
                 if (isDefined('formData.appen
                      for (idx = 1; idx lte length; idx = idx + 1)
                            ArrayAppend(editbuttons, formData.editbuttons[idx])
                 }
                 return editbuttons;
           </cfscript>
      </cffunction>
      <cffunction name="getApproveForm" access="public" returntype="string" hint="Returns Default Approve Form" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="ID" required="true" type="numeric">
           <cfargument name="formName" required="false" default="frmAddEdit">
           <cfargument name="jsValidate" required="false" default="jsValidate">
           <cfset var i = 0>
           <cfset var oldMetaTags = ''>
           <cfset var newMetaTags = ''>
           <cfquery name="qryOld" datasource="#this.datasour
                 SELECT      TOP 1 *
                 FROM       #formData.tablename#
                 WHERE       intItemID = #ID#
                 AND       blnLive = 1
                 ORDER BY dtAdded DESC
           </cfquery>
           <cfquery name="qryNew" datasource="#this.datasour
                 SELECT       TOP 1 *
                 FROM       #formData.tablename#
                 WHERE       intItemID = #ID#
                 AND       blnLive = 0
                 ORDER BY dtAdded DESC
           </cfquery>
           <cfparam name="leftBody" default="">
           <cfparam name="rightBody" default="">
          Â
           <cfsavecontent variable="buttons">
                 <cfoutput>
                      <script language="JavaScript">
                            function jsDecline () {
                                 if (window.showModalDialog) {
                                       // modal window
                                       window.showModalDialog('po
                                       return true;
                                 } else {
                                       // pop-up window
                                       window.open('popup/decline
                                       return false;
                                 }
                            }
                      </script>
                     Â
                      <input name="button" type="submit" <cfif NOT qryOld.recordCount>disable
                      <input name="button" type="submit" value="#translate("Preview
                      <input name="button" type="submit" value="#translate("Approve
                      <input name="button" type="submit" value="#translate("Decline
                      <input name="button" type="submit" value="#translate("Edit")#
                      <input type="hidden" name="txtDeclineReason" id="txtDeclineReason" value="">
                      <!--- this is here because we need to somehow submit the form with button=Decline without 'clicking' Decline --->
                      <input type="hidden" name="button" id="fakeButton" value="" disabled>
                 </cfoutput>
           </cfsavecontent>
           <cfset numChanged = 0>
           <cfsavecontent variable="body">
                 <cfoutput>
                      <!--- in case no content is added yet --->
                      <cfif NOT qryOld.recordCount AND qryNew.recordCount>
                            <cfloop from="1" to="#ArrayLen(formData.col
                                       <cfset column = formData.columns[key]>
                                            <cfif column.varname EQ 'txtBody'>
                                                  <cfset rightBody = HTMLEditFormat(getItemView
                                            </cfif>
                                 </cfloop>
                      </cfif>
                      <cfif qryOld.recordCount>
                            <table width="523" border="0" cellpadding="5" cellspacing="0" align="center">
                                 <tr>
                                       <td height="21" style="border-left: 1px solid ##999999;"><img src="images/shim.gif" width="1" height="21"></td>
                                       <td style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;"><img src="images/shim.gif" width="1" height="21"></td>
                                 </tr>
                                 <cfset numChanged = 0>
                                 <cfloop from="1" to="#ArrayLen(formData.col
                                       <cfset column = formData.columns[key]>
                                       <cfif (not isDefined("column.display"
                                             and column.type neq TYPES.HIDDEN and (not isDefined("column.insert")
                                             and qryOld[column.varname][1] neq qryNew[column.varname][1]>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset compare = diff(getItemView(formData,
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">#colum
                                                  #compare.str1#
                                            <cfif column.varname EQ 'txtBody'>
                                                  <cfset leftBody = HTMLEditFormat(getItemView
                                            </cfif>
                                       </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                            <span class="formCaption">#colum
                                            #compare.str2#
                                            <cfif column.varname EQ 'txtBody'>
                                                  <cfset rightBody = HTMLEditFormat(getItemView
                                            </cfif>
                                            </td></tr>
                                       </cfif>
                                 </cfloop>
                                 <!--- if using tblResource, we can assume that we also want to compare the file uploaded to this resource.
                                        comparing based on the table name is a Very Bad Thing to do, but I can't figure out another way to make
                                        the exception to pull this off, except making a custom approval form in resources.cfc, which i don't want to do.
                                 --->
                                 <cfif formData.tablename is "tblResource">
                                       <cfset media = createObject("component", "hb50.media").init(this.Co
                                       <cfset oldView = "">
                                       <cfif Val(qryOld.intMediaID)>
                                            <cfset oldFile = media.getURL(qryOld.intMed
                                            <cfset oldView = '<a href="#oldFile#" target="_blank">#GetFileFr
                                       </cfif>
                                       <cfset newView = "">
                                       <cfif Val(qryNew.intMediaID)>
                                            <cfset newFile = media.getURL(qryNew.intMed
                                            <cfset newView = '<a href="#newFile#" target="_blank">#GetFileFr
                                       </cfif>
                                       <cfif oldView neq newView>
                                            <cfset numChanged = numChanged + 1>
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">File:<
                                                  <span style="background-color: ##FFFF00;">#oldView#</span
                                            </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                  <span class="formCaption">File:<
                                                  <span style="background-color: ##FFFF00;">#newView#</span
                                            </td></tr>
                                       </cfif>
                                 </cfif>
                                Â
                                 <!--- additional resources --->
                                 <cfif formData.blnResources>
                                       <cfset media = createObject("component", "hb50.media").init(this.Co
                                      Â
                                       <cfset oldView = "">
                                       <cfif Val(qryOld.intResourceID)>
                                            <cfset oldResources = media.getAdditionalResourc
                                            <cfloop from="1" to="#ArrayLen(oldResources
                                                  <cfset oldView = oldView & '#oldResources[i].title#<b
                                            </cfloop>
                                       </cfif>
                                      Â
                                       <cfset newView = "">
                                       <cfif Val(qryNew.intResourceID)>
                                            <cfset newResources = media.getAdditionalResourc
                                            <cfloop from="1" to="#ArrayLen(newResources
                                                  <cfset newView = newView & '#newResources[i].title#<b
                                            </cfloop>
                                       </cfif>
                                      Â
                                       <cfif oldView neq newView>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset compare = diff(oldView, newView)>
                                            <tr>
                                                  <td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                       <span class="formCaption">Additi
                                                       #compare.str1#
                                                  </td>
                                                  <td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                       <span class="formCaption">Additi
                                                       #compare.str2#
                                                  </td>
                                            </tr>
                                       </cfif>
                                 </cfif>
                                Â
                                 <!--- meta data --->
                                 <cfif formData.blnMeta>     Â
                                       <cfif qryOld.txtMetaKeywords neq qryNew.txtMetaKeywords>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset oldView = qryOld.txtMetaKeywords>
                                            <cfset newView = qryNew.txtMetaKeywords>
                                            <cfset compare = diff(oldView,newView)>
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">Meta Keywords:</span><br>
                                                  #compare.str1#
                                            </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                  <span class="formCaption">Meta Keywords:</span><br>
                                                  #compare.str2#
                                            </td></tr>
                                       </cfif>
                                       <cfif qryOld.txtMetaDescription neq qryNew.txtMetaDescription>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset oldView = qryOld.txtMetaDescription>
                                            <cfset newView = qryNew.txtMetaDescription>
                                            <cfset compare = diff(oldView,newView)>
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">Meta Description:</span><br>
                                                  #compare.str1#
                                            </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                  <span class="formCaption">Meta Description:</span><br>
                                                  #compare.str2#
                                            </td></tr>
                                       </cfif>
     Â
                                       <cfset this.htmlHead = createObject('component',"
                                       <cfset oldMetaTags = this.htmlhead.getMetaTags(
                                       <cfset newMetaTags = this.htmlHead.getMetaTags(
                                       <cfif ArrayLen(oldMetaTags) OR ArrayLen(newMetaTags)>
                                            <cfif ArrayLen(oldMetaTags) GTE ArrayLen(newMetaTags)>
                                                  <cfloop from="1" to="#ArrayLen(oldMetaTags)
                                                       <cfif StructKeyExists(oldMetaTag
                                                             <cfset tagName = oldMetaTags[idx].name>
                                                             <cfset newTagContent = getMetaTagContent(newMetaT
                                                       <cfelse>
                                                             <cfset tagName = oldMetaTags[idx].httpequiv
                                                             <cfset newTagContent = getMetaTagContent(newMetaT
                                                       </cfif>
                                                       <cfset oldTagContent = oldMetaTags[idx].content>
     Â
                                                       <cfif oldTagContent NEQ newTagContent>
                                                             <cfset numChanged = numChanged + 1>
                                                             <cfset compare = diff(oldTagContent, newTagContent)>
                                                             <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                                  <span class="formCaption">#tagNa
                                                                  #compare.str1#
                                                             </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                                  <span class="formCaption">#tagNa
                                                                  #compare.str2#
                                                             </td></tr>
                                                       </cfif>
                                                  </cfloop>
                                                  <cfloop from="1" to="#ArrayLen(newMetaTags)
                                                       <cfif StructKeyExists(newMetaTag
                                                             <cfset tagName = newMetaTags[idx].name>
                                                       <cfelse>
                                                             <cfset tagName = newMetaTags[idx].httpequiv
                                                       </cfif>
                                                       <cfset newTagContent = newMetaTags[idx].content>
                                                       <cfset numChanged = numChanged + 1>
                                                       <cfset compare = diff('', newTagContent)>
                                                       <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                             <span class="formCaption">#tagNa
                                                             #compare.str1#
                                                       </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                             <span class="formCaption">#tagNa
                                                             #compare.str2#
                                                       </td></tr>
                                                  </cfloop>
                                            <cfelse>
                                                  <cfloop from="1" to="#ArrayLen(newMetaTags)
                                                       <cfif StructKeyExists(newMetaTag
                                                             <cfset tagName = newMetaTags[idx].name>
                                                             <cfset oldTagContent = getMetaTagContent(oldMetaT
                                                       <cfelse>
                                                             <cfset tagName = newMetaTags[idx].httpequiv
                                                             <cfset oldTagContent = getMetaTagContent(oldMetaT
                                                       </cfif>
                                                       <cfset newTagContent = newMetaTags[idx].content>
     Â
                                                       <cfif oldTagContent NEQ newTagContent>
                                                             <cfset numChanged = numChanged + 1>
                                                             <cfset compare = diff(oldTagContent, newTagContent)>
                                                             <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                                  <span class="formCaption">#tagNa
                                                                  #compare.str1#
                                                             </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                                  <span class="formCaption">#tagNa
                                                                  #compare.str2#
                                                             </td></tr>
                                                       </cfif>
                                                  </cfloop>
                                                  <cfloop from="1" to="#ArrayLen(oldMetaTags)
                                                       <cfif StructKeyExists(oldMetaTag
                                                             <cfset tagName = oldMetaTags[idx].name>
                                                       <cfelse>
                                                             <cfset tagName = oldMetaTags[idx].httpequiv
                                                       </cfif>
                                                       <cfset oldTagContent = oldMetaTags[idx].content>
                                                       <cfset numChanged = numChanged + 1>
                                                       <cfset compare = diff(oldTagContent, '')>
                                                       <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                             <span class="formCaption">#tagNa
                                                             #compare.str1#
                                                       </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                             <span class="formCaption">#tagNa
                                                             #compare.str2#
                                                       </td></tr>
                                                  </cfloop>
                                            </cfif>
                                       </cfif>
                                 </cfif>
                           Â
                                 <!--- scheduling --->
                                 <cfif formData.blnScheduling>
                                       <cfscript>
                                            x = StructNew();
                                            x.varname = "dtStart";
                                            x.title = "The date/time this data is scheduled to start";
                                            x.type = TYPES.DATE;
                                            x.required = true;
                                            startColumn = x;
     Â
                                            x = StructNew();
                                            x.varname = "dtEnd";
                                            x.title = "The date/time this data is scheduled to end";
                                            x.type = TYPES.DATE;
                                            x.required = true;
                                            endColumn = x;
                                       </cfscript>
                                       <cfif qryOld.dtStart neq qryNew.dtStart>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset compare = diff(getItemView(formData,
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">Start Date:</span><br>
                                                  #compare.str1#
                                            </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                  <span class="formCaption">Start Date:</span><br>
                                                  #compare.str2#
                                            </td></tr>
                                       </cfif>
                                       <cfif qryOld.dtEnd neq qryNew.dtEnd>
                                            <cfset numChanged = numChanged + 1>
                                            <cfset compare = diff(getItemView(formData,
                                            <tr><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999;">
                                                  <span class="formCaption">End Date:</span><br>
                                                  #compare.str1#
                                            </td><td width="50%" valign="top" class="default" style="border-left: 1px solid ##999999; border-right: 1px solid ##999999;">
                                                  <span class="formCaption">End Date:</span><br>
                                                  #compare.str2#
                                            </td></tr>
                                       </cfif>
                                 </cfif>
                                 <tr><td style="border-bottom: 1px solid ##999999; border-left: 1px solid ##999999;" height="1"><img src="images/shim.gif" height="1" width="1"></td><td style="border-bottom: 1px solid ##999999; border-left: 1px solid ##999999; border-right: 1px solid ##999999;" height="1"><img src="images/shim.gif" height="1" width="1"></td></tr>
                            </table>
     Â
                      <cfelse> <!--- approving a newly added item --->
                            <cfset numChanged = 1>
                            <table width="523" border="0" cellpadding="5" cellspacing="0" align="center">
                                 <tr>
                                       <td class="default">
                                            <cfloop from="1" to="#ArrayLen(formData.col
                                                  <cfset column = formData.columns[key]>
                                                  <cfif (not isDefined("column.display"
                                                       <span class="formCaption">#colum
                                                       #getItemView(formdata, column, qryNew[column.varname][1])
                                                  </cfif>
                                            </cfloop>
                                      Â
                                            <!--- if using tblResource, we can assume that we also want to compare the file uploaded to this resource.
                                                   comparing based on the table name is a Very Bad Thing to do, but I can't figure out another way to make
                                                   the exception to pull this off, except making a custom approval form in resources.cfc, which i don't want to do.
                                            --->
                                            <cfif formData.tablename is "tblResource">
                                                  <cfset media = createObject("component", "hb50.media").init(this.Co
                                                  <cfset newView = "">
                                                  <cfif Val(qryNew.intMediaID)>
                                                       <cfset newFile = media.getURL(qryNew.intMed
                                                       <cfset newView = '<a href="#newFile#" target="_blank">#GetFileFr
                                                  </cfif>
                                                  <span class="formCaption">File:<
                                                       #newView#<br><br>
                                            </cfif>
                                       </td>
                                 </tr>
                            </table>
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfif numChanged is 0>
                 <cfset body = "There were no changes.">
           </cfif>
           <cfsavecontent variable="output">
                 <cfoutput>
                      <table border="0" cellspacing="0" cellpadding="0" align="center">
                            <form name="#formName#" action="#formData.link#<cf
                                 <input type="hidden" name="ID" value="#ID#">
                                 <input type="hidden" name="txtCurrentBody" id="txtCurrentBody" value="#leftBody#">
                                 <input type="hidden" name="txtBody" id="txtBody" value="#rightBody#">
                                 <tr>
                                       <td class="default">
                                       <cfif qryOld.recordcount and numChanged>
                                            <div id="header" style="position:absolute; visibility:visible; left:2px; top:0px; width:523px; height:20px; z-index:2; background-color:##ffffff;
                                                  <table width="525" border="0" cellspacing="0" cellpadding="0">
                                                       <tr>
                                                             <td bgcolor="##FFFFFF"><img src="images/shim.gif" width="1" height="1"></td>
                                                       </tr>
                                                  </table>
                                                  <table class="tableOutline" width="523" border="0" cellspacing="1" cellpadding="0" bgcolor="##FFFFFF">
                                                        <tr>
                                                             <td height="21" width="50%" class="toolHeader">#transl
                                                             <td height="21" width="50%" class="toolHeader">#transl
                                                        </tr>
                                                  </table>
                                            </div>
                                       </cfif>
                Â
                                       #getInnerLayer(body, "approval", true)#
                                       #getButtonLayer(buttons)#
                Â
                                       <cfif formData.blnWorkflow and formData.blnTranslate>
                                            #getLanguageForm()#
                                       </cfif>
                                       </td>
                                 </tr>
                            </form>
                      </table>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
      <cffunction name="getMetaTagContent" access="private" returntype="string" output="false">
           <cfargument name="tagArray" type="array" required="true">
           <cfargument name="type" type="string" required="true">
           <cfargument name="tag" type="string" required="true">
           <cfset var tagContent = ''>
           <cfset var theTag = ''>
           <cfset var aIndex = 0>
           <cfloop from="1" to="#ArrayLen(tagArray)#" index="aIndex">
                 <cfset theTag = tagArray[aIndex]>
                 <cfif StructKeyExists(theTag,typ
                      <cfset tagContent = theTag.content>
                      <cfset ArrayDeleteAt(tagArray, aIndex)>
                      <cfreturn tagContent />
                 </cfif>
           </cfloop>
          Â
           <cfreturn tagContent />
      </cffunction>
      <!--- return the current url with form parameters encoded into the url --->
      <cffunction name="getCurrentURL" returntype="string">
           <cfset var page = CGI.SCRIPT_NAME />
           <cfset var sep = "?" />
           <cfset key = '' />
          Â
           <cfif Len(CGI.QUERY_STRING) or StructCount(FORM)>
                 <cfloop collection="#FORM#" item="key">
                      <cfif key neq "FIELDNAMES">
                            <cfset page = "#page##sep##key#=#URLEnco
                            <cfset sep = "&" />
                      </cfif>
                 </cfloop>
                 <cfif Len(CGI.QUERY_STRING)>
                      <cfset page = "#page##sep##ReReplaceNoCa
                 </cfif>
           </cfif>
           <cfreturn page />
      </cffunction>
      <!--- given two strings, returns a struct with the two strings, with changes highlighted in yellow --->
      <cffunction name="diff" returntype="any" output="false">
           <cfargument name="str1" type="string">
           <cfargument name="str2" type="string">
           <cfset var output = StructNew()>
           <cfset var start = 0> <!--- how many characters match at the start --->
           <cfset var end = 0>  <!--- how many characters match at the end --->
           <cfset var a = 0>
           <cfset var string1 = Trim(arguments.str1)>
           <cfset var string2 = Trim(arguments.str2)>           Â
           <cfset output.str1 = "">
           <cfset output.str2 = "">
           <cfif Compare(str1, str2) is 0>
                 <cfset output.str1 = str1>
                 <cfset output.str2 = str2>
                Â
                 <cfreturn output />
           </cfif>
           <!--- find the number of characters at the start of the strings that are equal (start) --->
           <cfloop from="1" to="#min(Len(string1), len(string2))#" index="a">
                 <cfif asc(mid(string1, a, 1)) is asc(mid(string2, a, 1))>
                      <cfset start = start + 1>
                 <cfelse>
                      <cfbreak>
                 </cfif>
           </cfloop>
           <!--- the number of characters after the matched chunk at the start --->
           <cfset lastLength = min(len(string1), len(string2)) - start>
           <!--- count the number of characters that are equal at the end of the strings --->
           <cfloop from="1" to="#min(lastLength, min(len(string1), len(string2)))#" index="a">
                 <cfif asc(mid(string1, len(string1) - a + 1, 1)) is asc(mid(string2, len(string2) - a + 1, 1))>
                      <cfset end = end + 1>
                 <cfelse>
                      <cfbreak>
                 </cfif>
           </cfloop>
           <!--- use starting matching chunk --->
           <cfif start gt 0>
                 <cfset output.str1 = left(string1, start)>
                 <cfset output.str2 = left(string1, start)>
           </cfif>
           <!--- append highlighted differing part (if necessary) --->
           <cfset highlight1 = max(0,len(string1) - start - end)>
           <cfif highlight1 gt 0>
                 <cfset output.str1 = output.str1 & '<span style="background-color: ##FFFF00;">' & mid(string1, start + 1, highlight1) & '</span>'>
           </cfif>
           <cfset highlight2 = max(0,len(string2) - start - end)>
           <cfif highlight2 gt 0>
                 <cfset output.str2 = output.str2 & '<span style="background-color: ##FFFF00;">' & mid(string2, start + 1, highlight2) & '</span>'>
           </cfif>
           <!--- append similar chunk on end --->
           <cfif end gt 0>
                 <cfset output.str1 = output.str1 & right(string1, end)>
                 <cfset output.str2 = output.str2 & right(string2, end)>
           </cfif>
           <cfreturn output />
      </cffunction>
      <cffunction name="getJSValidate" access="public" returntype="string" hint="Returns jsValidate cases." output="false">
           <cfargument name="formData" required="true">
           <cfargument name="formName" required="false" default="frmAddEdit">
           <cfargument name="functionName" required="false" default="jsValidate">
           <cfset isRequired = translate('is required')>
           <cfsavecontent variable="output">
                 <cfoutput>
                      <script language="JavaScript">
                            var jsValidationRequired = true;
                            function #functionName#() {
                                 // when they click delete, set jsValidationRequired to false and it won't validate the page.
                                 if (!jsValidationRequired) return true;
     Â
                                 <cfloop from="1" to="#ArrayLen(formData.col
                                       <cfset i = formData.columns[key]>
                                       <cfif isDefined("i.required") and i.required>
                                            <cfif i.type is TYPES.MEDIA and SESSION.blnAddResource>
                                                  if (document.#formName#.#i.va
                                                        if (document.getElementById('
                                                             if (!(document.#formName#.#i.
                                                              document.#formName#.#i.var
                                                              document.#formName#.#i.var
                                                                         alert('#translate("A Category, Title and File are required for")# #i.title#');
                                                                        return false;
                                                             }
                                                       } else {
                                                             if (!document.#formName#.#i.v
                                                                  alert("#translate(i.title)
                                                                  mydiv = document.getElementById('#
                                                                  if (document.#formName#.#i.va
                                                                  return false;
                                                             }
                                                       }
                                                  }
                                            <cfelse>
                                                  <cfif i.type is TYPES.CATEGORY>
                                                        if (document.#formName#.#i.va
                                                             && !(document.#formName#.#i.v
                                                  <cfelse>
                                                        <!--- Donny (20060623): document.#formName#.#i.var
                                                        if (document.#formName#.#i.va
                                                  </cfif>
                                                             alert("#translate(i.title)
                                                             <cfif i.type is TYPES.HTML and SESSION.richText>
                                                                  htmldiv = document.getElementById('D
                                                                  if (htmldiv.focus && htmldiv.style.display == 'block') htmldiv.focus();
                                                             <cfelse>
                                                                  mydiv = document.getElementById('#
                                                                  try {
                                                                        document.#formName#.#i.var
                                                                  } catch (e) {}
                                                             </cfif>
                                                             return false;
                                                        }
                                            </cfif>
                                       </cfif>
                                 </cfloop>
     Â
                                 return true;
                            }
                      </script>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
      <cffunction name="getXMLSelect" access="public" returntype="string" hint="Returns a select generated using an XML document" output="false">
           <cfargument name="xmlDoc" type="any" required="true">
           <cfargument name="varname" type="string" required="true">
           <cfargument name="selList" type="any" required="false" default="0">
           <cfargument name="pruneAt" type="string" required="false" default=""> <!--- used to avoid cycles --->
           <cfsavecontent variable="output">
                 <cfoutput>
                      <select name="#varname#">
                            <option value="#xmldoc.item.xmlatt
                            #getXMLSelectRecursive(xml
                      </select>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn output />
      </cffunction>
      <cffunction name="getXMLSelectRecursiv
           <cfargument name="xmlDoc" type="any" required="true">
           <cfargument name="varname" type="string" required="true">
           <cfargument name="selList" type="any" required="true">
           <cfargument name="pruneAt" type="string" required="true">
           <cfargument name="indent" type="numeric" required="false" default="0">
           <cfargument name="showCategory" type="boolean" required="false" default="true">
           <cfsavecontent variable="output">
                 <cfoutput>
                      <cfloop from="1" to="#ArrayLen(xmlDoc.xmlch
                            <cfset item = xmlDoc.xmlchildren[i]>                      Â
                            <cfif not ListFindNoCase(pruneAt, item.xmlattributes.id) and (not isDefined('item.xmlattribu
                                 <option value="#item.xmlattributes
                                 #getXMLSelectRecursive(ite
                            </cfif>
                      </cfloop>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn output />
      </cffunction>
     Â
      <!--- todo :: 931 :: KJ :: 7 dec 2006 :: Global Meta Data set up to emulate Workflow :: copy of getXMLSelectRecursive(), this new funtion is modifed return a list of ids --->
      <cffunction name="getXMLSelectRecursiv
           <cfargument name="xmlDoc" type="any" required="true">
           <cfargument name="varname" type="string" required="true">
           <cfargument name="selList" type="any" required="true">
           <cfargument name="pruneAt" type="string" required="true">
           <cfargument name="indent" type="numeric" required="false" default="0">
           <cfargument name="showCategory" type="boolean" required="false" default="true">
           <cfsavecontent variable="output">
                      <cfloop from="1" to="#ArrayLen(xmlDoc.xmlch
                            <cfset item = xmlDoc.xmlchildren[i]>                      Â
                            <cfif not ListFindNoCase(pruneAt, item.xmlattributes.id) and (not isDefined('item.xmlattribu
                                 <cfoutput>,#item.xmlattrib
                                 <cfset tempList = "#getXMLSelectRecursive2(i
                                 <cfif len(trim(tempList)) GT 0>
                                       <cfoutput>,#trim(tempList)
                                 </cfif>
                            </cfif>
                      </cfloop>
           </cfsavecontent>
          Â
           <cfreturn output />
      </cffunction>
      <cffunction name="memoFormat" access="public" returntype="string" output="false">
           <cfargument name="input" type="string" required="true">
           <cfargument name="length" type="numeric" required="true">
           <cfargument name="dots" type="string" required="false" default="...">
           <cfset var text = REReplace(arguments.input,
           <cfif Len(text) gt arguments.length>
                 <cfset text = Left(text, length)>
                 <cfset lastSpace = Len(text) - ReFind("\s[^\s]", reverse(text))>
                 <cfset text = Left(text, lastSpace) & dots>
           </cfif>
          Â
           <cfreturn text />
      </cffunction>
      <cffunction name="getItemView" access="public" returntype="string" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="i" type="struct" required="true">
           <cfargument name="data" type="string" required="true">
           <cfset width = 225>
           <cfsavecontent variable="output">
                 <cfoutput>
                      <cfif ListFind("#TYPES.TEXT#,#TY
                            #this.workflow.convertToke
                      <cfelseif i.type is TYPES.DATE>
                            <!--- date always has a default of now (due to the flash movie) --->
                            <cfif isDate(data)>
                                 #DateFormat(data, "mmm-dd-yy")#
                            </cfif>
                      <cfelseif ListFind("#TYPES.BOOLEAN#,
                            <cfif data is 1>#translate("Yes")#<cfels
                      <cfelseif i.type is TYPES.MEDIA>
                            <cfset media = createObject("component", "hb50.media").init(this.Co
                            #media.getMediaDisplay(Val
                      <cfelseif i.type is TYPES.SELECT>
                            <cfif isDefined("i.multiple") and i.multiple and isDefined("id")>
                                 <cfquery name="qryData" datasource="#this.datasour
                                       SELECT       #i.relationValue#
                                       FROM       #i.relationTable#
                                       WHERE       #i.relationIndex# = #id#
                                 </cfquery>
                            </cfif>
                            <cfif isDefined("i.xml")>
                                 <cfset findXML = searchXMLByID(i.xml, val(data))>
                                 <cfif (not isSimpleValue(findXML)) and StructKeyExists(findXML.xm
                                       #findXML[1].xmlattributes.
                                 </cfif>
                            <cfelseif isDefined("i.query")>
                                 <cfquery name="qryGetList" datasource="#this.datasour
                                       #PreserveSingleQuotes(i.qu
                                 </cfquery>
                                 <cfset qryData = selectFrom(qryGetList, i.valueVar, data)>
                                 #qryData[i.displayVar][1]#
                            </cfif>
                      <cfelseif i.type is TYPES.CATEGORY>
                            <cfset category = createObject("component", "hb50.category").init(this
                            #selectFrom(category.getCa
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
      <cffunction name="getFormItemDisplay" access="public" returntype="string" output="false">
           <cfargument name="formData" type="any" required="true" />
           <cfargument name="i" type="struct" required="true" />
           <cfargument name="qryData" type="query" required="false" />
           <cfargument name="itemWidth" type="numeric" required="false" default="225" />
          Â
           <cfscript>
                 var lastCat = 0;
                 var count = 0;
                 var width = arguments.itemWidth;
                 var value = '';
                Â
                 //padding settings
                 var paddingLeft = 20;
                 var paddingTop = 12;
                 if (StructKeyExists(arguments
                      paddingLeft = Val(formData.paddingL);
                 if (StructKeyExists(arguments
                      paddingTop = Val(formData.paddingT);
                 if (isDefined("qryData") and qryData.recordCount and StructKeyExists(qryData, i.varname))
                      value = qryData[i.varname][1];
                 else if (isDefined("#i.varname#"))
                      value = evaluate("#i.varname#");
                 else if (StructKeyExists(i, "default"))
                      value = i.default;
           </cfscript>
           <cfsavecontent variable="output">
                 <cfoutput>
                      <div id="#i.varname#" style="display:block; <cfif i.type neq TYPES.HTML>padding-left:#p
                      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="formCaption">
                            <cfif i.type is TYPES.HIDDEN>
                             <input type="hidden" name="#i.varname#" value="#HTMLEditFormat(val
                            <cfelse>
                            <cfif Len(Trim(i.title)) and not ListFind("#TYPES.BOOLEAN#,
                             <tr>
                                 <td valign="top" width="#width#">#translate
                                 </td>
                             </tr>
                            </cfif>
                             <tr>
                                 <td valign="top" align="left">
                            <cfif isDefined("i.edit") and not i.edit>
                                 <input disabled class="formTextbox" style="width: #width#px;" type="Text" size="50" value="#HTMLEditFormat(get
                            <cfelseif i.type is TYPES.TYPE>
                                 <select class="formTextbox" id="#i.varname#_select" style="width: #width#px;" name="#i.varname#" onchange="javascript:chang
                                       <option value="">#translate("Selec
                                       <cfloop from="1" to="#ArrayLen(i.options)#"
                                            <option value="#i.options[k].value
                                       </cfloop>
                                 </select>
                            <cfelseif i.type is TYPES.TEXT>
                                 <input class="formTextbox" style="width: #width#px;" type="Text" name="#i.varname#" id="#i.varname#_text" size="50" value="#HTMLEditFormat(val
                            <cfelseif i.type is TYPES.COLOUR>
                                 <cfif not isDefined("this.dialogHelp
                                       <object id="dlgHelper" classid="clsid:3050f819-98
                                       <cfset this.dialogHelperDefined = true>
                                 </cfif>
                                  <input class="formTextbox" style="width: #width#px;" type="Text" name="#i.varname#" id="#i.varname#_text" size="50" value="#HTMLEditFormat(val
                                 <script>
                                       var sInitColor = null;
                                       document.getElementById('#
                                            try {
                                                  sColor = document.getElementById('d
                                                  sColor = sColor.toString(16);
                                                  if (sColor.length < 6) {
                                                   var sTempString = '000000'.substring(0,6-sCo
                                                   sColor = sTempString.concat(sColor)
                                                  }
                                                  document.getElementById('#
                                            } catch (e) {}
                                       }
                                 </script>
                            <cfelseif i.type is TYPES.URL>
                                 <cfif isDefined('i.dynamic') and i.dynamic>
                                       <script>
                                            function jsGetLink_#i.varname# () {
                                                  var windowLink = 'popup.cfm?p=rte.insertlin
                                                  var linktxt = document.getElementById('#
                                                 Â
                                                  //Jason: append the id (sourceID) and the navid(will be converted to sourceType) from the URL to insertlink.cfc
                                                  var URLParams = window.document.location.s
                                                  var keyvalue = '';
                                                  var sourceID = '';
                                                  var sourceType = '';
                                                  var subType = '';
                                                  URLParams = URLParams.substring(1, URLParams.length);
                                                  URLParams = URLParams.split('&');
                                                  for (var i=0; i < URLParams.length; i++) {
                                                       keyvalue = URLParams[i].split('=');
                                                       switch(keyvalue[0]) {
                                                             case 'navid':
                                                                  sourceType = keyvalue[1];
                                                                  break;
                                                             case 'id':
                                                                  sourceID = keyvalue[1];
                                                                  break;
                                                             case 'tabid':
                                                                  subType = keyvalue[1];
                                                                  break;
                                                             default:
                                                       }
                                                  }
                                                  if (sourceID == '')
                                                       sourceID = '-999';
                                                  if (sourceID != '' && sourceType != '')
                                                       windowLink += '&sourceID=' + sourceID + '&sourceType=' + sourceType + '&subType=' + subType;
                                                 Â
                                                  if (linktxt != '')
                                                       windowLink += '&link=' + escape(linktxt);
                                                  if (window.showModalDialog)
                                                       showModalDialog(windowLink
                                                  else
                                                       window.open(windowLink, '', 'help=no,resizable=yes,scr
                                            }
                                            function jsSetLink_#i.varname# (link) {
                                                  document.getElementById('#
                                                  document.getElementById('#
                                            }
                                       </script>
                                       <img src="images/ed_link.gif" title="Insert Link" border=0 width=18 height=18 align="top" style="float:left;" onmouseover="this.style.cu
                                       <div style="width:#width-20#px;
                                       <input type="hidden" name="#i.varname#" id="#i.varname#_hidden" value="#HTMLEditFormat(val
                                 <cfelse>
                                       <input style="width: #width#px;" class="formTextbox" type="Text" name="#i.varname#" id="#i.varname#_text" size="50" value="#HTMLEditFormat(val
                                 </cfif>
                            <cfelseif i.type is TYPES.DATE>
                                 #getFormItem(TYPES.DATE, i.varname, value)#
                            <cfelseif i.type is TYPES.NUMBER>
                                 <input class="formTextbox" type="Text" name="#i.varname#" id="#i.varname#_text" size="10" value="#HTMLEditFormat(val
                            <cfelseif i.type is TYPES.BOOLEAN>
                                 <input type="checkbox" id="#i.varname#_check" name="#i.varname#" value="on"<cfif value is 1 or value is 'on'> checked</cfif><cfif isDefined("i.disabled") and i.disabled> disabled</cfif><cfif isDefined("i.onClick")> onClick="#i.onClick#"</cfi
                            <cfelseif i.type is TYPES.PASSWORD>
                                 <input class="formTextbox" size="50" style="width: #width#px;" type="password" name="#i.varname#" value="#value#" maxlength="500">
                            <cfelseif i.type is TYPES.MEDIA>
                                 <cfparam name="i.ext" default="">
                                 #getFormItem(TYPES.MEDIA, i.varname, value, i.ext)#
                            <cfelseif i.type is TYPES.SELECT>
                                 <cfif isDefined("i.multiple") and i.multiple and isDefined("id") and isDefined("i.relationTable
                                       <cfquery name="qryPolicy" datasource="#this.datasour
                                            SELECT       #i.relationValue# AS intID
                                            FROM       #i.relationTable#
                                            WHERE       #i.relationIndex# = #Val(id)#
                                       </cfquery>
                                       <cfset value = ValueList(qryPolicy.intID)
                                 </cfif>
                                 <select class="formTextarea" name="#i.varname#" id="#i.varname#_select" style="width: #width#px;"<cfif isDefined("i.multiple") and i.multiple> multiple size="<cfif isDefined("i.multiplesize"
                                       <cfif not isDefined("i.selectText")>
                                            <cfset i.selectText = "Please select one...">
                                       </cfif>
                                       <cfif isDefined("i.xml")>
                                            <cfparam name="i.pruneAt" default="0">
                                            <cfparam name="i.showXMLTopItem" default="true">
     Â
                                            <cfif (ArrayLen(i.xml.item.xmlch
                                                  <option value="">#translate(i.sele
                                            </cfif>
     Â
                                            <!--- decide whether to use the top item or not (if it has attributes) --->
                                            <cfif i.showXMLTopItem and isDefined("i.xml.item.xmla
                                                  <cfset showCategory = true>
                                                  <cfif isDefined("i.showCategory"
                                                       <cfset showCategory = i.showCategory>
                                                  </cfif>
                                                  <option value="#i.xml.item.xmlattr
                                                  #getXMLSelectRecursive(i.x
                                            <cfelse>
                                                  #getXMLSelectRecursive(i.x
                                            </cfif>
                                       <cfelseif isDefined("i.query")>
                                            <cfparam name="i.valueVar" default="intID">
                                            <cfparam name="i.displayVar" default="txtTitle">
                                           Â
                                            <cfif isDefined('i.datasource')>
                                                  <cfset thisDS = i.datasource>
                                            <cfelse>
                                                  <cfset thisDS = this.datasource>
                                            </cfif>
                                            <cfif IsQuery(i.query)>
                                                  <cfset qryGetList = i.query>
                                            <cfelse>
                                                  <cfquery name="qryGetList" datasource="#thisDS#">
                                                       #PreserveSingleQuotes(i.qu
                                                  </cfquery>
                                            </cfif>
                                            <cfif (qryGetList.recordcount gt 0 and len(i.selectText)) or isDefined("i.showSelectTex
                                                  <option value="">#translate(i.sele
                                            </cfif>
     Â
                                            <cfloop query="qryGetList">
                                                  <option value="#qryGetList[i.value
                                                       #qryGetList[i.displayVar][
                                                  </option>
                                            </cfloop>
                                       </cfif>
                                 </select>
                            <cfelseif i.type is TYPES.RADIO and isDefined("i.xml")>
                                 <cfset xmlNode = i.xml.item>
                                 <cfloop from="1" to="#ArrayLen(xmlNode.xmlc
                                       <cfset item = xmlNode.xmlchildren[idx]>
                                       <input type="radio" name="#i.varname#" value="#item.xmlattributes
                                 </cfloop>
                            <cfelseif i.type is TYPES.CATEGORY>
                                 <!--- Donny: if the formdata item have query associated to it, use it. (needed by Journal.cfc) --->
                                 <cfif isDefined("i.query") and isQuery(i.query)>
                                       <cfset qryCategory = i.query>
                                 <cfelse>
                                       <cfset category = createObject("component", "hb50.category").init(this
                                       <cfset qryCategory = category.getCategories(for
                                 </cfif>
                                 <cfset addnew = ((not isDefined("i.addnew")) or i.addnew)>
                                 <div id="#i.varname#_view">
                                       <select class="formTextbox" id="#i.varname#_select" name="#i.varname#" style="width:#width#px; height:18; z-index:1;"<cfif addnew> onchange="#i.varname#_addn
                                            <option value="">#translate("Pleas
                                            <cfif addnew>
                                                  <option value="">#translate("Add a new #LCase(i.title)#")#</optio
                                            </cfif>
                                            <cfloop query="qryCategory">
                                                  <option value="#intID#"<cfif value is intID> selected</cfif>>#qryCatego
                                            </cfloop>
                                       </select>
                                 </div>
                                 <cfif addnew>
                                       <div id="#i.varname#_add" style="display: none; width: #width-15#">                                            Â
                                            <input id="#i.varname#_add_title"
                                       </div>
                                       <script language='Javascript'>
                                            function #i.varname#_addnew() {
                                                  if (document.getElementById('
                                                       document.getElementById('#
                                                  else {
                                                       document.getElementById('#
                                                       document.getElementById('#
                                                  }
                                            }
                                       </script>
                                 </cfif>
                            <cfelseif i.type is TYPES.UPLOAD>
                                 <!--- it's up to you to process this form element, since its outcome is always so custom --->
                                 <input class="formTextarea" style="width: #width#px;" type="file" id="#i.varname#_text" name="#i.varname#" size="21" maxlength="1000" onChange="document.getElem
                                 <cfif isDefined("i.preview") and Len(Trim(i.preview))>
                                       <div style="padding-top:5px;">#
                                 </cfif>
                                 <input type="hidden" id="#i.varname#_strFile_id
                            <cfelseif i.type is TYPES.FEATURED>
                                 <cfif value is 1>
                                       <input type="hidden" name="blnFeatured" value="on">
                                       <b>#translate("THIS ITEM IS FEATURED.")#</b>
                                 <cfelse>
                                       <input type="checkbox" name="blnFeatured">
                                 </cfif>
                            <cfelseif i.type is TYPES.MEMO>
                                 <textarea id="#i.varname#_text" class="formTextarea" name="#i.varname#" wrap="PHYSICAL" style="width:<cfif isDefined("i.memoW") and Val(i.memoW)>#i.memoW#<cfe
                            <cfelseif i.type is TYPES.HTML>
                                 <cfif true or SESSION.richText>
                                       <cfsavecontent variable="toolbar">
                                            <cf_htmltoolbar name="#i.varname#" datasource="#this.datasour
                                       </cfsavecontent>
                                       #getToolbarLayer(toolbar)#
                                       <cf_htmleditarea name="#i.varname#" class="formTextarea" qryname="#this.qryCompany#
                                 <cfelse>
                                       #getToolbarLayer('<div align="center">#this.langu
                                       <textarea cols="37" class="formTextarea" name="#i.varname#" rows="8" wrap="PHYSICAL" style="width:545px; height:263px;">#value#</te
                                 </cfif>
                                Â
                            <!--- Donny:  display list items e.g. meta data list (didn't modify this) --->
                            <cfelseif i.type is TYPES.LIST>
                                 <style type="text/css">
                                 <!--
                                       .item {
                                            position: relative;
                                            width:522px;
                                            left: 1px;
                                            float: left;
                                            border-left: 1px solid ##999999;;
                                            border-right: 1px solid ##999999;;
                                            border-bottom: 1px solid ##999999;;
                                       }
                                 -->
                                 </style>
                                 <div style="position: absolute; top: -43px; left: 0px; z-index: 10;">
                                       <!--- Donny: Metatag Button & List -
                                                   - no add row
                                                   - show metatag template button (depends on flag set on e.g. /hb50/internal/webcontrol.
                                       <cfif isDefined("formData.blnMet
                                            <input type="reset" name="btnDelete_#i.varname
                                            <input type="reset" name="btnMetaTag_#i.varnam
                                       <cfelse>
                                            <!--- Donny: Normal List - allow add / remove delete row --->
                                            <input type="reset" value="#translate("Add Row")#" onclick="return newItem_#i.varname#();" class="buttons">
                                            <input type="reset" name="btnDelete_#i.varname
                                       </cfif>
                                 </div>
                                 <div id="header" style="position:absolute; visibility:visible; left:1px; top:1px; width:540px; height:20px; z-index:2;">#i.headerText#
                                 <div id="list_#i.varname#" style="position: absolute; top: 22; left: 0; overflow: scroll; width:541px; height:241px;" ></div>
                                 #getListColumn(i.listHTML,
                            <cfelseif i.type is TYPES.HIDDEN>
                                 <input type="hidden" name="#i.varname#" value="#value#">
                            <cfelseif i.type is TYPES.CUSTOM>
                                 #i.html#
                            <cfelseif i.type is TYPES.DATERANGE>
                                 #getFormItem(TYPES.DATERAN
                            </cfif>
                                 </td>
                             </tr>
                            </cfif>
                       </table>
                       </div>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
      <!--- turns a string formatted like
                 "value1,value2,value3
                  value1,value2,value3
                  value1,value2,value3"
            into a query with rows & columns (column names taken from collist)
      --->     Â
      <cffunction name="listColumnToQuery" access="public" returntype="query" output="false">
           <cfargument name="result" type="string" required="true">
           <cfargument name="collist" type="string" required="true">
           <cfset var query = QueryNew(collist)>
           <cfloop list="#result#" delimiters="#CHR(13)##CHR(
                 <!--- ignore incomplete records --->
                 <cfif ListLen(collist) lte ListLen(record)>
                      <cfset QueryAddRow(query)>
                      <cfif ListLen(collist) is 2> <!--- modified to support value that contains commas - only work for 2 columns --->
                            <cfset QuerySetCell(query, ListFirst(collist), Trim(ListFirst(record)))>
                            <cfset QuerySetCell(query, ListRest(collist), Trim(ListRest(record)))>
                      <cfelse>
                            <cfloop from="1" to="#ListLen(collist)#" index="i">
                                 <cfset QuerySetCell(query, ListGetAt(collist, i), Trim(ListGetAt(record, i)))>
                            </cfloop>
                      </cfif>
                 </cfif>
           </cfloop>
           <cfreturn query />
      </cffunction>
      <cffunction name="getListColumn" access="public" returntype="string" output="false">
           <cfargument name="listHTML" type="any" required="true">
           <cfargument name="editHTML" type="any" required="true">
           <cfargument name="divName" type="any" required="true">
           <cfargument name="collist" type="any" required="true">
           <cfargument name="varname" type="any" required="true">
           <cfargument name="value" type="any" required="true">
           <cfargument name="formName" type="any" required="true">
           <cfsavecontent variable="output">
                 <cfoutput>
                      <input type="hidden" name="#varname#" value="#value#">
                      <script>
                      //<!--
                            var saveDelay_#varname# = false;
                            var idEdited_#varname# = '';
                            var dataObj_#varname# = new Object();
                            var idCount_#varname# = #ListLen(value, '#CHR(13)##CHR(10)#') + 1#;
     Â
                            <cfloop from="1" to="#ListLen(value, '#CHR(13)##CHR(10)#')#" index="i">
                                 dataObj_#varname#['#varnam
                                 <cfif ListLen(collist) is 2> //modified to support value that contains commas - only work for 2 columns
                                       dataObj_#varname#['#varnam
                                       dataObj_#varname#['#varnam
                                 <cfelse>
                                       <cfloop from="1" to="#ListLen(collist)#" index="j">
                                            dataObj_#varname#['#varnam
                                       </cfloop>
                                 </cfif>
                            </cfloop>
     Â
                            function getItemDisplay_#varname# (id) {
                                 var item = dataObj_#varname#[id];
                                 return ''
                                       <cfloop from="1" to="#ListLen(collist)#" index="i">
                                            <cfset col = ListGetAt(collist, i)>
                                            + '#JSStringFormat(ListGetAt
                                            + item.#col#
                                            + '#JSStringFormat(ListGetAt
                                       </cfloop>
                                            ;
                            }
     Â
                            function removeItem_#varname#() {
                                 if (idEdited_#varname# == '') {
                                       alert("#translate('Click an item to edit/delete')#");
                                       return false;
                                 }
                                 var obj = document.getElementById(id
                                 delete(dataObj_#varname#[i
                                 obj.outerHTML = '';
                                 idEdited_#varname# = '';
                                 updateHiddenField_#varname
                                 return false;
                            }
     Â
                            function saveItem_#varname#() {
                                 if (idEdited_#varname# == '') {
                                       return false;
                                 }
                                 var obj = document.getElementById(id
                                 <cfloop list="#collist#" index="col">
                                       dataObj_#varname#[idEdited
                                 </cfloop>
                                 obj.outerHTML = dataObj_#varname#[idEdited
                                 idEdited_#varname# = '';
                                 updateHiddenField_#varname
                                 return false;
                            }
     Â
                            function newItem_#varname#() {
                                 var divlist = document.getElementById('#
                                 var newID = '#varname#_' + idCount_#varname#++ + '';
                                 if (idEdited_#varname# != '') {
                                       saveItem_#varname#();
                                 }
                                 dataObj_#varname#[newID] = new Object();
                                 <cfloop list="#collist#" index="col">
                                       dataObj_#varname#[newID].#
                                 </cfloop>
                                 dataObj_#varname#[newID].i
                                 divlist.innerHTML += '<div id="' + newID + '" class="item" onclick="editItem_#varname
                                 updateHiddenField_#varname
                                 editItem_#varname#(documen
                                 return false;
                            }
     Â
                            // Donny: callback from Meta Data Template Modal Dialog
                            function newMetaTagItem_#varname#(m
                                 if (metaTagName.length && metaTagContent.length) {
                                       var divlist = document.getElementById('#
                                       var newID = '#varname#_' + idCount_#varname#++ + '';
                                       if (idEdited_#varname# != '') {
                                            saveItem_#varname#();
                                       }
                                       dataObj_#varname#[newID] = new Object();
     Â
                                       // Donny: assign Name and Content to according column in #collist#
                                       <cfloop list="#collist#" index="col">
                                            <cfswitch expression="#col#">
                                                  <cfcase value="txtMetaType">
                                                       dataObj_#varname#[newID].#
                                                  </cfcase>
                                                  <cfcase value="txtMetaName">
                                                       dataObj_#varname#[newID].#
                                                  </cfcase>
                                                  <cfdefaultcase>
                                                       dataObj_#varname#[newID].#
                                                  </cfdefaultcase>
                                            </cfswitch>
                                       </cfloop>
     Â
                                       dataObj_#varname#[newID].i
                                       divlist.innerHTML += '<div id="' + newID + '" class="item" onclick="editItem_#varname
                                       updateHiddenField_#varname
                                       editItem_#varname#(documen
     Â
                                       setTimeout('saveItem_#varn
                                 }
                                 return false;
                            }
     Â
                            // Donny:  popup Meta Tag Modal Dialog
                            function newMetaTag_#varname#(title
                                 showModalDialog('popup/met
                                 return false;
                            }
     Â
                            function editItem_#varname# (obj) {
                                 var innerhtml = obj.innerHTML;
                                 if (idEdited_#varname# != '') {
                                       saveItem_#varname#();
                                 }
                                 idEdited_#varname# = obj.id;
                                 dataObj_#varname#[idEdited
                                 dataObj_#varname#[idEdited
                                 dataObj_#varname#[idEdited
                                 obj.innerHTML = '<cfoutput>#JSStringFormat
                                 obj.onclick = '';
     Â
                                 /*Trying to make it work for FireFox (and failing)
                                 for (var i=0;i < document.#formName#.elemen
                                       var column = document.#formName#.elemen
                                       if (typeof(dataObj_#varname#[
                                            column.value = dataObj_#varname#[idEdited
                                            if (column.addEventListener) {
                                                  column.addEventListener('b
                                                  column.addEventListener('f
                                            } else {
                                                  column.onblur = function () { saveDelay_#varname# = true; setTimeout('if (saveDelay_#varname#) saveItem_#varname#();', 100) };
                                                  column.onfocus = function () { saveDelay_#varname# = false; };
                                            }
                                       } else {
                                            alert(column.name);
                                       }
                                 }
                                 */
                                 <cfloop list="#collist#" index="col">
                                       document.#formName#.#col#.
                                       document.#formName#.#col#.
                                       document.#formName#.#col#.
                                 </cfloop>
     Â
                                 //setTimeout('document.#fo
                            }
     Â
                            function editItem2_#varname# (obj) {
                                 var innerhtml = obj.innerHTML;
                                 alert('#varname#');
                                 if (idEdited_#varname# != '') {
                                       saveItem_#varname#();
                                 }
     Â
                                 idEdited_#varname# = obj.id;
                                 dataObj_#varname#[idEdited
                                 dataObj_#varname#[idEdited
                                 dataObj_#varname#[idEdited
                                 obj.innerHTML = '<cfoutput>#JSStringFormat
     Â
                                 obj.onclick = '';
                                 <cfloop list="#collist#" index="col">
                                       document.#formName#.#col#.
                                       document.#formName#.#col#.
                                       document.#formName#.#col#.
                                 </cfloop>
                            }
     Â
                            function updateHiddenField_#varname
                                 var field = document.#formName#.#varna
                                 var str = '';
                                 for (var k in dataObj_#varname#) {
                                       str +=
                                            <cfloop from="1" to="#ListLen(collist)#" index="j">
                                                  <cfset col = ListGetAt(collist, j)>
                                                  (dataObj_#varname#[k].#col
                                            </cfloop>
                                            '\n';
                                 }
                                 field.value = str;
                            }
     Â
                            var divlist = document.getElementById('#
                            for (var k in dataObj_#varname#) {
                                 divlist.innerHTML += '<div id="' + k + '" class="item" onclick="editItem_#varname
                            }
                            updateHiddenField_#varname
                      //-->
                      </script>
                 </cfoutput>
           </cfsavecontent>
          Â
           <cfreturn output />
      </cffunction>
      <!--- returns the display for TYPES.MEDIA and TYPES.DATE --->
      <cffunction name="getFormItem" access="public" returntype="string" output="false">
           <cfargument name="type" type="any" required="true">
           <cfargument name="varname" type="any" required="true">
           <cfargument name="value" type="any" required="true">
           <cfargument name="options" type="string" required="false" default="">
           <cfargument name="width" type="numeric" required="false" default="225">
                     Â
           <cfscript>
                 var media = '';
                 var qryGetMedia = '';
                 var qryGetMediaCategory = '';
                 var qryGetMediaSorted = '';
                Â
                 var lastCat = -1;
                 var mediacount = 0;
                 var dtStart = '';
                 var chkStart = true;
                 var dtEnd = '';
                 var chkEnd = true;
           </cfscript>
           <cfsavecontent variable="output">
                 <cfoutput>
                      <!--- DATE --->
                      <cfif arguments.type is TYPES.DATE>
                            <!--- date always has a default of now (due to the flash movie) --->
                            <cfif not isDate(arguments.value)>
                                 <cfset arguments.value = now()>
                            </cfif>
                            <script type="text/javascript" src="js/swfobject.js"></sc
                                Â
                            <div id="#arguments.varname#_fl
                                 <input class="formTextbox" type="hidden" id="#arguments.varname#_hi
                                 <div id="#arguments.varname#_da
                                 </div>
                                 <script type="text/javascript">
                                       //not needed unless you want to reference the flash movie object later
                                       //var InternetExplorer = navigator.appName.indexOf(
                                      Â
                                       // Handle all the the FSCommand messages in a Flash movie. Uncomment
                                       function #arguments.varname#flashOb
                                            //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('#
                                       }
                                       // Hook for Internet Explorer
                                       if (navigator.appName && navigator.appName.indexOf(
                                             navigator.userAgent.indexO
                                       {
                                            document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                            document.write('on error resume next \n');
                                            document.write('Sub #arguments.varname#flashOb
                                            document.write('  call #arguments.varname#flashOb
                                            document.write('end sub\n');
                                            document.write('</SCRIPT\>
                                       }     Â
                                   var so = new SWFObject("flash/weekview.
                                   <cfif IsDate(arguments.value)>
                                        so.addVariable("day","#Day
                                        so.addVariable("month","#M
                                        so.addVariable("year","#Ye
                                   </cfif>
                                   so.write("#arguments.varna
                                 </script>
                            </div>
                           Â
                      <!--- DATERANGE --->     Â
                      <cfelseif arguments.type is TYPES.DATERANGE>
                            <cfscript>
                                 //parse the date value pair ('dtStart, dtEnd')
                                 dtStart = ListFirst(arguments.value,
                                 dtEnd = ListLast(arguments.value, ',');
                                Â
                                 if (Left(dtStart, 1) is 'e')
                                       dtEnd = Right(dtEnd, Len(dtEnd) - 1);
                                 else if (Left(dtEnd, 1) is 's')
                                       dtStart = Right(dtStart, Len(dtStart) - 1);
                                 else if (Len(dtStart) and Len(dtEnd)) {
                                       dtStart = Right(dtStart, Len(dtStart) - 1);
                                       dtEnd = Right(dtEnd, Len(dtEnd) - 1);
                                 }
                                Â
                                 if (not isDate(dtStart)) { dtStart = now(); chkStart = false; }
                                 if (not isDate(dtEnd)) { dtEnd = now(); chkEnd = false; }
                            </cfscript>
                            <script type="text/javascript" src="js/swfobject.js"></sc
                            <script>
                                 function #arguments.varname#_dtStar
                                       var element = document.getElementById('#
                                       //var element_chk = document.getElementById('#
                                      Â
                                       if (element) {
                                            var dtArray = element.value.split(',');
                                            //alert(element.value);
                                            //alert(dtArray.length);
                                            //alert(document.frmAddEdi
                                           Â
                                            //if (dtArray.length == 2)
                                                  element.value = month + '/' + day + '/' + year + ',' + dtArray[1];
                                            //else
                                            //      element.value = month + '/' + day + '/' + year + ',null';
                                       }
                                 }
                                Â
                                 function #arguments.varname#_dtEnd_
                                       var element = document.getElementById('#
                                       //var element_chk = document.getElementById('#
                                      Â
                                       if (element) {
                                            var dtArray = element.value.split(',');
                                            //alert(element.value);
                                            //alert(dtArray.length);
                                           Â
                                            //if (dtArray.length == 1)
                                            //      element.value = 'null,' + month + '/' + day + '/' + year;
                                            //else
                                                  element.value = dtArray[0] + ',' + month + '/' + day + '/' + year;
                                       }
                                 }                                 Â
                            </script>
                           Â
                            <font color="black">start:</font
                            <div id="#arguments.varname#_dt
                                 <input name="#arguments.varname#_
                                 <div id="#arguments.varname#_st
                                 </div>
                                 <script type="text/javascript">
                                       //not needed unless you want to reference the flash movie object later
                                       //var InternetExplorer = navigator.appName.indexOf(
                                      Â
                                       // Handle all the the FSCommand messages in a Flash movie. Uncomment
                                       function #arguments.varname#dtStart
                                            //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(
                                       }
                                       // Hook for Internet Explorer
                                       if (navigator.appName && navigator.appName.indexOf(
                                             navigator.userAgent.indexO
                                       {
                                            document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                            document.write('on error resume next \n');
                                            document.write('Sub #arguments.varname#dtStart
                                            document.write('  call #arguments.varname#dtStart
                                            document.write('end sub\n');
                                            document.write('</SCRIPT\>
                                       }     Â
                                   var so = new SWFObject("flash/weekview.
                                   so.addVariable("day","#Day
                                   so.addVariable("month","#M
                                   so.addVariable("year","#Ye
                                   so.write("#arguments.varna
                                 </script>                                 Â
                            </div>
                            <font color="black">end:</font><
                            <div id="#arguments.varname#_dt
                                 <input name="#arguments.varname#_
                                 <div id="#arguments.varname#_en
                                 </div>
                                 <script type="text/javascript">
                                       //not needed unless you want to reference the flash movie object later
                                       //var InternetExplorer = navigator.appName.indexOf(
                                      Â
                                       // Handle all the the FSCommand messages in a Flash movie. Uncomment
                                       function #arguments.varname#dtEndfl
                                            //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(
                                       }
                                       // Hook for Internet Explorer
                                       if (navigator.appName && navigator.appName.indexOf(
                                             navigator.userAgent.indexO
                                       {
                                            document.write('<SCRIPT LANGUAGE=VBScript\> \n');
                                            document.write('on error resume next \n');
                                            document.write('Sub #arguments.varname#dtEndfl
                                            document.write('  call #arguments.varname#dtEndfl
                                            document.write('end sub\n');
                                            document.write('</SCRIPT\>
                                       }     Â
                                   var so = new SWFObject("flash/weekview.
                                   so.addVariable("day","#Day
                                   so.addVariable("month","#M
                                   so.addVariable("year","#Ye
                                   so.write("#arguments.varna
                                 </script>
                            </div>
                            <input class="formTextbox" type="hidden" id="#arguments.varname#_hi
                     Â
                      <!--- MEDIA --->
                      <cfelseif arguments.type is TYPES.MEDIA>
                            <cfset media = createObject('component', 'hb50.media').init(this.Co
                            <cfset qryGetMedia = media.getMediaByExt(argume
                           Â
                            <cfquery name="qryGetMediaCategory"
                                 SELECT DISTINCT intCategoryID, txtCategory
                                 FROM       qryGetMedia
                                 ORDER BY txtCategoryNoCase, intCategoryID
                            </cfquery>
                           Â
                            <cfquery name="qryGetMediaSorted" dbtype="query">
                                 SELECT       *
                                 FROM       qryGetMedia
                                 ORDER BY txtCategoryNoCase, intCategoryID
                            </cfquery>
                           Â
                            <script name="javascript">
                                 var pdfs#arguments.varname# = new Array();
                                 var defaultpdftext#arguments.v
                                 var defaultpdfvalue#arguments.
          Â
                                 <cfloop query="qryGetMediaSorted">
                                       <cfif lastCat neq intCategoryID>
                                            <cfif lastCat neq -1>
                                                  null];
                                            </cfif>
                                            <cfset mediacount = mediacount + 1>
                                            <cfset lastCat = intCategoryID>
                                            pdfs#arguments.varname#[#m
                                        </cfif>
                                       '#replace(txtTitle, "'", "\'", "ALL")#','#intID#',
                                 </cfloop>
                                 <cfif qryGetMedia.recordCount neq 0>
                                       null];
                                 </cfif>
          Â
                                 function PDFUpdate#arguments.varnam
                                       var curValue = selCat.selectedIndex;
                                        var list = pdfs#arguments.varname#[cu
          Â
                                       if (!defaultpdftext#arguments
                                              for (var i=0; i< selPDF.length; i++) {
                                                  defaultpdftext#arguments.v
                                                  defaultpdfvalue#arguments.
                                             }
                                        }
          Â
                                        while (selPDF.options.length)
                                              selPDF.options[0] = null;
          Â
                                        if (curValue <= 0) {
                                            for(var i=0; i<defaultpdftext#arguments
                                                  selPDF.options[i] = new Option(defaultpdftext#argu
                                             return;
                                        }
          Â
                                        selPDF.options[0] = new Option('#translate("Select
                                        selPDF.options[1] = new Option('#translate("Add a new resource")#...', "");
                                        for(var i=0; i<list.length - 1; i+=2)
                                        selPDF.options[i/2 + 2] = new Option(list[i],list[i+1]);
                                        selPDF.selectedIndex = 0;
                                        selCat.options[0].text = "All Categories";
                                 }
          Â
                                 function jsNewFile_#arguments.varna
                                       var category = document.getElementById('#
                                       var catid = category.options[category.
                                      Â
                                       if (mySelect.options[mySelect
                                            var link = 'popup/upload_file.cfm?js=
                                            if (window.showModalDialog)
                                                  showModalDialog(link, window, 'resizable: yes; help: no; status: no; scroll: no; ');
                                            else
                                                  window.open(link, '', 'help=no,resizable=yes,scr
                                       }
                                 }
          Â
                                 function jsAddFile_#arguments.varna
                                       var newoption = new Option(title, id);
                                       var selobj = document.getElementById('#
                                       selobj.options[selobj.opti
                                       selobj.selectedIndex = selobj.options.length - 1;
                                       selobj.value = id;
                                 }
                            </script>
                           Â
                            <select class="formTextbox" style="width: #width#px;" name="#arguments.varname#_
                                 <option value="">#translate("Selec
                                 <cfloop query="qryGetMediaCategory
                                       <option value="#qryGetMediaCategor
                                 </cfloop>
                            </select>
                            <br>
     Â
                            <div id="#arguments.varname#_pi
                                 <select class="formTextbox" name="#arguments.varname#"
                                       <option value="">#translate("Selec
                                       <cfif SESSION.blnAddResource>
                                            <option value="">#translate("Add a new resource")#...</option>
                                       </cfif>
                                       <cfloop query="qryGetMedia">
                                            <option value="#intID#"<cfif value is intID> selected</cfif>>#txtTitle#
                                       </cfloop>
                                 </select>
                            </div>
                      </cfif>
                 </cfoutput>
           </cfsavecontent>
           <cfreturn output />
      </cffunction>
</cfcomponent>
ASKER
I am getting the error : Database Exception - in C:\Hotbanana\hb50\display. cfc : line 2795
     Error Executing Database Query.
which I think has something to do with SP the it converts the string maybe some single quotes preventing the query from execution. I do not know. Also I did not find anything suspisious in the log files. It was a few error saying that the very few parameters were provided in the SP. , but that was a while ago
     Error Executing Database Query.
which I think has something to do with SP the it converts the string maybe some single quotes preventing the query from execution. I do not know. Also I did not find anything suspisious in the log files. It was a few error saying that the very few parameters were provided in the SP. , but that was a while ago
When you have a database error there is usually a database error code returned with the error message. It would help if you cold turn on full debugging in coldfusion adminstrator and post the error information that is being returned from the database.
ASKER
this is the exact error I am getting I checked the logs and did not find anything related. I can also supply the stored procedures that I wrote maybe the error there but I tested them inquery analizer and they work just fine
 Database Exception - in C:\Hotbanana\hb50\display. cfc : line 2795
     Error Executing Database Query.
 Database Exception - in C:\Hotbanana\hb50\display.
     Error Executing Database Query.
put this code where the current query is on line 2795. run it and then post the results of the errorinfo.txt file. It should give us some more details to work with.
<cftry>
<cfquery name="qryGetList" datasource="#this.datasour ce#" cachedwithin="#this.queryC ache#">
   #PreserveSingleQuotes(i.qu ery)#
</cfquery>
<cfcatch type="Database">
<cfsavecontent variable="ErrorInfo">
Path: Â Â Â Â Â #cgi.path_translated#
Type: Â Â Â Â Â #cfcatch.type#
Message: Â Â Â Â #cfcatch.message# Â Â Â Â Â Â Â Â Â Â Â
<cfif isdefined("cfcatch.nativee rrorcode") >
Error Code: Â Â #cfcatch.nativeerrorcode#
</cfif>
<cfif isdefined("cfcatch.sqlstat e")>
SQL State: Â Â Â #cfcatch.sqlstate#
SQL: #cfcatch.Sql#
Database Error Message: #cfcatch.queryError#
</cfif>
Detail: Â Â Â Â #cfcatch.detail#
Template: #cfcatch.tagcontext[1].TEM PLATE# LINE:#cfcatch.tagcontext[1 ].LINE#
</cfsavecontent>
<cffile action = "write" file = "c:\ErrorInfo.txt" output="#ErrorInfo#">
<cfrethrow>
</cfcatch>
</cftry>
<cftry>
<cfquery name="qryGetList" datasource="#this.datasour
   #PreserveSingleQuotes(i.qu
</cfquery>
<cfcatch type="Database">
<cfsavecontent variable="ErrorInfo">
Path: Â Â Â Â Â #cgi.path_translated#
Type: Â Â Â Â Â #cfcatch.type#
Message: Â Â Â Â #cfcatch.message# Â Â Â Â Â Â Â Â Â Â Â
<cfif isdefined("cfcatch.nativee
Error Code: Â Â #cfcatch.nativeerrorcode#
</cfif>
<cfif isdefined("cfcatch.sqlstat
SQL State: Â Â Â #cfcatch.sqlstate#
SQL: #cfcatch.Sql#
Database Error Message: #cfcatch.queryError#
</cfif>
Detail: Â Â Â Â #cfcatch.detail#
Template: #cfcatch.tagcontext[1].TEM
</cfsavecontent>
<cffile action = "write" file = "c:\ErrorInfo.txt" output="#ErrorInfo#">
<cfrethrow>
</cfcatch>
</cftry>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I inserted the code above, however It does not create a file ErrorInfo.txt
ASKER
And I also wondering if this query will be executed
<cfquery name="qryGetList" datasource="#this.datasour ce#" >
   #PreserveSingleQuotes(i.qu ery)#
</cfquery>
<cfquery name="qryGetList" datasource="#this.datasour
   #PreserveSingleQuotes(i.qu
</cfquery>
Is cffile disabled on your server?
Try setting the cfcatch tag to type="Any":
<cftry>
<cfquery name="qryGetList" datasource="#this.datasour ce#" cachedwithin="#this.queryC ache#">
   #PreserveSingleQuotes(i.qu ery)#
</cfquery>
<cfcatch type="Any">
<cfoutput>
<cfsavecontent variable="ErrorInfo">
Path: Â Â Â Â Â #cgi.path_translated#
Type: Â Â Â Â Â #cfcatch.type#
Message: Â Â Â Â #cfcatch.message# Â Â Â Â Â Â Â Â Â Â Â
<cfif isdefined("cfcatch.nativee rrorcode") >
Error Code: Â Â #cfcatch.nativeerrorcode#
</cfif>
<cfif isdefined("cfcatch.sqlstat e")>
SQL State: Â Â Â #cfcatch.sqlstate#
SQL: #cfcatch.Sql#
Database Error Message: #cfcatch.queryError#
</cfif>
Detail: Â Â Â Â #cfcatch.detail#
Template: #cfcatch.tagcontext[1].TEM PLATE# LINE:#cfcatch.tagcontext[1 ].LINE#
</cfsavecontent>
</cfoutput>
<cffile action = "write" file = "c:\ErrorInfo.txt" output="#ErrorInfo#">
<cfrethrow>
</cfcatch>
</cftry>
Try setting the cfcatch tag to type="Any":
<cftry>
<cfquery name="qryGetList" datasource="#this.datasour
   #PreserveSingleQuotes(i.qu
</cfquery>
<cfcatch type="Any">
<cfoutput>
<cfsavecontent variable="ErrorInfo">
Path: Â Â Â Â Â #cgi.path_translated#
Type: Â Â Â Â Â #cfcatch.type#
Message: Â Â Â Â #cfcatch.message# Â Â Â Â Â Â Â Â Â Â Â
<cfif isdefined("cfcatch.nativee
Error Code: Â Â #cfcatch.nativeerrorcode#
</cfif>
<cfif isdefined("cfcatch.sqlstat
SQL State: Â Â Â #cfcatch.sqlstate#
SQL: #cfcatch.Sql#
Database Error Message: #cfcatch.queryError#
</cfif>
Detail: Â Â Â Â #cfcatch.detail#
Template: #cfcatch.tagcontext[1].TEM
</cfsavecontent>
</cfoutput>
<cffile action = "write" file = "c:\ErrorInfo.txt" output="#ErrorInfo#">
<cfrethrow>
</cfcatch>
</cftry>
you may want to remove the cachedwithin attribute from the cfquery tag as well temporarily so that the query get executed.
ASKER
OK . I got the errorInfoLog.txt. from there It says Incorect syntax near 'DIVISION' Line 1. Here is my Stored procedure. I do not know what is wrong with it
CREATE PROCEDURE dbo.qryCourseNumbers @AY varchar(6), @dept varchar(20), @dept2 varchar(20) AS
delete from tmpCourseNumbers
insert into tmpCourseNumbers
select distinct c.courseid, left(c.coursenumber,3)+'.' +right(c.c oursenumbe r,3)+' '+replace(c.coursetitle, "Â ' ", "Â '' ") as coursename, division
from courseschedule.dbo.tblcour seinformat ion c inner join courseschedule.dbo.vw_cour ses_and_de partments v
on c.courseid = v.courseid
where c.academicyear=@AY and (v.division=@dept or v.division=@dept2) and c.includeincatalog=-1 and (substring(c.coursenumber, 4,1) <>Â '1' and substring(c.coursenumber,4 ,1) <>Â '2')
select * from tmpCourseNumbers
order by coursename
GO
CREATE PROCEDURE dbo.qryCourseNumbers @AY varchar(6), @dept varchar(20), @dept2 varchar(20) AS
delete from tmpCourseNumbers
insert into tmpCourseNumbers
select distinct c.courseid, left(c.coursenumber,3)+'.'
from courseschedule.dbo.tblcour
on c.courseid = v.courseid
where c.academicyear=@AY and (v.division=@dept or v.division=@dept2) and c.includeincatalog=-1 and (substring(c.coursenumber,
select * from tmpCourseNumbers
order by coursename
GO
can you please post the full errorinfo.txt?
in particular I wan to see the
SQL State: Â Â Â #cfcatch.sqlstate#
SQL: #cfcatch.Sql#
Database Error Message: #cfcatch.queryError#
 portion of it
in particular I wan to see the
SQL State: Â Â Â #cfcatch.sqlstate#
SQL: #cfcatch.Sql#
Database Error Message: #cfcatch.queryError#
 portion of it
ASKER
Path: Â Â Â Â Â D:\DevWeb\hotbanana\tabs.c
Type: Â Â Â Â Â Database
Message: Â Â Â Â Error Executing Database Query. Â Â Â Â Â Â Â Â Â Â Â
Error Code: Â Â 170
Â
SQL State: Â Â Â HY000
SQL:
   [Table (rows 392 columns COURSEID, COURSENAME, DIVISION): [COURSEID: coldfusion.sql.QueryColumn
Database Error Message: [Macromedia][SQLServer JDBC Driver][SQLServer]Line 1: Incorrect syntax near 'DIVISION: coldfusion.sql.QueryColumn
Â
Detail: Â Â Â Â [Macromedia][SQLServer JDBC Driver][SQLServer]Line 1: Incorrect syntax near 'DIVISION: coldfusion.sql.QueryColumn
Template: C:\Hotbanana\hb50\display.
ok so #PreserveSingleQuotes(i.qu ery)# is generating the following string:
[Table (rows 392 columns COURSEID, COURSENAME, DIVISION): [COURSEID: coldfusion.sql.QueryColumn @100a3f8] [COURSENAME: coldfusion.sql.QueryColumn @10d1c6e] [DIVISION: coldfusion.sql.QueryColumn @1c59705] ]
This string is not a valid SQL statement.
If you want to run the stored procedure you posted you would need a string like this to be in that variable:
exec dbo.qryCourseNumbers('2007 ', 'deptvlue', 'dept2value')
this variable seems to be set by what ever code is calling this function.
[Table (rows 392 columns COURSEID, COURSENAME, DIVISION): [COURSEID: coldfusion.sql.QueryColumn
This string is not a valid SQL statement.
If you want to run the stored procedure you posted you would need a string like this to be in that variable:
exec dbo.qryCourseNumbers('2007
this variable seems to be set by what ever code is calling this function.
ASKER
Here is my calling stored procedure
<cfstoredproc datasource='#this.datasour ce#' procedure='qryCourseNumber s'>
                 <cfprocresult name='qryCourseNumbers'>                Â
                 <cfprocparam type='In' cfsqltype='cf_sql_varchar' variable='@AY' value='07-08' null='no'></cfprocparam>
                 <cfswitch expression="#this.companyi d#">
                 <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>     Â
    Â
<cfstoredproc datasource='#this.datasour
                 <cfprocresult name='qryCourseNumbers'>                Â
                 <cfprocparam type='In' cfsqltype='cf_sql_varchar'
                 <cfswitch expression="#this.companyi
                 <cfcase value="2">
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 </cfcase>
                 <cfcase value="9">
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 </cfcase>
                 <cfcase value="10">
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 <cfprocparam type='in' cfsqltype='cf_sql_varchar'
                 </cfcase>
     Â
  </cfswitch>
                 </cfstoredproc>     Â
    Â
I don't see how this stored procedure has anything to do with the problem. Which line is calling the getItemView function? and where is the i.query variable being set?
ASKER
If you look at the code of courseSchedule module that posted before here the set. Also why do we get the error in "division' txt file
<cfscript>
                 this.formData = newFormData();
                 this.formData.columns = xmlDataToArray(this.xmlDat a);
                 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=intCourseI D.options[ intCourseI D.selected Index].tex t;";
                 ArrayPrepend(this.formData .columns, x);     Â
                Â
<cfscript>
                 this.formData = newFormData();
                 this.formData.columns = xmlDataToArray(this.xmlDat
                 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=intCourseI
                 ArrayPrepend(this.formData
                Â
ASKER
You also may wanna check this components because it calls display.cfc components that may explains more
<cfcomponent displayname="workflow" extends="hb50.object">
      <cffunction name="init" access="public" returntype="any" output="false">
           <cfargument name="CompanyID" required="true" type="numeric">           Â
          Â
           <cfset super.init(CompanyID)>
          Â
           <!--- set up global action variables (use like workflowObject.EDIT) --->
           <cfset StructAppend(this, enum("add,save,checkin,app rove,decli ne,edit,de lete,resto re"))>
          Â
           <!--- IF YOU UPDATE THIS STATUS, UPDATE IT IN NAVIGATION!!! --->
           <cfset this.STATUS = enum("active,inactive,pend ing,expire d,lock,una pproved,fe atured,del eted,untra nslated,un shared,clo ned")>
           <cfset this.MAX_VERSIONS = 5>
           <cfreturn this />
      </cffunction>
      <cfscript>
           // define form data for workflow (blnLive, etc.)
           this.workflowData = newFormData();
           this.workflowData.blnExtra Columns = false;
           this.workflowData.columns = ArrayNew(1);
           x = StructNew();
           x.varname = "txtTitle";
           x.title = "The title of this Item";
           x.type = TYPES.TEXT;
           x.required = true;
           ArrayAppend(this.workflowD ata.column s, x);
          Â
           x = StructNew();
           x.varname = "intItemID";
           x.title = "The foreign ID of the associated Item";
           x.type = TYPES.NUMBER;
           x.required = true;
           ArrayAppend(this.workflowD ata.column s, x);
          Â
           x = StructNew();
           x.varname = "intResourceID";
           x.title = "The foreign ID of the additional resources associated with this item";
           x.type = TYPES.NUMBER;
           x.required = true;
           ArrayAppend(this.workflowD ata.column s, x);
          Â
           x = StructNew();
           x.varname = "blnLive";
           x.title = "Is this data live? (only one should be per ItemID)";
           x.type = TYPES.BOOLEAN;
           x.required = true;
           ArrayAppend(this.workflowD ata.column s, x);
           x = StructNew();
           x.varname = "dtAdded";
           x.title = "The date/time this data was added";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.workflowD ata.column s, x);           Â
           x = StructNew();
           x.varname = "dtStart";
           x.title = "The date/time this data is scheduled to start";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.workflowD ata.column s, x);           Â
           x = StructNew();
           x.varname = "dtEnd";
           x.title = "The date/time this data is scheduled to end";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.workflowD ata.column s, x);           Â
           x = StructNew();
           x.varname = "txtMetaKeywords";
           x.title = "Meta data keywords associated with this item";
           x.type = TYPES.MEMO;
           x.required = true;
           ArrayAppend(this.workflowD ata.column s, x);           Â
           x = StructNew();
           x.varname = "txtMetaDescription";
           x.title = "Meta data description associated with this item";
           x.type = TYPES.MEMO;
           x.required = true;
           ArrayAppend(this.workflowD ata.column s, x);           Â
          Â
           x = StructNew();
           x.varname = "intMetaID";
           x.title = "Meta ID";
           x.type = TYPES.SELECT;
           x.required = false;
           ArrayAppend(this.workflowD ata.column s, x);
          Â
           x = StructNew();
           x.varname = "blnNotification";
           x.title = "Send notification?";
           x.type = TYPES.BOOLEAN;
           x.required = true;
           ArrayAppend(this.workflowD ata.column s, x);
          Â
          Â
           // these are columns that should be in non-workflow tables
           this.basicData = newFormData();
           this.basicData.blnExtraCol umns = false;
           this.basicData.columns = ArrayNew(1);
           x = StructNew();
           x.varname = "txtTitle";
           x.title = "The title of this Item";
           x.type = TYPES.TEXT;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);
          Â
           x = StructNew();
           x.varname = "intItemID";
           x.title = "The foreign ID of the associated Item";
           x.type = TYPES.NUMBER;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);
          Â
           x = StructNew();
           x.varname = "blnLive";
           x.title = "Is this data live? (only one should be per ItemID)";
           x.type = TYPES.BOOLEAN;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);
           x = StructNew();
           x.varname = "blnDeleted";
           x.title = "Is this item deleted?";
           x.type = TYPES.BOOLEAN;
           x.required = false;
           ArrayAppend(this.basicData .columns, x);
           x = StructNew();
           x.varname = "intAdminIDAdded";
           x.title = "The Administrator who added this item";
           x.type = TYPES.NUMBER;
           x.required = false;
           ArrayAppend(this.basicData .columns, x);
           x = StructNew();
           x.varname = "dtStart";
           x.title = "The date/time this data is scheduled to start";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);           Â
           x = StructNew();
           x.varname = "dtEnd";
           x.title = "The date/time this data is scheduled to end";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);           Â
           x = StructNew();
           x.varname = "dtAdded";
           x.title = "The date/time this data was added";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);
           x = StructNew();
           x.varname = "dtUpdated";
           x.title = "The date/time this data was last updated";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);
           x = StructNew();
           x.varname = "txtMetaKeywords";
           x.title = "Meta data keywords associated with this item";
           x.type = TYPES.MEMO;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);           Â
           x = StructNew();
           x.varname = "txtMetaDescription";
           x.title = "Meta data description associated with this item";
           x.type = TYPES.MEMO;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);     Â
          Â
           x = StructNew();
           x.varname = "intMetaID";
           x.title = "Meta ID";
           x.type = TYPES.SELECT;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);     Â
           x = StructNew();
           x.varname = "intCategoryID";
           x.title = "The foreign ID from tblNavigation of the category that this belongs to";
           x.type = TYPES.NUMBER;
           x.required = false;
           ArrayAppend(this.basicData .columns, x);
           x = StructNew();
           x.varname = "intCompanyID";
           x.title = "The foreign ID from tblCompany that this belongs to";
           x.type = TYPES.NUMBER;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);
          Â
           x = StructNew();
           x.varname = "blnNotification";
           x.title = "Send notification?";
           x.type = TYPES.BOOLEAN;
           x.required = true;
           ArrayAppend(this.basicData .columns, x);
      </cfscript>
     Â
      <!--- returns query of all data -- containing at least some minimal set of columns --->
      <cffunction name="getQuery" access="public" returntype="query" output="false">
           <cfargument name="formData" type="struct" required="true">
           <cfset verifyColumns(formData)>
           <cfif not formData.blnWorkflow>
                 <cfquery name="qryRecords" datasource="#this.datasour ce#" >
                      SELECT *, intStatusID =
                                       CASE
                                            WHEN #formData.tablename#.blnDe leted = 1 THEN #this.STATUS.DELETED#
                                                                                       Â
                                            <cfif formData.blnScheduling>
                                                  WHEN #formData.tablename#.dtSta rt > #getODBCNow()#
                                                  THEN #this.STATUS.PENDING#
                                                  WHEN #formData.tablename#.dtEnd < #getODBCNow()#
                                                  THEN #this.STATUS.EXPIRED#
                                            </cfif>
                                            ELSE #this.STATUS.ACTIVE#
                                       END
                      FROM #formData.tablename#
                      WHERE (intCompanyID IS NULL OR intCompanyID = #this.CompanyID#)
                 </cfquery>
           <cfelse>
                 <!--- ensure workflow columns are in place --->
                 <cfquery name="qryRecords" datasource="#this.datasour ce#" >
                      SELECT isnull(#formData.tablename #.intItemI D,tblItem. intID) as intItemID,
                                 <cfif formData.blnCategory>
                                   isnull(isnull(#formData.ta blename#.i ntCategory ID, tblItem.intCategoryID), 0) as intCategoryID,
                                 </cfif>
                             #formData.tablename#.*,
                             tblItem.*,
                             intStatusID =
                                       CASE
                                            WHEN tblItem.blnDeleted = 1 THEN #this.STATUS.DELETED#
                                            <cfif formData.blnApproval>
                                                  WHEN tblItem.blnApproved = 0 THEN #this.STATUS.UNAPPROVED#
                                            </cfif>
                                            WHEN tblItem.blnNeedsTranslatio n = 1 THEN #this.STATUS.UNTRANSLATED#
                                            WHEN #formData.tablename#.intID IS NULL THEN #this.STATUS.INACTIVE#
                                           Â
                                            <cfif formData.blnLock>
                                                  WHEN tblItemLock.intID IS NOT NULL THEN #this.STATUS.LOCK#
                                            </cfif>
                                            <cfif formData.blnScheduling>
                                                  WHEN #formData.tablename#.dtSta rt > #getODBCNow()#
                                                  THEN #this.STATUS.PENDING#
                                                  WHEN #formData.tablename#.dtEnd < #getODBCNow()#
                                                  THEN #this.STATUS.EXPIRED#
                                            </cfif>
                                            ELSE #this.STATUS.ACTIVE#
                                       END
                      FROM tblItem
                      LEFT JOIN #formData.tablename# ON
                            tblItem.intID = #formData.tablename#.intIt emID
                            AND #formData.tablename#.intID IN
                             (SELECT TOP 1 intID
                                 FROM #formData.tablename#
                                 WHERE intItemID = tblItem.intID
                                 <!--- ORDER BY blnLive DESC, dtAdded DESC) --->
                                 ORDER BY dtAdded DESC)
                      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.intWebID = #val(formData.webid)#
                      AND tblItem.intDataType = #val(formData.datatype)#
                      AND tblNavigation.intCompanyID = #this.CompanyID#
                      <cfif formData.blnCategory and not session.superuser>
                            AND #formData.tablename#.intCa tegoryID IN (
                                  SELECT intNavID
                                  FROM tblAccessNav
                                  WHERE intUserID = #session.userid#
                            )
                      </cfif>
                       ORDER BY
                            <cfif formData.blnOrder>
                                 tblItem.intOrder
                            <cfelse>
                                 #formData.tablename#.#form Data.sortc olumn# #formData.sortdirection#
                            </cfif>
                 </cfquery>
           </cfif>
          Â
           <cfreturn qryRecords />           Â
      </cffunction>
      <!--- returns query of all publicly accessible data --->
      <cffunction name="getPublicQuery" access="public" returntype="query" output="false">
           <cfargument name="formData" type="struct" required="true">
           <cfset var qryRecords = "">
           <cfif not formData.blnWorkflow>
                 <cfset verifyColumns(formData)>
                 <cfquery name="qryRecords" datasource="#this.datasour ce#" >
                      SELECT *
                      FROM #formData.tablename#
                      WHERE (intCompanyID IS NULL OR intCompanyID = #this.CompanyID#)
                      <cfif formData.blnRestore>
                            AND blnDeleted = 0
                      </cfif>
                      ORDER BY #formData.tablename#.#form Data.sortc olumn# #formData.sortdirection#
                 </cfquery>
                 <cfreturn qryRecords />
           <cfelse>
                 <!--- ensure workflow columns are in place --->
                 <cfset verifyColumns(formData)>
                 <cfquery name="qryRecords" datasource="#this.datasour ce#" >
                      SELECT tblItem.intWebID,
                            <cfif formData.blnCategory>
                             isnull(isnull(tblItem.intC ategoryID, #formData.tablename#.intCa tegoryID), 0) AS intCategoryID,
                            </cfif>
                             #formData.tablename#.*,
                             tblItem.*
                      FROM tblItem
                      INNER JOIN #formData.tablename# ON
                            tblItem.intID = #formData.tablename#.intIt emID
                            AND #formData.tablename#.blnLi ve = 1
                            <!--- AND tblItem.blnApproved = 1 --->
                      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(formData.datatype)#
                      AND tblNavigation.intCompanyID = #this.CompanyID#
                      AND tblItem.blnDeleted = 0
                      AND tblItem.intWebID = #Val(formData.webid)#
                      <cfif formData.blnScheduling>
                            AND (#formData.tablename#.dtSt art IS NULL OR #formData.tablename#.dtSta rt <= #getODBCNow()#)
                            AND (#formData.tablename#.dtEn d IS NULL OR #formData.tablename#.dtEnd >= #getODBCNow()#)
                      </cfif>
                       ORDER BY
                            <cfif formData.blnOrder>
                                 tblItem.intOrder
                            <cfelse>
                                 #formData.tablename#.#form Data.sortc olumn# #formData.sortdirection#
                            </cfif>
                 </cfquery>
                 <cfreturn qryRecords />
                Â
                 <!---
                      Jason: replaced this selectFrom function call with this line above 'AND tblItem.intWebID = #Val(formData.webid)#'
                      - reason being that the old way is bringing back every single row from the table and perform a query on query in memory to select the single row based on the webid
                      - the old way was just overkill
                      - the new ways would speed up this query significantly
                     Â
                      <cfreturn selectFrom(qryRecords, "intWebID", val(formData.webid)) /> --->
           </cfif>
      </cffunction>
     Â
      <cffunction name="hasPrivileges" access="public" returntype="boolean">
           <cfargument name="formData" type="any" required="true">
          Â
           <cfif SESSION.superuser>
                 <cfreturn true/>
           </cfif>
          Â
           <!--- see if we have workflow setup for this page --->
           <cfquery name="qryMods" datasource="#this.datasour ce#">
                 SELECT intID
                 FROM tblModerator
                 WHERE intNavID = #formData.webid#
           </cfquery>
          Â
           <cfif not qryMods.recordCount>
                 <cfreturn true />
           </cfif>
          Â
           <cfquery name="qryAccess" datasource="#this.datasour ce#">
                 SELECT tblModerator.intID
                 FROM tblModerator
                 JOIN tblUserGroup ON tblUserGroup.intGroupID = tblModerator.intModeratorI D
                 JOIN tblUser ON tblUserGroup.intUserID = tblUser.intID
                 WHERE tblUser.intID = #session.userid#
                 AND tblModerator.intNavID = #formData.webid#
           </cfquery>
          Â
           <cfif qryAccess.recordCount>
                 <cfreturn true />
           </cfif>
          Â
           <cfreturn false />
      </cffunction>
      <!--- calls doAction based on data (add, save, check in, delete) and returns the action message --->
      <cffunction name="processForm" access="public" returntype="string" output="false">
           <cfargument name="formData" type="any" required="true">
          Â
           <cfset varList = "button">
           <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="i">
                 <cfset ListAppend(varList, formData.columns[i].varnam e)>
           </cfloop>
          Â
           <cfif varsExist(varList, "FORM")>           Â
                 <!--- check that this user is even allowed to perform changes to content --->
                 <cfif hasPrivileges(formData) is false>
                      <cfreturn "You have not been added to a group that has change privileges." />
                 </cfif>
                 <!--- set the default action based on form.ID (adding, or editing) --->
                 <cfif FORM.button is translate("Add")>
                      <cfset action = this.ADD>
                      <cfset message = "Added.">
                 <cfelseif FORM.button is translate("Save")>
                      <cfset action = this.SAVE>
                      <cfset message = "Saved.">
                 <cfelseif FORM.button is translate("Delete")>
                      <cfset action = this.DELETE>
                      <cfset message = "Deleted.">
                 <cfelseif FORM.button is translate("Restore")>
                      <cfset action = this.RESTORE>
                      <cfset message = "Restored.">
                 <cfelseif FORM.button is translate("Check In")>
                      <cfset action = this.CHECKIN>
                      <cfif isDefined("FORM.ID")>
                            <cfset message = "Checked In.">
                      <cfelse>
                            <cfset message = "Added.">
                      </cfif>
                 <cfelseif FORM.button is translate("Approve")>
                      <cfset action = this.APPROVE>
                      <cfset message = "Approved.">
                 <cfelseif FORM.button is translate("Decline")>
                      <cfset action = this.DECLINE>
                      <cfset message = "Declined.">
                 <cfelseif FORM.button is translate("Edit")>
                      <cfset action = this.EDIT>
                      <cfset message = "Edited">
                 <cfelse>
                      <!--- we don't know what to do --->
                      <cfreturn ""/>
                 </cfif>
                 <cfset FORM.ID = doAction(SESSION.userid, action, message, formData)>
                Â
                 <cfreturn message />
           </cfif>
          Â
           <cfreturn "" />
      </cffunction>
      <!--- Performs the steps associated with main actions (add, edit, delete, approve, etc.).
            Ensures that the action gets logged, and deals with all steps involved.
      --->
      <cffunction name="doAction" access="public" returntype="string" output="false">
           <cfargument name="userID" type="numeric" required="true">
           <cfargument name="action" type="numeric" required="true">
           <cfargument name="message" type="string" required="true">
           <cfargument name="formData" type="any" required="true">
           <cfobjectcache action="clear" />
           <cfif formData.blnWorkflow>
                 <!--- ensure workflow columns are in place --->
                 <cfset this.workflowData.tablenam e = formData.tablename>
                 <cfset verifyColumns(this.workflo wData)>
           <cfelse>
                 <!--- ensure other columns are in place --->
                 <cfset this.basicData.tablename = formData.tablename>
                 <cfset verifyColumns(this.basicDa ta)>
           </cfif>
           <!--- if declining, we need a default reason in place.
                  if not, set this so we can pass it on to logAction harmlessly
           --->
           <cfparam name="form.txtDeclineReaso n" default="">
           <cfparam name="form.txtEditReason" default="">
          Â
           <cfif isDefined("FORM.ID")>
                 <cfset ID = Val(FORM.ID)>
           </cfif>
           <!--- ADD --->
           <cfif action is this.ADD>
                 <!--- i suppose this action only happens when the tool doesn't use locks ? --->
                 <cfset ID = insertRecord(formData)>
                 <cfset checkIn(ID, formData)>
           <!--- SAVE --->     Â
           <cfelseif action is this.SAVE>
                 <cfif not isDefined("FORM.ID")>
                      <cfset ID = insertRecord(formData)>                      Â
                 <cfelse>
                      <cfset updateRecord(ID, formData)>
                 </cfif>
                 <!--- stay on the same page if we also would have an option to 'check in' --->
                 <cfif formData.blnLock>                      Â
                      <cfset checkOut(ID, formdata)>
                      <cfset url.ID = ID>
                      <cfset url.mode = "edit">
                 <cfelse>
                      <cfset checkIn(ID, formdata)>
                 </cfif>
           <!--- CHECK-IN --->
           <cfelseif action is this.CHECKIN>
                 <cfif not isDefined("form.ID")>
                      <cfset ID = insertRecord(formData)>
                 <cfelse>
                      <cfset updateRecord(ID, formData)>
                 </cfif>
                 <cfset checkIn(ID, formData, form.txtEditReason)>
                 <!--- new workflow notification email --->
                 <cfset sendWorkflowNotification(f ormData,ID )>
                 <!--- notification --->
                 <cfif isDefined("this.qryCompany .blnNotifi cation") and this.qryCompany.blnNotific ation is 1>
                      <cfset sendNotification(formData, ID)>
                 </cfif>
                Â
           <!--- APPROVE --->
           <cfelseif action is this.APPROVE>
                 <cfset checkIn(ID, formdata)>
                 <!--- new workflow notification email --->
                 <cfset sendWorkflowNotification(f ormData,ID )>
                 <!--- notification --->
                 <cfif isDefined("this.qryCompany .blnNotifi cation") and this.qryCompany.blnNotific ation is 1>
                      <cfset sendNotification(formData, ID)>
                 </cfif>
           <!--- DECLINE --->
           <cfelseif action is this.DECLINE>
                 <cfset decline(ID, formdata, form.txtDeclineReason)>
           <!--- EDIT --->           Â
           <cfelseif action is this.EDIT>
                 <!--- edit refers to an Editor taking over a record in order to edit it.
                       This involves silently approving the item after checking it out under this user,
                       then staying on the edit page (url.mode=edit).
                 --->
                 <cfset checkOut(ID, formdata)>
                Â
                 <cfquery datasource="#this.datasour ce#">
                      UPDATE       tblItem
                      SET       blnApproved = <cfqueryparam value="1" cfsqltype="cf_sql_bit">
                      WHERE       intID = <cfqueryparam value="#ID#" cfsqltype="cf_sql_integer" >
                 </cfquery>
                 <cfset URL.mode = "edit">
                 <cfset URL.ID = ID>
           <!--- DELETE --->           Â
           <cfelseif action is this.DELETE>
                 <cfset deleteRecord(ID, formData)>
           <!--- RESTORE --->                Â
           <cfelseif action is this.RESTORE>
                 <!--- we update following a restore in case the user changed things
                       in the add/edit form before clicking Restore.
                      Â
                       We also need to update url.statusid for the display.getListing() function,
                       so that the status bar stops displaying deleted items.
                 --->
                 <cfset restoreRecord(ID, formData)>
                 <cfset updateRecord(ID, formData)>
                 <cfset checkIn(ID, formdata)>
                 <cfset URL.statusid = 0>
                Â
           <cfelse>
                 <cfthrow message="Bad action type: #action#">
           </cfif>
          Â
           <!--- only log it if the ID relates to tblItem --->
           <cfif formData.blnWorkflow>
                 <cfset logAction(ID, userID, message, form.txtDeclineReason)>
           </cfif>
           <cfreturn ID />
      </cffunction>
     Â
      <!--- notification --->
      <cffunction name="sendNotification" access="public" returntype="any" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="itemID" type="numeric" required="false">
          Â
           <cfset var qryItem = ''>
           <cfset var notifier = ''>
           <cfset var theItemID = itemID>
          Â
           <cftrace text="workflow.cfc: sendNotification"/>           Â
           <cfquery name="qryItem" datasource="#this.datasour ce#" maxrows="1">
                 SELECT       TOP 1 blnNotification, blnLive, dtStart
                 FROM       #formData.tablename#
                 WHERE       intItemID = <cfqueryparam value="#Val(arguments.item ID)#" cfsqltype="cf_sql_integer" >
                 ORDER BY dtAdded DESC
           </cfquery>
          Â
           <cfif qryItem.recordCount and isDefined("qryItem.blnNoti fication") and qryItem.blnNotification is 1 and qryItem.blnLive is 1>
                 <cftry>
                 <cfset notifier = getObject('hb50.plugins.ge neric.noti fier',this .companyID ,true)>
                Â
                      <cfif StructKeyExists(formData, 'tablename') and formData.tablename is 'tblContent'>
                      <cfset theItemID = 0>
                 </cfif>
                      <cfif formData.blnScheduling and isDefined("qryItem.dtStart ") and isDate(qryItem.dtStart)>
                      <!--- <cftrace text="workflow.cfc: call schedule notification"> --->
                      <cfset notifier.scheduleTask(qryI tem.dtStar t,Val(form Data.webid ),theItemI D)>
                 <cfelse>
                      <!--- <cftrace text="workflow.cfc: call send notification"> --->
                      <cfset notifier.sendNotification( Val(formDa ta.webid), theItemID) >
                 </cfif>
                      <cfcatch>
                            <cftrace text="workflow.cfc: notification failed." />
                      </cfcatch>
                 </cftry>     Â
           </cfif>           Â
      </cffunction>     Â
     Â
      <cffunction name="logAction" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="userID" type="numeric" required="true">
           <cfargument name="actionmsg" type="string" required="true">
           <cfargument name="declinemsg" type="string" required="false" default="">
           <!--- record the data in tblActionLog.
                  Explicitly save the action msg instead of the action ID, because
                  its much more practical.. and we dont want to go look it up every time
                  when all we want is the action msg itself.
           --->
           <cfquery datasource="#this.datasour ce#">
                 INSERT INTO tblActionLog
                      (intUserID, intItemID, txtActionMsg, txtDeclineMsg)
                 VALUES (
                      #userID#,
                      #itemID#,
                      N'#actionmsg#',
                      N'#left(declinemsg, 1000)#')
           </cfquery>
      </cffunction>
      <cffunction name="addTranslation" access="public" output="false">
           <cfargument name="intItemID" type="numeric" required="true">
           <cfargument name="intTranslateID" type="numeric" required="true">
          Â
           <cfquery name="qryAddTranslation" datasource="#this.datasour ce#">
                 INSERT INTO tblItemTranslate
                 (intItemID, intTranslateID)
                 VALUES
                 (#intItemID#, #intTranslateID#)
           </cfquery>
      </cffunction>
      <cffunction name="getTranslation" access="public" output="false">
           <cfargument name="intItemID" type="numeric" required="true">
          Â
           <cfset var map = StructNew()>
           <cfset var qryTranslations = "">
          Â
           <cfquery name="qryTranslations" datasource="#this.datasour ce#" >
                 SELECT tblItemTranslate.intTransl ateID, tblNavigation.intCompanyID
                 FROM       tblItemTranslate
                 LEFT JOIN tblItem ON tblItemTranslate.intTransl ateID = tblItem.intID
                 LEFT JOIN tblNavigation ON tblItem.intWebID = tblNavigation.intID
                 WHERE tblItemTranslate.intItemID = #intItemID#
                 OR tblItemTranslate.intItemID IN (
                      SELECT tblItemTranslate.intItemID
                      FROM tblItemTranslate
                      WHERE intTranslateID = #intItemID#
                 )
           </cfquery>
           <cfloop query="qryTranslations">
                 <cfset map[intCompanyID] = intTranslateID>
           </cfloop>
          Â
           <cfreturn map />
      </cffunction>
      <cffunction name="insertRecord" access="public" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="fItemID" type="numeric" required="false">
          Â
           <cfscript>
                 var itemID = 0;
                 var display = '';
                 var navigation = '';
                 var localFormData = '';
                 var transMap = '';
                 var catMap = '';
                 var origCatID = '';
                 var translatedItemID = '';
                 var date_start = 'NULL';
                 var date_end = 'NULL';
                 //Donny: to store column and value in a format that is ready to use to insert query
                 var formDataQueryValue = '';
                 var formDataQueryColumn = '';
                 var resources = '';
                 var tagMgr = '';
                 var htmlhead = '';
                 var qPageType = QueryNew('');
                 var pageID = 0;
                 var i = '';
                 var key = '';
                 var html = '';
                 var ll = '';
                 var delFound = false;
                 var compFound = false;
                 var adminFound = false;
                 var updatedFound = false;
                 var lpCount = 0;
                Â
                 if (isDefined("arguments.fIte mID"))
                      itemID = arguments.fItemID;
           </cfscript>
          Â
           <cfobjectcache action="clear" />
          Â
           <!--- make sure the columns all exist --->
           <cfset verifyColumns(formData)>
           <cfset this.workflowData.tablenam e = formData.tablename>
           <cfset verifyColumns(this.workflo wData)>
           <cfset TYPES = this.TYPES>
           <cfif formData.blnWorkflow and not Val(itemID)>
                 <cfif StructKeyExists(FORM, 'id')>
                      <cfset itemID = FORM.id />
                 <cfelse>
                      <cfif formData.blnOrder>
                            <cfquery name="qryOrder" datasource="#this.datasour ce#">
                                 SELECT      MAX(intOrder) + 1 AS intOrder
                                 FROM       tblItem
                                 WHERE       intWebID = <cfqueryparam value="#Val(formData.webid )#" cfsqltype="cf_sql_integer" >
                                 AND       intDataType = <cfqueryparam value="#Val(formData.datat ype)#" cfsqltype="cf_sql_integer" >
                            </cfquery>
                      </cfif>
                      <cfquery name="qryInsertItem" datasource="#this.datasour ce#">
                            INSERT INTO tblItem
                                 (intWebID, intDataType, intNavID, intSubID, intTabID, intOrder, intCategoryID)
                            VALUES (
                                 #Val(formData.webid)#,
                                 #Val(formData.datatype)#,
                                 #Val(formData.navid)#,
                                 #Val(formData.subid)#,
                                 #Val(formData.tabid)#,
                                 <cfif formData.blnOrder>
                                       #Val(qryOrder.intOrder)#
                                 <cfelse>
                                       0
                                 </cfif>,
                                 <cfif formData.blnCategory and isDefined("intCategoryID") >
                                       #Val(intCategoryID)#
                                 <cfelse>
                                       NULL
                                 </cfif>
                            );
                           Â
                            SELECT IDENT_CURRENT('tblItem') AS intID
                      </cfquery>
                      <!--- Cache: Monitor Cache update --->
                      <cfquery name="qryUpdateCacheDate" datasource="#this.datasour ce#">
                            UPDATE       tblNavigation
                            SET       dtUpdated = GETDATE()
                            WHERE       intID = #Val(formData.webid)#;
                      </cfquery>
                      <cfset itemID = qryInsertItem.intID>
                 </cfif>
           </cfif>
           <!--- ADDITIONAL RESOURCES --->
           <cfif formData.blnResources and isDefined("FORM.resources" )>
                 <cfif ListLen(FORM.resources)>
                      <cfquery name="qryResource" datasource="#this.datasour ce#">
                            INSERT INTO tblAddlResource
                                 (intItemID)
                            VALUES (
                                 <cfqueryparam value="#itemID#" cfsqltype="cf_sql_integer" >);
                           Â
                            SELECT IDENT_CURRENT('tblAddlReso urce') AS intID;
                      </cfquery>
                      <cfset FORM.intResourceID = qryResource.intID>
                     Â
                      <cfquery name="qryAddResources" datasource="#this.datasour ce#">
                            <cfloop list="#FORM.resources#" index="i" delimiters="#CHR(10)##CHR( 13)#">
                                 <cfset uid = ListFirst(i, " ")>
                                 <cfif Val(uid) is uid>
                                       INSERT INTO tblAddlResourceItem
                                            (intAddlResourceID, intLinkID, txtTitle)
                                       VALUES (
                                            #qryResource.intID#,
                                            #Val(uid)#,
                                            N'#ListRest(i, " ")#');
                                 <cfelse>
                                       INSERT INTO tblAddlResourceItem
                                            (intAddlResourceID, txtLinkUID, txtTitle)
                                       VALUES (
                                            #qryResource.intID#,
                                            '#ListFirst(i, " ")#',
                                            N'#ListRest(i, " ")#'
                                       );
                                 </cfif>
                            </cfloop>
                      </cfquery>
                 </cfif>
           </cfif>
           <cfquery name="qryInsert" datasource="#this.datasour ce#">
                 INSERT INTO #formData.tablename# (
                      <cfsavecontent variable="formDataQueryCol umn">
                            <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="key">
                                 <cfset i = formData.columns[key]>
                              <cfif (not isDefined("i.insert")) or i.insert neq "false">
                                       #i.varname#,
                                 </cfif>
                                 <cfif i.varname IS "blnDeleted">
                                       <cfset delFound = true>
                                 </cfif>
                                 <cfif i.varname IS "intCompanyID">
                                       <cfset compFound = true>
                                 </cfif>
                                 <cfif i.varname IS "intAdminIDAdded">
                                       <cfset adminFound = true>
                                 </cfif>
                                 <cfif i.varname IS "dtUpdated">
                                       <cfset updatedFound = true>
                                 </cfif>
                            </cfloop>
                      </cfsavecontent>
                      #formDataQueryColumn#
                      <cfif formData.blnScheduling>
                            dtStart,
                            dtEnd,
                      </cfif>
                      <cfif formData.blnResources>
                            intResourceID,
                      </cfif>
                      <cfif formData.blnMeta>
                            txtMetaKeywords,
                            txtMetaDescription,
                      </cfif>
                      <cfif formData.blnWorkflow>
                            intItemID,
                            blnLive,
                      <cfelse>
                            <cfif delFound IS false>
                                 blnDeleted,
                            </cfif>
                            <cfif compFound IS false>
                                 intCompanyID,
                            </cfif>
                            <cfif adminFound IS false>
                                 intAdminIDAdded,
                            </cfif>
                            <cfif updatedFound IS false>
                                 dtUpdated,
                            </cfif>
                      </cfif>
                      dtAdded
                      <cfif isDefined("this.qryCompany .blnNotifi cation") AND Val(this.qryCompany.blnNot ification) AND isDefined("formData.blnNot ification" ) AND formData.blnNotification>
                      , blnNotification
                      </cfif>)
                 VALUES (
                 <cfsavecontent variable="formDataQueryVal ue">
                      <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="key">
                       <cfset i = formData.columns[key]>
                       <cfif (not isDefined("i.insert")) or i.insert neq "false">
                            <cfif ListFind("#TYPES.TEXT#,#TY PES.URL#,# TYPES.COLO UR#,#TYPES .MEMO#,#TY PES.SELECT #,#TYPES.H IDDEN#,#TY PES.CUSTOM #", i.type)>
                                 N'<cfif StructKeyExists(FORM, i.varname)>#FORM[i.varname ]#</cfif>'
                                 <!--- Jason: prepare list of TYPES.URL fields --->
                                 <cfif i.type is TYPES.URL>
                                       <cfset ll = ListAppend(ll, i.varname)>
                                 </cfif>
                            <cfelseif i.type is TYPES.HTML>
                                 <!--- Jason: prepare list of TYPES.HTML fields --->
                                 <cfset ll = ListAppend(ll, i.varname)>
                                 <cfif StructKeyExists(FORM, i.varname)>
                                       <cfset html = prepareTokens(FORM[i.varna me])>
                                 <cfelse>
                                       <cfset html = "">
                                 </cfif>     Â
                                 N'#html#'
                            <cfelseif ListFind("#TYPES.DATE#", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname) and isDate(FORM[i.varname])>
                                       #CreateODBCDateTime(FORM[i .varname]) #
                                 <cfelse>
                                       NULL
                                 </cfif>
                            <cfelseif ListFind("#TYPES.CATEGORY# ", i.type)>                             Â
                                 <cfif StructKeyExists(FORM, "#i.varname#_add_title") and FORM["#i.varname#_add_titl e"] neq "">
                                       #formData.object.addCatego ry(FORM["# i.varname# _add_title "])#
                                 <cfelseif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                       #val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.MEDIA#", i.type)>
                                 <cfif SESSION.blnAddResource
                                  and StructKeyExists(FORM, "#i.varname#_add_title") and FORM["#i.varname#_add_titl e"] neq ""
                                  and StructKeyExists(FORM, "#i.varname#_upload") and FORM["#i.varname#_upload"] neq ""
                                  and StructKeyExists(FORM, "#i.varname#_category") and FORM["#i.varname#_category "] neq "">
                                       <cfset resources = createObject('component', 'hb50.internal.resources') .init(this .CompanyID , this.qryCompany.intMediaID )>
                                       #resources.addResource(FOR M["#i.varn ame#_add_t itle"], FORM["#i.varname#_category "], "#i.varname#_upload")#
                                 <cfelseif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                       #val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.NUMBER#,# TYPES.TYPE #", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                       #val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.FEATURED# ,#TYPES.BO OLEAN#", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "" and FORM[i.varname] is "on">
                                       1
                                 <cfelse>
                                       0
                                 </cfif>     Â
                            <cfelseif ListFind("#TYPES.RADIO#", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname)>
                                       <cfif isDefined("i.varType")>
                                            <cfif i.varType is "int">
                                                  #Val(FORM[i.varname])#
                                            <cfelseif i.varType is "bit">
                                                  <cfif Val(FORM[i.varname]) GT 0>
                                                       1
                                                  <cfelse>
                                                       0
                                                  </cfif>
                                            <cfelse>
                                                  N'#FORM[i.varname]#'
                                            </cfif>
                                       <cfelse>
                                            N'#Val(FORM[i.varname])#'
                                       </cfif>
                                 </cfif>                      Â
                            </cfif>
                            ,
                       </cfif>
                      </cfloop>
                 </cfsavecontent>
                 #PreserveSingleQuotes(form DataQueryV alue)#
                 <cfif formData.blnScheduling>
                      <cfif isDefined("dtStart_hidden" ) and isDefined("dtEnd_hidden") and isDate(dtStart_hidden) and isDate(dtEnd_hidden)>
                            <cfif StructKeyExists(FORM, "dtStart_chk") and FORM.dtStart_chk neq "" and FORM.dtStart_chk is "on">
                                 <cfif not isDate("#dtStart_hidden# #dtStart_time#")>
                                       <cfset date_start = CreateODBCDateTime(ParseDa teTime(dtS tart_hidde n))>
                                 <cfelse>
                                       <cfset date_start = CreateODBCDateTime(ParseDa teTime("#d tStart_hid den# #dtStart_time#"))>
                                 </cfif>
                            </cfif>
                            <cfif StructKeyExists(FORM, "dtEnd_chk") and FORM.dtEnd_chk neq "" and FORM.dtEnd_chk is "on">
                                 <cfif not isDate("#dtEnd_hidden# #dtEnd_time#")>
                                       <cfset date_end = CreateODBCDateTime(ParseDa teTime(dtE nd_hidden) )>
                                 <cfelse>
                                       <cfset date_end = CreateODBCDateTime(ParseDa teTime("#d tEnd_hidde n# #Replace(dtEnd_time, '.', ':')#"))>
                                 </cfif>
                            </cfif>
                      </cfif>
                      #date_start#,
                      #date_end#,
                 </cfif>
                 <cfif formData.blnResources>
                      <cfif isDefined("FORM.intResourc eID")>#for m.intResou rceID#<cfe lse>NULL</ cfif>,
                 </cfif>
                 <cfif formData.blnMeta>
                      N'<cfif StructKeyExists(FORM, 'txtMetaKeywords')>#txtMet aKeywords# </cfif>',
                      N'<cfif StructKeyExists(FORM, 'txtMetaDescription')>#txt MetaDescri ption#</cf if>',
                 </cfif>
                 <cfif formData.blnWorkflow>
                      #itemID#,
                      0,
                 <cfelse>
                      <cfif delFound IS false>
                            0,
                      </cfif>
                      <cfif compFound IS false>
                            #this.CompanyID#,
                      </cfif>
                      <cfif adminFound IS false>
                            #SESSION.userid#,
                      </cfif>
                      <cfif updatedFound IS false>
                            GETDATE(),
                      </cfif>
                 </cfif>
                 GETDATE()
                 <cfif isDefined("this.qryCompany .blnNotifi cation") AND Val(this.qryCompany.blnNot ification)  AND isDefined("formData.blnNot ification" ) AND formData.blnNotification>
                 , <cfif StructKeyExists(FORM, 'HB_sendNotification') AND FORM.HB_sendNotification is 1>1<cfelse>0</cfif>
                 </cfif>
                 );
                Â
                 SELECT SCOPE_IDENTITY() AS intTableID;
           </cfquery>
           <!--- Donny: save additional metaTag to database: tblHTMLHead --->
           <cfif formData.blnMeta>
                 <cfset display = createObject("component", "hb50.display").init(this. CompanyID) >
                 <cfif isDefined("FORM.txtNameVal ues")>
                      <cfset qryNameValues = display.listColumnToQuery( FORM.txtNa meValues, 'type,name,content')>
                 </cfif>
                Â
                 <!--- our HTML head tag management library --->
                 <cfset htmlhead = getObject('hb50.util.htmlh ead', this.CompanyID, true)>
                 <!--- process form when submitted --->
                 <cfif (isDefined("FORM.button") and isDefined("FORM.txtNameVal ues"))>
                      <cfset htmlhead.clearMetaTags()> <!--- clear tags and start over --->
                      <!--- loop over query generated from list form type --->
                      <cfloop query="qryNameValues">
                            <cfset htmlhead.setMetaTag(qryNam eValues.ty pe, qryNameValues.name, qryNameValues.content)>
                      </cfloop>
                      <cfif Val(itemID)> <!--- workflow - with intItemID --->
                            <cfset htmlhead.save(Val(itemID), qryInsert.intTableID)> <!--- save to database --->
                      <cfelse> <!--- no workflow - no intItemID in table --->
                            <cfset htmlhead.save(Val(qryInser t.intTable ID), 0)>
                      </cfif>
                 </cfif>
           </cfif>
          Â
           <!--- Jason: process content containers petite tab--->
           <cfif formData.blnContainers>
                 <!--- process the petite tab --->
                 <cfif isDefined('FORM.hidden_con tainer_tab _indicator ') and FORM.hidden_container_tab_ indicator is 1>
                      <cfquery name="qPageType" datasource="#this.datasour ce#">
                            SELECT      intPageType
                            FROM      tblNavigation
                            WHERE      intID = <cfqueryparam value="#Val(formData.subid )#" cfsqltype="cf_sql_integer" >
                      </cfquery>
                     Â
                      <cfif qPageType.recordCount>
                            <cfquery datasource="#this.datasour ce#">
                                 <!--- non-landing page --->
                                 <cfif qPageType.intPageType neq 6>
                                       DELETE FROM tblContentContainerPages
                                       WHERE       intNavID = <cfqueryparam value="#Val(formData.subid )#" cfsqltype="cf_sql_integer" >;
                                      Â
                                       <cfif isDefined("FORM.intContain ers")>
                                            <cfloop list="#FORM.intContainers# " index="pageID">
                                                  INSERT INTO tblContentContainerPages
                                                       (intContainerID, intNavID, intCompanyID)
                                                  VALUES (
                                                       <cfqueryparam value="#Val(pageID)#" cfsqltype="cf_sql_integer" >,
                                                       <cfqueryparam value="#Val(formData.subid )#" cfsqltype="cf_sql_integer" >,
                                                       <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer" >);
                                            </cfloop>
                                       </cfif>
                                 <!--- landing page specific --->
                                 <cfelse>
                                       DELETE FROM tblContentContainersItem
                                       WHERE       intItemID = <cfqueryparam value="#itemID#" cfsqltype="cf_sql_integer" >;
                                      Â
                                       <cfif isDefined("FORM.intContain ers")>
                                            <cfloop list="#FORM.intContainers# " index="pageID">
                                                  INSERT INTO tblContentContainersItem
                                                       (intContainerID, intItemID, dtAdded)
                                                  VALUES (
                                                       <cfqueryparam value="#Val(pageID)#" cfsqltype="cf_sql_integer" >,
                                                       <cfqueryparam value="#itemID#" cfsqltype="cf_sql_integer" >,
                                                       GETDATE());
                                            </cfloop>
                                       </cfif>
                                 </cfif>
                            </cfquery>
                      </cfif>
                 </cfif>
           </cfif>
          Â
           <!---
                 Jason: save tagging info to database: tblTags, tblParentTags
                 - and based on FORM.groupid, insert to the relation table (e.g. tblGlobalContentTags)
           --->
           <cfif formData.blnTagging>
                 <!--- hb tagging management library --->
                 <cfset tagMgr = getObject("hb50.internal.C TagManager ", this.CompanyID, true) />
                 <!--- process form if tagging enabled --->
                 <cfif isDefined("FORM.blnEnableT agging") and Val(itemID)>
                      <cfset tagMgr.saveTags(Val(itemID ), FORM) />
                 </cfif>
           </cfif>
          Â
           <!--- Jason: hack the initial check-in for TYPES.URL and TYPES.HTML fields to append the link params --->
           <cfif not StructKeyExists(FORM, 'id')>
                 <cftry>
                 <cfquery name="qUpdateContent" datasource="#this.datasour ce#">
                      UPDATE       #formData.tablename#
                      SET           Â
                      <cfloop list="#ll#" index="key">
                            <cfset lpCount = lpCount + 1>
                        <cfif StructKeyExists(FORM, key)>
                              <cfif formData.blnWorkflow>
                                       <cfset html = fixLinkParams(FORM[key], Val(itemID)) />
                                 <cfelse>
                                       <cfset html = fixLinkParams(FORM[key], qryInsert.intTableID) />
                                 </cfif>
                            <cfelse>
                                 <cfset html = "">
                            </cfif>
                            <cfif lpCount IS 1>
                                 #key# = N'#html#'
                            <cfelse>
                                 #key# = ,N'#html#'
                            </cfif>
                      </cfloop>     Â
                      WHERE      intID = #qryInsert.intTableID#
                 </cfquery>
                 <cfcatch></cfcatch>
                 </cftry>
           </cfif>
          Â
           <cfif formData.blnWorkflow>
                 <cfif FORM.button is translate("Check In")>
                      <!--- we need to add an item for translated web sites if necessary --->                      Â
                      <cfif formData.blnTranslate>
                            <cfset navigation = getObject('hb50.navigation ', this.CompanyID, true)>
                            <cfif not StructIsEmpty(navigation.g etTranslat ionMap())>
                                 <cfset transMap = navigation.getTranslation( formData.w ebid)>
                                 <cfif formData.webid is formData.navid>
                                       <cfset navMap = transMap>
                                 <cfelse>
                                       <cfset navMap = navigation.getTranslation( formData.n avid)>
                                 </cfif>
                                 <cfif formData.subid gt 0>
                                       <cfset subMap = navigation.getTranslation( formData.s ubid)>
                                 </cfif>
                                 <cfif not (isDefined("arguments.fite mID") or isDefined("FORM.ID"))>
                                       <cfif formData.blnCategory and isDefined("FORM.intCategor yID")>
                                            <cfset catMap = navigation.getTranslation( FORM.intCa tegoryID)>
                                       </cfif>
                                       <cfloop collection="#transMap#" item="i">
                                            <cfif formData.blnCategory and isDefined("FORM.intCategor yID")>
                                                  <cfset newFormDataQueryValue = Replace(formDataQueryValue ,FORM.intC ategoryID, catMap[i], "ALL")>
                                            </cfif>
                                            <cfquery name="qryTranslateItem" datasource="#this.datasour ce#">
                                                  INSERT INTO tblItem
                                                  (blnNeedsTranslation, intWebID, intDataType, intNavID, intSubID, intTabID, intOrder, intCategoryID)
                                                  VALUES (1, #transMap[i]#, #val(formData.datatype)#, #navMap[i]#, <cfif formData.subid gt 0>#subMap[i]#<cfelse>0</cf if>, #val(formData.tabid)#, <cfif formData.blnOrder>#val(qry Order.intO rder)#<cfe lse>0</cfi f>, <cfif formData.blnCategory and isDefined("intCategoryID") >#catMap[i ]#<cfelse> NULL</cfif >);
                                                 Â
                                                  INSERT INTO #formData.tablename#
                                                  (
                                                       intItemID,
                                                       <cfif formData.blnScheduling>dtS tart, dtEnd,</cfif>
                                                       #formDataQueryColumn#
                                                       blnLive
                                                  )
                                                  VALUES
                                                  (
                                                       IDENT_CURRENT('tblItem'),
                                                       <cfif formData.blnScheduling>#da te_start#, #date_end#, </cfif>
                                                       <cfif isDefined("newFormDataQuer yValue")>
                                                             #PreserveSingleQuotes(newF ormDataQue ryValue)#
                                                       <cfelse>
                                                             #PreserveSingleQuotes(form DataQueryV alue)#
                                                       </cfif>
                                                       0
                                                  );
                                                 Â
                                                  SELECT IDENT_CURRENT('tblItem') as intID
                                            </cfquery>
                                            <!--- Cache: Monitor Cache update --->
                                            <cfquery name="qryUpdateCacheDate" datasource="#this.datasour ce#">
                                                  UPDATE       tblNavigation
                                                  SET       dtUpdated = GETDATE()
                                                  WHERE       intID = #Val(transMap[i])#;
                                            </cfquery>
                                            <cfset addTranslation(itemID, qryTranslateItem.intID)>
                                       </cfloop>
                                 <cfelse>
                                       <cfquery name="qryTranslateItem" datasource="#this.datasour ce#">
                                            UPDATE       tblItem
                                            SET       blnNeedsTranslation = 1
                                            WHERE       intID IN (
                                                  SELECT       intTranslateID
                                                  FROM       tblItemTranslate
                                                  WHERE       intItemID = #Val(itemID)#
                                            )
                                       </cfquery>
                                 </cfif>
                                 <!--- send emails out to translators --->
                                 <cfloop collection="#transMap#" item="i">
                                       <cfset sendAllTranslateEmails(i)>
                                 </cfloop>
                            </cfif>
                      </cfif>
                 </cfif>
                Â
                 <cfreturn itemID />
           <cfelse>
                 <cfreturn qryInsert.intTableID />
           </cfif>
      </cffunction>
     Â
      <!--- UPDATES AN EXISTING RECORD IN THE DB GIVEN THE FORMID --->
      <cffunction name="updateRecord" access="public" output="false">
           <cfargument name="ID" type="numeric" required="true">
           <cfargument name="formData" type="any" required="true">
           <cfobjectcache action="clear" />
           <!--- make sure the columns all exist --->
           <cfset verifyColumns(formData)>
           <cfset TYPES = this.TYPES>
           <cfif formData.blnWorkflow>
                 <cfset insertRecord(formData, arguments.ID)>
           <cfelse>
                 <cfquery name="qryUpdate" datasource="#this.datasour ce#">
                      UPDATE #formData.tablename#
                      SET
                      <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="key">
                       <cfset i = formData.columns[key]>
                    <cfif (not isDefined("i.insert")) or i.insert neq "false">
                                 <cfset t = "#Val(i.type)#">
                            #i.varname# =
                            <cfif ListFind("#TYPES.TEXT#,#TY PES.URL#,# TYPES.COLO UR#,#TYPES .MEMO#,#TY PES.SELECT #,#TYPES.H IDDEN#,#TY PES.CUSTOM #", i.type)>
                                 N'<cfif StructKeyExists(FORM, i.varname)>#FORM[i.varname ]#</cfif>'
                            <cfelseif i.type is TYPES.HTML>
                                 <cfset htmltext = prepareTokens(FORM[i.varna me])>
                                 N'<cfif StructKeyExists(FORM, i.varname)>#htmltext#</cfi f>'
                            <cfelseif ListFind("#TYPES.DATE#", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname) and isDate(FORM[i.varname])>
                                       #CreateODBCDate(FORM[i.var name])#
                                 <cfelse>
                                       NULL
                                 </cfif>
                            <cfelseif ListFind("#TYPES.CATEGORY# ", i.type)>                             Â
                                 <cfif StructKeyExists(FORM, "#i.varname#_add_title") and FORM["#i.varname#_add_titl e"] neq "">
                                       #formData.object.addCatego ry(FORM["# i.varname# _add_title "])#
                                 <cfelseif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                            #Val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.MEDIA#", i.type)>
                                       <cfif SESSION.blnAddResource
                                  and StructKeyExists(FORM, "#i.varname#_add_title") and FORM["#i.varname#_add_titl e"] neq ""
                                  and StructKeyExists(FORM, "#i.varname#_upload") and FORM["#i.varname#_upload"] neq ""
                                  and StructKeyExists(FORM, "#i.varname#_category") and FORM["#i.varname#_category "] neq "">
                                       <cfset resources = createObject('component', 'hb50.internal.resources') .init(this .CompanyID , this.qryCompany.intMediaID )>
                                       #resources.addResource(FOR M["#i.varn ame#_add_t itle"], FORM["#i.varname#_category "], "#i.varname#_upload")#
                                 <cfelseif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                            #Val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.NUMBER#,# TYPES.TYPE #", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                            #Val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.FEATURED# ,#TYPES.BO OLEAN#", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "" and FORM[i.varname] eq "on">
                                       1
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.RADIO#", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname)>
                                       <cfif isDefined("i.varType") >
                                                  <cfif i.varType is "int">
                                                  #Val(FORM[i.varname])#
                                                  <cfelseif i.varType is "bit">
                                                       <cfif Val(FORM[i.varname]) gt 0>
                                                             1
                                                       <cfelse>
                                                             0
                                                       </cfif>
                                                  <cfelse>
                                                       N'#FORM[i.varname]#'
                                                  </cfif>
                                            <cfelse>
                                             N'#Val(FORM[i.varname])#'
                                            </cfif>                                 Â
                                       </cfif>
                                 </cfif>
                                 ,
                             </cfif>
                      </cfloop>
                      <cfif formData.blnResources>
                            intResourceID = <cfif isDefined("qryResource.int ID")>#qryR esource.in tID#<cfels e>NULL</cf if>,
                      </cfif>
                      <cfif formData.blnScheduling>
                            <cfif isDefined("dtStart_hidden" ) and isDefined("dtEnd_hidden") and isDate(dtStart_hidden) and isDate(dtEnd_hidden)>
                                 dtStart =
                                 <cfif StructKeyExists(FORM, "dtStart_chk") and FORM.dtStart_chk neq "" and FORM.dtStart_chk eq "on">
                                       <cfif not isDate(dtStart_time)>
                                            <cfset date = ParseDateTime(dtStart_hidd en)>
                                       <cfelse>
                                            <cfset date = ParseDateTime("#dtStart_hi dden# #dtStart_time#")>
                                       </cfif>
                                       #CreateODBCDateTime(date)#
                                 <cfelse>
                                       NULL
                                 </cfif>,
                                 dtEnd =
                                 <cfif StructKeyExists(FORM, "dtEnd_chk") and FORM.dtEnd_chk neq "" and FORM.dtEnd_chk eq "on">
                                       <cfif not isDate(dtEnd_time)>
                                            <cfset date = ParseDateTime(dtEnd_hidden )>
                                       <cfelse>
                                            <cfset date = ParseDateTime("#dtEnd_hidd en# #dtEnd_time#")>
                                       </cfif>
                                       #CreateODBCDateTime(date)#
                                 <cfelse>
                                       NULL
                                 </cfif>,
                            <cfelse>
                                 dtStart = NULL,
                                 dtEnd = NULL,
                            </cfif>
                      </cfif>
                      <cfif formData.blnMeta>
                            txtMetaKeywords = N'<cfif StructKeyExists(FORM, 'txtMetaKeywords')>#txtMet aKeywords# </cfif>',
                            txtMetaDescription = N'<cfif StructKeyExists(FORM, 'txtMetaDescription')>#txt MetaDescri ption#</cf if>',
                      </cfif>
                      dtUpdated = getdate()
                      WHERE       #formData.varID# = #Val(arguments.ID)#;
                 </cfquery>
                 <!--- update the ssl flag for the children of this navigation table to be the same --->
                 <cfif formData.tablename is 'tblNavigation'>
                      <cfquery name="qryUpdateSSL" datasource="#this.datasour ce#">
                            UPDATE tblNavigation
                            SET       blnSSL = <cfif isDefined("FORM.blnSSL") and FORM.blnSSL neq "" and FORM.blnSSL is "on">1<cfelse>0</cfif>
                            WHERE       intParentID = #arguments.ID#
                      </cfquery>
                 </cfif>
                 <!--- Cache: Monitor Cache update --->
                 <cfif isDefined("formData.webid" ) AND Val(formData.webid)>
                      <cfquery name="qryUpdateCacheDate" datasource="#this.datasour ce#">
                            UPDATE tblNavigation
                            SET dtUpdated = GETDATE()
                            WHERE intID = #Val(formData.webid)#;
                      </cfquery>
                 </cfif>
           </cfif>
      </cffunction>
      <cffunction name="deleteRecord" access="public" output="false">
           <cfargument name="ID" type="numeric" required="true">
           <cfargument name="formData" type="any" required="true">
           <cfobjectcache action="clear"/>
           <cfif not formData.blnWorkflow>
                 <cfif formData.blnRestore>
                      <cfquery name="qryDelete" datasource="#this.datasour ce#">
                            UPDATE       #formData.tablename#
                            SET       blnDeleted = <cfqueryparam value="1" cfsqltype="cf_sql_bit">
                            WHERE       intID = <cfqueryparam value="#Val(arguments.ID)# " cfsqltype="cf_sql_integer" >
                      </cfquery>
                 <cfelse>
                      <cfquery datasource="#this.datasour ce#">
                            DELETE FROM #formData.tablename#
                            WHERE       intID = <cfqueryparam value="#Val(arguments.ID)# " cfsqltype="cf_sql_integer" >
                      </cfquery>
                 </cfif>
           <cfelseif formData.blnWorkflow>
                 <cfquery name="qryDelete" datasource="#this.datasour ce#">
                      UPDATE       tblItem
                      SET       blnDeleted = <cfqueryparam value="1" cfsqltype="cf_sql_bit">,
                                 blnStagingChange = <cfqueryparam value="1" cfsqltype="cf_sql_bit">
                      WHERE       intID = <cfqueryparam value="#Val(arguments.ID)# " cfsqltype="cf_sql_integer" >
                 </cfquery>
           </cfif>
      </cffunction>
      <cffunction name="restoreRecord" access="public" output="false">
           <cfargument name="ID" type="numeric" required="true">
           <cfargument name="formData" type="any" required="true">
           <cfobjectcache action="clear" />
           <cfif formData.blnWorkflow>
                 <cfquery name="qryDelete" datasource="#this.datasour ce#">
                      UPDATE       tblItem
                      SET       blnDeleted = <cfqueryparam value="0" cfsqltype="cf_sql_bit">,
                                 blnStagingChange = <cfqueryparam value="1" cfsqltype="cf_sql_bit">,
                                 blnStagingNew = <cfqueryparam value="1" cfsqltype="cf_sql_bit">
                      WHERE       intID = <cfqueryparam value="#Val(arguments.ID)# " cfsqltype="cf_sql_integer" >
                 </cfquery>
           <cfelse>
                 <cfquery name="qryDelete" datasource="#this.datasour ce#">
                      UPDATE       #formData.tablename#
                      SET       blnDeleted = <cfqueryparam value="0" cfsqltype="cf_sql_bit">
                      WHERE       intID = <cfqueryparam value="#Val(arguments.ID)# " cfsqltype="cf_sql_integer" >
                 </cfquery>
           </cfif>
      </cffunction>
      <!--- sets the edit copy to be the active copy, archive old active, unlock item --->
      <cffunction name="checkIn" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfargument name="editReason" type="string" default="" required="false">
           <cfif not formData.blnWorkflow>
                 <cfreturn>
           </cfif>
           <cfobjectcache action="clear" />
           <cfquery name="qryItem" datasource="#this.datasour ce#">
                 SELECT       TOP 1 *
                 FROM       #formData.tablename#
                 WHERE       intItemID = #Val(arguments.itemID)#
                 AND       blnLive = 0
                 ORDER BY dtAdded DESC
           </cfquery>
           <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="i">
                 <cfif formData.columns[i].type is TYPES.FEATURED>
                      <cfif qryItem[formData.columns[i ].varname] [1] is 1>
                            <cfquery name="qryClearFeatured" datasource="#this.datasour ce#">
                                 UPDATE tblItem
                                 SET       blnFeatured = 0,
                                            blnStagingChange = 1
                                 WHERE       intWebID = #formData.webid#
                                 AND            blnFeatured = 1;
                                Â
                                 UPDATE       #formData.tablename#
                                 SET       #formData.columns[i].varna me# = 0
                                 WHERE       intItemID IN
                                                  (SELECT intID
                                                  FROM       tblItem
                                                  WHERE       intWebID = #formData.webid#
                                                  AND       intItemID <> #Val(arguments.itemID)#);
                            </cfquery>
                            <!--- Cache: Monitor Cache update --->
                            <cfquery name="qryUpdateCacheDate" datasource="#this.datasour ce#">
                                 UPDATE tblNavigation
                                 SET dtUpdated = GETDATE()
                                 WHERE intID = #Val(formData.webid)#;
                            </cfquery>
                      </cfif>
                 </cfif>
           </cfloop>
           <cfif requestApproval(itemID, formData, editReason) or (not formData.blnApproval)>
                 <cfquery name="qryCheckIn" datasource="#this.datasour ce#">
                      DELETE FROM tblItemLock
                      WHERE       intItemID = #Val(arguments.itemID)#;
                     Â
                      UPDATE       tblItem
                      SET       intNavID = #formData.navid#,
                                 intSubID = #formData.subid#,
                                 intTabID = #formData.tabid#,
                                 blnNeedsTranslation = 0,
                                 blnStagingChange = 1
                                 <cfif isDefined("FORM.intCategor yID")>
                                 , intCategoryID = #Val(FORM.intCategoryID)#
                                 </cfif>
                                 <cfif ListFindNoCase(qryItem.col umnlist, "blnFeatured") and qryItem.blnFeatured is 1>
                                 , blnFeatured = 1
                                 </cfif>
                      WHERE       intID = #Val(arguments.itemID)#
                 </cfquery>
                 <!--- Cache: Monitor Cache update --->
                 <cfquery name="qryUpdateCacheDate" datasource="#this.datasour ce#">
                      UPDATE tblNavigation
                      SET dtUpdated = GETDATE()
                      WHERE intID = #Val(formData.subid)#;
                 </cfquery>
           </cfif>
           <cfset deleteOldVersions(itemID, formData)>
      </cffunction>
      <!--- creates an edit copy, sets the item as locked --->
      <cffunction name="checkOut" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfobjectcache action="clear"/>
           <cfquery name="qryCheckOut" datasource="#this.datasour ce#">
                 UPDATE tblItem
                 SET       intNavID = #formData.navid#,
                            intSubID = #formData.subid#,
                            intTabID = #formData.tabid#
                 WHERE       intID = #Val(arguments.itemID)#;
                Â
                 DELETE FROM tblItemLock
                 WHERE       intItemID = #Val(arguments.itemID)#;
                Â
                 INSERT INTO tblItemLock
                      (intUserID, intItemID)
                 VALUES (
                      #SESSION.userid#,
                      #Val(arguments.itemID)#
                 )
           </cfquery>
      </cffunction>
      <!--- returns a query with user IDs who have itemID locked out --->
      <cffunction name="getLockUsers" access="public" returntype="query" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfquery name="qryLockUsers" datasource="#this.datasour ce#" >
                 SELECT       *
                 FROM       tblItemLock
                 WHERE       intItemID = #Val(arguments.itemID)#
           </cfquery>
          Â
           <cfreturn qryLockUsers />
      </cffunction>
      <!--- checks if there are moderators. if so, tell them to moderate. if not, approve the item. returns true if approved. --->
      <cffunction name="requestApproval" access="public" returntype="boolean" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfargument name="editReason" type="string" required="true">
           <cfobjectcache action="clear" />
          Â
           <!--- return variable --->
           <cfparam name="retVal" default="false" type="boolean">
           <cfif SESSION.superuser>
                 <cfset setLive(itemID, formData)>
                 <cfreturn true />
           </cfif>
          Â
           <!--- we first need to get the last level of approval from the item table --->
           <cfquery name="qryLastApproved" datasource="#this.datasour ce#">
                 SELECT       intID, intLastLevel
                 FROM       tblItem
                 WHERE       intID = #itemID#
           </cfquery>
          Â
           <!--- we also need to get the number of approval levels for this page. There should
                  be at least one level i.e. 0 --->
           <cfquery name="qryModLevels" datasource="#this.datasour ce#">
                 SELECT       TOP 1 intLevel
                 FROM       tblModerator
                 WHERE       intNavID = #formData.webid#
                 ORDER BY intLevel DESC
           </cfquery>
          Â
           <!--- these vars will be sent to the approve function --->
           <cfset approveLevel = qryLastApproved.intLastLev el + 1>
           <cfset maxApproveLevel = Val(qryModLevels.intLevel) >
           <!--- <cfset modLevel = 1> --->
           <!--- we want to see if the current session user is at the correct access level
                  for this page to be allowed to approve --->
           <cfif qryLastApproved.recordCoun t>
                 <!--- using our highest approval level, we add one to that to define our level filter
                       for the query below --->
                 <cfset levelFilter = qryLastApproved.intLastLev el + 1>
                 <!--- check if moderator is not a superuser --->
                 <cfif formData.blnCategory and isdefined("FORM.intCategor yID")>
                      <cfquery name="qryCheckModerator" datasource="#this.datasour ce#">
                            SELECT tblUser.intID, tblUserGroup.intGroupID,
                                 tblUserGroup.intUserID, tblModerator.intModeratorI D, tblModerator.intLevel
                            FROM tblUserGroup
                            INNER JOIN tblUser ON tblUser.intID = tblUserGroup.intUserID
                            INNER JOIN tblModerator ON tblUserGroup.intGroupID = tblModerator.intModeratorI D
                            WHERE tblUser.intID = #session.userid#
                            AND tblModerator.intNavID = #val(form.intCategoryID)#
                            AND tblModerator.intLevel = #levelFilter#
                      </cfquery>     Â
                     Â
                      <!--- if current user is a moderator, then approve and increment the level --->
                      <cfif qryCheckModerator.recordCo unt>
                            <cfset retVal = approve(itemID, formData,approveLevel,maxA pproveLeve l)>     Â
                            <!--- if false, then we want to increment the level by two i.e. skip a level --->
                            <cfif retVal EQ false>
                                 <cfset modLevel = qryLastApproved.intLastLev el + 2>
                            <cfelse>
                                 <!--- since our approval went through, we simply return --->
                                 <cfreturn retVal>
                            </cfif>     Â
                      <cfelse>
                            <cfset modLevel = qryLastApproved.intLastLev el + 1>
                      </cfif>
                 <cfelse>
                      <cfquery name="qryCheckModerator" datasource="#this.datasour ce#">
                            SELECT tblUser.intID, tblUserGroup.intGroupID,
                                 tblUserGroup.intUserID, tblModerator.intModeratorI D, tblModerator.intLevel
                            FROM tblUserGroup
                            INNER JOIN tblUser ON tblUser.intID = tblUserGroup.intUserID
                            INNER JOIN tblModerator ON tblUserGroup.intGroupID = tblModerator.intModeratorI D
                            WHERE tblUser.intID = #session.userid#
                            AND tblModerator.intNavID = #formData.webid#
                            AND tblModerator.intLevel = #levelFilter#
                      </cfquery>     Â
                      <!--- if current user is a moderator, then approve and increment the level --->
                      <cfif qryCheckModerator.recordCo unt>
                            <cfset retVal = approve(itemID, formData,approveLevel,maxA pproveLeve l)>
                            <!--- if false, then we want to increment the level by two i.e. skip a level --->
                            <cfif retVal EQ false>
                                 <cfset modLevel = qryLastApproved.intLastLev el + 2>
                            <cfelse>
                                 <!--- since our approval went through, we simply return --->
                                 <cfreturn retVal>
                            </cfif>
                      <cfelse>
                            <cfset modLevel = qryLastApproved.intLastLev el + 1>
                      </cfif>                Â
                 </cfif>
           </cfif>
           <!--- get a list of moderators that will need to be notified of approvals --->
           <cfset qryModerators = getApprovalModerators(modL evel,formD ata)>
           <cfif qryModerators.recordcount>
                 <cfquery datasource="#this.datasour ce#">
                      DELETE FROM tblItemLock
                      WHERE intItemID = #itemID#;
                     Â
                      UPDATE tblItem
                      SET blnApproved = 0,
                            intApproveUserID = #session.userid#
                      WHERE intID = #itemID#;
                     Â
                      <cfloop query="qryModerators">
                            INSERT INTO tblItemLock (intUserID, intItemID, blnApproval, txtEditReason)
                            VALUES (#intID#, #itemID#, 1, '#editReason#');
                      </cfloop>
                 </cfquery>
                 <cfloop query="qryModerators">
                      <cfset sendApprovalEmail(intID, editReason)>
                 </cfloop>
                 <cfset retVal = false>
           <cfelse>
                 <cfreturn approve(itemID, formData,approveLevel,maxA pproveLeve l)>
           </cfif>
          Â
           <cfreturn retVal />
      </cffunction>
     Â
      <!--- this function retrieves all the users at the given moderator level --->
      <cffunction name="getApprovalModerator s" access="private" output="true" returntype="query">
           <cfargument name="modLevel" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
          Â
           <cfobjectcache action="clear" />
          Â
           <!---perform a query to determine the list of moderators for the given level --->
           <cfif formData.blnCategory and isdefined("form.intCategor yID")>
                 <cfquery name="qryModerators" datasource="#this.datasour ce#">
                      SELECT tblModerator.intModeratorI D, tblUser.txtFirstName + ' ' + tblUser.txtLastName as txtName, tblUser.txtUsername,tblUse r.intID
                      FROM tblModerator
                      LEFT JOIN tblUserGroup ON tblModerator.intModeratorI D = tblUserGroup.intGroupID
                      JOIN tblUser ON tblUserGroup.intUserID = tblUser.intID
                      WHERE intLevel = #modLevel#
                      AND intNavID = #val(form.intCategoryID)#
                 </cfquery>
           </cfif>
           <cfif (not isDefined("qryModerators") ) or qryModerators.recordcount eq 0>
                 <cfobjectcache action="clear" />
                Â
                 <cfquery name="qryModerators" datasource="#this.datasour ce#">
                      SELECT tblModerator.intModeratorI D, tblUser.txtFirstName + ' ' + tblUser.txtLastName as txtName, tblUser.txtUsername,tblUse r.intID
                      FROM tblModerator
                      LEFT JOIN tblUserGroup ON tblModerator.intModeratorI D = tblUserGroup.intGroupID
                      JOIN tblUser ON tblUserGroup.intUserID = tblUser.intID
                      WHERE intLevel = #modLevel#
                      AND intNavID = #formData.webid#
                 </cfquery>
           </cfif>
          Â
           <cfreturn qryModerators />
      </cffunction>
     Â
      <!--- this function retrieves all the users at the given notification level --->
      <cffunction name="getNotificationUsers " access="private" output="true" returntype="query">
           <cfargument name="modLevel" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
          Â
           <cfobjectcache action="clear" />
          Â
           <!---perform a query to determine the list of moderators for the given level --->
           <cfif formData.blnCategory and isdefined("form.intCategor yID")>
                 <!--- if the modlevel is -1, then this is notification for last level.
                       The reason for this logic is that the intlastlevel is set to zero in tblitem,
                      so no notifications would be sent to last level notify group --->
                 <cfif modLevel IS -1>
                      <cfquery name="qryLastMod" datasource="#this.datasour ce#">
                            SELECT intLevel
                            FROM tblModerator
                            WHERE intNavID = #val(form.intCategoryID)#
                            ORDER BY intLevel DESC
                      </cfquery>
                      <cfif qryLastMod.recordCount>
                            <cfset modLevel = qryLastMod.intLevel>
                      </cfif>
                 </cfif>
                 <cfquery name="qryNotifiers" datasource="#this.datasour ce#">
                      SELECT tblModerator.intNotifierID , tblUser.txtFirstName + ' ' + tblUser.txtLastName as txtName, tblUser.txtUsername,tblUse r.intID
                      FROM tblModerator
                      LEFT JOIN tblUserGroup ON tblModerator.intNotifierID = tblUserGroup.intGroupID
                      JOIN tblUser ON tblUserGroup.intUserID = tblUser.intID
                      WHERE intLevel = #modLevel#
                      AND intNavID = #val(form.intCategoryID)#
                 </cfquery>
           </cfif>
           <cfif (not isDefined("qryNotifiers")) or qryNotifiers.recordcount eq 0>
                 <cfobjectcache action="clear"/>
                 <!--- if the modlevel is -1, then this is notification for last level.
                       The reason for this logic is that the intlastlevel is set to zero in tblitem,
                      so no notifications would be sent to last level notify group --->
                 <cfif modLevel IS -1>
                      <cfquery name="qryLastMod" datasource="#this.datasour ce#">
                            SELECT intLevel
                            FROM tblModerator
                            WHERE intNavID = #formData.webid#
                            ORDER BY intLevel DESC
                      </cfquery>
                      <cfif qryLastMod.recordCount>
                            <cfset modLevel = qryLastMod.intLevel>
                      </cfif>
                 </cfif>
                 <cfquery name="qryNotifiers" datasource="#this.datasour ce#">
                      SELECT tblModerator.intNotifierID , tblUser.txtFirstName + ' ' + tblUser.txtLastName as txtName, tblUser.txtUsername,tblUse r.intID
                      FROM tblModerator
                      LEFT JOIN tblUserGroup ON tblModerator.intNotifierID = tblUserGroup.intGroupID
                      JOIN tblUser ON tblUserGroup.intUserID = tblUser.intID
                      WHERE intLevel = #modLevel#
                      AND intNavID = #formData.webid#
                 </cfquery>
           </cfif>
           <cfreturn qryNotifiers/>
      </cffunction>
      <cffunction name="sendWorkflowNotifica tion" access="public" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="itemID" type="numeric" required="false">
          Â
           <cfparam name="modLevel" default="0">
          Â
           <!--- we first need to get the last level of approval from the item table --->
           <cfquery name="qryLastApproved" datasource="#this.datasour ce#">
                 SELECT intID, intLastLevel, blnApproved
                 FROM tblItem
                 WHERE intID = #itemID#
           </cfquery>
          Â
           <cfquery name="qryTitle" datasource="#this.datasour ce#">
                 SELECT txtTitle,'index.cfm?navid= ' + CAST(tblItem.intNavID as varchar)
                                  + '&subid=' + CAST(tblItem.intSubID as varchar)
                                  + '&id=' + CAST(tblItem.intID as varchar)
                                  + '&tabid=' + CAST(tblItem.intTabID as varchar)
                                  + '&mode=edit' as txtLink
                 FROM tblNavigation                Â
                 LEFT JOIN tblItem ON tblItem.intWebID = tblNavigation.intID
                 WHERE tblNavigation.intID = #formData.webid#
           </cfquery>
          Â
           <cfif qryLastApproved.recordCoun t>
                 <cfset modLevel = qryLastApproved.intLastLev el>
                 <!--- check if this is the last level. If so, then set modlevel to -1 so that
                       only notifiers in final notification level are notified. see getnotificationusers()--->
                 <cfif modLevel IS 0 AND qryLastApproved.blnApprove d IS 1>
                      <cfset modLevel = -1>
                 </cfif>
           </cfif>
          Â
           <!--- get a list of moderators that will need to be notified of changes --->
           <cfset qryNotifiers = getNotificationUsers(modLe vel,formDa ta)>
           <cfif qryNotifiers.recordcount>
                 <cfloop query="qryNotifiers">
                      <cftry>
                            <cfset userInfo = getObject("hb50.access", this.CompanyID, true).getUserData(intID)>
                            <cfcatch>
                                 <cfreturn>
                            </cfcatch>
                      </cftry>
                      <cfset this.communication = getObject("hb50.communicat ion", this.CompanyID, true)>
                      <cfset this.communication.sendInt ernal(user Info.email , "Workflow Change Notification", '#userInfo.realname#, the page <a href="#this.qryCompany.txt Web#/#qryT itle.txtTi tle#"><nob r>#qryTitl e.txtTitle #</nobr></ a> has been modified.')>
                 </cfloop>
           </cfif>
          Â
      </cffunction>
      <cffunction name="sendApprovalEmail" access="public" output="false">
           <cfargument name="intUserID" type="numeric" required="true">
           <cfargument name="editReason" type="string" required="true">
           <!--- if this is a bad user ID, just return --->
           <cftry>
                 <cfset userInfo = getObject("hb50.access", this.CompanyID, true).getUserData(intUserI D)>
                 <cfcatch>
                      <cfreturn>
                 </cfcatch>
           </cftry>
          Â
           <cftry>
           <cfquery name="qryTools" datasource="#this.datasour ce#" >
                 SELECT DISTINCT txtTable
                 FROM (
                            SELECT txtTitle as txtTool, txtTablename as txtTable FROM tblPlugin
                            UNION
                            SELECT txtTitle + ' Category' as txtTool, txtCategoryTable as txtTable FROM tblPlugin
                       ) tblPlugins
                 WHERE txtTable != '' AND txtTable IS NOT NULL AND txtTable != 'tblTheme' AND txtTable != 'tblDisplaySettings'
           </cfquery>           Â
            <cftransaction>
                 <cfquery name="qryLocked" datasource="#this.datasour ce#" >
                      SELECT tblItem.*, tblItem.intID as intItemID,
                                 tblItemLock.blnApproval, tblItemLock.txtEditReason, tblNavigation.txtTitle, tblNavigation.txtTitle + ' > ' + tblAll.txtTitle as txtLabel, tblAll.dtAdded,
                                 'index.cfm?navid=' + CAST(tblItem.intNavID as varchar)
                                  + '&subid=' + CAST(tblItem.intSubID as varchar)
                                  + '&id=' + CAST(tblItem.intID as varchar)
                                  + '&tabid=' + CAST(tblItem.intTabID as varchar)
                                  + '&mode=edit' as txtLink,
                                  tblUser.txtFirstName + ' ' + tblUser.txtLastName as txtApproveUser,
                                  tblAll.dtStart
                      FROM tblItemLock
                      LEFT JOIN tblItem ON intItemID = tblItem.intID
                      LEFT JOIN tblNavigation ON tblItem.intWebID = tblNavigation.intID
                      LEFT JOIN (
                            <cfloop query="qryTools">
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM #qryTools.txtTable#
          Â
                             UNION
                            </cfloop>
                      Â
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM tblContent
          Â
                             UNION
          Â
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM tblResourceCategory
                      ) tblAll
                            ON tblAll.intItemID = tblItem.intID
                                 AND tblAll.intID IN
                                  (SELECT TOP 1 intID
                                       FROM (
                                            <cfloop query="qryTools">
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM #qryTools.txtTable#
                           Â
                                             UNION
                                            </cfloop>
                                       Â
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM tblContent
                           Â
                                             UNION
                           Â
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM tblResourceCategory
                                            Â
                                       ) tblAll2
                                       WHERE intItemID = tblItem.intID
                                       ORDER BY dtAdded DESC)
                      LEFT JOIN tblUser ON tblItem.intApproveUserID = tblUser.intID
                      WHERE tblItemLock.intUserID = #intUserID#
                      AND tblItem.blnDeleted = 0
                      AND tblItemLock.blnApproval = 1
                      AND tblNavigation.intCompanyID = #this.CompanyID#
                      ORDER BY tblNavigation.txtTitle, tblAll.txtTitle
                 </cfquery>
           </cftransaction>
           <cfcatch>
           </cfcatch>
           </cftry>
           <cfsavecontent variable="msg"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><cfoutput>#this.qry Company.tx tTitle#</c foutput> Content Approval</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<cfoutput><base href="#this.qryCompany.txt Web#/"></c foutput>
<style type="text/css">
<!--
body {
      background-color: #E5E5E5;
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
.hbTitle {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 18px;
      color: #CCCCCC;
}
.hbRegular {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      color: #333333;
}
.hbRegular a:link {color: #333333; text-decoration: underline}
.hbRegular a:visited {color: #333333; text-decoration: underline}
.hbRegular a:hover {color: #333333; text-decoration: underline}
.hbRegular a:active {color: #333333; text-decoration: underline}
.bhList {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 11px;
      color: #333333;
      width: 250px;
}
.hbTable {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 11px;
      color: #333333;
}
-->
</style></head>
<body>
<br>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
  <td bgcolor="#D8D8D8"><img src="images/shim.gif" width="1" height="16"></td>
 </tr>
 <tr>
  <td align="right" valign="bottom" bgcolor="#FFFFFF" class="hbTitle"><table border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="2"> </td>
   </tr>
   <tr>
    <td width="332"><img src="images/shim.gif" width="332" height="1"></td>
    <td width="308" align="left" class="hbTitle"><p><cfoutp ut>#this.q ryCompany. txtTitle#< /cfoutput> Content Approval</p></td>
    </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td height="200" bgcolor="#FFFFFF">      <table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
    </tr>
   <tr>
    <td width="50"> </td>
    <td width="258" align="left" valign="middle"><a href="<cfoutput>#this.qryC ompany.txt Web#</cfou tput>"><im g src="images/logo_company.g if" width="191" height="107" border="0"></a></td>
    <td width="24"> </td>
    <td width="258" valign="top" class="hbRegular"><strong> <cfoutput> #userInfo. realname#< /cfoutput> ,</strong> <br>The Web pages listed below are waiting for approval. To approve the Web pages, log in to Hot Banana and click on the "Unapproved" tab in your "My Overview" section.</td>
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
    </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td valign="top" bgcolor="#FFFFFF"><table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
   <tr>
    <td width="50"> </td>
    <td colspan="3" align="left" valign="top" class="hbRegular">
     <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
       <td bgcolor="#CCCCCC"><table width="100%"  border="0" cellspacing="1" cellpadding="3">
        <tr bgcolor="#E6E6E6" class="hbTable">
         <td>Web Page</td>
         <td style="padding-right: 5px; padding-left: 5px;">Author</td>
         <td style="padding-right: 5px; padding-left: 5px;">Note</td>
         <td style="padding-right: 5px; padding-left: 5px;">Live Date</td>
        </tr>
        <cfif isDefined("qryLocked") AND qryLocked.recordCount>
                            <cfoutput query="qryLocked">
              <tr class="hbTable">
               <td bgcolor="##F7F7F7"><a href="#this.qryCompany.txt HBWeb#/#tx tLink#" title="#txtLabel#"><nobr># txtTitle#< /nobr></a> </td>
               <td bgcolor="##FFFFFF" style="padding-right: 5px; padding-left: 5px;"><nobr>#txtApproveUse r#</nobr>< /td>
               <td bgcolor="##FFFFFF" style="padding-right: 5px; padding-left: 5px;">#qryLocked.txtEditRe ason#</td>
               <td bgcolor="##F7F7F7" style="padding-right: 5px; padding-left: 5px;"><nobr><cfif len(dtStart)>#DateFormat(d tStart, "mmm d, yyyy")#<cfelse>On Approval</cfif></nobr></td >
              </tr>
                            </cfoutput>
                      </cfif>
       </table></td>
      </tr>
     </table>      </td>
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td bgcolor="#FFFFFF"><table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
   <tr>
    <td width="50"> </td>
    <td width="258" align="left" valign="middle" class="hbRegular"><p><stro ng>Log in to Hot Banana now: </strong><cfoutput><a href="#this.qryCompany.txt HBWeb#">#t his.qryCom pany.txtHB Web#</a></ cfoutput>< /p>
     <p>This is an automated message please do not respond to it.</p></td>
    <td width="24"> </td>
    <td width="258" align="right" valign="bottom" class="hbRegular"><p><a href="http://www.hotbanana.ca"><img src="images/logo_hotbanana .gif" width="129" height="25" border="0"></a></p></td>
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#D8D8D8"><img src="images/shim.gif" width="1" height="16"></td>
 </tr>
</table>
<br>
</body>
</html>
</cfsavecontent>
           <cfset this.communication = getObject("hb50.communicat ion", this.CompanyID, true)>
           <cfset this.communication.sendPre Format(use rInfo.emai l, this.qryCompany.txtWorkflo wEmail, "Web Site Content Approval Notification", msg)>
      </cffunction>
      <!--- dummy function for approve function to be called from outsite this object --->
      <cffunction name="setLive" access="public">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <!--- force the live status by ensuring the level is greater than the maxlevel --->
           <cfset approve(itemID, formData,1,0)>
          Â
      </cffunction>
     Â
      <!--- sets the record as approved, replaces the current active with the most recent edit copy --->
      <cffunction name="approve" access="public" output="true" returntype="boolean">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfargument name="level" type="numeric" required="true">
           <cfargument name="maxlevel" type="numeric" required="true">
           <cfobjectcache action="clear"/>
          Â
           <cfset qryModerators = getApprovalModerators(leve l,formData )>
           <cfif qryModerators.recordCount>
                 <!--- send an email to the author to keep him informed --->
                 <cfquery name="qryApproveUser" datasource="#this.datasour ce#" maxrows="1">
                      SELECT       TOP 1 tblUser.txtEmail
                      FROM       tblItem
                      LEFT JOIN tblUser
                      ON            tblItem.intApproveUserID = tblUser.intID
                      WHERE       tblItem.intID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
                 </cfquery>
                Â
                 <!--- get the live (active?!) copy --->
                 <cfquery name="qryActiveCopy" datasource="#this.datasour ce#" maxrows="1">
                      SELECT       TOP 1 #formData.tablename#.txtTi tle, tblNavigation.txtCaption
                      FROM       #formData.tablename#
                      LEFT JOIN tblItem
                      ON            tblItem.intID = #formData.tablename#.intIt emID
                      LEFT JOIN tblNavigation
                      ON            tblItem.intWebID = tblNavigation.intID
                      WHERE       #formData.tablename#.intIt emID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
                      ORDER BY #formData.tablename#.blnLi ve DESC
                 </cfquery>
                                Â
                 <cfif Len(qryApproveUser.txtEmai l)>
                      <cfset this.communication = getObject("hb50.communicat ion", this.CompanyID, true)>
                      <cfset this.communication.sendInt ernal(qryA pproveUser .txtEmail, "Web Site Content Approved Notification", "#qryActiveCopy.txtCaption # > #qryActiveCopy.txtTitle# was approved by #session.realname#.")>
                 </cfif>
           </cfif>
           <!--- now check whether the level passed in matches the max level of approval.
                  If it does, then we can make this item live since it received the last
                 level of approval. Otherwise, simply update the itme table by incrementing
                 the intlastlevel --->
           <cfif val(level) LT val(maxlevel)>
                 <cfquery datasource="#this.datasour ce#">
                      UPDATE tblItem
                      SET intLastLevel = #val(level)#
                      WHERE intID = #val(itemID)#
                 </cfquery>
           <cfelse>
                 <cfquery name="qrySetActive" datasource="#this.datasour ce#">
                      UPDATE #formData.tablename#
                      SET blnLive = 0
                      WHERE intItemID = #val(itemID)#;
     Â
                      UPDATE #formData.tablename#
                      SET blnLive = 1
                      WHERE intID IN (
                            SELECT TOP 1 intID
                            FROM #formData.tablename#
                            WHERE intItemID = #val(itemID)#
                            ORDER BY dtAdded DESC
                      );
                     Â
                      UPDATE tblItem
                      SET intNavID = #formData.navid#,
                            intSubID = #formData.subid#,
                            intTabID = #formData.tabid#,
                            blnStagingChange = 1,
                            blnApproved = 1,
                            intApproveUserID = #session.userid#,
                            intLastLevel = 0
                      WHERE intID = #val(itemID)#
                 </cfquery>
                 <cfreturn true/>
           </cfif>
           <cfreturn false/>
      </cffunction>
      <!--- sets the record as approved, replaces the current active with the most recent edit copy --->
      <cffunction name="decline" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfargument name="reason" type="string" required="true">
           <cfobjectcache action="clear" />
           <!---
                 get the userid awaiting approval
                 - tblItem.intApproveUserID
           --->
           <cfquery name="qryApproveUser" datasource="#this.datasour ce#" maxrows="1">
                 SELECT       TOP 1 tblUser.txtEmail
                 FROM       tblItem
                 LEFT JOIN tblUser
                 ON            tblItem.intApproveUserID = tblUser.intID
                 WHERE       tblItem.intID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
           </cfquery>
          Â
           <!--- get the live (active?!) copy --->
           <cfquery name="qryActiveCopy" datasource="#this.datasour ce#" maxrows="1">
                 SELECT       TOP 1 #formData.tablename#.txtTi tle, tblNavigation.txtCaption
                 FROM       #formData.tablename#
                 LEFT JOIN tblItem
                 ON            tblItem.intID = #formData.tablename#.intIt emID
                 LEFT JOIN tblNavigation
                 ON            tblItem.intWebID = tblNavigation.intID
                 WHERE       #formData.tablename#.intIt emID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
                 ORDER BY #formData.tablename#.blnLi ve DESC
           </cfquery>
          Â
           <!--- we first need to get the last level of approval from the item table --->
           <cfquery name="qryLastApproved" datasource="#this.datasour ce#">
                 SELECT       intID, intLastLevel
                 FROM       tblItem
                 WHERE       intID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
           </cfquery>
          Â
           <!--- if the last level is not 1, then simply set the item table intlastlevel down by one --->
           <cfif qryLastApproved.intLastLev el gte 1>
                 <cfset newLevel = qryLastApproved.intLastLev el - 1>
                 <cfset qryModerators = getApprovalModerators(qryL astApprove d.intLastL evel,formD ata)>
                Â
                 <cfquery name="qryDeclineLevel" datasource="#this.datasour ce#">
                      UPDATE       tblItem
                      SET       intLastLevel = <cfqueryparam value="#newLevel#" cfsqltype="cf_sql_integer" >;
                                           Â
                      DELETE FROM tblItemLock
                      WHERE       intItemID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >;
                                           Â
                      <cfloop query="qryModerators">
                            INSERT INTO tblItemLock (
                                 intUserID, intItemID, blnApproval, txtEditReason)
                            VALUES (
                                 <cfqueryparam value="#intID#" cfsqltype="cf_sql_integer" >,
                                 <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >,
                                 <cfqueryparam value="1" cfsqltype="cf_sql_bit">,
                                 <cfqueryparam value="#arguments.reason#" cfsqltype="cf_sql_varchar" >);
                      </cfloop>
                 </cfquery>
           <cfelse>           Â
                 <!--- if this is not a superuser and this moderator has declined, then
                       drop the lastlevel down by one so that the next mod level down can reapprove ???--->
                 <cfquery name="qryDelApprove" datasource="#this.datasour ce#">
                      DELETE FROM #formData.tablename#
                      WHERE intID IN (
                            SELECT       TOP 1 intID
                            FROM      #formData.tablename#
                            WHERE      blnLive = <cfqueryparam value="0" cfsqltype="cf_sql_bit">
                            AND       intItemID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
                            ORDER BY dtAdded DESC);
                     Â
                      DELETE FROM tblItemLock
                      WHERE       intItemID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >;
     Â
                      UPDATE       tblItem
                      SET       intNavID = <cfqueryparam value="#formData.navid#" cfsqltype="cf_sql_integer" >,
                                 intSubID = <cfqueryparam value="#formData.subid#" cfsqltype="cf_sql_integer" >,
                                 intTabID = <cfqueryparam value="#formData.tabid#" cfsqltype="cf_sql_integer" >,
                                 blnApproved = <cfqueryparam value="1" cfsqltype="cf_sql_bit">                           Â
                      WHERE       intID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
                 </cfquery>
                Â
                 <cfquery name="qryAnyLeft" datasource="#this.datasour ce#" maxrows="1">
                      SELECT       TOP 1 intItemID
                      FROM       #formData.tablename#
                      WHERE       intItemID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
                 </cfquery>
     Â
                 <cfif qryAnyLeft.recordcount is 0>
                      <cfquery name="qryEraseItem" datasource="#this.datasour ce#">
                            DELETE FROM tblItem
                            WHERE      intID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
                      </cfquery>
                 </cfif>
           </cfif>
           <cfif Len(qryApproveUser.txtEmai l)>
                 <cfset this.communication = getObject("hb50.communicat ion", this.CompanyID, true)>
                 <cfset this.communication.sendInt ernal(qryA pproveUser .txtEmail, "Web Site Content Decline Notification", "#qryActiveCopy.txtCaption # > #qryActiveCopy.txtTitle# was declined by #session.realname#.<br><br >Reason: #reason#")>
           </cfif>
      </cffunction>
      <cffunction name="isLocked" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="userID" type="numeric" required="true">
          Â
           <cfif SESSION.superuser>
                 <cfreturn false />
           </cfif>
           <cfquery name="qryItemLock" datasource="#this.datasour ce#">
                 SELECT       intUserID
                 FROM       tblItemLock
                 WHERE       intItemID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
           </cfquery>
           <cfreturn qryItemLock.recordCount gt 0 and not ListFind(ValueList(qryItem Lock.intUs erID), userID) />
      </cffunction>
      <cffunction name="canApprove" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="userID" type="numeric" required="true">
          Â
           <cfif isLocked(itemID, userID)>
                 <cfreturn false />
           </cfif>
           <cfquery name="qryNeedsApproval" datasource="#this.datasour ce#">
                 SELECT       blnApproved
                 FROM       tblItem
                 WHERE       intID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
           </cfquery>
           <cfreturn qryNeedsApproval.blnApprov ed is 0 />
      </cffunction>
      <cffunction name="deleteOldVersions" access="private" returntype="string" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfobjectcache action="clear" />
           <cfquery name="qryDeleteVersions" datasource="#this.datasour ce#">
                 DELETE FROM #formData.tablename#
                 WHERE       blnLive = 0
                 AND       intItemID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
                 <cfif formData.blnVersion>
                       AND intID NOT IN (
                            SELECT       TOP #this.MAX_VERSIONS# intID
                            FROM       #formData.tablename#
                            WHERE       intItemID = <cfqueryparam value="#arguments.itemID#" cfsqltype="cf_sql_integer" >
                            AND       blnLive = <cfqueryparam value="0" cfsqltype="cf_sql_bit">
                            ORDER BY dtAdded DESC
                      )
                 </cfif>
           </cfquery>
      </cffunction>
      <cffunction name="sendAllTranslateEmai ls" access="public" output="false">
           <cfargument name="intCompanyID" type="numeric" required="true">
           <cfquery name="qryTranslators" datasource="#this.datasour ce#">
                 SELECT       intCompanyID, intUserID
                 FROM       tblTranslator
                 WHERE       intCompanyID = <cfqueryparam value="#arguments.intCompa nyID#" cfsqltype="cf_sql_integer" >
           </cfquery>
          Â
           <cfloop query="qryTranslators">
                 <cfset sendTranslateEmail(intComp anyID, intUserID)>
           </cfloop>
      </cffunction>
     Â
      <cffunction name="sendTranslateEmail" access="public" output="false">
           <cfargument name="intCompanyID" type="numeric" required="true">
           <cfargument name="intUserID" type="numeric" required="true">
          Â
           <!--- if this is a bad user ID, just return --->
           <cftry>
                 <cfset userInfo = getObject("hb50.access", this.CompanyID, true).getUserData(intUserI D)>
                 <cfcatch>
                      <cfreturn>
                 </cfcatch>
           </cftry>
          Â
           <cfquery name="qryTools" datasource="#this.datasour ce#" >
                 SELECT DISTINCT txtTable
                 FROM
                      (SELECT      txtTitle AS txtTool, txtTablename AS txtTable
                       FROM       tblPlugin
                       UNION
                       SELECT txtTitle + ' Category' AS txtTool, txtCategoryTable AS txtTable
                       FROM       tblPlugin)
                      tblPlugins
                 WHERE       txtTable != ''
                 AND       txtTable IS NOT NULL
           </cfquery>
           <cftransaction>
                 <cfquery name="qryLocked" datasource="#this.datasour ce#" >
                      SELECT tblItem.*, tblItem.intID as intItemID, tblNavigation.txtTitle + ' > ' + tblAll.txtTitle as txtLabel, tblAll.dtAdded,
                                 'index.cfm?navid=' + CAST(tblItem.intNavID as varchar)
                                  + '&subid=' + CAST(tblItem.intSubID as varchar)
                                  + '&id=' + CAST(tblItem.intID as varchar)
                                  + '&tabid=' + CAST(tblItem.intTabID as varchar)
                                  + '&mode=edit' as txtLink,
                                  tblAll.dtStart,
                                  tblUser.txtFirstName + ' ' + tblUser.txtLastName as txtAuthor
                      FROM tblItem
                      LEFT JOIN tblNavigation ON tblItem.intWebID = tblNavigation.intID
                      LEFT JOIN (
                            <cfloop query="qryTools">
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM #qryTools.txtTable#
          Â
                             UNION
                            </cfloop>
                      Â
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM tblContent
          Â
                             UNION
          Â
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM tblResourceCategory
                             UNION
          Â
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM tblResource
                      ) tblAll
                            ON tblAll.intItemID = tblItem.intID
                                 AND tblAll.intID IN
                                  (SELECT TOP 1 intID
                                       FROM (
                                            <cfloop query="qryTools">
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM #qryTools.txtTable#
                           Â
                                             UNION
                                            </cfloop>
                                       Â
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM tblContent
                           Â
                                             UNION
                           Â
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM tblResourceCategory
                                             UNION
                           Â
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM tblResource
                                       ) tblAll2
                                       WHERE intItemID = tblItem.intID
                                       ORDER BY dtAdded DESC)
                      LEFT JOIN tblItemTranslate ON tblItem.intID = tblItemTranslate.intTransl ateID
                      LEFT JOIN tblActionLog ON tblItemTranslate.intItemID = tblActionLog.intItemID AND tblActionLog.intID = (SELECT TOP 1 intID FROM tblActionLog WHERE intItemID = tblItemTranslate.intItemID ORDER BY dtDate DESC)
                      LEFT JOIN tblUser ON tblActionLog.intUserID = tblUser.intID
                      WHERE tblItem.blnNeedsTranslatio n = 1
                      AND tblNavigation.intCompanyID = #intCompanyID#
                      ORDER BY tblNavigation.txtTitle, tblAll.txtTitle
                 </cfquery>
           </cftransaction>
           <cfsavecontent variable="msg"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><cfoutput>#this.qry Company.tx tTitle#</c foutput> Content Translation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<cfoutput><base href="#this.qryCompany.txt Web#/"></c foutput>
<style type="text/css">
<!--
body {
      background-color: #E5E5E5;
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
.hbTitle {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 18px;
      color: #CCCCCC;
}
.hbRegular {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      color: #333333;
}
.hbRegular a:link {color: #333333; text-decoration: underline}
.hbRegular a:visited {color: #333333; text-decoration: underline}
.hbRegular a:hover {color: #333333; text-decoration: underline}
.hbRegular a:active {color: #333333; text-decoration: underline}
.bhList {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 11px;
      color: #333333;
      width: 250px;
}
.hbTable {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 11px;
      color: #333333;
}
-->
</style></head>
<body>
<br>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
  <td bgcolor="#D8D8D8"><img src="images/shim.gif" width="1" height="16"></td>
 </tr>
 <tr>
  <td align="right" valign="bottom" bgcolor="#FFFFFF" class="hbTitle"><table border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="2"> </td>
   </tr>
   <tr>
    <td width="332"><img src="images/shim.gif" width="332" height="1"></td>
    <td width="308" align="left" class="hbTitle"><p><cfoutp ut>#this.q ryCompany. txtTitle#< /cfoutput> Content Translation</p></td>
    </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td height="200" bgcolor="#FFFFFF">      <table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
    </tr>
   <tr>
    <td width="50"> </td>
    <td width="258" align="left" valign="middle"><a href="<cfoutput>#this.qryC ompany.txt Web#</cfou tput>"><im g src="images/logo_company.g if" width="191" height="107" border="0"></a></td>
    <td width="24"> </td>
    <td width="258" valign="top" class="hbRegular"><strong> <cfoutput> #userInfo. realname#< /cfoutput> ,</strong> <br>The Web pages listed below are waiting for translation. To translate the Web pages, log in to Hot Banana and click on the "Translation" tab in your "My Overview" section.</td>
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
    </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td valign="top" bgcolor="#FFFFFF"><table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
   <tr>
    <td width="50"> </td>
    <td colspan="3" align="left" valign="top" class="hbRegular">
     <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
       <td bgcolor="#CCCCCC"><table width="100%"  border="0" cellspacing="1" cellpadding="3">
        <tr bgcolor="#E6E6E6" class="hbTable">
         <td width="80%">Web Page</td>
         <td style="padding-right: 5px; padding-left: 5px;">Author</td>
         <td style="padding-right: 5px; padding-left: 5px;">Live Date</td>
        </tr>
                      <cfoutput query="qryLocked">
        <tr class="hbTable">
         <td bgcolor="##F7F7F7"><a href="#this.qryCompany.txt HBWeb#/#tx tLink#"><c fif len(txtLabel)>#txtLabel#<c felse>no title</cfif></a></td>
         <td bgcolor="##FFFFFF" style="padding-right: 5px; padding-left: 5px;"><nobr>#txtAuthor#</n obr></td>
         <td bgcolor="##F7F7F7" style="padding-right: 5px; padding-left: 5px;"><nobr><cfif len(dtStart)>#DateFormat(d tStart, "mmm d, yyyy")#<cfelse>On Approval</cfif></nobr></td >
        </tr>
                      </cfoutput>
       </table></td>
      </tr>
     </table>      </td>
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td bgcolor="#FFFFFF"><table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
   <tr>
    <td width="50"> </td>
    <td width="258" align="left" valign="middle" class="hbRegular"><p><stro ng>Log in to Hot Banana now: </strong><cfoutput><a href="#this.qryCompany.txt HBWeb#/"># this.qryCo mpany.txtH BWeb#</a>< /cfoutput> </p>
     <p>This is an automated message please do not respond to it.</p></td>
    <td width="24"> </td>
    <td width="258" align="right" valign="bottom" class="hbRegular"><p><a href="http://www.hotbanana.ca"><img src="images/logo_hotbanana .gif" width="129" height="25" border="0"></a></p></td>
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#D8D8D8"><img src="images/shim.gif" width="1" height="16"></td>
 </tr>
</table>
<br>
</body>
</html>
</cfsavecontent>
           <cfset this.communication = getObject("hb50.communicat ion", this.CompanyID, true)>
           <cfset this.communication.sendPre Format(use rInfo.emai l, this.qryCompany.txtWorkflo wEmail, "Web Site Content Translation Notification", msg)>
      </cffunction>
      <!--- Creates any columns that aren't already present in the table.
            Actually creates the whole table if necessary.
      --->
      <cffunction name="verifyColumns" access="public" returntype="any" output="false">
           <cfargument name="formData" required="true" type="any">
           <cfif not formData.blnVerifyColumns>
                 <cfreturn>
           </cfif>
           <cftry>
                 <cfquery name="qryTable" datasource="#this.datasour ce#" >
                      SELECT       TOP 1 *
                      FROM      #formData.tablename#
                 </cfquery>
                 <cfset columnlist = qryTable.columnlist>
                 <cfcatch>
                      <cfset columnlist = "">
                      <cfquery name="qryCreateTable" datasource="#this.datasour ce#">
                            CREATE TABLE dbo.#formData.tablename# (
                                 #formData.varID# INT IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
                                 intUID uniqueidentifier NOT NULL
                            );
                           Â
                            ALTER TABLE #formData.tablename# WITH NOCHECK ADD
                            CONSTRAINT [PK_#formData.tablename#] PRIMARY KEY CLUSTERED
                            (
                                 #formData.varID#
                            );
                           Â
                            ALTER TABLE #formData.tablename# WITH NOCHECK ADD
                                 CONSTRAINT [DF_#formData.tablename#_i ntUID] DEFAULT (newid()) FOR intUID;
                           Â
                            EXEC sp_addextendedproperty N'MS_Description', N'The primary key of this item version', N'user', N'dbo', N'table', N'#formData.tablename#', N'column', N'#formData.varID#';
                            EXEC sp_addextendedproperty N'MS_Description', N'The UID of this item version', N'user', N'dbo', N'table', N'#formData.tablename#', N'column', N'intUID';
                      </cfquery>
                 </cfcatch>
           </cftry>
           <!---
                 when adding extra columns, to add descriptions, use
                      exec sp_addextendedproperty N'MS_Description', N'Can the user edit content or items?', N'user', N'dbo', N'table', N'tblAdminPermission', N'column', N'blnEdit'
                      OR  sp_updateextendedproperty
           --->
           <cfloop from="1" to="#ArrayLen(formData.col umns)#" index="key">
                 <cfset i = formData.columns[key]>
                 <cfset column = i.varname>
                 <cfif  ((isDefined("i.column") and i.column is true) or not (isDefined("i.insert") and i.insert is false)) and not ListFindNoCase(columnlist, column)>
                      <cfif isDefined("i.vartype")>
                            <cfset type = i.vartype>
                      <cfelse>
                            <cfif ListFind("#TYPES.TEXT#,#TY PES.COLOUR #,#TYPES.H IDDEN#", i.type)>
                                 <cfset type = "nvarchar(500)">
                            <cfelseif ListFind("#TYPES.URL#", i.type)>
                                 <cfset type = "nvarchar(1000)">
                            <cfelseif ListFind("#TYPES.HTML#,#TY PES.MEMO#" , i.type)>
                                 <cfset type = "ntext">
                            <cfelseif ListFind("#TYPES.DATE#", i.type)>
                                 <cfset type = "datetime">
                            <cfelseif ListFind("#TYPES.CATEGORY# ,#TYPES.ME DIA#,#TYPE S.SELECT#, #TYPES.NUM BER#,#TYPE S.TYPE#", i.type)>
                                 <cfset type = "int">
                            <cfelseif ListFind("#TYPES.FEATURED# ,#TYPES.BO OLEAN#", i.type)>
                                 <cfset type = "bit">
                            <cfelse>
                                 <cfset type = "">
                            </cfif>
                      </cfif>
                       <!--- if we haven't added support for it, don't deal with it. --->
                       <cfif Len(type)>
                            <cfquery datasource="#this.datasour ce#">
                                 ALTER TABLE #formData.tablename#
                                 ADD #column# #type# <cfif isDefined("i.allownull") AND NOT i.allownull AND ListFindNoCase("int,bit",t ype)>NOT NULL <cfif isDefined("i.default") AND Len("#i.default#")>DEFAULT (#i.default#)</cfif></cfif >;
                                                                 Â
                                 EXEC sp_addextendedproperty N'MS_Description', N'#i.title#', N'user', N'dbo', N'table', N'#formData.tablename#', N'column', N'#column#';
                            </cfquery>
                           Â
                            <cfobjectcache action="clear" />
                      </cfif>
                 </cfif>
           </cfloop>
          Â
           <cfif formData.blnExtraColumns>
                 <cfif formData.blnWorkflow>
                      <cfset this.workflowData.tablenam e = formData.tablename>
                      <cfset verifyColumns(this.workflo wData)>
                 <cfelse>
                      <cfset this.basicData.tablename = formData.tablename>
                      <cfset verifyColumns(this.basicDa ta)>
                 </cfif>
           </cfif>
      </cffunction>     Â
     Â
      <!---
           wrapper function to convertCachedTokens
           - preserved for backward compatibility support
      --->
      <cffunction name="convertTokens" output="false">
           <cfargument name="input" required="true">
           <cfargument name="leaveToken" required="false" default="false">
           <cfargument name="webid" required="false" default="-1">
          Â
           <cfreturn convertCachedTokens(input, leaveToken, webid) />
      </cffunction>
     Â
      <!---
           takes a url and checks if the current page is an ssl page
           - if so, converts the prefix to https
      --->
      <cffunction name="setSSLPrefix" output="true" returntype="string">
           <cfargument name="input" required="true" type="string">
           <cfargument name="webid" required="true">
          Â
           <cfquery name="qrySSL" datasource="#this.datasour ce#" maxrows="1">
                 SELECT       TOP 1 intID,blnSSL
                 FROM       tblNavigation
                 WHERE       intID = <cfqueryparam value="#arguments.webid#" cfsqltype="cf_sql_integer" >
           </cfquery>
          Â
           <cfif qrySSL.recordCount and isDefined("qrySSL.blnSSL") and qrySSL.blnSSL>
                 <cfset input = REReplaceNoCase(input,'http://', 'https://', 'ALL')>
           </cfif>
          Â
           <cfreturn input />
      </cffunction>
     Â
      <!--- converts tokens in a way that is one way, stripping off the token --->
      <cffunction name="convertCachedTokens" output="false">
           <cfargument name="input" required="true">
           <cfargument name="leaveToken" required="false" default="false">
           <cfargument name="webid" required="false" default="-1">
           <cfscript>
                 var links = getObject("hb50.links", this.companyID, true);
                 var media = getObject("hb50.media", this.companyID, true);
                 var wtod = getObject("hb50.util.wtod" , this.companyID, true);
                Â
                 var length = Len(arguments.input);
                 var j = 1;
                 var pos = 0;
                 var end = 0;
                 var index = '';
                 var width = 0;
                 var height = 0;
                 var exclam = 0;
                 var token = '';
                 var newSrc = '';
                Â
                 var tagStart = 0;
                 var tagEnd = 0;
                Â
                 //WebTrends
                 var wtodEnabled = wtod.isWTODEnabled();
                 var mediaStruct = StructNew();
                Â
                 //tracking code manager
                 var plugins = getObject("hb50.plugins", this.companyID, true);
                 var blnTCODE = plugins.checkAccessByObjec t("hb50.pl ugins.gene ric.tracki ngCodeMana ger", this.companyID);
           </cfscript>
                           Â
           <!--- convert image --->
           <cfloop from="1" to="#length#" index="j">
                 <cfset pos = Find('$HB_IMG$', input, pos)>
                 <cfif pos is 0>
                      <cfbreak />
                 </cfif>
                 <cfset end = Find('$', input, pos + 8)>
                 <cfif end is 0>
                      <cfbreak />
                 </cfif>
                 <cfset index = Mid(input, pos + 8, end - pos - 8)>
                 <cfif index contains '!'>
                      <cfset token = index>
                      <cfset mediaID = Val(token)>
                     Â
                      <!--- get the width --->
                      <cfset width = 0>
                      <cfset exclam = Len(token) - Find('!', token)>
                      <cfif exclam gt 0>
                            <cfset token = Right(token, exclam)>
                            <cfset width = Val(token)>
                      </cfif>
                     Â
                      <!--- get the height --->
                      <cfset height = 0>
                      <cfset exclam = Len(token) - Find('!', token)>
                      <cfif exclam gt 0>
                            <cfset token = Right(token, exclam)>
                            <cfset height = Val(token)>
                      </cfif>
                     Â
                      <cfset newSrc = media.getURL(mediaID, width, height, 1)>
                 <cfelse>
                      <cfset newSrc = media.getURL(Val(index), -1, -1, 1)>
                 </cfif>
                Â
                 <!--- replace the token with the filename plus the token --->
                 <cfif arguments.leaveToken>
                      <cfif Find("?", newSrc)>
                            <cfset newSrc = "#newSrc#%26$HB_IMG$#index #$">
                      <cfelse>
                            <cfset newSrc = "#newSrc#?$HB_IMG$#index#$ ">
                      </cfif>
                 </cfif>
                Â
                 <!--- no token appended at the filename --->
                 <cfset input = Left(input, pos - 1) & newSrc & Right(input, Len(input) - end)>
                 <!--- advance the pos counter --->
                 <cfset pos = pos + Len(newSrc) + 1>
           </cfloop>
           <!--- convert flash (SWF) --->
           <cfloop from="1" to="#length#" index="j">
                 <cfset pos = Find('$HB_FLASH$', input, pos)>
                 <cfif pos is 0>
                      <cfbreak />
                 </cfif>
                 <cfset end = Find('$', input, pos + 10)>
                 <cfif end is 0>
                      <cfbreak />
                 </cfif>
                                Â
                 <cfset index = Mid(input, pos + 10, end - pos - 10)>
                Â
                 <!--- leave it as an image, with the token --->
                 <cfif arguments.leaveToken>
                      <cfset newSrc = 'images/thumb_flash.gif'>
                      <cfif Find("?", newSrc)>
                            <cfset newSrc = "#newSrc#%26$HB_FLASH$#ind ex#$">
                      <cfelse>
                            <cfset newSrc = "#newSrc#?$HB_FLASH$#index #$">
                      </cfif>
                      <cfset input = Left(input, pos - 1) & newSrc & Right(input, Len(input) - end)>
                      <cfset pos = pos + Len(newSrc) + 1>
                 <cfelse>
                      <cfset length = Len(input)>
                      <cfset newSrc = media.getMediaDisplay(Val( index))>
                     Â
                      <cfset tagStart = length - Find('<', Reverse(input), length - pos) + 1>
                      <cfset tagEnd = Find('>', input, tagStart)>
                     Â
                      <cfif tagStart lte 1>
                            <cfset input = newSrc & Right(input, length - tagEnd)>
                      <cfelse>
                            <cfset input = Left(input, tagStart - 1) & newSrc & Right(input, length - tagEnd)>
                      </cfif>
                      <cfset pos = pos + 1>
                 </cfif>
           </cfloop>
          Â
           <!--- convert flash (FLV) --->
           <cfloop from="1" to="#length#" index="j">
                 <cfset pos = Find('$HB_FLV$', input, pos)>
                 <cfif pos is 0>
                      <cfbreak />
                 </cfif>
                 <cfset end = Find('$', input, pos + 8)>
                 <cfif end is 0>
                      <cfbreak />
                 </cfif>
                Â
                 <cfset index = mid(input, pos + 8, end - pos - 8)>
                Â
                 <!--- leave it as an image, with the token --->
                 <cfif arguments.leaveToken>
                      <cfset newSrc = 'images/thumb_flash.gif'>
                      <cfif Find("?", newSrc)>
                            <cfset newSrc = "#newSrc#%26$HB_FLV$#index #$">
                      <cfelse>
                            <cfset newSrc = "#newSrc#?$HB_FLV$#index#$ ">
                      </cfif>
                      <cfset input = Left(input, pos - 1) & newSrc & Right(input, Len(input) - end)>
                      <cfset pos = pos + Len(newSrc) + 1>
                 <cfelse>
                      <cfset length = Len(input)>
                      <cfset newSrc = media.getMediaDisplay(Val( index))>
                     Â
                      <cfset tagStart = length - Find('<', reverse(input), length - pos) + 1>
                      <cfset tagEnd = Find('>', input, tagStart)>
                      <cfif tagStart lte 1>
                            <cfset input = newSrc & Right(input, length - tagEnd)>
                      <cfelse>
                            <cfset input = Left(input, tagStart - 1) & newSrc & Right(input, length - tagEnd)>
                      </cfif>
                      <cfset pos = pos + 1>
                 </cfif>
           </cfloop>
          Â
           <!--- change all of the resources except links to be https if ssl enabled --->
           <cfset input = setSSLPrefix(input,webid)>
           <!--- convert links --->
           <cfif not arguments.leaveToken>
                 <!--- don't even bother converting link tokens if we're preserving the token --->
                 <cfset pos = 0>
                 <cfset length = Len(input)>
                                Â
                 <!--- uid --->
                 <cfloop from="1" to="#length#" index="j">
                      <cfset pos = Find('"link.cfm?u=', input, pos)>
                      <cfset end = Find('"', input, pos + 12)>
                      <cfif pos is 0 or end is 0>
                            <cfbreak />
                      </cfif>
                      <cfset index = Mid(input, pos + 12, end - pos - 12)>
                      <!--- replace the token with the filename plus the token --->
                      <cfif wtodEnabled>
                            <cfset mediaStruct = links.getCachedURLStruct(i ndex)>
                            <cfset newSrc = '"' & mediaStruct.url & '"'>
                           Â
                            <cfif isDefined("mediaStruct.mul titrack") AND mediaStruct.multitrack is 1>
                                 <cfif mediaStruct.domain neq CGI.SERVER_NAME>                                      Â
                                       <cfset newSrc = newSrc & ' onclick="' & "dcsMultiTrack('DCS.dcssip ', '#mediaStruct.domain#', 'DCS.dcsuri', '#mediaStruct.url#','WT.ti ','#mediaS truct.titl e#', 'WT.cg_n', '', 'WT.cg_s', '', 'WT.si_n', '', 'WT.si_x', '', 'WT.mc_id', '');" & '"'>
                                 <cfelse>
                                       <cfset newSrc = newSrc & ' onclick="' & "dcsMultiTrack('DCS.dcsuri ','#mediaS truct.url# ', 'WT.ti', '#mediaStruct.title#', 'WT.cg_n', '', 'WT.cg_s', '', 'WT.si_n', '', 'WT.si_x', '', 'WT.mc_id', '');" & '"'>
                                 </cfif>
                            </cfif>
                      <cfelse>
                            <cfset newSrc = '"' & links.getCachedURL(index) & '"'>
                      </cfif>
                      <cfset input = Left(input, pos - 1) & newSrc & Right(input, Len(input) - end)>
                      <cfset pos = pos + Len(newSrc) + 1>
                 </cfloop>
                Â
                 <cfset pos = 0>
                 <cfset length = Len(input)>
                Â
                 <!--- lid --->
                 <cfloop from="1" to="#length#" index="j">
                      <cfset pos = Find('"link.cfm?lid=', input, pos)>
                      <cfset end = Find('"', input, pos + 14)>
                      <cfif pos is 0 or end is 0>
                            <cfbreak />
                      </cfif>
                     Â
                      <cfset index = Mid(input, pos + 14, end - pos - 14)>
                      <!--- replace the token with the filename plus the token --->
                      <cfif wtodEnabled>
                            <cfset mediaStruct = links.getCachedLinkURLStru ct(index)>
                           Â
                            <!--- hack the flv links --->
                            <cfif FindNoCase('viewFLV.cfm', mediaStruct.url) is 0>
                                 <cfset newSrc = '"' & mediaStruct.url & '"'>
                            <cfelse>
                                 <cfset newSrc = '"' & 'javascript:void(0)' & '"' & ' onClick="' & mediaStruct.url & '"'>
                            </cfif>
                           Â
                            <cfif isDefined("mediaStruct.mul titrack") AND mediaStruct.multitrack is 1>
                                 <cfif mediaStruct.domain neq CGI.SERVER_NAME>
                                       <cfset newSrc = newSrc & ' onclick="' & "dcsMultiTrack('DCS.dcssip ', '#mediaStruct.domain#', 'DCS.dcsuri', '#mediaStruct.url#','WT.ti ','#mediaS truct.titl e#', 'WT.cg_n', '', 'WT.cg_s', '', 'WT.si_n', '', 'WT.si_x', '', 'WT.mc_id', '');" & '"'>
                                 <cfelse>
                                       <cfset newSrc = newSrc & ' onclick="' & "dcsMultiTrack('DCS.dcsuri ','#mediaS truct.url# ', 'WT.ti', '#mediaStruct.title#', 'WT.cg_n', '', 'WT.cg_s', '', 'WT.si_n', '', 'WT.si_x', '', 'WT.mc_id', '');" & '"'>
                                 </cfif>
                            </cfif>
                      <cfelse>
                           Â
                            <cfif blnTCODE>
                                 <!--- tracking code handling --->
                                 <cfquery name="qryTCODE" datasource="#this.datasour ce#" maxrows="1">
                                       SELECT      TOP 1 intResourceID
                                       FROM      tblLink
                                       WHERE      intID = <cfqueryparam value="#val(index)#" cfsqltype="cf_sql_integer" >
                                       AND            intResourceID IN (SELECT DISTINCT intLinkID FROM tblTrackingCodeLinks)
                                 </cfquery>
                            </cfif>
                     Â
                            <cfif isDefined("qryTCODE") and qryTCODE.recordCount>
                                 <cfset newSrc = '"link.cfm?lid=' & index & '"'>
                            <cfelse>
                                 <cfset linkURL = links.getCachedLinkURL(Val (index)) />
                                Â
                                 <!--- hack the flv links --->
                                 <cfif FindNoCase('viewFLV.cfm', linkURL) is 0>
                                       <cfset newSrc = '"' & linkURL & '"' />
                                 <cfelse>
                                       <cfset newSrc = '"' & 'javascript:void(0)' & '"' & ' onClick="' & linkURL & '"' />
                                 </cfif>
                            </cfif>
                      </cfif>
                     Â
                      <cfset input = Left(input, pos - 1) & newSrc & Right(input, Len(input) - end) />
                      <cfset pos = pos + Len(newSrc) + 1 />
                 </cfloop>
           </cfif>
          Â
           <cfreturn input />
      </cffunction>
     Â
      <!---
           returns the body content with all filenames stripped out from image/flash/flv src parameters
           - leaves the token intact so that only the token is persisted in the db
      --->
      <cffunction name="prepareTokens" access="public" returntype="string" output="false">
           <cfargument name="input" type="string" required="true" />
          Â
           <cfscript>
                 var c = arguments.input;
                 //strip out all filenames from image src parameters, but leave the token
                 c = ReReplaceNoCase(c, '(["\''])[^\''"]*\$HB_IMG\ $', '\1$HB_IMG$', "ALL");
                 c = ReReplaceNoCase(c, '(["\''])[^"\'']*\$HB_FLAS H\$', '\1$HB_FLASH$', "ALL");
                 c = ReReplaceNoCase(c, '(["\''])[^"\'']*\$HB_FLV\ $', '\1$HB_FLV$', "ALL");
     Â
                 return c;
           </cfscript>
      </cffunction>
     Â
      <!---
           returns the body content with all placeholder tokens (s--999) replaced by the actual itemid of the content
           - hack for initial check-in of body content
      --->
      <cffunction name="fixLinkParams" access="private" returntype="string" output="false">
           <cfargument name="input" type="string" required="true" />
           <cfargument name="itemID" type="numeric" required="true" />
          Â
           <cfscript>
                 var c = arguments.input;
                 //replace the placeholder token with the itemid for each link in the params list
                 c = ReplaceNoCase(c, '_s--999_t-#URL.navid#_', '_s-#arguments.itemID#_t-# URL.navid# _', "ALL");
                 return c;
           </cfscript>
      </cffunction>
</cfcomponent>
<cfcomponent displayname="workflow" extends="hb50.object">
      <cffunction name="init" access="public" returntype="any" output="false">
           <cfargument name="CompanyID" required="true" type="numeric">           Â
          Â
           <cfset super.init(CompanyID)>
          Â
           <!--- set up global action variables (use like workflowObject.EDIT) --->
           <cfset StructAppend(this, enum("add,save,checkin,app
          Â
           <!--- IF YOU UPDATE THIS STATUS, UPDATE IT IN NAVIGATION!!! --->
           <cfset this.STATUS = enum("active,inactive,pend
           <cfset this.MAX_VERSIONS = 5>
           <cfreturn this />
      </cffunction>
      <cfscript>
           // define form data for workflow (blnLive, etc.)
           this.workflowData = newFormData();
           this.workflowData.blnExtra
           this.workflowData.columns = ArrayNew(1);
           x = StructNew();
           x.varname = "txtTitle";
           x.title = "The title of this Item";
           x.type = TYPES.TEXT;
           x.required = true;
           ArrayAppend(this.workflowD
          Â
           x = StructNew();
           x.varname = "intItemID";
           x.title = "The foreign ID of the associated Item";
           x.type = TYPES.NUMBER;
           x.required = true;
           ArrayAppend(this.workflowD
          Â
           x = StructNew();
           x.varname = "intResourceID";
           x.title = "The foreign ID of the additional resources associated with this item";
           x.type = TYPES.NUMBER;
           x.required = true;
           ArrayAppend(this.workflowD
          Â
           x = StructNew();
           x.varname = "blnLive";
           x.title = "Is this data live? (only one should be per ItemID)";
           x.type = TYPES.BOOLEAN;
           x.required = true;
           ArrayAppend(this.workflowD
           x = StructNew();
           x.varname = "dtAdded";
           x.title = "The date/time this data was added";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.workflowD
           x = StructNew();
           x.varname = "dtStart";
           x.title = "The date/time this data is scheduled to start";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.workflowD
           x = StructNew();
           x.varname = "dtEnd";
           x.title = "The date/time this data is scheduled to end";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.workflowD
           x = StructNew();
           x.varname = "txtMetaKeywords";
           x.title = "Meta data keywords associated with this item";
           x.type = TYPES.MEMO;
           x.required = true;
           ArrayAppend(this.workflowD
           x = StructNew();
           x.varname = "txtMetaDescription";
           x.title = "Meta data description associated with this item";
           x.type = TYPES.MEMO;
           x.required = true;
           ArrayAppend(this.workflowD
          Â
           x = StructNew();
           x.varname = "intMetaID";
           x.title = "Meta ID";
           x.type = TYPES.SELECT;
           x.required = false;
           ArrayAppend(this.workflowD
          Â
           x = StructNew();
           x.varname = "blnNotification";
           x.title = "Send notification?";
           x.type = TYPES.BOOLEAN;
           x.required = true;
           ArrayAppend(this.workflowD
          Â
          Â
           // these are columns that should be in non-workflow tables
           this.basicData = newFormData();
           this.basicData.blnExtraCol
           this.basicData.columns = ArrayNew(1);
           x = StructNew();
           x.varname = "txtTitle";
           x.title = "The title of this Item";
           x.type = TYPES.TEXT;
           x.required = true;
           ArrayAppend(this.basicData
          Â
           x = StructNew();
           x.varname = "intItemID";
           x.title = "The foreign ID of the associated Item";
           x.type = TYPES.NUMBER;
           x.required = true;
           ArrayAppend(this.basicData
          Â
           x = StructNew();
           x.varname = "blnLive";
           x.title = "Is this data live? (only one should be per ItemID)";
           x.type = TYPES.BOOLEAN;
           x.required = true;
           ArrayAppend(this.basicData
           x = StructNew();
           x.varname = "blnDeleted";
           x.title = "Is this item deleted?";
           x.type = TYPES.BOOLEAN;
           x.required = false;
           ArrayAppend(this.basicData
           x = StructNew();
           x.varname = "intAdminIDAdded";
           x.title = "The Administrator who added this item";
           x.type = TYPES.NUMBER;
           x.required = false;
           ArrayAppend(this.basicData
           x = StructNew();
           x.varname = "dtStart";
           x.title = "The date/time this data is scheduled to start";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.basicData
           x = StructNew();
           x.varname = "dtEnd";
           x.title = "The date/time this data is scheduled to end";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.basicData
           x = StructNew();
           x.varname = "dtAdded";
           x.title = "The date/time this data was added";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.basicData
           x = StructNew();
           x.varname = "dtUpdated";
           x.title = "The date/time this data was last updated";
           x.type = TYPES.DATE;
           x.required = true;
           ArrayAppend(this.basicData
           x = StructNew();
           x.varname = "txtMetaKeywords";
           x.title = "Meta data keywords associated with this item";
           x.type = TYPES.MEMO;
           x.required = true;
           ArrayAppend(this.basicData
           x = StructNew();
           x.varname = "txtMetaDescription";
           x.title = "Meta data description associated with this item";
           x.type = TYPES.MEMO;
           x.required = true;
           ArrayAppend(this.basicData
          Â
           x = StructNew();
           x.varname = "intMetaID";
           x.title = "Meta ID";
           x.type = TYPES.SELECT;
           x.required = true;
           ArrayAppend(this.basicData
           x = StructNew();
           x.varname = "intCategoryID";
           x.title = "The foreign ID from tblNavigation of the category that this belongs to";
           x.type = TYPES.NUMBER;
           x.required = false;
           ArrayAppend(this.basicData
           x = StructNew();
           x.varname = "intCompanyID";
           x.title = "The foreign ID from tblCompany that this belongs to";
           x.type = TYPES.NUMBER;
           x.required = true;
           ArrayAppend(this.basicData
          Â
           x = StructNew();
           x.varname = "blnNotification";
           x.title = "Send notification?";
           x.type = TYPES.BOOLEAN;
           x.required = true;
           ArrayAppend(this.basicData
      </cfscript>
     Â
      <!--- returns query of all data -- containing at least some minimal set of columns --->
      <cffunction name="getQuery" access="public" returntype="query" output="false">
           <cfargument name="formData" type="struct" required="true">
           <cfset verifyColumns(formData)>
           <cfif not formData.blnWorkflow>
                 <cfquery name="qryRecords" datasource="#this.datasour
                      SELECT *, intStatusID =
                                       CASE
                                            WHEN #formData.tablename#.blnDe
                                                                                       Â
                                            <cfif formData.blnScheduling>
                                                  WHEN #formData.tablename#.dtSta
                                                  THEN #this.STATUS.PENDING#
                                                  WHEN #formData.tablename#.dtEnd
                                                  THEN #this.STATUS.EXPIRED#
                                            </cfif>
                                            ELSE #this.STATUS.ACTIVE#
                                       END
                      FROM #formData.tablename#
                      WHERE (intCompanyID IS NULL OR intCompanyID = #this.CompanyID#)
                 </cfquery>
           <cfelse>
                 <!--- ensure workflow columns are in place --->
                 <cfquery name="qryRecords" datasource="#this.datasour
                      SELECT isnull(#formData.tablename
                                 <cfif formData.blnCategory>
                                   isnull(isnull(#formData.ta
                                 </cfif>
                             #formData.tablename#.*,
                             tblItem.*,
                             intStatusID =
                                       CASE
                                            WHEN tblItem.blnDeleted = 1 THEN #this.STATUS.DELETED#
                                            <cfif formData.blnApproval>
                                                  WHEN tblItem.blnApproved = 0 THEN #this.STATUS.UNAPPROVED#
                                            </cfif>
                                            WHEN tblItem.blnNeedsTranslatio
                                            WHEN #formData.tablename#.intID
                                           Â
                                            <cfif formData.blnLock>
                                                  WHEN tblItemLock.intID IS NOT NULL THEN #this.STATUS.LOCK#
                                            </cfif>
                                            <cfif formData.blnScheduling>
                                                  WHEN #formData.tablename#.dtSta
                                                  THEN #this.STATUS.PENDING#
                                                  WHEN #formData.tablename#.dtEnd
                                                  THEN #this.STATUS.EXPIRED#
                                            </cfif>
                                            ELSE #this.STATUS.ACTIVE#
                                       END
                      FROM tblItem
                      LEFT JOIN #formData.tablename# ON
                            tblItem.intID = #formData.tablename#.intIt
                            AND #formData.tablename#.intID
                             (SELECT TOP 1 intID
                                 FROM #formData.tablename#
                                 WHERE intItemID = tblItem.intID
                                 <!--- ORDER BY blnLive DESC, dtAdded DESC) --->
                                 ORDER BY dtAdded DESC)
                      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.intWebID = #val(formData.webid)#
                      AND tblItem.intDataType = #val(formData.datatype)#
                      AND tblNavigation.intCompanyID
                      <cfif formData.blnCategory and not session.superuser>
                            AND #formData.tablename#.intCa
                                  SELECT intNavID
                                  FROM tblAccessNav
                                  WHERE intUserID = #session.userid#
                            )
                      </cfif>
                       ORDER BY
                            <cfif formData.blnOrder>
                                 tblItem.intOrder
                            <cfelse>
                                 #formData.tablename#.#form
                            </cfif>
                 </cfquery>
           </cfif>
          Â
           <cfreturn qryRecords />           Â
      </cffunction>
      <!--- returns query of all publicly accessible data --->
      <cffunction name="getPublicQuery" access="public" returntype="query" output="false">
           <cfargument name="formData" type="struct" required="true">
           <cfset var qryRecords = "">
           <cfif not formData.blnWorkflow>
                 <cfset verifyColumns(formData)>
                 <cfquery name="qryRecords" datasource="#this.datasour
                      SELECT *
                      FROM #formData.tablename#
                      WHERE (intCompanyID IS NULL OR intCompanyID = #this.CompanyID#)
                      <cfif formData.blnRestore>
                            AND blnDeleted = 0
                      </cfif>
                      ORDER BY #formData.tablename#.#form
                 </cfquery>
                 <cfreturn qryRecords />
           <cfelse>
                 <!--- ensure workflow columns are in place --->
                 <cfset verifyColumns(formData)>
                 <cfquery name="qryRecords" datasource="#this.datasour
                      SELECT tblItem.intWebID,
                            <cfif formData.blnCategory>
                             isnull(isnull(tblItem.intC
                            </cfif>
                             #formData.tablename#.*,
                             tblItem.*
                      FROM tblItem
                      INNER JOIN #formData.tablename# ON
                            tblItem.intID = #formData.tablename#.intIt
                            AND #formData.tablename#.blnLi
                            <!--- AND tblItem.blnApproved = 1 --->
                      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(formData.datatype)#
                      AND tblNavigation.intCompanyID
                      AND tblItem.blnDeleted = 0
                      AND tblItem.intWebID = #Val(formData.webid)#
                      <cfif formData.blnScheduling>
                            AND (#formData.tablename#.dtSt
                            AND (#formData.tablename#.dtEn
                      </cfif>
                       ORDER BY
                            <cfif formData.blnOrder>
                                 tblItem.intOrder
                            <cfelse>
                                 #formData.tablename#.#form
                            </cfif>
                 </cfquery>
                 <cfreturn qryRecords />
                Â
                 <!---
                      Jason: replaced this selectFrom function call with this line above 'AND tblItem.intWebID = #Val(formData.webid)#'
                      - reason being that the old way is bringing back every single row from the table and perform a query on query in memory to select the single row based on the webid
                      - the old way was just overkill
                      - the new ways would speed up this query significantly
                     Â
                      <cfreturn selectFrom(qryRecords, "intWebID", val(formData.webid)) /> --->
           </cfif>
      </cffunction>
     Â
      <cffunction name="hasPrivileges" access="public" returntype="boolean">
           <cfargument name="formData" type="any" required="true">
          Â
           <cfif SESSION.superuser>
                 <cfreturn true/>
           </cfif>
          Â
           <!--- see if we have workflow setup for this page --->
           <cfquery name="qryMods" datasource="#this.datasour
                 SELECT intID
                 FROM tblModerator
                 WHERE intNavID = #formData.webid#
           </cfquery>
          Â
           <cfif not qryMods.recordCount>
                 <cfreturn true />
           </cfif>
          Â
           <cfquery name="qryAccess" datasource="#this.datasour
                 SELECT tblModerator.intID
                 FROM tblModerator
                 JOIN tblUserGroup ON tblUserGroup.intGroupID = tblModerator.intModeratorI
                 JOIN tblUser ON tblUserGroup.intUserID = tblUser.intID
                 WHERE tblUser.intID = #session.userid#
                 AND tblModerator.intNavID = #formData.webid#
           </cfquery>
          Â
           <cfif qryAccess.recordCount>
                 <cfreturn true />
           </cfif>
          Â
           <cfreturn false />
      </cffunction>
      <!--- calls doAction based on data (add, save, check in, delete) and returns the action message --->
      <cffunction name="processForm" access="public" returntype="string" output="false">
           <cfargument name="formData" type="any" required="true">
          Â
           <cfset varList = "button">
           <cfloop from="1" to="#ArrayLen(formData.col
                 <cfset ListAppend(varList, formData.columns[i].varnam
           </cfloop>
          Â
           <cfif varsExist(varList, "FORM")>           Â
                 <!--- check that this user is even allowed to perform changes to content --->
                 <cfif hasPrivileges(formData) is false>
                      <cfreturn "You have not been added to a group that has change privileges." />
                 </cfif>
                 <!--- set the default action based on form.ID (adding, or editing) --->
                 <cfif FORM.button is translate("Add")>
                      <cfset action = this.ADD>
                      <cfset message = "Added.">
                 <cfelseif FORM.button is translate("Save")>
                      <cfset action = this.SAVE>
                      <cfset message = "Saved.">
                 <cfelseif FORM.button is translate("Delete")>
                      <cfset action = this.DELETE>
                      <cfset message = "Deleted.">
                 <cfelseif FORM.button is translate("Restore")>
                      <cfset action = this.RESTORE>
                      <cfset message = "Restored.">
                 <cfelseif FORM.button is translate("Check In")>
                      <cfset action = this.CHECKIN>
                      <cfif isDefined("FORM.ID")>
                            <cfset message = "Checked In.">
                      <cfelse>
                            <cfset message = "Added.">
                      </cfif>
                 <cfelseif FORM.button is translate("Approve")>
                      <cfset action = this.APPROVE>
                      <cfset message = "Approved.">
                 <cfelseif FORM.button is translate("Decline")>
                      <cfset action = this.DECLINE>
                      <cfset message = "Declined.">
                 <cfelseif FORM.button is translate("Edit")>
                      <cfset action = this.EDIT>
                      <cfset message = "Edited">
                 <cfelse>
                      <!--- we don't know what to do --->
                      <cfreturn ""/>
                 </cfif>
                 <cfset FORM.ID = doAction(SESSION.userid, action, message, formData)>
                Â
                 <cfreturn message />
           </cfif>
          Â
           <cfreturn "" />
      </cffunction>
      <!--- Performs the steps associated with main actions (add, edit, delete, approve, etc.).
            Ensures that the action gets logged, and deals with all steps involved.
      --->
      <cffunction name="doAction" access="public" returntype="string" output="false">
           <cfargument name="userID" type="numeric" required="true">
           <cfargument name="action" type="numeric" required="true">
           <cfargument name="message" type="string" required="true">
           <cfargument name="formData" type="any" required="true">
           <cfobjectcache action="clear" />
           <cfif formData.blnWorkflow>
                 <!--- ensure workflow columns are in place --->
                 <cfset this.workflowData.tablenam
                 <cfset verifyColumns(this.workflo
           <cfelse>
                 <!--- ensure other columns are in place --->
                 <cfset this.basicData.tablename = formData.tablename>
                 <cfset verifyColumns(this.basicDa
           </cfif>
           <!--- if declining, we need a default reason in place.
                  if not, set this so we can pass it on to logAction harmlessly
           --->
           <cfparam name="form.txtDeclineReaso
           <cfparam name="form.txtEditReason" default="">
          Â
           <cfif isDefined("FORM.ID")>
                 <cfset ID = Val(FORM.ID)>
           </cfif>
           <!--- ADD --->
           <cfif action is this.ADD>
                 <!--- i suppose this action only happens when the tool doesn't use locks ? --->
                 <cfset ID = insertRecord(formData)>
                 <cfset checkIn(ID, formData)>
           <!--- SAVE --->     Â
           <cfelseif action is this.SAVE>
                 <cfif not isDefined("FORM.ID")>
                      <cfset ID = insertRecord(formData)>                      Â
                 <cfelse>
                      <cfset updateRecord(ID, formData)>
                 </cfif>
                 <!--- stay on the same page if we also would have an option to 'check in' --->
                 <cfif formData.blnLock>                      Â
                      <cfset checkOut(ID, formdata)>
                      <cfset url.ID = ID>
                      <cfset url.mode = "edit">
                 <cfelse>
                      <cfset checkIn(ID, formdata)>
                 </cfif>
           <!--- CHECK-IN --->
           <cfelseif action is this.CHECKIN>
                 <cfif not isDefined("form.ID")>
                      <cfset ID = insertRecord(formData)>
                 <cfelse>
                      <cfset updateRecord(ID, formData)>
                 </cfif>
                 <cfset checkIn(ID, formData, form.txtEditReason)>
                 <!--- new workflow notification email --->
                 <cfset sendWorkflowNotification(f
                 <!--- notification --->
                 <cfif isDefined("this.qryCompany
                      <cfset sendNotification(formData,
                 </cfif>
                Â
           <!--- APPROVE --->
           <cfelseif action is this.APPROVE>
                 <cfset checkIn(ID, formdata)>
                 <!--- new workflow notification email --->
                 <cfset sendWorkflowNotification(f
                 <!--- notification --->
                 <cfif isDefined("this.qryCompany
                      <cfset sendNotification(formData,
                 </cfif>
           <!--- DECLINE --->
           <cfelseif action is this.DECLINE>
                 <cfset decline(ID, formdata, form.txtDeclineReason)>
           <!--- EDIT --->           Â
           <cfelseif action is this.EDIT>
                 <!--- edit refers to an Editor taking over a record in order to edit it.
                       This involves silently approving the item after checking it out under this user,
                       then staying on the edit page (url.mode=edit).
                 --->
                 <cfset checkOut(ID, formdata)>
                Â
                 <cfquery datasource="#this.datasour
                      UPDATE       tblItem
                      SET       blnApproved = <cfqueryparam value="1" cfsqltype="cf_sql_bit">
                      WHERE       intID = <cfqueryparam value="#ID#" cfsqltype="cf_sql_integer"
                 </cfquery>
                 <cfset URL.mode = "edit">
                 <cfset URL.ID = ID>
           <!--- DELETE --->           Â
           <cfelseif action is this.DELETE>
                 <cfset deleteRecord(ID, formData)>
           <!--- RESTORE --->                Â
           <cfelseif action is this.RESTORE>
                 <!--- we update following a restore in case the user changed things
                       in the add/edit form before clicking Restore.
                      Â
                       We also need to update url.statusid for the display.getListing() function,
                       so that the status bar stops displaying deleted items.
                 --->
                 <cfset restoreRecord(ID, formData)>
                 <cfset updateRecord(ID, formData)>
                 <cfset checkIn(ID, formdata)>
                 <cfset URL.statusid = 0>
                Â
           <cfelse>
                 <cfthrow message="Bad action type: #action#">
           </cfif>
          Â
           <!--- only log it if the ID relates to tblItem --->
           <cfif formData.blnWorkflow>
                 <cfset logAction(ID, userID, message, form.txtDeclineReason)>
           </cfif>
           <cfreturn ID />
      </cffunction>
     Â
      <!--- notification --->
      <cffunction name="sendNotification" access="public" returntype="any" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="itemID" type="numeric" required="false">
          Â
           <cfset var qryItem = ''>
           <cfset var notifier = ''>
           <cfset var theItemID = itemID>
          Â
           <cftrace text="workflow.cfc: sendNotification"/>           Â
           <cfquery name="qryItem" datasource="#this.datasour
                 SELECT       TOP 1 blnNotification, blnLive, dtStart
                 FROM       #formData.tablename#
                 WHERE       intItemID = <cfqueryparam value="#Val(arguments.item
                 ORDER BY dtAdded DESC
           </cfquery>
          Â
           <cfif qryItem.recordCount and isDefined("qryItem.blnNoti
                 <cftry>
                 <cfset notifier = getObject('hb50.plugins.ge
                Â
                      <cfif StructKeyExists(formData, 'tablename') and formData.tablename is 'tblContent'>
                      <cfset theItemID = 0>
                 </cfif>
                      <cfif formData.blnScheduling and isDefined("qryItem.dtStart
                      <!--- <cftrace text="workflow.cfc: call schedule notification"> --->
                      <cfset notifier.scheduleTask(qryI
                 <cfelse>
                      <!--- <cftrace text="workflow.cfc: call send notification"> --->
                      <cfset notifier.sendNotification(
                 </cfif>
                      <cfcatch>
                            <cftrace text="workflow.cfc: notification failed." />
                      </cfcatch>
                 </cftry>     Â
           </cfif>           Â
      </cffunction>     Â
     Â
      <cffunction name="logAction" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="userID" type="numeric" required="true">
           <cfargument name="actionmsg" type="string" required="true">
           <cfargument name="declinemsg" type="string" required="false" default="">
           <!--- record the data in tblActionLog.
                  Explicitly save the action msg instead of the action ID, because
                  its much more practical.. and we dont want to go look it up every time
                  when all we want is the action msg itself.
           --->
           <cfquery datasource="#this.datasour
                 INSERT INTO tblActionLog
                      (intUserID, intItemID, txtActionMsg, txtDeclineMsg)
                 VALUES (
                      #userID#,
                      #itemID#,
                      N'#actionmsg#',
                      N'#left(declinemsg, 1000)#')
           </cfquery>
      </cffunction>
      <cffunction name="addTranslation" access="public" output="false">
           <cfargument name="intItemID" type="numeric" required="true">
           <cfargument name="intTranslateID" type="numeric" required="true">
          Â
           <cfquery name="qryAddTranslation" datasource="#this.datasour
                 INSERT INTO tblItemTranslate
                 (intItemID, intTranslateID)
                 VALUES
                 (#intItemID#, #intTranslateID#)
           </cfquery>
      </cffunction>
      <cffunction name="getTranslation" access="public" output="false">
           <cfargument name="intItemID" type="numeric" required="true">
          Â
           <cfset var map = StructNew()>
           <cfset var qryTranslations = "">
          Â
           <cfquery name="qryTranslations" datasource="#this.datasour
                 SELECT tblItemTranslate.intTransl
                 FROM       tblItemTranslate
                 LEFT JOIN tblItem ON tblItemTranslate.intTransl
                 LEFT JOIN tblNavigation ON tblItem.intWebID = tblNavigation.intID
                 WHERE tblItemTranslate.intItemID
                 OR tblItemTranslate.intItemID
                      SELECT tblItemTranslate.intItemID
                      FROM tblItemTranslate
                      WHERE intTranslateID = #intItemID#
                 )
           </cfquery>
           <cfloop query="qryTranslations">
                 <cfset map[intCompanyID] = intTranslateID>
           </cfloop>
          Â
           <cfreturn map />
      </cffunction>
      <cffunction name="insertRecord" access="public" output="false">
           <cfargument name="formData" type="any" required="true">
           <cfargument name="fItemID" type="numeric" required="false">
          Â
           <cfscript>
                 var itemID = 0;
                 var display = '';
                 var navigation = '';
                 var localFormData = '';
                 var transMap = '';
                 var catMap = '';
                 var origCatID = '';
                 var translatedItemID = '';
                 var date_start = 'NULL';
                 var date_end = 'NULL';
                 //Donny: to store column and value in a format that is ready to use to insert query
                 var formDataQueryValue = '';
                 var formDataQueryColumn = '';
                 var resources = '';
                 var tagMgr = '';
                 var htmlhead = '';
                 var qPageType = QueryNew('');
                 var pageID = 0;
                 var i = '';
                 var key = '';
                 var html = '';
                 var ll = '';
                 var delFound = false;
                 var compFound = false;
                 var adminFound = false;
                 var updatedFound = false;
                 var lpCount = 0;
                Â
                 if (isDefined("arguments.fIte
                      itemID = arguments.fItemID;
           </cfscript>
          Â
           <cfobjectcache action="clear" />
          Â
           <!--- make sure the columns all exist --->
           <cfset verifyColumns(formData)>
           <cfset this.workflowData.tablenam
           <cfset verifyColumns(this.workflo
           <cfset TYPES = this.TYPES>
           <cfif formData.blnWorkflow and not Val(itemID)>
                 <cfif StructKeyExists(FORM, 'id')>
                      <cfset itemID = FORM.id />
                 <cfelse>
                      <cfif formData.blnOrder>
                            <cfquery name="qryOrder" datasource="#this.datasour
                                 SELECT      MAX(intOrder) + 1 AS intOrder
                                 FROM       tblItem
                                 WHERE       intWebID = <cfqueryparam value="#Val(formData.webid
                                 AND       intDataType = <cfqueryparam value="#Val(formData.datat
                            </cfquery>
                      </cfif>
                      <cfquery name="qryInsertItem" datasource="#this.datasour
                            INSERT INTO tblItem
                                 (intWebID, intDataType, intNavID, intSubID, intTabID, intOrder, intCategoryID)
                            VALUES (
                                 #Val(formData.webid)#,
                                 #Val(formData.datatype)#,
                                 #Val(formData.navid)#,
                                 #Val(formData.subid)#,
                                 #Val(formData.tabid)#,
                                 <cfif formData.blnOrder>
                                       #Val(qryOrder.intOrder)#
                                 <cfelse>
                                       0
                                 </cfif>,
                                 <cfif formData.blnCategory and isDefined("intCategoryID")
                                       #Val(intCategoryID)#
                                 <cfelse>
                                       NULL
                                 </cfif>
                            );
                           Â
                            SELECT IDENT_CURRENT('tblItem') AS intID
                      </cfquery>
                      <!--- Cache: Monitor Cache update --->
                      <cfquery name="qryUpdateCacheDate" datasource="#this.datasour
                            UPDATE       tblNavigation
                            SET       dtUpdated = GETDATE()
                            WHERE       intID = #Val(formData.webid)#;
                      </cfquery>
                      <cfset itemID = qryInsertItem.intID>
                 </cfif>
           </cfif>
           <!--- ADDITIONAL RESOURCES --->
           <cfif formData.blnResources and isDefined("FORM.resources"
                 <cfif ListLen(FORM.resources)>
                      <cfquery name="qryResource" datasource="#this.datasour
                            INSERT INTO tblAddlResource
                                 (intItemID)
                            VALUES (
                                 <cfqueryparam value="#itemID#" cfsqltype="cf_sql_integer"
                           Â
                            SELECT IDENT_CURRENT('tblAddlReso
                      </cfquery>
                      <cfset FORM.intResourceID = qryResource.intID>
                     Â
                      <cfquery name="qryAddResources" datasource="#this.datasour
                            <cfloop list="#FORM.resources#" index="i" delimiters="#CHR(10)##CHR(
                                 <cfset uid = ListFirst(i, " ")>
                                 <cfif Val(uid) is uid>
                                       INSERT INTO tblAddlResourceItem
                                            (intAddlResourceID, intLinkID, txtTitle)
                                       VALUES (
                                            #qryResource.intID#,
                                            #Val(uid)#,
                                            N'#ListRest(i, " ")#');
                                 <cfelse>
                                       INSERT INTO tblAddlResourceItem
                                            (intAddlResourceID, txtLinkUID, txtTitle)
                                       VALUES (
                                            #qryResource.intID#,
                                            '#ListFirst(i, " ")#',
                                            N'#ListRest(i, " ")#'
                                       );
                                 </cfif>
                            </cfloop>
                      </cfquery>
                 </cfif>
           </cfif>
           <cfquery name="qryInsert" datasource="#this.datasour
                 INSERT INTO #formData.tablename# (
                      <cfsavecontent variable="formDataQueryCol
                            <cfloop from="1" to="#ArrayLen(formData.col
                                 <cfset i = formData.columns[key]>
                              <cfif (not isDefined("i.insert")) or i.insert neq "false">
                                       #i.varname#,
                                 </cfif>
                                 <cfif i.varname IS "blnDeleted">
                                       <cfset delFound = true>
                                 </cfif>
                                 <cfif i.varname IS "intCompanyID">
                                       <cfset compFound = true>
                                 </cfif>
                                 <cfif i.varname IS "intAdminIDAdded">
                                       <cfset adminFound = true>
                                 </cfif>
                                 <cfif i.varname IS "dtUpdated">
                                       <cfset updatedFound = true>
                                 </cfif>
                            </cfloop>
                      </cfsavecontent>
                      #formDataQueryColumn#
                      <cfif formData.blnScheduling>
                            dtStart,
                            dtEnd,
                      </cfif>
                      <cfif formData.blnResources>
                            intResourceID,
                      </cfif>
                      <cfif formData.blnMeta>
                            txtMetaKeywords,
                            txtMetaDescription,
                      </cfif>
                      <cfif formData.blnWorkflow>
                            intItemID,
                            blnLive,
                      <cfelse>
                            <cfif delFound IS false>
                                 blnDeleted,
                            </cfif>
                            <cfif compFound IS false>
                                 intCompanyID,
                            </cfif>
                            <cfif adminFound IS false>
                                 intAdminIDAdded,
                            </cfif>
                            <cfif updatedFound IS false>
                                 dtUpdated,
                            </cfif>
                      </cfif>
                      dtAdded
                      <cfif isDefined("this.qryCompany
                      , blnNotification
                      </cfif>)
                 VALUES (
                 <cfsavecontent variable="formDataQueryVal
                      <cfloop from="1" to="#ArrayLen(formData.col
                       <cfset i = formData.columns[key]>
                       <cfif (not isDefined("i.insert")) or i.insert neq "false">
                            <cfif ListFind("#TYPES.TEXT#,#TY
                                 N'<cfif StructKeyExists(FORM, i.varname)>#FORM[i.varname
                                 <!--- Jason: prepare list of TYPES.URL fields --->
                                 <cfif i.type is TYPES.URL>
                                       <cfset ll = ListAppend(ll, i.varname)>
                                 </cfif>
                            <cfelseif i.type is TYPES.HTML>
                                 <!--- Jason: prepare list of TYPES.HTML fields --->
                                 <cfset ll = ListAppend(ll, i.varname)>
                                 <cfif StructKeyExists(FORM, i.varname)>
                                       <cfset html = prepareTokens(FORM[i.varna
                                 <cfelse>
                                       <cfset html = "">
                                 </cfif>     Â
                                 N'#html#'
                            <cfelseif ListFind("#TYPES.DATE#", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname) and isDate(FORM[i.varname])>
                                       #CreateODBCDateTime(FORM[i
                                 <cfelse>
                                       NULL
                                 </cfif>
                            <cfelseif ListFind("#TYPES.CATEGORY#
                                 <cfif StructKeyExists(FORM, "#i.varname#_add_title") and FORM["#i.varname#_add_titl
                                       #formData.object.addCatego
                                 <cfelseif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                       #val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.MEDIA#", i.type)>
                                 <cfif SESSION.blnAddResource
                                  and StructKeyExists(FORM, "#i.varname#_add_title") and FORM["#i.varname#_add_titl
                                  and StructKeyExists(FORM, "#i.varname#_upload") and FORM["#i.varname#_upload"]
                                  and StructKeyExists(FORM, "#i.varname#_category") and FORM["#i.varname#_category
                                       <cfset resources = createObject('component', 'hb50.internal.resources')
                                       #resources.addResource(FOR
                                 <cfelseif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                       #val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.NUMBER#,#
                                 <cfif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                       #val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.FEATURED#
                                 <cfif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "" and FORM[i.varname] is "on">
                                       1
                                 <cfelse>
                                       0
                                 </cfif>     Â
                            <cfelseif ListFind("#TYPES.RADIO#", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname)>
                                       <cfif isDefined("i.varType")>
                                            <cfif i.varType is "int">
                                                  #Val(FORM[i.varname])#
                                            <cfelseif i.varType is "bit">
                                                  <cfif Val(FORM[i.varname]) GT 0>
                                                       1
                                                  <cfelse>
                                                       0
                                                  </cfif>
                                            <cfelse>
                                                  N'#FORM[i.varname]#'
                                            </cfif>
                                       <cfelse>
                                            N'#Val(FORM[i.varname])#'
                                       </cfif>
                                 </cfif>                      Â
                            </cfif>
                            ,
                       </cfif>
                      </cfloop>
                 </cfsavecontent>
                 #PreserveSingleQuotes(form
                 <cfif formData.blnScheduling>
                      <cfif isDefined("dtStart_hidden"
                            <cfif StructKeyExists(FORM, "dtStart_chk") and FORM.dtStart_chk neq "" and FORM.dtStart_chk is "on">
                                 <cfif not isDate("#dtStart_hidden# #dtStart_time#")>
                                       <cfset date_start = CreateODBCDateTime(ParseDa
                                 <cfelse>
                                       <cfset date_start = CreateODBCDateTime(ParseDa
                                 </cfif>
                            </cfif>
                            <cfif StructKeyExists(FORM, "dtEnd_chk") and FORM.dtEnd_chk neq "" and FORM.dtEnd_chk is "on">
                                 <cfif not isDate("#dtEnd_hidden# #dtEnd_time#")>
                                       <cfset date_end = CreateODBCDateTime(ParseDa
                                 <cfelse>
                                       <cfset date_end = CreateODBCDateTime(ParseDa
                                 </cfif>
                            </cfif>
                      </cfif>
                      #date_start#,
                      #date_end#,
                 </cfif>
                 <cfif formData.blnResources>
                      <cfif isDefined("FORM.intResourc
                 </cfif>
                 <cfif formData.blnMeta>
                      N'<cfif StructKeyExists(FORM, 'txtMetaKeywords')>#txtMet
                      N'<cfif StructKeyExists(FORM, 'txtMetaDescription')>#txt
                 </cfif>
                 <cfif formData.blnWorkflow>
                      #itemID#,
                      0,
                 <cfelse>
                      <cfif delFound IS false>
                            0,
                      </cfif>
                      <cfif compFound IS false>
                            #this.CompanyID#,
                      </cfif>
                      <cfif adminFound IS false>
                            #SESSION.userid#,
                      </cfif>
                      <cfif updatedFound IS false>
                            GETDATE(),
                      </cfif>
                 </cfif>
                 GETDATE()
                 <cfif isDefined("this.qryCompany
                 , <cfif StructKeyExists(FORM, 'HB_sendNotification') AND FORM.HB_sendNotification is 1>1<cfelse>0</cfif>
                 </cfif>
                 );
                Â
                 SELECT SCOPE_IDENTITY() AS intTableID;
           </cfquery>
           <!--- Donny: save additional metaTag to database: tblHTMLHead --->
           <cfif formData.blnMeta>
                 <cfset display = createObject("component", "hb50.display").init(this.
                 <cfif isDefined("FORM.txtNameVal
                      <cfset qryNameValues = display.listColumnToQuery(
                 </cfif>
                Â
                 <!--- our HTML head tag management library --->
                 <cfset htmlhead = getObject('hb50.util.htmlh
                 <!--- process form when submitted --->
                 <cfif (isDefined("FORM.button") and isDefined("FORM.txtNameVal
                      <cfset htmlhead.clearMetaTags()> <!--- clear tags and start over --->
                      <!--- loop over query generated from list form type --->
                      <cfloop query="qryNameValues">
                            <cfset htmlhead.setMetaTag(qryNam
                      </cfloop>
                      <cfif Val(itemID)> <!--- workflow - with intItemID --->
                            <cfset htmlhead.save(Val(itemID),
                      <cfelse> <!--- no workflow - no intItemID in table --->
                            <cfset htmlhead.save(Val(qryInser
                      </cfif>
                 </cfif>
           </cfif>
          Â
           <!--- Jason: process content containers petite tab--->
           <cfif formData.blnContainers>
                 <!--- process the petite tab --->
                 <cfif isDefined('FORM.hidden_con
                      <cfquery name="qPageType" datasource="#this.datasour
                            SELECT      intPageType
                            FROM      tblNavigation
                            WHERE      intID = <cfqueryparam value="#Val(formData.subid
                      </cfquery>
                     Â
                      <cfif qPageType.recordCount>
                            <cfquery datasource="#this.datasour
                                 <!--- non-landing page --->
                                 <cfif qPageType.intPageType neq 6>
                                       DELETE FROM tblContentContainerPages
                                       WHERE       intNavID = <cfqueryparam value="#Val(formData.subid
                                      Â
                                       <cfif isDefined("FORM.intContain
                                            <cfloop list="#FORM.intContainers#
                                                  INSERT INTO tblContentContainerPages
                                                       (intContainerID, intNavID, intCompanyID)
                                                  VALUES (
                                                       <cfqueryparam value="#Val(pageID)#" cfsqltype="cf_sql_integer"
                                                       <cfqueryparam value="#Val(formData.subid
                                                       <cfqueryparam value="#this.companyID#" cfsqltype="cf_sql_integer"
                                            </cfloop>
                                       </cfif>
                                 <!--- landing page specific --->
                                 <cfelse>
                                       DELETE FROM tblContentContainersItem
                                       WHERE       intItemID = <cfqueryparam value="#itemID#" cfsqltype="cf_sql_integer"
                                      Â
                                       <cfif isDefined("FORM.intContain
                                            <cfloop list="#FORM.intContainers#
                                                  INSERT INTO tblContentContainersItem
                                                       (intContainerID, intItemID, dtAdded)
                                                  VALUES (
                                                       <cfqueryparam value="#Val(pageID)#" cfsqltype="cf_sql_integer"
                                                       <cfqueryparam value="#itemID#" cfsqltype="cf_sql_integer"
                                                       GETDATE());
                                            </cfloop>
                                       </cfif>
                                 </cfif>
                            </cfquery>
                      </cfif>
                 </cfif>
           </cfif>
          Â
           <!---
                 Jason: save tagging info to database: tblTags, tblParentTags
                 - and based on FORM.groupid, insert to the relation table (e.g. tblGlobalContentTags)
           --->
           <cfif formData.blnTagging>
                 <!--- hb tagging management library --->
                 <cfset tagMgr = getObject("hb50.internal.C
                 <!--- process form if tagging enabled --->
                 <cfif isDefined("FORM.blnEnableT
                      <cfset tagMgr.saveTags(Val(itemID
                 </cfif>
           </cfif>
          Â
           <!--- Jason: hack the initial check-in for TYPES.URL and TYPES.HTML fields to append the link params --->
           <cfif not StructKeyExists(FORM, 'id')>
                 <cftry>
                 <cfquery name="qUpdateContent" datasource="#this.datasour
                      UPDATE       #formData.tablename#
                      SET           Â
                      <cfloop list="#ll#" index="key">
                            <cfset lpCount = lpCount + 1>
                        <cfif StructKeyExists(FORM, key)>
                              <cfif formData.blnWorkflow>
                                       <cfset html = fixLinkParams(FORM[key], Val(itemID)) />
                                 <cfelse>
                                       <cfset html = fixLinkParams(FORM[key], qryInsert.intTableID) />
                                 </cfif>
                            <cfelse>
                                 <cfset html = "">
                            </cfif>
                            <cfif lpCount IS 1>
                                 #key# = N'#html#'
                            <cfelse>
                                 #key# = ,N'#html#'
                            </cfif>
                      </cfloop>     Â
                      WHERE      intID = #qryInsert.intTableID#
                 </cfquery>
                 <cfcatch></cfcatch>
                 </cftry>
           </cfif>
          Â
           <cfif formData.blnWorkflow>
                 <cfif FORM.button is translate("Check In")>
                      <!--- we need to add an item for translated web sites if necessary --->                      Â
                      <cfif formData.blnTranslate>
                            <cfset navigation = getObject('hb50.navigation
                            <cfif not StructIsEmpty(navigation.g
                                 <cfset transMap = navigation.getTranslation(
                                 <cfif formData.webid is formData.navid>
                                       <cfset navMap = transMap>
                                 <cfelse>
                                       <cfset navMap = navigation.getTranslation(
                                 </cfif>
                                 <cfif formData.subid gt 0>
                                       <cfset subMap = navigation.getTranslation(
                                 </cfif>
                                 <cfif not (isDefined("arguments.fite
                                       <cfif formData.blnCategory and isDefined("FORM.intCategor
                                            <cfset catMap = navigation.getTranslation(
                                       </cfif>
                                       <cfloop collection="#transMap#" item="i">
                                            <cfif formData.blnCategory and isDefined("FORM.intCategor
                                                  <cfset newFormDataQueryValue = Replace(formDataQueryValue
                                            </cfif>
                                            <cfquery name="qryTranslateItem" datasource="#this.datasour
                                                  INSERT INTO tblItem
                                                  (blnNeedsTranslation, intWebID, intDataType, intNavID, intSubID, intTabID, intOrder, intCategoryID)
                                                  VALUES (1, #transMap[i]#, #val(formData.datatype)#, #navMap[i]#, <cfif formData.subid gt 0>#subMap[i]#<cfelse>0</cf
                                                 Â
                                                  INSERT INTO #formData.tablename#
                                                  (
                                                       intItemID,
                                                       <cfif formData.blnScheduling>dtS
                                                       #formDataQueryColumn#
                                                       blnLive
                                                  )
                                                  VALUES
                                                  (
                                                       IDENT_CURRENT('tblItem'),
                                                       <cfif formData.blnScheduling>#da
                                                       <cfif isDefined("newFormDataQuer
                                                             #PreserveSingleQuotes(newF
                                                       <cfelse>
                                                             #PreserveSingleQuotes(form
                                                       </cfif>
                                                       0
                                                  );
                                                 Â
                                                  SELECT IDENT_CURRENT('tblItem') as intID
                                            </cfquery>
                                            <!--- Cache: Monitor Cache update --->
                                            <cfquery name="qryUpdateCacheDate" datasource="#this.datasour
                                                  UPDATE       tblNavigation
                                                  SET       dtUpdated = GETDATE()
                                                  WHERE       intID = #Val(transMap[i])#;
                                            </cfquery>
                                            <cfset addTranslation(itemID, qryTranslateItem.intID)>
                                       </cfloop>
                                 <cfelse>
                                       <cfquery name="qryTranslateItem" datasource="#this.datasour
                                            UPDATE       tblItem
                                            SET       blnNeedsTranslation = 1
                                            WHERE       intID IN (
                                                  SELECT       intTranslateID
                                                  FROM       tblItemTranslate
                                                  WHERE       intItemID = #Val(itemID)#
                                            )
                                       </cfquery>
                                 </cfif>
                                 <!--- send emails out to translators --->
                                 <cfloop collection="#transMap#" item="i">
                                       <cfset sendAllTranslateEmails(i)>
                                 </cfloop>
                            </cfif>
                      </cfif>
                 </cfif>
                Â
                 <cfreturn itemID />
           <cfelse>
                 <cfreturn qryInsert.intTableID />
           </cfif>
      </cffunction>
     Â
      <!--- UPDATES AN EXISTING RECORD IN THE DB GIVEN THE FORMID --->
      <cffunction name="updateRecord" access="public" output="false">
           <cfargument name="ID" type="numeric" required="true">
           <cfargument name="formData" type="any" required="true">
           <cfobjectcache action="clear" />
           <!--- make sure the columns all exist --->
           <cfset verifyColumns(formData)>
           <cfset TYPES = this.TYPES>
           <cfif formData.blnWorkflow>
                 <cfset insertRecord(formData, arguments.ID)>
           <cfelse>
                 <cfquery name="qryUpdate" datasource="#this.datasour
                      UPDATE #formData.tablename#
                      SET
                      <cfloop from="1" to="#ArrayLen(formData.col
                       <cfset i = formData.columns[key]>
                    <cfif (not isDefined("i.insert")) or i.insert neq "false">
                                 <cfset t = "#Val(i.type)#">
                            #i.varname# =
                            <cfif ListFind("#TYPES.TEXT#,#TY
                                 N'<cfif StructKeyExists(FORM, i.varname)>#FORM[i.varname
                            <cfelseif i.type is TYPES.HTML>
                                 <cfset htmltext = prepareTokens(FORM[i.varna
                                 N'<cfif StructKeyExists(FORM, i.varname)>#htmltext#</cfi
                            <cfelseif ListFind("#TYPES.DATE#", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname) and isDate(FORM[i.varname])>
                                       #CreateODBCDate(FORM[i.var
                                 <cfelse>
                                       NULL
                                 </cfif>
                            <cfelseif ListFind("#TYPES.CATEGORY#
                                 <cfif StructKeyExists(FORM, "#i.varname#_add_title") and FORM["#i.varname#_add_titl
                                       #formData.object.addCatego
                                 <cfelseif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                            #Val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.MEDIA#", i.type)>
                                       <cfif SESSION.blnAddResource
                                  and StructKeyExists(FORM, "#i.varname#_add_title") and FORM["#i.varname#_add_titl
                                  and StructKeyExists(FORM, "#i.varname#_upload") and FORM["#i.varname#_upload"]
                                  and StructKeyExists(FORM, "#i.varname#_category") and FORM["#i.varname#_category
                                       <cfset resources = createObject('component', 'hb50.internal.resources')
                                       #resources.addResource(FOR
                                 <cfelseif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                            #Val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.NUMBER#,#
                                 <cfif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "">
                                            #Val(FORM[i.varname])#
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.FEATURED#
                                 <cfif StructKeyExists(FORM, i.varname) and FORM[i.varname] neq "" and FORM[i.varname] eq "on">
                                       1
                                 <cfelse>
                                       0
                                 </cfif>
                            <cfelseif ListFind("#TYPES.RADIO#", i.type)>
                                 <cfif StructKeyExists(FORM, i.varname)>
                                       <cfif isDefined("i.varType") >
                                                  <cfif i.varType is "int">
                                                  #Val(FORM[i.varname])#
                                                  <cfelseif i.varType is "bit">
                                                       <cfif Val(FORM[i.varname]) gt 0>
                                                             1
                                                       <cfelse>
                                                             0
                                                       </cfif>
                                                  <cfelse>
                                                       N'#FORM[i.varname]#'
                                                  </cfif>
                                            <cfelse>
                                             N'#Val(FORM[i.varname])#'
                                            </cfif>                                 Â
                                       </cfif>
                                 </cfif>
                                 ,
                             </cfif>
                      </cfloop>
                      <cfif formData.blnResources>
                            intResourceID = <cfif isDefined("qryResource.int
                      </cfif>
                      <cfif formData.blnScheduling>
                            <cfif isDefined("dtStart_hidden"
                                 dtStart =
                                 <cfif StructKeyExists(FORM, "dtStart_chk") and FORM.dtStart_chk neq "" and FORM.dtStart_chk eq "on">
                                       <cfif not isDate(dtStart_time)>
                                            <cfset date = ParseDateTime(dtStart_hidd
                                       <cfelse>
                                            <cfset date = ParseDateTime("#dtStart_hi
                                       </cfif>
                                       #CreateODBCDateTime(date)#
                                 <cfelse>
                                       NULL
                                 </cfif>,
                                 dtEnd =
                                 <cfif StructKeyExists(FORM, "dtEnd_chk") and FORM.dtEnd_chk neq "" and FORM.dtEnd_chk eq "on">
                                       <cfif not isDate(dtEnd_time)>
                                            <cfset date = ParseDateTime(dtEnd_hidden
                                       <cfelse>
                                            <cfset date = ParseDateTime("#dtEnd_hidd
                                       </cfif>
                                       #CreateODBCDateTime(date)#
                                 <cfelse>
                                       NULL
                                 </cfif>,
                            <cfelse>
                                 dtStart = NULL,
                                 dtEnd = NULL,
                            </cfif>
                      </cfif>
                      <cfif formData.blnMeta>
                            txtMetaKeywords = N'<cfif StructKeyExists(FORM, 'txtMetaKeywords')>#txtMet
                            txtMetaDescription = N'<cfif StructKeyExists(FORM, 'txtMetaDescription')>#txt
                      </cfif>
                      dtUpdated = getdate()
                      WHERE       #formData.varID# = #Val(arguments.ID)#;
                 </cfquery>
                 <!--- update the ssl flag for the children of this navigation table to be the same --->
                 <cfif formData.tablename is 'tblNavigation'>
                      <cfquery name="qryUpdateSSL" datasource="#this.datasour
                            UPDATE tblNavigation
                            SET       blnSSL = <cfif isDefined("FORM.blnSSL") and FORM.blnSSL neq "" and FORM.blnSSL is "on">1<cfelse>0</cfif>
                            WHERE       intParentID = #arguments.ID#
                      </cfquery>
                 </cfif>
                 <!--- Cache: Monitor Cache update --->
                 <cfif isDefined("formData.webid"
                      <cfquery name="qryUpdateCacheDate" datasource="#this.datasour
                            UPDATE tblNavigation
                            SET dtUpdated = GETDATE()
                            WHERE intID = #Val(formData.webid)#;
                      </cfquery>
                 </cfif>
           </cfif>
      </cffunction>
      <cffunction name="deleteRecord" access="public" output="false">
           <cfargument name="ID" type="numeric" required="true">
           <cfargument name="formData" type="any" required="true">
           <cfobjectcache action="clear"/>
           <cfif not formData.blnWorkflow>
                 <cfif formData.blnRestore>
                      <cfquery name="qryDelete" datasource="#this.datasour
                            UPDATE       #formData.tablename#
                            SET       blnDeleted = <cfqueryparam value="1" cfsqltype="cf_sql_bit">
                            WHERE       intID = <cfqueryparam value="#Val(arguments.ID)#
                      </cfquery>
                 <cfelse>
                      <cfquery datasource="#this.datasour
                            DELETE FROM #formData.tablename#
                            WHERE       intID = <cfqueryparam value="#Val(arguments.ID)#
                      </cfquery>
                 </cfif>
           <cfelseif formData.blnWorkflow>
                 <cfquery name="qryDelete" datasource="#this.datasour
                      UPDATE       tblItem
                      SET       blnDeleted = <cfqueryparam value="1" cfsqltype="cf_sql_bit">,
                                 blnStagingChange = <cfqueryparam value="1" cfsqltype="cf_sql_bit">
                      WHERE       intID = <cfqueryparam value="#Val(arguments.ID)#
                 </cfquery>
           </cfif>
      </cffunction>
      <cffunction name="restoreRecord" access="public" output="false">
           <cfargument name="ID" type="numeric" required="true">
           <cfargument name="formData" type="any" required="true">
           <cfobjectcache action="clear" />
           <cfif formData.blnWorkflow>
                 <cfquery name="qryDelete" datasource="#this.datasour
                      UPDATE       tblItem
                      SET       blnDeleted = <cfqueryparam value="0" cfsqltype="cf_sql_bit">,
                                 blnStagingChange = <cfqueryparam value="1" cfsqltype="cf_sql_bit">,
                                 blnStagingNew = <cfqueryparam value="1" cfsqltype="cf_sql_bit">
                      WHERE       intID = <cfqueryparam value="#Val(arguments.ID)#
                 </cfquery>
           <cfelse>
                 <cfquery name="qryDelete" datasource="#this.datasour
                      UPDATE       #formData.tablename#
                      SET       blnDeleted = <cfqueryparam value="0" cfsqltype="cf_sql_bit">
                      WHERE       intID = <cfqueryparam value="#Val(arguments.ID)#
                 </cfquery>
           </cfif>
      </cffunction>
      <!--- sets the edit copy to be the active copy, archive old active, unlock item --->
      <cffunction name="checkIn" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfargument name="editReason" type="string" default="" required="false">
           <cfif not formData.blnWorkflow>
                 <cfreturn>
           </cfif>
           <cfobjectcache action="clear" />
           <cfquery name="qryItem" datasource="#this.datasour
                 SELECT       TOP 1 *
                 FROM       #formData.tablename#
                 WHERE       intItemID = #Val(arguments.itemID)#
                 AND       blnLive = 0
                 ORDER BY dtAdded DESC
           </cfquery>
           <cfloop from="1" to="#ArrayLen(formData.col
                 <cfif formData.columns[i].type is TYPES.FEATURED>
                      <cfif qryItem[formData.columns[i
                            <cfquery name="qryClearFeatured" datasource="#this.datasour
                                 UPDATE tblItem
                                 SET       blnFeatured = 0,
                                            blnStagingChange = 1
                                 WHERE       intWebID = #formData.webid#
                                 AND            blnFeatured = 1;
                                Â
                                 UPDATE       #formData.tablename#
                                 SET       #formData.columns[i].varna
                                 WHERE       intItemID IN
                                                  (SELECT intID
                                                  FROM       tblItem
                                                  WHERE       intWebID = #formData.webid#
                                                  AND       intItemID <> #Val(arguments.itemID)#);
                            </cfquery>
                            <!--- Cache: Monitor Cache update --->
                            <cfquery name="qryUpdateCacheDate" datasource="#this.datasour
                                 UPDATE tblNavigation
                                 SET dtUpdated = GETDATE()
                                 WHERE intID = #Val(formData.webid)#;
                            </cfquery>
                      </cfif>
                 </cfif>
           </cfloop>
           <cfif requestApproval(itemID, formData, editReason) or (not formData.blnApproval)>
                 <cfquery name="qryCheckIn" datasource="#this.datasour
                      DELETE FROM tblItemLock
                      WHERE       intItemID = #Val(arguments.itemID)#;
                     Â
                      UPDATE       tblItem
                      SET       intNavID = #formData.navid#,
                                 intSubID = #formData.subid#,
                                 intTabID = #formData.tabid#,
                                 blnNeedsTranslation = 0,
                                 blnStagingChange = 1
                                 <cfif isDefined("FORM.intCategor
                                 , intCategoryID = #Val(FORM.intCategoryID)#
                                 </cfif>
                                 <cfif ListFindNoCase(qryItem.col
                                 , blnFeatured = 1
                                 </cfif>
                      WHERE       intID = #Val(arguments.itemID)#
                 </cfquery>
                 <!--- Cache: Monitor Cache update --->
                 <cfquery name="qryUpdateCacheDate" datasource="#this.datasour
                      UPDATE tblNavigation
                      SET dtUpdated = GETDATE()
                      WHERE intID = #Val(formData.subid)#;
                 </cfquery>
           </cfif>
           <cfset deleteOldVersions(itemID, formData)>
      </cffunction>
      <!--- creates an edit copy, sets the item as locked --->
      <cffunction name="checkOut" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfobjectcache action="clear"/>
           <cfquery name="qryCheckOut" datasource="#this.datasour
                 UPDATE tblItem
                 SET       intNavID = #formData.navid#,
                            intSubID = #formData.subid#,
                            intTabID = #formData.tabid#
                 WHERE       intID = #Val(arguments.itemID)#;
                Â
                 DELETE FROM tblItemLock
                 WHERE       intItemID = #Val(arguments.itemID)#;
                Â
                 INSERT INTO tblItemLock
                      (intUserID, intItemID)
                 VALUES (
                      #SESSION.userid#,
                      #Val(arguments.itemID)#
                 )
           </cfquery>
      </cffunction>
      <!--- returns a query with user IDs who have itemID locked out --->
      <cffunction name="getLockUsers" access="public" returntype="query" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfquery name="qryLockUsers" datasource="#this.datasour
                 SELECT       *
                 FROM       tblItemLock
                 WHERE       intItemID = #Val(arguments.itemID)#
           </cfquery>
          Â
           <cfreturn qryLockUsers />
      </cffunction>
      <!--- checks if there are moderators. if so, tell them to moderate. if not, approve the item. returns true if approved. --->
      <cffunction name="requestApproval" access="public" returntype="boolean" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfargument name="editReason" type="string" required="true">
           <cfobjectcache action="clear" />
          Â
           <!--- return variable --->
           <cfparam name="retVal" default="false" type="boolean">
           <cfif SESSION.superuser>
                 <cfset setLive(itemID, formData)>
                 <cfreturn true />
           </cfif>
          Â
           <!--- we first need to get the last level of approval from the item table --->
           <cfquery name="qryLastApproved" datasource="#this.datasour
                 SELECT       intID, intLastLevel
                 FROM       tblItem
                 WHERE       intID = #itemID#
           </cfquery>
          Â
           <!--- we also need to get the number of approval levels for this page. There should
                  be at least one level i.e. 0 --->
           <cfquery name="qryModLevels" datasource="#this.datasour
                 SELECT       TOP 1 intLevel
                 FROM       tblModerator
                 WHERE       intNavID = #formData.webid#
                 ORDER BY intLevel DESC
           </cfquery>
          Â
           <!--- these vars will be sent to the approve function --->
           <cfset approveLevel = qryLastApproved.intLastLev
           <cfset maxApproveLevel = Val(qryModLevels.intLevel)
           <!--- <cfset modLevel = 1> --->
           <!--- we want to see if the current session user is at the correct access level
                  for this page to be allowed to approve --->
           <cfif qryLastApproved.recordCoun
                 <!--- using our highest approval level, we add one to that to define our level filter
                       for the query below --->
                 <cfset levelFilter = qryLastApproved.intLastLev
                 <!--- check if moderator is not a superuser --->
                 <cfif formData.blnCategory and isdefined("FORM.intCategor
                      <cfquery name="qryCheckModerator" datasource="#this.datasour
                            SELECT tblUser.intID, tblUserGroup.intGroupID,
                                 tblUserGroup.intUserID, tblModerator.intModeratorI
                            FROM tblUserGroup
                            INNER JOIN tblUser ON tblUser.intID = tblUserGroup.intUserID
                            INNER JOIN tblModerator ON tblUserGroup.intGroupID = tblModerator.intModeratorI
                            WHERE tblUser.intID = #session.userid#
                            AND tblModerator.intNavID = #val(form.intCategoryID)#
                            AND tblModerator.intLevel = #levelFilter#
                      </cfquery>     Â
                     Â
                      <!--- if current user is a moderator, then approve and increment the level --->
                      <cfif qryCheckModerator.recordCo
                            <cfset retVal = approve(itemID, formData,approveLevel,maxA
                            <!--- if false, then we want to increment the level by two i.e. skip a level --->
                            <cfif retVal EQ false>
                                 <cfset modLevel = qryLastApproved.intLastLev
                            <cfelse>
                                 <!--- since our approval went through, we simply return --->
                                 <cfreturn retVal>
                            </cfif>     Â
                      <cfelse>
                            <cfset modLevel = qryLastApproved.intLastLev
                      </cfif>
                 <cfelse>
                      <cfquery name="qryCheckModerator" datasource="#this.datasour
                            SELECT tblUser.intID, tblUserGroup.intGroupID,
                                 tblUserGroup.intUserID, tblModerator.intModeratorI
                            FROM tblUserGroup
                            INNER JOIN tblUser ON tblUser.intID = tblUserGroup.intUserID
                            INNER JOIN tblModerator ON tblUserGroup.intGroupID = tblModerator.intModeratorI
                            WHERE tblUser.intID = #session.userid#
                            AND tblModerator.intNavID = #formData.webid#
                            AND tblModerator.intLevel = #levelFilter#
                      </cfquery>     Â
                      <!--- if current user is a moderator, then approve and increment the level --->
                      <cfif qryCheckModerator.recordCo
                            <cfset retVal = approve(itemID, formData,approveLevel,maxA
                            <!--- if false, then we want to increment the level by two i.e. skip a level --->
                            <cfif retVal EQ false>
                                 <cfset modLevel = qryLastApproved.intLastLev
                            <cfelse>
                                 <!--- since our approval went through, we simply return --->
                                 <cfreturn retVal>
                            </cfif>
                      <cfelse>
                            <cfset modLevel = qryLastApproved.intLastLev
                      </cfif>                Â
                 </cfif>
           </cfif>
           <!--- get a list of moderators that will need to be notified of approvals --->
           <cfset qryModerators = getApprovalModerators(modL
           <cfif qryModerators.recordcount>
                 <cfquery datasource="#this.datasour
                      DELETE FROM tblItemLock
                      WHERE intItemID = #itemID#;
                     Â
                      UPDATE tblItem
                      SET blnApproved = 0,
                            intApproveUserID = #session.userid#
                      WHERE intID = #itemID#;
                     Â
                      <cfloop query="qryModerators">
                            INSERT INTO tblItemLock (intUserID, intItemID, blnApproval, txtEditReason)
                            VALUES (#intID#, #itemID#, 1, '#editReason#');
                      </cfloop>
                 </cfquery>
                 <cfloop query="qryModerators">
                      <cfset sendApprovalEmail(intID, editReason)>
                 </cfloop>
                 <cfset retVal = false>
           <cfelse>
                 <cfreturn approve(itemID, formData,approveLevel,maxA
           </cfif>
          Â
           <cfreturn retVal />
      </cffunction>
     Â
      <!--- this function retrieves all the users at the given moderator level --->
      <cffunction name="getApprovalModerator
           <cfargument name="modLevel" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
          Â
           <cfobjectcache action="clear" />
          Â
           <!---perform a query to determine the list of moderators for the given level --->
           <cfif formData.blnCategory and isdefined("form.intCategor
                 <cfquery name="qryModerators" datasource="#this.datasour
                      SELECT tblModerator.intModeratorI
                      FROM tblModerator
                      LEFT JOIN tblUserGroup ON tblModerator.intModeratorI
                      JOIN tblUser ON tblUserGroup.intUserID = tblUser.intID
                      WHERE intLevel = #modLevel#
                      AND intNavID = #val(form.intCategoryID)#
                 </cfquery>
           </cfif>
           <cfif (not isDefined("qryModerators")
                 <cfobjectcache action="clear" />
                Â
                 <cfquery name="qryModerators" datasource="#this.datasour
                      SELECT tblModerator.intModeratorI
                      FROM tblModerator
                      LEFT JOIN tblUserGroup ON tblModerator.intModeratorI
                      JOIN tblUser ON tblUserGroup.intUserID = tblUser.intID
                      WHERE intLevel = #modLevel#
                      AND intNavID = #formData.webid#
                 </cfquery>
           </cfif>
          Â
           <cfreturn qryModerators />
      </cffunction>
     Â
      <!--- this function retrieves all the users at the given notification level --->
      <cffunction name="getNotificationUsers
           <cfargument name="modLevel" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
          Â
           <cfobjectcache action="clear" />
          Â
           <!---perform a query to determine the list of moderators for the given level --->
           <cfif formData.blnCategory and isdefined("form.intCategor
                 <!--- if the modlevel is -1, then this is notification for last level.
                       The reason for this logic is that the intlastlevel is set to zero in tblitem,
                      so no notifications would be sent to last level notify group --->
                 <cfif modLevel IS -1>
                      <cfquery name="qryLastMod" datasource="#this.datasour
                            SELECT intLevel
                            FROM tblModerator
                            WHERE intNavID = #val(form.intCategoryID)#
                            ORDER BY intLevel DESC
                      </cfquery>
                      <cfif qryLastMod.recordCount>
                            <cfset modLevel = qryLastMod.intLevel>
                      </cfif>
                 </cfif>
                 <cfquery name="qryNotifiers" datasource="#this.datasour
                      SELECT tblModerator.intNotifierID
                      FROM tblModerator
                      LEFT JOIN tblUserGroup ON tblModerator.intNotifierID
                      JOIN tblUser ON tblUserGroup.intUserID = tblUser.intID
                      WHERE intLevel = #modLevel#
                      AND intNavID = #val(form.intCategoryID)#
                 </cfquery>
           </cfif>
           <cfif (not isDefined("qryNotifiers"))
                 <cfobjectcache action="clear"/>
                 <!--- if the modlevel is -1, then this is notification for last level.
                       The reason for this logic is that the intlastlevel is set to zero in tblitem,
                      so no notifications would be sent to last level notify group --->
                 <cfif modLevel IS -1>
                      <cfquery name="qryLastMod" datasource="#this.datasour
                            SELECT intLevel
                            FROM tblModerator
                            WHERE intNavID = #formData.webid#
                            ORDER BY intLevel DESC
                      </cfquery>
                      <cfif qryLastMod.recordCount>
                            <cfset modLevel = qryLastMod.intLevel>
                      </cfif>
                 </cfif>
                 <cfquery name="qryNotifiers" datasource="#this.datasour
                      SELECT tblModerator.intNotifierID
                      FROM tblModerator
                      LEFT JOIN tblUserGroup ON tblModerator.intNotifierID
                      JOIN tblUser ON tblUserGroup.intUserID = tblUser.intID
                      WHERE intLevel = #modLevel#
                      AND intNavID = #formData.webid#
                 </cfquery>
           </cfif>
           <cfreturn qryNotifiers/>
      </cffunction>
      <cffunction name="sendWorkflowNotifica
           <cfargument name="formData" type="any" required="true">
           <cfargument name="itemID" type="numeric" required="false">
          Â
           <cfparam name="modLevel" default="0">
          Â
           <!--- we first need to get the last level of approval from the item table --->
           <cfquery name="qryLastApproved" datasource="#this.datasour
                 SELECT intID, intLastLevel, blnApproved
                 FROM tblItem
                 WHERE intID = #itemID#
           </cfquery>
          Â
           <cfquery name="qryTitle" datasource="#this.datasour
                 SELECT txtTitle,'index.cfm?navid=
                                  + '&subid=' + CAST(tblItem.intSubID as varchar)
                                  + '&id=' + CAST(tblItem.intID as varchar)
                                  + '&tabid=' + CAST(tblItem.intTabID as varchar)
                                  + '&mode=edit' as txtLink
                 FROM tblNavigation                Â
                 LEFT JOIN tblItem ON tblItem.intWebID = tblNavigation.intID
                 WHERE tblNavigation.intID = #formData.webid#
           </cfquery>
          Â
           <cfif qryLastApproved.recordCoun
                 <cfset modLevel = qryLastApproved.intLastLev
                 <!--- check if this is the last level. If so, then set modlevel to -1 so that
                       only notifiers in final notification level are notified. see getnotificationusers()--->
                 <cfif modLevel IS 0 AND qryLastApproved.blnApprove
                      <cfset modLevel = -1>
                 </cfif>
           </cfif>
          Â
           <!--- get a list of moderators that will need to be notified of changes --->
           <cfset qryNotifiers = getNotificationUsers(modLe
           <cfif qryNotifiers.recordcount>
                 <cfloop query="qryNotifiers">
                      <cftry>
                            <cfset userInfo = getObject("hb50.access", this.CompanyID, true).getUserData(intID)>
                            <cfcatch>
                                 <cfreturn>
                            </cfcatch>
                      </cftry>
                      <cfset this.communication = getObject("hb50.communicat
                      <cfset this.communication.sendInt
                 </cfloop>
           </cfif>
          Â
      </cffunction>
      <cffunction name="sendApprovalEmail" access="public" output="false">
           <cfargument name="intUserID" type="numeric" required="true">
           <cfargument name="editReason" type="string" required="true">
           <!--- if this is a bad user ID, just return --->
           <cftry>
                 <cfset userInfo = getObject("hb50.access", this.CompanyID, true).getUserData(intUserI
                 <cfcatch>
                      <cfreturn>
                 </cfcatch>
           </cftry>
          Â
           <cftry>
           <cfquery name="qryTools" datasource="#this.datasour
                 SELECT DISTINCT txtTable
                 FROM (
                            SELECT txtTitle as txtTool, txtTablename as txtTable FROM tblPlugin
                            UNION
                            SELECT txtTitle + ' Category' as txtTool, txtCategoryTable as txtTable FROM tblPlugin
                       ) tblPlugins
                 WHERE txtTable != '' AND txtTable IS NOT NULL AND txtTable != 'tblTheme' AND txtTable != 'tblDisplaySettings'
           </cfquery>           Â
            <cftransaction>
                 <cfquery name="qryLocked" datasource="#this.datasour
                      SELECT tblItem.*, tblItem.intID as intItemID,
                                 tblItemLock.blnApproval, tblItemLock.txtEditReason,
                                 'index.cfm?navid=' + CAST(tblItem.intNavID as varchar)
                                  + '&subid=' + CAST(tblItem.intSubID as varchar)
                                  + '&id=' + CAST(tblItem.intID as varchar)
                                  + '&tabid=' + CAST(tblItem.intTabID as varchar)
                                  + '&mode=edit' as txtLink,
                                  tblUser.txtFirstName + ' ' + tblUser.txtLastName as txtApproveUser,
                                  tblAll.dtStart
                      FROM tblItemLock
                      LEFT JOIN tblItem ON intItemID = tblItem.intID
                      LEFT JOIN tblNavigation ON tblItem.intWebID = tblNavigation.intID
                      LEFT JOIN (
                            <cfloop query="qryTools">
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM #qryTools.txtTable#
          Â
                             UNION
                            </cfloop>
                      Â
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM tblContent
          Â
                             UNION
          Â
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM tblResourceCategory
                      ) tblAll
                            ON tblAll.intItemID = tblItem.intID
                                 AND tblAll.intID IN
                                  (SELECT TOP 1 intID
                                       FROM (
                                            <cfloop query="qryTools">
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM #qryTools.txtTable#
                           Â
                                             UNION
                                            </cfloop>
                                       Â
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM tblContent
                           Â
                                             UNION
                           Â
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM tblResourceCategory
                                            Â
                                       ) tblAll2
                                       WHERE intItemID = tblItem.intID
                                       ORDER BY dtAdded DESC)
                      LEFT JOIN tblUser ON tblItem.intApproveUserID = tblUser.intID
                      WHERE tblItemLock.intUserID = #intUserID#
                      AND tblItem.blnDeleted = 0
                      AND tblItemLock.blnApproval = 1
                      AND tblNavigation.intCompanyID
                      ORDER BY tblNavigation.txtTitle, tblAll.txtTitle
                 </cfquery>
           </cftransaction>
           <cfcatch>
           </cfcatch>
           </cftry>
           <cfsavecontent variable="msg"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><cfoutput>#this.qry
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<cfoutput><base href="#this.qryCompany.txt
<style type="text/css">
<!--
body {
      background-color: #E5E5E5;
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
.hbTitle {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 18px;
      color: #CCCCCC;
}
.hbRegular {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      color: #333333;
}
.hbRegular a:link {color: #333333; text-decoration: underline}
.hbRegular a:visited {color: #333333; text-decoration: underline}
.hbRegular a:hover {color: #333333; text-decoration: underline}
.hbRegular a:active {color: #333333; text-decoration: underline}
.bhList {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 11px;
      color: #333333;
      width: 250px;
}
.hbTable {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 11px;
      color: #333333;
}
-->
</style></head>
<body>
<br>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
  <td bgcolor="#D8D8D8"><img src="images/shim.gif" width="1" height="16"></td>
 </tr>
 <tr>
  <td align="right" valign="bottom" bgcolor="#FFFFFF" class="hbTitle"><table border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="2"> </td>
   </tr>
   <tr>
    <td width="332"><img src="images/shim.gif" width="332" height="1"></td>
    <td width="308" align="left" class="hbTitle"><p><cfoutp
    </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td height="200" bgcolor="#FFFFFF">      <table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
    </tr>
   <tr>
    <td width="50"> </td>
    <td width="258" align="left" valign="middle"><a href="<cfoutput>#this.qryC
    <td width="24"> </td>
    <td width="258" valign="top" class="hbRegular"><strong>
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
    </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td valign="top" bgcolor="#FFFFFF"><table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
   <tr>
    <td width="50"> </td>
    <td colspan="3" align="left" valign="top" class="hbRegular">
     <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
       <td bgcolor="#CCCCCC"><table width="100%"  border="0" cellspacing="1" cellpadding="3">
        <tr bgcolor="#E6E6E6" class="hbTable">
         <td>Web Page</td>
         <td style="padding-right: 5px; padding-left: 5px;">Author</td>
         <td style="padding-right: 5px; padding-left: 5px;">Note</td>
         <td style="padding-right: 5px; padding-left: 5px;">Live Date</td>
        </tr>
        <cfif isDefined("qryLocked") AND qryLocked.recordCount>
                            <cfoutput query="qryLocked">
              <tr class="hbTable">
               <td bgcolor="##F7F7F7"><a href="#this.qryCompany.txt
               <td bgcolor="##FFFFFF" style="padding-right: 5px; padding-left: 5px;"><nobr>#txtApproveUse
               <td bgcolor="##FFFFFF" style="padding-right: 5px; padding-left: 5px;">#qryLocked.txtEditRe
               <td bgcolor="##F7F7F7" style="padding-right: 5px; padding-left: 5px;"><nobr><cfif len(dtStart)>#DateFormat(d
              </tr>
                            </cfoutput>
                      </cfif>
       </table></td>
      </tr>
     </table>      </td>
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td bgcolor="#FFFFFF"><table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
   <tr>
    <td width="50"> </td>
    <td width="258" align="left" valign="middle" class="hbRegular"><p><stro
     <p>This is an automated message please do not respond to it.</p></td>
    <td width="24"> </td>
    <td width="258" align="right" valign="bottom" class="hbRegular"><p><a href="http://www.hotbanana.ca"><img src="images/logo_hotbanana
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#D8D8D8"><img src="images/shim.gif" width="1" height="16"></td>
 </tr>
</table>
<br>
</body>
</html>
</cfsavecontent>
           <cfset this.communication = getObject("hb50.communicat
           <cfset this.communication.sendPre
      </cffunction>
      <!--- dummy function for approve function to be called from outsite this object --->
      <cffunction name="setLive" access="public">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <!--- force the live status by ensuring the level is greater than the maxlevel --->
           <cfset approve(itemID, formData,1,0)>
          Â
      </cffunction>
     Â
      <!--- sets the record as approved, replaces the current active with the most recent edit copy --->
      <cffunction name="approve" access="public" output="true" returntype="boolean">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfargument name="level" type="numeric" required="true">
           <cfargument name="maxlevel" type="numeric" required="true">
           <cfobjectcache action="clear"/>
          Â
           <cfset qryModerators = getApprovalModerators(leve
           <cfif qryModerators.recordCount>
                 <!--- send an email to the author to keep him informed --->
                 <cfquery name="qryApproveUser" datasource="#this.datasour
                      SELECT       TOP 1 tblUser.txtEmail
                      FROM       tblItem
                      LEFT JOIN tblUser
                      ON            tblItem.intApproveUserID = tblUser.intID
                      WHERE       tblItem.intID = <cfqueryparam value="#arguments.itemID#"
                 </cfquery>
                Â
                 <!--- get the live (active?!) copy --->
                 <cfquery name="qryActiveCopy" datasource="#this.datasour
                      SELECT       TOP 1 #formData.tablename#.txtTi
                      FROM       #formData.tablename#
                      LEFT JOIN tblItem
                      ON            tblItem.intID = #formData.tablename#.intIt
                      LEFT JOIN tblNavigation
                      ON            tblItem.intWebID = tblNavigation.intID
                      WHERE       #formData.tablename#.intIt
                      ORDER BY #formData.tablename#.blnLi
                 </cfquery>
                                Â
                 <cfif Len(qryApproveUser.txtEmai
                      <cfset this.communication = getObject("hb50.communicat
                      <cfset this.communication.sendInt
                 </cfif>
           </cfif>
           <!--- now check whether the level passed in matches the max level of approval.
                  If it does, then we can make this item live since it received the last
                 level of approval. Otherwise, simply update the itme table by incrementing
                 the intlastlevel --->
           <cfif val(level) LT val(maxlevel)>
                 <cfquery datasource="#this.datasour
                      UPDATE tblItem
                      SET intLastLevel = #val(level)#
                      WHERE intID = #val(itemID)#
                 </cfquery>
           <cfelse>
                 <cfquery name="qrySetActive" datasource="#this.datasour
                      UPDATE #formData.tablename#
                      SET blnLive = 0
                      WHERE intItemID = #val(itemID)#;
     Â
                      UPDATE #formData.tablename#
                      SET blnLive = 1
                      WHERE intID IN (
                            SELECT TOP 1 intID
                            FROM #formData.tablename#
                            WHERE intItemID = #val(itemID)#
                            ORDER BY dtAdded DESC
                      );
                     Â
                      UPDATE tblItem
                      SET intNavID = #formData.navid#,
                            intSubID = #formData.subid#,
                            intTabID = #formData.tabid#,
                            blnStagingChange = 1,
                            blnApproved = 1,
                            intApproveUserID = #session.userid#,
                            intLastLevel = 0
                      WHERE intID = #val(itemID)#
                 </cfquery>
                 <cfreturn true/>
           </cfif>
           <cfreturn false/>
      </cffunction>
      <!--- sets the record as approved, replaces the current active with the most recent edit copy --->
      <cffunction name="decline" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfargument name="reason" type="string" required="true">
           <cfobjectcache action="clear" />
           <!---
                 get the userid awaiting approval
                 - tblItem.intApproveUserID
           --->
           <cfquery name="qryApproveUser" datasource="#this.datasour
                 SELECT       TOP 1 tblUser.txtEmail
                 FROM       tblItem
                 LEFT JOIN tblUser
                 ON            tblItem.intApproveUserID = tblUser.intID
                 WHERE       tblItem.intID = <cfqueryparam value="#arguments.itemID#"
           </cfquery>
          Â
           <!--- get the live (active?!) copy --->
           <cfquery name="qryActiveCopy" datasource="#this.datasour
                 SELECT       TOP 1 #formData.tablename#.txtTi
                 FROM       #formData.tablename#
                 LEFT JOIN tblItem
                 ON            tblItem.intID = #formData.tablename#.intIt
                 LEFT JOIN tblNavigation
                 ON            tblItem.intWebID = tblNavigation.intID
                 WHERE       #formData.tablename#.intIt
                 ORDER BY #formData.tablename#.blnLi
           </cfquery>
          Â
           <!--- we first need to get the last level of approval from the item table --->
           <cfquery name="qryLastApproved" datasource="#this.datasour
                 SELECT       intID, intLastLevel
                 FROM       tblItem
                 WHERE       intID = <cfqueryparam value="#arguments.itemID#"
           </cfquery>
          Â
           <!--- if the last level is not 1, then simply set the item table intlastlevel down by one --->
           <cfif qryLastApproved.intLastLev
                 <cfset newLevel = qryLastApproved.intLastLev
                 <cfset qryModerators = getApprovalModerators(qryL
                Â
                 <cfquery name="qryDeclineLevel" datasource="#this.datasour
                      UPDATE       tblItem
                      SET       intLastLevel = <cfqueryparam value="#newLevel#" cfsqltype="cf_sql_integer"
                                           Â
                      DELETE FROM tblItemLock
                      WHERE       intItemID = <cfqueryparam value="#arguments.itemID#"
                                           Â
                      <cfloop query="qryModerators">
                            INSERT INTO tblItemLock (
                                 intUserID, intItemID, blnApproval, txtEditReason)
                            VALUES (
                                 <cfqueryparam value="#intID#" cfsqltype="cf_sql_integer"
                                 <cfqueryparam value="#arguments.itemID#"
                                 <cfqueryparam value="1" cfsqltype="cf_sql_bit">,
                                 <cfqueryparam value="#arguments.reason#"
                      </cfloop>
                 </cfquery>
           <cfelse>           Â
                 <!--- if this is not a superuser and this moderator has declined, then
                       drop the lastlevel down by one so that the next mod level down can reapprove ???--->
                 <cfquery name="qryDelApprove" datasource="#this.datasour
                      DELETE FROM #formData.tablename#
                      WHERE intID IN (
                            SELECT       TOP 1 intID
                            FROM      #formData.tablename#
                            WHERE      blnLive = <cfqueryparam value="0" cfsqltype="cf_sql_bit">
                            AND       intItemID = <cfqueryparam value="#arguments.itemID#"
                            ORDER BY dtAdded DESC);
                     Â
                      DELETE FROM tblItemLock
                      WHERE       intItemID = <cfqueryparam value="#arguments.itemID#"
     Â
                      UPDATE       tblItem
                      SET       intNavID = <cfqueryparam value="#formData.navid#" cfsqltype="cf_sql_integer"
                                 intSubID = <cfqueryparam value="#formData.subid#" cfsqltype="cf_sql_integer"
                                 intTabID = <cfqueryparam value="#formData.tabid#" cfsqltype="cf_sql_integer"
                                 blnApproved = <cfqueryparam value="1" cfsqltype="cf_sql_bit">                           Â
                      WHERE       intID = <cfqueryparam value="#arguments.itemID#"
                 </cfquery>
                Â
                 <cfquery name="qryAnyLeft" datasource="#this.datasour
                      SELECT       TOP 1 intItemID
                      FROM       #formData.tablename#
                      WHERE       intItemID = <cfqueryparam value="#arguments.itemID#"
                 </cfquery>
     Â
                 <cfif qryAnyLeft.recordcount is 0>
                      <cfquery name="qryEraseItem" datasource="#this.datasour
                            DELETE FROM tblItem
                            WHERE      intID = <cfqueryparam value="#arguments.itemID#"
                      </cfquery>
                 </cfif>
           </cfif>
           <cfif Len(qryApproveUser.txtEmai
                 <cfset this.communication = getObject("hb50.communicat
                 <cfset this.communication.sendInt
           </cfif>
      </cffunction>
      <cffunction name="isLocked" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="userID" type="numeric" required="true">
          Â
           <cfif SESSION.superuser>
                 <cfreturn false />
           </cfif>
           <cfquery name="qryItemLock" datasource="#this.datasour
                 SELECT       intUserID
                 FROM       tblItemLock
                 WHERE       intItemID = <cfqueryparam value="#arguments.itemID#"
           </cfquery>
           <cfreturn qryItemLock.recordCount gt 0 and not ListFind(ValueList(qryItem
      </cffunction>
      <cffunction name="canApprove" access="public" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="userID" type="numeric" required="true">
          Â
           <cfif isLocked(itemID, userID)>
                 <cfreturn false />
           </cfif>
           <cfquery name="qryNeedsApproval" datasource="#this.datasour
                 SELECT       blnApproved
                 FROM       tblItem
                 WHERE       intID = <cfqueryparam value="#arguments.itemID#"
           </cfquery>
           <cfreturn qryNeedsApproval.blnApprov
      </cffunction>
      <cffunction name="deleteOldVersions" access="private" returntype="string" output="false">
           <cfargument name="itemID" type="numeric" required="true">
           <cfargument name="formData" type="struct" required="true">
           <cfobjectcache action="clear" />
           <cfquery name="qryDeleteVersions" datasource="#this.datasour
                 DELETE FROM #formData.tablename#
                 WHERE       blnLive = 0
                 AND       intItemID = <cfqueryparam value="#arguments.itemID#"
                 <cfif formData.blnVersion>
                       AND intID NOT IN (
                            SELECT       TOP #this.MAX_VERSIONS# intID
                            FROM       #formData.tablename#
                            WHERE       intItemID = <cfqueryparam value="#arguments.itemID#"
                            AND       blnLive = <cfqueryparam value="0" cfsqltype="cf_sql_bit">
                            ORDER BY dtAdded DESC
                      )
                 </cfif>
           </cfquery>
      </cffunction>
      <cffunction name="sendAllTranslateEmai
           <cfargument name="intCompanyID" type="numeric" required="true">
           <cfquery name="qryTranslators" datasource="#this.datasour
                 SELECT       intCompanyID, intUserID
                 FROM       tblTranslator
                 WHERE       intCompanyID = <cfqueryparam value="#arguments.intCompa
           </cfquery>
          Â
           <cfloop query="qryTranslators">
                 <cfset sendTranslateEmail(intComp
           </cfloop>
      </cffunction>
     Â
      <cffunction name="sendTranslateEmail" access="public" output="false">
           <cfargument name="intCompanyID" type="numeric" required="true">
           <cfargument name="intUserID" type="numeric" required="true">
          Â
           <!--- if this is a bad user ID, just return --->
           <cftry>
                 <cfset userInfo = getObject("hb50.access", this.CompanyID, true).getUserData(intUserI
                 <cfcatch>
                      <cfreturn>
                 </cfcatch>
           </cftry>
          Â
           <cfquery name="qryTools" datasource="#this.datasour
                 SELECT DISTINCT txtTable
                 FROM
                      (SELECT      txtTitle AS txtTool, txtTablename AS txtTable
                       FROM       tblPlugin
                       UNION
                       SELECT txtTitle + ' Category' AS txtTool, txtCategoryTable AS txtTable
                       FROM       tblPlugin)
                      tblPlugins
                 WHERE       txtTable != ''
                 AND       txtTable IS NOT NULL
           </cfquery>
           <cftransaction>
                 <cfquery name="qryLocked" datasource="#this.datasour
                      SELECT tblItem.*, tblItem.intID as intItemID, tblNavigation.txtTitle + ' > ' + tblAll.txtTitle as txtLabel, tblAll.dtAdded,
                                 'index.cfm?navid=' + CAST(tblItem.intNavID as varchar)
                                  + '&subid=' + CAST(tblItem.intSubID as varchar)
                                  + '&id=' + CAST(tblItem.intID as varchar)
                                  + '&tabid=' + CAST(tblItem.intTabID as varchar)
                                  + '&mode=edit' as txtLink,
                                  tblAll.dtStart,
                                  tblUser.txtFirstName + ' ' + tblUser.txtLastName as txtAuthor
                      FROM tblItem
                      LEFT JOIN tblNavigation ON tblItem.intWebID = tblNavigation.intID
                      LEFT JOIN (
                            <cfloop query="qryTools">
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM #qryTools.txtTable#
          Â
                             UNION
                            </cfloop>
                      Â
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM tblContent
          Â
                             UNION
          Â
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM tblResourceCategory
                             UNION
          Â
                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                             FROM tblResource
                      ) tblAll
                            ON tblAll.intItemID = tblItem.intID
                                 AND tblAll.intID IN
                                  (SELECT TOP 1 intID
                                       FROM (
                                            <cfloop query="qryTools">
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM #qryTools.txtTable#
                           Â
                                             UNION
                                            </cfloop>
                                       Â
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM tblContent
                           Â
                                             UNION
                           Â
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM tblResourceCategory
                                             UNION
                           Â
                                             SELECT intID, intItemID, txtTitle, dtAdded, blnLive, dtStart
                                             FROM tblResource
                                       ) tblAll2
                                       WHERE intItemID = tblItem.intID
                                       ORDER BY dtAdded DESC)
                      LEFT JOIN tblItemTranslate ON tblItem.intID = tblItemTranslate.intTransl
                      LEFT JOIN tblActionLog ON tblItemTranslate.intItemID
                      LEFT JOIN tblUser ON tblActionLog.intUserID = tblUser.intID
                      WHERE tblItem.blnNeedsTranslatio
                      AND tblNavigation.intCompanyID
                      ORDER BY tblNavigation.txtTitle, tblAll.txtTitle
                 </cfquery>
           </cftransaction>
           <cfsavecontent variable="msg"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><cfoutput>#this.qry
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<cfoutput><base href="#this.qryCompany.txt
<style type="text/css">
<!--
body {
      background-color: #E5E5E5;
      margin-left: 0px;
      margin-top: 0px;
      margin-right: 0px;
      margin-bottom: 0px;
}
.hbTitle {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 18px;
      color: #CCCCCC;
}
.hbRegular {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 12px;
      color: #333333;
}
.hbRegular a:link {color: #333333; text-decoration: underline}
.hbRegular a:visited {color: #333333; text-decoration: underline}
.hbRegular a:hover {color: #333333; text-decoration: underline}
.hbRegular a:active {color: #333333; text-decoration: underline}
.bhList {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 11px;
      color: #333333;
      width: 250px;
}
.hbTable {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 11px;
      color: #333333;
}
-->
</style></head>
<body>
<br>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
  <td bgcolor="#D8D8D8"><img src="images/shim.gif" width="1" height="16"></td>
 </tr>
 <tr>
  <td align="right" valign="bottom" bgcolor="#FFFFFF" class="hbTitle"><table border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="2"> </td>
   </tr>
   <tr>
    <td width="332"><img src="images/shim.gif" width="332" height="1"></td>
    <td width="308" align="left" class="hbTitle"><p><cfoutp
    </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td height="200" bgcolor="#FFFFFF">      <table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
    </tr>
   <tr>
    <td width="50"> </td>
    <td width="258" align="left" valign="middle"><a href="<cfoutput>#this.qryC
    <td width="24"> </td>
    <td width="258" valign="top" class="hbRegular"><strong>
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
    </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td valign="top" bgcolor="#FFFFFF"><table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
   <tr>
    <td width="50"> </td>
    <td colspan="3" align="left" valign="top" class="hbRegular">
     <table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
       <td bgcolor="#CCCCCC"><table width="100%"  border="0" cellspacing="1" cellpadding="3">
        <tr bgcolor="#E6E6E6" class="hbTable">
         <td width="80%">Web Page</td>
         <td style="padding-right: 5px; padding-left: 5px;">Author</td>
         <td style="padding-right: 5px; padding-left: 5px;">Live Date</td>
        </tr>
                      <cfoutput query="qryLocked">
        <tr class="hbTable">
         <td bgcolor="##F7F7F7"><a href="#this.qryCompany.txt
         <td bgcolor="##FFFFFF" style="padding-right: 5px; padding-left: 5px;"><nobr>#txtAuthor#</n
         <td bgcolor="##F7F7F7" style="padding-right: 5px; padding-left: 5px;"><nobr><cfif len(dtStart)>#DateFormat(d
        </tr>
                      </cfoutput>
       </table></td>
      </tr>
     </table>      </td>
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#CCCCCC"><img src="images/shim.gif" width="1" height="1"></td>
 </tr>
 <tr>
  <td bgcolor="#FFFFFF"><table width="640" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
   <tr>
    <td width="50"> </td>
    <td width="258" align="left" valign="middle" class="hbRegular"><p><stro
     <p>This is an automated message please do not respond to it.</p></td>
    <td width="24"> </td>
    <td width="258" align="right" valign="bottom" class="hbRegular"><p><a href="http://www.hotbanana.ca"><img src="images/logo_hotbanana
    <td width="50"> </td>
   </tr>
   <tr>
    <td height="25" colspan="5"> </td>
   </tr>
  </table></td>
 </tr>
 <tr>
  <td bgcolor="#D8D8D8"><img src="images/shim.gif" width="1" height="16"></td>
 </tr>
</table>
<br>
</body>
</html>
</cfsavecontent>
           <cfset this.communication = getObject("hb50.communicat
           <cfset this.communication.sendPre
      </cffunction>
      <!--- Creates any columns that aren't already present in the table.
            Actually creates the whole table if necessary.
      --->
      <cffunction name="verifyColumns" access="public" returntype="any" output="false">
           <cfargument name="formData" required="true" type="any">
           <cfif not formData.blnVerifyColumns>
                 <cfreturn>
           </cfif>
           <cftry>
                 <cfquery name="qryTable" datasource="#this.datasour
                      SELECT       TOP 1 *
                      FROM      #formData.tablename#
                 </cfquery>
                 <cfset columnlist = qryTable.columnlist>
                 <cfcatch>
                      <cfset columnlist = "">
                      <cfquery name="qryCreateTable" datasource="#this.datasour
                            CREATE TABLE dbo.#formData.tablename# (
                                 #formData.varID# INT IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
                                 intUID uniqueidentifier NOT NULL
                            );
                           Â
                            ALTER TABLE #formData.tablename# WITH NOCHECK ADD
                            CONSTRAINT [PK_#formData.tablename#] PRIMARY KEY CLUSTERED
                            (
                                 #formData.varID#
                            );
                           Â
                            ALTER TABLE #formData.tablename# WITH NOCHECK ADD
                                 CONSTRAINT [DF_#formData.tablename#_i
                           Â
                            EXEC sp_addextendedproperty N'MS_Description', N'The primary key of this item version', N'user', N'dbo', N'table', N'#formData.tablename#', N'column', N'#formData.varID#';
                            EXEC sp_addextendedproperty N'MS_Description', N'The UID of this item version', N'user', N'dbo', N'table', N'#formData.tablename#', N'column', N'intUID';
                      </cfquery>
                 </cfcatch>
           </cftry>
           <!---
                 when adding extra columns, to add descriptions, use
                      exec sp_addextendedproperty N'MS_Description', N'Can the user edit content or items?', N'user', N'dbo', N'table', N'tblAdminPermission', N'column', N'blnEdit'
                      OR  sp_updateextendedproperty
           --->
           <cfloop from="1" to="#ArrayLen(formData.col
                 <cfset i = formData.columns[key]>
                 <cfset column = i.varname>
                 <cfif  ((isDefined("i.column") and i.column is true) or not (isDefined("i.insert") and i.insert is false)) and not ListFindNoCase(columnlist,
                      <cfif isDefined("i.vartype")>
                            <cfset type = i.vartype>
                      <cfelse>
                            <cfif ListFind("#TYPES.TEXT#,#TY
                                 <cfset type = "nvarchar(500)">
                            <cfelseif ListFind("#TYPES.URL#", i.type)>
                                 <cfset type = "nvarchar(1000)">
                            <cfelseif ListFind("#TYPES.HTML#,#TY
                                 <cfset type = "ntext">
                            <cfelseif ListFind("#TYPES.DATE#", i.type)>
                                 <cfset type = "datetime">
                            <cfelseif ListFind("#TYPES.CATEGORY#
                                 <cfset type = "int">
                            <cfelseif ListFind("#TYPES.FEATURED#
                                 <cfset type = "bit">
                            <cfelse>
                                 <cfset type = "">
                            </cfif>
                      </cfif>
                       <!--- if we haven't added support for it, don't deal with it. --->
                       <cfif Len(type)>
                            <cfquery datasource="#this.datasour
                                 ALTER TABLE #formData.tablename#
                                 ADD #column# #type# <cfif isDefined("i.allownull") AND NOT i.allownull AND ListFindNoCase("int,bit",t
                                                                 Â
                                 EXEC sp_addextendedproperty N'MS_Description', N'#i.title#', N'user', N'dbo', N'table', N'#formData.tablename#', N'column', N'#column#';
                            </cfquery>
                           Â
                            <cfobjectcache action="clear" />
                      </cfif>
                 </cfif>
           </cfloop>
          Â
           <cfif formData.blnExtraColumns>
                 <cfif formData.blnWorkflow>
                      <cfset this.workflowData.tablenam
                      <cfset verifyColumns(this.workflo
                 <cfelse>
                      <cfset this.basicData.tablename = formData.tablename>
                      <cfset verifyColumns(this.basicDa
                 </cfif>
           </cfif>
      </cffunction>     Â
     Â
      <!---
           wrapper function to convertCachedTokens
           - preserved for backward compatibility support
      --->
      <cffunction name="convertTokens" output="false">
           <cfargument name="input" required="true">
           <cfargument name="leaveToken" required="false" default="false">
           <cfargument name="webid" required="false" default="-1">
          Â
           <cfreturn convertCachedTokens(input,
      </cffunction>
     Â
      <!---
           takes a url and checks if the current page is an ssl page
           - if so, converts the prefix to https
      --->
      <cffunction name="setSSLPrefix" output="true" returntype="string">
           <cfargument name="input" required="true" type="string">
           <cfargument name="webid" required="true">
          Â
           <cfquery name="qrySSL" datasource="#this.datasour
                 SELECT       TOP 1 intID,blnSSL
                 FROM       tblNavigation
                 WHERE       intID = <cfqueryparam value="#arguments.webid#" cfsqltype="cf_sql_integer"
           </cfquery>
          Â
           <cfif qrySSL.recordCount and isDefined("qrySSL.blnSSL")
                 <cfset input = REReplaceNoCase(input,'http://', 'https://', 'ALL')>
           </cfif>
          Â
           <cfreturn input />
      </cffunction>
     Â
      <!--- converts tokens in a way that is one way, stripping off the token --->
      <cffunction name="convertCachedTokens"
           <cfargument name="input" required="true">
           <cfargument name="leaveToken" required="false" default="false">
           <cfargument name="webid" required="false" default="-1">
           <cfscript>
                 var links = getObject("hb50.links", this.companyID, true);
                 var media = getObject("hb50.media", this.companyID, true);
                 var wtod = getObject("hb50.util.wtod"
                Â
                 var length = Len(arguments.input);
                 var j = 1;
                 var pos = 0;
                 var end = 0;
                 var index = '';
                 var width = 0;
                 var height = 0;
                 var exclam = 0;
                 var token = '';
                 var newSrc = '';
                Â
                 var tagStart = 0;
                 var tagEnd = 0;
                Â
                 //WebTrends
                 var wtodEnabled = wtod.isWTODEnabled();
                 var mediaStruct = StructNew();
                Â
                 //tracking code manager
                 var plugins = getObject("hb50.plugins", this.companyID, true);
                 var blnTCODE = plugins.checkAccessByObjec
           </cfscript>
                           Â
           <!--- convert image --->
           <cfloop from="1" to="#length#" index="j">
                 <cfset pos = Find('$HB_IMG$', input, pos)>
                 <cfif pos is 0>
                      <cfbreak />
                 </cfif>
                 <cfset end = Find('$', input, pos + 8)>
                 <cfif end is 0>
                      <cfbreak />
                 </cfif>
                 <cfset index = Mid(input, pos + 8, end - pos - 8)>
                 <cfif index contains '!'>
                      <cfset token = index>
                      <cfset mediaID = Val(token)>
                     Â
                      <!--- get the width --->
                      <cfset width = 0>
                      <cfset exclam = Len(token) - Find('!', token)>
                      <cfif exclam gt 0>
                            <cfset token = Right(token, exclam)>
                            <cfset width = Val(token)>
                      </cfif>
                     Â
                      <!--- get the height --->
                      <cfset height = 0>
                      <cfset exclam = Len(token) - Find('!', token)>
                      <cfif exclam gt 0>
                            <cfset token = Right(token, exclam)>
                            <cfset height = Val(token)>
                      </cfif>
                     Â
                      <cfset newSrc = media.getURL(mediaID, width, height, 1)>
                 <cfelse>
                      <cfset newSrc = media.getURL(Val(index), -1, -1, 1)>
                 </cfif>
                Â
                 <!--- replace the token with the filename plus the token --->
                 <cfif arguments.leaveToken>
                      <cfif Find("?", newSrc)>
                            <cfset newSrc = "#newSrc#%26$HB_IMG$#index
                      <cfelse>
                            <cfset newSrc = "#newSrc#?$HB_IMG$#index#$
                      </cfif>
                 </cfif>
                Â
                 <!--- no token appended at the filename --->
                 <cfset input = Left(input, pos - 1) & newSrc & Right(input, Len(input) - end)>
                 <!--- advance the pos counter --->
                 <cfset pos = pos + Len(newSrc) + 1>
           </cfloop>
           <!--- convert flash (SWF) --->
           <cfloop from="1" to="#length#" index="j">
                 <cfset pos = Find('$HB_FLASH$', input, pos)>
                 <cfif pos is 0>
                      <cfbreak />
                 </cfif>
                 <cfset end = Find('$', input, pos + 10)>
                 <cfif end is 0>
                      <cfbreak />
                 </cfif>
                                Â
                 <cfset index = Mid(input, pos + 10, end - pos - 10)>
                Â
                 <!--- leave it as an image, with the token --->
                 <cfif arguments.leaveToken>
                      <cfset newSrc = 'images/thumb_flash.gif'>
                      <cfif Find("?", newSrc)>
                            <cfset newSrc = "#newSrc#%26$HB_FLASH$#ind
                      <cfelse>
                            <cfset newSrc = "#newSrc#?$HB_FLASH$#index
                      </cfif>
                      <cfset input = Left(input, pos - 1) & newSrc & Right(input, Len(input) - end)>
                      <cfset pos = pos + Len(newSrc) + 1>
                 <cfelse>
                      <cfset length = Len(input)>
                      <cfset newSrc = media.getMediaDisplay(Val(
                     Â
                      <cfset tagStart = length - Find('<', Reverse(input), length - pos) + 1>
                      <cfset tagEnd = Find('>', input, tagStart)>
                     Â
                      <cfif tagStart lte 1>
                            <cfset input = newSrc & Right(input, length - tagEnd)>
                      <cfelse>
                            <cfset input = Left(input, tagStart - 1) & newSrc & Right(input, length - tagEnd)>
                      </cfif>
                      <cfset pos = pos + 1>
                 </cfif>
           </cfloop>
          Â
           <!--- convert flash (FLV) --->
           <cfloop from="1" to="#length#" index="j">
                 <cfset pos = Find('$HB_FLV$', input, pos)>
                 <cfif pos is 0>
                      <cfbreak />
                 </cfif>
                 <cfset end = Find('$', input, pos + 8)>
                 <cfif end is 0>
                      <cfbreak />
                 </cfif>
                Â
                 <cfset index = mid(input, pos + 8, end - pos - 8)>
                Â
                 <!--- leave it as an image, with the token --->
                 <cfif arguments.leaveToken>
                      <cfset newSrc = 'images/thumb_flash.gif'>
                      <cfif Find("?", newSrc)>
                            <cfset newSrc = "#newSrc#%26$HB_FLV$#index
                      <cfelse>
                            <cfset newSrc = "#newSrc#?$HB_FLV$#index#$
                      </cfif>
                      <cfset input = Left(input, pos - 1) & newSrc & Right(input, Len(input) - end)>
                      <cfset pos = pos + Len(newSrc) + 1>
                 <cfelse>
                      <cfset length = Len(input)>
                      <cfset newSrc = media.getMediaDisplay(Val(
                     Â
                      <cfset tagStart = length - Find('<', reverse(input), length - pos) + 1>
                      <cfset tagEnd = Find('>', input, tagStart)>
                      <cfif tagStart lte 1>
                            <cfset input = newSrc & Right(input, length - tagEnd)>
                      <cfelse>
                            <cfset input = Left(input, tagStart - 1) & newSrc & Right(input, length - tagEnd)>
                      </cfif>
                      <cfset pos = pos + 1>
                 </cfif>
           </cfloop>
          Â
           <!--- change all of the resources except links to be https if ssl enabled --->
           <cfset input = setSSLPrefix(input,webid)>
           <!--- convert links --->
           <cfif not arguments.leaveToken>
                 <!--- don't even bother converting link tokens if we're preserving the token --->
                 <cfset pos = 0>
                 <cfset length = Len(input)>
                                Â
                 <!--- uid --->
                 <cfloop from="1" to="#length#" index="j">
                      <cfset pos = Find('"link.cfm?u=', input, pos)>
                      <cfset end = Find('"', input, pos + 12)>
                      <cfif pos is 0 or end is 0>
                            <cfbreak />
                      </cfif>
                      <cfset index = Mid(input, pos + 12, end - pos - 12)>
                      <!--- replace the token with the filename plus the token --->
                      <cfif wtodEnabled>
                            <cfset mediaStruct = links.getCachedURLStruct(i
                            <cfset newSrc = '"' & mediaStruct.url & '"'>
                           Â
                            <cfif isDefined("mediaStruct.mul
                                 <cfif mediaStruct.domain neq CGI.SERVER_NAME>                                      Â
                                       <cfset newSrc = newSrc & ' onclick="' & "dcsMultiTrack('DCS.dcssip
                                 <cfelse>
                                       <cfset newSrc = newSrc & ' onclick="' & "dcsMultiTrack('DCS.dcsuri
                                 </cfif>
                            </cfif>
                      <cfelse>
                            <cfset newSrc = '"' & links.getCachedURL(index) & '"'>
                      </cfif>
                      <cfset input = Left(input, pos - 1) & newSrc & Right(input, Len(input) - end)>
                      <cfset pos = pos + Len(newSrc) + 1>
                 </cfloop>
                Â
                 <cfset pos = 0>
                 <cfset length = Len(input)>
                Â
                 <!--- lid --->
                 <cfloop from="1" to="#length#" index="j">
                      <cfset pos = Find('"link.cfm?lid=', input, pos)>
                      <cfset end = Find('"', input, pos + 14)>
                      <cfif pos is 0 or end is 0>
                            <cfbreak />
                      </cfif>
                     Â
                      <cfset index = Mid(input, pos + 14, end - pos - 14)>
                      <!--- replace the token with the filename plus the token --->
                      <cfif wtodEnabled>
                            <cfset mediaStruct = links.getCachedLinkURLStru
                           Â
                            <!--- hack the flv links --->
                            <cfif FindNoCase('viewFLV.cfm', mediaStruct.url) is 0>
                                 <cfset newSrc = '"' & mediaStruct.url & '"'>
                            <cfelse>
                                 <cfset newSrc = '"' & 'javascript:void(0)' & '"' & ' onClick="' & mediaStruct.url & '"'>
                            </cfif>
                           Â
                            <cfif isDefined("mediaStruct.mul
                                 <cfif mediaStruct.domain neq CGI.SERVER_NAME>
                                       <cfset newSrc = newSrc & ' onclick="' & "dcsMultiTrack('DCS.dcssip
                                 <cfelse>
                                       <cfset newSrc = newSrc & ' onclick="' & "dcsMultiTrack('DCS.dcsuri
                                 </cfif>
                            </cfif>
                      <cfelse>
                           Â
                            <cfif blnTCODE>
                                 <!--- tracking code handling --->
                                 <cfquery name="qryTCODE" datasource="#this.datasour
                                       SELECT      TOP 1 intResourceID
                                       FROM      tblLink
                                       WHERE      intID = <cfqueryparam value="#val(index)#" cfsqltype="cf_sql_integer"
                                       AND            intResourceID IN (SELECT DISTINCT intLinkID FROM tblTrackingCodeLinks)
                                 </cfquery>
                            </cfif>
                     Â
                            <cfif isDefined("qryTCODE") and qryTCODE.recordCount>
                                 <cfset newSrc = '"link.cfm?lid=' & index & '"'>
                            <cfelse>
                                 <cfset linkURL = links.getCachedLinkURL(Val
                                Â
                                 <!--- hack the flv links --->
                                 <cfif FindNoCase('viewFLV.cfm', linkURL) is 0>
                                       <cfset newSrc = '"' & linkURL & '"' />
                                 <cfelse>
                                       <cfset newSrc = '"' & 'javascript:void(0)' & '"' & ' onClick="' & linkURL & '"' />
                                 </cfif>
                            </cfif>
                      </cfif>
                     Â
                      <cfset input = Left(input, pos - 1) & newSrc & Right(input, Len(input) - end) />
                      <cfset pos = pos + Len(newSrc) + 1 />
                 </cfloop>
           </cfif>
          Â
           <cfreturn input />
      </cffunction>
     Â
      <!---
           returns the body content with all filenames stripped out from image/flash/flv src parameters
           - leaves the token intact so that only the token is persisted in the db
      --->
      <cffunction name="prepareTokens" access="public" returntype="string" output="false">
           <cfargument name="input" type="string" required="true" />
          Â
           <cfscript>
                 var c = arguments.input;
                 //strip out all filenames from image src parameters, but leave the token
                 c = ReReplaceNoCase(c, '(["\''])[^\''"]*\$HB_IMG\
                 c = ReReplaceNoCase(c, '(["\''])[^"\'']*\$HB_FLAS
                 c = ReReplaceNoCase(c, '(["\''])[^"\'']*\$HB_FLV\
     Â
                 return c;
           </cfscript>
      </cffunction>
     Â
      <!---
           returns the body content with all placeholder tokens (s--999) replaced by the actual itemid of the content
           - hack for initial check-in of body content
      --->
      <cffunction name="fixLinkParams" access="private" returntype="string" output="false">
           <cfargument name="input" type="string" required="true" />
           <cfargument name="itemID" type="numeric" required="true" />
          Â
           <cfscript>
                 var c = arguments.input;
                 //replace the placeholder token with the itemid for each link in the params list
                 c = ReplaceNoCase(c, '_s--999_t-#URL.navid#_', '_s-#arguments.itemID#_t-#
                 return c;
           </cfscript>
      </cffunction>
</cfcomponent>
I'm sorry but I just don't have time to hunt through 10,000 lines of code as to what you are trying to do. but I can say that it looks like you are taking the result set from your stored procedure then passing that into the i.query variable in you function. What I don't understand is why you are taking a result set and puting it in a cfquery tag as if it were a sql string. Â
ASKER
Because the diplay.cfc components is the core file that was given to me by manufacture
Therefore #PreserveSingleQuote(i.que y# is valid
Therefore #PreserveSingleQuote(i.que
I am sure that it is valid for the use it was intended for. but you added the storedprocedure part of it and I think you are doing that wrong. you should not be putting a result set in the i.query or x.query you should be putting a string with a valid sql statement in that variable that will be executed by the cfquery tag within the function.
ASKER
I think what you trying to say is get rid of stored procedure and put that stored procedure into query. If so pleas e provide an example i you can, this is urgent . Thank you
I am not sure what the exact query statement will need to be but you will need to replace the stored procedure code to be something like:
<cfswitch expression="#this.companyi d#">
      <cfcase value="2">
           <cfset myQuery = "exec dbo.qryCourseNumbers('07-0 8', 'PSL', 'PSL')">
      </cfcase>
      <cfcase value="9">
           <cfset myQuery = "exec dbo.qryCourseNumbers('07-0 8', 'business', 'undergraduate')">
      </cfcase>
      <cfcase value="10">
           <cfset myQuery = "exec dbo.qryCourseNumbers('07-0 8', 'education', 'education')">
      </cfcase>
</cfswitch>
then a litlle lower you will set
x.query = myQuery;
<cfswitch expression="#this.companyi
      <cfcase value="2">
           <cfset myQuery = "exec dbo.qryCourseNumbers('07-0
      </cfcase>
      <cfcase value="9">
           <cfset myQuery = "exec dbo.qryCourseNumbers('07-0
      </cfcase>
      <cfcase value="10">
           <cfset myQuery = "exec dbo.qryCourseNumbers('07-0
      </cfcase>
</cfswitch>
then a litlle lower you will set
x.query = myQuery;
ASKER
I am trying to get courseId , coursetitle and division .
So can I do something like this
<cfquery name="qryCourseNumbers" datasource="#this.datasour ce#">
So can I do something like this
<cfquery name="qryCourseNumbers" datasource="#this.datasour
ASKER
I am trying to get courseId , coursetitle and division . I can not think of anything that can build the query since we calling the stored procedure
ASKER
OK. I still can not get this to work, What I did is I got rid of the stored procedure and put <cfquery> instead , so my <query lokks like this now. I just have no idea what should I be doing next, I keep getting the error saying Incorrect sytax near 'DIVISION. PLeas e help
<cfquery name="qryCourseNumbers2" datasource="#this.datasour ce#">
        select distinct c.courseid, left(c.coursenumber,3)+'.' +right(c.c oursenumbe r,3)+' '+replace (c.coursetitle, ' '' ', ' '''' ') as CourseName, v.division
from courseschedule.dbo.tblcour seinformat ion c inner join courseschedule.dbo.vw_cour ses_and_de partments v
on c.courseid = v.courseid
where
<cfswitch expression="#this.companyi d#">
   <cfcase value="2">
      c.academicyear='07-08' and v.division in ('PSL')
   </cfcase>
   <cfcase value="9">
       c.academicyear='07-08' and v.division in ('Business','Undergraduate ')
   </cfcase>
   <cfcase value="10">
      c.academicyear='07-08' and v.division in ('Education')
   </cfcase>
</cfswitch>
and c.includeincatalog=-1 and (substring(c.coursenumber, 4,1) <>Â 1 and substring(c.coursenumber,4 ,1) <>Â 2)
<cfquery name="qryCourseNumbers2" datasource="#this.datasour
        select distinct c.courseid, left(c.coursenumber,3)+'.'
from courseschedule.dbo.tblcour
on c.courseid = v.courseid
where
<cfswitch expression="#this.companyi
   <cfcase value="2">
      c.academicyear='07-08' and v.division in ('PSL')
   </cfcase>
   <cfcase value="9">
       c.academicyear='07-08' and v.division in ('Business','Undergraduate
   </cfcase>
   <cfcase value="10">
      c.academicyear='07-08' and v.division in ('Education')
   </cfcase>
</cfswitch>
and c.includeincatalog=-1 and (substring(c.coursenumber,
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. It works. Would you please explain to me why it did not work for neither SP nor cfquery. Thank you for you help
cfquery tag needs a SQL satement to be within the start and end tags. It passes that SQL statement to the database, then the database returns the results of the query passes them back to coldfusion which creates a variable containing a query resultset to the page being processed. The resultset is not another SQL statment.
You were running a stored procedure that was returning a query resultset and then attempting to put the resultset into a cfquery, and that was causing an error.
You were running a stored procedure that was returning a query resultset and then attempting to put the resultset into a cfquery, and that was causing an error.
 <cfquery name="qryGetList" datasource="#this.datasour
                     #PreserveSingleQuotes(i.qu
                  </cfquery>
You need to make sure that the i.query variable that is being passed to the getItemView function on that cfc actually contains a valid sql statement.
Can you post the detailed information about the database error you are getting? try looking in your coldfusion error logs (c:\cfusionmx7\logs\exepti
Also, instead of posting 6249 lines of code to ask a question... i would be better to just post the portions that are relevant to the question.