From f195a0d0418c4c020b487bdee2419d7278bc4765 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 1 Jun 2013 18:20:53 +0200 Subject: [PATCH] Fixes quote managing on pages without quote handler --- wcfsetup/install/files/js/WCF.Message.js | 7 +++-- .../lib/action/MessageQuoteAction.class.php | 27 +++++++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index be8b01f508..c90533e58c 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -2408,6 +2408,7 @@ WCF.Message.Quote.Manager = Class.extend({ this._proxy.setOption('data', { actionName: 'remove', + getFullQuoteObjectIDs: this._handlers.length > 0, objectTypes: $objectTypes, quoteIDs: $quoteIDs }); @@ -2452,12 +2453,13 @@ WCF.Message.Quote.Manager = Class.extend({ }, /** - * Remoes all marked quote ids. + * Removes all marked quote ids. */ removeMarkedQuotes: function() { if (this._removeOnSubmit.length) { this._proxy.setOption('data', { - actionName: 'removeMarkedQuotes' + actionName: 'removeMarkedQuotes', + getFullQuoteObjectIDs: this._handlers.length > 0 }); this._proxy.sendRequest(); } @@ -2474,6 +2476,7 @@ WCF.Message.Quote.Manager = Class.extend({ this._proxy.setOption('data', { actionName: 'count', + getFullQuoteObjectIDs: this._handlers.length > 0, objectTypes: $objectTypes }); this._proxy.sendRequest(); diff --git a/wcfsetup/install/files/lib/action/MessageQuoteAction.class.php b/wcfsetup/install/files/lib/action/MessageQuoteAction.class.php index 2eda385fa8..574a102e3d 100644 --- a/wcfsetup/install/files/lib/action/MessageQuoteAction.class.php +++ b/wcfsetup/install/files/lib/action/MessageQuoteAction.class.php @@ -12,13 +12,20 @@ use wcf\util\StringUtil; * Handles message quotes. * * @author Alexander Ebert - * @copyright 2001-2012 WoltLab GmbH + * @copyright 2001-2013 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf.message * @subpackage action * @category Community Framework */ class MessageQuoteAction extends AJAXProxyAction { + /** + * indicates if the WCF.Message.Quote.Manager object requesting data has any + * quote handlers which require updated object ids of full quotes + * @var integer + */ + public $_getFullQuoteObjectIDs = false; + /** * list of quote ids * @var array @@ -38,6 +45,7 @@ class MessageQuoteAction extends AJAXProxyAction { AbstractSecureAction::readParameters(); if (isset($_POST['actionName'])) $this->actionName = StringUtil::trim($_POST['actionName']); + if (isset($_POST['getFullQuoteObjectIDs'])) $this->_getFullQuoteObjectIDs = intval($_POST['getFullQuoteObjectIDs']); if (isset($_POST['objectTypes']) && is_array($_POST['objectTypes'])) $this->objectTypes = ArrayUtil::trim($_POST['objectTypes']); if (isset($_POST['quoteIDs'])) { $this->quoteIDs = ArrayUtil::trim($_POST['quoteIDs']); @@ -61,13 +69,14 @@ class MessageQuoteAction extends AJAXProxyAction { switch ($this->actionName) { case 'count': $returnValues = array( - 'count' => $this->count(), - 'fullQuoteObjectIDs' => $this->getFullQuoteObjectIDs() + 'count' => $this->count() ); break; case 'getQuotes': - $returnValues = array('template' => $this->getQuotes()); + $returnValues = array( + 'template' => $this->getQuotes() + ); break; case 'markForRemoval': @@ -76,15 +85,13 @@ class MessageQuoteAction extends AJAXProxyAction { case 'remove': $returnValues = array( - 'count' => $this->remove(), - 'fullQuoteObjectIDs' => $this->getFullQuoteObjectIDs() + 'count' => $this->remove() ); break; case 'removeMarkedQuotes': $returnValues = array( - 'count' => $this->removeMarkedQuotes(), - 'fullQuoteObjectIDs' => $this->getFullQuoteObjectIDs() + 'count' => $this->removeMarkedQuotes() ); break; @@ -93,6 +100,10 @@ class MessageQuoteAction extends AJAXProxyAction { break; } + if (is_array($returnValues) && $this->_getFullQuoteObjectIDs) { + $returnValues['fullQuoteObjectIDs'] = $this->getFullQuoteObjectIDs(); + } + $this->executed(); // force session update -- 2.20.1