Display subscription URLs.
authorJan Schneider <jan@horde.org>
Fri, 9 Apr 2010 15:49:40 +0000 (16:49 +0100)
committerJan Schneider <jan@horde.org>
Fri, 9 Apr 2010 17:04:02 +0000 (19:04 +0200)
kronolith/js/kronolith.js
kronolith/lib/Kronolith.php
kronolith/templates/chunks/calendar.php
nag/templates/tasklist_info.php

index 7bf4aa3..1d9e2fe 100644 (file)
@@ -2367,6 +2367,7 @@ KronolithCore = {
             $('kronolithC' + type + 'PAdvanced').select('tr').findAll(function(tr) {
                 return tr.retrieve('remove');
             }).invoke('remove');
+            $('kronolithCalendar' + type + 'Urls').hide();
         }
 
         var newCalendar = !calendar;
@@ -2428,6 +2429,9 @@ KronolithCore = {
                 } else {
                     $('kronolithCalendar' + type + 'LinkImport').up('li').hide();
                 }
+                $('kronolithCalendar' + type + 'UrlFeed')
+                    .writeAttribute('href', info.feed)
+                    .update(info.feed.escapeHTML());
                 // Fall through.
             case 'tasklists':
                 $('kronolithCalendar' + type + 'Description').setValue(info.desc);
@@ -2435,6 +2439,10 @@ KronolithCore = {
                 $('kronolithCalendar' + type + 'Export').href = type == 'internal'
                     ? Kronolith.conf.URI_CALENDAR_EXPORT + '=' + calendar
                     : Kronolith.conf.tasks.URI_TASKLIST_EXPORT + '=' + calendar.substring(6);
+                $('kronolithCalendar' + type + 'Urls').show();
+                $('kronolithCalendar' + type + 'UrlSub')
+                    .writeAttribute('href', info.sub)
+                    .update(info.sub.escapeHTML());
                 break;
             case 'remote':
                 $('kronolithCalendarremoteUrl').setValue(calendar);
index b531df2..6d2cfe8 100644 (file)
@@ -240,6 +240,9 @@ class Kronolith
             $code['conf']['tasks'] = $registry->tasks->ajaxDefaults();
         }
 
+        $subscriptionCals = Horde::url($registry->get('webroot', 'horde') . ($GLOBALS['conf']['urls']['pretty'] == 'rewrite' ? '/rpc/kronolith/' : '/rpc.php/kronolith/'), true, -1);
+        $subscriptionTasks = Horde::url($registry->get('webroot', 'horde') . ($GLOBALS['conf']['urls']['pretty'] == 'rewrite' ? '/rpc/nag/' : '/rpc.php/nag/'), true, -1);
+
         // Calendars
         foreach (array(true, false) as $my) {
             foreach ($GLOBALS['all_calendars'] as $id => $calendar) {
@@ -261,6 +264,8 @@ class Kronolith
                         'show' => in_array($id, $GLOBALS['display_calendars']),
                         'perms' => $calendar->getPermission()->data,
                         'edit' => $calendar->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT),
+                        'sub' => $subscriptionCals . ($calendar->get('owner') ? $calendar->get('owner') : '-system-') . '/' . $calendar->getName() . '.ics',
+                        'feed' => (string)Kronolith::feedUrl($calendar->getName()),
                         'tg' => array_values($tagger->getTags($calendar->getName(), 'calendar')));
                 }
             }
@@ -287,7 +292,8 @@ class Kronolith
                         'bg' => self::backgroundColor($tasklist),
                         'show' => in_array('tasks/' . $id, $GLOBALS['display_external_calendars']),
                         'perms' => $tasklist->getPermission()->data,
-                        'edit' => $tasklist->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT));
+                        'edit' => $tasklist->hasPermission(Horde_Auth::getAuth(), Horde_Perms::EDIT),
+                        'sub' => $subscriptionTasks . ($tasklist->get('owner') ? $tasklist->get('owner') : '-system-') . '/' . $tasklist->getName() . '.ics');
                 }
             }
         }
index c464c55..30713a8 100644 (file)
@@ -41,6 +41,17 @@ $file_upload = $GLOBALS['browser']->allowFileUploads();
   </label>
 </div>
 
+<div id="kronolithCalendarinternalUrls" style="display:none">
+  <label><?php echo _("Subscription URL") ?></label>
+  <span class="kronolithSeparator">&mdash;</span>
+  <span class="kronolithDialogInfo"><?php echo _("To subscribe to this calendar from another calendar program, use this URL:") ?></span><br />
+  <a id="kronolithCalendarinternalUrlSub" href="#" target="_blank"></a><br />
+  <label><?php echo _("Feed URL") ?></label>
+  <span class="kronolithSeparator">&mdash;</span>
+  <span class="kronolithDialogInfo"><?php echo _("To subscribe to this calendar from a feed reader, use this URL:") ?></span><br />
+  <a id="kronolithCalendarinternalUrlFeed" href="#" target="_blank"></a><br />
+</div>
+
 <div class="tabset">
   <ul>
     <li class="activeTab"><a href="#" class="kronolithTabLink" id="kronolithCalendarinternalLinkDescription"><?php echo _("Description") ?></a></li>
@@ -121,6 +132,13 @@ $file_upload = $GLOBALS['browser']->allowFileUploads();
   </label>
 </div>
 
+<div id="kronolithCalendartasklistsUrls" style="display:none">
+  <label><?php echo _("Subscription URL") ?></label>
+  <span class="kronolithSeparator">&mdash;</span>
+  <span class="kronolithDialogInfo"><?php echo _("To subscribe to this taks list from another program, use this URL:") ?></span><br />
+  <a id="kronolithCalendartasklistsUrlSub" href="#" target="_blank"></a><br />
+</div>
+
 <div class="tabset">
   <ul>
     <li class="activeTab"><a href="#" class="kronolithTabLink" id="kronolithCalendartasklistsLinkDescription"><?php echo _("Description") ?></a></li>
index af753e6..ce6db6c 100644 (file)
@@ -4,7 +4,7 @@
 <?php endif; ?>
 <p>
  <?php echo $owner_name ? sprintf(_("Task List owned by %s."), $owner_name) : _("Task List owned by system.") ?>
- <?php echo _("To subscribe to this task list from another program, use this URL: ") ?>
+ <?php echo _("To subscribe to this task list from another program, use this URL:") ?>
 </p>
 <p class="tasklist-info-url">
  <?php echo htmlspecialchars($subscribe_url) ?>