variables.defaultSearchType = "Listing"; //Listing variables.defaultFilterName = "eventsManager"; variables.defaultFilterType = "Datasheet"; //Grid/Datasheet var retStrut = StructNew(); var resultsStr = ""; var filterStatus = false; var dataQry = QueryNew("temp"); var filterFields = arguments.filterCriteria; var startDateTime = ""; var endDateTime = ""; var approvedStatus = "Approved"; var locationAsKeyword = false; var keywords = ""; var description = ""; var catIDlist = ""; var orgIDlist = ""; var location = ""; var dayBeginTime = getDayBeginTime(); var dayEndTime = getDayEndTime(); /* dsfilterstartdate (convert datetime stamps) dsfilterenddate (convert datetime stamps) dsfiltercategory (list of ids) dsfilterorganization (list of ids) dsfilterlocation (text from a dropdown) dsfilterkeyword (text form a text box... match the following event details fields: title,description )) */ if ( StructKeyExists(filterFields,"dsFilterStartDate") ) startDateTime = application.ptCalendar.date.csDateFormat(filterFields.dsFilterStartDate,dayBeginTime); if ( LEN(TRIM(startDateTime)) ) filterStatus = true; if ( StructKeyExists(filterFields,"dsFilterEndDate") ) endDateTime = application.ptCalendar.date.csDateFormat(filterFields.dsFilterEndDate,dayEndTime); if ( LEN(TRIM(endDateTime)) ) filterStatus = true; if ( StructKeyExists(filterFields,"dsFilterKeywords") ) keywords = filterFields.dsFilterKeywords; if ( LEN(TRIM(keywords)) ) filterStatus = true; if ( StructKeyExists(filterFields,"dsFilterCategories") ) catIDlist = filterFields.dsFilterCategories; if ( LEN(TRIM(catIDlist)) ) filterStatus = true; if ( StructKeyExists(filterFields,"dsFilterOrganizations") ) orgIDlist = filterFields.dsFilterOrganizations; if ( LEN(TRIM(orgIDlist)) ) filterStatus = true; if ( StructKeyExists(filterFields,"dsFilterLocation") ) location = filterFields.dsFilterLocation; if ( LEN(TRIM(location)) ) filterStatus = true; dataQry = application.ptCalendar.calEventsSearchDAO.getEventIDsByCriteria( startDate=startDateTime ,endDate=endDateTime ,approvedStatus=approvedStatus ,keywords=keywords ,catIDlist=catIDlist ,orgIDlist=orgIDlist ,location=location ,useCache=arguments.useCache ,locationAsKeyword=locationAsKeyword ); // Convert the query results into a comma-delimmited string of IDs if ( dataQry.RecordCount ) resultsStr = ValueList(dataQry.calEventID); retStruct.filterIDlist = resultsStr; retStruct.filterStatus = filterStatus; return retStruct; var retStrut = StructNew(); var resultsStr = ""; var filterStatus = false; var dataQry = QueryNew("temp"); var filterFields = arguments.filterCriteria; var startDateTime = ""; var endDateTime = ""; var approvedStatus = ""; var keywords = ""; var description = ""; var catIDlist = ""; var orgIDlist = ""; var location = ""; var locationAsKeyword = true; var dayBeginTime = getDayBeginTime(); var dayEndTime = getDayEndTime(); var gridStartDate = ""; var gridEndDate = ""; /* dsfilterstartdate (convert datetime stamps) dsfilterenddate (convert datetime stamps) dsfiltercategory (list of ids) dsfilterorganization (list of ids) dsfilterlocation (text from a dropdown) dsfilterkeyword (text form a text box... match the following event details fields: title,description )) dsFilterApprovedStatus (""=all, Approved or NotApproved) */ if ( arguments.filterType NEQ "Datasheet" ) { if ( StructKeyExists(filterFields,"dsFilterMonth") AND IsNumeric(filterFields.dsFilterMonth) AND StructKeyExists(filterFields,"dsFilterYear") AND IsNumeric(filterFields.dsFilterYear) ) { filterStatus = false; gridStartDate = application.ptCalendar.date.firstOfMonth(inMonth=filterFields.dsFilterMonth,inYear=filterFields.dsFilterYear); gridEndDate = application.ptCalendar.date.lastOfMonth(inMonth=filterFields.dsFilterMonth,inYear=filterFields.dsFilterYear); startDateTime = application.ptCalendar.date.csDateFormat(dateInput=gridStartDate,timeInput=dayBeginTime); endDateTime = application.ptCalendar.date.csDateFormat(dateInput=gridEndDate,timeInput=dayEndTime); } } else { if ( StructKeyExists(filterFields,"dsFilterStartDate") ) startDateTime = application.ptCalendar.date.csDateFormat(filterFields.dsFilterStartDate,dayBeginTime); if ( LEN(TRIM(startDateTime)) ) filterStatus = true; if ( StructKeyExists(filterFields,"dsFilterEndDate") ) endDateTime = application.ptCalendar.date.csDateFormat(filterFields.dsFilterEndDate,dayEndTime); if ( LEN(TRIM(endDateTime)) ) filterStatus = true; } if ( StructKeyExists(filterFields,"dsFilterApprovedStatus") ) approvedStatus = filterFields.dsFilterApprovedStatus; if ( LEN(TRIM(approvedStatus)) ) filterStatus = true; if ( StructKeyExists(filterFields,"dsFilterKeywords") ) keywords = filterFields.dsFilterKeywords; if ( LEN(TRIM(keywords)) ) filterStatus = true; if ( StructKeyExists(filterFields,"dsFilterCategories") ) catIDlist = filterFields.dsFilterCategories; if ( LEN(TRIM(catIDlist)) ) filterStatus = true; if ( StructKeyExists(filterFields,"dsFilterOrganizations") ) orgIDlist = filterFields.dsFilterOrganizations; if ( LEN(TRIM(orgIDlist)) ) filterStatus = true; if ( StructKeyExists(filterFields,"dsFilterLocation") ) location = filterFields.dsFilterLocation; if ( LEN(TRIM(location)) ) filterStatus = true; dataQry = application.ptCalendar.calEventsSearchDAO.getEventIDsByCriteria( startDate=startDateTime ,endDate=endDateTime ,approvedStatus=approvedStatus ,keywords=keywords ,catIDlist=catIDlist ,orgIDlist=orgIDlist ,location=location ,useCache=arguments.useCache ,locationAsKeyword=locationAsKeyword ); // Convert the query results into a comma-delimmited string of IDs if ( dataQry.RecordCount ) resultsStr = ValueList(dataQry.calEventID); retStruct.filterIDlist = resultsStr; retStruct.filterStatus = filterStatus; return retStruct; var filterFields = arguments.filterCriteria; var key = ""; if ( NOT StructKeyExists(session,"ptCalendar") ) session.ptCalendar = StructNew(); if ( NOT StructKeyExists(session.ptCalendar,arguments.filterName) ) session.ptCalendar[arguments.filterName] = StructNew(); if ( NOT StructKeyExists(session.ptCalendar[arguments.filterName],arguments.filterType) ) session.ptCalendar[arguments.filterName][arguments.filterType] = StructNew(); if ( NOT StructKeyExists(session.ptCalendar[arguments.filterName][arguments.filterType],"filterCriteria") ) session.ptCalendar[arguments.filterName][arguments.filterType].filterCriteria = StructNew(); // Loop over the passed in filter keys for ( key IN filterFields ) { if ( FindNoCase("dsFilter",key) ) session.ptCalendar[arguments.filterName][arguments.filterType].filterCriteria[key] = filterFields[key]; } var retStruct = StructNew(); var storedData = StructNew(); if ( StructKeyExists(session,"ptCalendar") AND StructKeyExists(session.ptCalendar,arguments.filterName) AND StructKeyExists(session.ptCalendar[arguments.filterName],arguments.filterType) AND StructKeyExists(session.ptCalendar[arguments.filterName][arguments.filterType],"filterCriteria") ) { storedData = session.ptCalendar[arguments.filterName][arguments.filterType].filterCriteria; // Loop over the passed in filter keys for ( key IN storedData ) { if ( FindNoCase("dsFilter",key) ) { if ( arguments.filterType EQ "Grid" ) { if ( ListFindNoCase("dsFilterMonth,dsFilterYear",key) EQ 0 ) retStruct[key] = storedData[key]; } else { if ( ListFindNoCase("dsFilterStartDate,dsFilterEndDate",key) EQ 0 ) retStruct[key] = storedData[key]; } } } } return retStruct; var retResult = false; if ( StructKeyExists(session,"ptCalendar") AND StructKeyExists(session.ptCalendar,arguments.filterName) AND StructKeyExists(session.ptCalendar[arguments.filterName],arguments.filterType) AND StructKeyExists(session.ptCalendar[arguments.filterName][arguments.filterType],"filterCriteria") ) { StructDelete(session.ptCalendar[arguments.filterName][arguments.filterType],"filterCriteria"); retResult = true; } return retResult;