[eGroupWare-svn] r56017 - in /trunk: calendar/inc/ calendar/lang/ calendar/setup/ calendar/templates/default/ egroupware/api/src/CalDAV/

[email protected] Wed, 04 May 2016 17:15:18 -0000
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: ralfbecker
Date: Wed May  4 19:15:18 2016
New Revision: 56017

URL: http://svn.stylite.de/viewvc/egroupware?rev=56017&view=rev
Log:
reading holidays now from Mozilla holiday calendars, or a custom iCal URL

Added:
    trunk/calendar/inc/class.calendar_holidays.inc.php   (with props)
    trunk/calendar/setup/ical_holiday_urls.json
Removed:
    trunk/calendar/inc/class.holidaycalc.inc.php
    trunk/calendar/inc/class.holidaycalc_JP.inc.php
    trunk/calendar/inc/class.holidaycalc_US.inc.php
    trunk/calendar/inc/class.sbox.inc.php
    trunk/calendar/inc/class.soholiday.inc.php
    trunk/calendar/inc/class.uiholiday.inc.php
    trunk/calendar/templates/default/csv_import.tpl
    trunk/calendar/templates/default/delete_common.tpl
    trunk/calendar/templates/default/event_widget.tpl
    trunk/calendar/templates/default/form_button_script.tpl
    trunk/calendar/templates/default/holiday.tpl
    trunk/calendar/templates/default/locales.tpl
    trunk/calendar/templates/default/preference_acl_row.tpl
    trunk/calendar/templates/default/preference_colspan.tpl
Modified:
    trunk/calendar/inc/class.calendar_bo.inc.php
    trunk/calendar/inc/class.calendar_hooks.inc.php
    trunk/calendar/inc/class.calendar_ical.inc.php
    trunk/calendar/inc/class.calendar_ui.inc.php
    trunk/calendar/inc/class.calendar_uiviews.inc.php
    trunk/calendar/lang/egw_de.lang
    trunk/calendar/lang/egw_en.lang
    trunk/calendar/setup/setup.inc.php
    trunk/calendar/setup/tables_current.inc.php
    trunk/calendar/setup/tables_update.inc.php
    trunk/calendar/templates/default/config.xet
    trunk/egroupware/api/src/CalDAV/IcalIterator.php

Modified: trunk/calendar/inc/class.calendar_bo.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_bo.inc.php?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/inc/class.calendar_bo.inc.php (original)
+++ trunk/calendar/inc/class.calendar_bo.inc.php Wed May  4 19:15:18 2016
@@ -184,10 +184,6 @@
 	 * @var array $cached_holidays holidays plus birthdays (gets cached in the session for performance reasons)
 	 */
 	var $cached_holidays;
-	/**
-	 * @var boholiday
-	 */
-	var $holidays;
 	/**
 	 * Instance of the socal class
 	 *
@@ -1744,14 +1740,11 @@
 	 *
 	 * @param int $year =0 year, defaults to 0 = current year
 	 * @return array indexed with Ymd of array of holidays. A holiday is an array with the following fields:
-	 *	index: numerical unique id
-	 *	locale: string, 2-char short for the nation
 	 *	name: string
+	 *  title: optional string with description
 	 *	day: numerical day in month
 	 *	month: numerical month
 	 *	occurence: numerical year or 0 for every year
-	 *	dow: day of week, 0=sunday, .., 6= saturday
-	 *	observande_rule: boolean
 	 */
 	function read_holidays($year=0)
 	{
@@ -1763,12 +1756,10 @@
 		}
 		if (!isset($this->cached_holidays[$year]))
 		{
-			if (!is_object($this->holidays))
-			{
-				$this->holidays = CreateObject('calendar.boholiday');
-			}
-			$this->holidays->prepare_read_holidays($year);
-			$this->cached_holidays[$year] = $this->holidays->read_holiday();
+			$this->cached_holidays[$year] = calendar_holidays::read(
+				!empty($GLOBALS['egw_info']['server']['ical_holiday_url']) ?
+				$GLOBALS['egw_info']['server']['ical_holiday_url'] :
+				$GLOBALS['egw_info']['user']['preferences']['common']['country'], $year);
 
 			// search for birthdays
 			if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes')
@@ -1813,7 +1804,7 @@
 				}
 			}
 			// store holidays and birthdays in the session
-			$this->cached_holidays = Api\Cache::setSession('calendar', 'holidays', $this->cached_holidays);
+			Api\Cache::setSession('calendar', 'holidays', $this->cached_holidays);
 		}
 		if ((int) $this->debug >= 2 || $this->debug == 'read_holidays')
 		{

Added: trunk/calendar/inc/class.calendar_holidays.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_holidays.inc.php?rev=56017&view=auto
==============================================================================
--- trunk/calendar/inc/class.calendar_holidays.inc.php (added)
+++ trunk/calendar/inc/class.calendar_holidays.inc.php Wed May  4 19:15:18 2016
@@ -1,0 +1,220 @@
+<?php
+/**
+ * EGroupware - Calendar holidays
+ *
+ * @link http://www.egroupware.org
+ * @package calendar
+ * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @copyright (c) 2016 by RalfBecker-At-outdoor-training.de
+ * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
+ * @version $Id$
+ */
+
+use EGroupware\Api;
+
+/**
+ * Calendar holidays
+ *
+ * Holidays are read from:
+ * - a given iCal URL or
+ * - json file with 2-digit iso country-code: URL pairs is read from https://community.egroupware.org or
+ * - json file is read from /calendar/setup/ical_holiday_urls.json
+ *
+ * Holidays are cached on tree or instance level, later for custom urls.
+ * As fetching and parsing iCal files is expensive, we always render them
+ * from previous (requested) year until next 5 years.
+ */
+class calendar_holidays
+{
+	const URL_CACHE_TIME = 864000;
+	const URL_FAIL_CACHE_TIME = 300;
+	const EGW_HOLIDAY_URL = 'https://community.egroupware.org/egw';
+	const HOLIDAY_PATH = '/calendar/setup/ical_holiday_urls.json';
+	const HOLIDAY_CACHE_TIME = 864000;
+
+	/**
+	 * Read holidays for given country/url and year
+	 *
+	 * @param string $country 2-digit iso country code or URL
+	 * @param int $year =null default current year
+	 * @return array of Ymd => array of array with values for keys 'occurence','month','day','name', (commented out) 'title'
+	 */
+	public static function read($country, $year=null)
+	{
+		if (!$year) $year = (int)Api\DateTime::to('now', 'Y');
+		$level = self::is_url($country) ? Api\Cache::INSTANCE : Api\Cache::TREE;
+
+		$holidays = Api\Cache::getCache($level, __CLASS__, $country.':'.$year);
+
+		// if we dont find holidays in cache, we render from previous year until next 5 years
+		if (!isset($holidays) && ($years = self::render($country, $year-1, $year+5)))
+		{
+			foreach($years as $y => $data)
+			{
+				Api\Cache::setCache($level, __CLASS__, $country.':'.$y, $data, self::HOLIDAY_CACHE_TIME);
+			}
+			$holidays = $years[$year];
+		}
+		return (array)$holidays;
+	}
+
+	/**
+	 * Fetch holiday iCal and convert it to usual holiday format
+	 *
+	 * @param string $country 2-digit iso country code or URL
+	 * @param int $year =null default current year
+	 * @param int $until_year =null default, fetch only one year, if given result is indexed additional by year
+	 * @return array of Ymd => array of array with values for keys 'occurence','month','day','name', (commented out) 'title'
+	 */
+	public static function render($country, $year=null, $until_year=null)
+	{
+		if (!$year) $year = (int)Api\DateTime::to('now', 'Y');
+		$end_year = $until_year && $year < $until_year ? $until_year : $year;
+
+		$starttime = microtime(true);
+		if (!($holidays = self::fetch($country)))
+		{
+			return array();
+		}
+		$years = array();
+		foreach($holidays as $event)
+		{
+			$start = new Api\DateTime($event['start']);
+			$end = new Api\DateTime($event['end']);
+			if ($start->format('Y') > $end_year) continue;
+			if ($end->format('Y') < $year && !$event['recur_type']) continue;
+
+			// recuring events
+			if ($event['recur_type'])
+			{
+				// calendar_rrule limits no enddate, to 5 years
+				if (!$event['recur_enddate']) $event['recur_enddate'] = (1+$end_year).'0101';
+
+				$rrule = calendar_rrule::event2rrule($event);
+				if ($rrule->enddate && $rrule->enddate->format('Y') < $year) continue;
+
+				foreach($rrule as $rtime)
+				{
+					if (($y = (int)$rtime->format('Y')) < $year) continue;
+					if ($y > $end_year) break;
+
+					$ymd = (int)$rtime->format('Ymd');
+					$years[$y][(string)$ymd][] = array(
+						'day' => $ymd % 100,
+						'month' => ($ymd / 100) % 100,
+						'occurence'  => $y,
+						'name' => $event['title'],
+						//'title' => $event['description'],
+					);
+				}
+			}
+			else
+			{
+				$end_ymd = (int)$end->format('Ymd');
+				while(($ymd = (int)$start->format('Ymd')) <= $end_ymd)
+				{
+					$y = (int)$start->format('Y');
+					$years[$y][(string)$ymd][] = array(
+						'day' => $ymd % 100,
+						'month' => ($ymd / 100) % 100,
+						'occurence'  => $y,
+						'name' => $event['title'],
+						//'title' => $event['description'],
+					);
+					$start->add('1day');
+				}
+			}
+		}
+		foreach($years as $y => &$data)
+		{
+			ksort($data);
+		}
+		error_log(__METHOD__."('$country', $year, $end_year) took ".  number_format(microtime(true)-$starttime, 3).'s to fetch '.count(call_user_func_array('array_merge', $years)).' events');
+		unset($starttime);
+
+		return $until_year ? $years : $years[$year];
+	}
+
+	protected static function is_url($url)
+	{
+		return $url[0] == '/' || strpos($url, '://') !== false;
+	}
+
+	/**
+	 * Fetch iCal for given country
+	 *
+	 * @param string $country 2-digit iso country code or URL
+	 * @return array|Iterator parsed events
+	 */
+	protected static function fetch($country)
+	{
+		if (!($url = self::is_url($country) ? $country : self::ical_url($country)))
+		{
+			error_log("No holiday iCal for '$country'!");
+			return array();
+		}
+		if (!($f = fopen($url, 'r')))
+		{
+			error_log("Can NOT open holiday iCal '$url' for country '$country'!");
+			return array();
+		}
+		$parser = new calendar_ical();
+		if (!($icals = $parser->icaltoegw($f)))
+		{
+			error_log("Error parsing holiday iCal '$url' for country '$country'!");
+			return array();
+		}
+		return $icals;
+	}
+
+	/**
+	 * Get iCal url for holidays of given country
+	 *
+	 * We first try to fetch urls from https://community.egroupware.org and if that fails we use the local one.
+	 *
+	 * @param string $country
+	 * @return string|boolean|null string with url, false if we cant load urls, NULL if $country is not included
+	 */
+	protected static function ical_url($country)
+	{
+		$urls = Api\Cache::getTree(__CLASS__, 'ical_holiday_urls');
+
+		if (!isset($urls))
+		{
+			$ctx = stream_context_create(array(
+				'http'=> array(
+					'timeout' => 1,
+				)
+			));
+			if (!($json = file_get_contents(self::EGW_HOLIDAY_URL.self::HOLIDAY_PATH, false, $ctx)))
+			{
+				$json = file_get_contents(EGW_SERVER_ROOT.self::HOLIDAY_PATH);
+			}
+			if (!$json || !($urls = json_decode($json, true)))
+			{
+				error_log(__METHOD__."() cant read ical_holiday_urls.json!");
+				$urls = false;
+			}
+			Api\Cache::setTree(__CLASS__, 'ical_holiday_urls', $urls, $urls ? self::URL_CACHE_TIME : self::URL_FAIL_CACHE_TIME);
+		}
+		return $urls[$country];
+	}
+}
+
+// some tests when url is called direct
+if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)
+{
+	$GLOBALS['egw_info'] = array(
+		'flags' => array(
+			'currentapp' => 'login',
+		)
+	);
+	include('../../header.inc.php');
+
+	$country = !empty($_GET['country']) && preg_match('/^[A-Z]{2}$/i', $_GET['country']) ? strtoupper($_GET['country']) : 'DE';
+	$year = !empty($_GET['year']) && (int)$_GET['year'] > 2000 ? (int)$_GET['year'] : (int)date('Y');
+	$year_until = !empty($_GET['year_until']) && (int)$_GET['year_until'] >= $year ? (int)$_GET['year_until'] : $year;
+
+	Api\Header\Content::type('holidays-'.$country.'.txt', 'text/plain', 0, true, false);
+	print_r(calendar_holidays::render($country, $year, $year_until));
+}

Propchange: trunk/calendar/inc/class.calendar_holidays.inc.php
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/calendar/inc/class.calendar_holidays.inc.php
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Modified: trunk/calendar/inc/class.calendar_hooks.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_hooks.inc.php?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/inc/class.calendar_hooks.inc.php (original)
+++ trunk/calendar/inc/class.calendar_hooks.inc.php Wed May  4 19:15:18 2016
@@ -86,7 +86,6 @@
 		$file = Array(
 			'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'),
 			'Custom fields' => Egw::link('/index.php','menuaction=admin.customfields.index&appname=calendar'),
-			'Calendar Holiday Management' => Egw::link('/index.php','menuaction=calendar.uiholiday.admin'),
 			'Global Categories' => Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'),
 			'Category ACL' => Egw::link('/index.php','menuaction=calendar.calendar_uiforms.cat_acl'),
 			'Update timezones' => Egw::link('/index.php','menuaction=calendar.calendar_timezones.update'),

Modified: trunk/calendar/inc/class.calendar_ical.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_ical.inc.php?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/inc/class.calendar_ical.inc.php (original)
+++ trunk/calendar/inc/class.calendar_ical.inc.php Wed May  4 19:15:18 2016
@@ -2249,7 +2249,9 @@
 		// we use Api\CalDAV\IcalIterator only on resources, as calling importVCal() accesses single events like an array (eg. $events[0])
 		if (is_resource($_vcalData))
 		{
-			return new Api\CalDAV\IcalIterator($_vcalData,'VCALENDAR',$charset,array($this,'_ical2egw_callback'),array($this->tzid,$principalURL));
+			return new Api\CalDAV\IcalIterator($_vcalData, 'VCALENDAR', $charset,
+				// true = add container as last parameter to callback parameters
+				array($this, '_ical2egw_callback'), array($this->tzid, $principalURL), true);
 		}
 
 		if ($this->tzid)
@@ -2333,6 +2335,12 @@
 		if ($this->log)
 		{
 			error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.'() '.get_class($component)." found\n",3,$this->logfile);
+		}
+
+		// eg. Mozilla holiday calendars contain only a X-WR-TIMEZONE on vCalendar component
+		if (!$tzid && $container && ($tz = $container->getAttributeDefault('X-WR-TIMEZONE')))
+		{
+			$tzid = $tz;
 		}
 
 		if (!is_a($component, 'Horde_Icalendar_Vevent') ||

Modified: trunk/calendar/inc/class.calendar_ui.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_ui.inc.php?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/inc/class.calendar_ui.inc.php (original)
+++ trunk/calendar/inc/class.calendar_ui.inc.php Wed May  4 19:15:18 2016
@@ -520,7 +520,6 @@
 			$file = Array(
 				'Configuration'=>Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'),
 				'Custom Fields'=>Egw::link('/index.php','menuaction=admin.customfields.index&appname=calendar'),
-				'Holiday Management'=>Egw::link('/index.php','menuaction=calendar.uiholiday.admin'),
 				'Global Categories' =>Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar'),
 			);
 			$GLOBALS['egw']->framework->sidebox($appname,lang('Admin'),$file,'admin');

Modified: trunk/calendar/inc/class.calendar_uiviews.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_uiviews.inc.php?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/inc/class.calendar_uiviews.inc.php (original)
+++ trunk/calendar/inc/class.calendar_uiviews.inc.php Wed May  4 19:15:18 2016
@@ -158,7 +158,7 @@
 			'daywise' => True,
 			'use_so_events' => $this->test === 'true',
 		);
-		$this->holidays = $this->bo->read_holidays($this->year);
+//		$this->holidays = $this->bo->read_holidays($this->year);
 
 		$this->check_owners_access();
 

Modified: trunk/calendar/lang/egw_de.lang
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/lang/egw_de.lang?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/lang/egw_de.lang (original)
+++ trunk/calendar/lang/egw_de.lang Wed May  4 19:15:18 2016
@@ -12,9 +12,9 @@
 %s the event	calendar	de	%s dem Termin
 (%1 events in %2 seconds)	calendar	de	(%1 Termine in %2 Sekunden
 (empty = use global limit, no = no export at all)	admin	de	(leer = globale Begrenzung verwenden, nein = gar kein Export)
+(without a custom url we use nation of user preference to load holidays from %s)	calendar	de	(Ohne eine eigene URL laden wir die Feiertage entsprechen des Landes in den Benutzereinstellung aus den %s)
 , exceptions preserved	calendar	de	und Ausnahmen erhalten
 , stati of participants reset	calendar	de	, Status der Teilnehmer zurückgesetzt
-<b>please note</b>: the calendar use the holidays of your country, which is set to %1. you can change it in your %2.<br />holidays are %3 automatic installed from %4. you can changed it in %5.	calendar	de	<b>Bitte beachten</b>: Der Kalender verwendet die Feiertages des Landes, welches auf %1 eingestellt ist. Das können Sie in Ihren %2 ändern.<br />Feiertage werden %3 automatisch von %4 installiert, was in %5 änderbar ist.
 a non blocking event will not conflict with other events	calendar	de	Ein nicht blockierender Termin ergibt keine Konflikt mit anderen Terminen
 accept	calendar	de	Zusagen
 accept or reject an invitation	calendar	de	Einladung zu- oder absagen
@@ -55,8 +55,6 @@
 apply the action on the whole query, not only the shown events	calendar	de	Befehl auf die gesamte Abfrage anwenden, NICHT nur auf die angezeigten Termine
 apply the changes	calendar	de	Übernimmt die Änderungen
 appointment settings	calendar	de	Einstellungen der Terminverwaltung
-are you sure you want to delete this country ?	calendar	de	Sind Sie sicher, dass Sie dieses Land löschen möchten?
-are you sure you want to delete this holiday ?	calendar	de	Sind Sie sicher, dass Sie diesen Feiertag löschen möchten?
 as an alternative you can %1download a mysql dump%2 and import it manually into egw_cal_timezones table.	calendar	de	Als Alternative können Sie auch einen %1MySQL Dump herunterladen%2 und diesen von Hand in die Datenbank Tabelle egw_cal_timezones importieren.
 automatically purge old events after	admin	de	Bereinigt bzw. löscht alte Termine automatisch nach
 back half a month	calendar	de	einen halben Monat zurück
@@ -79,7 +77,6 @@
 calendar csv import	calendar	de	Kalender CSV Import
 calendar event	calendar	de	Kalender Aktualisierung
 calendar fields:	calendar	de	Kalender  Felder:
-calendar holiday management	admin	de	Feiertage verwalten
 calendar ical export	calendar	de	Kalender iCal Export
 calendar ical import	calendar	de	Kalender iCal Import
 calendar id	calendar	de	Kalender ID
@@ -120,6 +117,7 @@
 csv-filename	calendar	de	CSV-Dateiname
 custom	calendar	de	Benutzerdefiniert
 custom fields	common	de	Benutzerdefinierte Felder
+custom url for ical with holidays for all users	calendar	de	Eigene URL für iCal-Datei mit Feiertagen für alle Benutzer
 custom_2	common	de	frei / besetzt
 daily	calendar	de	Täglich
 daily tables	calendar	de	Tabellen für tägliche Einträge
@@ -169,7 +167,6 @@
 do you want to edit this event as an exception or the whole series?	calendar	de	Wollen Sie diesen Termin als Ausnahme bearbeiten oder die ganze Serie?
 do you want to keep the series exceptions in your calendar?	calendar	de	Wollen Sie die Ausnahmen dieses Serientermins in Ihrem Kalender behalten?
 do you want to receive a regulary summary of your appointsments via email?<br>the summary is sent to your standard email-address on the morning of that day or on monday for weekly summarys.<br>it is only sent when you have any appointments on that day or week.	calendar	de	Möchten Sie eine regelmäßige Zusammenfassung Ihrer Termine via E-Mail erhalten?<br>Die Zusammenfassung wird täglich (jeden Morgen), oder für eine wöchentliche Zusammenfassung Montags an Ihre Standard E-Mail Adresse gesendet.<br> Die Benachrichtigung wird nur versendet, wenn Sie am nächsten Tag oder in der nächsten Woche auch einen Termin haben.
-do you wish to autoload calendar holidays files dynamically?	admin	de	Sollen die Feiertage automatisch geladen werden?
 download	calendar	de	Herunterladen
 download this event as ical	calendar	de	Termin als iCal herunterladen
 duration	calendar	de	Dauer
@@ -264,7 +261,6 @@
 history	calendar	de	Historie
 history logging	admin	de	Protokollierung der Historie
 holiday	calendar	de	Feiertag
-holiday management	calendar	de	Feiertagsverwaltung
 holidays	calendar	de	Feiertage
 holidays only	calendar	de	Nur Feiertage
 hours	calendar	de	Stunden
@@ -281,7 +277,6 @@
 ical file	calendar	de	iCal Datei
 ical import	calendar	de	iCal Import
 ical successful imported	calendar	de	iCal erfolgreich importiert
-if checked holidays falling on a weekend, are taken on the monday after.	calendar	de	Wenn ausgewählt werden Feiertage die auf ein Wochenende fallen, am drauf folgenden Montag nachgeholt.
 if start day differs	calendar	de	Wenn die Starttage abweichen
 if you dont set a password here, the information is available to everyone, who knows the url!!!	calendar	de	Wenn Sie hier kein Passwort angeben, ist die Information für jeden verfügbar, der die Adresse (URL) kennt!!!
 if you select a range (month, week, etc) instead of a list of entries, these extra fields are available	calendar	de	Falls Sie einen Bereich (Monat, Woche, Tag) anstatt einer Liste von Einträge ausgewählt haben, können Sie folgende Platzhalter für Ihre Felder definieren.
@@ -318,7 +313,6 @@
 list of files linked to the current record	calendar	de	Liste der Dokumente, die zum aktuellen Datensatz gehören.
 listview	calendar	de	Listenansicht
 location	calendar	de	Ort
-location to autoload from	admin	de	Von wo sollen sie geladen werden
 location, start- and endtimes, ...	calendar	de	Ort, Start- und Endzeiten
 mail all participants	calendar	de	Mail an alle Teilnehmer
 make freebusy information available to not loged in persons?	calendar	de	Die freien/nicht verfügbaren Zeiten für nicht angemeldete Personen sichtbar machen?
@@ -459,7 +453,6 @@
 selected range	calendar	de	Ausgewählter Zeitraum
 send meetingrequest to all participants after the event is saved	calendar	de	Terminanforderung an alle Teilnehmer senden nachdem der Termin gespeichert wurde
 series deleted	calendar	de	Serientermin wurde gelöscht
-set a year only for one-time / non-regular holidays.	calendar	de	Nur für einmalige bzw. unregelmäßige Feiertage das Jahr angeben.
 set new events to private	calendar	de	Neue Termine als private Termine eintragen
 setting lock time calender	admin	de	Zeitintervall für Datensatzlock (Voreinstellung beträgt eine Sekunde)
 shall the date parameter be accepted (e.g. from calendar module)?	calendar	de	Soll der Parameter Datum akzeptiert werden (z.B. vom Kalender Modul)?

Modified: trunk/calendar/lang/egw_en.lang
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/lang/egw_en.lang?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/lang/egw_en.lang (original)
+++ trunk/calendar/lang/egw_en.lang Wed May  4 19:15:18 2016
@@ -12,9 +12,9 @@
 %s the event	calendar	en	%s the event
 (%1 events in %2 seconds)	calendar	en	(%1 events in %2 seconds)
 (empty = use global limit, no = no export at all)	admin	en	(empty = use global limit, no = no export at all)
+(without a custom url we use nation of user preference to load holidays from %s)	calendar	en	(Without a custom URL we use nation of user preference to load holidays from %s)
 , exceptions preserved	calendar	en	, exceptions preserved
 , stati of participants reset	calendar	en	, status of participants reset
-<b>please note</b>: the calendar use the holidays of your country, which is set to %1. you can change it in your %2.<br />holidays are %3 automatic installed from %4. you can changed it in %5.	calendar	en	<b>Please note</b>: The calendar use the holidays of your country, which is set to %1. You can change it in your %2.<br />Holidays are %3 automatic installed from %4. You can change it in %5.
 a non blocking event will not conflict with other events	calendar	en	A non blocking event will not conflict with other events
 accept	calendar	en	Accept
 accept or reject an invitation	calendar	en	Accept or reject an invitation
@@ -55,8 +55,6 @@
 apply the action on the whole query, not only the shown events	calendar	en	Apply the action on the whole query, NOT only the shown events.
 apply the changes	calendar	en	Apply the changes
 appointment settings	calendar	en	Appointment settings
-are you sure you want to delete this country ?	calendar	en	Are you sure you want to delete this country?
-are you sure you want to delete this holiday ?	calendar	en	Are you sure you want to delete this holiday?
 as an alternative you can %1download a mysql dump%2 and import it manually into egw_cal_timezones table.	calendar	en	As an alternative you can %1download a MySQL dump%2 and import it manually into egw_cal_timezones table.
 automatically purge old events after	admin	en	Automatically purge old events after
 back half a month	calendar	en	Back half a month
@@ -79,7 +77,6 @@
 calendar csv import	calendar	en	Calendar CSV import
 calendar event	calendar	en	Calendar event
 calendar fields:	calendar	en	Calendar fields:
-calendar holiday management	admin	en	Calendar holiday management
 calendar ical export	calendar	en	Calendar iCal export
 calendar ical import	calendar	en	Calendar iCal import
 calendar id	calendar	en	Calendar ID
@@ -120,6 +117,7 @@
 csv-filename	calendar	en	CSV file name
 custom	calendar	en	Custom
 custom fields	common	en	Custom fields
+custom url for ical with holidays for all users	calendar	en	Custom URL for iCal with holidays for all users
 custom_2	common	en	Free/Busy
 daily	calendar	en	Daily
 daily tables	calendar	en	Daily tables
@@ -169,7 +167,6 @@
 do you want to edit this event as an exception or the whole series?	calendar	en	Do you want to edit this event as an exception or the whole series?
 do you want to keep the series exceptions in your calendar?	calendar	en	Do you want to keep the series exceptions in your calendar?
 do you want to receive a regulary summary of your appointsments via email?<br>the summary is sent to your standard email-address on the morning of that day or on monday for weekly summarys.<br>it is only sent when you have any appointments on that day or week.	calendar	en	Do you want to receive regularly a summary of your appointments via email?<br>The summary is sent to your standard email-address on the morning of that day or on Monday for weekly summaries.<br>It is only sent when you have any appointments on that day or week.
-do you wish to autoload calendar holidays files dynamically?	admin	en	Do you wish to auto-load calendar holidays files dynamically?
 download	calendar	en	Download
 download this event as ical	calendar	en	Download this event as iCal
 duration	calendar	en	Duration
@@ -264,7 +261,6 @@
 history	calendar	en	History
 history logging	admin	en	History logging
 holiday	calendar	en	Holiday
-holiday management	calendar	en	Holiday management
 holidays	calendar	en	Holidays
 holidays only	calendar	en	Holidays only
 hours	calendar	en	hours
@@ -281,7 +277,6 @@
 ical file	calendar	en	iCal file
 ical import	calendar	en	iCal import
 ical successful imported	calendar	en	iCal successful imported.
-if checked holidays falling on a weekend, are taken on the monday after.	calendar	en	If checked holidays are falling on a weekend, they are taken on the Monday after.
 if start day differs	calendar	en	If start day differs
 if you dont set a password here, the information is available to everyone, who knows the url!!!	calendar	en	If you don't set a password here, the information is available to everyone, who knows the URL!
 if you select a range (month, week, etc) instead of a list of entries, these extra fields are available	calendar	en	If you select a range (month, week, etc) instead of a list of entries, these extra fields are available.
@@ -318,7 +313,6 @@
 list of files linked to the current record	calendar	en	List of files linked to the current record
 listview	calendar	en	List view
 location	calendar	en	Location
-location to autoload from	admin	en	Location to autoload from
 location, start- and endtimes, ...	calendar	en	Location, start and end times, ...
 mail all participants	calendar	en	Mail all participants
 make freebusy information available to not loged in persons?	calendar	en	Make Free/Busy information available to not logged in persons
@@ -460,7 +454,6 @@
 selected range	calendar	en	Selected range
 send meetingrequest to all participants after the event is saved	calendar	en	Send meetingrequest to all participants after the event is saved
 series deleted	calendar	en	Series deleted
-set a year only for one-time / non-regular holidays.	calendar	en	Set a year only for one time / non regular holidays.
 set new events to private	calendar	en	Set new events to private
 setting lock time calender	admin	en	Setting data lock time for Calendar (default 1 sec.)
 shall the date parameter be accepted (e.g. from calendar module)?	calendar	en	Shall the date parameter be accepted, e.g. from calendar module?

Added: trunk/calendar/setup/ical_holiday_urls.json
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/setup/ical_holiday_urls.json?rev=56017&view=auto
==============================================================================
--- trunk/calendar/setup/ical_holiday_urls.json (added)
+++ trunk/calendar/setup/ical_holiday_urls.json Wed May  4 19:15:18 2016
@@ -1,0 +1,72 @@
+{
+	"_origin": "https://www.mozilla.org/en-US/projects/calendar/holidays/",
+	"DZ": "https://www.mozilla.org/media/caldata/AlgeriaHolidays.ics",
+	"AR": "https://www.mozilla.org/media/caldata/ArgentinaHolidays.ics",
+	"AU": "https://www.mozilla.org/media/caldata/AustraliaHolidays.ics",
+	"AT": "https://www.mozilla.org/media/caldata/AustrianHolidays.ics",
+	"BE": "https://www.mozilla.org/media/caldata/BelgianHolidays.ics",
+	"BO": "https://www.mozilla.org/media/caldata/BoliviaHolidays.ics",
+	"BR": "https://www.mozilla.org/media/caldata/BrazilHolidays.ics",
+	"BG": "https://www.mozilla.org/media/caldata/BulgarianHolidays.ics",
+	"CA": "https://www.mozilla.org/media/caldata/CanadaHolidays.ics",
+	"CL": "https://www.mozilla.org/media/caldata/ChileHolidays.ics",
+	"CN": "https://www.mozilla.org/media/caldata/ChinaHolidays.ics",
+	"CO": "https://www.mozilla.org/media/caldata/ColombianHolidays.ics",
+	"CR": "https://www.mozilla.org/media/caldata/CostaRicaHolidays.ics",
+	"HR": "https://www.mozilla.org/media/caldata/CroatiaHolidays.ics",
+	"CZ": "https://www.mozilla.org/media/caldata/CzechHolidays.ics",
+	"DK": "https://www.mozilla.org/media/caldata/DanishHolidays.ics",
+	"DO": "https://www.mozilla.org/media/caldata/DominicanRepublicSpanish.ics",
+	"EE": "https://www.mozilla.org/media/caldata/EstoniaHolidays.ics",
+	"FI": "https://www.mozilla.org/media/caldata/FinlandHolidays.ics",
+	"FR": "https://www.mozilla.org/media/caldata/FrenchHolidays.ics",
+	"DE": "https://www.mozilla.org/media/caldata/GermanHolidays.ics",
+	"GR": "https://www.mozilla.org/media/caldata/GreeceHolidays.ics",
+	"GY": "https://www.mozilla.org/media/caldata/GuyanaHolidays.ics",
+	"HT": "https://www.mozilla.org/media/caldata/HaitiHolidays.ics",
+	"HK": "https://www.mozilla.org/media/caldata/HongKongHolidays.ics",
+	"HU": "https://www.mozilla.org/media/caldata/HungarianHolidays.ics",
+	"IS": "https://www.mozilla.org/media/caldata/IcelandHolidays.ics",
+	"IN": "https://www.mozilla.org/media/caldata/IndiaHolidays.ics",
+	"ID": "https://www.mozilla.org/media/caldata/IndonesianHolidays.ics",
+	"IR": "https://www.mozilla.org/media/caldata/IranHolidays_Persian.ics",
+	"IE": "https://www.mozilla.org/media/caldata/IrelandHolidays2014-2021.ics",
+	"IT": "https://www.mozilla.org/media/caldata/ItalianHolidays.ics",
+	"JP": "https://www.mozilla.org/media/caldata/JapanHolidays.ics",
+	"KZ": "https://www.mozilla.org/media/caldata/KazakhstanHolidaysRussian.ics",
+	"KE": "https://www.mozilla.org/media/caldata/KenyaHolidays.ics",
+	"KR": "https://www.mozilla.org/media/caldata/SouthKoreaHolidays.ics",
+	"LV": "https://www.mozilla.org/media/caldata/LatviaHolidays.ics",
+	"LI": "https://www.mozilla.org/media/caldata/LiechtensteinHolidays.ics",
+	"LT": "https://www.mozilla.org/media/caldata/LithuanianHolidays.ics",
+	"LU": "https://www.mozilla.org/media/caldata/LuxembourgHolidays.ics",
+	"MA": "https://www.mozilla.org/media/caldata/MoroccoHolidays.ics",
+	"NL": "https://www.mozilla.org/media/caldata/DutchHolidays.ics",
+	"NZ": "https://www.mozilla.org/media/caldata/NewZealandHolidays.ics",
+	"NI": "https://www.mozilla.org/media/caldata/NicaraguaHolidays.ics",
+	"NO": "https://www.mozilla.org/media/caldata/NorwegianHolidays.ics",
+	"PK": "https://www.mozilla.org/media/caldata/PakistanHolidays.ics",
+	"PE": "https://www.mozilla.org/media/caldata/PeruHolidays.ics",
+	"PH": "https://www.mozilla.org/media/caldata/PhilippinesHolidays.ics",
+	"PL": "https://www.mozilla.org/media/caldata/PolishHolidays.ics",
+	"PT": "https://www.mozilla.org/media/caldata/PortugalHolidays.ics",
+	"RO": "https://www.mozilla.org/media/caldata/RomaniaHolidays.ics",
+	"RU": "https://www.mozilla.org/media/caldata/RussiaHolidays.ics",
+	"SG": "https://www.mozilla.org/media/caldata/SingaporeHolidays.ics",
+	"SK": "https://www.mozilla.org/media/caldata/SlovakHolidays.ics",
+	"SI": "https://www.mozilla.org/media/caldata/SlovenianHolidays.ics",
+	"ZA": "https://www.mozilla.org/media/caldata/SouthAfricaHolidays.ics",
+	"ES": "https://www.mozilla.org/media/caldata/SpanishHolidays.ics",
+	"LK": "https://www.mozilla.org/media/caldata/SriLankaHolidays.ics",
+	"SE": "https://www.mozilla.org/media/caldata/SwedishHolidays.ics",
+	"CH": "https://www.mozilla.org/media/caldata/SwissHolidays.ics",
+	"TW": "https://www.mozilla.org/media/caldata/TaiwanHolidays.ics",
+	"TH": "https://www.mozilla.org/media/caldata/ThaiHolidays.ics",
+	"TT": "https://www.mozilla.org/media/caldata/TrinidadTobagoHolidays.ics.ics",
+	"TR": "https://www.mozilla.org/media/caldata/TurkeyHolidays.ics",
+	"UA": "https://www.mozilla.org/media/caldata/UkraineHolidays.ics",
+	"GB": "https://www.mozilla.org/media/caldata/UKHolidays.ics",
+	"US": "https://www.mozilla.org/media/caldata/USHolidays.ics",
+	"UY": "https://www.mozilla.org/media/caldata/UruguayHolidays.ics",
+	"VN": "https://www.mozilla.org/media/caldata/VietnamHolidays.ics"
+}

Modified: trunk/calendar/setup/setup.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/setup/setup.inc.php?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/setup/setup.inc.php (original)
+++ trunk/calendar/setup/setup.inc.php Wed May  4 19:15:18 2016
@@ -10,7 +10,7 @@
  */
 
 $setup_info['calendar']['name']    = 'calendar';
-$setup_info['calendar']['version'] = '16.1';
+$setup_info['calendar']['version'] = '16.1.001';
 $setup_info['calendar']['app_order'] = 3;
 $setup_info['calendar']['enable']  = 1;
 $setup_info['calendar']['index']   = 'calendar.calendar_uiviews.index&ajax=true';
@@ -26,7 +26,6 @@
 );
 
 $setup_info['calendar']['tables'][] = 'egw_cal';
-$setup_info['calendar']['tables'][] = 'egw_cal_holidays';
 $setup_info['calendar']['tables'][] = 'egw_cal_repeats';
 $setup_info['calendar']['tables'][] = 'egw_cal_user';
 $setup_info['calendar']['tables'][] = 'egw_cal_extra';

Modified: trunk/calendar/setup/tables_current.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/setup/tables_current.inc.php?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/setup/tables_current.inc.php (original)
+++ trunk/calendar/setup/tables_current.inc.php Wed May  4 19:15:18 2016
@@ -39,22 +39,6 @@
 		'pk' => array('cal_id'),
 		'fk' => array(),
 		'ix' => array('cal_uid','cal_owner','cal_modified','cal_reference','cal_deleted','caldav_name'),
-		'uc' => array()
-	),
-	'egw_cal_holidays' => array(
-		'fd' => array(
-			'hol_id' => array('type' => 'auto','nullable' => False),
-			'hol_locale' => array('type' => 'char','precision' => '2','nullable' => False),
-			'hol_name' => array('type' => 'varchar','precision' => '50','nullable' => False),
-			'hol_mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
-			'hol_month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
-			'hol_occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
-			'hol_dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'),
-			'hol_observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0')
-		),
-		'pk' => array('hol_id'),
-		'fk' => array(),
-		'ix' => array('hol_locale'),
 		'uc' => array()
 	),
 	'egw_cal_repeats' => array(

Modified: trunk/calendar/setup/tables_update.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/setup/tables_update.inc.php?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/setup/tables_update.inc.php (original)
+++ trunk/calendar/setup/tables_update.inc.php Wed May  4 19:15:18 2016
@@ -2715,3 +2715,11 @@
 {
 	return $GLOBALS['setup_info']['calendar']['currentver'] = '16.1';
 }
+
+
+function calendar_upgrade16_1()
+{
+	$GLOBALS['egw_setup']->oProc->DropTable('egw_cal_holidays');
+
+	return $GLOBALS['setup_info']['calendar']['currentver'] = '16.1.001';
+}

Modified: trunk/calendar/templates/default/config.xet
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/templates/default/config.xet?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/calendar/templates/default/config.xet (original)
+++ trunk/calendar/templates/default/config.xet Wed May  4 19:15:18 2016
@@ -10,18 +10,11 @@
 			</columns>
 			<rows>
 				<row>
-					<description value="Do you wish to autoload calendar holidays files dynamically?"/>
-					<select id="newsettings[auto_load_holidays]">
-						<option value="">No</option>
-						<option value="True">Yes</option>
-					</select>
-				</row>
-				<row>
-					<description value="Location to autoload from" label="%s:"/>
-					<select id="newsettings[holidays_url_path]">
-						<option value="localhost">localhost</option>
-						<option value="http://www.egroupware.org/cal">www.egroupware.org</option>
-					</select>
+					<vbox>
+						<description value="Custom URL for iCal with holidays for all users" label="%s:"/>
+						<description label="(Without a custom URL we use nation of user preference to load holidays from %s)" href="https://www.mozilla.org/en-US/projects/calendar/holidays/" value="Mozilla Holiday Calendars" extra_link_target="_blank"/>
+					</vbox>
+					<url id="newsettings[ical_holiday_url]" size="64"/>
 				</row>
 				<row>
 					<description value="setting lock time calender" label="%s:"/>

Modified: trunk/egroupware/api/src/CalDAV/IcalIterator.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/CalDAV/IcalIterator.php?rev=56017&r1=56016&r2=56017&view=diff
==============================================================================
--- trunk/egroupware/api/src/CalDAV/IcalIterator.php (original)
+++ trunk/egroupware/api/src/CalDAV/IcalIterator.php Wed May  4 19:15:18 2016
@@ -104,8 +104,9 @@
 	 * @param string $charset =null
 	 * @param callback $callback =null callback to call with component in current() method, if returning false, item get's ignored
 	 * @param array $callback_params =array() further parameters for the callback, 1. parameter is component
-	 */
-	public function __construct($ical_file,$base='VCALENDAR',$charset=null,$callback=null,array $callback_params=array())
+	 * @param boolean $add_container =false true, add container / $this as last parameter to callback
+	 */
+	public function __construct($ical_file,$base='VCALENDAR',$charset=null,$callback=null,array $callback_params=array(), $add_container=false)
 	{
 		// call parent constructor
 		parent::__construct();
@@ -115,6 +116,7 @@
 		if (is_callable($callback))
 		{
 			$this->callback = $callback;
+			if ($add_container) $callback_params[] = $this;
 			$this->callback_params = $callback_params;
 		}
 		if (is_string($ical_file))
@@ -274,7 +276,7 @@
 	 */
 	public function rewind()
 	{
-		fseek($this->ical_file,0,SEEK_SET);
+		@fseek($this->ical_file,0,SEEK_SET);
 
 		// advance to begin of container
 		while(($line = $this->read_line()) && substr($line,0,6+strlen($this->base)) !== 'BEGIN:'.$this->base)


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
eGroupWare-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs