summaryrefslogtreecommitdiff
path: root/plugins/kolab_activesync
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2013-04-09 11:45:41 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2013-04-09 11:45:41 (GMT)
commit2c74dc6037a8ca78e7e1e6c94811b68a440d7cd3 (patch)
treeea79e8685ba0e20f90031968e2a67d2d46c667de /plugins/kolab_activesync
parent1df25c1984927cdc5e7c04871de5a9d947d2b76b (diff)
downloadroundcubemail-plugins-kolab-2c74dc6037a8ca78e7e1e6c94811b68a440d7cd3.tar.gz
Display additional device information from syncroton database
Diffstat (limited to 'plugins/kolab_activesync')
-rw-r--r--plugins/kolab_activesync/kolab_activesync.php35
-rw-r--r--plugins/kolab_activesync/kolab_activesync_ui.php12
-rw-r--r--plugins/kolab_activesync/localization/en_US.inc7
-rw-r--r--plugins/kolab_activesync/package.xml4
4 files changed, 54 insertions, 4 deletions
diff --git a/plugins/kolab_activesync/kolab_activesync.php b/plugins/kolab_activesync/kolab_activesync.php
index 0238f11..19604af 100644
--- a/plugins/kolab_activesync/kolab_activesync.php
+++ b/plugins/kolab_activesync/kolab_activesync.php
@@ -330,7 +330,14 @@ class kolab_activesync extends rcube_plugin
self::ASYNC_KEY => $this->serialize_metadata($metadata)));
}
-
+ /**
+ * Device update
+ *
+ * @param array $device Device data
+ * @param string $id Device ID
+ *
+ * @return bool True on success, False on failure
+ */
public function device_update($device, $id)
{
$devices_list = $this->list_devices();
@@ -362,7 +369,6 @@ class kolab_activesync extends rcube_plugin
return $result;
}
-
/**
* Device delete.
*
@@ -427,6 +433,31 @@ class kolab_activesync extends rcube_plugin
return $result;
}
+ /**
+ * Device information (from syncroton database)
+ *
+ * @param string $id Device ID
+ *
+ * @return array Device data
+ */
+ public function device_info($id)
+ {
+ $db = $this->rc->get_dbh();
+ $table = $db->table_name('syncroton_device');
+
+ if (in_array($table, $db->list_tables())) {
+ $fields = array('devicetype', 'acsversion', 'useragent', 'friendlyname', 'os',
+ 'oslanguage', 'phonenumber');
+
+ $result = $db->query("SELECT " . $db->array2list($fields, 'ident')
+ . " FROM $table WHERE owner_id = ? AND id = ?",
+ $this->rc->user->ID, $id);
+
+ if ($result && ($sql_arr = $db->fetch_assoc($result))) {
+ return $sql_arr;
+ }
+ }
+ }
/**
* Helper method to decode saved IMAP metadata
diff --git a/plugins/kolab_activesync/kolab_activesync_ui.php b/plugins/kolab_activesync/kolab_activesync_ui.php
index a191255..6e796cc 100644
--- a/plugins/kolab_activesync/kolab_activesync_ui.php
+++ b/plugins/kolab_activesync/kolab_activesync_ui.php
@@ -80,6 +80,18 @@ class kolab_activesync_ui
$table->add('title', $this->plugin->gettext('imageformat'));
$table->add(null, html::label($field_id, $checkbox->show() . ' ' . $this->plugin->gettext('laxpiclabel')));
*/
+ // read-only device information
+ $info = $this->plugin->device_info($this->device['ID']);
+
+ if (!empty($info)) {
+ foreach ($info as $key => $value) {
+ if ($value) {
+ $table->add('title', Q($this->plugin->gettext($key)));
+ $table->add(null, Q($value));
+ }
+ }
+ }
+
if ($attrib['form']) {
$this->rc->output->add_gui_object('editform', $attrib['form']);
}
diff --git a/plugins/kolab_activesync/localization/en_US.inc b/plugins/kolab_activesync/localization/en_US.inc
index 2399b13..8f94a51 100644
--- a/plugins/kolab_activesync/localization/en_US.inc
+++ b/plugins/kolab_activesync/localization/en_US.inc
@@ -29,5 +29,12 @@ $labels['notsupported'] = 'Your server does not support metadata/annotations';
$labels['devicedeleteconfirm'] = 'Do you really want to delete the configuration for this device?';
$labels['successfullydeleted'] = 'The device configuration was successfully removed';
$labels['devicenotfound'] = 'Unable to read device configuration';
+$labels['devicetype'] = 'Device type';
+$labels['acsversion'] = 'Protocol version';
+$labels['useragent'] = 'User agent';
+$labels['friendlyname'] = 'Friendly name';
+$labels['os'] = 'Operating system';
+$labels['oslanguage'] = 'OS language';
+$labels['phonenumber'] = 'Phone number';
?>
diff --git a/plugins/kolab_activesync/package.xml b/plugins/kolab_activesync/package.xml
index 09e8d66..dfdd3e3 100644
--- a/plugins/kolab_activesync/package.xml
+++ b/plugins/kolab_activesync/package.xml
@@ -19,9 +19,9 @@
<email>bruederli@kolabsys.com</email>
<active>yes</active>
</lead>
- <date>2012-08-29</date>
+ <date>2013-04-09</date>
<version>
- <release>0.9</release>
+ <release>1.0</release>
<api>1.0</api>
</version>
<stability>