2 * Provides the trophy icon designer.
4 * @author Joshua Ruesweg
5 * @copyright 2001-2018 WoltLab GmbH
6 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
7 * @module WoltLabSuite/Core/Acp/User/Content/Remove/Handler
10 define(['Ajax', 'Language', 'Ui/Dialog', 'WoltLabSuite/Core/Acp/Ui/Worker'], function (Ajax
, Language
, UiDialog
, Worker
) {
14 * Creates a new worker instance.
17 function Handler(element
, userId
) { this.init(element
, userId
); }
20 * Initializes the content remove handler.
22 init: function (element
, userId
) {
23 element
.addEventListener(WCF_CLICK_EVENT
, this._click
.bind(this));
24 this._userId
= userId
;
28 * Click on the remove content button.
30 * @param {object} event click event
32 _click: function (event
) {
33 event
.preventDefault();
39 * Executes the remove content worker.
41 * @param {Array} objectTypes
43 _executeWorker: function (objectTypes
) {
46 dialogId
: 'removeContentWorker',
47 dialogTitle
: Language
.get('wcf.acp.user.content.removeContent'),
50 className
: '\\wcf\\system\\worker\\UserContentRemoveWorker',
53 contentProvider
: objectTypes
59 * Handles a click on the submit button in the overlay.
61 _submit: function () {
62 var objectTypeInputs
= elBySelAll('input.contentProviderObjectType', UiDialog
.getDialog('userRemoveContentHandler-' + this._userId
).content
);
65 for (var i
= 0, length
= objectTypeInputs
.length
; i
< length
; i
++) {
66 if (objectTypeInputs
[i
].checked
) {
67 objectTypes
.push(objectTypeInputs
[i
].name
);
71 if (objectTypes
.length
> 0) {
72 this._executeWorker(objectTypes
);
76 _ajaxSuccess: function (data
) {
77 UiDialog
.open(this, data
.returnValues
.template
);
79 elBySel('input[type="submit"]', UiDialog
.getDialog('userRemoveContentHandler-' + this._userId
).content
).addEventListener(WCF_CLICK_EVENT
, this._submit
.bind(this));
82 _ajaxSetup: function () {
85 actionName
: 'prepareRemoveContent',
86 className
: 'wcf\\data\\user\\UserAction',
94 _dialogSetup: function() {
96 id
: 'userRemoveContentHandler-' + this._userId
,
98 title
: Language
.get('wcf.acp.user.content.removeContent')