Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117754995
D2173.1775201662.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None
D2173.1775201662.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,6 @@
// 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 per devicetype (lowercase) and folder
+// States can be: 0 => not subscribed, 1 => subscribed, 2 => subscribed with alarm
+$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 (array_key_exists($devicetype, $this->force_subscriptions)) {
+ return array_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 && array_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']);
@@ -210,14 +228,17 @@
}
$table->add_row();
+
+ $disabled = $this->is_protected($folder, $this->device['TYPE']);
+
$table->add('subscription checkbox-cell', $checkbox_sync->show(
!empty($subscribed[$folder]) ? $folder : null,
- array('value' => $folder, 'id' => $folder_id)));
+ array('value' => $folder, 'id' => $folder_id, 'disabled' => $disabled)));
if ($alarms) {
$table->add('alarm checkbox-cell', $checkbox_alarm->show(
intval($subscribed[$folder]) > 1 ? $folder : null,
- array('value' => $folder, 'id' => $folder_id.'_alarm')));
+ array('value' => $folder, 'id' => $folder_id.'_alarm', 'disabled' => $disabled)));
}
$table->add(join(' ', $classes), html::label($folder_id, $foldername));
@@ -258,15 +279,17 @@
}
}
+ $disabled = $this->is_protected($folder_name, $device['TYPE']);
+
$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, array('disabled' => $disabled)));
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, array('disabled' => $disabled)));
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 7:34 AM (15 h, 59 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823036
Default Alt Text
D2173.1775201662.diff (5 KB)
Attached To
Mode
D2173: Support forcing a subscription state
Attached
Detach File
Event Timeline