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();
foreach($tags as $key => $value) {
if (in_array($key, $filteringTags)) {
continue;
}
// Tag font size scaling:
// default 15 and 30 logarithm bases affect scaling,
// 22 and 6 are arbitrary font sizes for max and min sizes.
@ -829,12 +832,17 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
exit;
}
// -------- Tag cloud
// -------- Tag list
if ($targetPage == Router::$PAGE_TAGLIST)
{
$visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all';
$filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : [];
$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') {
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">
{$countTags=count($tags)}
<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 class="pure-u-lg-1-4"></div>
@ -40,7 +45,7 @@
<div id="cloudtag">
{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>
{loop="$value.tag_plugin"}
{$value}

View file

@ -13,6 +13,9 @@
<div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor">
{$countTags=count($tags)}
<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 class="pure-u-lg-1-4"></div>
@ -50,7 +53,7 @@
{/if}
<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"}
{$value}