Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117751501
D2173.1775185942.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
6 KB
Referenced Files
None
Subscribers
None
D2173.1775185942.diff
View Options
diff --git a/plugins/kolab_activesync/config.inc.php.dist b/plugins/kolab_activesync/config.inc.php.dist
--- a/plugins/kolab_activesync/config.inc.php.dist
+++ b/plugins/kolab_activesync/config.inc.php.dist
@@ -2,3 +2,5 @@
// The page with Activesync clients configuration manual
$config['activesync_setup_url'] = 'https://kb.kolabenterprise.com/documentation/setting-up-an-activesync-client';
+// Force a subscription state for per devicetype and per folder
+$config['activesync_force_subscriptions'] = array('windowsoutlook15' => array('INBOX' => 1, 'Sent' => 1, 'Trash' => 1));
diff --git a/plugins/kolab_activesync/kolab_activesync.js b/plugins/kolab_activesync/kolab_activesync.js
--- a/plugins/kolab_activesync/kolab_activesync.js
+++ b/plugins/kolab_activesync/kolab_activesync.js
@@ -65,7 +65,7 @@
var fn = function(elem) {
var classname = elem.className.split(' ')[0],
- list = $(elem).closest('table').find('input.' + classname),
+ list = $(elem).closest('table').find('input.' + classname).not('[disabled]'),
check = list.not(':checked').length > 0;
list.prop('checked', check).change();
diff --git a/plugins/kolab_activesync/kolab_activesync_ui.php b/plugins/kolab_activesync/kolab_activesync_ui.php
--- a/plugins/kolab_activesync/kolab_activesync_ui.php
+++ b/plugins/kolab_activesync/kolab_activesync_ui.php
@@ -27,6 +27,7 @@
{
private $rc;
private $plugin;
+ private $force_subscriptions = array();
public $device = array();
const SETUP_URL = 'https://kb.kolabenterprise.com/documentation/setting-up-an-activesync-client';
@@ -39,6 +40,9 @@
$skin_path = $this->plugin->local_skin_path() . '/';
$this->skin_path = 'plugins/kolab_activesync/' . $skin_path;
+ $this->plugin->load_config();
+ $this->force_subscriptions = $this->rc->config->get('activesync_force_subscriptions', array());
+
$this->plugin->include_stylesheet($skin_path . 'config.css');
}
@@ -94,6 +98,15 @@
}
+ private function is_protected($folder, $devicetype)
+ {
+ $devicetype = strtolower($devicetype);
+ if (key_exists($devicetype, $this->force_subscriptions)) {
+ return key_exists($folder, $this->force_subscriptions[$devicetype]);
+ }
+ return false;
+ }
+
public function folder_subscriptions($attrib = array())
{
if (!$attrib['id']) {
@@ -111,6 +124,9 @@
$folder_meta = $this->plugin->folder_meta();
}
+ $devicetype = strtolower($this->device['TYPE']);
+ $device_force_subscriptions = $this->force_subscriptions[$devicetype];
+
foreach ($this->plugin->list_folders() as $folder) {
if ($folder_types[$folder]) {
list($type, ) = explode('.', $folder_types[$folder]);
@@ -122,7 +138,9 @@
if (is_array($folder_groups[$type])) {
$folder_groups[$type][] = $folder;
- if (!empty($folder_meta) && ($meta = $folder_meta[$folder])
+ if ($device_force_subscriptions && key_exists($folder, $device_force_subscriptions)) {
+ $subscribed[$folder] = intval($device_force_subscriptions[$folder]);
+ } else if (!empty($folder_meta) && ($meta = $folder_meta[$folder])
&& $meta['FOLDER'] && $meta['FOLDER'][$imei]['S']
) {
$subscribed[$folder] = intval($meta['FOLDER'][$imei]['S']);
@@ -180,9 +198,6 @@
$table->add_header('foldername', $this->plugin->gettext('folder'));
- $checkbox_sync = new html_checkbox(array('name' => 'subscribed[]', 'class' => 'subscription'));
- $checkbox_alarm = new html_checkbox(array('name' => 'alarm[]', 'class' => 'alarm'));
-
$names = array();
foreach ($a_folders as $folder) {
$foldername = $origname = kolab_storage::object_prettyname($folder);
@@ -210,14 +225,29 @@
}
$table->add_row();
+
+ $extra_attributes = array();
+ if ($this->is_protected($folder, $this->device['TYPE'])) {
+ $extra_attributes['disabled'] = 'true';
+ }
+
+ // Need to be recreated to reset past attributes
+ $checkbox_sync = new html_checkbox(array('name' => 'subscribed[]', 'class' => 'subscription'));
+ $checkbox_alarm = new html_checkbox(array('name' => 'alarm[]', 'class' => 'alarm'));
$table->add('subscription checkbox-cell', $checkbox_sync->show(
!empty($subscribed[$folder]) ? $folder : null,
- array('value' => $folder, 'id' => $folder_id)));
+ array_merge(
+ array('value' => $folder, 'id' => $folder_id),
+ $extra_attributes
+ )));
if ($alarms) {
$table->add('alarm checkbox-cell', $checkbox_alarm->show(
intval($subscribed[$folder]) > 1 ? $folder : null,
- array('value' => $folder, 'id' => $folder_id.'_alarm')));
+ array_merge(
+ array('value' => $folder, 'id' => $folder_id.'_alarm'),
+ $extra_attributes
+ )));
}
$table->add(join(' ', $classes), html::label($folder_id, $foldername));
@@ -258,15 +288,20 @@
}
}
+ $extra_attributes = array();
+ if ($this->is_protected($folder_name, $device['TYPE'])) {
+ $extra_attributes['disabled'] = 'true';
+ }
+
$table->add_row();
$table->add(array('class' => 'device', 'title' => $title), $name);
- $table->add('subscription checkbox-cell', $checkbox->show(!empty($folder_data[$id]['S']) ? 1 : 0));
+ $table->add('subscription checkbox-cell', $checkbox->show(!empty($folder_data[$id]['S']) ? 1 : 0, $extra_attributes));
if ($alarms) {
$checkbox_alarm = new html_checkbox(array('name' => "_alarms[$id]", 'value' => 1,
'onchange' => 'return activesync_object.update_sync_data(this)'));
- $table->add('alarm checkbox-cell', $checkbox_alarm->show($folder_data[$id]['S'] > 1 ? 1 : 0));
+ $table->add('alarm checkbox-cell', $checkbox_alarm->show($folder_data[$id]['S'] > 1 ? 1 : 0, $extra_attributes));
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 3:12 AM (9 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18822355
Default Alt Text
D2173.1775185942.diff (6 KB)
Attached To
Mode
D2173: Support forcing a subscription state
Attached
Detach File
Event Timeline