summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/kolab_addressbook/kolab_addressbook.php19
-rw-r--r--plugins/kolab_addressbook/localization/en_US.inc7
-rw-r--r--plugins/kolab_addressbook/rcube_kolab_contacts.php30
3 files changed, 45 insertions, 11 deletions
diff --git a/plugins/kolab_addressbook/kolab_addressbook.php b/plugins/kolab_addressbook/kolab_addressbook.php
index edf8e1f45..68179c387 100644
--- a/plugins/kolab_addressbook/kolab_addressbook.php
+++ b/plugins/kolab_addressbook/kolab_addressbook.php
@@ -116,12 +116,16 @@ class kolab_addressbook extends rcube_plugin
*/
public function contact_form($p)
{
+ // none of our business
+ if (!is_a($GLOBALS['CONTACTS'], 'rcube_kolab_contacts'))
+ return $p;
+
// extend the list of contact fields to be displayed in the 'info' section
if (is_array($p['form']['info'])) {
$p['form']['info']['content']['initials'] = array('size' => 6);
- $p['form']['info']['content']['anniversary'] = array('size' => 12, 'render_func' => 'rcmail_format_date_col');
-
- // TODO: add more Kolab-specific fields
+ $p['form']['info']['content']['officelocation'] = array('size' => 40);
+ $p['form']['info']['content']['profession'] = array('size' => 40);
+ $p['form']['info']['content']['children'] = array('size' => 40);
// re-order fields according to the coltypes list
$block = array();
@@ -132,6 +136,15 @@ class kolab_addressbook extends rcube_plugin
}
$p['form']['info']['content'] = $block;
+
+ // define a separate section 'settings'
+ $p['form']['settings'] = array(
+ 'name' => rcube_label('kolab_addressbook.settings'),
+ 'content' => array(
+ 'pgppublickey' => array('size' => 40, 'visible' => true),
+ 'freebusyurl' => array('size' => 40, 'visible' => true),
+ )
+ );
}
return $p;
diff --git a/plugins/kolab_addressbook/localization/en_US.inc b/plugins/kolab_addressbook/localization/en_US.inc
index d22318b04..968d9e691 100644
--- a/plugins/kolab_addressbook/localization/en_US.inc
+++ b/plugins/kolab_addressbook/localization/en_US.inc
@@ -2,6 +2,11 @@
$labels = array();
$labels['initials'] = 'Initials';
-$labels['anniversary'] = 'Anniversary';
+$labels['profession'] = 'Profession';
+$labels['officelocation'] = 'Office location';
+$labels['children'] = 'Children';
+$labels['pgppublickey'] = 'PGP publickey';
+$labels['freebusyurl'] = 'Free-busy URL';
+$labels['settings'] = 'Settings';
?> \ No newline at end of file
diff --git a/plugins/kolab_addressbook/rcube_kolab_contacts.php b/plugins/kolab_addressbook/rcube_kolab_contacts.php
index 37cf6ebfd..8eb1f7856 100644
--- a/plugins/kolab_addressbook/rcube_kolab_contacts.php
+++ b/plugins/kolab_addressbook/rcube_kolab_contacts.php
@@ -30,14 +30,22 @@ class rcube_kolab_contacts extends rcube_addressbook
'initials' => array('type' => 'text', 'size' => 6, 'limit' => 1, 'label' => 'kolab_addressbook.initials'),
'email' => array('subtypes' => null),
'phone' => array(),
- 'im' => array('limit' => 1),
+ 'im' => array('limit' => 1, 'subtypes' => null),
'website' => array('limit' => 1, 'subtypes' => null),
'address' => array('limit' => 2, 'subtypes' => array('home','business')),
'birthday' => array('limit' => 1),
- 'anniversary' => array('type' => 'date', 'size' => 12, 'limit' => 1, 'label' => 'kolab_addressbook.anniversary'),
- // TODO: define more Kolab-specific fields such as: office-location, profession, manager-name, assistant, spouse-name, children, language, latitude, longitude, pgp-publickey, free-busy-url
+ 'anniversary' => array('limit' => 1),
+ 'officelocation' => array('type' => 'text', 'size' => 40, 'limit' => 1, 'label' => 'kolab_addressbook.officelocation'),
+ 'profession' => array('type' => 'text', 'size' => 40, 'limit' => 1, 'label' => 'kolab_addressbook.profession'),
+ 'manager' => array('limit' => 1),
+ 'assistant' => array('limit' => 1),
+ 'spouse' => array('limit' => 1),
+ 'children' => array('type' => 'text', 'size' => 40, 'limit' => 1, 'label' => 'kolab_addressbook.children'),
+ 'pgppublickey' => array('type' => 'text', 'size' => 40, 'limit' => 1, 'label' => 'kolab_addressbook.pgppublickey'),
+ 'freebusyurl' => array('type' => 'text', 'size' => 40, 'limit' => 1, 'label' => 'kolab_addressbook.freebusyurl'),
'notes' => array(),
'photo' => array(),
+ // TODO: define more Kolab-specific fields such as: language, latitude, longitude
);
private $gid;
@@ -71,9 +79,17 @@ class rcube_kolab_contacts extends rcube_addressbook
'initials' => 'initials',
'birthday' => 'birthday',
'anniversary' => 'anniversary',
- 'im-address' => 'im:aim',
+ 'im-address' => 'im',
'web-page' => 'website',
+ 'office-location' => 'officelocation',
+ 'profession' => 'profession',
+ 'manager-name' => 'manager',
+ 'assistant' => 'assistant',
+ 'spouse-name' => 'spouse',
+ 'children' => 'children',
'body' => 'notes',
+ 'pgp-publickey' => 'pgppublickey',
+ 'free-busy-url' => 'freebusyurl',
);
@@ -783,8 +799,8 @@ class rcube_kolab_contacts extends rcube_addressbook
foreach (array_flip($this->fieldmap) as $rcube => $kolab) {
if (isset($contact[$rcube]))
$object[$kolab] = is_array($contact[$rcube]) ? $contact[$rcube][0] : $contact[$rcube];
- else if ($rcube .= ':home' && isset($contact[$rcube]))
- $object[$kolab] = is_array($contact[$rcube]) ? $contact[$rcube][0] : $contact[$rcube];
+ else if ($values = $this->get_col_values($rcube, $contact, true))
+ $object[$kolab] = is_array($values) ? $values[0] : $values;
}
// format dates
@@ -849,7 +865,7 @@ class rcube_kolab_contacts extends rcube_addressbook
$attkey = 'photo.attachment';
$object['_attachments'][$attkey] = array(
'type' => rc_image_content_type($contact['photo']),
- 'content' => $contact['photo'],
+ 'content' => preg_match('![^a-z0-9/=+-]!i', $contact['photo']) ? $contact['photo'] : base64_decode($contact['photo']),
);
$object['picture'] = $attkey;
}