var retStruct = StructNew(); var notifyUsers = ""; var notifyEventContact = ""; var notifyEmailList = ""; var devEmailList = "gcronkright@paperthin.com"; // Get Event Details Data var eventData = application.ptCalendar.calEventDetailsDAO.getEventDetailsDataByUniqueID(uniqueID=arguments.eventID); // Send and Email to the Notification Contacts for each selected Event Category if ( StructKeyExists(eventData,"values") ) { if ( StructKeyExists(eventData.values,"uniqueID") AND LEN(TRIM(eventData.values.uniqueID)) ) { // Send Notification Emails to users who have been assigned to Event Categories notifyUsers = notifyUsersByEventID(eventData.values.uniqueID); // If approved or denied ... send rejection or approval email to the Contact Email if ( StructKeyExists(eventData.values,"eventApproved") AND LEN(TRIM(eventData.values.eventApproved)) ) notifyEventContact = sendEventApprovalEmail(eventData.values.uniqueID); // Test Email addresses //notifyEmailList = devEmailList; //notifyEmailList = ListAppend(notifyEmailList,devEmailList); if ( ListLen(notifyEmailList) GT 0 ) notifyEmailList = notifyByEmailAddressList(eventData.values.uniqueID,notifyEmailList); } } // Build the return Struct retStruct["notifyUsers"] = notifyUsers; retStruct["notifyEventContact"] = notifyEventContact; retStruct["notifyEmailList"] = notifyEmailList; retStruct["EventID"] = arguments.EventID; return retStruct; var catUserIDList = ""; var catUserEmailList = ""; var eventCatIDList = ""; var eventCatNameList = ""; var emailSendStatus = false; var noticationStatusStruct = StructNew(); // Get Event Details Data var eventStruct = application.ptCalendar.calEventDetailsDAO.getEventDetailsDataByUniqueID(uniqueID=arguments.eventID); // Get List of UserIDs from the provided list of Categories from the Notication Groups if ( StructKeyExists(eventStruct,"values") AND StructKeyExists(eventStruct.values,"category") AND LEN(TRIM(eventStruct.values.category)) ) { eventCatIDList = eventStruct.values.category; // Get Category Users catUserIDList = application.ptCalendar.calEventCategoriesDAO.getCategoryUserListByCatIDs(catIDlist=eventCatIDList); // Get Category names eventCatNameList = application.ptCalendar.calEventCategoriesDAO.getEventCategoryNames(uniqueID=eventCatIDList); } // Get List of User's' Email Addresses from list of UserIDs if ( LEN(TRIM(catUserIDList)) ) catUserEmailList = application.ptCalendar.calCSUsersDAO.getUserEmailListByIDList(UserIDList=catUserIDList); // Build and Send Email to Notification Users if ( LEN(TRIM(catUserEmailList)) ) emailSendStatus = sendEventNotifcationEmail(toEmailList=catUserEmailList,eventDetailsStruct=eventStruct); // Build the return Struct noticationStatusStruct["EmailSendStatus"] = emailSendStatus; noticationStatusStruct["EmailAddressList"] = catUserEmailList; noticationStatusStruct["EventCatIDs"] = eventCatIDList; noticationStatusStruct["EventCategories"] = eventCatNameList; noticationStatusStruct["EventID"] = arguments.EventID; return noticationStatusStruct; var emailSendStatus = false; var noticationStatusStruct = StructNew(); // Get Event Details Data var eventStruct = application.ptCalendar.calEventDetailsDAO.getEventDetailsDataByUniqueID(uniqueID=arguments.eventID); // Build and Send Email to Notification Users if ( LEN(TRIM(arguments.emailSendList)) ) emailSendStatus = sendEventNotifcationEmail(toEmailList=arguments.emailSendList,eventDetailsStruct=eventStruct); // Build the return Struct noticationStatusStruct["EmailSendStatus"] = emailSendStatus; noticationStatusStruct["EmailAddressList"] = arguments.emailSendList; noticationStatusStruct["EventID"] = arguments.EventID; return noticationStatusStruct; var sendNotifications = false; var emailMessage = ""; var emailIntroMsg = ""; var emailSubject = "Event Notification"; var emailFromAddress = "events@ptCalendar.com"; var sentSuccess = false; var calAppConfig = getAppConfig(); var eventStruct = arguments.eventDetailsStruct; var currData = StructNew(); var eventID = ""; var eventTitle = ""; var eventCatList = ""; // Get App Config Settings if ( structKeyExists(calAppConfig,'SendEventNotifiactionEmail') AND IsBoolean(calAppConfig['SendEventNotifiactionEmail']) AND calAppConfig['SendEventNotifiactionEmail'] EQ true ) sendNotifications = true; if ( structKeyExists(calAppConfig,'Event_Notification_From_Address') AND LEN(TRIM(calAppConfig['Event_Notification_From_Address'])) ) emailFromAddress = calAppConfig['Event_Notification_From_Address']; if ( structKeyExists(calAppConfig,'Event_Notification_Email_Subject') AND LEN(TRIM(calAppConfig['Event_Notification_Email_Subject'])) ) emailSubject = calAppConfig['Event_Notification_Email_Subject']; if ( structKeyExists(calAppConfig,'Event_Notification_Email_Message') AND LEN(TRIM(calAppConfig['Event_Notification_Email_Message'])) ) emailIntroMsg = calAppConfig['Event_Notification_Email_Message']; // Set the currData struct and make sure we have a valid data set if ( StructKeyExists(eventStruct,"values") ) { currData = eventStruct.values; // if we have a uniqueID then we should have an actual event record if ( StructKeyExists(currData,"uniqueID") AND LEN(TRIM(currData.uniqueID)) ) eventID = currData.uniqueID; if ( StructKeyExists(currData,"title") ) eventTitle = currData.title; // Convert CatIDs into category names if ( StructKeyExists(currData,"category") AND LEN(TRIM(currData.category)) ) { eventCatList = application.ptCalendar.calEventCategoriesDAO.getEventCategoryNames(currData.category); eventCatList = ListChangeDelims(eventCatList,", ",","); } } if ( LEN(TRIM(emailMessage)) ) emailIntroMsg = REPLACENOCASE(emailIntroMsg,"[EventCats]","#eventCatList#","all"); // Do Not Send and Email if Config setting does not allow it if ( sendNotifications EQ false ) sendEmail = false; [#UCASE(request.site.name)#] #TRIM(emailSubject)##CHR(10)# #emailIntroMsg# #buildEventNotificationDetails(uniqueID=eventID)# #emailMessage# var sentSuccess = false; var calAppConfig = getAppConfig(); var sendEmail = false; var currData = StructNew(); var emailSubject = ""; var emailFromAddress = "admin@milton.edu"; // Set as default but value will come fromt he config element var emailToAddress = ""; // retrieve the data for the event var eventUniqueID = ""; var eventTitle = ""; var eventApprovalStatus = ""; var eventData = application.ptCalendar.calEventDetailsDAO.getEventDetailsDataByUniqueID(uniqueID=arguments.eventID); var sendApproved = false; var approvedLabel = "Approved"; var approvedIntroMsg = "Your event has been #approvedLabel#."; var sendDenied = false; var deniedLabel = "Denied"; var deniedIntroMsg = "Your event has been #deniedLabel#."; // Get App Config Settings if ( structKeyExists(calAppConfig,'Event_Notification_From_Address') AND LEN(TRIM(calAppConfig['Event_Notification_From_Address'])) ) emailFromAddress = calAppConfig['Event_Notification_From_Address']; if ( structKeyExists(calAppConfig,'SendEventApprovedEmail') AND IsBoolean(calAppConfig['SendEventApprovedEmail']) AND calAppConfig['SendEventApprovedEmail'] EQ true ) sendApproved = true; if ( structKeyExists(calAppConfig,'EventApprovedLabel') AND LEN(TRIM(calAppConfig['EventApprovedLabel'])) ) approvedLabel = calAppConfig['EventApprovedLabel']; if ( structKeyExists(calAppConfig,'Event_Approved_Email_Message') AND LEN(TRIM(calAppConfig['Event_Approved_Email_Message'])) ) approvedIntroMsg = calAppConfig['Event_Approved_Email_Message']; if ( structKeyExists(calAppConfig,'SendEventDeniedEmail') AND IsBoolean(calAppConfig['SendEventDeniedEmail']) AND calAppConfig['SendEventDeniedEmail'] EQ true ) sendDenied = true; if ( structKeyExists(calAppConfig,'EventDeniedLabel') AND LEN(TRIM(calAppConfig['EventDeniedLabel'])) ) deniedLabel = calAppConfig['EventDeniedLabel']; if ( structKeyExists(calAppConfig,'Event_Denied_Email_Message') AND LEN(TRIM(calAppConfig['Event_Denied_Email_Message'])) ) deniedIntroMsg = calAppConfig['Event_Denied_Email_Message']; // Set the currData struct and make sure we have a valid data set if ( StructKeyExists(eventData,"values") ) { currData = eventData.values; // if we have a uniqueID then we should have an actual event record if ( StructKeyExists(currData,"uniqueID") AND LEN(TRIM(currData.uniqueID)) ) { eventUniqueID = currData.uniqueID; sendEmail = true; } else { sendEmail = false; } // Check to see if we have an Event Requestor Email... the CS email Custom Field should have verified the format if ( sendEmail AND StructKeyExists(currData,"eventRequestorEmail") AND LEN(TRIM(currData.eventRequestorEmail)) ) emailToAddress = currData.eventRequestorEmail; else sendEmail = false; // Set the event Title if ( sendEmail AND StructKeyExists(currData,"title") ) eventTitle = currData.title; // Set the eventApprovalStatus if ( sendEmail AND StructKeyExists(currData,"eventApproved") ) { if ( currData.eventApproved EQ 1 ) eventApprovalStatus = "approved"; else if ( currData.eventApproved EQ 0 ) eventApprovalStatus = "denied"; else sendEmail = false; } else { sendEmail = false; } // Do Not Send and Email if Config setting does not allow it if ( eventApprovalStatus EQ "approved" AND sendApproved EQ false ) sendEmail = false; else if ( eventApprovalStatus EQ "denied" AND sendDenied EQ false ) sendEmail = false; } #approvedIntroMsg# #buildEventNotificationDetails(uniqueID=eventUniqueID)# #deniedIntroMsg# Event Title: #eventTitle# Rejection Reason: #currData.rejectionReason# #emailMessage# var calAppConfig = getAppConfig(); var currData = StructNew(); var retHTML = ""; var r = 1; var k = 1; var eventTitle = ""; var calOrgList = ""; var eventCatList = ""; var recPropsArray = ArrayNew(1); var dateTimeArray = ArrayNew(1); var eventDateTimeHTML=""; var eventRecurrenceHTML = ""; // Get Event Details Data var eventData = application.ptCalendar.calEventDetailsDAO.getEventDetailsDataByUniqueID(uniqueID=arguments.uniqueID); // Set the currData struct and make sure we have a valid data set if ( structKeyExists(eventData,"values") ) { currData = eventData.values; // Set the event Title if ( StructKeyExists(currData,"title") ) eventTitle = currData.title; // Convert Org IDs into Organization Names if ( StructKeyExists(currData,"organization") AND LEN(TRIM(currData.organization)) ) { calOrgList = application.ptCalendar.calOrganizationsDAO.getCalOrganizationsNames(currData.organization); calOrgList = ListChangeDelims(calOrgList,", ",","); } // Convert CatIDs into category names if ( StructKeyExists(currData,"category") AND LEN(TRIM(currData.category)) ) { eventCatList = application.ptCalendar.calEventCategoriesDAO.getEventCategoryNames(currData.category); eventCatList = ListChangeDelims(eventCatList,", ",","); } // Get Event Date Time HTML if ( StructKeyExists(currData,"EventDateTimeIDList") AND LEN(TRIM(currData.EventDateTimeIDList)) ) dateTimeArray = application.ptCalendar.dateTimeBuilderController.buildDateTimeRenderData(dateTimeIDList=currData.EventDateTimeIDList); // Get Event Recurrence HTML if ( StructKeyExists(currData,"EventRecurrenceID") AND LEN(TRIM(currData.EventRecurrenceID)) ) recPropsArray = application.ptCalendar.recurrenceBuilderController.buildRecurrenceRenderData(uuidList=currData.EventRecurrenceID); } #dateTimeArray[k].renderString##CHR(10)# ",CHR(10),"all")> #recPropsArray[r].renderString##CHR(10)# ",CHR(10),"all")> Event Details: Event Title: #eventTitle# Event Description: #currData.description# Event Dates and Times: #eventDateTimeHTML# Recurrence Properties: #eventRecurrenceHTML# Organization: #calOrgList# Categories: #eventCatList# Location: #currData.location# Web Site: #currData.url# Contact Name: #currData.contactName# Contact Phone: #currData.contactPhone# Contact Email: #currData.contactEmail##CHR(10)# Sponsors: #currData.sponsors##CHR(10)# No event details available or an error occurred!