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(); searchFormPageID = request.page.id; searchResultsPageID = request.page.id; //Get the Template ID for the Region Search results page eventsResultsTemplateID = 2; // Base+1 Template // Get the Custom Calendar View Page Template from the config element if( structKeyExists(appConfig, "eventsSearchResultsTemplate") and IsNumeric(appConfig['eventsSearchResultsTemplate']) ) eventsResultsTemplateID = appConfig['eventsSearchResultsTemplate']; resultsPageIDArray = application.ptCalendar.csData.getPageIdsUsingTemplateID(eventsResultsTemplateID,request.subsite.id); // Set the matching page returned from the template/subsite lookup to the results page if ( ArrayLen(resultsPageIDArray) AND IsNumeric(resultsPageIDArray[1]) AND resultsPageIDArray[1] GT 0 ) searchResultsPageID = resultsPageIDArray[1]; else { // if no region search results page is found then use the one up in the site root (subsiteid: 1) resultsPageIDArray = application.ptCalendar.csData.getPageIdsUsingTemplateID(eventsResultsTemplateID,1); if ( ArrayLen(resultsPageIDArray) AND IsNumeric(resultsPageIDArray[1]) AND resultsPageIDArray[1] GT 0 ) searchResultsPageID = resultsPageIDArray[1]; } // 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(); searchFilterName = "eventsSearch"; searchFilterType = "Listing"; // Listing/Grid/Datasheet // Custom Region Filter Type (Defaults to 'all') filterRegion= 14; if ( structKeyExists(request,"dodea") AND structKeyExists(request.dodea,"regionmapstruct") AND structKeyExists(request.dodea.regionmapstruct,"currentTermID") AND IsNumeric(request.dodea.regionmapstruct.currentTermID) ) filterRegion=request.dodea.regionmapstruct.currentTermID; 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,"Organization") ) OrgNameFilter = attributes.Organization; if ( StructKeyExists(attributes,"resultsPageID") ) searchResultsPageID = attributes.resultsPageID; // use this value if overridden from the custom script params tab // Convert the OrgName filter in to an OrgID if ( LEN(TRIM(OrgNameFilter)) ) OrgIDFilter = application.ptCalendar.calOrganizationsDAO.getOrgIDByName(orgName=OrgNameFilter); //else // OrgIDFilter = filterRegion; // 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 = "3"; defaultMonth = ""; defaultYear = ""; // Get Default Start and End Date defaultStartDate = DateFormat(CreateDate(Year(Now()), Month(Now()), 1),cfDateFormatMask); defaultEndDate = DateFormat(DateAdd(defaultRangeType,defaultRangeQty,defaultStartDate),cfDateFormatMask); // Custom Default Values defaultRegionID = filterRegion; // 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,filterRegion=filterRegion); 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,filterRegion=filterRegion); } // 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,filterRegion=filterRegion); } 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(searchFormPageID); // Set the URL for the results page resultsPageURL = formPageURL; if ( searchFormPageID 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 Events Search Form"; hideToolsLinkText = "Hide Events 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 = ""; // Custom Selected Filters selectedRegionID = defaultRegionID; selectedRegion = ""; 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; selectedRegionType = ""; selectedOrganizations = ""; // Custom dsFilter Values if ( StructKeyExists(request.params,"dsFilterRegionID") AND IsNumeric(request.params.dsFilterRegionID) ) { selectedRegionID = request.params.dsFilterRegionID; } // Convert Region ID filter value to a Region Name if ( selectedRegionID ) { selectedRegion = application.ptRegionSubsiteMap.regionSubsiteMapDAO.getTermByTermID(termID=selectedRegionID); selectedRegionType = application.ptRegionSubsiteMap.regionSubsiteMapService.getRegionTypeByRegionID(regionID=selectedRegionID); // Reset the selection organization based on the selectedRegionID selectedOrganizations = application.ptCalendar.calOrganizationsDAO.getOrgIDByName(orgName=selectedRegionType); } // Get the Active Organization orgArray = application.ptCalendar.calOrganizationsDAO.getActiveOrganizations(sortField=orgsFilterSortField); // Get the Active Categories for the selected org catArray = application.ptCalendar.calEventCategoriesDAO.getFilteredCategoriesByOrgID(orgID=selectedOrganizations,filterField="active",filterValue=1,sortField=catsFilterSortField); // 2013-12-19 - PT - REMOVED LOCATION SEARCH OPTION AS PER MARTIN F (DoDEA) // 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);

Event Search Form:

  (From: Title and Description)
#selectedRegion#
 
 
Clear Dates
#submitStatusHTML#
 
#showToolsLinkText#