+/**
+ * @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
+ * @since 5.5
+ */
+
export abstract class AbstractUserAction {
- protected button: HTMLElement;
- protected userData: HTMLElement;
- protected userId: number;
+ protected readonly button: HTMLElement;
+ protected readonly userDataElement: HTMLElement;
+ protected readonly userId: number;
public constructor(button: HTMLElement, userId: number, userDataElement: HTMLElement) {
this.button = button;
this.userId = userId;
- this.userData = userDataElement;
+ this.userDataElement = userDataElement;
this.init();
}
- protected abstract init();
+ protected abstract init(): void;
}
export default AbstractUserAction;
-import * as Core from "../../../../Core";
-import AbstractUserAction from "./AbstractUserAction";
-import BanHandler from "./Handler/Ban";
-import * as UiNotification from "../../../../Ui/Notification";
-import * as EventHandler from "../../../../Event/Handler";
-
/**
* @author Joshua Ruesweg
* @copyright 2001-2021 WoltLab GmbH
* @module WoltLabSuite/Core/Acp/Ui/User/Action
* @since 5.5
*/
+
+import * as Core from "../../../../Core";
+import AbstractUserAction from "./AbstractUserAction";
+import BanHandler from "./Handler/Ban";
+import * as UiNotification from "../../../../Ui/Notification";
+import * as EventHandler from "../../../../Event/Handler";
+
export class BanAction extends AbstractUserAction {
private banHandler: BanHandler;
- protected init() {
+ protected init(): void {
this.banHandler = new BanHandler([this.userId]);
this.button.addEventListener("click", (event) => {
event.preventDefault();
- const isBanned = Core.stringToBool(this.userData.dataset.banned!);
+ const isBanned = Core.stringToBool(this.userDataElement.dataset.banned!);
if (isBanned) {
this.banHandler.unban(() => {
- this.userData.dataset.banned = "false";
+ this.userDataElement.dataset.banned = "false";
this.button.textContent = this.button.dataset.banMessage!;
UiNotification.show();
EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
- userIds: [this.userId]
+ userIds: [this.userId],
});
});
- }
- else {
+ } else {
this.banHandler.ban(() => {
- this.userData.dataset.banned = "true";
+ this.userDataElement.dataset.banned = "true";
this.button.textContent = this.button.dataset.unbanMessage!;
UiNotification.show();
EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
- userIds: [this.userId]
+ userIds: [this.userId],
});
});
}
-import AbstractUserAction from "./AbstractUserAction";
-import * as Language from "../../../../Language";
-import Delete from "./Handler/Delete";
-
/**
* @author Joshua Ruesweg
* @copyright 2001-2021 WoltLab GmbH
* @module WoltLabSuite/Core/Acp/Ui/User/Action
* @since 5.5
*/
+
+import AbstractUserAction from "./AbstractUserAction";
+import Delete from "./Handler/Delete";
+
export class DeleteAction extends AbstractUserAction {
- protected init() {
+ protected init(): void {
this.button.addEventListener("click", (event) => {
event.preventDefault();
- let deleteHandler = new Delete([this.userId], () => {
- this.userData.remove();
- }, this.button.dataset.confirmMessage);
+ const deleteHandler = new Delete(
+ [this.userId],
+ () => {
+ this.userDataElement.remove();
+ },
+ this.button.dataset.confirmMessage,
+ );
deleteHandler.delete();
});
}
-import * as Ajax from "../../../../Ajax";
-import * as Core from "../../../../Core";
-import { AjaxCallbackObject, DatabaseObjectActionResponse } from "../../../../Ajax/Data";
-import * as UiNotification from "../../../../Ui/Notification";
-import AbstractUserAction from "./AbstractUserAction";
-import * as EventHandler from "../../../../Event/Handler";
-
/**
* @author Joshua Ruesweg
* @copyright 2001-2021 WoltLab GmbH
* @module WoltLabSuite/Core/Acp/Ui/User/Action
* @since 5.5
*/
-export class DisableAction extends AbstractUserAction {
- protected init() {
+
+import * as Ajax from "../../../../Ajax";
+import * as Core from "../../../../Core";
+import { AjaxCallbackObject, AjaxCallbackSetup, DatabaseObjectActionResponse } from "../../../../Ajax/Data";
+import * as UiNotification from "../../../../Ui/Notification";
+import AbstractUserAction from "./AbstractUserAction";
+import * as EventHandler from "../../../../Event/Handler";
+
+export class DisableAction extends AbstractUserAction implements AjaxCallbackObject {
+ protected init(): void {
this.button.addEventListener("click", (event) => {
event.preventDefault();
+ const isEnabled = Core.stringToBool(this.userDataElement.dataset.enabled!);
- Ajax.api(
- {
- _ajaxSetup: () => {
- const isEnabled = Core.stringToBool(this.userData.dataset.enabled!);
+ Ajax.api(this, {
+ actionName: isEnabled ? "disable" : "enable",
+ });
+ });
+ }
- return {
- data: {
- actionName: (isEnabled ? "disable" : "enable"),
- className: "wcf\\data\\user\\UserAction",
- objectIDs: [this.userId],
- },
- };
- },
+ _ajaxSetup(): ReturnType<AjaxCallbackSetup> {
+ return {
+ data: {
+ className: "wcf\\data\\user\\UserAction",
+ objectIDs: [this.userId],
+ },
+ };
+ }
- _ajaxSuccess: (data: DatabaseObjectActionResponse) => {
- if (data.objectIDs.includes(this.userId)) {
- switch (data.actionName) {
- case "enable":
- this.userData.dataset.enabled = "true";
- this.button.textContent = this.button.dataset.disableMessage!;
- break;
+ _ajaxSuccess(data: DatabaseObjectActionResponse): void {
+ if (data.objectIDs.includes(this.userId)) {
+ switch (data.actionName) {
+ case "enable":
+ this.userDataElement.dataset.enabled = "true";
+ this.button.textContent = this.button.dataset.disableMessage!;
+ break;
- case "disable":
- this.userData.dataset.enabled = "false";
- this.button.textContent = this.button.dataset.enableMessage!;
- break;
+ case "disable":
+ this.userDataElement.dataset.enabled = "false";
+ this.button.textContent = this.button.dataset.enableMessage!;
+ break;
- default:
- throw new Error("Unreachable");
- }
- }
+ default:
+ throw new Error("Unreachable");
+ }
+ }
- UiNotification.show();
+ UiNotification.show();
- EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
- userIds: [this.userId]
- });
- },
- }
- );
+ EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
+ userIds: [this.userId],
});
}
}
-import { DialogCallbackSetup } from "../../../../../Ui/Dialog/Data";
-import * as Language from "../../../../../Language";
-import * as Ajax from "../../../../../Ajax";
-import { AjaxCallbackObject, DatabaseObjectActionResponse } from "../../../../../Ajax/Data";
-import UiDialog from "../../../../../Ui/Dialog";
-
/**
* @author Joshua Ruesweg
* @copyright 2001-2021 WoltLab GmbH
* @module WoltLabSuite/Core/Acp/Ui/User/Action/Handler
* @since 5.5
*/
+
+import { DialogCallbackSetup } from "../../../../../Ui/Dialog/Data";
+import * as Language from "../../../../../Language";
+import * as Ajax from "../../../../../Ajax";
+import UiDialog from "../../../../../Ui/Dialog";
+
export class BanHandler {
- private userIDs: number[];
- private banCallback: () => void;
+ private userIDs: number[];
+ private banCallback: () => void;
- public constructor(userIDs: number[]) {
- this.userIDs = userIDs;
- }
+ public constructor(userIDs: number[]) {
+ this.userIDs = userIDs;
+ }
- ban(callback: () => void): void {
- // Save the callback for later usage.
- // We cannot easily give the callback to the dialog.
- this.banCallback = callback;
+ public ban(callback: () => void): void {
+ // Save the callback for later usage.
+ // We cannot easily give the callback to the dialog.
+ this.banCallback = callback;
- UiDialog.open(this);
- }
+ UiDialog.open(this);
+ }
- unban(callback: () => void): void {
- Ajax.api(
- {
- _ajaxSetup: () => {
- return {
- data: {
- actionName: "unban",
- className: "wcf\\data\\user\\UserAction",
- objectIDs: this.userIDs,
- },
- };
- },
- _ajaxSuccess: callback,
- }
- );
- }
+ public unban(callback: () => void): void {
+ Ajax.api({
+ _ajaxSetup: () => {
+ return {
+ data: {
+ actionName: "unban",
+ className: "wcf\\data\\user\\UserAction",
+ objectIDs: this.userIDs,
+ },
+ };
+ },
+ _ajaxSuccess: callback,
+ });
+ }
- private banSubmit(reason: string, userBanExpires: string): void {
- Ajax.api(
- {
- _ajaxSetup: () => {
- return {
- data: {
- actionName: "ban",
- className: "wcf\\data\\user\\UserAction",
- objectIDs: this.userIDs,
- parameters: {
- 'banReason': reason,
- 'banExpires': userBanExpires,
- },
- },
- };
+ private banSubmit(reason: string, userBanExpires: string): void {
+ Ajax.api({
+ _ajaxSetup: () => {
+ return {
+ data: {
+ actionName: "ban",
+ className: "wcf\\data\\user\\UserAction",
+ objectIDs: this.userIDs,
+ parameters: {
+ banReason: reason,
+ banExpires: userBanExpires,
},
- _ajaxSuccess: this.banCallback,
- }
- );
- }
+ },
+ };
+ },
+ _ajaxSuccess: this.banCallback,
+ });
+ }
- _dialogSetup(): ReturnType<DialogCallbackSetup> {
- return {
- id: "userBanHandler",
- options: {
- onShow: (content: HTMLElement): void => {
- const submit = content.querySelector(".formSubmitButton")! as HTMLElement;
- const neverExpires = content.querySelector("#userBanNeverExpires")! as HTMLInputElement;
- const userBanExpiresSettings = content.querySelector("#userBanExpiresSettings")! as HTMLElement;
+ _dialogSetup(): ReturnType<DialogCallbackSetup> {
+ return {
+ id: "userBanHandler",
+ options: {
+ onSetup: (content: HTMLElement): void => {
+ const submit = content.querySelector(".formSubmitButton")! as HTMLElement;
+ const neverExpires = content.querySelector("#userBanNeverExpires")! as HTMLInputElement;
+ const userBanExpiresSettings = content.querySelector("#userBanExpiresSettings")! as HTMLElement;
- submit.addEventListener("click", (event) => {
- event.preventDefault();
+ submit.addEventListener("click", (event) => {
+ event.preventDefault();
- const reason = content.querySelector("#userBanReason")! as HTMLInputElement;
- const neverExpires = content.querySelector("#userBanNeverExpires")! as HTMLInputElement;
- const userBanExpires = content.querySelector("#userBanExpiresDatePicker")! as HTMLInputElement;
+ const reason = content.querySelector("#userBanReason")! as HTMLInputElement;
+ const neverExpires = content.querySelector("#userBanNeverExpires")! as HTMLInputElement;
+ const userBanExpires = content.querySelector("#userBanExpiresDatePicker")! as HTMLInputElement;
- this.banSubmit(reason.value, neverExpires.checked ? "" : userBanExpires.value);
+ this.banSubmit(reason.value, neverExpires.checked ? "" : userBanExpires.value);
- UiDialog.close(this);
+ UiDialog.close(this);
- reason.value = "";
- neverExpires.checked = true;
- // @TODO empty userBanExpires
- userBanExpiresSettings.style.setProperty("display", "none", "");
- });
+ reason.value = "";
+ neverExpires.checked = true;
+ // @TODO empty userBanExpires
+ userBanExpiresSettings.style.setProperty("display", "none", "");
+ });
- neverExpires.addEventListener("change", (event) => {
- const checkbox = event.currentTarget as HTMLInputElement;
- if (checkbox.checked) {
- userBanExpiresSettings.style.setProperty("display", "none", "");
- }
- else {
- userBanExpiresSettings.style.removeProperty("display");
- }
- });
- },
- title: Language.get('wcf.acp.user.ban.sure'),
- },
- source: `<div class="section">
+ neverExpires.addEventListener("change", (event) => {
+ const checkbox = event.currentTarget as HTMLInputElement;
+ if (checkbox.checked) {
+ userBanExpiresSettings.style.setProperty("display", "none", "");
+ } else {
+ userBanExpiresSettings.style.removeProperty("display");
+ }
+ });
+ },
+ title: Language.get("wcf.acp.user.ban.sure"),
+ },
+ source: `<div class="section">
<dl>
- <dt><label for="userBanReason">${Language.get('wcf.acp.user.banReason')}</label></dt>
+ <dt><label for="userBanReason">${Language.get("wcf.acp.user.banReason")}</label></dt>
<dd>
<textarea id="userBanReason" cols="40" rows="3" class=""></textarea>
- <small>${Language.get('wcf.acp.user.banReason.description')}</small>
+ <small>${Language.get("wcf.acp.user.banReason.description")}</small>
</dd>
</dl>
<dl>
<dd>
<label for="userBanNeverExpires">
<input type="checkbox" name="userBanNeverExpires" id="userBanNeverExpires" checked="">
- ${Language.get('wcf.acp.user.ban.neverExpires')}
+ ${Language.get("wcf.acp.user.ban.neverExpires")}
</label>
</dd>
</dl>
<dl id="userBanExpiresSettings" style="display: none;">
<dt>
- <label for="userBanExpires">${Language.get('wcf.acp.user.ban.expires')}</label>
+ <label for="userBanExpires">${Language.get("wcf.acp.user.ban.expires")}</label>
</dt>
<dd>
<div class="inputAddon">
data-ignore-timezone="true"
/>
</div>
- <small>${Language.get('wcf.acp.user.ban.expires.description')}</small>
+ <small>${Language.get("wcf.acp.user.ban.expires.description")}</small>
</dd>
</dl>
</div>
<div class="formSubmit dialogFormSubmit">
- <button class="buttonPrimary formSubmitButton" accesskey="s">${Language.get('wcf.global.button.submit')}</button>
+ <button class="buttonPrimary formSubmitButton" accesskey="s">${Language.get(
+ "wcf.global.button.submit",
+ )}</button>
</div>`,
- };
- }
+ };
+ }
}
-export default BanHandler;
\ No newline at end of file
+export default BanHandler;
-import * as Language from "../../../../../Language";
-import * as UiConfirmation from "../../../../../Ui/Confirmation";
-import * as Ajax from "../../../../../Ajax";
-import { CallbackSuccess } from "../../../../../Ajax/Data";
-
/**
* @author Joshua Ruesweg
* @copyright 2001-2021 WoltLab GmbH
* @module WoltLabSuite/Core/Acp/Ui/User/Action/Handler
* @since 5.5
*/
+
+import * as Language from "../../../../../Language";
+import * as UiConfirmation from "../../../../../Ui/Confirmation";
+import * as Ajax from "../../../../../Ajax";
+import { CallbackSuccess } from "../../../../../Ajax/Data";
+
export class Delete {
private userIDs: number[];
private successCallback: CallbackSuccess;
this.successCallback = successCallback;
if (deleteMessage) {
this.deleteMessage = deleteMessage;
- }
- else {
+ } else {
this.deleteMessage = Language.get("wcf.button.delete.confirmMessage"); // @todo find better variable for a generic message
}
}
- delete(): void {
+ public delete(): void {
UiConfirmation.show({
confirm: () => {
- Ajax.api(
- {
- _ajaxSetup: () => {
- return {
- data: {
- actionName: "delete",
- className: "wcf\\data\\user\\UserAction",
- objectIDs: this.userIDs,
- },
- };
- },
- _ajaxSuccess: this.successCallback,
- }
- );
+ Ajax.apiOnce({
+ data: {
+ actionName: "delete",
+ className: "wcf\\data\\user\\UserAction",
+ objectIDs: this.userIDs,
+ },
+ success: this.successCallback,
+ });
},
message: this.deleteMessage,
messageIsHtml: true,
+/**
+ * @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
+ */
+
import * as Language from "../../../../../Language";
import * as UiConfirmation from "../../../../../Ui/Confirmation";
import AcpUiWorker from "../../../Worker";
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;
-import AbstractUserAction from "./AbstractUserAction";
-import SendNewPassword from "./Handler/SendNewPassword";
-
/**
* @author Joshua Ruesweg
* @copyright 2001-2021 WoltLab GmbH
* @module WoltLabSuite/Core/Acp/Ui/User/Action
* @since 5.5
*/
+
+import AbstractUserAction from "./AbstractUserAction";
+import SendNewPassword from "./Handler/SendNewPassword";
+
export class SendNewPasswordAction extends AbstractUserAction {
- protected init() {
+ protected init(): void {
this.button.addEventListener("click", (event) => {
event.preventDefault();
-import AbstractUserAction from "./AbstractUserAction";
-import * as Ajax from "../../../../Ajax";
-import * as Core from "../../../../Core";
-import { AjaxCallbackObject, DatabaseObjectActionResponse } from "../../../../Ajax/Data";
-import * as UiNotification from "../../../../Ui/Notification";
-
/**
* @author Joshua Ruesweg
* @copyright 2001-2021 WoltLab GmbH
* @module WoltLabSuite/Core/Acp/Ui/User/Action
* @since 5.5
*/
+
+import AbstractUserAction from "./AbstractUserAction";
+import * as Ajax from "../../../../Ajax";
+import * as Core from "../../../../Core";
+import { AjaxCallbackSetup, DatabaseObjectActionResponse } from "../../../../Ajax/Data";
+import * as UiNotification from "../../../../Ui/Notification";
+
export class ToggleConfirmEmailAction extends AbstractUserAction {
- protected init() {
+ protected init(): void {
this.button.addEventListener("click", (event) => {
event.preventDefault();
+ const isEmailConfirmed = Core.stringToBool(this.userDataElement.dataset.emailConfirmed!);
- Ajax.api(
- {
- _ajaxSetup: () => {
- const isEmailConfirmed = Core.stringToBool(this.userData.dataset.emailConfirmed!);
-
- return {
- data: {
- actionName: (isEmailConfirmed ? "un" : "") + "confirmEmail",
- className: "wcf\\data\\user\\UserAction",
- objectIDs: [this.userId],
- },
- };
- },
-
- _ajaxSuccess: (data: DatabaseObjectActionResponse) => {
- if (data.objectIDs.includes(this.userId)) {
- switch (data.actionName) {
- case "confirmEmail":
- this.userData.dataset.emailConfirmed = "true";
- this.button.textContent = this.button.dataset.unconfirmEmailMessage!;
- break;
-
- case "unconfirmEmail":
- this.userData.dataset.emailConfirmed = "false";
- this.button.textContent = this.button.dataset.confirmEmailMessage!;
- break;
-
- default:
- throw new Error("Unreachable");
- }
- }
-
- UiNotification.show();
- },
- }
- );
+ Ajax.api(this, {
+ actionName: (isEmailConfirmed ? "un" : "") + "confirmEmail",
+ });
});
}
+
+ _ajaxSetup(): ReturnType<AjaxCallbackSetup> {
+ return {
+ data: {
+ className: "wcf\\data\\user\\UserAction",
+ objectIDs: [this.userId],
+ },
+ };
+ }
+
+ _ajaxSuccess(data: DatabaseObjectActionResponse): void {
+ if (data.objectIDs.includes(this.userId)) {
+ switch (data.actionName) {
+ case "confirmEmail":
+ this.userDataElement.dataset.emailConfirmed = "true";
+ this.button.textContent = this.button.dataset.unconfirmEmailMessage!;
+ break;
+
+ case "unconfirmEmail":
+ this.userDataElement.dataset.emailConfirmed = "false";
+ this.button.textContent = this.button.dataset.confirmEmailMessage!;
+ break;
+
+ default:
+ throw new Error("Unreachable");
+ }
+ }
+
+ UiNotification.show();
+ }
}
export default ToggleConfirmEmailAction;
// inject buttons
const items: HTMLLIElement[] = [];
- let deleteButton: HTMLAnchorElement | null = null;
Array.from(legacyButtonContainer.children).forEach((button: HTMLAnchorElement) => {
const item = document.createElement("li");
item.className = "jsLegacyItem";
}
}
-export = AcpUiUserEditor;
\ No newline at end of file
+export = AcpUiUserEditor;
<ul>
{if $action === 'edit'}
<li>
- <div class="dropdown"
- id="userListDropdown{@$user->userID}"
- data-object-id="{@$user->getObjectID()}"
- data-banned="{if $user->banned}true{else}false{/if}"
- data-enabled="{if !$user->activationCode}true{else}false{/if}"
- data-email-confirmed="{if $user->isEmailConfirmed()}true{else}false{/if}"
- >
- <a href="#" class="dropdownToggle button"><span class="icon icon16 fa-pencil"></span> <span>{lang}wcf.global.button.edit{/lang}</span></a>
+ <div class="dropdown"{*
+ *}id="userListDropdown{@$user->userID}" {*
+ *}data-object-id="{@$user->getObjectID()}" {*
+ *}data-banned="{if $user->banned}true{else}false{/if}" {*
+ *}data-enabled="{if !$user->activationCode}true{else}false{/if}" {*
+ *}data-email-confirmed="{if $user->isEmailConfirmed()}true{else}false{/if}" {*
+ *}>
+ <a href="#" class="dropdownToggle button">
+ <span class="icon icon16 fa-pencil"></span>
+ <span>{lang}wcf.global.button.edit{/lang}</span>
+ </a>
<ul class="dropdownMenu">
{event name='dropdownItems'}
{if $user->userID !== $__wcf->user->userID}
{if $__wcf->session->getPermission('admin.user.canEnableUser')}
- <li><a href="#" class="jsEnable" data-enable-message="{lang}wcf.acp.user.enable{/lang}" data-disable-message="{lang}wcf.acp.user.disable{/lang}">{lang}wcf.acp.user.{if !$user->activationCode}disable{else}enable{/if}{/lang}</a></li>
+ <li>
+ <a {*
+ *}href="#" {*
+ *}class="jsEnable" {*
+ *}data-enable-message="{lang}wcf.acp.user.enable{/lang}" {*
+ *}data-disable-message="{lang}wcf.acp.user.disable{/lang}"{*
+ *}>
+ {lang}wcf.acp.user.{if !$user->activationCode}disable{else}enable{/if}{/lang}
+ </a>
+ </li>
{/if}
{if $__wcf->session->getPermission('admin.user.canEnableUser')}
- <li><a href="#" class="jsConfirmEmailToggle" data-confirm-email-message="{lang}wcf.acp.user.action.confirmEmail{/lang}" data-unconfirm-email-message="{lang}wcf.acp.user.action.unconfirmEmail{/lang}">{lang}wcf.acp.user.action.{if $user->isEmailConfirmed()}un{/if}confirmEmail{/lang}</a></li>
+ <li>
+ <a href="#" {*
+ *}class="jsConfirmEmailToggle" {*
+ *}data-confirm-email-message="{lang}wcf.acp.user.action.confirmEmail{/lang}" {*
+ *}data-unconfirm-email-message="{lang}wcf.acp.user.action.unconfirmEmail{/lang}"{*
+ *}>
+ {lang}wcf.acp.user.action.{if $user->isEmailConfirmed()}un{/if}confirmEmail{/lang}
+ </a>
+ </li>
{/if}
{if $__wcf->session->getPermission('admin.user.canMailUser')}
- <li><a href="{link controller='UserMail' id=$user->userID}{/link}">{lang}wcf.acp.user.action.sendMail{/lang}</a></li>
+ <li>
+ <a {*
+ *}href="{link controller='UserMail' id=$user->userID}{/link}"{*
+ *}>
+ {lang}wcf.acp.user.action.sendMail{/lang}
+ </a>
+ </li>
{/if}
{if $__wcf->session->getPermission('admin.user.canEditPassword')}
- <li><a href="#" class="jsSendNewPassword">{lang}wcf.acp.user.action.sendNewPassword{/lang}</a></li>
+ <li>
+ <a {*
+ *}href="#" {*
+ *}class="jsSendNewPassword"{*
+ *}>
+ {lang}wcf.acp.user.action.sendNewPassword{/lang}
+ </a>
+ </li>
{/if}
{/if}
{if $__wcf->session->getPermission('admin.user.canExportGdprData')}
- <li><a href="{link controller='UserExportGdpr' id=$user->userID}{/link}">{lang}wcf.acp.user.exportGdpr{/lang}</a></li>
+ <li
+ <a {*
+ *}href="{link controller='UserExportGdpr' id=$user->userID}{/link}"{*
+ *}>
+ {lang}wcf.acp.user.exportGdpr{/lang}
+ </a>
+ </li>
{/if}
{if $__wcf->session->getPermission('admin.user.canDeleteUser')}
+/**
+ * @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
+ * @since 5.5
+ */
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
constructor(button, userId, userDataElement) {
this.button = button;
this.userId = userId;
- this.userData = userDataElement;
+ this.userDataElement = userDataElement;
this.init();
}
}
+/**
+ * @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
+ * @since 5.5
+ */
define(["require", "exports", "tslib", "../../../../Core", "./AbstractUserAction", "./Handler/Ban", "../../../../Ui/Notification", "../../../../Event/Handler"], function (require, exports, tslib_1, Core, AbstractUserAction_1, Ban_1, UiNotification, EventHandler) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
Ban_1 = tslib_1.__importDefault(Ban_1);
UiNotification = tslib_1.__importStar(UiNotification);
EventHandler = tslib_1.__importStar(EventHandler);
- /**
- * @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
- * @since 5.5
- */
class BanAction extends AbstractUserAction_1.default {
init() {
this.banHandler = new Ban_1.default([this.userId]);
this.button.addEventListener("click", (event) => {
event.preventDefault();
- const isBanned = Core.stringToBool(this.userData.dataset.banned);
+ const isBanned = Core.stringToBool(this.userDataElement.dataset.banned);
if (isBanned) {
this.banHandler.unban(() => {
- this.userData.dataset.banned = "false";
+ this.userDataElement.dataset.banned = "false";
this.button.textContent = this.button.dataset.banMessage;
UiNotification.show();
EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
- userIds: [this.userId]
+ userIds: [this.userId],
});
});
}
else {
this.banHandler.ban(() => {
- this.userData.dataset.banned = "true";
+ this.userDataElement.dataset.banned = "true";
this.button.textContent = this.button.dataset.unbanMessage;
UiNotification.show();
EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
- userIds: [this.userId]
+ userIds: [this.userId],
});
});
}
+/**
+ * @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
+ * @since 5.5
+ */
define(["require", "exports", "tslib", "./AbstractUserAction", "./Handler/Delete"], function (require, exports, tslib_1, AbstractUserAction_1, Delete_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeleteAction = void 0;
AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
Delete_1 = tslib_1.__importDefault(Delete_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
- * @since 5.5
- */
class DeleteAction extends AbstractUserAction_1.default {
init() {
this.button.addEventListener("click", (event) => {
event.preventDefault();
- let deleteHandler = new Delete_1.default([this.userId], () => {
- this.userData.remove();
+ const deleteHandler = new Delete_1.default([this.userId], () => {
+ this.userDataElement.remove();
}, this.button.dataset.confirmMessage);
deleteHandler.delete();
});
+/**
+ * @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
+ * @since 5.5
+ */
define(["require", "exports", "tslib", "../../../../Ajax", "../../../../Core", "../../../../Ui/Notification", "./AbstractUserAction", "../../../../Event/Handler"], function (require, exports, tslib_1, Ajax, Core, UiNotification, AbstractUserAction_1, EventHandler) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
UiNotification = tslib_1.__importStar(UiNotification);
AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
EventHandler = tslib_1.__importStar(EventHandler);
- /**
- * @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
- * @since 5.5
- */
class DisableAction extends AbstractUserAction_1.default {
init() {
this.button.addEventListener("click", (event) => {
event.preventDefault();
- Ajax.api({
- _ajaxSetup: () => {
- const isEnabled = Core.stringToBool(this.userData.dataset.enabled);
- return {
- data: {
- actionName: (isEnabled ? "disable" : "enable"),
- className: "wcf\\data\\user\\UserAction",
- objectIDs: [this.userId],
- },
- };
- },
- _ajaxSuccess: (data) => {
- if (data.objectIDs.includes(this.userId)) {
- switch (data.actionName) {
- case "enable":
- this.userData.dataset.enabled = "true";
- this.button.textContent = this.button.dataset.disableMessage;
- break;
- case "disable":
- this.userData.dataset.enabled = "false";
- this.button.textContent = this.button.dataset.enableMessage;
- break;
- default:
- throw new Error("Unreachable");
- }
- }
- UiNotification.show();
- EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
- userIds: [this.userId]
- });
- },
+ const isEnabled = Core.stringToBool(this.userDataElement.dataset.enabled);
+ Ajax.api(this, {
+ actionName: isEnabled ? "disable" : "enable",
});
});
}
+ _ajaxSetup() {
+ return {
+ data: {
+ className: "wcf\\data\\user\\UserAction",
+ objectIDs: [this.userId],
+ },
+ };
+ }
+ _ajaxSuccess(data) {
+ if (data.objectIDs.includes(this.userId)) {
+ switch (data.actionName) {
+ case "enable":
+ this.userDataElement.dataset.enabled = "true";
+ this.button.textContent = this.button.dataset.disableMessage;
+ break;
+ case "disable":
+ this.userDataElement.dataset.enabled = "false";
+ this.button.textContent = this.button.dataset.enableMessage;
+ break;
+ default:
+ throw new Error("Unreachable");
+ }
+ }
+ UiNotification.show();
+ EventHandler.fire("com.woltlab.wcf.acp.user", "refresh", {
+ userIds: [this.userId],
+ });
+ }
}
exports.DisableAction = DisableAction;
exports.default = DisableAction;
+/**
+ * @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
+ */
define(["require", "exports", "tslib", "../../../../../Language", "../../../../../Ajax", "../../../../../Ui/Dialog"], function (require, exports, tslib_1, Language, Ajax, Dialog_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
Language = tslib_1.__importStar(Language);
Ajax = tslib_1.__importStar(Ajax);
Dialog_1 = tslib_1.__importDefault(Dialog_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 BanHandler {
constructor(userIDs) {
this.userIDs = userIDs;
className: "wcf\\data\\user\\UserAction",
objectIDs: this.userIDs,
parameters: {
- 'banReason': reason,
- 'banExpires': userBanExpires,
+ banReason: reason,
+ banExpires: userBanExpires,
},
},
};
return {
id: "userBanHandler",
options: {
- onShow: (content) => {
+ onSetup: (content) => {
const submit = content.querySelector(".formSubmitButton");
const neverExpires = content.querySelector("#userBanNeverExpires");
const userBanExpiresSettings = content.querySelector("#userBanExpiresSettings");
}
});
},
- title: Language.get('wcf.acp.user.ban.sure'),
+ title: Language.get("wcf.acp.user.ban.sure"),
},
source: `<div class="section">
<dl>
- <dt><label for="userBanReason">${Language.get('wcf.acp.user.banReason')}</label></dt>
+ <dt><label for="userBanReason">${Language.get("wcf.acp.user.banReason")}</label></dt>
<dd>
<textarea id="userBanReason" cols="40" rows="3" class=""></textarea>
- <small>${Language.get('wcf.acp.user.banReason.description')}</small>
+ <small>${Language.get("wcf.acp.user.banReason.description")}</small>
</dd>
</dl>
<dl>
<dd>
<label for="userBanNeverExpires">
<input type="checkbox" name="userBanNeverExpires" id="userBanNeverExpires" checked="">
- ${Language.get('wcf.acp.user.ban.neverExpires')}
+ ${Language.get("wcf.acp.user.ban.neverExpires")}
</label>
</dd>
</dl>
<dl id="userBanExpiresSettings" style="display: none;">
<dt>
- <label for="userBanExpires">${Language.get('wcf.acp.user.ban.expires')}</label>
+ <label for="userBanExpires">${Language.get("wcf.acp.user.ban.expires")}</label>
</dt>
<dd>
<div class="inputAddon">
data-ignore-timezone="true"
/>
</div>
- <small>${Language.get('wcf.acp.user.ban.expires.description')}</small>
+ <small>${Language.get("wcf.acp.user.ban.expires.description")}</small>
</dd>
</dl>
</div>
<div class="formSubmit dialogFormSubmit">
- <button class="buttonPrimary formSubmitButton" accesskey="s">${Language.get('wcf.global.button.submit')}</button>
+ <button class="buttonPrimary formSubmitButton" accesskey="s">${Language.get("wcf.global.button.submit")}</button>
</div>`,
};
}
+/**
+ * @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
+ */
define(["require", "exports", "tslib", "../../../../../Language", "../../../../../Ui/Confirmation", "../../../../../Ajax"], function (require, exports, tslib_1, Language, UiConfirmation, Ajax) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
Language = tslib_1.__importStar(Language);
UiConfirmation = tslib_1.__importStar(UiConfirmation);
Ajax = tslib_1.__importStar(Ajax);
- /**
- * @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 Delete {
constructor(userIDs, successCallback, deleteMessage) {
this.userIDs = userIDs;
delete() {
UiConfirmation.show({
confirm: () => {
- Ajax.api({
- _ajaxSetup: () => {
- return {
- data: {
- actionName: "delete",
- className: "wcf\\data\\user\\UserAction",
- objectIDs: this.userIDs,
- },
- };
+ Ajax.apiOnce({
+ data: {
+ actionName: "delete",
+ className: "wcf\\data\\user\\UserAction",
+ objectIDs: this.userIDs,
},
- _ajaxSuccess: this.successCallback,
+ success: this.successCallback,
});
},
message: this.deleteMessage,
+/**
+ * @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
+ */
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 });
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;
+/**
+ * @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
+ * @since 5.5
+ */
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;
AbstractUserAction_1 = tslib_1.__importDefault(AbstractUserAction_1);
SendNewPassword_1 = tslib_1.__importDefault(SendNewPassword_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
- * @since 5.5
- */
class SendNewPasswordAction extends AbstractUserAction_1.default {
init() {
this.button.addEventListener("click", (event) => {
+/**
+ * @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
+ * @since 5.5
+ */
define(["require", "exports", "tslib", "./AbstractUserAction", "../../../../Ajax", "../../../../Core", "../../../../Ui/Notification"], function (require, exports, tslib_1, AbstractUserAction_1, Ajax, Core, UiNotification) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
Ajax = tslib_1.__importStar(Ajax);
Core = tslib_1.__importStar(Core);
UiNotification = tslib_1.__importStar(UiNotification);
- /**
- * @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
- * @since 5.5
- */
class ToggleConfirmEmailAction extends AbstractUserAction_1.default {
init() {
this.button.addEventListener("click", (event) => {
event.preventDefault();
- Ajax.api({
- _ajaxSetup: () => {
- const isEmailConfirmed = Core.stringToBool(this.userData.dataset.emailConfirmed);
- return {
- data: {
- actionName: (isEmailConfirmed ? "un" : "") + "confirmEmail",
- className: "wcf\\data\\user\\UserAction",
- objectIDs: [this.userId],
- },
- };
- },
- _ajaxSuccess: (data) => {
- if (data.objectIDs.includes(this.userId)) {
- switch (data.actionName) {
- case "confirmEmail":
- this.userData.dataset.emailConfirmed = "true";
- this.button.textContent = this.button.dataset.unconfirmEmailMessage;
- break;
- case "unconfirmEmail":
- this.userData.dataset.emailConfirmed = "false";
- this.button.textContent = this.button.dataset.confirmEmailMessage;
- break;
- default:
- throw new Error("Unreachable");
- }
- }
- UiNotification.show();
- },
+ const isEmailConfirmed = Core.stringToBool(this.userDataElement.dataset.emailConfirmed);
+ Ajax.api(this, {
+ actionName: (isEmailConfirmed ? "un" : "") + "confirmEmail",
});
});
}
+ _ajaxSetup() {
+ return {
+ data: {
+ className: "wcf\\data\\user\\UserAction",
+ objectIDs: [this.userId],
+ },
+ };
+ }
+ _ajaxSuccess(data) {
+ if (data.objectIDs.includes(this.userId)) {
+ switch (data.actionName) {
+ case "confirmEmail":
+ this.userDataElement.dataset.emailConfirmed = "true";
+ this.button.textContent = this.button.dataset.unconfirmEmailMessage;
+ break;
+ case "unconfirmEmail":
+ this.userDataElement.dataset.emailConfirmed = "false";
+ this.button.textContent = this.button.dataset.confirmEmailMessage;
+ break;
+ default:
+ throw new Error("Unreachable");
+ }
+ }
+ UiNotification.show();
+ }
}
exports.ToggleConfirmEmailAction = ToggleConfirmEmailAction;
exports.default = ToggleConfirmEmailAction;
dropdownMenu.querySelectorAll(".jsLegacyItem").forEach((element) => element.remove());
// inject buttons
const items = [];
- let deleteButton = null;
Array.from(legacyButtonContainer.children).forEach((button) => {
const item = document.createElement("li");
item.className = "jsLegacyItem";