diff options
author | Thomas <thomas@brotherli.ch> | 2011-09-28 10:51:55 (GMT) |
---|---|---|
committer | Thomas <thomas@brotherli.ch> | 2011-09-28 10:51:55 (GMT) |
commit | 5c054b10941c6494b6a84852486540c8a1e466cd (patch) | |
tree | 79785ea2f5716fa04ac26b88e3e9eeab51940889 /plugins/kolab_zpush | |
parent | e23fead4c49bd793b82b5e098741fa2f39c8efb6 (diff) | |
download | roundcubemail-plugins-kolab-5c054b10941c6494b6a84852486540c8a1e466cd.tar.gz |
Add laxpic settings + some code cleanup
Diffstat (limited to 'plugins/kolab_zpush')
-rw-r--r-- | plugins/kolab_zpush/kolab_zpush.js | 10 | ||||
-rw-r--r-- | plugins/kolab_zpush/kolab_zpush.php | 46 | ||||
-rw-r--r-- | plugins/kolab_zpush/kolab_zpush_ui.php | 5 | ||||
-rw-r--r-- | plugins/kolab_zpush/localization/de_CH.inc | 5 | ||||
-rw-r--r-- | plugins/kolab_zpush/localization/en_US.inc | 6 | ||||
-rw-r--r-- | plugins/kolab_zpush/skins/default/config.css | 2 |
6 files changed, 46 insertions, 28 deletions
diff --git a/plugins/kolab_zpush/kolab_zpush.js b/plugins/kolab_zpush/kolab_zpush.js index f1cb0b0..f820c70 100644 --- a/plugins/kolab_zpush/kolab_zpush.js +++ b/plugins/kolab_zpush/kolab_zpush.js @@ -57,6 +57,7 @@ function kolab_zpush_config() if (data.id && data.id == active_device) { $('#config-device-alias').val(data.devicealias); $('#config-device-mode').val(data.syncmode); + $('#config-device-laxpic').prop('checked', data.laxpic ? true : false); $('input.subscription').each(function(i, elem){ var key = elem.value; @@ -83,7 +84,8 @@ function kolab_zpush_config() cmd: 'save', id: active_device, devicealias: $('#config-device-alias').val(), - syncmode: $('#config-device-mode option:selected').val() + syncmode: $('#config-device-mode option:selected').val(), + laxpic: $('#config-device-laxpic').get(0).checked ? 1 : 0 }; data.subscribed = {}; @@ -102,9 +104,9 @@ function kolab_zpush_config() // callback function when saving has completed function save_complete(p) { - if (p.success && p.devicename) { - $('#devices-table tr.selected span.devicealias').html(p.devicename); - rcmail.env.devices[p.id].ALIAS = p.devicename; + if (p.success && p.devicealias) { + $('#devices-table tr.selected span.devicealias').html(p.devicealias); + rcmail.env.devices[p.id].ALIAS = p.devicealias; } } diff --git a/plugins/kolab_zpush/kolab_zpush.php b/plugins/kolab_zpush/kolab_zpush.php index 4531ee2..619158e 100644 --- a/plugins/kolab_zpush/kolab_zpush.php +++ b/plugins/kolab_zpush/kolab_zpush.php @@ -84,23 +84,23 @@ class kolab_zpush extends rcube_plugin public function json_command() { $cmd = get_input_value('cmd', RCUBE_INPUT_GPC); - $device_id = get_input_value('id', RCUBE_INPUT_GPC); + $imei = get_input_value('id', RCUBE_INPUT_GPC); switch ($cmd) { case 'load': $result = array(); $this->init_imap(); $devices = $this->list_devices(); - if ($device = $devices[$device_id]) { - $result['id'] = $device_id; + if ($device = $devices[$imei]) { + $result['id'] = $imei; $result['devicealias'] = $device['ALIAS']; $result['syncmode'] = intval($device['MODE']); $result['laxpic'] = intval($device['LAXPIC']); $result['subscribed'] = array(); foreach ($this->folders_meta() as $folder => $meta) { - if ($meta[$device_id]['S']) - $result['subscribed'][$folder] = intval($meta[$device_id]['S']); + if ($meta[$imei]['S']) + $result['subscribed'][$folder] = intval($meta[$imei]['S']); } $this->rc->output->command('plugin.zpush_data_ready', $result); @@ -113,22 +113,31 @@ class kolab_zpush extends rcube_plugin case 'save': $this->init_imap(); $devices = $this->list_devices(); - $syncmode = get_input_value('syncmode', RCUBE_INPUT_POST); + $syncmode = intval(get_input_value('syncmode', RCUBE_INPUT_POST)); $devicealias = get_input_value('devicealias', RCUBE_INPUT_POST); + $laxpic = intval(get_input_value('laxpic', RCUBE_INPUT_POST)); $subsciptions = get_input_value('subscribed', RCUBE_INPUT_POST); $err = false; - if ($device = $devices[$device_id]) { + if ($device = $devices[$imei]) { // update device config if changed - if ($devicealias != $this->root_meta['DEVICE'][$device_id]['ALIAS'] || - $syncmode != $this->root_meta['DEVICE'][$device_id]['MODE'] || - $subsciptions[self::ROOT_MAILBOX] != $this->root_meta['FOLDER'][$device_id]['S']) { - $this->root_meta['DEVICE'][$device_id]['MODE'] = $syncmode; - $this->root_meta['DEVICE'][$device_id]['ALIAS'] = $devicealias; - $this->root_meta['FOLDER'][$device_id]['S'] = intval($subsciptions[self::ROOT_MAILBOX]); + if ($devicealias != $this->root_meta['DEVICE'][$imei]['ALIAS'] || + $syncmode != $this->root_meta['DEVICE'][$imei]['MODE'] || + $laxpic != $this->root_meta['DEVICE'][$imei]['LAXPIC'] || + $subsciptions[self::ROOT_MAILBOX] != $this->root_meta['FOLDER'][$imei]['S']) { + $this->root_meta['DEVICE'][$imei]['MODE'] = $syncmode; + $this->root_meta['DEVICE'][$imei]['ALIAS'] = $devicealias; + $this->root_meta['DEVICE'][$imei]['LAXPIC'] = $laxpic; + $this->root_meta['FOLDER'][$imei]['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))); + + // update cached meta data + if (!$err) { + $this->cache->remove('devicemeta'); + $this->cache->write('devicemeta', $this->rc->imap->get_metadata(self::ROOT_MAILBOX, self::ACTIVESYNC_KEY)); + } } // iterate over folders list and update metadata if necessary foreach ($this->folders_meta() as $folder => $meta) { @@ -136,8 +145,8 @@ class kolab_zpush extends rcube_plugin if ($folder == self::ROOT_MAILBOX) continue; - if ($subsciptions[$folder] != $meta[$device_id]['S']) { - $meta[$device_id]['S'] = intval($subsciptions[$folder]); + if ($subsciptions[$folder] != $meta[$imei]['S']) { + $meta[$imei]['S'] = intval($subsciptions[$folder]); $this->folders_meta[$folder] = $meta; unset($meta['TYPE']); @@ -155,7 +164,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, 'id' => $device_id, 'devicename' => Q($devicealias))); + $this->rc->output->command('plugin.zpush_save_complete', array('success' => !$err, 'id' => $imei, 'devicealias' => Q($devicealias))); } if ($err) @@ -180,10 +189,7 @@ class kolab_zpush extends rcube_plugin $this->init_imap(); // checks if IMAP server supports any of METADATA, ANNOTATEMORE, ANNOTATEMORE2 - if ($this->rc->imap->get_capability('METADATA') || $this->rc->imap->get_capability('ANNOTATEMORE') || $this->rc->imap->get_capability('ANNOTATEMORE2')) { - $this->list_devices(); - } - else { + if (!($this->rc->imap->get_capability('METADATA') || $this->rc->imap->get_capability('ANNOTATEMORE') || $this->rc->imap->get_capability('ANNOTATEMORE2'))) { $this->rc->output->show_message($this->gettext('notsupported'), 'error'); } diff --git a/plugins/kolab_zpush/kolab_zpush_ui.php b/plugins/kolab_zpush/kolab_zpush_ui.php index cd167e0..75c712f 100644 --- a/plugins/kolab_zpush/kolab_zpush_ui.php +++ b/plugins/kolab_zpush/kolab_zpush_ui.php @@ -74,6 +74,11 @@ class kolab_zpush_ui $select->add(array($this->config->gettext('modeauto'), $this->config->gettext('modeflat'), $this->config->gettext('modefolder')), array('-1', '0', '1')); $table->add('title', html::label($field_id, $this->config->gettext('syncmode'))); $table->add(null, $select->show('-1')); + + $field_id = 'config-device-laxpic'; + $checkbox = new html_checkbox(array('name' => 'laxpic', 'value' => '1', 'id' => $field_id)); + $table->add('title', $this->config->gettext('imageformat')); + $table->add(null, html::label($field_id, $checkbox->show() . ' ' . $this->config->gettext('laxpiclabel'))); return $table->show($attrib); } diff --git a/plugins/kolab_zpush/localization/de_CH.inc b/plugins/kolab_zpush/localization/de_CH.inc index 00d752b..195f2a0 100644 --- a/plugins/kolab_zpush/localization/de_CH.inc +++ b/plugins/kolab_zpush/localization/de_CH.inc @@ -12,9 +12,12 @@ $labels['synchronize'] = 'Synchronisieren'; $labels['withalarms'] = 'Mit Erinnerungen'; $labels['syncsettings'] = 'Synchronisationseinstellungen'; $labels['deviceconfig'] = 'Gerätekonfiguration'; -$labels['folderstosync'] = 'Order zum Symchronisieren'; +$labels['folderstosync'] = 'Order zum Synchronisieren'; $labels['deletedevice'] = 'Gerät löschen'; +$labels['imageformat'] = 'Bildformat'; +$labels['laxpiclabel'] = 'Erlaube PNG- und GIF-Bilder'; $labels['introtext'] = 'Wählen Sie das zu konfigurierende Gerät aus'; +$labels['nodevices'] = 'Es sind noch keine Geräte registriert.<br/><br/>Um ein neues Gerät anzumelden, verbinden Sie dieses zuerst mit dem Server. Eine Anleitung dazu finden Sie im <a href="http://wiki.kolab.org/Z_push#Clients">Wiki</a>. Anschliessend laden Sie diese Seite neu und das Gerät wird hier aufgelistet.'; $labels['savingdata'] = 'Daten werden gespeichert...'; $labels['savingerror'] = 'Fehler beim Speichern'; $labels['notsupported'] = 'Ihr Server unterstützt keine Activesync-Konfiguration'; diff --git a/plugins/kolab_zpush/localization/en_US.inc b/plugins/kolab_zpush/localization/en_US.inc index 74d360c..d8e12db 100644 --- a/plugins/kolab_zpush/localization/en_US.inc +++ b/plugins/kolab_zpush/localization/en_US.inc @@ -3,7 +3,7 @@ $labels = array(); $labels['tabtitle'] = 'Activesync'; $labels['devices'] = 'Devices'; -$labels['devicealias'] = 'Device Name'; +$labels['devicealias'] = 'Device name'; $labels['syncmode'] = 'Sync Mode'; $labels['modeauto'] = 'Determine automatically'; $labels['modeflat'] = 'Force flat mode'; @@ -13,7 +13,9 @@ $labels['withalarms'] = 'With alarms'; $labels['syncsettings'] = 'Synchronization settings'; $labels['deviceconfig'] = 'Device configration'; $labels['folderstosync'] = 'Folders to synchronize'; -$labels['deletedevice'] = 'Delete Device'; +$labels['deletedevice'] = 'Delete device'; +$labels['imageformat'] = 'Image format'; +$labels['laxpiclabel'] = 'Allow PNG and GIF images'; $labels['introtext'] = 'Select a device to configure'; $labels['nodevices'] = 'There are currently no devices registered.<br/><br/>In order to register a device, please connect it to the server first, using <a href="http://wiki.kolab.org/Z_push#Clients">the instructions in the Wiki</a>. Afterwards the device should become available for configuration here.'; $labels['savingdata'] = 'Saving data...'; diff --git a/plugins/kolab_zpush/skins/default/config.css b/plugins/kolab_zpush/skins/default/config.css index 5809455..8385777 100644 --- a/plugins/kolab_zpush/skins/default/config.css +++ b/plugins/kolab_zpush/skins/default/config.css @@ -37,7 +37,7 @@ #foldersubscriptions td.mailbox { padding-right: 3em; - padding-left: 25px; + padding-left: 30px; min-width: 12em; background: url(foldertypes.png) 2px 2px no-repeat; } |