Enable saving, remove debug stuff, show message if no devices are yet registered
This commit is contained in:
parent
342320f448
commit
ac30e75d9c
4 changed files with 22 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@
|
|||
top: 12px;
|
||||
left: 5px;
|
||||
padding-left: 10px;
|
||||
max-width: 40em;
|
||||
}
|
||||
|
||||
#introtext .pointer-left {
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue