*/
WCF.ACP.Package = {};
-/**
- * Paginated package list.
- *
- * @param integer pages
- */
-WCF.ACP.Package.List = Class.extend({
- /**
- * page cache
- * @var object
- */
- _pages: {},
-
- /**
- * plugin list references
- * @var object
- */
- _pluginLists: [],
-
- /**
- * action proxy
- * @var WCF.Action.Proxy
- */
- _proxy: null,
-
- /**
- * target container
- * @var jQuery
- */
- _template: null,
-
- /**
- * Initializes the package list.
- *
- * @param integer pages
- */
- init: function(pages) {
- // handle pagination
- $('.jsPluginListPagination').each($.proxy(function(index, pluginList) {
- var $wcfPages = $(pluginList).wcfPages({
- activePage: 1,
- maxPage: pages
- }).bind('wcfpagesshouldswitch', $.proxy(this._cachePage, this)).bind('wcfpagesswitched', $.proxy(this._loadPage, this));
-
- this._pluginLists.push($wcfPages);
- }, this));
-
- // initialize
- if (this._pluginLists.length > 0) {
- this._proxy = new WCF.Action.Proxy({
- success: $.proxy(this._success, this)
- });
- this._template = $('#plugins ol');
- }
- },
-
- /**
- * Caches currently active page.
- *
- * @param object event
- * @param object data
- */
- _cachePage: function(event, data) {
- if (!this._pages[data.currentPage]) {
- this._pages[data.currentPage] = $('#plugins ol').html();
- }
- },
-
- /**
- * Loads the request page using AJAX.
- *
- * @param object event
- * @param object data
- */
- _loadPage: function(event, data) {
- // update active page
- for (var $i = 0, $size = this._pluginLists.length; $i < $size; $i++) {
- this._pluginLists[$i].wcfPages('switchPage', data.activePage);
- }
-
- // load page from cache if applicable
- if (this._pages[data.activePage]) {
- this._template.html(this._pages[data.activePage]);
- return;
- }
-
- // load content using AJAX
- this._proxy.setOption('data', {
- actionName: 'getPluginList',
- className: 'wcf\\data\\package\\PackageAction',
- parameters: {
- activePage: data.activePage
- }
- });
- this._proxy.sendRequest();
- },
-
- /**
- * Displays the fetched page.
- *
- * @param object data
- * @param string textStatus
- * @param jQuery jqXHR
- */
- _success: function(data, textStatus, jqXHR) {
- this._pages[data.returnValues.activePage] = data.returnValues.template;
- this._loadPage(null, { activePage: data.returnValues.activePage });
- }
-});
-
/**
* Provides the package installation.
*
+++ /dev/null
-{include file='header' pageTitle='wcf.acp.package.list'}
-
-<script type="text/javascript">
- //<![CDATA[
- $(function() {
- WCF.TabMenu.init();
-
- WCF.Language.add('wcf.acp.package.view.button.uninstall.sure', 'wcf.acp.package.view.button.uninstall.sure');
- new WCF.ACP.Package.Uninstallation($('.jsPackageContainer .jsUninstallButton'));
-
- {if $pluginsCount > 1}
- new WCF.ACP.Package.List({@($pluginsCount / 20)|ceil});
- {/if}
- });
- //]]>
-</script>
-
-<header class="boxHeadline">
- <hgroup>
- <h1>{lang}wcf.acp.package.list{/lang}</h1>
- </hgroup>
-</header>
-
-<div class="tabMenuContainer">
- <nav class="tabMenu">
- <ul>
- <li><a href="{@$__wcf->getAnchor('applications')}" title="applications">{lang}wcf.acp.package.application.title{/lang}</a></li>
- {if $plugins|count}<li><a href="{@$__wcf->getAnchor('plugins')}" title="plugins">{lang}wcf.acp.package.plugin.title{/lang}</a></li>{/if}
- </ul>
- </nav>
-
- <div id="applications" class="container containerPadding tabMenuContent hidden">
- <ol class="applicationList">
- {foreach from=$applications key=packageID item=package}
- <li>
- <fieldset>
- <legend>{$package->getName()}</legend>
-
- <div class="box96">
- <img src="{@$__wcf->getPath()}icon/wcfIcon1.svg" alt="" title="{$package->getName()}" class="icon96" />
- <dl>
- <dt>{lang}wcf.acp.package.identifier{/lang}</dt>
- <dd>{$package->package}</dd>
- </dl>
- <dl>
- <dt>{lang}wcf.acp.package.version{/lang}</dt>
- <dd>{$package->packageVersion}</dd>
- </dl>
- <dl>
- <dt>{lang}wcf.acp.package.packageDate{/lang}</dt>
- <dd>{$package->packageDate|date}</dd>
- </dl>
- <dl>
- <dt>{lang}wcf.acp.package.installDate{/lang}</dt>
- <dd>{@$package->installDate|time}</dd>
- </dl>
- <dl>
- <dt>{lang}wcf.acp.package.updateDate{/lang}</dt>
- <dd>{@$package->updateDate|time}</dd>
- </dl>
- <dl>
- <dt>{lang}wcf.acp.package.author{/lang}</dt>
- <dd>{if $package->authorURL}<a href="dereferrer.php?url={$package->authorURL|rawurlencode}">{/if}{$package->author}{if $package->authorURL}</a>{/if}</dd>
- </dl>
-
- <footer class="contentOptions clearfix">
- <nav>
- <ul class="smallButtons">
- <li><a href="{link controller='Package' id=$packageID}{/link}" class="button"><img src="{@$__wcf->getPath()}icon/info.svg" alt="" title="{lang}wcf.acp.package.button.info{/lang}" class="icon16" /> <span>{lang}wcf.acp.package.button.info{/lang}</span></a></li>
- <li><a href="{link controller='PackageStartInstall' id=$packageID}action=update{/link}" class="button"><img src="{@$__wcf->getPath()}icon/update.svg" alt="" title="{lang}wcf.acp.package.button.update{/lang}" class="icon16" /> <span>{lang}wcf.acp.package.button.update{/lang}</span></a></li>
- </ul>
- </nav>
- </footer>
- </div>
- </fieldset>
- </li>
- {/foreach}
- </ol>
- </div>
-
- {hascontent}
- <div id="plugins" class="container containerPadding tabMenuContent hidden">
- <div class="contentHeader jsPluginListPagination">
-
- </div>
-
- <section>
- <ol class="pluginList">
- {content}
- {include file='packageListPlugins'}
- {/content}
- </ol>
- </section>
-
- <div class="contentFooter jsPluginListPagination">
-
- </div>
- </div>
- {/hascontent}
-</div>
-
-<div class="contentNavigation">
- <nav>
- <ul>
- <li><a href="{link controller='PackageListDetailed'}{/link}" title="{lang}wcf.acp.menu.link.package.list{/lang}" class="button"><img src="{@$__wcf->getPath()}icon/list.svg" alt="" class="icon24" /> <span>{lang}wcf.acp.package.list.detailed{/lang}</span></a></li>
- </ul>
- </nav>
-</div>
-
-{include file='footer'}
+++ /dev/null
-<?php
-namespace wcf\acp\page;
-use wcf\data\package\Package;
-use wcf\data\package\PackageList;
-use wcf\page\AbstractPage;
-use wcf\system\request\RouteHandler;
-use wcf\system\WCF;
-use wcf\util\HeaderUtil;
-
-/**
- * Shows a list of installed packages and plugins.
- *
- * @author Alexander Ebert
- * @copyright 2001-2012 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package com.woltlab.wcf
- * @subpackage acp.page
- * @category Community Framework
- */
-class PackageListPage extends AbstractPage {
- /**
- * @see wcf\page\AbstractPage::$activeMenuItem
- */
- public $activeMenuItem = 'wcf.acp.menu.link.package.list';
-
- /**
- * list of applications
- * @var wcf\data\package\PackageList
- */
- protected $applicationList = null;
-
- /**
- * plugin count
- * @var integer
- */
- protected $pluginCount = 0;
-
- /**
- * list of plugins
- * @var wcf\data\package\PackageList
- */
- protected $pluginList = null;
-
- /**
- * @see wcf\page\IPage::readData()
- */
- public function readData() {
- parent::readData();
-
- // read applications
- $this->applicationList = new PackageList();
- $this->applicationList->getConditionBuilder()->add("package.isApplication = ?", array(1));
- $this->applicationList->getConditionBuilder()->add("package.packageID <> ?", array(1));
- $this->applicationList->sqlLimit = 0;
- $this->applicationList->readObjects();
-
- // read plugins
- $this->pluginList = Package::getPluginList();
-
- // count total plugins
- $this->pluginCount = $this->pluginList->countObjects();
-
- // read plugins
- $this->pluginList->sqlLimit = 20;
- $this->pluginList->readObjects();
- }
-
- /**
- * @see wcf\page\IPage::assignVariables()
- */
- public function assignVariables() {
- parent::assignVariables();
-
- WCF::getTPL()->assign(array(
- 'applications' => $this->applicationList,
- 'plugins' => $this->pluginList,
- 'pluginsCount' => $this->pluginCount
- ));
- }
-
- /**
- * @see wcf\page\IPage::show()
- */
- public function show() {
- // use detailed view if accessing WCF ACP directly
- if (PACKAGE_ID == 1) {
- // base tag is determined on runtime
- $host = RouteHandler::getHost();
- $path = RouteHandler::getPath();
-
- HeaderUtil::redirect($host . $path . 'index.php/PackageListDetailed/' . SID_ARG_1ST);
- exit;
- }
-
- parent::show();
- }
-}
<?php
namespace wcf\data\package;
-use wcf\system\exception\PermissionDeniedException;
-
use wcf\data\AbstractDatabaseObjectAction;
+use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\UserInputException;
use wcf\system\WCF;
*/
public $packageEditor = null;
- /**
- * Validates the 'getPluginList' action.
- */
- public function validateGetPluginList() {
- if (!isset($this->parameters['activePage']) || !intval($this->parameters['activePage'])) {
- throw new UserInputException('activePage');
- }
- }
-
- /**
- * Returns a list of plugins.
- *
- * @return array
- */
- public function getPluginList() {
- $pluginList = Package::getPluginList();
- $pluginList->sqlLimit = 20;
- $pluginList->sqlOffset = (($this->parameters['activePage'] - 1) * $pluginList->sqlLimit);
- $pluginList->readObjects();
-
- WCF::getTPL()->assign(array(
- 'plugins' => $pluginList
- ));
- return array(
- 'activePage' => $this->parameters['activePage'],
- 'template' => WCF::getTPL()->fetch('packageListPlugins')
- );
- }
-
/**
* Validates parameters to return the confirm message for package uninstallation.
*/