aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucas Cimon <lucas.cimon@gmail.com>2017-06-02 17:58:26 +0200
committerLucas Cimon <lucas.cimon@gmail.com>2017-06-09 10:58:12 +0200
commit49cc8e5d747e6c3504803cf4fa1589fa204e32b5 (patch)
tree8d666317f8845377adc2645d49da9c3779775c38
parent88535f20a9c1bde4d0461561a5a60be6b2bf4745 (diff)
downloadShaarli-49cc8e5d747e6c3504803cf4fa1589fa204e32b5.tar.gz
Shaarli-49cc8e5d747e6c3504803cf4fa1589fa204e32b5.tar.zst
Shaarli-49cc8e5d747e6c3504803cf4fa1589fa204e32b5.zip
Tagcloud/list improvments
-rw-r--r--index.php10
-rw-r--r--tpl/default/tag.cloud.html7
-rw-r--r--tpl/default/tag.list.html5
3 files changed, 19 insertions, 3 deletions
diff --git a/index.php b/index.php
index 2ff2505a..85486eb5 100644
--- a/index.php
+++ b/index.php
@@ -805,6 +805,9 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
805 805
806 $tagList = array(); 806 $tagList = array();
807 foreach($tags as $key => $value) { 807 foreach($tags as $key => $value) {
808 if (in_array($key, $filteringTags)) {
809 continue;
810 }
808 // Tag font size scaling: 811 // Tag font size scaling:
809 // default 15 and 30 logarithm bases affect scaling, 812 // default 15 and 30 logarithm bases affect scaling,
810 // 22 and 6 are arbitrary font sizes for max and min sizes. 813 // 22 and 6 are arbitrary font sizes for max and min sizes.
@@ -829,12 +832,17 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history)
829 exit; 832 exit;
830 } 833 }
831 834
832 // -------- Tag cloud 835 // -------- Tag list
833 if ($targetPage == Router::$PAGE_TAGLIST) 836 if ($targetPage == Router::$PAGE_TAGLIST)
834 { 837 {
835 $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; 838 $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all';
836 $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; 839 $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : [];
837 $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); 840 $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility);
841 foreach ($filteringTags as $tag) {
842 if (array_key_exists($tag, $tags)) {
843 unset($tags[$tag]);
844 }
845 }
838 846
839 if (! empty($_GET['sort']) && $_GET['sort'] === 'alpha') { 847 if (! empty($_GET['sort']) && $_GET['sort'] === 'alpha') {
840 alphabetical_sort($tags, false, true); 848 alphabetical_sort($tags, false, true);
diff --git a/tpl/default/tag.cloud.html b/tpl/default/tag.cloud.html
index 59aa2ee0..96b357a3 100644
--- a/tpl/default/tag.cloud.html
+++ b/tpl/default/tag.cloud.html
@@ -13,6 +13,11 @@
13 <div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor"> 13 <div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor">
14 {$countTags=count($tags)} 14 {$countTags=count($tags)}
15 <h2 class="window-title">{'Tag cloud'|t} - {$countTags} {'tags'|t}</h2> 15 <h2 class="window-title">{'Tag cloud'|t} - {$countTags} {'tags'|t}</h2>
16 {if="!empty($search_tags)"}
17 <p class="enter">
18 <a href="?searchtags={$search_tags|urlencode}">{'List all links with those tags'|t}</a>
19 </p>
20 {/if}
16 21
17 <div id="search-tagcloud" class="pure-g"> 22 <div id="search-tagcloud" class="pure-g">
18 <div class="pure-u-lg-1-4"></div> 23 <div class="pure-u-lg-1-4"></div>
@@ -40,7 +45,7 @@
40 45
41 <div id="cloudtag"> 46 <div id="cloudtag">
42 {loop="tags"} 47 {loop="tags"}
43 <a href="?searchtags={$key|urlencode}" style="font-size:{$value.size}em;">{$key}</a 48 <a href="?searchtags={$key|urlencode} {$search_tags|urlencode}" style="font-size:{$value.size}em;">{$key}</a
44 ><a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value.count}</a> 49 ><a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value.count}</a>
45 {loop="$value.tag_plugin"} 50 {loop="$value.tag_plugin"}
46 {$value} 51 {$value}
diff --git a/tpl/default/tag.list.html b/tpl/default/tag.list.html
index 62e2e7c6..81d6e5af 100644
--- a/tpl/default/tag.list.html
+++ b/tpl/default/tag.list.html
@@ -13,6 +13,9 @@
13 <div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor"> 13 <div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor">
14 {$countTags=count($tags)} 14 {$countTags=count($tags)}
15 <h2 class="window-title">{'Tag list'|t} - {$countTags} {'tags'|t}</h2> 15 <h2 class="window-title">{'Tag list'|t} - {$countTags} {'tags'|t}</h2>
16 <p style="text-align: center">
17 <a href="?searchtags={$search_tags|urlencode}">{'List all links with those tags'|t}</a>
18 </p>
16 19
17 <div id="search-tagcloud" class="pure-g"> 20 <div id="search-tagcloud" class="pure-g">
18 <div class="pure-u-lg-1-4"></div> 21 <div class="pure-u-lg-1-4"></div>
@@ -50,7 +53,7 @@
50 {/if} 53 {/if}
51 54
52 <a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value}</a> 55 <a href="?addtag={$key|urlencode}" title="{'Filter by tag'|t}" class="count">{$value}</a>
53 <a href="?searchtags={$key|urlencode}" class="tag-link">{$key}</a> 56 <a href="?searchtags={$key|urlencode} {$search_tags|urlencode}" class="tag-link">{$key}</a>
54 57
55 {loop="$value.tag_plugin"} 58 {loop="$value.tag_plugin"}
56 {$value} 59 {$value}