mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-17 05:23:13 +01:00
Backport commit 47927 committed by NathanGray.Don't send mail rows when opening mail app, but use client side cache instead.
Gives large speed improvements when changing to previously opened folders.
This commit is contained in:
parent
82fa583951
commit
9d1727d077
@ -427,6 +427,8 @@ class mail_ui
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$content[self::$nm_index]['num_rows'] = 0; // Do not send any rows with initial request
|
||||
$content[self::$nm_index]['default_cols'] = 'status,attachments,subject,address,date,size'; // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns
|
||||
$content[self::$nm_index]['csv_fields'] = false;
|
||||
if ($msg)
|
||||
|
@ -65,6 +65,11 @@ app.classes.mail = AppJS.extend(
|
||||
*/
|
||||
init: function() {
|
||||
this._super.apply(this,arguments);
|
||||
|
||||
// Turn on client side, persistent cache
|
||||
// egw.data system runs encapsulated below etemplate, so this must be
|
||||
// done before the nextmatch is created.
|
||||
this.egw.dataCacheRegister('mail',this.nm_cache, this);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -81,6 +86,10 @@ app.classes.mail = AppJS.extend(
|
||||
$j(nm).off('refresh');
|
||||
}
|
||||
}
|
||||
|
||||
// Unregister client side cache
|
||||
this.egw.dataCacheUnregister('mail');
|
||||
|
||||
delete this.et2_obj;
|
||||
// call parent
|
||||
this._super.apply(this, arguments);
|
||||
@ -249,6 +258,32 @@ app.classes.mail = AppJS.extend(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback function for dataFetch caching.
|
||||
*
|
||||
* We only cache the first chunk (50 rows), and only if search filter is not set,
|
||||
* but we cache this for every combination of folder, filter & filter2.
|
||||
*
|
||||
* @param {object} query_context Query information from egw.dataFetch()
|
||||
* @returns {string|false} Cache key, or false to not cache
|
||||
*/
|
||||
nm_cache: function(query_context)
|
||||
{
|
||||
// Only cache first chunk of rows, if no search filter
|
||||
if((!query_context || !query_context.start) && query_context.count == 0 && !(
|
||||
query_context.self._filters.search || false)
|
||||
)
|
||||
{
|
||||
// Make sure keys match, even if some filters are not defined
|
||||
return JSON.stringify({
|
||||
selectedFolder: query_context.self._filters.selectedFolder || '',
|
||||
filter: query_context.self._filters.filter || '',
|
||||
filter2: query_context.self._filters.filter2
|
||||
});
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* mail rebuild Action menu On nm-list
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user