From f8c7108a6d7497f788fa8d34efb99886d8af14ca Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 11 Mar 2010 18:24:37 +0100 Subject: [PATCH] Implement iCalendar import. --- kronolith/data.php | 10 ++++++++++ kronolith/js/kronolith.js | 13 +++++++++++-- kronolith/templates/chunks/calendar.php | 24 +++++++++++++++++------- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/kronolith/data.php b/kronolith/data.php index 62f525b68..63943c411 100644 --- a/kronolith/data.php +++ b/kronolith/data.php @@ -296,6 +296,16 @@ if (is_array($next_step)) { $next_step = $data->cleanup(); } +if (Horde_Util::getFormData('import_ajax')) { + $stack = $notification->notify(array('listeners' => 'status', 'raw' => true)); + if ($stack) { + Horde::addInlineScript('window.parent.KronolithCore.showNotifications(window.parent.$A(' . Horde_Serialize::serialize($stack, Horde_Serialize::JSON, Horde_Nls::getCharset()) . '));'); + Horde::addInlineScript('window.parent.$(window.name).remove();'); + Horde::outputInlineScript(); + } + exit; +} + $import_calendars = $export_calendars = array(); if (Horde_Auth::getAuth()) { $calendars = Kronolith::listCalendars(false, Horde_Perms::EDIT); diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index ac17dd687..1d624bec0 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -2226,7 +2226,7 @@ KronolithCore = { switch (type) { case 'internal': kronolithCTagAc.reset(); - // Fall through + // Fall through. case 'tasklists': $('kronolithCalendar' + type + 'LinkImportExport').up('span').hide(); break; @@ -2250,7 +2250,8 @@ KronolithCore = { switch (type) { case 'internal': kronolithCTagAc.reset(Kronolith.conf.calendars.internal[calendar].tg); - // fall through + $('kronolithCalendar' + type + 'ImportCal').setValue(calendar); + // Fall through. case 'tasklists': $('kronolithCalendar' + type + 'Description').setValue(info.desc); $('kronolithCalendar' + type + 'LinkImportExport').up('span').show(); @@ -2657,6 +2658,14 @@ KronolithCore = { data, function(r) { if (r.response.saved) { + if ($F('kronolithCalendarinternalImport')) { + var name = 'kronolithIframe' + Math.round(Math.random() * 1000), + iframe = new Element('iframe', { src: 'about:blank', name: name, id: name }).setStyle({ display: 'none' }); + //iframe.observe('load', function() { iframe.remove.defer(); }); + document.body.insert(iframe); + form.target = name; + form.submit(); + } if (data.calendar) { var cal = Kronolith.conf.calendars[type][data.calendar], color = { diff --git a/kronolith/templates/chunks/calendar.php b/kronolith/templates/chunks/calendar.php index 0b2e4143c..5ce3fa125 100644 --- a/kronolith/templates/chunks/calendar.php +++ b/kronolith/templates/chunks/calendar.php @@ -10,12 +10,22 @@ if ($groups instanceof PEAR_Error) { $groups = array(); } asort($groups); +$file_upload = $GLOBALS['browser']->allowFileUploads(); ?>
-
+> + + + + + + + + +
@@ -40,7 +50,7 @@ asort($groups); |
    -
  • +
@@ -62,12 +72,12 @@ asort($groups); -- 2.11.0