From: Marcel Werk Date: Thu, 6 Aug 2020 15:42:47 +0000 (+0200) Subject: Improve results when searching for packages X-Git-Tag: 5.3.0_Alpha_1~85^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0e1cc205a5345ccefd1aaae0460fd08264716563;p=GitHub%2FWoltLab%2FWCF.git Improve results when searching for packages Closes #3407 --- diff --git a/wcfsetup/install/files/acp/images/woltlabLogo-tiny.png b/wcfsetup/install/files/acp/images/woltlabLogo-tiny.png new file mode 100644 index 0000000000..5321b6e661 Binary files /dev/null and b/wcfsetup/install/files/acp/images/woltlabLogo-tiny.png differ diff --git a/wcfsetup/install/files/acp/style/layout.scss b/wcfsetup/install/files/acp/style/layout.scss index 704b3e7368..81f83df537 100644 --- a/wcfsetup/install/files/acp/style/layout.scss +++ b/wcfsetup/install/files/acp/style/layout.scss @@ -466,6 +466,28 @@ $wcfAcpSubMenuWidth: 300px; } /* Search for Packages */ +.packageSearchResultRow { + .columnText { + padding: 15px 10px; + } + + td.columnIcon { + position: relative; + width: 44px; + + a { + align-items: center; + bottom: 5px; + display: flex; + justify-content: center; + left: 0; + position: absolute; + right: 0; + top: 5px; + } + } +} + .packageSearchName { @include wcfFontHeadline; @include wcfFontBold; @@ -474,15 +496,32 @@ $wcfAcpSubMenuWidth: 300px; .packageSearchVersion { color: $wcfContentDimmedText; font-weight: 400; - padding-left: 5px; +} + +.packageSearchDescription { + margin-top: 3px; } .packageSearchPackage { color: $wcfContentDimmedText; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; - font-weight: 400; - - @include wcfFontSmall; +} + +.packageSearchAuthor, +.packageSearchLicense { + white-space: nowrap; +} + +.packageSearchAuthorWoltlab::before { + background-image: url(../images/woltlabLogo-tiny.png); + background-size: contain; + content: ""; + display: inline-block; + height: 12px; + margin-right: 2px; + position: relative; + top: 1px; + width: 22px; } #packageSearchResultContainer { diff --git a/wcfsetup/install/files/acp/templates/packageSearchResultList.tpl b/wcfsetup/install/files/acp/templates/packageSearchResultList.tpl index 1acc835d3d..610cd84522 100644 --- a/wcfsetup/install/files/acp/templates/packageSearchResultList.tpl +++ b/wcfsetup/install/files/acp/templates/packageSearchResultList.tpl @@ -11,43 +11,23 @@ - - {lang count=$trustedSources|count}wcf.acp.package.search.result.trusted{/lang} - - {foreach from=$trustedSources item=$package} - - - - - -
{$package->packageName} {$package->getAccessibleVersion()->packageVersion}
- {$package->package} - - {if $package->authorURL}{$package->author}{else}{$package->author}{/if} - {if $package->getAccessibleVersion()->licenseURL}{$package->getAccessibleVersion()->license}{else}{$package->getAccessibleVersion()->license}{/if} - {@$package->getAccessibleVersion()->packageDate|time} + {if $officialPackages|count} + + {lang count=$officialPackages|count}wcf.acp.package.search.result.official{/lang} + + {include file='packageSearchResultListItems' packages=$officialPackages} + {/if} + {if $trustedSources|count} + + {lang count=$trustedSources|count}wcf.acp.package.search.result.trusted{/lang} - {/foreach} - {hascontent} + {include file='packageSearchResultListItems' packages=$trustedSources} + {/if} + {if $thirdPartySources|count} - {lang count=$thirdPartySources|count}wcf.acp.package.search.result.thirdParty{/lang} + {lang count=$thirdPartySources|count}wcf.acp.package.search.result.trusted{/lang} - {content} - {foreach from=$thirdPartySources item=$package} - - - - - -
{$package->packageName} {$package->getAccessibleVersion()->packageVersion}
- {$package->package} - - {if $package->authorURL}{$package->author}{else}{$package->author}{/if} - {if $package->getAccessibleVersion()->licenseURL}{$package->getAccessibleVersion()->license}{else}{$package->getAccessibleVersion()->license}{/if} - {@$package->getAccessibleVersion()->packageDate|time} - - {/foreach} - {/content} - {/hascontent} + {include file='packageSearchResultListItems' packages=$thirdPartySources} + {/if} diff --git a/wcfsetup/install/files/acp/templates/packageSearchResultListItems.tpl b/wcfsetup/install/files/acp/templates/packageSearchResultListItems.tpl new file mode 100644 index 0000000000..3059f48cdf --- /dev/null +++ b/wcfsetup/install/files/acp/templates/packageSearchResultListItems.tpl @@ -0,0 +1,18 @@ +{foreach from=$packages item=$package} + + + + + +
{$package->packageName} {$package->getAccessibleVersion()->packageVersion}
+
{$package->packageDescription}
+ {$package->package} + {if $package->pluginStoreFileID} + {lang}wcf.acp.pluginStore.file{/lang} + {/if} + + {if $package->authorURL}{$package->author|truncate:30}{else}{$package->author|truncate:30}{/if} + {if $package->getAccessibleVersion()->licenseURL}{$package->getAccessibleVersion()->license|truncate:30}{else}{$package->getAccessibleVersion()->license|truncate:30}{/if} + {@$package->getAccessibleVersion()->packageDate|time} + +{/foreach} diff --git a/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php b/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php index 0e857fe7d2..de7e6b7e14 100644 --- a/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php +++ b/wcfsetup/install/files/lib/data/package/update/PackageUpdateAction.class.php @@ -66,6 +66,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { // there are no available package update servers if (empty($availableUpdateServers)) { WCF::getTPL()->assign([ + 'officialPackages' => [], 'thirdPartySources' => [], 'trustedSources' => [], ]); @@ -96,6 +97,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { // no matches found if (empty($packageUpdateIDs)) { WCF::getTPL()->assign([ + 'officialPackages' => [], 'thirdPartySources' => [], 'trustedSources' => [], ]); @@ -134,6 +136,7 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { // no matches found if (empty($packageUpdates)) { WCF::getTPL()->assign([ + 'officialPackages' => [], 'thirdPartySources' => [], 'trustedSources' => [], ]); @@ -459,10 +462,11 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { // assign versions /** + * @var ViewablePackageUpdate[] $officialPackages * @var ViewablePackageUpdate[] $thirdPartySources * @var ViewablePackageUpdate[] $trustedSources */ - $thirdPartySources = $trustedSources = []; + $officialPackages = $thirdPartySources = $trustedSources = []; /** * @var int $packageUpdateID * @var ViewablePackageUpdate $packageUpdate @@ -473,7 +477,10 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { $packageUpdate->setLatestVersion($updateVersions[$versionIDs['existing']]); $packageUpdate->setUpdateServer($updateServers[$packageUpdate->packageUpdateServerID]); - if ($packageUpdate->getUpdateServer()->isTrustedServer() || $packageUpdate->getUpdateServer()->isWoltLabStoreServer()) { + if ($packageUpdate->getUpdateServer()->isWoltLabUpdateServer()) { + $officialPackages[] = $packageUpdate; + } + else if ($packageUpdate->getUpdateServer()->isTrustedServer() || $packageUpdate->getUpdateServer()->isWoltLabStoreServer()) { $trustedSources[] = $packageUpdate; } else { @@ -481,6 +488,9 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { } } + uasort($officialPackages, function(ViewablePackageUpdate $a, ViewablePackageUpdate $b) { + return strnatcasecmp($a->getName(), $b->getName()); + }); uasort($thirdPartySources, function(ViewablePackageUpdate $a, ViewablePackageUpdate $b) { return strnatcasecmp($a->getName(), $b->getName()); }); @@ -489,12 +499,13 @@ class PackageUpdateAction extends AbstractDatabaseObjectAction { }); WCF::getTPL()->assign([ + 'officialPackages' => $officialPackages, 'thirdPartySources' => $thirdPartySources, 'trustedSources' => $trustedSources, ]); return [ - 'count' => count($thirdPartySources) + count($trustedSources), + 'count' => count($officialPackages) + count($thirdPartySources) + count($trustedSources), 'template' => WCF::getTPL()->fetch('packageSearchResultList'), ]; } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 4b5097edc9..70bb8616bf 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1957,6 +1957,7 @@ Die Datenbestände werden sorgfältig gepflegt, aber es ist nicht ausgeschlossen + already bought the licenses for the listed apps, th +