Cache resource owner info lookups
This commit is contained in:
parent
6fe1cfcdd2
commit
0b2e726857
2 changed files with 15 additions and 6 deletions
|
@ -51,6 +51,7 @@ function rcube_calendar_ui(settings)
|
|||
var resources_treelist;
|
||||
var resources_data = {};
|
||||
var resources_index = [];
|
||||
var resource_owners = {};
|
||||
var freebusy_ui = { workinhoursonly:false, needsupdate:false };
|
||||
var freebusy_data = {};
|
||||
var current_view = null;
|
||||
|
@ -1681,9 +1682,15 @@ function rcube_calendar_ui(settings)
|
|||
$(rcmail.gui_objects.resourceownerinfo).hide();
|
||||
|
||||
if (resource.owner) {
|
||||
// fetch owner data from server
|
||||
me.loading_lock = rcmail.set_busy(true, 'loading', me.loading_lock);
|
||||
rcmail.http_request('resources-owner', { _id: resource.owner }, me.loading_lock);
|
||||
// display cached data
|
||||
if (resource_owners[resource.owner]) {
|
||||
resource_owner_load(resource_owners[resource.owner]);
|
||||
}
|
||||
else {
|
||||
// fetch owner data from server
|
||||
me.loading_lock = rcmail.set_busy(true, 'loading', me.loading_lock);
|
||||
rcmail.http_request('resources-owner', { _id: resource.owner }, me.loading_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1735,12 +1742,13 @@ function rcube_calendar_ui(settings)
|
|||
var resource_owner_load = function(data)
|
||||
{
|
||||
if (data) {
|
||||
// TODO: cache this!
|
||||
// cache this!
|
||||
resource_owners[data.ID] = data;
|
||||
|
||||
var table = $(rcmail.gui_objects.resourceownerinfo).find('tbody').html('');
|
||||
|
||||
for (var k in data) {
|
||||
if (k == 'event')
|
||||
if (k == 'event' || k == 'ID')
|
||||
continue;
|
||||
|
||||
table.append($('<tr>').addClass(k)
|
||||
|
|
|
@ -1359,7 +1359,8 @@ class kolab_driver extends calendar_driver
|
|||
|
||||
if ($ldap = $this->resurces_ldap()) {
|
||||
$owner = $ldap->get_record(rcube_ldap::dn_encode($dn), true);
|
||||
unset($owner['_raw_attrib'], $owner['_type'], $owner['ID']);
|
||||
$owner['ID'] = rcube_ldap::dn_decode($owner['ID']);
|
||||
unset($owner['_raw_attrib'], $owner['_type']);
|
||||
}
|
||||
|
||||
return $owner;
|
||||
|
|
Loading…
Add table
Reference in a new issue