Remove `WCF.UserPanel` (#4316)
authorMatthias Schmidt <gravatronics@live.com>
Sun, 20 Jun 2021 11:38:00 +0000 (13:38 +0200)
committerGitHub <noreply@github.com>
Sun, 20 Jun 2021 11:38:00 +0000 (13:38 +0200)
This component has been deprecated for many years since 611bfec845fba517504f186d7c97dc6c559f8f7d.

wcfsetup/install/files/js/WCF.js

index 05a1c1fe6a65d17ac256ddf18b66da27a288efd4..094e6041c2da048fe1d53281287757537be1bf05 100755 (executable)
@@ -7127,185 +7127,6 @@ WCF.Language.Chooser = Class.extend({
  */
 WCF.Style = { };
 
-/**
- * Converts static user panel items into interactive dropdowns.
- * 
- * @deprecated 2.1 - Please use WCF.User.Panel.Interactive instead
- * 
- * @param      string          containerID
- */
-WCF.UserPanel = Class.extend({
-       /**
-        * target container
-        * @var jQuery
-        */
-       _container: null,
-       
-       /**
-        * initialization state
-        * @var boolean
-        */
-       _didLoad: false,
-       
-       /**
-        * original link element
-        * @var jQuery
-        */
-       _link: null,
-       
-       /**
-        * language variable name for 'no items'
-        * @var string
-        */
-       _noItems: '',
-       
-       /**
-        * reverts to original link if return values are empty
-        * @var boolean
-        */
-       _revertOnEmpty: true,
-       
-       /**
-        * Initializes the WCF.UserPanel class.
-        * 
-        * @param       string          containerID
-        */
-       init: function(containerID) {
-               this._container = $('#' + containerID);
-               this._didLoad = false;
-               this._revertOnEmpty = true;
-               
-               if (this._container.length != 1) {
-                       console.debug("[WCF.UserPanel] Unable to find container identified by '" + containerID + "', aborting.");
-                       return;
-               }
-               
-               this._convert();
-       },
-       
-       /**
-        * Converts link into an interactive dropdown menu.
-        */
-       _convert: function() {
-               this._container.addClass('dropdown');
-               this._link = this._container.children('a').remove();
-               
-               var $button = $('<a href="' + this._link.attr('href') + '" class="dropdownToggle">' + this._link.html() + '</a>').appendTo(this._container).click($.proxy(this._click, this));
-               var $dropdownMenu = $('<ul class="dropdownMenu" />').appendTo(this._container);
-               $('<li class="jsDropdownPlaceholder"><span>' + WCF.Language.get('wcf.global.loading') + '</span></li>').appendTo($dropdownMenu);
-               
-               this._addDefaultItems($dropdownMenu);
-               
-               this._container.dblclick($.proxy(function() {
-                       window.location = this._link.attr('href');
-                       return false;
-               }, this));
-               
-               WCF.Dropdown.initDropdown($button, false);
-       },
-       
-       /**
-        * Adds default items to dropdown menu.
-        * 
-        * @param       jQuery          dropdownMenu
-        */
-       _addDefaultItems: function(dropdownMenu) { },
-       
-       /**
-        * Adds a dropdown divider.
-        * 
-        * @param       jQuery          dropdownMenu
-        */
-       _addDivider: function(dropdownMenu) {
-               $('<li class="dropdownDivider" />').appendTo(dropdownMenu);
-       },
-       
-       /**
-        * Handles clicks on the dropdown item.
-        * 
-        * @param       object          event
-        */
-       _click: function(event) {
-               event.preventDefault();
-               
-               if (this._didLoad) {
-                       return;
-               }
-               
-               new WCF.Action.Proxy({
-                       autoSend: true,
-                       data: this._getParameters(),
-                       success: $.proxy(this._success, this)
-               });
-               
-               this._didLoad = true;
-       },
-       
-       /**
-        * Returns a list of parameters for AJAX request.
-        * 
-        * @return      object
-        */
-       _getParameters: function() {
-               return { };
-       },
-       
-       /**
-        * Handles successful AJAX requests.
-        * 
-        * @param       object          data
-        * @param       string          textStatus
-        * @param       jQuery          jqXHR
-        */
-       _success: function(data, textStatus, jqXHR) {
-               var $dropdownMenu = WCF.Dropdown.getDropdownMenu(this._container.wcfIdentify());
-               $dropdownMenu.children('.jsDropdownPlaceholder').remove();
-               
-               if (data.returnValues && data.returnValues.template) {
-                       $('' + data.returnValues.template).prependTo($dropdownMenu);
-                       
-                       // update badge
-                       this._updateBadge(data.returnValues.totalCount);
-                       
-                       this._after($dropdownMenu);
-               }
-               else {
-                       $('<li><span>' + WCF.Language.get(this._noItems) + '</span></li>').prependTo($dropdownMenu);
-                       
-                       // remove badge
-                       this._updateBadge(0);
-               }
-       },
-       
-       /**
-        * Updates badge count.
-        * 
-        * @param       integer         count
-        */
-       _updateBadge: function(count) {
-               count = parseInt(count) || 0;
-               
-               if (count) {
-                       var $badge = this._container.find('.badge');
-                       if (!$badge.length) {
-                               $badge = $('<span class="badge badgeUpdate" />').appendTo(this._container.children('.dropdownToggle'));
-                               $badge.before(' ');
-                       }
-                       $badge.html(count);
-               }
-               else {
-                       this._container.find('.badge').remove();
-               }
-       },
-       
-       /**
-        * Execute actions after the dropdown menu has been populated.
-        * 
-        * @param       object          dropdownMenu
-        */
-       _after: function(dropdownMenu) { }
-});
-
 jQuery.fn.extend({
        // shim for 'ui.wcfDialog'
        wcfDialog: function(method) {