--- /dev/null
+import * as Language from "../../../../../Language";
+import * as UiConfirmation from "../../../../../Ui/Confirmation";
+import AcpUiWorker from "../../../Worker";
+
+interface AjaxResponse {
+ loopCount: number;
+ parameters: ArbitraryObject;
+ proceedURL: string;
+ progress: number;
+ template?: string;
+}
+
+type CallbackSuccess = (data: AjaxResponse) => void;
+
+/**
+ * @author Joshua Ruesweg
+ * @copyright 2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Acp/Ui/User/Action/Handler
+ * @since 5.5
+ */
+export class SendNewPassword {
+ private userIDs: number[];
+ private successCallback: CallbackSuccess | null;
+
+ public constructor(userIDs: number[], successCallback: CallbackSuccess | null) {
+ this.userIDs = userIDs;
+ this.successCallback = successCallback;
+ }
+
+ send(): void {
+ UiConfirmation.show({
+ confirm: () => {
+ new AcpUiWorker({
+ dialogId: "sendingNewPasswords",
+ dialogTitle: Language.get("wcf.acp.user.sendNewPassword.workerTitle"),
+ className: "wcf\\system\\worker\\SendNewPasswordWorker",
+ parameters: {
+ userIDs: this.userIDs,
+ },
+ callbackSuccess: this.successCallback,
+ });
+ },
+ message: Language.get("wcf.acp.user.action.sendNewPassword.confirmMessage"),
+ });
+ }
+}
+
+export default SendNewPassword;
-import * as EventHandler from "../../../../Event/Handler";
-import * as Language from "../../../../Language";
import AbstractUserAction from "./AbstractUserAction";
+import SendNewPassword from "./Handler/SendNewPassword";
/**
* @author Joshua Ruesweg
this.button.addEventListener("click", (event) => {
event.preventDefault();
- // emulate clipboard selection
- EventHandler.fire("com.woltlab.wcf.clipboard", "com.woltlab.wcf.user", {
- data: {
- actionName: "com.woltlab.wcf.user.sendNewPassword",
- parameters: {
- confirmMessage: Language.get("wcf.acp.user.action.sendNewPassword.confirmMessage"),
- objectIDs: [this.userId],
- },
- },
- responseData: {
- actionName: "com.woltlab.wcf.user.sendNewPassword",
- objectIDs: [this.userId],
- },
+ const sendNewPasswordHandler = new SendNewPassword([this.userId], () => {
+ location.reload();
});
+ sendNewPasswordHandler.send();
});
}
}
--- /dev/null
+define(["require", "exports", "tslib", "../../../../../Language", "../../../../../Ui/Confirmation", "../../../Worker"], function (require, exports, tslib_1, Language, UiConfirmation, Worker_1) {
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.SendNewPassword = void 0;
+ Language = tslib_1.__importStar(Language);
+ UiConfirmation = tslib_1.__importStar(UiConfirmation);
+ Worker_1 = tslib_1.__importDefault(Worker_1);
+ /**
+ * @author Joshua Ruesweg
+ * @copyright 2001-2021 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module WoltLabSuite/Core/Acp/Ui/User/Action/Handler
+ * @since 5.5
+ */
+ class SendNewPassword {
+ constructor(userIDs, successCallback) {
+ this.userIDs = userIDs;
+ this.successCallback = successCallback;
+ }
+ send() {
+ UiConfirmation.show({
+ confirm: () => {
+ new Worker_1.default({
+ dialogId: "sendingNewPasswords",
+ dialogTitle: Language.get("wcf.acp.user.sendNewPassword.workerTitle"),
+ className: "wcf\\system\\worker\\SendNewPasswordWorker",
+ parameters: {
+ userIDs: this.userIDs,
+ },
+ callbackSuccess: this.successCallback,
+ });
+ },
+ message: Language.get("wcf.acp.user.action.sendNewPassword.confirmMessage"),
+ });
+ }
+ }
+ exports.SendNewPassword = SendNewPassword;
+ exports.default = SendNewPassword;
+});
-define(["require", "exports", "tslib", "../../../../Event/Handler", "../../../../Language", "./AbstractUserAction"], function (require, exports, tslib_1, EventHandler, Language, AbstractUserAction_1) {
+define(["require", "exports", "tslib", "./AbstractUserAction", "./Handler/SendNewPassword"], function (require, exports, tslib_1, AbstractUserAction_1, SendNewPassword_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SendNewPasswordAction = void 0;
- EventHandler = tslib_1.__importStar(EventHandler);
- Language = tslib_1.__importStar(Language);
AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
+ SendNewPassword_1 = tslib_1.__importDefault(SendNewPassword_1);
/**
* @author Joshua Ruesweg
* @copyright 2001-2021 WoltLab GmbH
init() {
this.button.addEventListener("click", (event) => {
event.preventDefault();
- // emulate clipboard selection
- EventHandler.fire("com.woltlab.wcf.clipboard", "com.woltlab.wcf.user", {
- data: {
- actionName: "com.woltlab.wcf.user.sendNewPassword",
- parameters: {
- confirmMessage: Language.get("wcf.acp.user.action.sendNewPassword.confirmMessage"),
- objectIDs: [this.userId],
- },
- },
- responseData: {
- actionName: "com.woltlab.wcf.user.sendNewPassword",
- objectIDs: [this.userId],
- },
+ const sendNewPasswordHandler = new SendNewPassword_1.default([this.userId], () => {
+ location.reload();
});
+ sendNewPasswordHandler.send();
});
}
}