Tagcloud/list improvments

This commit is contained in:
Lucas Cimon 2017-06-02 17:58:26 +02:00
parent 88535f20a9
commit 49cc8e5d74
3 changed files with 19 additions and 3 deletions

View file

@ -805,6 +805,9 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
$tagList = array(); $tagList = array();
foreach($tags as $key => $value) { foreach($tags as $key => $value) {
if (in_array($key, $filteringTags)) {
continue;
}
// Tag font size scaling: // Tag font size scaling:
// default 15 and 30 logarithm bases affect scaling, // default 15 and 30 logarithm bases affect scaling,
// 22 and 6 are arbitrary font sizes for max and min sizes. // 22 and 6 are arbitrary font sizes for max and min sizes.
@ -829,12 +832,17 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
exit; exit;
} }
// -------- Tag cloud // -------- Tag list
if ($targetPage == Router::$PAGE_TAGLIST) if ($targetPage == Router::$PAGE_TAGLIST)
{ {
$visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all';
$filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : [];
$tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility);
foreach ($filteringTags as $tag) {
if (array_key_exists($tag, $tags)) {
unset($tags[$tag]);
}
}
if (! empty($_GET['sort']) && $_GET['sort'] === 'alpha') { if (! empty($_GET['sort']) && $_GET['sort'] === 'alpha') {
alphabetical_sort($tags, false, true); alphabetical_sort($tags, false, true);

View file

@ -13,6 +13,11 @@
<div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor"> <div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor">
{$countTags=count($tags)} {$countTags=count($tags)}
<h2 class="window-title">{'Tag cloud'|t} - {$countTags} {'tags'|t}</h2> <h2 class="window-title">{'Tag cloud'|t} - {$countTags} {'tags'|t}</h2>
{if="!empty($search_tags)"}
<p class="enter">
<a href="?searchtags={$search_tags|urlencode}">{'List all links with those tags'|t}</a>
</p>
{/if}
<div id="search-tagcloud" class="pure-g"> <div id="search-tagcloud" class="pure-g">
<div class="pure-u-lg-1-4"></div> <div class="pure-u-lg-1-4"></div>
@ -40,7 +45,7 @@ <h2 class="window-title">{'Tag cloud'|t} - {$countTags} {'tags'|t}</h2>
<div id="cloudtag"> <div id="cloudtag">
{loop="tags"} {loop="tags"}
<a href="?searchtags={$key|urlencode}" style="font-size:{$value.size}em;">{$key}</a <a href="?searchtags={$key|urlencode} {$search_tags|urlencode}" style="font-size:{$value.size}em;">{$key}</a
><a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value.count}</a> ><a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value.count}</a>
{loop="$value.tag_plugin"} {loop="$value.tag_plugin"}
{$value} {$value}

View file

@ -13,6 +13,9 @@
<div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor"> <div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor">
{$countTags=count($tags)} {$countTags=count($tags)}
<h2 class="window-title">{'Tag list'|t} - {$countTags} {'tags'|t}</h2> <h2 class="window-title">{'Tag list'|t} - {$countTags} {'tags'|t}</h2>
<p style="text-align: center">
<a href="?searchtags={$search_tags|urlencode}">{'List all links with those tags'|t}</a>
</p>
<div id="search-tagcloud" class="pure-g"> <div id="search-tagcloud" class="pure-g">
<div class="pure-u-lg-1-4"></div> <div class="pure-u-lg-1-4"></div>
@ -50,7 +53,7 @@ <h2 class="window-title">{'Tag list'|t} - {$countTags} {'tags'|t}</h2>
{/if} {/if}
<a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value}</a> <a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value}</a>
<a href="?searchtags={$key|urlencode}" class="tag-link">{$key}</a> <a href="?searchtags={$key|urlencode} {$search_tags|urlencode}" class="tag-link">{$key}</a>
{loop="$value.tag_plugin"} {loop="$value.tag_plugin"}
{$value} {$value}