<commit_before>/**
 * Provides the trophy icon designer.
 *
 * @author	<NAME>
 * @copyright	2001-2019 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @module	WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler
 * @since       5.2
 */
define(['Ajax', 'Language', 'Ui/Dialog', 'WoltLabSuite/Core/Acp/Ui/Worker'], function (Ajax, Language, UiDialog, Worker) {
	"use strict";
	
	/**
	 * Creates a new worker instance.
	 * @constructor
	 */
	function Handler(element, userId) { this.init(element, userId); }
	Handler.prototype = {
		/**
		 * Initializes the content remove handler.
		 */
		init: function (element, userId) {
			element.addEventListener(WCF_CLICK_EVENT, this._click.bind(this));
			this._userId = userId;
		},
		
		/**
		 * Click on the remove content button. 
		 * 
		 * @param	{object}	event		click event
		 */
		_click: function (event) {
			event.preventDefault();
			
			Ajax.api(this);
		},
		
		/**
		 * Executes the remove content worker. 
		 * 
		 * @param       {Array}         objectTypes
		 */
		_executeWorker: function (objectTypes) {
			new Worker({
				// dialog
				dialogId: 'removeContentWorker',
				dialogTitle: Language.get('wcf.acp.content.removeContent'),
				
				// ajax
				className: '\\wcf\\system\\worker\\UserContentRemoveWorker',
				parameters: {
					userID: this._userId,
					contentProvider: objectTypes
				}
			});
		},
		
		/**
		 * Handles a click on the submit button in the overlay.
		 */
		_submit: function () {
			var objectTypeInputs = elBySelAll('input.contentProviderObjectType', UiDialog.getDialog('userRemoveContentHandler-' + this._userId).content);
			var objectTypes = [];
			
			for (var i = 0, length = objectTypeInputs.length; i < length; i++) {
				if (objectTypeInputs[i].checked) {
					objectTypes.push(objectTypeInputs[i].name);
				}
			}
			
			UiDialog.close('userRemoveContentHandler-' + this._userId);
			
			if (objectTypes.length > 0) {
				this._executeWorker(objectTypes);
			}
		},
		
		_ajaxSuccess: function (data) {
			UiDialog.open(this, data.returnValues.template);<commit_msg>Fixes overlapping dialog container See #2716<commit_after>/**
 * Provides the trophy icon designer.
 *
 * @author	<NAME>
 * @copyright	2001-2019 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @module	WoltLabSuite/Core/Acp/Ui/User/Content/Remove/Handler
 * @since       5.2
 */
define(['Ajax', 'Language', 'Ui/Dialog', 'WoltLabSuite/Core/Acp/Ui/Worker'], function (Ajax, Language, UiDialog, Worker) {
	"use strict";
	
	/**
	 * Creates a new worker instance.
	 * @constructor
	 */
	function Handler(element, userId) { this.init(element, userId); }
	Handler.prototype = {
		/**
		 * Initializes the content remove handler.
		 */
		init: function (element, userId) {
			element.addEventListener(WCF_CLICK_EVENT, this._click.bind(this));
			this._userId = userId;
		},
		
		/**
		 * Click on the remove content button. 
		 * 
		 * @param	{object}	event		click event
		 */
		_click: function (event) {
			event.preventDefault();
			
			Ajax.api(this);
		},
		
		/**
		 * Executes the remove content worker. 
		 * 
		 * @param       {Array}         objectTypes
		 */
		_executeWorker: function (objectTypes) {
			new Worker({
				// dialog
				dialogId: 'removeContentWorker',
				dialogTitle: Language.get('wcf.acp.content.removeContent'),
				
				// ajax
				className: '\\wcf\\system\\worker\\UserContentRemoveWorker',
				parameters: {
					userID: this._userId,
					contentProvider: objectTypes
				}
			});
		},
		
		/**
		 * Handles a click on the submit button in the overlay.
		 */
		_submit: function () {
			var objectTypeInputs = elBySelAll('input.contentProviderObjectType', UiDialog.getDialog('userRemoveContentHandler-' + this._userId).content);
			var objectTypes = [];
			
			for (var i = 0, length = objectTypeInputs.length; i < length; i++) {
				if (objectTypeInputs[i].checked) {
					objectTypes.push(objectTypeInputs[i].name);
				}
			}
			
			UiDialog.close('userRemoveContentHandler-' + this._userId);
			
			window.setTimeout(function () {
				if (objectTypes.length > 0) {
					this._executeWorker(objectTypes);
				}
			}.bind(this), 200);
		},
		
		_ajaxSuccess: function (data) {
			UiDialog.open(this, data.returnValues.template);
{'fraction_non_alphanumeric': 0.13901654411764705, 'fraction_numerical': 0.007123161764705882, 'mean_word_length': 3.0682242990654207, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '683010', 'n_tokens_mistral': 1667, 'n_tokens_neox': 1357, 'n_words': 293}