// CUSTOM ELEMENT INFO variables.CUSTOM_ELEMENT = "YouTube Channels"; variables.CE_FIELD = "uniqueID"; variables.SEARCH_FIELDS = "channelTitle"; variables.ORDER_FIELD = "channelTitle"; variables.FILTER_FIELD = "feedActive"; variables.FILTER_VALUE = 1; variables.ICON_URL = "/ADF/apps/pt_social_media/images/youtube-32.png"; // LAYOUT FLAGS //variables.SHOW_SECTION1 = true; // Boolean //variables.SHOW_SECTION2 = true; // Boolean // STYLES variables.MAIN_WIDTH = 580; variables.SECTION1_WIDTH = 570; variables.SECTION2_WIDTH = 270; variables.SECTION3_WIDTH = 570; variables.SELECT_BOX_HEIGHT = 270; //320 variables.SELECT_BOX_WIDTH = 250; //variables.SELECT_ITEM_HEIGHT = 53; variables.SELECT_ITEM_HEIGHT = 36; variables.SELECT_ITEM_WIDTH = 210; variables.SELECT_ITEM_CLASS = "ui-state-default"; variables.JQUERY_UI_THEME = "ui-lightness"; // ADDITIONS //variables.SHOW_ALL_LINK = true; // Boolean //variables.ADD_NEW_FLAG = false; // Boolean //variables.ADD_NEW_URL = ""; //variables.ADD_NEW_LB_WIDTH = 600; //variables.ADD_NEW_LB_HEIGHT = 420; // NEW VARIABLES v1.1 variables.SHOW_SEARCH = true; // Boolean variables.SHOW_ALL_LINK = true; // Boolean variables.SHOW_ADD_LINK = false; // Boolean variables.SHOW_EDIT_DELETE_LINKS = false; // Boolean var retHTML = ""; var i = 1; var editDeleteLinks = ""; var itemCls = ""; var ceDataArray = getChooserData(arguments.item, arguments.queryType, arguments.searchValues, arguments.csPageID); var photoImgURL = variables.ICON_URL; var retHTMLImg = ""; // Loop over the data for ( i=1; i LTE ArrayLen(ceDataArray); i=i+1) { // Assemble the render HTML if ( StructKeyExists(ceDataArray[i].Values, "#variables.ORDER_FIELD#") AND LEN(ceDataArray[i].Values[variables.ORDER_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 & "
"; // Set the item class to add the spacing for the edit/delete links itemCls = itemCls & " itemEditDelete"; } // Build the item, and add the Edit/Delete links //retHTML = retHTML & "
  • #LEFT(ceDataArray[i].Values[variables.ORDER_FIELD],26)##editDeleteLinks#
  • "; // Build the item with image and add the Edit/Delete links retHTML = retHTML & "
  • #retHTMLImg#
    #LEFT(ceDataArray[i].Values[variables.ORDER_FIELD],40)#
    #editDeleteLinks#
  • "; } }
    // Initialize the return variable var retHTML = ""; var itm = 1; var b = 1; // Get the CE Data var dataArray = ArrayNew(1); var newArray = ArrayNew(1); //var newArrayB = 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); } if ( LEN(TRIM(variables.FILTER_FIELD)) AND LEN(TRIM(variables.FILTER_VALUE)) ) { for ( itm=1; itm LTE ArrayLen(dataArray); itm=itm+1 ) { // - Filter out records that do not match the 'Filter_Value' (ie. Feature) if ( StructKeyExists(dataArray[itm].values,variables.FILTER_FIELD) AND TRIM(dataArray[itm].values[variables.FILTER_FIELD]) EQ variables.FILTER_VALUE ) { // - Filter out expired records arrayAppend(newArray, dataArray[itm]); } } // Convert newArray back the dataArray for the return dataArray = newArray; } return dataArray;