From: Alexander Ebert Date: Sun, 6 Jan 2019 14:33:51 +0000 (+0100) Subject: Status icons for the ACP user list X-Git-Tag: 5.2.0_Alpha_1~296^2~64 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=47619e6ce011b5de142662ad5b492e80b4fc1fd4;p=GitHub%2FWoltLab%2FWCF.git Status icons for the ACP user list See #2693 --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index cc35dd1fd1..93c80b6bda 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -1941,6 +1941,13 @@ WCF.ACP.User.BanHandler = { * @param jQuery jqXHR */ _success: function(data, textStatus, jqXHR) { + elBySelAll('.jsUserRow', undefined, function(userRow) { + var userId = parseInt(elData(userRow, 'object-id'), 10); + if (data.objectIDs.indexOf(userId) !== -1) { + elData(userRow, 'banned', data.actionName === 'ban'); + } + }); + $('.jsBanButton').each(function(index, button) { var $button = $(button); if (WCF.inArray($button.data('objectID'), data.objectIDs)) { @@ -1961,6 +1968,8 @@ WCF.ACP.User.BanHandler = { if (data.actionName == 'ban') { this._dialog.wcfDialog('close'); } + + WCF.System.Event.fireEvent('com.woltlab.wcf.acp.user', 'refresh', {userIds: data.objectIDs}); } }; @@ -2102,6 +2111,13 @@ WCF.ACP.User.EnableHandler = { * @param jQuery jqXHR */ _success: function(data, textStatus, jqXHR) { + elBySelAll('.jsUserRow', undefined, function(userRow) { + var userId = parseInt(elData(userRow, 'object-id'), 10); + if (data.objectIDs.indexOf(userId) !== -1) { + elData(userRow, 'enabled', data.actionName === 'enable'); + } + }); + $('.jsEnableButton').each(function(index, button) { var $button = $(button); if (WCF.inArray($button.data('objectID'), data.objectIDs)) { @@ -2116,6 +2132,8 @@ WCF.ACP.User.EnableHandler = { var $notification = new WCF.System.Notification(); $notification.show(function() { window.location.reload(); }); + + WCF.System.Event.fireEvent('com.woltlab.wcf.acp.user', 'refresh', {userIds: data.objectIDs}); } }; diff --git a/wcfsetup/install/files/acp/templates/userList.tpl b/wcfsetup/install/files/acp/templates/userList.tpl index 9ed63fc807..7bf351cdac 100644 --- a/wcfsetup/install/files/acp/templates/userList.tpl +++ b/wcfsetup/install/files/acp/templates/userList.tpl @@ -31,7 +31,9 @@ 'wcf.acp.user.ban.neverExpires': '{lang}wcf.acp.user.ban.neverExpires{/lang}', 'wcf.acp.user.sendNewPassword.workerTitle': '{lang}wcf.acp.user.sendNewPassword.workerTitle{/lang}', 'wcf.acp.worker.abort.confirmMessage': '{lang}wcf.acp.worker.abort.confirmMessage{/lang}', - 'wcf.acp.content.removeContent': '{lang}wcf.acp.content.removeContent{/lang}' + 'wcf.acp.content.removeContent': '{lang}wcf.acp.content.removeContent{/lang}', + 'wcf.user.status.banned': '{lang}wcf.user.status.banned{/lang}', + 'wcf.user.status.isDisabled': '{lang}wcf.user.status.isDisabled{/lang}' }); WCF.ACP.User.BanHandler.init(); @@ -163,11 +165,19 @@ {@$user->userID} {@$user->getAvatar()->getImageTag(24)} - {if $user->editable} - {$user->username} - {else} - {$user->username} - {/if} + + {if $user->editable} + {$user->username} + {else} + {$user->username} + {/if} + + + + {if $user->banned}{/if} + {if $user->activationCode != 0}{/if} + + {if MODULE_USER_RANK} {if $user->getUserTitle()} {$user->getUserTitle()}{/if} {if $user->getRank() && $user->getRank()->rankImage} {@$user->getRank()->getImage()}{/if} diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Editor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Editor.js index 9f5e0ea093..24bbef91af 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Editor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/User/Editor.js @@ -19,6 +19,8 @@ define(['Ajax', 'Core', 'EventHandler', 'Language', 'Ui/SimpleDropdown', 'WoltLa */ init: function () { elBySelAll('.jsUserRow', undefined, this._initUser.bind(this)); + + EventHandler.add('com.woltlab.wcf.acp.user', 'refresh', this._refreshUsers.bind(this)); }, /** @@ -144,6 +146,39 @@ define(['Ajax', 'Core', 'EventHandler', 'Language', 'Ui/SimpleDropdown', 'WoltLa hasItem = true; } } + }, + + _refreshUsers: function (data) { + elBySelAll('.jsUserRow', undefined, function(userRow) { + var userId = parseInt(elData(userRow, 'object-id')); + if (data.userIds.indexOf(userId) !== -1) { + var userStatusIcons = elBySel('.userStatusIcons', userRow); + + var banned = elDataBool(userRow, 'banned'); + var iconBanned = elBySel('.jsUserStatusBanned', userRow); + if (banned && iconBanned === null) { + iconBanned = elCreate('span'); + iconBanned.className = 'icon icon16 fa-lock jsUserStatusBanned jsTooltip'; + iconBanned.title = Language.get('wcf.user.status.banned'); + userStatusIcons.insertBefore(iconBanned, null); + } + else if (!banned && iconBanned !== null) { + elRemove(iconBanned); + } + + var isDisabled = elDataBool(userRow, 'enabled') === false; + var iconIsDisabled = elBySel('.jsUserStatusIsDisabled', userRow); + if (isDisabled && iconIsDisabled === null) { + iconIsDisabled = elCreate('span'); + iconIsDisabled.className = 'icon icon16 fa-power-off jsUserStatusIsDisabled jsTooltip'; + iconIsDisabled.title = Language.get('wcf.user.status.isDisabled'); + userStatusIcons.appendChild(iconIsDisabled); + } + else if (!isDisabled && iconIsDisabled !== null) { + elRemove(iconIsDisabled); + } + } + }) } }; }); diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 5b497ab9fa..00a2655850 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -4456,6 +4456,8 @@ sich{/if} nicht bei uns registriert {if LANGUAGE_USE_INFORMAL_VARIANT}hast{else} + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 6b4d6938e9..cd8096444f 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -4453,6 +4453,8 @@ not register with us.]]> + +