summaryrefslogtreecommitdiff
path: root/plugins/kolab_zpush
diff options
context:
space:
mode:
authorThomas <thomas@brotherli.ch>2011-11-18 09:42:53 (GMT)
committerThomas <thomas@brotherli.ch>2011-11-18 09:42:53 (GMT)
commitf007d019831a5b53f49bf63f04eb4efd90dbeea1 (patch)
treec05c7b45c94a6e792594d152f65a0ab7060d48d0 /plugins/kolab_zpush
parenta2f70e2dc09f1b444d3b793eb4beceb04ae08bfa (diff)
downloadroundcubemail-plugins-kolab-f007d019831a5b53f49bf63f04eb4efd90dbeea1.tar.gz
Improve config UI as suggested in #474 and #475
Diffstat (limited to 'plugins/kolab_zpush')
-rw-r--r--plugins/kolab_zpush/kolab_zpush.js13
-rw-r--r--plugins/kolab_zpush/kolab_zpush_ui.php47
2 files changed, 12 insertions, 48 deletions
diff --git a/plugins/kolab_zpush/kolab_zpush.js b/plugins/kolab_zpush/kolab_zpush.js
index 76c89f4..1605fcd 100644
--- a/plugins/kolab_zpush/kolab_zpush.js
+++ b/plugins/kolab_zpush/kolab_zpush.js
@@ -39,9 +39,18 @@ function kolab_zpush_config()
rcmail.addEventListener('plugin.zpush_data_ready', device_data_ready);
rcmail.addEventListener('plugin.zpush_save_complete', save_complete);
- $('input.subscription').change(function(e){ $('#'+this.id+'_alarm').prop('disabled', !this.checked); });
+ $('input.alarm').change(function(e){ if (this.checked) $('#'+this.id.replace(/_alarm/, '')).prop('checked', this.checked); });
+ $('input.subscription').change(function(e){ if (!this.checked) $('#'+this.id+'_alarm').prop('checked', false); });
$(window).bind('resize', resize_ui);
-
+
+ $('.subscriptionblock thead td.subscription img, .subscriptionblock thead td.alarm img').click(function(e){
+ var $this = $(this);
+ var classname = $this.parent().get(0).className;
+ var check = !($this.data('checked') || false);
+ $this.css('cursor', 'pointer').data('checked', check)
+ .closest('table').find('input.'+classname).prop('checked', check).change();
+ });
+
// select the one and only device from list
if (rcmail.env.devicecount == 1) {
for (var imei in rcmail.env.devices)
diff --git a/plugins/kolab_zpush/kolab_zpush_ui.php b/plugins/kolab_zpush/kolab_zpush_ui.php
index 1536f0a..4abf309 100644
--- a/plugins/kolab_zpush/kolab_zpush_ui.php
+++ b/plugins/kolab_zpush/kolab_zpush_ui.php
@@ -125,7 +125,7 @@ class kolab_zpush_ui
$table->add_header('foldername', $this->config->gettext('folder'));
$checkbox_sync = new html_checkbox(array('name' => 'subscribed[]', 'class' => 'subscription'));
- $checkbox_alarm = new html_checkbox(array('name' => 'alarm[]', 'class' => 'alarm', 'disabled' => true));
+ $checkbox_alarm = new html_checkbox(array('name' => 'alarm[]', 'class' => 'alarm'));
$names = array();
foreach ($a_folders as $folder) {
@@ -168,49 +168,4 @@ class kolab_zpush_ui
return $table->show();
}
- /**
- * Recursively compose folders table
- */
- private function render_folders($a_folders, $table, $level = 0)
- {
- $idx = 0;
- $checkbox_sync = new html_checkbox(array('name' => 'subscribed[]', 'class' => 'subscription'));
- $checkbox_alarm = new html_checkbox(array('name' => 'alarm[]', 'class' => 'alarm', 'disabled' => true));
- $folders_meta = $this->config->folders_meta();
-
- foreach ($a_folders as $key => $folder) {
- $classes = array('mailbox');
-
- if ($folder_class = rcmail_folder_classname($folder['id'])) {
- $foldername = rcube_label($folder_class);
- $classes[] = $folder_class;
- }
- else
- $foldername = $folder['name'];
-
- // visualize folder type
- if ($type = $folders_meta[$folder['id']]['TYPE'])
- $classes[] = $type;
-
- if ($folder['virtual'])
- $classes[] = 'virtual';
-
- $folder_id = 'rcmf' . html_identifier($folder['id']);
- $padding = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level);
-
- $table->add_row(array('class' => (($level+1) * $idx++) % 2 == 0 ? 'even' : 'odd'));
- $table->add(join(' ', $classes), html::label($folder_id, $padding . Q($foldername)));
- $table->add('subscription', $folder['virtual'] ? '' : $checkbox_sync->show('', array('value' => $folder['id'], 'id' => $folder_id)));
-
- if (($type == 'event' || $type == 'task') && !$folder['virtual'])
- $table->add('alarm', $checkbox_alarm->show('', array('value' => $folder['id'], 'id' => $folder_id.'_alarm')));
- else
- $table->add('alarm', '');
-
- if (!empty($folder['folders']))
- $this->render_folders($folder['folders'], $table, $level+1);
- }
-
- }
-
}