summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@pardus.de>2010-06-02 19:06:32 (GMT)
committerGunnar Wrobel <wrobel@pardus.de>2010-06-02 19:06:32 (GMT)
commite815ec83e03ee3b788ea3e41e1daf5305191620f (patch)
tree52d923f4de67703840f3edcee3f0016d7375c377
parent383fcb6945151b3dd7b89f0c095ff32faa9fb7b4 (diff)
downloadserver-e815ec83e03ee3b788ea3e41e1daf5305191620f.tar.gz
Merge the activesync configuration frontend to the 2.2.4 stable branch so that it can be built via CVS (use make dist-activesync for that).
-rw-r--r--kolab-webclient/Makefile36
-rw-r--r--kolab-webclient/activesync_conf.patch626
-rw-r--r--kolab-webclient/kolab-webclient.spec12
3 files changed, 673 insertions, 1 deletions
diff --git a/kolab-webclient/Makefile b/kolab-webclient/Makefile
index 0726d66..66ee9ee 100644
--- a/kolab-webclient/Makefile
+++ b/kolab-webclient/Makefile
@@ -13,7 +13,7 @@ SOURCE_VERSION = $(shell grep "%define[ ]*V_source_version" *.spec | sed -e "s/.
PASSWD_VERSION = $(shell grep "%define[ ]*V_passwd_version" *.spec | sed -e "s/.*V_passwd_version\s*\([0-9._a-z]*\).*/\1/")
RELEASE = ${YEAR}${MONTH}${DAY}
-PATCHES = ../patches/horde-webmail/$(VERSION)/horde-webmail-$(VERSION)_kolab_openpkg.patch
+PATCHES = ../patches/horde-webmail/$(VERSION)/horde-webmail-$(VERSION)_kolab_openpkg.patch activesync_conf.patch
TEMPLATES = $(shell find . -name "*.template")
CONFIGS = $(shell find . -name "*.php")
@@ -66,3 +66,37 @@ $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm $(PACKAGE)-$(VERS
.PHONY: install
install: $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm
$(RPM) -Uhv --force $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE).$(PLATTAG).rpm
+
+.PHONY: all-activesync
+all-activesync: $(PACKAGE)-$(VERSION)-$(RELEASE)+activesync1.src.rpm
+
+.PHONY: dist-activesync
+dist-activesync: all-activesync
+ cp $(PACKAGE)-$(VERSION)-$(RELEASE)+activesync1.src.rpm ../stage/
+
+$(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE)+activesync1.$(PLATTAG).rpm $(PACKAGE)-$(VERSION)-$(RELEASE)+activesync1.src.rpm: Makefile $(PACKAGE).spec $(TEMPLATES) $(CONFIGS) ChangeLog
+ test -d $(KOLABRPMSRC)/$(PACKAGE) || mkdir $(KOLABRPMSRC)/$(PACKAGE)
+ cd $(KOLABRPMSRC)/$(PACKAGE) && wget -c "$(SOURCE_0)" && wget -c "$(SOURCE_1)"
+
+ for PATCH in $(PATCHES); do \
+ cp "$$PATCH" $(KOLABRPMSRC)/$(PACKAGE); done
+
+ cp $(PACKAGE).spec $(KOLABRPMSRC)/$(PACKAGE)
+
+ if [ -n "$(TEMPLATES)" ]; then \
+ for TEMPLATE in $(TEMPLATES); \
+ do \
+ cp $$TEMPLATE $(KOLABRPMSRC)/$(PACKAGE);\
+ done; \
+ fi
+
+ if [ -n "$(CONFIGS)" ]; then \
+ for CONFIG in $(CONFIGS); \
+ do \
+ cp $$CONFIG $(KOLABRPMSRC)/$(PACKAGE); \
+ done; \
+ fi
+
+ cd $(KOLABRPMSRC)/$(PACKAGE) && $(RPM) -ba $(PACKAGE).spec --define 'with_activesync yes'
+
+ cp -p $(KOLABRPMPKG)/$(PACKAGE)-$(VERSION)-$(RELEASE)+activesync1.src.rpm .
diff --git a/kolab-webclient/activesync_conf.patch b/kolab-webclient/activesync_conf.patch
new file mode 100644
index 0000000..e995c46
--- /dev/null
+++ b/kolab-webclient/activesync_conf.patch
@@ -0,0 +1,626 @@
+diff -Naur a/config/prefs.php b/config/prefs.php
+--- a/config/prefs.php.dist 2010-05-04 22:00:29.938760839 +0200
++++ b/config/prefs.php.dist 2010-05-04 22:02:27.177573941 +0200
+@@ -165,6 +165,14 @@
+ 'members' => array()
+ );
+
++$prefGroups['activesync'] = array(
++ 'column' => _("Other Information"),
++ 'label' => _("ActiveSync"),
++ 'desc' => _("Configuration for syncing with PDAs, Smartphones and Outlook."),
++ 'url' => 'services/portal/activesync.php',
++ 'members' => array()
++);
++
+ // Personal Information preferences
+
+ // default identity
+diff -Naur a/config/prefs.php b/config/prefs.php
+--- a/config/prefs.php 2010-05-04 22:00:29.938760839 +0200
++++ b/config/prefs.php 2010-05-04 22:02:27.177573941 +0200
+@@ -165,6 +165,14 @@
+ 'members' => array()
+ );
+
++$prefGroups['activesync'] = array(
++ 'column' => _("Other Information"),
++ 'label' => _("ActiveSync"),
++ 'desc' => _("Configuration for syncing with PDAs, Smartphones and Outlook."),
++ 'url' => 'services/portal/activesync.php',
++ 'members' => array()
++);
++
+ // Personal Information preferences
+
+ // default identity
+diff -Naur a/services/portal/activesync.php b/services/portal/activesync.php
+--- a/services/portal/activesync.php 1970-01-01 01:00:00.000000000 +0100
++++ b/services/portal/activesync.php 2010-05-06 06:52:58.250251515 +0200
+@@ -0,0 +1,72 @@
++<?php
++/**
++ * $Horde: horde/services/portal/syncml.php,v 1.3.2.15 2009-01-06 15:27:33 jan Exp $
++ *
++ * Copyright 2005-2009 The Horde Project (http://www.horde.org/)
++ *
++ * See the enclosed file COPYING for license information (LGPL). If you
++ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
++ *
++ * @author Karsten Fourmont <karsten@horde.org>
++ */
++
++require_once dirname(__FILE__) . '/../../lib/base.php';
++
++if (!Auth::isAuthenticated()) {
++ Horde::authenticationFailureRedirect();
++}
++
++require_once 'Horde/Kolab/Storage.php';
++$folder = Kolab_Storage::getFolder('INBOX');
++$result = $folder->getActiveSync();
++$devices = isset($result['DEVICE']) ? $result['DEVICE'] : null;
++
++$actionID = Util::getFormData('actionID');
++switch ($actionID) {
++case 'save':
++ if (Util::getFormData('delete')) {
++ $deviceids = array_keys(Util::getFormData('delete'));
++ $deviceid = $deviceids[0];
++ $result = $folder->deleteActiveSyncDevice($deviceid);
++ if (is_a($result, 'PEAR_Error')) {
++ $notification->push(_("Error deleting device:")
++ . ' ' . $result->getMessage(),
++ 'horde.error');
++ } else {
++ $notification->push(sprintf(_("Deleted ActiveSync device \"%s\"."),
++ $deviceid),
++ 'horde.success');
++ unset($devices[$deviceid]);
++ }
++ } else {
++ $modes = Util::getFormData('mode_select', array());
++ foreach ($modes as $deviceid => $mode) {
++ $devices[$deviceid]['MODE'] = $mode;
++ }
++ $data = array('DEVICE' => $devices);
++ $result = $folder->setActiveSyncDeviceData($data, 'DEVICE');
++ if (is_a($result, 'PEAR_Error')) {
++ $notification->push(_("Error storing synchronization modes:")
++ . ' ' . $result->getMessage(),
++ 'horde.error');
++ } else {
++ $notification->push(_("Synchronization modes stored successfully."),
++ 'horde.success');
++ }
++ }
++}
++
++/* Show the header. */
++require_once 'Horde/Prefs/UI.php';
++$result = Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'horde');
++if (!is_a($result, 'PEAR_Error')) {
++ extract($result);
++}
++$app = 'horde';
++$chunk = Util::nonInputVar('chunk');
++Prefs_UI::generateHeader('activesync', $chunk);
++
++require HORDE_TEMPLATES . '/activesync/activesync.inc';
++if (!$chunk) {
++ require HORDE_TEMPLATES . '/common-footer.inc';
++}
+diff -Naur a/templates/activesync/activesync.inc b/templates/activesync/activesync.inc
+--- a/templates/activesync/activesync.inc 1970-01-01 01:00:00.000000000 +0100
++++ b/templates/activesync/activesync.inc 2010-05-05 06:08:23.358849561 +0200
+@@ -0,0 +1,41 @@
++<div class="smallheader">
++ <?php echo _("Known ActiveSync synchronisation devices") ?>
++</div>
++<?php if (!$devices): ?>
++<em><?php echo _("None") ?></em>
++<?php else: ?>
++<table class="striped">
++<tr>
++ <th><?php echo _("Device") ?></th>
++ <th><?php echo _("Type") ?></th>
++ <th><?php echo _("Mode") ?></th>
++</tr>
++<?php
++foreach ($devices as $device => $data) {
++?>
++<tr>
++ <td><?php echo htmlspecialchars($device) ?></td>
++ <td><?php echo htmlspecialchars($data['TYPE']) ?></td>
++ <td>
++ <select id="mode_select[<?php echo $device; ?>]" name="mode_select[<?php echo $device; ?>]">
++ <option value=""><?php echo _("Select the device mode:"); ?></option>
++ <option value="-1" <?php echo ($data['MODE'] === null || $data['MODE'] === '-1') ? 'selected="selected"' : ''; ?>>Default</option>
++ <option value="0" <?php echo ($data['MODE'] === '0') ? 'selected="selected"' : ''; ?>>Flat mode</option>
++ <option value="1" <?php echo ($data['MODE'] === '1') ? 'selected="selected"' : ''; ?>>Folder mode</option>
++ </select>
++ </td>
++ <td>
++ <input type="submit" class="button" value="<?php echo _("Delete") ?>" name="delete[<?php echo htmlspecialchars($device) ?>]"/>
++ </td>
++</tr>
++<?php } ?>
++</table>
++<?php endif; ?>
++<p>
++ <input type="hidden" name="actionID" value="save" />
++ <input type="submit" class="button" value="<?php echo _("Store device modes") ?>" />
++ <input id="prefs_return" type="button" class="button" onclick="cancelSubmit=true;document.location.href='<?php echo Horde::applicationUrl(Util::addParameter('services/prefs.php', 'app', 'horde'), true) ?>'" value="<?php echo _("Return to Options") ?>" />
++</p>
++
++</div>
++</form>
+diff -Naur a/calendars/edit.php b/calendars/edit.php
+--- a/kronolith/calendars/edit.php 2010-05-04 22:00:35.670897983 +0200
++++ b/kronolith/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');
+ }
+ }
+-
+ header('Location: ' . Horde::applicationUrl('calendars/', true));
+ exit;
+ }
+@@ -57,6 +56,23 @@
+ if (isset($params['fbrelevance'])) {
+ $vars->set('fbrelevance', $params['fbrelevance']);
+ }
++if (isset($params['activesync'])) {
++ if ($params['activesync']['NAMESPACE'] == 'PERSONAL') {
++ $default = 1;
++ } else {
++ $default = 0;
++ }
++ $devices = $params['activesync']['DEVICE'];
++ 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);
++ }
++ $form->activeSyncSegment($devices, $default);
++ }
++}
+ $title = $form->getTitle();
+ require KRONOLITH_TEMPLATES . '/common-header.inc';
+ require KRONOLITH_TEMPLATES . '/menu.inc';
+diff -Naur a/lib/Forms/EditCalendar.php b/lib/Forms/EditCalendar.php
+--- a/kronolith/lib/Forms/EditCalendar.php 2010-05-04 22:00:36.210910903 +0200
++++ b/kronolith/lib/Forms/EditCalendar.php 2010-05-05 10:30:48.073386331 +0200
+@@ -49,13 +49,40 @@
+ $this->setButtons(array(_("Save")));
+ }
+
++ function activeSyncSegment($devices, $default)
++ {
++ $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');
++ foreach ($devices as $id => $config) {
++ $this->addVariable($id, 'activesync_' . $id . '_alarm', 'boolean', false);
++ }
++ }
++
+ function execute()
+ {
+ $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));
++
++ 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;
++ }
++ }
++
++ $this->_calendar->set('params', serialize($params));
+
+ if ($original_name != $new_name) {
+ $result = $GLOBALS['kronolith_driver']->rename($original_name, $new_name);
+diff -Naur a/lib/Forms/EditNotepad.php b/lib/Forms/EditNotepad.php
+--- a/mnemo/lib/Forms/EditNotepad.php 2010-05-10 08:25:30.000000000 +0200
++++ b/mnemo/lib/Forms/EditNotepad.php 2010-05-10 08:28:09.000000000 +0200
+@@ -46,10 +46,38 @@
+ $this->setButtons(array(_("Save")));
+ }
+
++ function activeSyncSegment($devices, $default)
++ {
++ $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');
++ foreach ($devices as $id => $config) {
++ $this->addVariable($id, 'activesync_' . $id . '_alarm', 'boolean', false);
++ }
++ }
++
+ function execute()
+ {
+ $this->_notepad->set('name', $this->_vars->get('name'));
+ $this->_notepad->set('desc', $this->_vars->get('description'));
++
++ if ($this->_vars->get('activesync_devices', '')) {
++ $params = array();
++ $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;
++ }
++ $this->_notepad->set('params', serialize($params));
++ }
++
+ $result = $this->_notepad->save();
+ if (is_a($result, 'PEAR_Error')) {
+ return PEAR::raiseError(sprintf(_("Unable to save notepad \"%s\": %s"), $id, $result->getMessage()));
+diff -Naur a/notepads/edit.php b/notepads/edit.php
+--- a/mnemo/notepads/edit.php 2010-05-10 08:25:30.000000000 +0200
++++ b/mnemo/notepads/edit.php 2010-05-10 08:28:19.000000000 +0200
+@@ -51,6 +51,26 @@
+
+ $vars->set('name', $notepad->get('name'));
+ $vars->set('description', $notepad->get('desc'));
++
++$params = @unserialize($notepad->get('params'));
++if (isset($params['activesync'])) {
++ if ($params['activesync']['NAMESPACE'] == 'PERSONAL') {
++ $default = 1;
++ } else {
++ $default = 0;
++ }
++ $devices = $params['activesync']['DEVICE'];
++ 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);
++ }
++ $form->activeSyncSegment($devices, $default);
++ }
++}
++
+ $title = $form->getTitle();
+ require MNEMO_TEMPLATES . '/common-header.inc';
+ require MNEMO_TEMPLATES . '/menu.inc';
+diff -Naur a/addressbooks/edit.php b/addressbooks/edit.php
+--- a/turba/addressbooks/edit.php 2010-05-10 08:30:03.000000000 +0200
++++ b/turba/addressbooks/edit.php 2010-05-10 08:31:19.000000000 +0200
+@@ -53,6 +53,26 @@
+
+ $vars->set('name', $addressbook->get('name'));
+ $vars->set('description', $addressbook->get('desc'));
++
++$params = @unserialize($addressbook->get('params'));
++if (isset($params['activesync'])) {
++ if ($params['activesync']['NAMESPACE'] == 'PERSONAL') {
++ $default = 1;
++ } else {
++ $default = 0;
++ }
++ $devices = $params['activesync']['DEVICE'];
++ 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);
++ }
++ $form->activeSyncSegment($devices, $default);
++ }
++}
++
+ $title = $form->getTitle();
+ require TURBA_TEMPLATES . '/common-header.inc';
+ require TURBA_TEMPLATES . '/menu.inc';
+diff -Naur a/lib/Forms/EditAddressBook.php b/lib/Forms/EditAddressBook.php
+--- a/turba/lib/Forms/EditAddressBook.php 2010-05-10 08:30:05.000000000 +0200
++++ b/turba/lib/Forms/EditAddressBook.php 2010-05-10 08:32:28.000000000 +0200
+@@ -46,10 +46,38 @@
+ $this->setButtons(array(_("Save")));
+ }
+
++ function activeSyncSegment($devices, $default)
++ {
++ $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');
++ foreach ($devices as $id => $config) {
++ $this->addVariable($id, 'activesync_' . $id . '_alarm', 'boolean', false);
++ }
++ }
++
+ function execute()
+ {
+ $this->_addressbook->set('name', $this->_vars->get('name'));
+ $this->_addressbook->set('desc', $this->_vars->get('description'));
++
++ if ($this->_vars->get('activesync_devices', '')) {
++ $params = array();
++ $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;
++ }
++ $this->_addressbook->set('params', serialize($params));
++ }
++
+ $result = $this->_addressbook->save();
+ if (is_a($result, 'PEAR_Error')) {
+ return PEAR::raiseError(sprintf(_("Unable to save address book \"%s\": %s"), $id, $result->getMessage()));
+diff -Naur a/lib/Forms/EditTaskList.php b/lib/Forms/EditTaskList.php
+--- a/nag/lib/Forms/EditTaskList.php 2010-05-10 08:10:16.000000000 +0200
++++ b/nag/lib/Forms/EditTaskList.php 2010-05-10 08:18:34.000000000 +0200
+@@ -46,10 +46,38 @@
+ $this->setButtons(array(_("Save")));
+ }
+
++ function activeSyncSegment($devices, $default)
++ {
++ $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');
++ foreach ($devices as $id => $config) {
++ $this->addVariable($id, 'activesync_' . $id . '_alarm', 'boolean', false);
++ }
++ }
++
+ function execute()
+ {
+ $this->_tasklist->set('name', $this->_vars->get('name'));
+ $this->_tasklist->set('desc', $this->_vars->get('description'));
++
++ if ($this->_vars->get('activesync_devices', '')) {
++ $params = array();
++ $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;
++ }
++ $this->_tasklist->set('params', serialize($params));
++ }
++
+ $result = $this->_tasklist->save();
+ if (is_a($result, 'PEAR_Error')) {
+ return PEAR::raiseError(sprintf(_("Unable to save task list \"%s\": %s"), $id, $result->getMessage()));
+diff -Naur a/tasklists/edit.php b/tasklists/edit.php
+--- a/nag/tasklists/edit.php 2010-05-10 08:10:16.000000000 +0200
++++ b/nag/tasklists/edit.php 2010-05-10 08:22:49.000000000 +0200
+@@ -51,6 +51,26 @@
+
+ $vars->set('name', $tasklist->get('name'));
+ $vars->set('description', $tasklist->get('desc'));
++
++$params = @unserialize($tasklist->get('params'));
++if (isset($params['activesync'])) {
++ if ($params['activesync']['NAMESPACE'] == 'PERSONAL') {
++ $default = 1;
++ } else {
++ $default = 0;
++ }
++ $devices = $params['activesync']['DEVICE'];
++ 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);
++ }
++ $form->activeSyncSegment($devices, $default);
++ }
++}
++
+ $title = $form->getTitle();
+ require NAG_TEMPLATES . '/common-header.inc';
+ require NAG_TEMPLATES . '/menu.inc';
+diff -Naur a/a/a/Share/kolab.php b/a/a/Share/kolab.php
+--- a/lib/Horde/Share/kolab.php 2010-05-05 07:51:03.742452620 +0200
++++ b/lib/Horde/Share/kolab.php 2010-05-06 07:46:45.088087728 +0200
+@@ -524,7 +524,8 @@
+ $params = @unserialize($this->_folder->getAttribute('params'));
+ $default = array('source' => 'kolab',
+ 'default' => $this->get('default'),
+- 'name' => $this->get('name'));
++ 'name' => $this->get('name'),
++ 'activesync' => $this->_folder->getActiveSync());
+ $type = $this->get('type');
+ if (!is_a($type, 'PEAR_Error') && $type == 'event') {
+ $default = array_merge($default, array(
+diff -Naur a/framework/Kolab_Storage/lib/Horde/Kolab/Storage.orig/Folder.php b/framework/Kolab_Storage/lib/Horde/Kolab/Storage/Folder.php
+--- a/lib/Horde/Kolab/Storage/Folder.php 2010-05-04 23:44:49.522328256 +0200
++++ b/lib/Horde/Kolab/Storage/Folder.php 2010-05-06 07:46:01.507036608 +0200
+@@ -412,13 +412,23 @@
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
++ unset($params['xfbaccess']);
+ }
+ if (isset($params['fbrelevance'])) {
+ $result = $this->setFbrelevance(join(' ', $params['fbrelevance']));
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
++ unset($params['fbrelevance']);
+ }
++ if (isset($params['activesync'])) {
++ $result = $this->setActiveSyncDeviceData($params['activesync'], 'FOLDER');
++ if (is_a($result, 'PEAR_Error')) {
++ return $result;
++ }
++ unset($params['activesync']);
++ }
++ $value = serialize($params);
+ }
+
+ // setAnnotation apparently does not suppoort UTF-8 nor any special characters
+@@ -1645,6 +1655,132 @@
+ return $this->_setAnnotation(KOLAB_ANNOT_ROOT . 'pxfb-readable-for',
+ $value);
+ }
++
++ /**
++ * Get the active sync settings for this folder.
++ *
++ * @return array Array containing the active sync information.
++ */
++ function getActiveSync()
++ {
++ $imap = Horde_Kolab_Session::singleton()->getImap();
++ if (is_a($imap, 'PEAR_Error')) {
++ return $imap;
++ }
++ $raw = $imap->getAnnotation(
++ KOLAB_ANNOT_ROOT . 'activesync', 'value.priv', $this->name
++ );
++ $local = json_decode(base64_decode($raw), true);
++ if (!$this->name != 'INBOX') {
++ $raw = $imap->getAnnotation(
++ KOLAB_ANNOT_ROOT . 'activesync', 'value.priv', 'INBOX'
++ );
++ $global = json_decode(base64_decode($raw), true);
++ if (!is_array($local)) {
++ $result = array(
++ 'DEVICE' => isset($global['DEVICE']) ? $global['DEVICE'] : array(),
++ 'FOLDER' => array()
++ );
++ } elseif (is_array($global)) {
++ $result = array(
++ 'DEVICE' => isset($global['DEVICE']) ? $global['DEVICE'] : array(),
++ 'FOLDER' => isset($local['FOLDER']) ? $local['FOLDER'] : array(),
++ );
++ } else {
++ $result = array(
++ 'DEVICE' => array(),
++ 'FOLDER' => isset($local['FOLDER']) ? $local['FOLDER'] : array(),
++ );
++ }
++ } else {
++ $result = array(
++ 'DEVICE' => isset($global['DEVICE']) ? $global['DEVICE'] : array(),
++ 'FOLDER' => array()
++ );
++ }
++ $result['NAMESPACE'] = (strpos($this->name, 'INBOX') === 0) ? 'PERSONAL' : 'OTHER';
++ return $result;
++ }
++
++ /**
++ * Delete an active sync device for this folder.
++ *
++ * @param string $id The id of the device.
++ *
++ * @return mixed True on success or a PEAR_Error.
++ */
++ function deleteActiveSyncDevice($id)
++ {
++ $imap = Horde_Kolab_Session::singleton()->getImap();
++ if (is_a($imap, 'PEAR_Error')) {
++ return $imap;
++ }
++ $raw = $imap->getAnnotation(
++ KOLAB_ANNOT_ROOT . 'activesync', 'value.priv', $this->name
++ );
++ $result = json_decode(base64_decode($raw), true);
++ if (is_a($result, 'PEAR_Error')) {
++ return $result;
++ }
++ if (!is_array($result)) {
++ return true;
++ }
++ unset($result['DEVICE'][$id]);
++ $result = $imap->setAnnotation(
++ KOLAB_ANNOT_ROOT . 'activesync',
++ array('value.priv' => base64_encode(json_encode($result))),
++ $this->name
++ );
++ if (is_a($result, 'PEAR_Error')) {
++ return $result;
++ }
++ return true;
++ }
++
++ /**
++ * Set the active sync annotation.
++ *
++ * @param string $data The data to store in the annotation.
++ * @param string $type The type of the data (DEVICE|FOLDER).
++ *
++ * @return mixed True on success or a PEAR_Error.
++ */
++ function setActiveSyncDeviceData($data, $type = 'DEVICE')
++ {
++ $imap = Horde_Kolab_Session::singleton()->getImap();
++ if (is_a($imap, 'PEAR_Error')) {
++ return $imap;
++ }
++ $raw = $imap->getAnnotation(
++ KOLAB_ANNOT_ROOT . 'activesync', 'value.priv', $this->name
++ );
++ $old = json_decode(base64_decode($raw), true);
++ if (is_a($old, 'PEAR_Error')) {
++ return $data;
++ }
++ if (!is_array($old)) {
++ $old = array();
++ }
++
++ $new_type = isset($old[$type]) ? $old[$type] : array();
++ $data_type = isset($data[$type]) ? $data[$type] : array();
++ foreach ($data_type as $id => $settings) {
++ foreach ($settings as $key => $value) {
++ $new_type[$id][$key] = $value;
++ }
++ }
++ $new = array($type => $new_type);
++ $result = $imap->setAnnotation(
++ KOLAB_ANNOT_ROOT . 'activesync',
++ array('value.priv' => base64_encode(json_encode($new))),
++ $this->name
++ );
++
++ if (is_a($result, 'PEAR_Error')) {
++ return $result;
++ }
++ return true;
++ }
+ }
+
+ class HTTP_Request_NonBlocking extends HTTP_Request
diff --git a/kolab-webclient/kolab-webclient.spec b/kolab-webclient/kolab-webclient.spec
index 60f2df8..de24889 100644
--- a/kolab-webclient/kolab-webclient.spec
+++ b/kolab-webclient/kolab-webclient.spec
@@ -8,7 +8,11 @@
%define V_source_version 1.2
%define V_passwd_version 3.0.1
%define V_date %{V_year}-%{V_month}-%{V_day}
+%if "%{with_activesync}" == "no"
%define V_release %{V_year}%{V_month}%{V_day}
+%else
+%define V_release %{V_year}%{V_month}%{V_day}+activesync1
+%endif
# Package Information
Name: %{V_package}
@@ -21,6 +25,9 @@ License: GPL
Group: MAIL
Distribution: OpenPKG
+# package options
+%option with_activesync no
+
# List of Sources
Source0: http://ftp.horde.org/pub/%{V_horde_name}/%{V_horde_name}-%{V_source_version}.tar.gz
Source1: http://ftp.horde.org/pub/passwd/passwd-h3-%{V_passwd_version}.tar.gz
@@ -76,6 +83,7 @@ Source50: webclient-turba_sources.php.template
# List of Patches
Patch0: http://kolab.org/cgi-bin/viewcvs-kolab.cgi/*checkout*/server/patches/horde-webmail/%{V_version}/horde-webmail-%{V_version}_kolab_openpkg.patch
+Patch1: activesync_conf.patch
# Build Info
Prefix: %{l_prefix}
@@ -103,8 +111,12 @@ frontend to the Kolab server. The package is based on Horde.
cd %{V_horde_name}-%{V_source_version}
%patch -p2 -P 0
+%if "%{with_activesync}" == "yes"
+ %patch -p1 -P 1
+%endif
cd ..
+
%build
%install