plugins/kolab_activesync
Aleksander Machniak
machniak at kolabsys.com
Tue Apr 9 13:46:16 CEST 2013
plugins/kolab_activesync/kolab_activesync.php | 35 +++++++++++++++++++++--
plugins/kolab_activesync/kolab_activesync_ui.php | 12 +++++++
plugins/kolab_activesync/localization/en_US.inc | 7 ++++
plugins/kolab_activesync/package.xml | 4 +-
4 files changed, 54 insertions(+), 4 deletions(-)
New commits:
commit 2c74dc6037a8ca78e7e1e6c94811b68a440d7cd3
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Tue Apr 9 13:45:41 2013 +0200
Display additional device information from syncroton database
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 at 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>
More information about the commits
mailing list