summaryrefslogtreecommitdiff
path: root/plugins/kolab_zpush
diff options
context:
space:
mode:
authorThomas <thomas@brotherli.ch>2011-09-27 09:14:27 (GMT)
committerThomas <thomas@brotherli.ch>2011-09-27 09:14:27 (GMT)
commitac30e75d9c19f82c75fe35708ff4a56c3900630c (patch)
treea6995e23aea9018262a0903886b92234ede0d5a6 /plugins/kolab_zpush
parent342320f4483aa587693842904ffae4751e479709 (diff)
downloadroundcubemail-plugins-kolab-ac30e75d9c19f82c75fe35708ff4a56c3900630c.tar.gz
Enable saving, remove debug stuff, show message if no devices are yet registered
Diffstat (limited to 'plugins/kolab_zpush')
-rw-r--r--plugins/kolab_zpush/kolab_zpush.js6
-rw-r--r--plugins/kolab_zpush/kolab_zpush.php14
-rw-r--r--plugins/kolab_zpush/skins/default/config.css1
-rw-r--r--plugins/kolab_zpush/skins/default/templates/config.html8
4 files changed, 22 insertions, 7 deletions
diff --git a/plugins/kolab_zpush/kolab_zpush.js b/plugins/kolab_zpush/kolab_zpush.js
index b66b2eb..f1cb0b0 100644
--- a/plugins/kolab_zpush/kolab_zpush.js
+++ b/plugins/kolab_zpush/kolab_zpush.js
@@ -20,7 +20,6 @@ function kolab_zpush_config()
/* constructor */
-
var devicelist = new rcube_list_widget(rcmail.gui_objects.devicelist,
{ multiselect:true, draggable:false, keyboard:true });
devicelist.addEventListener('select', select_device);
@@ -51,6 +50,10 @@ function kolab_zpush_config()
// callback from server after loading device data
function device_data_ready(data)
{
+ // reset form first
+ $('input.alarm:checked').prop('checked', false);
+ $('input.subscription:checked').prop('checked', false).change();
+
if (data.id && data.id == active_device) {
$('#config-device-alias').val(data.devicealias);
$('#config-device-mode').val(data.syncmode);
@@ -101,6 +104,7 @@ function kolab_zpush_config()
{
if (p.success && p.devicename) {
$('#devices-table tr.selected span.devicealias').html(p.devicename);
+ rcmail.env.devices[p.id].ALIAS = p.devicename;
}
}
diff --git a/plugins/kolab_zpush/kolab_zpush.php b/plugins/kolab_zpush/kolab_zpush.php
index ef87c0c..4531ee2 100644
--- a/plugins/kolab_zpush/kolab_zpush.php
+++ b/plugins/kolab_zpush/kolab_zpush.php
@@ -111,7 +111,6 @@ class kolab_zpush extends rcube_plugin
break;
case 'save':
- console($_POST);
$this->init_imap();
$devices = $this->list_devices();
$syncmode = get_input_value('syncmode', RCUBE_INPUT_POST);
@@ -128,11 +127,15 @@ class kolab_zpush extends rcube_plugin
$this->root_meta['DEVICE'][$device_id]['ALIAS'] = $devicealias;
$this->root_meta['FOLDER'][$device_id]['S'] = intval($subsciptions[self::ROOT_MAILBOX]);
-# $err = !$this->rc->imap->set_metadata(self::ROOT_MAILBOX,
-# array(self::ACTIVESYNC_KEY => $this->serialize_metadata($this->root_meta)));
+ $err = !$this->rc->imap->set_metadata(self::ROOT_MAILBOX,
+ array(self::ACTIVESYNC_KEY => $this->serialize_metadata($this->root_meta)));
}
// iterate over folders list and update metadata if necessary
foreach ($this->folders_meta() as $folder => $meta) {
+ // skip root folder (already handled above)
+ if ($folder == self::ROOT_MAILBOX)
+ continue;
+
if ($subsciptions[$folder] != $meta[$device_id]['S']) {
$meta[$device_id]['S'] = intval($subsciptions[$folder]);
$this->folders_meta[$folder] = $meta;
@@ -144,7 +147,7 @@ class kolab_zpush extends rcube_plugin
$metadata = $this->unserialize_metadata($asyncdata);
$metadata['FOLDER'] = $meta;
-# $err |= !$this->rc->imap->set_metadata($folder, array(self::ACTIVESYNC_KEY => $this->serialize_metadata($metadata)));
+ $err |= !$this->rc->imap->set_metadata($folder, array(self::ACTIVESYNC_KEY => $this->serialize_metadata($metadata)));
}
}
@@ -152,7 +155,7 @@ class kolab_zpush extends rcube_plugin
$this->cache->remove('folders');
$this->cache->write('folders', $this->folders_meta);
- $this->rc->output->command('plugin.zpush_save_complete', array('success' => !$err, 'devicename' => Q($devicealias)));
+ $this->rc->output->command('plugin.zpush_save_complete', array('success' => !$err, 'id' => $device_id, 'devicename' => Q($devicealias)));
}
if ($err)
@@ -190,6 +193,7 @@ class kolab_zpush extends rcube_plugin
$this->register_handler('plugin.deviceconfigform', array($this->ui, 'device_config_form'));
$this->register_handler('plugin.foldersubscriptions', array($this->ui, 'folder_subscriptions'));
+ $this->rc->output->set_env('devicecount', count($this->list_devices()));
$this->rc->output->send('kolab_zpush.config');
}
diff --git a/plugins/kolab_zpush/skins/default/config.css b/plugins/kolab_zpush/skins/default/config.css
index 299734b..5809455 100644
--- a/plugins/kolab_zpush/skins/default/config.css
+++ b/plugins/kolab_zpush/skins/default/config.css
@@ -77,6 +77,7 @@
top: 12px;
left: 5px;
padding-left: 10px;
+ max-width: 40em;
}
#introtext .pointer-left {
diff --git a/plugins/kolab_zpush/skins/default/templates/config.html b/plugins/kolab_zpush/skins/default/templates/config.html
index 927684e..421b25d 100644
--- a/plugins/kolab_zpush/skins/default/templates/config.html
+++ b/plugins/kolab_zpush/skins/default/templates/config.html
@@ -43,7 +43,13 @@
</p>
</form>
<div id="introtext">
- <div class="inner"><div class="bordered"><roundcube:label name="kolab_zpush.introtext" /></div></div>
+ <div class="inner"><div class="bordered">
+ <roundcube:if condition="env:devicecount" />
+ <roundcube:label name="kolab_zpush.introtext" />
+ <roundcube:else />
+ <roundcube:label name="kolab_zpush.nodevices" html="true" />
+ <roundcube:endif />
+ </div></div>
<div class="pointer-left"></div>
</div>
</div>