From a10f45ec79a06633a9a681ac3d0f9423771b4270 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 16 Sep 2015 11:37:20 +0000 Subject: [PATCH] * Calendar/Filemanager: display warning when clicking on an iCal file with more then 1 event, only first one is displayed --- calendar/inc/class.calendar_uiforms.inc.php | 12 +++++++++--- calendar/lang/egw_de.lang | 1 + calendar/lang/egw_en.lang | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index c08c1a66b0..d417f9af39 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -1202,8 +1202,9 @@ class calendar_uiforms extends calendar_ui * edit_single int timestamp of single event edited, unset/null otherwise * @param string $msg ='' msg to display * @param mixed $link_to_id ='' from or for the link-widget + * @param string $msg_type =null default automatic detect, if it contains "error" */ - function edit($event=null,$preserv=null,$msg='',$link_to_id='') + function edit($event=null,$preserv=null,$msg='',$link_to_id='',$msg_type=null) { $sel_options = array( 'recur_type' => &$this->bo->recur_types, @@ -1258,7 +1259,7 @@ class calendar_uiforms extends calendar_ui if (!empty($_GET['ical'])) { $ical = new calendar_ical(); - if (!($events = $ical->icaltoegw($_GET['ical'], '', 'utf-8')) || count($events) != 1) + if (!($events = $ical->icaltoegw($_GET['ical'], '', 'utf-8'))) { error_log(__METHOD__."('$_GET[ical]') error parsing iCal!"); $msg = lang('Error: importing the iCal'); @@ -1266,6 +1267,11 @@ class calendar_uiforms extends calendar_ui } else { + if (count($events) > 1) + { + $msg = lang('%1 events in iCal file, only first one imported and displayed!', count($events)); + $msg_type = 'notice'; // no not hide automatic + } // as icaltoegw returns timestamps in server-time, we have to convert them here to user-time $this->bo->db2data($events, 'ts'); @@ -1415,9 +1421,9 @@ class calendar_uiforms extends calendar_ui 'edit_single' => $preserv['edit_single'], // need to be in content too, as it is used in the template 'tabs' => $preserv['tabs'], 'view' => $view, - 'msg' => $msg, 'query_delete_exceptions' => (int)($event['recur_type'] && $event['recur_exception']), )); + egw_framework::message($msg, $msg_type); $content['duration'] = $content['end'] - $content['start']; if (isset($this->durations[$content['duration']])) $content['end'] = ''; diff --git a/calendar/lang/egw_de.lang b/calendar/lang/egw_de.lang index 84b65569c5..272c77e7e2 100644 --- a/calendar/lang/egw_de.lang +++ b/calendar/lang/egw_de.lang @@ -2,6 +2,7 @@ %1 days calendar de %1 Tage %1 event(s) %2 calendar de %1 Termin(e) %2 %1 event(s) %2, %3 failed because of insufficent rights !!! calendar de %1 Termin(e) %2, %3 wegen fehlender Rechte !!! +%1 events in ical file, only first one imported and displayed! calendar de %1 Termine in der iCal Datei, nur der erste wurde importiert und angezeigt! %1 hours calendar de %1 Stunden %1 minutes calendar de %1 Minuten %1 participants removed because of missing invite grants calendar de %1 Teilnehmer entfernt wegen fehlender Einladungsrechte diff --git a/calendar/lang/egw_en.lang b/calendar/lang/egw_en.lang index edc76a71b0..538584a8a2 100644 --- a/calendar/lang/egw_en.lang +++ b/calendar/lang/egw_en.lang @@ -2,6 +2,7 @@ %1 days calendar en %1 days %1 event(s) %2 calendar en %1 event(s) %2 %1 event(s) %2, %3 failed because of insufficent rights !!! calendar en %1 event(s) %2, %3 failed because of insufficient rights! +%1 events in ical file, only first one imported and displayed! calendar en %1 events in iCal file, only first one imported and displayed! %1 hours calendar en %1 hours %1 minutes calendar en %1 minutes %1 participants removed because of missing invite grants calendar en %1 participants removed because of missing invite grants.