Improved the visual separation of package sources
authorAlexander Ebert <ebert@woltlab.com>
Thu, 18 Apr 2019 09:19:54 +0000 (11:19 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 18 Apr 2019 09:19:54 +0000 (11:19 +0200)
wcfsetup/install/files/acp/templates/packageSearchResultList.tpl
wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 976964941aa8bf32faa85596c52fcccc6dc25eb1..1acc835d3df085f0e4c339bfd7ff7e9a566d2e1d 100644 (file)
@@ -1,24 +1,42 @@
-{hascontent}
-       <table class="table">
-               <thead>
+<table class="table">
+       <thead>
+               <tr>
+                       <th colspan="2" class="columnTitle">{lang}wcf.acp.package.name{/lang}</th>
+                       <th class="columnText">{lang}wcf.acp.package.author{/lang}</a></th>
+                       <th class="columnText">{lang}wcf.acp.package.license{/lang}</th>
+                       <th class="columnDate">{lang}wcf.acp.package.packageDate{/lang}</a></th>
+                       
+                       {event name='headColumns'}
+               </tr>
+       </thead>
+       
+       <tbody>
+               <tr>
+                       <td colspan="5"><small>{lang count=$trustedSources|count}wcf.acp.package.search.result.trusted{/lang}</small></td>
+               </tr>
+               {foreach from=$trustedSources item=$package}
+                       <tr class="jsPackageRow">
+                               <td class="columnIcon">
+                                       <a href="#" class="jsInstallPackage" data-confirm-message="{lang __encode=true}wcf.acp.package.install.confirmMessage{/lang}" data-package="{$package->package}" data-package-version="{$package->getAccessibleVersion()->packageVersion}"><span class="icon icon16 fa-plus jsTooltip" title="{lang}wcf.acp.package.button.installPackage{/lang}"></span></a>
+                               </td>
+                               <td class="columnTitle" title="{$package->packageDescription}">
+                                       <div class="packageSearchName">{$package->packageName} <span class="packageSearchVersion">{$package->getAccessibleVersion()->packageVersion}</span></div>
+                                       <span class="packageSearchPackage">{$package->package}</span>
+                               </td>
+                               <td class="columnText">{if $package->authorURL}<a href="{$package->authorURL}" class="externalURL">{$package->author}</a>{else}{$package->author}{/if}</td>
+                               <td class="columnText">{if $package->getAccessibleVersion()->licenseURL}<a href="{$package->getAccessibleVersion()->licenseURL}" class="externalURL">{$package->getAccessibleVersion()->license}</a>{else}{$package->getAccessibleVersion()->license}{/if}</td>
+                               <td class="columnDate">{@$package->getAccessibleVersion()->packageDate|time}</td>
+                       </tr>
+               {/foreach}
+               {hascontent}
                        <tr>
-                               <th colspan="2" class="columnTitle">{lang}wcf.acp.package.name{/lang}</th>
-                               <th class="columnText">{lang}wcf.acp.package.author{/lang}</a></th>
-                               <th class="columnText">{lang}wcf.acp.package.license{/lang}</th>
-                               <th class="columnDate">{lang}wcf.acp.package.packageDate{/lang}</a></th>
-                               
-                               {event name='headColumns'}
+                               <td colspan="5"><small>{lang count=$thirdPartySources|count}wcf.acp.package.search.result.thirdParty{/lang}</small></td>
                        </tr>
-               </thead>
-               
-               <tbody>
                        {content}
-                               {foreach from=$packageUpdates item=$package}
+                               {foreach from=$thirdPartySources item=$package}
                                        <tr class="jsPackageRow">
                                                <td class="columnIcon">
                                                        <a href="#" class="jsInstallPackage" data-confirm-message="{lang __encode=true}wcf.acp.package.install.confirmMessage{/lang}" data-package="{$package->package}" data-package-version="{$package->getAccessibleVersion()->packageVersion}"><span class="icon icon16 fa-plus jsTooltip" title="{lang}wcf.acp.package.button.installPackage{/lang}"></span></a>
-                                                       
-                                                       {event name='buttons'}
                                                </td>
                                                <td class="columnTitle" title="{$package->packageDescription}">
                                                        <div class="packageSearchName">{$package->packageName} <span class="packageSearchVersion">{$package->getAccessibleVersion()->packageVersion}</span></div>
                                                <td class="columnText">{if $package->authorURL}<a href="{$package->authorURL}" class="externalURL">{$package->author}</a>{else}{$package->author}{/if}</td>
                                                <td class="columnText">{if $package->getAccessibleVersion()->licenseURL}<a href="{$package->getAccessibleVersion()->licenseURL}" class="externalURL">{$package->getAccessibleVersion()->license}</a>{else}{$package->getAccessibleVersion()->license}{/if}</td>
                                                <td class="columnDate">{@$package->getAccessibleVersion()->packageDate|time}</td>
-                                               
-                                               {event name='columns'}
                                        </tr>
                                {/foreach}
                        {/content}
-               </tbody>
-       </table>
-{hascontentelse}
-       <p class="info">{lang}wcf.acp.package.search.error.noMatches{/lang}</p>
-{/hascontent}
+               {/hascontent}
+       </tbody>
+</table>
index a94d9b8750caf21ed410b40b951d0727c41e8821..7af9a557bc8fd9521ca215cd7635a2e883ea0421 100644 (file)
@@ -450,6 +450,11 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction {
                $updateVersions = $statement->fetchObjects(PackageUpdateVersion::class, 'packageUpdateVersionID');
                
                // assign versions
+               /**
+                * @var ViewablePackageUpdate[] $thirdPartySources
+                * @var ViewablePackageUpdate[] $trustedSources
+                */
+               $thirdPartySources = $trustedSources = [];
                /**
                 * @var int $packageUpdateID
                 * @var ViewablePackageUpdate $packageUpdate
@@ -459,25 +464,29 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction {
                        $packageUpdate->setAccessibleVersion($updateVersions[$versionIDs['accessible']]);
                        $packageUpdate->setLatestVersion($updateVersions[$versionIDs['existing']]);
                        $packageUpdate->setUpdateServer($updateServers[$packageUpdate->packageUpdateServerID]);
-               }
-               
-               uasort($packageUpdates, function(ViewablePackageUpdate $a, ViewablePackageUpdate $b) {
-                       $aIsTrusted = $a->getUpdateServer()->isTrustedServer() || $a->getUpdateServer()->isWoltLabStoreServer();
-                       $bIsTrusted = $b->getUpdateServer()->isTrustedServer() || $b->getUpdateServer()->isWoltLabStoreServer();
                        
-                       if ($aIsTrusted === $bIsTrusted) {
-                               return strnatcasecmp($a->getName(), $b->getName());
+                       if ($packageUpdate->getUpdateServer()->isTrustedServer() || $packageUpdate->getUpdateServer()->isWoltLabStoreServer()) {
+                               $trustedSources[] = $packageUpdate;
                        }
-                       
-                       return $aIsTrusted ? -1 : 1;
+                       else {
+                               $thirdPartySources[] = $packageUpdate;
+                       }
+               }
+               
+               uasort($thirdPartySources, function(ViewablePackageUpdate $a, ViewablePackageUpdate $b) {
+                       return strnatcasecmp($a->getName(), $b->getName());
+               });
+               uasort($trustedSources, function(ViewablePackageUpdate $a, ViewablePackageUpdate $b) {
+                       return strnatcasecmp($a->getName(), $b->getName());
                });
                
                WCF::getTPL()->assign([
-                       'packageUpdates' => $packageUpdates,
+                       'thirdPartySources' => $thirdPartySources,
+                       'trustedSources' => $trustedSources,
                ]);
                
                return [
-                       'count' => count($updateData),
+                       'count' => count($thirdPartySources) + count($trustedSources),
                        'template' => WCF::getTPL()->fetch('packageSearchResultList'),
                ];
        }
index 16ce3e6041754d4fce204ab2131e5698be4a751b..4f5e8177397d8446bf92528be13c5e5d7242cedb 100644 (file)
@@ -1919,9 +1919,11 @@ Die Datenbestände werden sorgfältig gepflegt, aber es ist nicht ausgeschlossen
                <item name="wcf.acp.package.search.input"><![CDATA[Suchbegriff eingeben]]></item>
                <item name="wcf.acp.package.search.input.description"><![CDATA[Es wird nach Teilübereinstimmungen des Paketnamens, dessen Beschreibung sowie dem internen Bezeichner gesucht.]]></item>
                <item name="wcf.acp.package.search.status.idle"><![CDATA[Geben Sie mehr als drei Buchstaben ein, um die Suche zu starten.]]></item>
-               <item name="wcf.acp.package.search.status.loading"><![CDATA[Suche läuft…]]></item>
+               <item name="wcf.acp.package.search.status.loading"><![CDATA[Suche läuft …]]></item>
                <item name="wcf.acp.package.search.status.noResults"><![CDATA[Die Suche ergab keine Treffer.]]></item>
-               <item name="wcf.acp.package.search.status.refreshDatabase"><![CDATA[Die Paketlisten werden aktualisiert…]]></item>
+               <item name="wcf.acp.package.search.status.refreshDatabase"><![CDATA[Die Paketlisten werden aktualisiert …]]></item>
+               <item name="wcf.acp.package.search.result.thirdParty"><![CDATA[{if $count === 0}Keine{elseif $count === 1}Ein{else}{#$count}{/if} Treffer in Paketquellen von Drittanbietern]]></item>
+               <item name="wcf.acp.package.search.result.trusted"><![CDATA[{if $count === 0}Keine{elseif $count === 1}Ein{else}{#$count}{/if} Treffer in offizielle Paketquellen]]></item>
        </category>
        <category name="wcf.acp.page">
                <item name="wcf.acp.page.add"><![CDATA[Seite hinzufügen]]></item>
index 9dd1ed71828141c69739fe57bb6caaccb672e78f..2966d146f83fb26d161f7c82e7d2656d1c8ef5ca 100644 (file)
@@ -1908,6 +1908,8 @@ If you have <strong>already bought the licenses for the listed apps</strong>, th
                <item name="wcf.acp.package.search.status.loading"><![CDATA[Searching…]]></item>
                <item name="wcf.acp.package.search.status.noResults"><![CDATA[There were no matches.]]></item>
                <item name="wcf.acp.package.search.status.refreshDatabase"><![CDATA[Retrieving the package lists…]]></item>
+               <item name="wcf.acp.package.search.result.thirdParty"><![CDATA[{if $count === 0}No matches{elseif $count === 1}One match{else}{#$count} matches{/if} in package sources maintained by third parties]]></item>
+               <item name="wcf.acp.package.search.result.trusted"><![CDATA[{if $count === 0}No matches{elseif $count === 1}One match{else}{#$count} matches{/if} in official package sources]]></item>
        </category>
        <category name="wcf.acp.paidSubscription">
                <item name="wcf.acp.paidSubscription.list"><![CDATA[Paid Subscriptions]]></item>