Merge branch 'master' of ssh://git.kolab.org/git/roundcubemail-plugins-kolab
This commit is contained in:
commit
3ebc2dc548
10 changed files with 141 additions and 80 deletions
|
@ -159,25 +159,5 @@ function kolab_activesync_config()
|
|||
|
||||
|
||||
window.rcmail && rcmail.addEventListener('init', function(evt) {
|
||||
// add button to tabs list
|
||||
var tab = $('<span>').attr('id', 'settingstabpluginactivesync').addClass('tablink'),
|
||||
button = $('<a>').attr('href', rcmail.env.comm_path+'&_action=plugin.activesync')
|
||||
.html(rcmail.gettext('tabtitle', 'kolab_activesync'))
|
||||
.appendTo(tab);
|
||||
rcmail.add_element(tab, 'tabs');
|
||||
|
||||
if (/^plugin.activesync/.test(rcmail.env.action))
|
||||
activesync_object = new kolab_activesync_config();
|
||||
activesync_object = new kolab_activesync_config();
|
||||
});
|
||||
|
||||
|
||||
// extend jQuery
|
||||
(function($){
|
||||
$.fn.serializeJSON = function(){
|
||||
var json = {};
|
||||
jQuery.map($(this).serializeArray(), function(n, i) {
|
||||
json[n['name']] = n['value'];
|
||||
});
|
||||
return json;
|
||||
};
|
||||
})(jQuery);
|
||||
|
|
|
@ -52,8 +52,28 @@ class kolab_activesync extends rcube_plugin
|
|||
$this->register_action('plugin.activesync-config', array($this, 'config_frame'));
|
||||
$this->register_action('plugin.activesync-json', array($this, 'json_command'));
|
||||
|
||||
$this->add_texts('localization/', true);
|
||||
$this->include_script('kolab_activesync.js');
|
||||
$this->add_hook('settings_actions', array($this, 'settings_actions'));
|
||||
|
||||
$this->add_texts('localization/', array('devicedeleteconfirm', 'savingdata'));
|
||||
|
||||
if (strpos($this->rc->action, 'plugin.activesync') === 0) {
|
||||
$this->include_script('kolab_activesync.js');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Activesync section in Settings
|
||||
*/
|
||||
function settings_actions($args)
|
||||
{
|
||||
$args['actions'][] = array(
|
||||
'action' => 'plugin.activesync',
|
||||
'class' => 'activesync',
|
||||
'label' => 'tabtitle',
|
||||
'domain' => 'kolab_activesync',
|
||||
);
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -95,7 +95,7 @@ class kolab_activesync_ui
|
|||
$attrib['id'] = 'foldersubscriptions';
|
||||
|
||||
// group folders by type (show only known types)
|
||||
$folder_groups = array('mail' => array(), 'contact' => array(), 'event' => array(), 'task' => array());
|
||||
$folder_groups = array('mail' => array(), 'contact' => array(), 'event' => array(), 'task' => array(), 'note' => array());
|
||||
$folder_types = kolab_storage::folders_typedata();
|
||||
$imei = $this->device['_id'];
|
||||
$subscribed = array();
|
||||
|
|
|
@ -329,12 +329,14 @@ class kolab_auth_ldap extends rcube_ldap_generic
|
|||
|
||||
// fields mapping
|
||||
foreach ($this->fieldmap as $field => $attr) {
|
||||
// $entry is indexed by lower-case attribute names
|
||||
// $entry might be indexed by lower-case attribute names
|
||||
$attr_lc = strtolower($attr);
|
||||
if (isset($entry[$attr_lc])) {
|
||||
$entry[$field] = $entry[$attr_lc];
|
||||
}
|
||||
// @TODO: consider returning also $entry[$attr] when $attr != $attr_lc
|
||||
else if (isset($entry[$attr])) {
|
||||
$entry[$field] = $entry[$attr];
|
||||
}
|
||||
}
|
||||
|
||||
return $entry;
|
||||
|
|
|
@ -38,13 +38,6 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
|
|||
else if (rcmail.env.task != 'settings')
|
||||
return;
|
||||
|
||||
// add Delegation section to the list
|
||||
var tab = $('<span>').attr('id', 'settingstabplugindelegation').addClass('tablink'),
|
||||
button = $('<a>').attr('href', rcmail.env.comm_path+'&_action=plugin.delegation')
|
||||
.html(rcmail.gettext('tabtitle', 'kolab_delegation'))
|
||||
.appendTo(tab);
|
||||
rcmail.add_element(tab, 'tabs');
|
||||
|
||||
if (/^plugin.delegation/.test(rcmail.env.action)) {
|
||||
rcmail.addEventListener('plugin.delegate_save_complete', function(e) { rcmail.delegate_save_complete(e); });
|
||||
|
||||
|
|
|
@ -65,9 +65,15 @@ class kolab_delegation extends rcube_plugin
|
|||
$this->register_action('plugin.delegation-save', array($this, 'controller_action'));
|
||||
$this->register_action('plugin.delegation-autocomplete', array($this, 'controller_action'));
|
||||
|
||||
$this->add_hook('settings_actions', array($this, 'settings_actions'));
|
||||
|
||||
if ($this->rc->action == 'plugin.delegation' || empty($_REQUEST['_framed'])) {
|
||||
$this->add_texts('localization/', array('tabtitle', 'deleteconfirm', 'savingdata', 'yes', 'no'));
|
||||
$this->include_script('kolab_delegation.js');
|
||||
$this->add_texts('localization/', array('deleteconfirm', 'savingdata', 'yes', 'no'));
|
||||
|
||||
if ($this->rc->action == 'plugin.delegation') {
|
||||
$this->include_script('kolab_delegation.js');
|
||||
}
|
||||
|
||||
$this->skin_path = $this->local_skin_path();
|
||||
$this->include_stylesheet($this->skin_path . '/style.css');
|
||||
}
|
||||
|
@ -78,6 +84,21 @@ class kolab_delegation extends rcube_plugin
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Delegation section in Settings
|
||||
*/
|
||||
function settings_actions($args)
|
||||
{
|
||||
$args['actions'][] = array(
|
||||
'action' => 'plugin.delegation',
|
||||
'class' => 'delegation',
|
||||
'label' => 'tabtitle',
|
||||
'domain' => 'kolab_delegation',
|
||||
);
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Engine object getter
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* Stylesheets for the Kolab Delegation configuration UI */
|
||||
|
||||
#settings-sections #settingstabplugindelegation a {
|
||||
#settings-sections span.listitem.delegation a {
|
||||
background: url(delegation.png) 6px 1px no-repeat;
|
||||
}
|
||||
|
||||
#settings-sections #settingstabplugindelegation.selected a {
|
||||
#settings-sections span.listitem.delegation.selected a {
|
||||
background-position: 6px -23px;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ abstract class kolab_format
|
|||
protected $version = '3.0';
|
||||
|
||||
const KTYPE_PREFIX = 'application/x-vnd.kolab.';
|
||||
const PRODUCT_ID = 'Roundcube-libkolab-0.9';
|
||||
const PRODUCT_ID = 'Roundcube-libkolab-0.9';
|
||||
|
||||
/**
|
||||
* Factory method to instantiate a kolab_format object of the given type and version
|
||||
|
@ -497,4 +497,50 @@ abstract class kolab_format
|
|||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
protected function get_attachments(&$object)
|
||||
{
|
||||
// handle attachments
|
||||
$vattach = $this->obj->attachments();
|
||||
for ($i=0; $i < $vattach->size(); $i++) {
|
||||
$attach = $vattach->get($i);
|
||||
|
||||
// skip cid: attachments which are mime message parts handled by kolab_storage_folder
|
||||
if (substr($attach->uri(), 0, 4) != 'cid:' && $attach->label()) {
|
||||
$name = $attach->label();
|
||||
$content = $attach->data();
|
||||
$object['_attachments'][$name] = array(
|
||||
'name' => $name,
|
||||
'mimetype' => $attach->mimetype(),
|
||||
'size' => strlen($content),
|
||||
'content' => $content,
|
||||
);
|
||||
}
|
||||
else if (substr($attach->uri(), 0, 4) == 'http') {
|
||||
$object['links'][] = $attach->uri();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function set_attachments($object)
|
||||
{
|
||||
// save attachments
|
||||
$vattach = new vectorattachment;
|
||||
foreach ((array) $object['_attachments'] as $cid => $attr) {
|
||||
if (empty($attr))
|
||||
continue;
|
||||
$attach = new Attachment;
|
||||
$attach->setLabel((string)$attr['name']);
|
||||
$attach->setUri('cid:' . $cid, $attr['mimetype']);
|
||||
$vattach->push($attach);
|
||||
}
|
||||
|
||||
foreach ((array) $object['links'] as $link) {
|
||||
$attach = new Attachment;
|
||||
$attach->setUri($link, 'unknown');
|
||||
$vattach->push($attach);
|
||||
}
|
||||
|
||||
$this->obj->setAttachments($vattach);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,11 @@ class kolab_format_note extends kolab_format
|
|||
protected $read_func = 'readNote';
|
||||
protected $write_func = 'writeNote';
|
||||
|
||||
protected $sensitivity_map = array(
|
||||
'public' => kolabformat::ClassPublic,
|
||||
'private' => kolabformat::ClassPrivate,
|
||||
'confidential' => kolabformat::ClassConfidential,
|
||||
);
|
||||
|
||||
/**
|
||||
* Set properties to the kolabformat object
|
||||
|
@ -42,7 +47,12 @@ class kolab_format_note extends kolab_format
|
|||
// set common object properties
|
||||
parent::set($object);
|
||||
|
||||
// TODO: set object propeties
|
||||
$this->obj->setSummary($object['title']);
|
||||
$this->obj->setDescription($object['description']);
|
||||
$this->obj->setClassification($this->sensitivity_map[$object['sensitivity']]);
|
||||
$this->obj->setCategories(self::array2vector($object['categories']));
|
||||
|
||||
$this->set_attachments($object);
|
||||
|
||||
// cache this data
|
||||
$this->data = $object;
|
||||
|
@ -73,10 +83,35 @@ class kolab_format_note extends kolab_format
|
|||
// read common object props into local data object
|
||||
$object = parent::to_array($data);
|
||||
|
||||
// TODO: read object properties
|
||||
$sensitivity_map = array_flip($this->sensitivity_map);
|
||||
|
||||
$this->data = $object;
|
||||
return $this->data;
|
||||
// read object properties
|
||||
$object += array(
|
||||
'sensitivity' => $sensitivity_map[$this->obj->classification()],
|
||||
'categories' => self::vector2array($this->obj->categories()),
|
||||
'title' => $this->obj->summary(),
|
||||
'description' => $this->obj->description(),
|
||||
);
|
||||
|
||||
$this->get_attachments($object);
|
||||
|
||||
return $this->data = $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for kolab_storage_cache to get object specific tags to cache
|
||||
*
|
||||
* @return array List of tags to save in cache
|
||||
*/
|
||||
public function get_tags()
|
||||
{
|
||||
$tags = array();
|
||||
|
||||
foreach ((array) $this->data['categories'] as $cat) {
|
||||
$tags[] = rcube_utils::normalize_string($cat);
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -237,26 +237,7 @@ abstract class kolab_format_xcal extends kolab_format
|
|||
}
|
||||
}
|
||||
|
||||
// handle attachments
|
||||
$vattach = $this->obj->attachments();
|
||||
for ($i=0; $i < $vattach->size(); $i++) {
|
||||
$attach = $vattach->get($i);
|
||||
|
||||
// skip cid: attachments which are mime message parts handled by kolab_storage_folder
|
||||
if (substr($attach->uri(), 0, 4) != 'cid:' && $attach->label()) {
|
||||
$name = $attach->label();
|
||||
$content = $attach->data();
|
||||
$object['_attachments'][$name] = array(
|
||||
'name' => $name,
|
||||
'mimetype' => $attach->mimetype(),
|
||||
'size' => strlen($content),
|
||||
'content' => $content,
|
||||
);
|
||||
}
|
||||
else if (substr($attach->uri(), 0, 4) == 'http') {
|
||||
$object['links'][] = $attach->uri();
|
||||
}
|
||||
}
|
||||
$this->get_attachments($object);
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
@ -443,24 +424,7 @@ abstract class kolab_format_xcal extends kolab_format
|
|||
}
|
||||
$this->obj->setAlarms($valarms);
|
||||
|
||||
// save attachments
|
||||
$vattach = new vectorattachment;
|
||||
foreach ((array)$object['_attachments'] as $cid => $attr) {
|
||||
if (empty($attr))
|
||||
continue;
|
||||
$attach = new Attachment;
|
||||
$attach->setLabel((string)$attr['name']);
|
||||
$attach->setUri('cid:' . $cid, $attr['mimetype']);
|
||||
$vattach->push($attach);
|
||||
}
|
||||
|
||||
foreach ((array)$object['links'] as $link) {
|
||||
$attach = new Attachment;
|
||||
$attach->setUri($link, 'unknown');
|
||||
$vattach->push($attach);
|
||||
}
|
||||
|
||||
$this->obj->setAttachments($vattach);
|
||||
$this->set_attachments($object);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue