application.ADF.scripts.loadJQuery(noConflict=true); // Variable for the version of the field - Display in Props UI. fieldVersion = "1.0.4"; requiredVersion = 10; productVersion = ListFirst(ListLast(request.cp.productversion," "),".");
This Custom Field Type requires CommonSpot #requiredVersion# or above.
// initialize some of the attributes variables typeid = attributes.typeid; prefix = attributes.prefix; formname = attributes.formname; formID = attributes.formID; currentValues = attributes.currentValues; CSRF_Token = application.ADF.csSecurity.getCSRF_Token(); // AjaxProxy Path to make ajax call in context of the site ajaxComURL = application.ADF.ajaxProxy; ajaxBeanName = 'dbHierarchySelector'; if( not structKeyExists(currentValues, "datasource") ) currentValues.datasource = ""; if ( not structKeyExists(currentValues, "tablename") ) currentValues.tablename = ""; if( not structKeyExists(currentValues, "parentField") ) currentValues.parentField = ""; if( not structKeyExists(currentValues, "displayField") ) currentValues.displayField = ""; if( not structKeyExists(currentValues, "valueField") ) currentValues.valueField = ""; if( not structKeyExists(currentValues, "activeField") ) currentValues.activeField = ""; if( not structKeyExists(currentValues, "activeOperator") ) currentValues.activeOperator = "="; if( not structKeyExists(currentValues, "activeValue") ) currentValues.activeValue = ""; if( not structKeyExists(currentValues, "sortField") ) currentValues.sortField = ""; if( not structKeyExists(currentValues, "sortCriteriaStr") ) currentValues.sortCriteriaStr = ""; if( not structKeyExists(currentValues, "selectionType") ) currentValues.selectionType = "single"; if( not structKeyExists(currentValues, "cookieField") ) currentValues.cookieField = ""; if( not structKeyExists(currentValues, "defaultValue") ) currentValues.defaultValue = ""; if ( not StructKeyExists(attributes.currentValues, 'useUdef') ) currentValues.useUdef = 0; if ( not StructKeyExists(attributes.currentValues, 'filterCriteria') ) currentValues.filterCriteria = ""; if( not structKeyExists(currentValues, "widthValue") ) currentValues.widthValue = ""; if( not structKeyExists(currentValues, "rootNodeText") ) currentValues.rootNodeText = ""; if( not structKeyExists(currentValues, "rootValue") ) currentValues.rootValue = ""; if( not structKeyExists(currentValues, "heightValue") ) currentValues.heightValue = ""; // Future feature if( not structKeyExists(currentValues, "displaySelectedValues") ) currentValues.displaySelectedValues = 0; // Get Available CF DSNs allDSNdata = createobject("java","coldfusion.server.ServiceFactory").getDatasourceService().getNames(); allTableData = QueryNew("Table_Name"); allColumnsData = QueryNew("temp"); activeColumnData = QueryNew("temp"); showTableSectionControl = false; showChildControls = false; showCustomSortControls = false; sqlOperatorList = "=,!=,<>,>,<,>=,<=,!<,!>"; if ( LEN(TRIM(currentValues.datasource)) ) { allTableData = application.ADF.dbHierarchySelector.getDBtables(dataSource=currentValues.datasource); showTableSectionControl = true; //WriteDump(var=allTableData, expand=false); if ( LEN(TRIM(currentValues.tablename)) ) { allColumnsData = application.ADF.dbHierarchySelector.getTableColumns(dataSource=currentValues.datasource,tableName=currentValues.tableName); showChildControls = true; /* if ( LEN(TRIM(currentValues.activeField)) ) { activeColumnData = application.ADF.dbHierarchySelector.getActiveValues(dataSource=currentValues.datasource,tableName=currentValues.tableName,activeField=currentValues.activeField); writeDump(var=activeColumnData, expand=false); }*/ } //writeDump(var=allColumnsData, expand=false); } if ( LEN(TRIM(currentValues.sortField)) AND currentValues.sortField EQ "[[customsort]]" ) { showCustomSortControls = true; } errorMsgCustom = 'An error occurred while trying to perform the operation.'; /* writeOutput("showTableSectionControl: "); writeDump(var=showTableSectionControl, expand=false); writeOutput("
"); writeOutput("showChildControls: "); writeDump(var=showChildControls, expand=false); writeOutput("
"); */ //writeDump(var=currentValues, expand=false); /* if ( LEN(TRIM(currentValues.datasource)) AND LEN(TRIM(currentValues.tablename)) AND LEN(TRIM(currentValues.parentField)) AND LEN(TRIM(currentValues.activeField)) AND LEN(TRIM(currentValues.activeOperator)) AND LEN(TRIM(currentValues.activeValue)) ) { treeData = application.ADF.dbHierarchySelector.getTreeData( dataSource=currentValues.datasource ,tableName=currentValues.tablename ,parentField=currentValues.parentField ,valueField=currentValues.valueField ,displayField=currentValues.displayField ,activeField=currentValues.activeField ,activeOperator=currentValues.activeOperator ,activeValue=currentValues.activeValue ,sortField=currentValues.sortField ); writeDump(var=treeData, expand=false); } */
application.ADF.scripts.addHeaderCSS(cftDBhierarchyCSS,"TERTIARY"); application.ADF.scripts.addFooterJS(cftDBhierarchyJS,"TERTIARY"); #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#activeValue", name="#prefix#activeValue", value="#currentValues.activeValue#", size="5", class="InputControl", style="text-align: right;")# ---> #Server.CommonSpot.UDF.tag.input(type="hidden", name="#prefix#displaySelectedValues", value=currentValues.displaySelectedValues)# --->
Datasource:
Table:
Parent Column:
Select the column used to indicate the parent node.
Value Column:
Select the column whose value will be stored when the node is selected.
Display Column:
Select the column to display in the selection tree.
Active Criteria:     #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#activeValue", name="#prefix#activeValue", value="#currentValues.activeValue#", size="5", class="InputControl", style="text-align: right;")#
Select the column, operator and value that will be used to filter active records.
Sort Column:
Select the sort column.
Custom Sort Criteria: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#sortCriteriaStr", name="#prefix#sortCriteriaStr", value="#currentValues.sortCriteriaStr#", size="50", class="InputControl", style="")#
IMPORTANT: Be sure to use columns from the selected table and proper syntax (without the "ORDER BY").

Root Node Text: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#rootNodeText", name="#prefix#rootNodeText", value="#currentValues.rootNodeText#", size="40", class="InputControl")#
Enter the text to be displayed as the 'root' node. If blank no 'root' node will be displayed.
Root Value: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#rootValue", name="#prefix#rootValue", value="#currentValues.rootValue#", size="25", class="InputControl")#
The 'parent' value identifying items off the root node (first-level items).
Width: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#widthValue", name="#prefix#widthValue", value="#currentValues.widthValue#", size="5", class="InputControl", style="text-align: right;")#px
Height: #Server.CommonSpot.udf.tag.input(type="text", id="#prefix#heightValue", name="#prefix#heightValue", value="#currentValues.heightValue#", size="5", class="InputControl", style="text-align: right;")#px
Selection Type: #Server.CommonSpot.udf.tag.checkboxRadio(type="radio", name="#prefix#selectionType", value="single", label="Single", checked=(currentValues.selectionType EQ '' OR currentValues.selectionType EQ 'single'), labelClass="cs_dlgLabelSmall")# 
#Server.CommonSpot.udf.tag.checkboxRadio(type="radio", name="#prefix#selectionType", value="multiple", label="Multiple", checked=(currentValues.selectionType EQ 'multiple'), labelClass="cs_dlgLabelSmall")# 
#Server.CommonSpot.udf.tag.checkboxRadio(type="radio", name="#prefix#selectionType", value="multiAutoParents", label="Multiple (auto select parents)", checked=(currentValues.selectionType EQ 'multiAutoParents'), labelClass="cs_dlgLabelSmall")# 
#Server.CommonSpot.udf.tag.checkboxRadio(type="radio", name="#prefix#selectionType", value="multiAuto", label="Multiple (auto select children)", checked=(currentValues.selectionType EQ 'multiAuto'), labelClass="cs_dlgLabelSmall")# 
Cookie Field: #Server.CommonSpot.UDF.tag.input(type="text", name="#prefix#cookieField", value=currentValues.cookieField, size="30", maxlength="255", style="font-family:#Request.CP.Font#;font-size:10")#
Enter the name of the cookie field to use to populate this field. Leave empty to not use a cookie to populate.
Display Selected Values: #Server.CommonSpot.udf.tag.checkboxRadio(type="radio", name="#prefix#displaySelectedValues", value="1", label="Yes", checked=(currentValues.displaySelectedValues EQ 1), labelClass="cs_dlgLabelSmall")#  #Server.CommonSpot.udf.tag.checkboxRadio(type="radio", name="#prefix#displaySelectedValues", value="0", label="No", checked=(currentValues.displaySelectedValues EQ 0), labelClass="cs_dlgLabelSmall")# 
Renders the checked values. (Primarily used for development.)

ADF Custom Field v#fieldVersion#