diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-02-02 19:22:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-02 19:22:37 +0100 |
commit | bc3ce7ec2a652eec1441774958050cf83105560a (patch) | |
tree | add0bcb98c4051bde67badf202a3f5bcaeb850a3 | |
parent | 17b4baedec3902a1549451ede36f914000019797 (diff) | |
parent | d2f6d909e529898c43b32defb890ec8e2d6b72f5 (diff) | |
download | Shaarli-bc3ce7ec2a652eec1441774958050cf83105560a.tar.gz Shaarli-bc3ce7ec2a652eec1441774958050cf83105560a.tar.zst Shaarli-bc3ce7ec2a652eec1441774958050cf83105560a.zip |
Merge pull request #1038 from ArthurHoaro/feature/public-only-filter
Add a filter to only display public links
-rw-r--r-- | application/PageBuilder.php | 3 | ||||
-rw-r--r-- | application/Updater.php | 12 | ||||
-rw-r--r-- | inc/languages/fr/LC_MESSAGES/shaarli.po | 78 | ||||
-rw-r--r-- | index.php | 33 | ||||
-rw-r--r-- | tpl/default/css/shaarli.css | 5 | ||||
-rw-r--r-- | tpl/default/linklist.paging.html | 9 | ||||
-rw-r--r-- | tpl/vintage/linklist.paging.html | 8 |
7 files changed, 94 insertions, 54 deletions
diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 468f144b..3233d6b6 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php | |||
@@ -83,7 +83,8 @@ class PageBuilder | |||
83 | ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt')) | 83 | ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt')) |
84 | ); | 84 | ); |
85 | $this->tpl->assign('scripturl', index_url($_SERVER)); | 85 | $this->tpl->assign('scripturl', index_url($_SERVER)); |
86 | $this->tpl->assign('privateonly', !empty($_SESSION['privateonly'])); // Show only private links? | 86 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; |
87 | $this->tpl->assign('visibility', $visibility); | ||
87 | $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); | 88 | $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); |
88 | $this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli')); | 89 | $this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli')); |
89 | if ($this->conf->exists('general.header_link')) { | 90 | if ($this->conf->exists('general.header_link')) { |
diff --git a/application/Updater.php b/application/Updater.php index 8d2bd577..f07e7697 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -445,6 +445,18 @@ class Updater | |||
445 | $this->linkDB->save($this->conf->get('resource.page_cache')); | 445 | $this->linkDB->save($this->conf->get('resource.page_cache')); |
446 | return true; | 446 | return true; |
447 | } | 447 | } |
448 | |||
449 | /** | ||
450 | * Change privateonly session key to visibility. | ||
451 | */ | ||
452 | public function updateMethodVisibilitySession() | ||
453 | { | ||
454 | if (isset($_SESSION['privateonly'])) { | ||
455 | unset($_SESSION['privateonly']); | ||
456 | $_SESSION['visibility'] = 'private'; | ||
457 | } | ||
458 | return true; | ||
459 | } | ||
448 | } | 460 | } |
449 | 461 | ||
450 | /** | 462 | /** |
diff --git a/inc/languages/fr/LC_MESSAGES/shaarli.po b/inc/languages/fr/LC_MESSAGES/shaarli.po index 323c6111..857b13c7 100644 --- a/inc/languages/fr/LC_MESSAGES/shaarli.po +++ b/inc/languages/fr/LC_MESSAGES/shaarli.po | |||
@@ -1,15 +1,15 @@ | |||
1 | msgid "" | 1 | msgid "" |
2 | msgstr "" | 2 | msgstr "" |
3 | "Project-Id-Version: Shaarli\n" | 3 | "Project-Id-Version: Shaarli\n" |
4 | "POT-Creation-Date: 2017-11-11 10:59+0100\n" | 4 | "POT-Creation-Date: 2018-01-24 18:43+0100\n" |
5 | "PO-Revision-Date: 2017-11-11 11:00+0100\n" | 5 | "PO-Revision-Date: 2018-01-24 18:44+0100\n" |
6 | "Last-Translator: \n" | 6 | "Last-Translator: \n" |
7 | "Language-Team: Shaarli\n" | 7 | "Language-Team: Shaarli\n" |
8 | "Language: fr_FR\n" | 8 | "Language: fr_FR\n" |
9 | "MIME-Version: 1.0\n" | 9 | "MIME-Version: 1.0\n" |
10 | "Content-Type: text/plain; charset=UTF-8\n" | 10 | "Content-Type: text/plain; charset=UTF-8\n" |
11 | "Content-Transfer-Encoding: 8bit\n" | 11 | "Content-Transfer-Encoding: 8bit\n" |
12 | "X-Generator: Poedit 2.0.4\n" | 12 | "X-Generator: Poedit 2.0.6\n" |
13 | "X-Poedit-Basepath: ../../../..\n" | 13 | "X-Poedit-Basepath: ../../../..\n" |
14 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" | 14 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" |
15 | "X-Poedit-SourceCharset: UTF-8\n" | 15 | "X-Poedit-SourceCharset: UTF-8\n" |
@@ -161,11 +161,11 @@ msgstr "" | |||
161 | "a été importé avec succès en %d secondes : %d liens importés, %d liens " | 161 | "a été importé avec succès en %d secondes : %d liens importés, %d liens " |
162 | "écrasés, %d liens ignorés." | 162 | "écrasés, %d liens ignorés." |
163 | 163 | ||
164 | #: application/PageBuilder.php:167 | 164 | #: application/PageBuilder.php:168 |
165 | msgid "The page you are trying to reach does not exist or has been deleted." | 165 | msgid "The page you are trying to reach does not exist or has been deleted." |
166 | msgstr "La page que vous essayez de consulter n'existe pas ou a été supprimée." | 166 | msgstr "La page que vous essayez de consulter n'existe pas ou a été supprimée." |
167 | 167 | ||
168 | #: application/PageBuilder.php:169 | 168 | #: application/PageBuilder.php:170 |
169 | msgid "404 Not Found" | 169 | msgid "404 Not Found" |
170 | msgstr "404 Introuvable" | 170 | msgstr "404 Introuvable" |
171 | 171 | ||
@@ -178,17 +178,17 @@ msgstr "Les fichiers de l'extension \"%s\" sont introuvables." | |||
178 | msgid "Couldn't retrieve Updater class methods." | 178 | msgid "Couldn't retrieve Updater class methods." |
179 | msgstr "Impossible de récupérer les méthodes de la classe Updater." | 179 | msgstr "Impossible de récupérer les méthodes de la classe Updater." |
180 | 180 | ||
181 | #: application/Updater.php:493 | 181 | #: application/Updater.php:506 |
182 | msgid "An error occurred while running the update " | 182 | msgid "An error occurred while running the update " |
183 | msgstr "Une erreur s'est produite lors de l'exécution de la mise à jour " | 183 | msgstr "Une erreur s'est produite lors de l'exécution de la mise à jour " |
184 | 184 | ||
185 | #: application/Updater.php:533 | 185 | #: application/Updater.php:546 |
186 | msgid "Updates file path is not set, can't write updates." | 186 | msgid "Updates file path is not set, can't write updates." |
187 | msgstr "" | 187 | msgstr "" |
188 | "Le chemin vers le fichier de mise à jour n'est pas défini, impossible " | 188 | "Le chemin vers le fichier de mise à jour n'est pas défini, impossible " |
189 | "d'écrire les mises à jour." | 189 | "d'écrire les mises à jour." |
190 | 190 | ||
191 | #: application/Updater.php:538 | 191 | #: application/Updater.php:551 |
192 | msgid "Unable to write updates in " | 192 | msgid "Unable to write updates in " |
193 | msgstr "Impossible d'écrire les mises à jour dans " | 193 | msgstr "Impossible d'écrire les mises à jour dans " |
194 | 194 | ||
@@ -265,46 +265,46 @@ msgstr "NON. Vous êtes banni pour le moment. Revenez plus tard." | |||
265 | msgid "Wrong login/password." | 265 | msgid "Wrong login/password." |
266 | msgstr "Nom d'utilisateur ou mot de passe incorrects." | 266 | msgstr "Nom d'utilisateur ou mot de passe incorrects." |
267 | 267 | ||
268 | #: index.php:1092 | 268 | #: index.php:1103 |
269 | msgid "You are not supposed to change a password on an Open Shaarli." | 269 | msgid "You are not supposed to change a password on an Open Shaarli." |
270 | msgstr "" | 270 | msgstr "" |
271 | "Vous n'êtes pas censé modifier le mot de passe d'un Shaarli en mode ouvert." | 271 | "Vous n'êtes pas censé modifier le mot de passe d'un Shaarli en mode ouvert." |
272 | 272 | ||
273 | #: index.php:1097 index.php:1138 index.php:1214 index.php:1244 index.php:1344 | 273 | #: index.php:1108 index.php:1149 index.php:1225 index.php:1255 index.php:1355 |
274 | msgid "Wrong token." | 274 | msgid "Wrong token." |
275 | msgstr "Jeton invalide." | 275 | msgstr "Jeton invalide." |
276 | 276 | ||
277 | #: index.php:1102 | 277 | #: index.php:1113 |
278 | msgid "The old password is not correct." | 278 | msgid "The old password is not correct." |
279 | msgstr "L'ancien mot de passe est incorrect." | 279 | msgstr "L'ancien mot de passe est incorrect." |
280 | 280 | ||
281 | #: index.php:1122 | 281 | #: index.php:1133 |
282 | msgid "Your password has been changed" | 282 | msgid "Your password has been changed" |
283 | msgstr "Votre mot de passe a été modifié" | 283 | msgstr "Votre mot de passe a été modifié" |
284 | 284 | ||
285 | #: index.php:1175 | 285 | #: index.php:1186 |
286 | msgid "Configuration was saved." | 286 | msgid "Configuration was saved." |
287 | msgstr "La configuration a été sauvegardé." | 287 | msgstr "La configuration a été sauvegardé." |
288 | 288 | ||
289 | #: index.php:1226 | 289 | #: index.php:1237 |
290 | #, php-format | 290 | #, php-format |
291 | msgid "The tag was removed from %d link." | 291 | msgid "The tag was removed from %d link." |
292 | msgid_plural "The tag was removed from %d links." | 292 | msgid_plural "The tag was removed from %d links." |
293 | msgstr[0] "Le tag a été supprimé de %d lien." | 293 | msgstr[0] "Le tag a été supprimé de %d lien." |
294 | msgstr[1] "Le tag a été supprimé de %d liens." | 294 | msgstr[1] "Le tag a été supprimé de %d liens." |
295 | 295 | ||
296 | #: index.php:1227 | 296 | #: index.php:1238 |
297 | #, php-format | 297 | #, php-format |
298 | msgid "The tag was renamed in %d link." | 298 | msgid "The tag was renamed in %d link." |
299 | msgid_plural "The tag was renamed in %d links." | 299 | msgid_plural "The tag was renamed in %d links." |
300 | msgstr[0] "Le tag a été renommé dans %d lien." | 300 | msgstr[0] "Le tag a été renommé dans %d lien." |
301 | msgstr[1] "Le tag a été renommé dans %d liens." | 301 | msgstr[1] "Le tag a été renommé dans %d liens." |
302 | 302 | ||
303 | #: index.php:1443 | 303 | #: index.php:1454 |
304 | msgid "Note: " | 304 | msgid "Note: " |
305 | msgstr "Note : " | 305 | msgstr "Note : " |
306 | 306 | ||
307 | #: index.php:1552 | 307 | #: index.php:1563 |
308 | #, php-format | 308 | #, php-format |
309 | msgid "" | 309 | msgid "" |
310 | "The file you are trying to upload is probably bigger than what this " | 310 | "The file you are trying to upload is probably bigger than what this " |
@@ -314,7 +314,7 @@ msgstr "" | |||
314 | "le serveur web peut accepter (%s). Merci de l'envoyer en parties plus " | 314 | "le serveur web peut accepter (%s). Merci de l'envoyer en parties plus " |
315 | "légères." | 315 | "légères." |
316 | 316 | ||
317 | #: index.php:1972 | 317 | #: index.php:1983 |
318 | #, php-format | 318 | #, php-format |
319 | msgid "" | 319 | msgid "" |
320 | "<pre>Sessions do not seem to work correctly on your server.<br>Make sure the " | 320 | "<pre>Sessions do not seem to work correctly on your server.<br>Make sure the " |
@@ -333,7 +333,7 @@ msgstr "" | |||
333 | "cookies. Nous vous recommandons d'accéder à votre serveur depuis son adresse " | 333 | "cookies. Nous vous recommandons d'accéder à votre serveur depuis son adresse " |
334 | "IP ou un <em>Fully Qualified Domain Name</em>.<br>" | 334 | "IP ou un <em>Fully Qualified Domain Name</em>.<br>" |
335 | 335 | ||
336 | #: index.php:1982 | 336 | #: index.php:1993 |
337 | msgid "Click to try again." | 337 | msgid "Click to try again." |
338 | msgstr "Cliquer ici pour réessayer." | 338 | msgstr "Cliquer ici pour réessayer." |
339 | 339 | ||
@@ -870,10 +870,10 @@ msgstr "Recherche texte" | |||
870 | #: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:38 | 870 | #: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:38 |
871 | #: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:124 | 871 | #: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:124 |
872 | #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:124 | 872 | #: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:124 |
873 | #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:33 | 873 | #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36 |
874 | #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:61 | 874 | #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:64 |
875 | #: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:33 | 875 | #: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36 |
876 | #: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:71 | 876 | #: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:74 |
877 | msgid "Filter by tag" | 877 | msgid "Filter by tag" |
878 | msgstr "Filtrer par tag" | 878 | msgstr "Filtrer par tag" |
879 | 879 | ||
@@ -933,25 +933,30 @@ msgstr "Filtres" | |||
933 | 933 | ||
934 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:12 | 934 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:12 |
935 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:12 | 935 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:12 |
936 | msgid "Filter private links" | 936 | msgid "Only display private links" |
937 | msgstr "Filtrer par liens privés" | 937 | msgstr "Afficher uniquement les liens privés" |
938 | |||
939 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:15 | ||
940 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:15 | ||
941 | msgid "Only display public links" | ||
942 | msgstr "Afficher uniquement les liens publics" | ||
938 | 943 | ||
939 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:18 | 944 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:20 |
940 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:18 | 945 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:20 |
941 | msgid "Filter untagged links" | 946 | msgid "Filter untagged links" |
942 | msgstr "Filtrer par liens privés" | 947 | msgstr "Filtrer par liens privés" |
943 | 948 | ||
944 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:22 | 949 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 |
945 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:74 | 950 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:76 |
946 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:22 | 951 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:24 |
947 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:74 | 952 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:76 |
948 | #: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:43 | 953 | #: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:43 |
949 | #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:43 | 954 | #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:43 |
950 | msgid "Fold all" | 955 | msgid "Fold all" |
951 | msgstr "Replier tout" | 956 | msgstr "Replier tout" |
952 | 957 | ||
953 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:67 | 958 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:69 |
954 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:67 | 959 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:69 |
955 | msgid "Links per page" | 960 | msgid "Links per page" |
956 | msgstr "Liens par page" | 961 | msgstr "Liens par page" |
957 | 962 | ||
@@ -1127,8 +1132,8 @@ msgstr "Aucun paramètre disponible." | |||
1127 | msgid "tags" | 1132 | msgid "tags" |
1128 | msgstr "tags" | 1133 | msgstr "tags" |
1129 | 1134 | ||
1130 | #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:23 | 1135 | #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 |
1131 | #: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:23 | 1136 | #: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 |
1132 | msgid "List all links with those tags" | 1137 | msgid "List all links with those tags" |
1133 | msgstr "Lister tous les liens avec ces tags" | 1138 | msgstr "Lister tous les liens avec ces tags" |
1134 | 1139 | ||
@@ -1284,6 +1289,9 @@ msgstr "" | |||
1284 | "Glisser ce lien dans votre barre de favoris ou cliquer droit dessus et « " | 1289 | "Glisser ce lien dans votre barre de favoris ou cliquer droit dessus et « " |
1285 | "Ajouter aux favoris »" | 1290 | "Ajouter aux favoris »" |
1286 | 1291 | ||
1292 | #~ msgid "Filter links by visibility" | ||
1293 | #~ msgstr "Filtrer les liens par visibilité" | ||
1294 | |||
1287 | #~ msgid "Redirector" | 1295 | #~ msgid "Redirector" |
1288 | #~ msgstr "Redirecteur" | 1296 | #~ msgstr "Redirecteur" |
1289 | 1297 | ||
@@ -287,7 +287,7 @@ function logout() { | |||
287 | unset($_SESSION['uid']); | 287 | unset($_SESSION['uid']); |
288 | unset($_SESSION['ip']); | 288 | unset($_SESSION['ip']); |
289 | unset($_SESSION['username']); | 289 | unset($_SESSION['username']); |
290 | unset($_SESSION['privateonly']); | 290 | unset($_SESSION['visibility']); |
291 | unset($_SESSION['untaggedonly']); | 291 | unset($_SESSION['untaggedonly']); |
292 | } | 292 | } |
293 | setcookie('shaarli_staySignedIn', FALSE, 0, WEB_PATH); | 293 | setcookie('shaarli_staySignedIn', FALSE, 0, WEB_PATH); |
@@ -805,7 +805,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager) | |||
805 | // -------- Tag cloud | 805 | // -------- Tag cloud |
806 | if ($targetPage == Router::$PAGE_TAGCLOUD) | 806 | if ($targetPage == Router::$PAGE_TAGCLOUD) |
807 | { | 807 | { |
808 | $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; | 808 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; |
809 | $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; | 809 | $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; |
810 | $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); | 810 | $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); |
811 | 811 | ||
@@ -850,7 +850,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager) | |||
850 | // -------- Tag list | 850 | // -------- Tag list |
851 | if ($targetPage == Router::$PAGE_TAGLIST) | 851 | if ($targetPage == Router::$PAGE_TAGLIST) |
852 | { | 852 | { |
853 | $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; | 853 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; |
854 | $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; | 854 | $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; |
855 | $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); | 855 | $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); |
856 | foreach ($filteringTags as $tag) { | 856 | foreach ($filteringTags as $tag) { |
@@ -1016,15 +1016,26 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager) | |||
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | // -------- User wants to see only private links (toggle) | 1018 | // -------- User wants to see only private links (toggle) |
1019 | if (isset($_GET['privateonly'])) { | 1019 | if (isset($_GET['visibility'])) { |
1020 | if (empty($_SESSION['privateonly'])) { | 1020 | if ($_GET['visibility'] === 'private') { |
1021 | $_SESSION['privateonly'] = 1; // See only private links | 1021 | // Visibility not set or not already private, set private, otherwise reset it |
1022 | } else { | 1022 | if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'private') { |
1023 | unset($_SESSION['privateonly']); // See all links | 1023 | // See only private links |
1024 | $_SESSION['visibility'] = 'private'; | ||
1025 | } else { | ||
1026 | unset($_SESSION['visibility']); | ||
1027 | } | ||
1028 | } else if ($_GET['visibility'] === 'public') { | ||
1029 | if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'public') { | ||
1030 | // See only public links | ||
1031 | $_SESSION['visibility'] = 'public'; | ||
1032 | } else { | ||
1033 | unset($_SESSION['visibility']); | ||
1034 | } | ||
1024 | } | 1035 | } |
1025 | 1036 | ||
1026 | if (! empty($_SERVER['HTTP_REFERER'])) { | 1037 | if (! empty($_SERVER['HTTP_REFERER'])) { |
1027 | $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('privateonly')); | 1038 | $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('visibility')); |
1028 | } else { | 1039 | } else { |
1029 | $location = '?'; | 1040 | $location = '?'; |
1030 | } | 1041 | } |
@@ -1666,7 +1677,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) | |||
1666 | } | 1677 | } |
1667 | } else { | 1678 | } else { |
1668 | // Filter links according search parameters. | 1679 | // Filter links according search parameters. |
1669 | $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; | 1680 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; |
1670 | $request = [ | 1681 | $request = [ |
1671 | 'searchtags' => $searchtags, | 1682 | 'searchtags' => $searchtags, |
1672 | 'searchterm' => $searchterm, | 1683 | 'searchterm' => $searchterm, |
@@ -1742,7 +1753,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) | |||
1742 | 'result_count' => count($linksToDisplay), | 1753 | 'result_count' => count($linksToDisplay), |
1743 | 'search_term' => $searchterm, | 1754 | 'search_term' => $searchterm, |
1744 | 'search_tags' => $searchtags, | 1755 | 'search_tags' => $searchtags, |
1745 | 'visibility' => ! empty($_SESSION['privateonly']) ? 'private' : '', | 1756 | 'visibility' => ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '', |
1746 | 'redirector' => $conf->get('redirector.url'), // Optional redirector URL. | 1757 | 'redirector' => $conf->get('redirector.url'), // Optional redirector URL. |
1747 | 'links' => $linkDisp, | 1758 | 'links' => $linkDisp, |
1748 | ); | 1759 | ); |
diff --git a/tpl/default/css/shaarli.css b/tpl/default/css/shaarli.css index 14439402..1e07a88e 100644 --- a/tpl/default/css/shaarli.css +++ b/tpl/default/css/shaarli.css | |||
@@ -453,6 +453,11 @@ body, .pure-g [class*="pure-u"] { | |||
453 | background: #1b926c; | 453 | background: #1b926c; |
454 | } | 454 | } |
455 | 455 | ||
456 | .linklist-filters .filter-block { | ||
457 | color: #f5f5f5; | ||
458 | background: #ac2925; | ||
459 | } | ||
460 | |||
456 | .linklist-pages { | 461 | .linklist-pages { |
457 | margin: 5px 0; | 462 | margin: 5px 0; |
458 | color: #252525; | 463 | color: #252525; |
diff --git a/tpl/default/linklist.paging.html b/tpl/default/linklist.paging.html index 347b3d13..72bdd931 100644 --- a/tpl/default/linklist.paging.html +++ b/tpl/default/linklist.paging.html | |||
@@ -6,9 +6,12 @@ | |||
6 | {'Filters'|t} | 6 | {'Filters'|t} |
7 | </span> | 7 | </span> |
8 | {if="isLoggedIn()"} | 8 | {if="isLoggedIn()"} |
9 | <a href="?privateonly" title="{'Filter private links'|t}" | 9 | <a href="?visibility=private" title="{'Only display private links'|t}" |
10 | class={if="$privateonly"}"filter-on"{else}"filter-off"{/if} | 10 | class="{if="$visibility==='private'"}filter-on{else}filter-off{/if}" |
11 | ><i class="fa fa-key"></i></a> | 11 | ><i class="fa fa-user-secret"></i></a> |
12 | <a href="?visibility=public" title="{'Only display public links'|t}" | ||
13 | class="{if="$visibility==='public'"}filter-on{else}filter-off{/if}" | ||
14 | ><i class="fa fa-globe"></i></a> | ||
12 | {/if} | 15 | {/if} |
13 | <a href="?untaggedonly" title="{'Filter untagged links'|t}" | 16 | <a href="?untaggedonly" title="{'Filter untagged links'|t}" |
14 | class={if="$untaggedonly"}"filter-on"{else}"filter-off"{/if} | 17 | class={if="$untaggedonly"}"filter-on"{else}"filter-off"{/if} |
diff --git a/tpl/vintage/linklist.paging.html b/tpl/vintage/linklist.paging.html index 86019c01..12828a97 100644 --- a/tpl/vintage/linklist.paging.html +++ b/tpl/vintage/linklist.paging.html | |||
@@ -1,11 +1,11 @@ | |||
1 | <div class="paging"> | 1 | <div class="paging"> |
2 | {if="isLoggedIn()"} | 2 | {if="isLoggedIn()"} |
3 | <div class="paging_privatelinks"> | 3 | <div class="paging_privatelinks"> |
4 | <a href="?privateonly"> | 4 | <a href="?visibility=private"> |
5 | {if="$privateonly"} | 5 | {if="$visibility=='private'"} |
6 | <img src="images/private_16x16_active.png#" width="16" height="16" title="Click to see all links" alt="Click to see all links"> | 6 | <img src="images/private_16x16_active.png#" width="16" height="16" title="Filter links by visibility" alt="Filter links by visibility"> |
7 | {else} | 7 | {else} |
8 | <img src="images/private_16x16.png#" width="16" height="16" title="Click to see only private links" alt="Click to see only private links"> | 8 | <img src="images/private_16x16.png#" width="16" height="16" title="Filter links by visibility" alt="Filter links by visibility"> |
9 | {/if} | 9 | {/if} |
10 | </a> | 10 | </a> |
11 | 11 | ||