From 995afaf1cd96ed9d43b4936592bf7aed043f6c12 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 7 Oct 2012 14:58:31 +0200 Subject: [PATCH] Makes clipboard container data Every data attribute that starts with `type` (like `data-type-foo-bar`) is treated as container type data which is available in the clipboard action interface implementation in the `$typeData` array via `$typeData['fooBar']`. --- wcfsetup/install/files/js/WCF.js | 9 ++++++--- .../install/files/lib/action/ClipboardAction.class.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index b5379f65eb..51982d71ff 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -916,9 +916,12 @@ WCF.Clipboard = { $container.find('.jsClipboardMarkAll').data('hasContainer', $containerID).click($.proxy(this._markAll, this)); $container.find('input.jsClipboardItem').data('hasContainer', $containerID).click($.proxy(this._click, this)); - if ($container.data('typeContainerID')) { - this._containerData[$container.data('type')] = $container.data('typeContainerID'); - } + this._containerData[$container.data('type')] = {}; + $.each($container.data(), $.proxy(function(index, element) { + if (index.match(/^type(.+)/)) { + this._containerData[$container.data('type')][WCF.String.lcfirst(index.replace(/^type/, ''))] = element; + } + }, this)); }, /** diff --git a/wcfsetup/install/files/lib/action/ClipboardAction.class.php b/wcfsetup/install/files/lib/action/ClipboardAction.class.php index 4e27af8cb1..53f5528818 100644 --- a/wcfsetup/install/files/lib/action/ClipboardAction.class.php +++ b/wcfsetup/install/files/lib/action/ClipboardAction.class.php @@ -78,7 +78,7 @@ class ClipboardAction extends AbstractSecureAction { parent::readParameters(); if (isset($_POST['action'])) $this->action = StringUtil::trim($_POST['action']); - if (isset($_POST['containerData']) && is_array($_POST['containerData'])) $this->containerData = ArrayUtil::toIntegerArray($_POST['containerData']); + 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['type'])) $this->type = StringUtil::trim($_POST['type']); -- 2.20.1