/************************************************************************************************* * Javascript library for display of multiple Google calendars and search by text and date * * Refer to file "sandleiten-calendar.html" for how to embed on a webpage * * (c) 2018, Pfarre Sandleiten, version 6.0 * * --Version history:----------------------------------------------------------------------------* * 1.0 26.01.2014 - Initial version * * - Calendar-, text- and date selection fields outside the calendar iframe * * - Search requests to Google are sent via Javascript * * 1.1 30.01.2014 - Larger calendar selection fields for mobile devices with touch-displays * * - Datepicker controls added for date selection fields * * 1.2 26.02.2015 - Compact list format added to improve presentation of searchresults on * * smaller mobile screens * * - Preview format added to display events of coming 1-4 weeks * * 1.3 26.03.2015 - Miscellaneous error corrections and improvements * * 2.0 18.04.2015 - Calendar requests to Google are now sent via PHP to allow read/write to * * calendar contents before display on client * * - A color-character code added to Calendar mode "Agenda" to better * * identify to which calendar an event belongs * * - Calendar startdate and mode preserved when calendar selection is changed * * - Calendar selections preserved when changing between calendar and search * * - Printer and Google calendar icons are now shown in the calendar * * 2.1 26.05.2015 - Holiday names shown for dates which are defined in the holidays calendar * * or in the Pfarrübergreifend calendar with description "**Feiertag" * * - Info message improved for no results found or no calendars selected * * 2.2 20.06.2015 - Added parameter "hl=de" to force Google API to return calendar feed in * * German language as well as European dates and times instead. Logic for * * date/time conversion was removed/changed accordingly. * * 2.3 29.06.2015 - In the preview "pfarrübergreifende" events are highlighted with the * * corresponding color and explained with a footnote at the bottom * * 29.09.2015 - Selecting or deseleting Pfarren in the Week mode did not work because a * * wrong date pattern was used in function convertStartdateToYYYYMMDD * * 3.0 22.10.2015 - The XML feed was replaced by the use of the calendar API v3 because the * * XML feed format was discontinued by Google. Search functions were * * adapted accordingly to handle the events in json format returned by the * * API request. No functional changes. * * 3.1 19.11.2015 - Error correction: Preserving startdate and mode in the calendar (as * * introduced with version 2.0) did not work when calendar page and PHP are * * in different domains. * * - Error correction: For multi days events Google API sends wrong end date, * * e.g. for a 2-days event 1.-2.Jan it reports a 3-days event 1.-3.Jan. * * - Added logic to dynamically find the "home" calendars which are initially * * selected and should stay selected when the "All" selection is * * deactivated. * * 03.01.2016 - Added logic to the search function for highlighting the entered search * * words found in the text of the search results. Highlight is defined with * * a user customizable CSS class, default is yellow background. * * 3.2 01.02.2016 - Error correction: If search button was triggered more than once in quick * * succession events were duplicated in the search results. Now a search is * * only performed once with the same search parameters and selections. * * 17.02.20016 - Remove test for Google API error with multi-days events and always reset * * end date by one day. Google replied that this is on purpose and not an * * error. * * 11.03.2016 - Display busy cursor while search requests are executed. * * 14.03.2016 - For the calendar preview use a timer to check that the holidays array is * * filled by the asynchroneous callback function before loading the events. * * 17.03.2016 - Error correction: Multi-days event was shown intermixed with single day * * events. Logic changed accordingly to show multi-days events always * * separately from single days. * * 4.0 22.04.2016 - New functionality added for "single event listing", i.e. a short listing * * of dates for a particular single event such as "Abendgebet" or * * "Bibelrunde". Supports only one such listing per page. * * 25.04.2016 - Improve display of single event listing to allow additional info after * * date/time: (a) trailing star in search term to add info after search * * term, e.g. if search term is "Abendgebet*" and title is "Abendgebet * * (Taize)" it will show "Di 22.Sep 2015, 18:45 - 19:45, Taize", * * (b) leading star will add whole title, e.g. if search term is *PGR * * Klausur" and title is "PGR Klausur (Schönstatt) " it will show * * "Fr 2.Okt 2015 - Sa 3.Okt 2015, PGR Klausur (Schönstatt)". * * 4.1 29.08.2016 - On mobile phones always show calendar in mode "agenda" for better * * readability. * * 4.2 01.11.2016 - In the searchresults add a link on event level for "Copy to my calendar".* * - Enable Export to Word, only supported on desktop PCs. The main purpose * * is to avoid retyping events for miscellaneous publications. The calendar * * search is reused to generate an event list that can be exported to Word * * using an open source jQuery module. * * - Add an expiration date of +1 year for cookies. * * 14.11.2016 - Add Word Export options for font-family, font-size and for time range. * * 17.11.2016 - Attach current selection parameters as query paremeters when calling the * * Word Export page. * * 28.11.2016 - Change "pikaday" (for datepicker) from jQuery version to pure javascript * * which allows dynamic control of min and max dates to be selected so that * * from-date cannot go beyond to-date and vice versa. * * 4.3 18.12.2016 - Add new function for Word Export to prepare "Paragraph" layouts in HTML * * which converts all events in the searchresults table to
paragraphs * * with Word compatible tab stops. * * 01.01.2017 - Add new option line spacing for Word Export. * * 5.0 25.02.2017 - Redesign the Word Export page to allow users defining their own layout * * by arranging fields into 1-5 columns and saving layouts. * * 03.03.2017 - Allow text search in OR relationship (separated by comma) and support * * phrases in quotation marks, e.g. erstkommunion, EK-, "EK Feier" * * 30.03.2017 - Correct Google datesearch error to not include multi-day events of one * * day outsie the selected to-date, e.g. if selection of March 1-31 is * * passed to Google it would also return a multi-day event of April 1-2. * * 5.1 10.06.2017 - Modify logic to save layout options in text files on the server * * providing a separate folder per calendar owner. Saving and changing * * layouts is only allowed in the folder of the currently open web site, * * i.e. maintainenace of Sandleiten layouts is only possible from the * * Sandleiten calendar page and Schmelz layouts only from the Schmelz page. * * 09.08.2017 - Remove logic from initWordExport to assign styles to parent