From: Alexander Ebert Date: Mon, 8 Aug 2022 17:00:32 +0000 (+0200) Subject: Remove the legacy user panel X-Git-Tag: 6.0.0_Alpha_1~1048^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b433eb3580d56dc41dabc029324a3cc03c6ef3f1;p=GitHub%2FWoltLab%2FWCF.git Remove the legacy user panel --- diff --git a/com.woltlab.wcf/templateDelete.xml b/com.woltlab.wcf/templateDelete.xml index f92065e1e1..94ab04a98d 100644 --- a/com.woltlab.wcf/templateDelete.xml +++ b/com.woltlab.wcf/templateDelete.xml @@ -1,54 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/com.woltlab.wcf/templates/moderationQueueList.tpl b/com.woltlab.wcf/templates/moderationQueueList.tpl deleted file mode 100644 index b47d25449a..0000000000 --- a/com.woltlab.wcf/templates/moderationQueueList.tpl +++ /dev/null @@ -1,16 +0,0 @@ -{foreach from=$queues item=queue} -
  • -
    -
    - {@$queue->getUserProfile()->getAvatar()->getImageTag(48)} -
    -
    -

    - {$queue->getLabel()} - {$queue->getAffectedObject()->getTitle()} -

    - {if $queue->getUserProfile()->userID}{user object=$queue->getUserProfile()}{else}{$queue->getAffectedObject()->getUsername()}{/if} {@$queue->lastChangeTime|time} -
    -
    -
  • -{/foreach} diff --git a/com.woltlab.wcf/templates/notificationListUserPanel.tpl b/com.woltlab.wcf/templates/notificationListUserPanel.tpl deleted file mode 100644 index 924b98c762..0000000000 --- a/com.woltlab.wcf/templates/notificationListUserPanel.tpl +++ /dev/null @@ -1,18 +0,0 @@ -{foreach from=$notifications[notifications] item=notification} -
  • -
    -
    - {if $notification[event]->getAuthors()|count < 2} - {@$notification[event]->getAuthor()->getAvatar()->getImageTag(48)} - {else} - - {/if} -
    - -
    -

    {@$notification[event]->getMessage()}

    - {@$notification[time]|time} -
    -
    -
  • -{/foreach} diff --git a/com.woltlab.wcf/templates/user.tpl b/com.woltlab.wcf/templates/user.tpl index 361d97dc5f..b8faa99889 100644 --- a/com.woltlab.wcf/templates/user.tpl +++ b/com.woltlab.wcf/templates/user.tpl @@ -69,17 +69,7 @@ 'wcf.user.editProfile': '{jslang}wcf.user.editProfile{/jslang}' }); - var userProfileEditor = new WCF.User.Profile.Editor({@$user->userID}, {if $editOnInit}true{else}false{/if}); - {if $__wcf->getUser()->userID == $user->userID} - var editLink = elBySel('.interactiveDropdownItemsUserMenu .jsUserPanelEditProfile'); - if (editLink) { - editLink.addEventListener('click', function (event) { - userProfileEditor._beginEdit(event); - - WCF.CloseOverlayHandler.forceExecution(); - }); - } - {/if} + new WCF.User.Profile.Editor({@$user->userID}, {if $editOnInit}true{else}false{/if}); {/if} {if $followingCount > 7} diff --git a/wcfsetup/install/files/js/WCF.Moderation.js b/wcfsetup/install/files/js/WCF.Moderation.js index 424adb88c4..cde8278458 100644 --- a/wcfsetup/install/files/js/WCF.Moderation.js +++ b/wcfsetup/install/files/js/WCF.Moderation.js @@ -395,13 +395,6 @@ if (COMPILER_TARGET_DEFAULT) { * @param jQuery jqXHR */ _success: function (data, textStatus, jqXHR) { - // update dropdown - var dropdown = WCF.Dropdown.Interactive.Handler.getDropdown('outstandingModeration'); - if (dropdown) { - dropdown.getLinkList().find('.interactiveDropdownItemMarkAllAsRead').remove(); - dropdown.getItemList().find('.interactiveDropdownItemMarkAsRead').remove(); - } - // remove badge in userpanel $('#outstandingModeration .badgeUpdate').remove(); diff --git a/wcfsetup/install/files/js/WCF.User.js b/wcfsetup/install/files/js/WCF.User.js index 5d6a941042..ac92587ce2 100644 --- a/wcfsetup/install/files/js/WCF.User.js +++ b/wcfsetup/install/files/js/WCF.User.js @@ -8,455 +8,6 @@ * @license GNU Lesser General Public License */ -/** - * Namespace for User Panel classes. - */ -WCF.User.Panel = { }; - -if (COMPILER_TARGET_DEFAULT) { - /** - * Abstract implementation for user panel items providing an interactive dropdown. - * - * @param jQuery triggerElement - * @param string identifier - * @param object options - * @deprecated 5.5 Implement `WoltLabSuite/Core/Ui/User/Menu/Data/Provider` instead. - */ - WCF.User.Panel.Abstract = Class.extend({ - /** - * counter badge - * @var jQuery - */ - _badge: null, - - /** - * interactive dropdown instance - * @var WCF.Dropdown.Interactive.Instance - */ - _dropdown: null, - - /** - * dropdown identifier - * @var string - */ - _identifier: '', - - /** - * true if data should be loaded using an AJAX request - * @var boolean - */ - _loadData: true, - - /** - * header icon to mark all items belonging to this user panel item as read - * @var jQuery - */ - _markAllAsReadLink: null, - - /** - * list of options required to dropdown initialization and UI features - * @var object - */ - _options: {}, - - /** - * action proxy - * @var WCF.Action.Proxy - */ - _proxy: null, - - /** - * trigger element - * @var jQuery - */ - _triggerElement: null, - - /** - * @var Element - */ - _button: null, - - /** - * @var Function - */ - _callbackFocus: null, - - /** - * @var {string} - */ - _callbackCloseUuid: '', - - /** - * @var boolean - */ - _wasInsideDropdown: false, - - /** - * Initializes the WCF.User.Panel.Abstract class. - * - * @param jQuery triggerElement - * @param string identifier - * @param object options - */ - init: function (triggerElement, identifier, options) { - this._dropdown = null; - this._loadData = true; - this._identifier = identifier; - this._triggerElement = triggerElement; - this._options = options; - this._callbackFocus = null; - this._callbackCloseUuid = ''; - - this._proxy = new WCF.Action.Proxy({ - showLoadingOverlay: false, - success: $.proxy(this._success, this) - }); - - this._triggerElement.click($.proxy(this.toggle, this)); - this._button = elBySel('a', this._triggerElement[0]); - if (this._button) { - elAttr(this._button, 'role', 'button'); - elAttr(this._button, 'tabindex', '0'); - elAttr(this._button, 'aria-haspopup', true); - elAttr(this._button, 'aria-expanded', false); - } - - if (this._options.showAllLink) { - this._triggerElement.dblclick($.proxy(this._dblClick, this)); - } - - var $badge = this._triggerElement.find('span.badge'); - if ($badge.length) { - this._badge = $badge; - } - - require(["WoltLabSuite/Core/Event/Handler"], (EventHandler) => { - EventHandler.add("com.woltlab.wcf.pageMenu", "legacyMenu", (data) => { - data.panels.push({ - api: { - getDropdown: () => this._dropdown, - open: () => { - if (this._dropdown === null) { - this._dropdown = this._initDropdown(); - } - - this._dropdown.open(); - - if (!this._loadData) { - // check if there are outstanding items but there are no outstanding ones in the current list - if (this._badge !== null) { - var $count = parseInt(this._badge.text()) || 0; - if ($count && !this._dropdown.getItemList().children('.interactiveDropdownItemOutstanding').length) { - this._loadData = true; - } - } - } - - if (this._loadData) { - this._loadData = false; - this._load(); - } - }, - close: () => { - if (this._dropdown === null) { - this._dropdown = this._initDropdown(); - } - - this._dropdown.close(); - }, - }, - element: triggerElement[0], - }); - }); - }); - }, - - /** - * Toggles the interactive dropdown. - * - * @param {Event?} event - * @return {boolean} - */ - toggle: function (event) { - if (event instanceof Event) { - event.preventDefault(); - } - - if (this._dropdown === null) { - this._dropdown = this._initDropdown(); - } - - if (this._dropdown.toggle()) { - if (!this._loadData) { - // check if there are outstanding items but there are no outstanding ones in the current list - if (this._badge !== null) { - var $count = parseInt(this._badge.text()) || 0; - if ($count && !this._dropdown.getItemList().children('.interactiveDropdownItemOutstanding').length) { - this._loadData = true; - } - } - } - - if (this._loadData) { - this._loadData = false; - this._load(); - } - - elAttr(this._button, 'aria-expanded', true); - if (this._callbackFocus === null) { - this._callbackFocus = this._maintainFocus.bind(this); - } - document.body.addEventListener('focus', this._callbackFocus, { capture: true }); - - this._callbackCloseUuid = WCF.System.Event.addListener('WCF.Dropdown.Interactive.Instance', 'close', (function (data) { - if (data.instance === this._dropdown) { - WCF.System.Event.removeListener('WCF.Dropdown.Interactive.Instance', 'close', this._callbackCloseUuid); - document.body.removeEventListener('focus', this._callbackFocus, { capture: true }); - } - }).bind(this)); - } - else { - elAttr(this._button, 'aria-expanded', false); - - WCF.System.Event.removeListener('WCF.Dropdown.Interactive.Instance', 'close', this._callbackCloseUuid); - document.body.removeEventListener('focus', this._callbackFocus, { capture: true }); - } - - return false; - }, - - /** - * Forward to original URL by double clicking the trigger element. - * - * @param object event - * @return boolean - */ - _dblClick: function (event) { - event.preventDefault(); - - window.location = this._options.showAllLink; - - return false; - }, - - /** - * Initializes the dropdown on first usage. - * - * @return WCF.Dropdown.Interactive.Instance - */ - _initDropdown: function () { - var $dropdown = WCF.Dropdown.Interactive.Handler.create(this._triggerElement, this._identifier, this._options); - $('
  • ' + WCF.Language.get('wcf.global.loading') + '
  • ').appendTo($dropdown.getItemList()); - - return $dropdown; - }, - - /** - * Loads item list data via AJAX. - */ - _load: function () { - // override this in your own implementation to fetch display data - }, - - /** - * Handles successful AJAX requests. - * - * @param object data - */ - _success: function (data) { - if (data.returnValues.template !== undefined) { - var $itemList = this._dropdown.getItemList().empty(); - $(data.returnValues.template).appendTo($itemList); - - if (!$itemList.children().length) { - $('
  • ' + this._options.noItems + '
  • ').appendTo($itemList); - } - - if (this._options.enableMarkAsRead) { - var $outstandingItems = this._dropdown.getItemList().children('.interactiveDropdownItemOutstanding'); - if (this._markAllAsReadLink === null && $outstandingItems.length) { - var $button = this._markAllAsReadLink = $('
  • ').appendTo(this._dropdown.getLinkList()); - $button.click((function (event) { - this._dropdown.close(); - - this._markAllAsRead(); - - return false; - }).bind(this)); - } - - $outstandingItems.each((function (index, item) { - var $item = $(item).addClass('interactiveDropdownItemOutstandingIcon'); - var $objectID = $item.data('objectID'); - - var $button = $('
    ').appendTo($item); - $button.click((function (event) { - this._markAsRead(event, $objectID); - - return false; - }).bind(this)); - }).bind(this)); - } - - this._dropdown.getItemList().children().each(function (index, item) { - var $item = $(item); - var $link = $item.data('link'); - - if ($link) { - if ($.browser.msie) { - $item.click(function (event) { - if (event.target.tagName !== 'A') { - window.location = $link; - - return false; - } - }); - } - else { - $item.addClass('interactiveDropdownItemShadow'); - $('').appendTo($item); - } - - if ($item.data('linkReplaceAll')) { - $item.find('> .box48 a:not(.userLink)').prop('href', $link); - } - } - }); - - this._dropdown.rebuildScrollbar(); - } - - if (data.returnValues.totalCount !== undefined) { - this.updateBadge(data.returnValues.totalCount); - } - - if (this._options.enableMarkAsRead) { - if (data.returnValues.markAsRead) { - var $item = this._dropdown.getItemList().children('li[data-object-id=' + data.returnValues.markAsRead + ']'); - if ($item.length) { - $item.removeClass('interactiveDropdownItemOutstanding').data('isRead', true); - $item.children('.interactiveDropdownItemMarkAsRead').remove(); - } - } - else if (data.returnValues.markAllAsRead) { - this.resetItems(); - this.updateBadge(0); - } - } - }, - - /** - * Marks an item as read. - * - * @param object event - * @param integer objectID - */ - _markAsRead: function (event, objectID) { - // override this in your own implementation to mark an item as read - }, - - /** - * Marks all items as read. - */ - _markAllAsRead: function () { - // override this in your own implementation to mark all items as read - }, - - /** - * Updates the badge's count or removes it if count reaches zero. Passing a negative number is undefined. - * - * @param integer count - */ - updateBadge: function (count) { - count = parseInt(count) || 0; - - if (count) { - if (this._badge === null) { - this._badge = $('').appendTo(this._triggerElement.children('a')); - this._badge.before(' '); - } - - this._badge.text(count); - } - else if (this._badge !== null) { - this._badge.remove(); - this._badge = null; - } - - if (this._options.enableMarkAsRead) { - if (!count && this._markAllAsReadLink !== null) { - this._markAllAsReadLink.remove(); - this._markAllAsReadLink = null; - } - } - - WCF.System.Event.fireEvent('com.woltlab.wcf.userMenu', 'updateBadge', { - count: count, - identifier: this._identifier - }); - }, - - /** - * Resets the dropdown's inner item list. - */ - resetItems: function () { - // this method could be called from outside, but the dropdown was never - // toggled and thus never initialized - if (this._dropdown !== null) { - this._dropdown.resetItems(); - this._loadData = true; - } - }, - - /** - * @param {Event} event - */ - _maintainFocus: function(event) { - // Ignore a focus shift that was not the result of a keyboard interaction. - if (document.activeElement && !document.activeElement.classList.contains('focus-visible')) { - return; - } - - var dropdown = this._dropdown.getContainer()[0]; - - if (!dropdown.contains(event.target)) { - if (this._wasInsideDropdown) { - this._button.focus(); - this._wasInsideDropdown = false; - } - else { - elBySel('a', dropdown).focus(); - } - } - else { - this._wasInsideDropdown = true; - } - } - }); -} -else { - WCF.User.Panel.Abstract = Class.extend({ - _badge: {}, - _dropdown: {}, - _identifier: "", - _loadData: true, - _markAllAsReadLink: {}, - _options: {}, - _proxy: {}, - _triggerElement: {}, - init: function() {}, - toggle: function() {}, - _dblClick: function() {}, - _initDropdown: function() {}, - _load: function() {}, - _success: function() {}, - _markAsRead: function() {}, - _markAllAsRead: function() {}, - updateBadge: function() {}, - resetItems: function() {} - }); -} - /** * UserProfile namespace */ diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index d49fe2188d..a8923f88b7 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -955,344 +955,7 @@ WCF.Dropdown = { } }; -/** - * Namespace for interactive dropdowns. - */ -WCF.Dropdown.Interactive = { }; - if (COMPILER_TARGET_DEFAULT) { - /** - * General interface to create and manage interactive dropdowns. - * - * @deprecated 5.5 Use `WoltLabSuite/Core/Ui/User/Menu/Manager` instead. - */ - WCF.Dropdown.Interactive.Handler = { - /** - * global container for interactive dropdowns - * @var jQuery - */ - _dropdownContainer: null, - - /** - * list of dropdown instances by identifier - * @var object - */ - _dropdownMenus: {}, - - /** - * Creates a new interactive dropdown instance. - * - * @param jQuery triggerElement - * @param string identifier - * @param object options - * @return WCF.Dropdown.Interactive.Instance - */ - create: function (triggerElement, identifier, options) { - if (this._dropdownContainer === null) { - this._dropdownContainer = $('