appName = application.ptCalendar.getAppBeanName(); appConfig = application.ptCalendar.getAppConfig(); // Set the Event Cache status from the configuration element useEventsCache = application.ptCalendar.getEventCacheStatus(); // Set the UI theme from the Configuration Element uiTheme = application.ptCalendar.getUItheme(); viewPageMode = application.ptCalendar.getViewPageMode(); useVerboseOutput = application.ptCalendar.getVerboseOutputStatus(); // date/time defualt values from the Confing dayBeginTime = application.ptCalendar.getDayBeginTime(); dayEndTime = application.ptCalendar.getDayEndTime(); // date format values from the Confing cfDateFormatMask = application.ptCalendar.getDisplayCFdateMask(); jsDateFormatMask = application.ptCalendar.getDatePickerJSdateMask(); // Orgs and Cats Sort Field from the Confing orgsFilterSortField = application.ptCalendar.getOrgsDisplaySortField(); catsFilterSortField = application.ptCalendar.getCatsDisplaySortField(); eventFilterFooterJS = ""; searchFilterName = "eventsSearch"; searchFilterType = "List"; // List/Grid/Datasheet searchFromPageID = request.page.id; searchResultsPageID = request.page.id; OrgIDFilter = ""; OrgNameFilter = ""; // Get the values from the attributes passed in from the Custom Script Properties field if ( StructKeyExists(attributes,"searchType") ) searchFilterType = attributes.searchType; // this attributes option is not used at this time if ( StructKeyExists(attributes,"resultsPageID") ) searchResultsPageID = attributes.resultsPageID; if ( StructKeyExists(attributes,"Organization") ) OrgNameFilter = attributes.Organization; // Convert the OrgName filter in to an OrgID if ( LEN(TRIM(OrgNameFilter)) ) OrgIDFilter = application.ptCalendar.calOrganizationsDAO.getOrgIDByName(orgName=OrgNameFilter); // Set searchFilterName... used for Filter Field Cache and Filter Form Cookies if ( viewPageMode EQ "Single" ) searchFilterName = searchFilterName & "-" & searchResultsPageID; else searchFilterName = searchFilterName & "-" & request.subsite.id; // Default Field Values defaultApprovalStatus = "Approved"; //Approved defaultOrganizations = OrgIDFilter; defaultRangeType = "m"; // m - month, d - day, y - year, ww - week defaultRangeQty = "6"; defaultMonth = ""; defaultYear = ""; // Get Default Start and End Date defaultStartDate = DateFormat(CreateDate(Year(Now()), Month(Now()), 1),cfDateFormatMask); defaultEndDate = DateFormat(DateAdd(defaultRangeType,defaultRangeQty,defaultStartDate),cfDateFormatMask); // Set a Dummy UUID so the DataSheet filter doesn't fail dummyEventID = "XXXXXXXX-AAAA-YYYY-ZZZZZZZZZZZZZZZZ"; eventsfilterResult = StructNew(); eventsfilterData = StructNew(); eventsfilterIDlist = ""; eventsFilteredStatus = false; // Set up eventSearch request variable if it doesn't exist if ( !StructKeyExists(request,"ptCalendar") ) request.ptCalendar = StructNew(); if ( !StructKeyExists(request.ptCalendar,searchFilterName) ) request.ptCalendar[searchFilterName] = StructNew(); if ( !StructKeyExists(request.ptCalendar[searchFilterName],"eventIDlist") ) request.ptCalendar[searchFilterName].eventIDlist = dummyEventID; // Use a Dummy UUID so the DataSheet filter doesn't fail // Read the filter field cache cachedfilters = StructNew(); // Check to see if SEARCH button was clicked if ( NOT StructKeyExists(request.params,"dsFilterAction") ) { // See if there are any filters stored in session cachedfilters = application.ptCalendar.calEventsSearchController.readFilterSessionVars(filterType=searchFilterType,filterName=searchFilterName); if ( StructKeyExists(cachedfilters,"dsFilterAction") ) { // Add the cached filters to the request.params StructAppend(request.params,cachedfilters); } } else if ( StructKeyExists(request.params,"dsFilterAction") AND request.params.dsFilterAction EQ "reset" ) { application.ptCalendar.calEventsSearchController.clearFilterSessionVars(filterType=searchFilterType,filterName=searchFilterName); } // Return no Results if not coming from a FROM page submit or if coming from a "RESET" if ( StructKeyExists(request.params,"dsFilterAction") AND request.params.dsFilterAction NEQ "reset" ) { // Build the eventsfilterIDlist if ( StructKeyExists(request.params,"eventID") ) { // if a list if IDs has been passed in via the URL go ahead a override any other criteria eventsfilterIDlist = request.params.eventID; } else if ( StructKeyExists(request.params,"dsFilterAction") AND request.params.dsFilterAction EQ "search" ) { //useEventsCache = false; // Use this to override the appCofig setting when debugging // if the searchFilterForm has been submitted process the submission and return a list of eventIDs // or a query with the calEventIDs as a column and use the ValueList() function eventsfilterResult = application.ptCalendar.calEventsSearchController.processEventsSearchForm( filterCriteria=request.params ,filterType=searchFilterType ,useCache = useEventsCache ); // Copy the filterCriteria from request.params (URL) vars to session scope application.ptCalendar.calEventsSearchController.createFilterSessionVars(filterCriteria=request.params,filterType=searchFilterType,filterName=searchFilterName); } else { defaultCriteria = StructNew(); defaultCriteria.dsFilterStartDate = defaultStartDate; defaultCriteria.dsFilterEndDate = defaultEndDate; defaultCriteria.dsFilterMonth = defaultMonth; defaultCriteria.dsFilterYear = defaultYear; defaultCriteria.dsFilterApprovedStatus = defaultApprovalStatus; defaultCriteria.dsFilterOrganizations = defaultOrganizations; // Build default list of event IDs to display with ONLY date criteria eventsfilterResult = application.ptCalendar.calEventsSearchController.processEventsSearchForm( filterCriteria=defaultCriteria ,filterType=searchFilterType ,useCache=useEventsCache ); } } if ( StructKeyExists(eventsfilterResult,"filterIDlist") AND LEN(TRIM(eventsfilterResult.filterIDlist)) ) eventsfilterIDlist = eventsfilterResult.filterIDlist; if ( StructKeyExists(eventsfilterResult,"filterStatus") ) eventsFilteredStatus = eventsfilterResult.filterStatus; if ( LEN(TRIM(eventsfilterIDlist)) ) request.ptCalendar[searchFilterName].eventIDlist = eventsfilterIDlist; // Set the URL for the form page formPageURL = application.ptCalendar.csData.getCSPageURL(searchFromPageID); // Set the URL for the results page resultsPageURL = formPageURL; if ( searchFromPageID NEQ searchResultsPageID ) resultsPageURL = application.ptCalendar.csData.getCSPageURL(searchResultsPageID); // Set the default URL from the search form formActionURL = "#resultsPageURL#"; formActionParams = ""; if ( StructKeyExists(cgi,"QUERY_STRING") AND LEN(TRIM(cgi.QUERY_STRING)) ) formActionParams = cgi.QUERY_STRING; submitStatusHTML = " Searching..."; clearStatusHTML = " Resetting..."; showToolsLinkText = "Show Search Form"; hideToolsLinkText = "Hide Search Form"; // Filter field size defaults dateFieldSize = "10"; dateMaxSize = "12"; textFieldSize = "20"; textMaxSize = "255"; // Filter Form Defaults selectedApprovedStatus = defaultApprovalStatus; selectedKeywords = ""; selectedStartDateValue = defaultStartDate; selectedEndDateValue = defaultEndDate; selectedCategories = ""; selectedOrganizations = defaultOrganizations; selectedLocation = ""; if ( StructKeyExists(request.params,"dsFilterStartDate") ) selectedStartDateValue = request.params.dsFilterStartDate; if ( StructKeyExists(request.params,"dsFilterEndDate") ) selectedEndDateValue = request.params.dsFilterEndDate; if ( StructKeyExists(request.params,"dsFilterCategories") ) selectedCategories = request.params.dsFilterCategories; if ( StructKeyExists(request.params,"dsFilterOrganizations") ) selectedOrganizations = request.params.dsFilterOrganizations; if ( StructKeyExists(request.params,"dsFilterLocation") ) selectedLocation = request.params.dsFilterLocation; if ( StructKeyExists(request.params,"dsFilterKeywords") ) selectedKeywords = request.params.dsFilterKeywords; // Get the Active Organization orgArray = application.ptCalendar.calOrganizationsDAO.getCalOrgIDandNameArray(activeOnly=1,sortField=orgsFilterSortField); // Get the Active Categories for the selected Org catArray = application.ptCalendar.calEventCategoriesDAO.getFilteredCategoriesByOrgID(orgID=selectedOrganizations,filterField="active",filterValue=1,sortField=catsFilterSortField); // Get the Locations list from the Event Details Records locationsQry = application.ptCalendar.calEventDetailsDAO.getUniqueLocationsQuery(); application.ptCalendar.scripts.loadJQuery(); application.ptCalendar.scripts.loadJQueryUI(themeName=uiTheme); application.ptCalendar.scripts.loadJQuerySelectboxes(); // load headers for jQuery Cookie application.ptCalendar.scripts.loadJQueryCookie(); // Load the DateJS Plugin Headers application.ptCalendar.scripts.loadDateJS(); // Load the BBQ Plugin Headers application.ptCalendar.scripts.loadJQueryBBQ(); // Load the CFJS Plugin Headers application.ptCalendar.scripts.loadCFJS(); // load header for the Calendar Admin CSS application.ptCalendar.calService.loadCalendarAdminCSS(); // Output Cache Status (if verbose output is turned on) if ( useVerboseOutput ) application.ptCalendar.calEventsCacheService.renderCalendarCacheStatusHTML(eventsCacheStatusOverride=useEventsCache); // Load the inline JavaScript after the libraries have loaded application.ptCalendar.scripts.addFooterJS(eventFilterFooterJS, "SECONDARY"); // PRIMARY, SECONDARY, TERTIARY
Event Search Form:
  (From: Title and Description)
 
 
Clear Dates
#submitStatusHTML#
 
#showToolsLinkText#