Store PGP public key in contact; remove unsupported field definitions from old format
This commit is contained in:
parent
8af6b9eec3
commit
ef550eaec4
3 changed files with 24 additions and 12 deletions
|
@ -289,12 +289,10 @@ class kolab_addressbook extends rcube_plugin
|
||||||
|
|
||||||
// extend the list of contact fields to be displayed in the 'personal' section
|
// extend the list of contact fields to be displayed in the 'personal' section
|
||||||
if (is_array($p['form']['personal'])) {
|
if (is_array($p['form']['personal'])) {
|
||||||
$p['form']['contact']['content']['officelocation'] = array('size' => 40);
|
|
||||||
$p['form']['personal']['content']['initials'] = array('size' => 6);
|
|
||||||
$p['form']['personal']['content']['profession'] = array('size' => 40);
|
$p['form']['personal']['content']['profession'] = array('size' => 40);
|
||||||
$p['form']['personal']['content']['children'] = array('size' => 40);
|
$p['form']['personal']['content']['children'] = array('size' => 40);
|
||||||
$p['form']['personal']['content']['pgppublickey'] = array('size' => 40);
|
|
||||||
$p['form']['personal']['content']['freebusyurl'] = array('size' => 40);
|
$p['form']['personal']['content']['freebusyurl'] = array('size' => 40);
|
||||||
|
$p['form']['personal']['content']['pgppublickey'] = array('size' => 40);
|
||||||
|
|
||||||
// re-order fields according to the coltypes list
|
// re-order fields according to the coltypes list
|
||||||
$p['form']['contact']['content'] = $this->_sort_form_fields($p['form']['contact']['content']);
|
$p['form']['contact']['content'] = $this->_sort_form_fields($p['form']['contact']['content']);
|
||||||
|
|
|
@ -46,14 +46,10 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
'department' => array('limit' => 1),
|
'department' => array('limit' => 1),
|
||||||
'email' => array('subtypes' => null),
|
'email' => array('subtypes' => null),
|
||||||
'phone' => array(),
|
'phone' => array(),
|
||||||
'address' => array('subtypes' => array('home','work')),
|
'address' => array('subtypes' => array('home','work','office')),
|
||||||
// 'officelocation' => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1,
|
|
||||||
// 'label' => 'kolab_addressbook.officelocation', 'category' => 'main'),
|
|
||||||
'website' => array('subtypes' => null),
|
'website' => array('subtypes' => null),
|
||||||
'im' => array('subtypes' => null),
|
'im' => array('subtypes' => null),
|
||||||
'gender' => array('limit' => 1),
|
'gender' => array('limit' => 1),
|
||||||
'initials' => array('type' => 'text', 'size' => 6, 'maxlength' => 10, 'limit' => 1,
|
|
||||||
'label' => 'kolab_addressbook.initials', 'category' => 'personal'),
|
|
||||||
'birthday' => array('limit' => 1),
|
'birthday' => array('limit' => 1),
|
||||||
'anniversary' => array('limit' => 1),
|
'anniversary' => array('limit' => 1),
|
||||||
'profession' => array('type' => 'text', 'size' => 40, 'maxlength' => 80, 'limit' => 1,
|
'profession' => array('type' => 'text', 'size' => 40, 'maxlength' => 80, 'limit' => 1,
|
||||||
|
@ -63,10 +59,10 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
'spouse' => array('limit' => 1),
|
'spouse' => array('limit' => 1),
|
||||||
'children' => array('type' => 'text', 'size' => 40, 'maxlength' => 80, 'limit' => null,
|
'children' => array('type' => 'text', 'size' => 40, 'maxlength' => 80, 'limit' => null,
|
||||||
'label' => 'kolab_addressbook.children', 'category' => 'personal'),
|
'label' => 'kolab_addressbook.children', 'category' => 'personal'),
|
||||||
'pgppublickey' => array('type' => 'text', 'size' => 40, 'limit' => 1,
|
|
||||||
'label' => 'kolab_addressbook.pgppublickey'),
|
|
||||||
'freebusyurl' => array('type' => 'text', 'size' => 40, 'limit' => 1,
|
'freebusyurl' => array('type' => 'text', 'size' => 40, 'limit' => 1,
|
||||||
'label' => 'kolab_addressbook.freebusyurl'),
|
'label' => 'kolab_addressbook.freebusyurl'),
|
||||||
|
'pgppublickey' => array('type' => 'textarea', 'size' => 70, 'rows' => 10, 'limit' => 1,
|
||||||
|
'label' => 'kolab_addressbook.pgppublickey'),
|
||||||
'notes' => array(),
|
'notes' => array(),
|
||||||
'photo' => array(),
|
'photo' => array(),
|
||||||
// TODO: define more Kolab-specific fields such as: language, latitude, longitude
|
// TODO: define more Kolab-specific fields such as: language, latitude, longitude
|
||||||
|
@ -93,6 +89,7 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
private $result;
|
private $result;
|
||||||
private $namespace;
|
private $namespace;
|
||||||
private $imap_folder = 'INBOX/Contacts';
|
private $imap_folder = 'INBOX/Contacts';
|
||||||
|
private $action;
|
||||||
|
|
||||||
|
|
||||||
public function __construct($imap_folder = null)
|
public function __construct($imap_folder = null)
|
||||||
|
@ -132,6 +129,8 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->action = rcmail::get_instance()->action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1046,10 +1045,14 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
// photo is stored as separate attachment
|
// photo is stored as separate attachment
|
||||||
if ($record['photo'] && strlen($record['photo']) < 255 && ($att = $record['_attachments'][$record['photo']])) {
|
if ($record['photo'] && strlen($record['photo']) < 255 && ($att = $record['_attachments'][$record['photo']])) {
|
||||||
// only fetch photo content if requested
|
// only fetch photo content if requested
|
||||||
if (rcmail::get_instance()->action == 'photo')
|
if ($this->action == 'photo')
|
||||||
$record['photo'] = $att['content'] ? $att['content'] : $this->storagefolder->get_attachment($record['uid'], $att['key']);
|
$record['photo'] = $att['content'] ? $att['content'] : $this->storagefolder->get_attachment($record['uid'], $att['key']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// truncate publickey value for display
|
||||||
|
if ($record['pgppublickey'] && $this->action == 'show')
|
||||||
|
$record['pgppublickey'] = substr($record['pgppublickey'], 0, 140) . '...';
|
||||||
|
|
||||||
// remove empty fields
|
// remove empty fields
|
||||||
return array_filter($record);
|
return array_filter($record);
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,7 +264,13 @@ class kolab_format_contact extends kolab_format
|
||||||
}
|
}
|
||||||
$this->obj->setRelateds($rels);
|
$this->obj->setRelateds($rels);
|
||||||
|
|
||||||
// TODO: handle language, pgppublickey, etc.
|
if (isset($object['pgppublickey'])) {
|
||||||
|
$crypto = new Crypto;
|
||||||
|
$crypto->setPGPKey($object['pgppublickey']);
|
||||||
|
$this->obj->setCrypto($crypto);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: handle language, gpslocation, etc.
|
||||||
|
|
||||||
|
|
||||||
// cache this data
|
// cache this data
|
||||||
|
@ -352,6 +358,11 @@ class kolab_format_contact extends kolab_format
|
||||||
// relateds -> spouse, children
|
// relateds -> spouse, children
|
||||||
$this->read_relateds($this->obj->relateds(), $object);
|
$this->read_relateds($this->obj->relateds(), $object);
|
||||||
|
|
||||||
|
// crypto settings: currently only pgpkey is supported
|
||||||
|
$crypto = $this->obj->crypto();
|
||||||
|
if ($pgpkey = $crypto->pgpKey())
|
||||||
|
$object['pgppublickey'] = $pgpkey;
|
||||||
|
|
||||||
$this->data = $object;
|
$this->data = $object;
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue