From 5d5cc168c961baef3c0e483f04e9ce9cc4c32122 Mon Sep 17 00:00:00 2001 From: phili67 Date: Tue, 18 Jan 2022 14:45:19 +0000 Subject: [PATCH] 7.6.0-upgrade.php : remove ListEvents.php + ListEvent.js + GetText.php --- src/GetText.php | 58 --- src/ListEvents.php | 773 ---------------------------- src/mysql/upgrade/7.6.0-upgrade.php | 3 + src/skin/js/event/ListEvent.js | 208 -------- 4 files changed, 3 insertions(+), 1039 deletions(-) delete mode 100644 src/GetText.php delete mode 100644 src/ListEvents.php delete mode 100644 src/skin/js/event/ListEvent.js diff --git a/src/GetText.php b/src/GetText.php deleted file mode 100644 index ff16323278..0000000000 --- a/src/GetText.php +++ /dev/null @@ -1,58 +0,0 @@ -findOneById($_GET['EID']); - -require_once 'Include/Header-function.php'; -require_once 'Include/Header-Security.php'; - -// Turn ON output buffering -ob_start(); - -?> - - - <?= _("Text from") ?> <?= $event->getId() ?> - - - getId()); - ?> - - - -
-
-
-
getId() . ") : " . htmlentities(stripslashes($event->getTitle()), ENT_NOQUOTES, 'UTF-8') ?>
-
-
-
- getText() ?> -
- -
- - - diff --git a/src/ListEvents.php b/src/ListEvents.php deleted file mode 100644 index d0af149b20..0000000000 --- a/src/ListEvents.php +++ /dev/null @@ -1,773 +0,0 @@ -findOneById($eType); - - $sPageTitle = _('Listing Events of Type = ').$eventType->GetName(); -} else { - $sPageTitle = _('Listing All Church Events'); -} - -// retrieve the year selector - -if (isset($_POST['WhichYear'])) { - $yVal = InputUtils::LegacyFilterInput($_POST['WhichYear'], 'int'); -} else { - $yVal = date('Y'); -} - - -if (isset($_POST['WhichMonth'])) { - $EventMonth = InputUtils::LegacyFilterInput($_POST['WhichMonth'], 'int'); -} else { - $EventMonth = 0;//date('m'); -} - - -/////////////////////// -require 'Include/Header.php'; - - -if (isset($_POST['Action']) && isset($_POST['EID'])) { - $eID = InputUtils::LegacyFilterInput($_POST['EID'], 'int'); - $action = InputUtils::LegacyFilterInput($_POST['Action']); - if ($action == 'Delete' && $eID) { - $propel_event = EventQuery::Create()->findOneById($eID); - - $calendarId = [$propel_event->getEventCalendarid(),0]; - - // new way to manage events - - // We set the BackEnd for sabre Backends - $calendarBackend = new CalDavPDO(); - $event = $calendarBackend->getCalendarObjectById($calendarId,$eID); - - // We have to use the sabre way to ensure the event is reflected in external connection : CalDav - $calendarBackend->deleteCalendarObject($calendarId, $event['uri']); - } elseif ($action == 'Activate' && $eID) { - $event = EventQuery::Create()->findOneById($eID); - $event->setInActive (0); - $event->save(); - } -} - -/// top of main form -// -$eventTypes = EventTypesQuery::Create() - ->addJoin(EventTypesTableMap::COL_TYPE_ID, EventTableMap::COL_EVENT_TYPE,Criteria::RIGHT_JOIN) - ->setDistinct(EventTypesTableMap::COL_TYPE_ID) - ->orderById() - ->find(); - -?> - - -
- - - - -
- -
-
-
- - - - -addAsColumn('year','YEAR('.EventTableMap::COL_EVENT_START.')') - ->select('year') - ->setDistinct() - ->where('YEAR('.EventTableMap::COL_EVENT_START.')') - ->find(); - -} else { - $years = EventQuery::Create() - ->filterByType ($eType) - ->addAsColumn('year','YEAR('.EventTableMap::COL_EVENT_START.')') - ->select('year') - ->setDistinct() - ->where('YEAR('.EventTableMap::COL_EVENT_START.')') - ->find(); - -} -?> -
-
- - -
-
- -
-
-
- -
-isAdmin())) { - $onlyUser = " AND ".PrincipalsTableMap::COL_URI."='principals/".strtolower(SessionUser::getUser()->getUserName())."'"; - } - - if ($eType == 'All') { - $events = EventQuery::Create() - ->orderByStart('DESC') - ->addJoin(EventTableMap::COL_EVENT_CALENDARID, CalendarinstancesTableMap::COL_CALENDARID,Criteria::RIGHT_JOIN) - ->addJoin(CalendarinstancesTableMap::COL_PRINCIPALURI, PrincipalsTableMap::COL_URI,Criteria::RIGHT_JOIN) - ->addAsColumn('login',PrincipalsTableMap::COL_URI) - ->addAsColumn('rights',CalendarinstancesTableMap::COL_ACCESS) - ->addAsColumn('calendarName',CalendarinstancesTableMap::COL_DISPLAYNAME) - ->where('MONTH('.EventTableMap::COL_EVENT_START.') = '.$mVal.' AND YEAR('.EventTableMap::COL_EVENT_START.')='.$yVal.$onlyUser) - ->groupBy(EventTableMap::COL_EVENT_ID) - ->find(); - - } else { - $events = EventQuery::Create() - ->filterByType($eType) - ->orderByStart('DESC') - ->addJoin(EventTableMap::COL_EVENT_CALENDARID, CalendarinstancesTableMap::COL_CALENDARID,Criteria::RIGHT_JOIN) - ->addJoin(CalendarinstancesTableMap::COL_PRINCIPALURI, PrincipalsTableMap::COL_URI,Criteria::RIGHT_JOIN) - ->addAsColumn('login',PrincipalsTableMap::COL_URI) - ->addAsColumn('rights',CalendarinstancesTableMap::COL_ACCESS) - ->addAsColumn('calendarName',CalendarinstancesTableMap::COL_DISPLAYNAME) - ->where('MONTH('.EventTableMap::COL_EVENT_START.') = '.$mVal.' AND YEAR('.EventTableMap::COL_EVENT_START.')='.$yVal.$onlyUser) - ->groupBy(EventTableMap::COL_EVENT_ID) - ->find(); - } - - - - - $numRows = 0; - if ( !empty($events) ) { - $numRows = $events->count(); - } - $aAvgRows = $numRows; - - - $numAVGAtt = 0; - $numAVG_CheckIn = 0; - $numAVG_CheckOut = 0; - - $row=1; - - - foreach ($events as $event) { - // get the list of attend-counts that exists in event_attend for this - $aEventID[$row] = $event->getId(); - - if ( SessionUser::getUser()->isAdmin() ) { - $aLogin[$row] = _("Name").":"."".$event->getCalendarName()."
"._("login").":".str_replace("principals/","",$event->getLogin()).""; - } else { - $aLogin[$row] = _("Name").":"."".$event->getCalendarName().""; - } - - $aEventType[$row] = $event->getTypeName(); - $aEventTitle[$row] = htmlentities(stripslashes($event->getTitle()), ENT_NOQUOTES, 'UTF-8'); - $aEventDesc[$row] = htmlentities(stripslashes($event->getDesc()), ENT_NOQUOTES, 'UTF-8'); - $aEventText[$row] = htmlentities(stripslashes($event->getText()), ENT_NOQUOTES, 'UTF-8'); - $aEventStartDateTime[$row] = $event->getStart()->format(SystemConfig::getValue('sDateFormatLong'));//.' H:i:s'); - $aEventEndDateTime[$row] = $event->getEnd()->format(SystemConfig::getValue('sDateFormatLong'));//.' H:i:s'); - $aEventStatus[$row] = $event->getInactive(); - if (!(SessionUser::getUser()->isAdmin())) { - $aEventRights[$row] = ($event->getRights() == 1 || $event->getRights() == 3)?true:false; - } else { - $aEventRights[$row] = true; - } - - $attendees = EventAttendQuery::create()->findByEventId($event->getId()); - - $attCheckOut[$row] = 0; - $realAttCheckOut[$row] = 0; - - if (!empty($attendees)) { - foreach ($attendees as $attende) { - if ($attende->getCheckoutDate()) { - $attCheckOut[$row]++; - } - - if ($attende->getCheckoutId()) { - $realAttCheckOut[$row]++; - } - } - - if ($attCheckOut[$row] > 0) { - // no statistic for the special counter - $statisticaAvgRows = false; - } - - $attNumRows[$row] = count($attendees); - $numAVG_CheckIn += $attNumRows[$row]; - $numAVG_CheckOut += $attCheckOut[$row]; - } - - if ($attNumRows[$row++]) { - $numAVGAtt++; - } - } - - if ($numRows > 0) { - ?> -
-
-

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - useEventQuery() - ->filterByType($eType) - ->addAsColumn('monthStart','MONTH('.EventTableMap::COL_EVENT_START.')') - ->addAsColumn('yearStart','YEAR('.EventTableMap::COL_EVENT_START.')') - ->endUse() - ->where('YEAR('.EventTableMap::COL_EVENT_START.')='.$yVal.' AND MONTH('.EventTableMap::COL_EVENT_START.')='.$mVal) - ->addAsColumn('avg','AVG('.EventCountsTableMap::COL_EVTCNT_COUNTCOUNT.')') - ->addAsColumn('sum','SUM('.EventCountsTableMap::COL_EVTCNT_COUNTCOUNT.')') - ->groupByEvtcntCountid() - ->find(); - - ?> - - - - - - - - - - - - - - 0) { - ?> - - - - - - - - - - - - - -
- - - - - -
- "> - - - - -
- - - - - -
- -
-
- - - -
- -
- - - - - - - - - - - - - - - - - -
- - - - - -
- -
- - - - - - " > - -
- -
- -
- - - - -
- -
-
- - -
- - - - -
- -
- -
- - - filterByEvtcntEventid($aEventID[$row])->orderByEvtcntCountid(Criteria::ASC)->find(); - - if (!empty($eventCounts)) { - $c=0; - $aNumCounts = $eventCounts->count(); - - foreach ($eventCounts as $eventCount) { - $cCountID[$c] = $eventCount->getEvtcntCountid(); - $cCountName[$c] = $eventCount->getEvtcntCountname(); - $cCount[$c] = $eventCount->getEvtcntCountcount(); - $cCountNotes = $eventCount->getEvtcntNotes(); ?> - - - - - -
-
getEvtcntCountname() ?>
-
getEvtcntCountcount() ?>
-
-

- -

-
-
- - - - ;text-align:center"> - -
- 0) { - ?> - - - - - - -
- -
-
-
- -
-
-
- -
-
-
- - -
-
- 0) { - ?> - - - - - - - - - -
- -
getEvtcntCountname() ?>
-
getAvg()) ?>
-
- - -
-
- 0) { - ?> - - - - - - -
- -
-
-
- -
-
-
- -
-
-
- -
-
- 0) { - ?> - - - - - - - - - -
- -
getEvtcntCountname() ?>
-
getSum()) ?>
-
- -
-
-
-
- - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mysql/upgrade/7.6.0-upgrade.php b/src/mysql/upgrade/7.6.0-upgrade.php index 1b76175f44..cb23800e7d 100644 --- a/src/mysql/upgrade/7.6.0-upgrade.php +++ b/src/mysql/upgrade/7.6.0-upgrade.php @@ -14,6 +14,9 @@ unlink(SystemURLs::getDocumentRoot()."/Include/GetGroupArray.php"); unlink(SystemURLs::getDocumentRoot()."/RPCdummy.php"); unlink(SystemURLs::getDocumentRoot()."/EcclesiaCRM/Reports/ChurchInfoReport.php"); +unlink(SystemURLs::getDocumentRoot()."/ListEvents.php"); +unlink(SystemURLs::getDocumentRoot()."/GetText.php"); +unlink(SystemURLs::getDocumentRoot()."/skin/js/event/ListEvent.js"); $logger->info("End of delete : all unusefull files"); ?> diff --git a/src/skin/js/event/ListEvent.js b/src/skin/js/event/ListEvent.js deleted file mode 100644 index 919f21a8e9..0000000000 --- a/src/skin/js/event/ListEvent.js +++ /dev/null @@ -1,208 +0,0 @@ -// -// This code is under copyright not under MIT Licence -// copyright : 2018 Philippe Logel all right reserved not MIT licence -// This code can't be incoprorated in another software without authorizaion -// -// Updated : 2019/04/19 -// - -window.CRM.editor = null; - -function addEvent(dateStart,dateEnd) -{ - window.CRM.APIRequest({ - method: 'POST', - path: 'calendar/numberofcalendars', - }).done(function(data) { - if (data.CalendarNumber > 0) { - if (window.CRM.editor != null) { - CKEDITOR.remove(window.CRM.editor); - window.CRM.editor = null; - } - - modal = createEventEditorWindow(dateStart, dateEnd, 'createEvent', 0, '', 'ListEvent.php'); - - // we add the calendars and the types - addCalendars(); - addCalendarEventTypes(-1, true); - - // finish installing the window - installAndfinishEventEditorWindow(); - - $("#typeEventrecurrence").prop("disabled", true); - $("#endDateEventrecurrence").prop("disabled", true); - - modal.modal("show"); - - initMap(); - } else { - window.CRM.DisplayAlert(i18next.t("Error"),i18next.t("To add an event, You have to create a calendar or activate one first.")); - } - }); -} - - -$('#add-event').click('focus', function (e) { - var fmt = 'YYYY-MM-DD HH:mm:ss'; - - var dateStart = moment().format(fmt); - var dateEnd = moment().format(fmt); - - addEvent(dateStart,dateEnd); -}); - -//Added by @saulowulhynek to translation of datatable nav terms - $(document).ready(function () { - $.fn.dataTable.moment = function ( format, locale ) { - var types = $.fn.dataTable.ext.type; - - // Add type detection - types.detect.unshift( function ( d ) { - // Removed true as the last parameter of the following moment - return moment( d, format, locale ).isValid() ? - 'moment-'+format : - null; - } ); - - // Add sorting method - use an integer for the sorting - types.order[ 'moment-'+format+'-pre' ] = function ( d ) { - console.log("d"); - return moment ( d, format, locale, true ).unix(); - }; - }; - - - $.fn.dataTable.moment(window.CRM.datePickerformat.toUpperCase(),window.CRM.shortLocale); - - - $(".eventsTable").DataTable({ - "language": { - "url": window.CRM.plugin.dataTable.language.url - }, - responsive: true - }); - - $('.listEvents').DataTable({"language": { - "url": window.CRM.plugin.dataTable.language.url - }}); - - $('.DeleteEvent').submit(function(e) { - var currentForm = this; - e.preventDefault(); - bootbox.confirm({ - title: i18next.t("Deleting an event will also delete all attendance counts for that event."), - message:i18next.t("Are you sure you want to DELETE the event ?"), - buttons: { - confirm: { - label: i18next.t('Yes'), - className: 'btn-danger' - }, - cancel: { - label: i18next.t('No'), - className: 'btn-success' - } - }, - callback: function(result) { - if (result) { - currentForm.submit(); - } - }}); - }); - - $(".EditEvent").click('focus', function (e) { - var eventID = $(this).data("id"); - - window.CRM.APIRequest({ - method: 'POST', - path: 'events/info', - data: JSON.stringify({"eventID":eventID}) - }).done(function(calEvent) { - if (window.CRM.editor != null) { - CKEDITOR.remove(window.CRM.editor); - window.CRM.editor = null; - } - - modal = createEventEditorWindow (calEvent.start,calEvent.end,'modifyEvent',eventID,'','ListEvent.php'); - - $('form #EventTitle').val(calEvent.Title); - $('form #EventDesc').val(calEvent.Desc); - $('form #eventNotes').val(calEvent.Text); - $('form #EventLocation').val(calEvent.location); - - $("form #addGroupAttendees").prop("disabled", (calEvent.groupID == "0") ? true : false); - $("form #addGroupAttendees").prop('checked', (calEvent.groupID == "0") ? false : true); - - - if (calEvent.alarm !== null) { - $("form #EventAlarm").val(calEvent.alarm.trigger).trigger('change'); - } - - // we add the calendars and the types - addCalendars(calEvent.calendarID); - addCalendarEventTypes(calEvent.eventTypeID,false); - addAttendees(calEvent.eventTypeID,true,calEvent.eventID); - setActiveState(calEvent.inActive); - - //Timepicker - $('.timepicker').datetimepicker({ - format: 'LT', - locale: window.CRM.lang, - icons: - { - up: 'fa fa-angle-up', - down: 'fa fa-angle-down' - } - }); - - $('.date-picker').datepicker({format:window.CRM.datePickerformat, language: window.CRM.lang}); - - $('.date-picker').click('focus', function (e) { - e.preventDefault(); - $(this).datepicker('show'); - }); - - $('.date-start').hide(); - $('.date-end').hide(); - $('.date-recurrence').hide(); - $(".eventNotes").hide(); - - var theme = 'n1theme,/skin/js/ckeditor/themes/n1theme/'; - if (window.CRM.bDarkMode) { - theme = 'moono-dark,/skin/js/ckeditor/themes/moono-dark/'; - } - - // this will create the toolbar for the textarea - if (window.CRM.editor == null) { - if (window.CRM.bEDrive) { - window.CRM.editor = CKEDITOR.replace('eventNotes',{ - customConfig: window.CRM.root+'/skin/js/ckeditor/configs/calendar_event_editor_config.js', - language : window.CRM.lang, - width : '100%', - extraPlugins : 'uploadfile,uploadimage,filebrowser', - uploadUrl: window.CRM.root+'/uploader/upload.php?type=publicDocuments', - imageUploadUrl: window.CRM.root+'/uploader/upload.php?type=publicImages', - filebrowserUploadUrl: window.CRM.root+'/uploader/upload.php?type=publicDocuments', - filebrowserBrowseUrl: window.CRM.root+'/browser/browse.php?type=publicDocuments', - skin:theme - }); - } else { - window.CRM.editor = CKEDITOR.replace('eventNotes',{ - customConfig: window.CRM.root+'/skin/js/ckeditor/configs/calendar_event_editor_config.js', - language : window.CRM.lang, - width : '100%', - skin:theme - }); - } - - add_ckeditor_buttons(window.CRM.editor); - } - - $(".ATTENDENCES").hide(); - - modal.modal("show"); - - initMap(calEvent.longitude,calEvent.latitude,calEvent.title+'('+calEvent.Desc+')',calEvent.location,calEvent.title+'('+calEvent.Desc+')',calEvent.Text); - }); - }); - - });