From 0e1cc205a5345ccefd1aaae0460fd08264716563 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Thu, 6 Aug 2020 17:42:47 +0200 Subject: [PATCH] Improve results when searching for packages Closes #3407 --- .../files/acp/images/woltlabLogo-tiny.png | Bin 0 -> 1054 bytes wcfsetup/install/files/acp/style/layout.scss | 47 ++++++++++++++-- .../acp/templates/packageSearchResultList.tpl | 50 ++++++------------ .../packageSearchResultListItems.tpl | 18 +++++++ .../update/PackageUpdateAction.class.php | 17 ++++-- wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 7 files changed, 92 insertions(+), 42 deletions(-) create mode 100644 wcfsetup/install/files/acp/images/woltlabLogo-tiny.png create mode 100644 wcfsetup/install/files/acp/templates/packageSearchResultListItems.tpl 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 0000000000000000000000000000000000000000..5321b6e661ec0b2c282e8405f79e2d732ced12d1 GIT binary patch literal 1054 zcmeAS@N?(olHy`uVBq!ia0vp^8bB<;!3-q#NBMtZU|`%9;1l8sYtJnC~uHfJkvB;RJ7hY?U)Z4lKa%k@XNb5Y;$w+jWPEHD;+3eA@P!B=zV=)BzdJbz9w6`PYw6}U9)0GcBp zs|mE!ws@&_Krv7OP_Jj}9-u5xS5Vh}pe{L!0H8{sI1n*0v*gS<88h*)PEe_R*-HP8 zeL$5!ajTr!K(8fDJ!(_92q+E=1fU>L3h2nF35S3lRJ4m^;}!r40^J-r;Sj{XmRU3X zJNE(A0CmMoIt+A`RqmX`DMy34_d8auH%;l+@-G59257ih+9bp1CQz6JmxuKp2<zATHmG}LtGFaZ^c{3**lt_2#3;5^$uYKU@!6tatlQHp<(6JX*G3J+6+mS7M9_Z-!k|4ie2A+SSEdI`lf*gO}-nw$; z_|XH~XZ1GaWV#uus>(@8iGKg~_3M|9@7}$A^ZM1R$B!T0zjyok_3KwJT{v~}=$>8M z)~#E;XwIxz)2B@6Z)vW{PD_Z5jtCD8_HuW%(btogmEBUajT4wyc6hothG?8WdOkJ$ zv4aTPgO!ej5p(XgmX?=?-;qt5G_&HeipkPUF_bs&!&6+FUB}YbH|9ho( zKl_(SioyH)i^ErmPg^2TReDwHcE&OBUwM0fzn(42`n}}h_8muzUy4`$Y)qT6{`c%x zhR6EZKetz|HZMtSHF9&iH!W&+=&XO4c4~XxzBdrFuRePyaPxxWo3lOVEsA`&P}4e3 zF*NtgdhN9bqMlXGe)wv|jCp6(idQi%zOy;-`;+RHfFsPGJ|-M;%{MpMn^IxR$J}{U z;pmdZGL3U&_}VAl$eaJ6`A7@LqD)RUW`lJa+9&2{WSurjx_MSB;drQGT8h}kEG3B# z>{`)P>!j=3*H0Q8i#akndQ{sm>H_h{5 zdAv0>?QYfNXtj!S{EC0ryNs**Gfq|Ig{~}#?48(?anL>N@VSVe@4i*({XBB-vWn1h zPWA%}OQyZgS$j8E*QDzE-TDF*XZiU5Gd1%n>_Tg$*`J@5i)yN`_nlI13`{Nzp00i_ I>zopr0E&CsT>t<8 literal 0 HcmV?d00001 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 +