gunnar: server/kolab-webclient/kronolith/patches/kronolith-2.3.3 t_kronolith_HK_GW_ZpushAnnotations.diff, 1.1, 1.2

cvs at kolab.org cvs at kolab.org
Mon Jun 7 17:44:02 CEST 2010


Author: gunnar

Update of /kolabrepository/server/kolab-webclient/kronolith/patches/kronolith-2.3.3
In directory doto:/tmp/cvs-serv14745/kronolith/patches/kronolith-2.3.3

Modified Files:
	t_kronolith_HK_GW_ZpushAnnotations.diff 
Log Message:
         - Allow modifications of foreign shares.
         - Update list of devices immediately rather than reading them
           from the share parameters.
         - Adapt from SYNC/ALARM to S parameter.


Index: t_kronolith_HK_GW_ZpushAnnotations.diff
===================================================================
RCS file: /kolabrepository/server/kolab-webclient/kronolith/patches/kronolith-2.3.3/t_kronolith_HK_GW_ZpushAnnotations.diff,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- t_kronolith_HK_GW_ZpushAnnotations.diff	6 May 2010 07:10:06 -0000	1.1
+++ t_kronolith_HK_GW_ZpushAnnotations.diff	7 Jun 2010 15:44:00 -0000	1.2
@@ -8,15 +8,18 @@
 diff -Naur a/calendars/edit.php b/calendars/edit.php
 --- a/calendars/edit.php	2010-05-04 22:00:35.670897983 +0200
 +++ b/calendars/edit.php	2010-05-06 07:45:36.406431213 +0200
-@@ -46,7 +46,6 @@
-             $notification->push(sprintf(_("The calendar \"%s\" has been saved."), $original_name), 'horde.success');
-         }
-     }
--
+@@ -26,10 +26,6 @@
+     $notification->push($calendar, 'horde.error');
      header('Location: ' . Horde::applicationUrl('calendars/', true));
      exit;
+-} elseif ($calendar->get('owner') != Auth::getAuth()) {
+-    $notification->push(_("You are not allowed to change this calendar."), 'horde.error');
+-    header('Location: ' . Horde::applicationUrl('calendars/', true));
+-    exit;
  }
-@@ -57,6 +56,23 @@
+ $form = new Kronolith_EditCalendarForm($vars, $calendar);
+ 
+@@ -57,6 +56,25 @@
  if (isset($params['fbrelevance'])) {
      $vars->set('fbrelevance', $params['fbrelevance']);
  }
@@ -26,15 +29,17 @@
 +    } else {
 +        $default = 0;
 +    }
-+    $devices = $params['activesync']['DEVICE'];
++    require_once 'Horde/Kolab/Storage.php';
++    $folder = Kolab_Storage::getFolder('INBOX');
++    $result = $folder->getActiveSync();
++    $devices = isset($result['DEVICE']) ? $result['DEVICE'] : null;
 +    if (!empty($devices)) {
 +        $folders = $params['activesync']['FOLDER'];
 +        $vars->set('activesync_devices', implode('|', array_keys($devices)));
 +        foreach ($devices as $id => $config) {
-+            $vars->set('activesync_' . $id . '_sync', isset($folders[$id]['SYNC']) ? $folders[$id]['SYNC'] : $default);
-+            $vars->set('activesync_' . $id . '_alarm', isset($folders[$id]['ALARM']) ? $folders[$id]['ALARM'] : $default);
++            $vars->set('activesync_' . $id, isset($folders[$id]['S']) ? $folders[$id]['S'] : $default);
 +        }
-+        $form->activeSyncSegment($devices, $default);
++        $form->activeSyncSegment($devices);
 +    }
 +}
  $title = $form->getTitle();
@@ -43,41 +48,64 @@
 diff -Naur a/lib/Forms/EditCalendar.php b/lib/Forms/EditCalendar.php
 --- a/lib/Forms/EditCalendar.php	2010-05-04 22:00:36.210910903 +0200
 +++ b/lib/Forms/EditCalendar.php	2010-05-05 10:30:48.073386331 +0200
-@@ -49,13 +49,40 @@
+@@ -40,22 +40,56 @@
+         parent::Horde_Form($vars, sprintf(_("Edit %s"), $calendar->get('name')));
+ 
+         $this->addHidden('', 'c', 'text', true);
+-        $this->addVariable(_("Name"), 'name', 'text', true);
++        if ($this->_calendar->get('owner') != Auth::getAuth()) {
++            $this->addVariable(_("Name"), 'name', 'text', false, true);
++        } else {
++            $this->addVariable(_("Name"), 'name', 'text', true);
++        }
+         $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
+-        $this->addVariable(_("Relevance"), 'fbrelevance', 'radio', false, false, null, 
+-                           array(array(_("owners/administrators"), _("readers"), _("no one")), 
+-                                 'This calendar is only included into the free/busy data for ...'));
++        if ($this->_calendar->get('owner') == Auth::getAuth()) {
++            $this->addVariable(_("Relevance"), 'fbrelevance', 'radio', false, false, null, 
++                               array(array(_("owners/administrators"), _("readers"), _("no one")), 
++                                     'This calendar is only included into the free/busy data for ...'));
++        }
+ 
          $this->setButtons(array(_("Save")));
      }
  
-+    function activeSyncSegment($devices, $default)
++    function activeSyncSegment($devices)
 +    {
 +        $this->addHidden('', 'activesync_devices', 'text');
 +        $this->addVariable('', '', 'spacer');
-+        $this->addVariable(_("Synchronize this calendar with the following ActiveSync devices"), '', 'header');
-+        foreach ($devices as $id => $config) {
-+            $this->addVariable($id, 'activesync_' . $id . '_sync', 'boolean', false);
-+        }
-+        $this->addVariable('', '', 'spacer');
-+        $this->addVariable(_("Activate alarms for this calendar on the following ActiveSync devices"), '', 'header');
++        $this->addVariable(_("Synchronization options for ActiveSync devices"), '', 'header');
 +        foreach ($devices as $id => $config) {
-+            $this->addVariable($id, 'activesync_' . $id . '_alarm', 'boolean', false);
++            $this->addVariable(sprintf("Device \"%s\"", $id), 'activesync_' . $id, 'radio', false, false, null, 
++                           array(array(_("does not synchronize with this calendar"), _("synchronizes with this calendar but ignores alarms"), _("synchronizes with this calendar including alarms"))));
 +        }
 +    }
 +
      function execute()
      {
-         $original_name = $this->_calendar->get('name');
-         $new_name = $this->_vars->get('name');
-         $this->_calendar->set('name', $new_name);
+-        $original_name = $this->_calendar->get('name');
+-        $new_name = $this->_vars->get('name');
+-        $this->_calendar->set('name', $new_name);
          $this->_calendar->set('desc', $this->_vars->get('description'));
 -        $this->_calendar->set('params', serialize(array('fbrelevance' => (int) $this->_vars->get('fbrelevance', 0))));
-+        $params = array('fbrelevance' => (int) $this->_vars->get('fbrelevance', 0));
++
++        $original_name = $this->_calendar->get('name');
++        if ($this->_calendar->get('owner') == Auth::getAuth()) {
++            $new_name = $this->_vars->get('name');
++            $this->_calendar->set('name', $new_name);
++            $params = array('fbrelevance' => (int) $this->_vars->get('fbrelevance', 0));
++        } else {
++            $new_name = $original_name;
++        }
 +
 +        if ($this->_vars->get('activesync_devices', '')) {
 +            $ids = explode('|', $this->_vars->get('activesync_devices', ''));
 +            foreach ($ids as $id) {
-+                $sync = $this->_vars->get('activesync_' . $id . '_sync');
-+                $alarm = $this->_vars->get('activesync_' . $id . '_alarm');
-+                $params['activesync']['FOLDER'][$id]['SYNC'] = empty($sync) ? 0 : 1;
-+                $params['activesync']['FOLDER'][$id]['ALARM'] = empty($alarm) ? 0 : 1;
++                $sync = (int) $this->_vars->get('activesync_' . $id, 0);
++                if ($sync === 0 || $sync === 1 || $sync === 2) {
++                    $params['activesync']['FOLDER'][$id]['S'] = $sync;
++                }
 +            }
 +        }
 +





More information about the commits mailing list