DimpCore.doActionComplete(o);
},
onCachedList: function(id) {
- var tmp, vs;
if (!this.cacheids[id]) {
- vs = this.viewport.getSelection(id);
+ var vs = this.viewport.getSelection(id);
if (!vs.size()) {
return '';
}
- if (vs.getBuffer().getMetaData('search')) {
- this.cacheids[id] = vs.get('uid').toJSON();
- } else {
- tmp = {};
- tmp[id] = vs.get('uid').clone();
- this.cacheids[id] = DimpCore.toRangeString(tmp);
- }
+ this.cacheids[id] = DimpCore.toRangeString(DimpCore.selectionToRange(vs));
}
return this.cacheids[id];
}.bind(this),
params = $H(params);
opts = opts || {};
- var b,
- ajaxopts = Object.extend(this.doActionOpts, opts.ajaxopts || {}),
- tmp = {};
+ var ajaxopts = Object.extend(this.doActionOpts, opts.ajaxopts || {});
if (opts.uids) {
if (opts.uids.viewport_selection) {
- b = opts.uids.getBuffer();
- if (b.getMetaData('search')) {
- opts.uids.get('dataob').each(function(r) {
- if (!tmp[r.view]) {
- tmp[r.view] = [];
- }
- tmp[r.view].push(r.imapuid);
- });
- } else {
- tmp[b.getView()] = opts.uids.get('uid');
- }
- opts.uids = tmp;
+ opts.uids = this.selectionToRange(opts.uids);
}
params.set('uid', this.toRangeString(opts.uids));
}
new Ajax.Request(DIMP.conf.URI_AJAX + action, ajaxopts);
},
+ selectionToRange: function(s)
+ {
+ var b = s.getBuffer(),
+ tmp = {};
+
+ if (b.getMetaData('search')) {
+ s.get('dataob').each(function(r) {
+ if (!tmp[r.view]) {
+ tmp[r.view] = [];
+ }
+ tmp[r.view].push(r.imapuid);
+ });
+ } else {
+ tmp[b.getView()] = s.get('uid');
+ }
+
+ return tmp;
+ },
+
// params - (Hash)
addRequestParams: function(params)
{
/* Get the cached list. */
$cached = $changed = array();
if (!empty($args['cache'])) {
+ $cached = $GLOBALS['imp_imap']->ob()->utils->fromSequenceString($args['cache']);
if ($is_search) {
- $cached = array_flip(Horde_Serialize::unserialize($args['cache'], Horde_Serialize::JSON));
+ $cached = array_flip($cached);
} else {
- $cached = $GLOBALS['imp_imap']->ob()->utils->fromSequenceString($args['cache']);
$cached = array_flip(reset($cached));
/* Check for cached entries marked as changed via CONDSTORE