// CUSTOM ELEMENT INFO variables.CUSTOM_ELEMENT = ""; variables.CE_FIELD = ""; // Must have the matching case as the field name in the element. variables.SEARCH_FIELDS = ""; variables.ORDER_FIELD = ""; // Display Text for the Chooser Items ( Defaults to the ORDER_FIELD ) variables.DISPLAY_FIELD = ""; // STYLES variables.MAIN_WIDTH = 580; variables.SECTION1_WIDTH = 270; variables.SECTION2_WIDTH = 270; variables.SECTION3_WIDTH = 580; variables.SELECT_BOX_HEIGHT = 350; variables.SELECT_BOX_WIDTH = 250; variables.SELECT_ITEM_HEIGHT = 30; variables.SELECT_ITEM_WIDTH = 210; variables.SELECT_ITEM_CLASS = "ui-state-default"; variables.JQUERY_UI_THEME = "ui-lightness"; // VARIABLES for v1.1 variables.SHOW_SEARCH = true; // Boolean variables.SHOW_ALL_LINK = true; // Boolean variables.SHOW_ADD_LINK = true; // Boolean variables.SHOW_EDIT_DELETE_LINKS = false; // Boolean var itm = 1; var thisParam = ""; var argStr = ""; var reHTML = ""; // loop through request.params parameters to get arguments for( itm=1; itm lte listLen(structKeyList(arguments)); itm=itm+1 ) { thisParam = listGetAt(structKeyList(arguments), itm); if( thisParam neq "method" and thisParam neq "bean" and thisParam neq "chooserMethod" ) { argStr = listAppend(argStr, "#thisParam#='#arguments[thisParam]#'"); } } if( len(argStr) ) reHTML = Evaluate("#arguments.chooserMethod#(#argStr#)"); else reHTML = Evaluate("#arguments.chooserMethod#()"); var retSearchBoxHTML = ""; // Backward compatibility to allow the variables from General Chooser v1.0 site and app override GC files to honored if ( StructKeyExists(variables,"SHOW_SECTION1") ) variables.SHOW_SEARCH = variables.SHOW_SECTION1; var retAddLinkHTML = ""; var ceFormID = 0; // Backward Compatibility to allow the variables from General Chooser v1.0 site and app override GC files to be honored // - if the section2 variable is used and set to false... not ADD button should be displayed if ( StructKeyExists(variables,"SHOW_SECTION2") AND variables.SHOW_SECTION2 EQ false ) variables.SHOW_ADD_LINK = false; // - if SHOW_ADD_LINK is still true (and SHOW_SECTION2 is true) then check for the ADD_NEW_FLAG variable if ( StructKeyExists(variables,"ADD_NEW_FLAG") AND variables.SHOW_ADD_LINK NEQ false ) variables.SHOW_ADD_LINK = variables.ADD_NEW_FLAG; var retHTML = ""; var i = 1; var editDeleteLinks = ""; var itemCls = ""; var ceDataArray = getChooserData(arguments.item, arguments.queryType, arguments.searchValues, arguments.csPageID); var displayText = ''; // Backward Compatibility - if a DISPLAY_TEXT variable not given or is not defined the ORDER_FIELD will still be used for the Item display text if ( NOT StructKeyExists(variables,"DISPLAY_FIELD") OR LEN(TRIM(variables.DISPLAY_FIELD)) EQ 0 ) variables.DISPLAY_FIELD = variables.ORDER_FIELD; // Loop over the data for ( i=1; i LTE ArrayLen(ceDataArray); i=i+1) { // Assemble the render HTML if ( StructKeyExists(ceDataArray[i].Values, "#variables.DISPLAY_FIELD#") AND LEN(ceDataArray[i].Values[variables.DISPLAY_FIELD]) AND StructKeyExists(ceDataArray[i].Values, "#variables.CE_FIELD#") AND LEN(ceDataArray[i].Values[variables.CE_FIELD]) ) { // Reset the item class on every loop iteration itemCls = variables.SELECT_ITEM_CLASS; // Build the Edit/Delete links if ( variables.SHOW_EDIT_DELETE_LINKS ) { //editDeleteLinks = "
"; //editDeleteLinks = editDeleteLinks & "
"; editDeleteLinks = "
"; // Set the item class to add the spacing for the edit/delete links itemCls = itemCls & " itemEditDelete"; } // Set the display text and determine if need "..." displayText = LEFT(ceDataArray[i].Values[variables.DISPLAY_FIELD],26); if ( LEN(displayText) GT 26 ) displayText = displayText & "..."; // Build the item, and add the Edit/Delete links retHTML = retHTML & "
  • #displayText##editDeleteLinks#
  • "; } }
    // Initialize the return variable var retHTML = ""; // Get the CE Data var dataArray = ArrayNew(1); // clean the search text if ( arguments.queryType eq "search" ) arguments.searchValues = cleanChooserSearchText(arguments.searchValues); // Get custom element data // Check if we are returning all the records when items is empty string and querytype is NOTselected if ( (arguments.queryType EQ "notselected") AND (LEN(arguments.item) LTE 0) ) dataArray = getCEData(variables.CUSTOM_ELEMENT); else dataArray = getCEData(variables.CUSTOM_ELEMENT, variables.CE_FIELD, arguments.item, arguments.queryType, arguments.searchValues, variables.SEARCH_FIELDS); // if are returning the selected items // sort the dataArray array order to match the passed in items ID order if ( arguments.queryType NEQ "selected" ) { // sort the dataArray dataArray = arrayOfCEDataSort(dataArray, variables.ORDER_FIELD); } var retText = arguments.inText; // remove the single quote retText = Replace(retText,chr(39),"&##39;","all"); // remove the double quote retText = Replace(retText,chr(34),"&##34;","all"); return retText;