Some minor improvements towards Plugin-Store integration
authorAlexander Ebert <ebert@woltlab.com>
Tue, 6 May 2014 19:39:57 +0000 (21:39 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 6 May 2014 19:39:57 +0000 (21:39 +0200)
wcfsetup/install/files/acp/js/WCF.ACP.js
wcfsetup/install/files/acp/templates/packageList.tpl
wcfsetup/install/files/lib/acp/page/PluginStorePurchasedItemsPage.class.php

index edb8cbcae95fac554fb4d796f19ef216ae47c722..2f73a8847cbb3fc9f5848c4c06ba2908406d545a 100644 (file)
@@ -1592,9 +1592,21 @@ WCF.ACP.PluginStore.PurchasedItems = { };
  * Searches for purchased items available for install but not yet installed.
  */
 WCF.ACP.PluginStore.PurchasedItems.Search = Class.extend({
+       /**
+        * dialog overlay
+        * @var jQuery
+        */
        _dialog: null,
+       
+       /**
+        * action proxy
+        * @var WCF.Action.Proxy
+        */
        _proxy: null,
        
+       /**
+        * Initializes the WCF.ACP.PluginStore.PurchasedItems.Search class.
+        */
        init: function() {
                this._dialog = null;
                this._proxy = new WCF.Action.Proxy({
@@ -1605,6 +1617,9 @@ WCF.ACP.PluginStore.PurchasedItems.Search = Class.extend({
                $button.prependTo($('.contentNavigation:eq(0) > nav > ul')).click($.proxy(this._click, this));
        },
        
+       /**
+        * Handles clicks on the search button.
+        */
        _click: function() {
                this._proxy.setOption('data', {
                        actionName: 'searchForPurchasedItems',
@@ -1613,7 +1628,15 @@ WCF.ACP.PluginStore.PurchasedItems.Search = Class.extend({
                this._proxy.sendRequest();
        },
        
+       /**
+        * Handles successful AJAX requests.
+        * 
+        * @param       object          data
+        * @param       string          textStatus
+        * @param       jQuery          jqXHR
+        */
        _success: function(data, textStatus, jqXHR) {
+               // prompt for credentials
                if (data.returnValues.template) {
                        if (this._dialog === null) {
                                this._dialog = $('<div />').hide().appendTo(document.body);
@@ -1635,15 +1658,20 @@ WCF.ACP.PluginStore.PurchasedItems.Search = Class.extend({
                        });
                }
                else if (data.returnValues.noResults) {
+                       // there are no purchased products yet
                        this._dialog.wcfDialog('option', 'title', WCF.Language.get('wcf.acp.pluginStore.purchasedItems'));
                        this._dialog.html(data.returnValues.noResults);
                        this._dialog.wcfDialog('open');
                }
                else if (data.returnValues.redirectURL) {
+                       // redirect to list of purchased products
                        window.location = data.returnValues.redirectURL;
                }
        },
        
+       /**
+        * Submits the user credentials.
+        */
        _submit: function() {
                this._dialog.wcfDialog('close');
                
index a9ea2c0b2b0dab8b2dfaae4a68ef619c25e04ea5..ccd9a002eb6c4a328256030ca5a5cb5a75058b4b 100644 (file)
@@ -27,7 +27,9 @@
                        new WCF.ACP.Package.Update.Search();
                {/if}
                
-               new WCF.ACP.PluginStore.PurchasedItems.Search();
+               {if $__wcf->session->getPermission('admin.system.package.canUpdatePackage') && $__wcf->session->getPermission('admin.system.package.canUninstallPackage')}
+                       new WCF.ACP.PluginStore.PurchasedItems.Search();
+               {/if}
        });
        //]]>
 </script>
index 0a7870ccce15bebd6cf887eddaf1f7cfbca2b323..85ca5d3ba36c3a6a04cb8991f03cca239eb60576 100644 (file)
@@ -29,15 +29,27 @@ class PluginStorePurchasedItemsPage extends AbstractPage {
        public $neededPermissions = array('admin.system.package.canUpdatePackage', 'admin.system.package.canUninstallPackage');
        
        /**
-        * list of purchased products grouped by WCF major release.
+        * list of purchased products grouped by WCF major release
         * @var array<array>
         */
        public $products = array();
        
+       /**
+        * list of product data grouped by WCF major release
+        * @var array<array>
+        */
        public $productData = array();
        
+       /**
+        * list of installed update servers (Plugin-Store only)
+        * @var array<\wcf\data\package\update\server\PackageUpdateServer>
+        */
        public $updateServers = array();
        
+       /**
+        * list of supported WCF major releases (Plugin-Store)
+        * @var array<string>
+        */
        public $wcfMajorReleases = array();
        
        /**