Add calendar and tasklist export.
authorJan Schneider <jan@horde.org>
Fri, 19 Feb 2010 22:25:20 +0000 (23:25 +0100)
committerJan Schneider <jan@horde.org>
Fri, 19 Feb 2010 23:18:09 +0000 (00:18 +0100)
kronolith/js/kronolith.js
kronolith/lib/Kronolith.php
kronolith/templates/chunks/calendar.php
nag/lib/Api.php

index 02a0842..4efc3f0 100644 (file)
@@ -2077,6 +2077,7 @@ KronolithCore = {
             switch (type) {
             case 'internal':
             case 'tasklists':
+                $('kronolithCalendar' + type + 'LinkImportExport').up().hide();
                 fields.push('Description');
                 break;
             case 'remote':
@@ -2102,8 +2103,14 @@ KronolithCore = {
 
         switch (type) {
         case 'internal':
-        case 'tasklists':
             $('kronolithCalendarinternalDescription').setValue(info.desc);
+            $('kronolithCalendarinternalLinkImportExport').up().show();
+            $('kronolithCalendarinternalExport').href = Kronolith.conf.URI_CALENDAR_EXPORT + '=' + calendar;
+            break;
+        case 'tasklists':
+            $('kronolithCalendartasklistsDescription').setValue(info.desc);
+            $('kronolithCalendartasklistsLinkImportExport').up().show();
+            $('kronolithCalendartasklistsExport').href = Kronolith.conf.tasks.URI_TASKLIST_EXPORT + '=' + calendar.substring(6);
             break;
         case 'remote':
             $('kronolithCalendarremoteUrl').setValue(calendar);
index 6c8ef01..6b78aed 100644 (file)
@@ -187,6 +187,7 @@ class Kronolith
             'URI_AJAX' => (string)Horde::getServiceLink('ajax', 'kronolith'),
             'URI_IMG' => $registry->getImageDir() . '/',
             'URI_SNOOZE' => (string)Horde::url($registry->get('webroot', 'horde') . '/services/snooze.php', true, -1),
+            'URI_CALENDAR_EXPORT' => (string)Horde::url('data.php', true)->add(array('actionID' => 'export', 'all_events' => 1, 'exportID' => Horde_Data::EXPORT_ICALENDAR, 'exportCal' => '')),
             'SESSION_ID' => defined('SID') ? SID : '',
             'user' => Horde_Auth::getAuth(),
             'prefs_url' => str_replace('&amp;', '&', Horde::getServiceLink('options', 'kronolith')),
index 13fd839..aa983e3 100644 (file)
@@ -23,6 +23,7 @@
     <li class="activeTab"><a href="#" class="kronolithTabLink" id="kronolithCalendarinternalLinkDescription"><?php echo _("Description") ?></a></li>
     <li><a href="#" class="kronolithTabLink" id="kronolithCalendarinternalLinkTags"><?php echo _("Tags") ?></a></li>
     <li><a href="#" class="kronolithTabLink" id="kronolithCalendarinternalLinkPerms"><?php echo _("Permissions") ?></a></li>
+    <li><a href="#" class="kronolithTabLink" id="kronolithCalendarinternalLinkImportExport"><?php echo _("Export") /*_("Import/Export")*/ ?></a></li>
   </ul>
 </div>
 <br class="clear" />
 tbd
 </div>
 
+<div id="kronolithCalendarinternalTabImportExport" class="kronolithTabsOption" style="display:none">
+  <div class="kronolithTabInfo"><?php echo _("iCalendar is a computer file format which allows internet users to send meeting requests and tasks to other internet users, via email, or sharing files with an extension of .ics. Recipients of the iCalendar data file (with supporting software, such as an email client or calendar application) can respond to the sender easily or counter propose another meeting date/time.") ?></div>
+  <?php /* ?>
+  <label><?php echo _("Import ICS file") ?>:
+    <input type="file" name="import_file" />
+  </label>
+  <br />
+  <?php */ ?>
+  <label><?php echo _("Export ICS file") ?>:</label>
+  <a id="kronolithCalendarinternalExport"><?php echo _("Calendar ICS file") ?></a>
+</div>
+
 <div class="kronolithFormActions">
   <input type="button" value="<?php echo _("Save") ?>" class="kronolithCalendarSave button ok" />
   <input type="button" value="<?php echo _("Delete") ?>" class="kronolithCalendarDelete button ko" />
@@ -72,6 +85,7 @@ tbd
   <ul>
     <li class="activeTab"><a href="#" class="kronolithTabLink" id="kronolithCalendartasklistsLinkDescription"><?php echo _("Description") ?></a></li>
     <li><a href="#" class="kronolithTabLink" id="kronolithCalendartasklistsLinkPerms"><?php echo _("Permissions") ?></a></li>
+    <li><a href="#" class="kronolithTabLink" id="kronolithCalendartasklistsLinkImportExport"><?php echo _("Export") /*_("Import/Export")*/ ?></a></li>
   </ul>
 </div>
 <br class="clear" />
@@ -84,6 +98,18 @@ tbd
 tbd
 </div>
 
+<div id="kronolithCalendartasklistsTabImportExport" class="kronolithTabsOption" style="display:none">
+  <div class="kronolithTabInfo"><?php echo _("iCalendar is a computer file format which allows internet users to send meeting requests and tasks to other internet users, via email, or sharing files with an extension of .ics. Recipients of the iCalendar data file (with supporting software, such as an email client or calendar application) can respond to the sender easily or counter propose another meeting date/time.") ?></div>
+  <?php /* ?>
+  <label><?php echo _("Import ICS file") ?>:
+    <input type="file" name="import_file" />
+  </label>
+  <br />
+  <?php */ ?>
+  <label><?php echo _("Export ICS file") ?>:</label>
+  <a id="kronolithCalendartasklistsExport"><?php echo _("Calendar ICS file") ?></a>
+</div>
+
 <div class="kronolithFormActions">
   <input type="button" value="<?php echo _("Save") ?>" class="kronolithCalendarSave button ok" />
   <input type="button" value="<?php echo _("Delete") ?>" class="kronolithCalendarDelete button ko" />
index d0b8cd5..8ef354d 100644 (file)
@@ -26,6 +26,7 @@ class Nag_Api extends Horde_Registry_Api
     public function ajaxDefaults()
     {
         return array(
+            'URI_TASKLIST_EXPORT' => (string)Horde::url('data.php', true)->add(array('actionID' => 'export', 'exportTasks' => 1, 'exportID' => Horde_Data::EXPORT_ICALENDAR, 'exportList' => '')),
             'default_tasklist' => Nag::getDefaultTasklist(Horde_Perms::EDIT),
             'default_due' => (bool)$GLOBALS['prefs']->getValue('default_due'),
             'default_due_days' => (int)$GLOBALS['prefs']->getValue('default_due_days'),