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_treelist;
|
||||||
var resources_data = {};
|
var resources_data = {};
|
||||||
var resources_index = [];
|
var resources_index = [];
|
||||||
|
var resource_owners = {};
|
||||||
var freebusy_ui = { workinhoursonly:false, needsupdate:false };
|
var freebusy_ui = { workinhoursonly:false, needsupdate:false };
|
||||||
var freebusy_data = {};
|
var freebusy_data = {};
|
||||||
var current_view = null;
|
var current_view = null;
|
||||||
|
@ -1681,11 +1682,17 @@ function rcube_calendar_ui(settings)
|
||||||
$(rcmail.gui_objects.resourceownerinfo).hide();
|
$(rcmail.gui_objects.resourceownerinfo).hide();
|
||||||
|
|
||||||
if (resource.owner) {
|
if (resource.owner) {
|
||||||
|
// display cached data
|
||||||
|
if (resource_owners[resource.owner]) {
|
||||||
|
resource_owner_load(resource_owners[resource.owner]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
// fetch owner data from server
|
// fetch owner data from server
|
||||||
me.loading_lock = rcmail.set_busy(true, 'loading', me.loading_lock);
|
me.loading_lock = rcmail.set_busy(true, 'loading', me.loading_lock);
|
||||||
rcmail.http_request('resources-owner', { _id: resource.owner }, me.loading_lock);
|
rcmail.http_request('resources-owner', { _id: resource.owner }, me.loading_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// callback from server for resource listing
|
// callback from server for resource listing
|
||||||
|
@ -1735,12 +1742,13 @@ function rcube_calendar_ui(settings)
|
||||||
var resource_owner_load = function(data)
|
var resource_owner_load = function(data)
|
||||||
{
|
{
|
||||||
if (data) {
|
if (data) {
|
||||||
// TODO: cache this!
|
// cache this!
|
||||||
|
resource_owners[data.ID] = data;
|
||||||
|
|
||||||
var table = $(rcmail.gui_objects.resourceownerinfo).find('tbody').html('');
|
var table = $(rcmail.gui_objects.resourceownerinfo).find('tbody').html('');
|
||||||
|
|
||||||
for (var k in data) {
|
for (var k in data) {
|
||||||
if (k == 'event')
|
if (k == 'event' || k == 'ID')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
table.append($('<tr>').addClass(k)
|
table.append($('<tr>').addClass(k)
|
||||||
|
|
|
@ -1359,7 +1359,8 @@ class kolab_driver extends calendar_driver
|
||||||
|
|
||||||
if ($ldap = $this->resurces_ldap()) {
|
if ($ldap = $this->resurces_ldap()) {
|
||||||
$owner = $ldap->get_record(rcube_ldap::dn_encode($dn), true);
|
$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;
|
return $owner;
|
||||||
|
|
Loading…
Add table
Reference in a new issue