*/
_container: null,
+ /**
+ * container meta data
+ * @var object
+ */
+ _containerData: { },
+
/**
* user has marked items
* @var boolean
new WCF.Action.Proxy({
autoSend: true,
data: {
+ containerData: this._containerData,
pageClassName: this._page
},
success: $.proxy(this._loadMarkedItemsSuccess, this),
*/
_initContainer: function(container) {
var $container = $(container);
+ var $containerID = $container.wcfIdentify();
- // fetch id or assign a random one if none found
- var $id = $container.attr('id');
- if (!$id) {
- $id = WCF.getRandomID();
- $container.attr('id', $id);
- }
-
- // bind mark all checkboxes
- $container.find('.jsClipboardMarkAll').each($.proxy(function(index, item) {
- $(item).data('hasContainer', $id).click($.proxy(this._markAll, this));
- }, this));
+ $container.find('.jsClipboardMarkAll').data('hasContainer', $containerID).click($.proxy(this._markAll, this));
+ $container.find('input.jsClipboardItem').data('hasContainer', $containerID).click($.proxy(this._click, this));
- // bind item checkboxes
- $container.find('input.jsClipboardItem').each($.proxy(function(index, item) {
- $(item).data('hasContainer', $id).click($.proxy(this._click, this));
- }, this));
+ if ($container.data('typeContainerID')) {
+ this._containerData[$container.data('type')] = $container.data('typeContainerID');
+ }
},
/**
*/
protected $action = '';
+ /**
+ * container data
+ * @var array
+ */
+ protected $containerData = array();
+
/**
* list of object ids
* @var array<integer>
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['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']);
* @return array<array>
*/
protected function getEditorItems() {
- $data = ClipboardHandler::getInstance()->getEditorItems($this->pageClassName);
+ $data = ClipboardHandler::getInstance()->getEditorItems($this->pageClassName, $this->containerData);
if ($data === null) {
return array();
* Returns items for clipboard editor.
*
* @param string $page
+ * @param array $containerData
* @return array<array>
*/
- public function getEditorItems($page) {
+ public function getEditorItems($page, $containerData) {
// ignore unknown pages
if (!isset($this->pageCache[$page])) return null;
'items' => array()
);
+ $typeData = array();
+ if (isset($containerData[$typeName])) {
+ $typeData = $containerData[$typeName];
+ }
+
foreach ($actionData['actions'] as $action) {
- $data = $actionData['object']->execute($this->markedItems[$typeName], $action);
+ $data = $actionData['object']->execute($this->markedItems[$typeName], $action, $typeData);
if ($data === null) {
continue;
}
*
* @param array $objects
* @param string $actionName
+ * @param array $typeData
* @return wcf\system\clipboard\ClipboardEditorItem
*/
- public function execute(array $objects, $actionName);
+ public function execute(array $objects, $actionName, $typeData = array());
/**
* Returns label for item editor.
/**
* @see wcf\system\clipboard\action\IClipboardAction::execute()
*/
- public function execute(array $objects, $actionName) {
+ public function execute(array $objects, $actionName, $typeData = array()) {
$item = new ClipboardEditorItem();
// handle actions