if (this.ppfifo.indexOf(pp_uid) != -1) {
// There is a chance that the message may have been marked
// as unseen since first being viewed. If so, we need to
- // explicitly flag as seen here.
+ // explicitly flag as seen here. TODO?
if (!this.hasFlag('\\seen', data)) {
this.flag('\\seen', true);
}
this.loadingImg('msg', true);
- DimpCore.doAction('ShowPreview', params || {}, { uids: this.viewport.createSelection('dataob', this.pp), callback: this._loadPreviewCallback.bind(this) });
+ DimpCore.doAction('ShowPreview', this.viewport.addRequestParams(params || {}), { uids: this.viewport.createSelection('dataob', this.pp), callback: this._loadPreviewCallback.bind(this) });
},
_loadPreviewCallback: function(resp)
* AJAX action: Generate data necessary to display preview message.
*
* @param Horde_Variables $vars See the list of variables needed for
- * _checkUidvalidity(). Additional variables
- * used:
+ * _changed() and _checkUidvalidity().
+ * Additional variables used:
* <pre>
* 'uid' - (string) Index of the messages to preview (IMAP sequence
* string) - must be single index.
* </pre>
*
- * @return mixed False on failure, or an object with the 'preview'
- * property containing the return value from
- * IMP_View_ShowMessage::showMessage().
+ * @return mixed False on failure, or an object with the following
+ * entries:
+ * <pre>
+ * 'preview' - (object) Return from IMP_View_ShowMessage::showMessage().
+ * 'ViewPort' - (object) See _viewPortData(). (Only returns updatecacheid
+ * entry - don't do mailbox poll here).
+ * </pre>
*/
public function ShowPreview($vars)
{
return false;
}
+ $change = $this->_changed($vars, $indices);
+ if (is_null($change)) {
+ return false;
+ }
+
$ptr = each($indices);
$args = array(
'mailbox' => $ptr['key'],
$result->preview = (object)$show_msg->showMessage($args);
if (isset($result->preview->error)) {
$result = $this->_checkUidvalidity($vars, $result);
+ } elseif (!$change) {
+ /* Only update cacheid info if it changed. */
+ $cacheid = IMP_Mailbox::singleton($vars->view)->getCacheID($vars->view);
+ if ($cacheid != $vars->cacheid) {
+ $result->ViewPort = new stdClass;
+ $result->ViewPort->updatecacheid = $cacheid;
+ $result->ViewPort->view = $vars->view;
+ }
}
} catch (Horde_Imap_Client_Exception $e) {
$result->preview->error = $e->getMessage();