Skip to content

Commit

Permalink
Fix incorrect alphabetical sorting of the package list
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntimeX committed Oct 30, 2024
1 parent cb84e47 commit c11d57d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion wcfsetup/install/files/acp/templates/packageList.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<thead>
<tr>
<th colspan="2" class="columnID{if $sortField == 'packageID'} active {@$sortOrder}{/if}"><a href="{link controller='PackageList'}pageNo={@$pageNo}&sortField=packageID&sortOrder={if $sortField == 'packageID' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.global.objectID{/lang}</a></th>
<th class="columnTitle{if $sortField == 'packageName'} active {@$sortOrder}{/if}"><a href="{link controller='PackageList'}pageNo={@$pageNo}&sortField=packageName&sortOrder={if $sortField == 'packageName' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.package.name{/lang}</a></th>
<th class="columnTitle{if $sortField == 'packageNameI18n'} active {@$sortOrder}{/if}"><a href="{link controller='PackageList'}pageNo={@$pageNo}&sortField=packageNameI18n&sortOrder={if $sortField == 'packageNameI18n' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.package.name{/lang}</a></th>
<th class="columnText{if $sortField == 'author'} active {@$sortOrder}{/if}"><a href="{link controller='PackageList'}pageNo={@$pageNo}&sortField=author&sortOrder={if $sortField == 'author' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.package.author{/lang}</a></th>
<th class="columnText">{lang}wcf.acp.package.version{/lang}</th>
<th class="columnDate{if $sortField == 'updateDate'} active {@$sortOrder}{/if}"><a href="{link controller='PackageList'}pageNo={@$pageNo}&sortField=updateDate&sortOrder={if $sortField == 'updateDate' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{/link}">{lang}wcf.acp.package.updateDate{/lang}</a></th>
Expand Down
10 changes: 5 additions & 5 deletions wcfsetup/install/files/lib/acp/page/PackageListPage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace wcf\acp\page;

use wcf\data\package\PackageList;
use wcf\data\package\I18nPackageList;
use wcf\data\package\update\server\PackageUpdateServer;
use wcf\page\SortablePage;
use wcf\system\application\ApplicationHandler;
Expand All @@ -16,7 +16,7 @@
* @copyright 2001-2019 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
*
* @property PackageList $objectList
* @property I18nPackageList $objectList
*/
class PackageListPage extends SortablePage
{
Expand Down Expand Up @@ -55,7 +55,7 @@ class PackageListPage extends SortablePage
'packageID',
'package',
'packageDir',
'packageName',
'packageNameI18n',
'packageDescription',
'packageDate',
'packageURL',
Expand All @@ -69,7 +69,7 @@ class PackageListPage extends SortablePage
/**
* @inheritDoc
*/
public $objectListClassName = PackageList::class;
public $objectListClassName = I18nPackageList::class;

/**
* @inheritDoc
Expand Down Expand Up @@ -106,7 +106,7 @@ public function assignVariables()
*/
protected function readObjects()
{
$this->sqlOrderBy = 'package.' . ($this->sortField == 'packageType' ? 'isApplication ' . $this->sortOrder : $this->sortField . ' ' . $this->sortOrder) . ($this->sortField != 'packageName' ? ', package.packageName ASC' : '');
$this->sqlOrderBy = ($this->sortField == 'packageNameI18n' ? '' : 'package.') . ($this->sortField == 'packageType' ? 'isApplication ' . $this->sortOrder : $this->sortField . ' ' . $this->sortOrder) . ($this->sortField != 'packageNameI18n' ? ', packageNameI18n ASC' : '');

parent::readObjects();
}
Expand Down
32 changes: 32 additions & 0 deletions wcfsetup/install/files/lib/data/package/I18nPackageList.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace wcf\data\package;

use wcf\data\I18nDatabaseObjectList;

/**
* I18n implementation of the package list.
*
* @author Marcel Werk
* @copyright 2001-2024 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 6.1
*
* @method Package current()
* @method Package[] getObjects()
* @method Package|null getSingleObject()
* @method Package|null search($objectID)
* @property Package[] $objects
*/
class I18nPackageList extends I18nDatabaseObjectList
{
/**
* @inheritDoc
*/
public $i18nFields = ['packageName' => 'packageNameI18n'];

/**
* @inheritDoc
*/
public $className = Package::class;
}

0 comments on commit c11d57d

Please sign in to comment.