*/
_page: '',
+ /**
+ * current page's object id
+ * @var integer
+ */
+ _pageObjectID: 0,
+
/**
* proxy object
* @var WCF.Action.Proxy
/**
* Initializes the clipboard API.
+ *
+ * @param string page
+ * @param integer hasMarkedItems
+ * @param object actionObjects
+ * @param integer pageObjectID
*/
- init: function(page, hasMarkedItems, actionObjects) {
+ init: function(page, hasMarkedItems, actionObjects, pageObjectID) {
this._page = page;
- this._actionObjects = actionObjects;
- if (!actionObjects) {
- this._actionObjects = {};
- }
- if (hasMarkedItems) {
- this._hasMarkedItems = true;
- }
+ this._actionObjects = actionObjects || { };
+ this._hasMarkedItems = (hasMarkedItems > 0);
+ this._pageObjectID = parseInt(pageObjectID) || 0;
this._actionProxy = new WCF.Action.Proxy({
success: $.proxy(this._actionSuccess, this),
autoSend: true,
data: {
containerData: this._containerData,
- pageClassName: this._page
+ pageClassName: this._page,
+ pageObjectID: this._pageObjectID
},
success: $.proxy(this._loadMarkedItemsSuccess, this),
url: 'index.php/ClipboardLoadMarkedItems/?t=' + SECURITY_TOKEN + SID_ARG_2ND
*/
protected $pageClassName = '';
+ /**
+ * page object id
+ * @var integer
+ */
+ protected $pageObjectID = 0;
+
/**
* object type
* @var string
if (isset($_POST['containerData']) && is_array($_POST['containerData'])) $this->containerData = $_POST['containerData'];
if (isset($_POST['objectIDs']) && is_array($_POST['objectIDs'])) $this->objectIDs = ArrayUtil::toIntegerArray($_POST['objectIDs']);
if (isset($_POST['pageClassName'])) $this->pageClassName = StringUtil::trim($_POST['pageClassName']);
+ if (isset($_POST['pageObjectID'])) $this->pageObjectID = intval($_POST['pageObjectID']);
if (isset($_POST['type'])) $this->type = StringUtil::trim($_POST['type']);
}
* @return array<array>
*/
protected function getEditorItems() {
- $data = ClipboardHandler::getInstance()->getEditorItems($this->pageClassName, $this->containerData);
+ $data = ClipboardHandler::getInstance()->getEditorItems($this->pageClassName, $this->pageObjectID, $this->containerData);
if ($data === null) {
return array();
* Handles marked clipboard items once DOM is loaded.
*
* @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
+ * @copyright 2001-2013 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage action
*/
protected $actionCache = null;
+ /**
+ * cached list of clipboard item types
+ * @var array<array>
+ */
+ protected $cache = null;
+
/**
* list of marked items
* @var array<array>
protected $pageCache = null;
/**
- * cached list of clipboard item types
- * @var array<array>
+ * page object id
+ * @var integer
*/
- protected $cache = null;
+ protected $pageObjectID = 0;
/**
* @see wcf\system\SingletonFactory::init()
* Returns items for clipboard editor.
*
* @param string $page
+ * @param integer $pageObjectID
* @param array $containerData
* @return array<array>
*/
- public function getEditorItems($page, $containerData) {
+ public function getEditorItems($page, $pageObjectID, $containerData) {
+ $this->pageObjectID = 0;
+
// ignore unknown pages
if (!isset($this->pageCache[$page])) return null;
$this->loadMarkedItems();
if (empty($this->markedItems)) return null;
+ $this->pageObjectID = $pageObjectID;
+
// fetch action ids
$this->loadActionCache();
$actionIDs = array();
return 0;
}
+
+ /**
+ * Returns page object id.
+ *
+ * @return integer
+ */
+ public function getPageObjectID() {
+ return $this->pageObjectID;
+ }
}