diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-12-16 12:36:59 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2017-12-16 14:32:56 +0100 |
commit | 9d4736a3e95332198896f97ecc8a83abb0cbe85b (patch) | |
tree | fc2487dbefd09953f21f8d10850c7689c87af224 | |
parent | 877491b4ad0a6a9119e667901cef40cc56116901 (diff) | |
download | Shaarli-9d4736a3e95332198896f97ecc8a83abb0cbe85b.tar.gz Shaarli-9d4736a3e95332198896f97ecc8a83abb0cbe85b.tar.zst Shaarli-9d4736a3e95332198896f97ecc8a83abb0cbe85b.zip |
Add a filter to only display public links
When the key filter is clicked once, it only displays private link. When it is clicked on again, it becomes red and only public links are displayed. Another click and all links are displayed. The current visibility status is shown in the search banner
Fixes #1030
-rw-r--r-- | application/PageBuilder.php | 24 | ||||
-rw-r--r-- | application/Updater.php | 12 | ||||
-rw-r--r-- | inc/languages/fr/LC_MESSAGES/shaarli.po | 73 | ||||
-rw-r--r-- | index.php | 23 | ||||
-rw-r--r-- | tpl/default/css/shaarli.css | 5 | ||||
-rw-r--r-- | tpl/default/linklist.paging.html | 4 | ||||
-rw-r--r-- | tpl/vintage/linklist.paging.html | 8 |
7 files changed, 96 insertions, 53 deletions
diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 468f144b..0902d00d 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php | |||
@@ -83,7 +83,9 @@ 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); | ||
88 | $this->tpl->assign('nextVisibility', $this->getNextVisibility($visibility)); | ||
87 | $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); | 89 | $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); |
88 | $this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli')); | 90 | $this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli')); |
89 | if ($this->conf->exists('general.header_link')) { | 91 | if ($this->conf->exists('general.header_link')) { |
@@ -170,4 +172,24 @@ class PageBuilder | |||
170 | $this->tpl->assign('error_message', $message); | 172 | $this->tpl->assign('error_message', $message); |
171 | $this->renderPage('404'); | 173 | $this->renderPage('404'); |
172 | } | 174 | } |
175 | |||
176 | /** | ||
177 | * Return the next visibility option: | ||
178 | * private -> public -> all | ||
179 | * | ||
180 | * @param string $current visibility value | ||
181 | * | ||
182 | * @return string next visibility value | ||
183 | */ | ||
184 | protected function getNextVisibility($current) | ||
185 | { | ||
186 | switch ($current) { | ||
187 | case 'private': | ||
188 | return 'public'; | ||
189 | case 'public': | ||
190 | return ''; | ||
191 | default: | ||
192 | return 'private'; | ||
193 | } | ||
194 | } | ||
173 | } | 195 | } |
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..b62ff6ed 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: 2017-12-16 14:27+0100\n" |
5 | "PO-Revision-Date: 2017-11-11 11:00+0100\n" | 5 | "PO-Revision-Date: 2017-12-16 14:27+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.5\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:169 |
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:171 |
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:1093 |
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:1098 index.php:1139 index.php:1215 index.php:1245 index.php:1345 |
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:1103 |
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:1123 |
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:1176 |
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:1227 |
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:1228 |
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:1444 |
304 | msgid "Note: " | 304 | msgid "Note: " |
305 | msgstr "Note : " | 305 | msgstr "Note : " |
306 | 306 | ||
307 | #: index.php:1552 | 307 | #: index.php:1553 |
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:1973 |
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:1983 |
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,25 @@ 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 "Filter links by visibility" |
937 | msgstr "Filtrer par liens privés" | 937 | msgstr "Filtrer les liens par visibilité" |
938 | 938 | ||
939 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:18 | 939 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:17 |
940 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:18 | 940 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:17 |
941 | msgid "Filter untagged links" | 941 | msgid "Filter untagged links" |
942 | msgstr "Filtrer par liens privés" | 942 | msgstr "Filtrer par liens privés" |
943 | 943 | ||
944 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:22 | 944 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:21 |
945 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:74 | 945 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:73 |
946 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:22 | 946 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:21 |
947 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:74 | 947 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:73 |
948 | #: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:43 | 948 | #: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:43 |
949 | #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:43 | 949 | #: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:43 |
950 | msgid "Fold all" | 950 | msgid "Fold all" |
951 | msgstr "Replier tout" | 951 | msgstr "Replier tout" |
952 | 952 | ||
953 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:67 | 953 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:66 |
954 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:67 | 954 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:66 |
955 | msgid "Links per page" | 955 | msgid "Links per page" |
956 | msgstr "Liens par page" | 956 | msgstr "Liens par page" |
957 | 957 | ||
@@ -1127,8 +1127,8 @@ msgstr "Aucun paramètre disponible." | |||
1127 | msgid "tags" | 1127 | msgid "tags" |
1128 | msgstr "tags" | 1128 | msgstr "tags" |
1129 | 1129 | ||
1130 | #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:23 | 1130 | #: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 |
1131 | #: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:23 | 1131 | #: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 |
1132 | msgid "List all links with those tags" | 1132 | msgid "List all links with those tags" |
1133 | msgstr "Lister tous les liens avec ces tags" | 1133 | msgstr "Lister tous les liens avec ces tags" |
1134 | 1134 | ||
@@ -1284,6 +1284,9 @@ msgstr "" | |||
1284 | "Glisser ce lien dans votre barre de favoris ou cliquer droit dessus et « " | 1284 | "Glisser ce lien dans votre barre de favoris ou cliquer droit dessus et « " |
1285 | "Ajouter aux favoris »" | 1285 | "Ajouter aux favoris »" |
1286 | 1286 | ||
1287 | #~ msgid "Filter private links" | ||
1288 | #~ msgstr "Filtrer par liens privés" | ||
1289 | |||
1287 | #~ msgid "Redirector" | 1290 | #~ msgid "Redirector" |
1288 | #~ msgstr "Redirecteur" | 1291 | #~ msgstr "Redirecteur" |
1289 | 1292 | ||
@@ -282,7 +282,7 @@ function logout() { | |||
282 | unset($_SESSION['uid']); | 282 | unset($_SESSION['uid']); |
283 | unset($_SESSION['ip']); | 283 | unset($_SESSION['ip']); |
284 | unset($_SESSION['username']); | 284 | unset($_SESSION['username']); |
285 | unset($_SESSION['privateonly']); | 285 | unset($_SESSION['visibility']); |
286 | unset($_SESSION['untaggedonly']); | 286 | unset($_SESSION['untaggedonly']); |
287 | } | 287 | } |
288 | setcookie('shaarli_staySignedIn', FALSE, 0, WEB_PATH); | 288 | setcookie('shaarli_staySignedIn', FALSE, 0, WEB_PATH); |
@@ -800,7 +800,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager) | |||
800 | // -------- Tag cloud | 800 | // -------- Tag cloud |
801 | if ($targetPage == Router::$PAGE_TAGCLOUD) | 801 | if ($targetPage == Router::$PAGE_TAGCLOUD) |
802 | { | 802 | { |
803 | $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; | 803 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; |
804 | $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; | 804 | $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; |
805 | $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); | 805 | $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); |
806 | 806 | ||
@@ -845,7 +845,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager) | |||
845 | // -------- Tag list | 845 | // -------- Tag list |
846 | if ($targetPage == Router::$PAGE_TAGLIST) | 846 | if ($targetPage == Router::$PAGE_TAGLIST) |
847 | { | 847 | { |
848 | $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; | 848 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; |
849 | $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; | 849 | $filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : []; |
850 | $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); | 850 | $tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility); |
851 | foreach ($filteringTags as $tag) { | 851 | foreach ($filteringTags as $tag) { |
@@ -1011,15 +1011,16 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager) | |||
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | // -------- User wants to see only private links (toggle) | 1013 | // -------- User wants to see only private links (toggle) |
1014 | if (isset($_GET['privateonly'])) { | 1014 | if (isset($_GET['visibility'])) { |
1015 | if (empty($_SESSION['privateonly'])) { | 1015 | unset($_SESSION['visibility']); |
1016 | $_SESSION['privateonly'] = 1; // See only private links | 1016 | if ($_GET['visibility'] === 'private') { |
1017 | } else { | 1017 | $_SESSION['visibility'] = 'private'; // See only private links |
1018 | unset($_SESSION['privateonly']); // See all links | 1018 | } else if ($_GET['visibility'] === 'public') { |
1019 | $_SESSION['visibility'] = 'public'; // See only public links | ||
1019 | } | 1020 | } |
1020 | 1021 | ||
1021 | if (! empty($_SERVER['HTTP_REFERER'])) { | 1022 | if (! empty($_SERVER['HTTP_REFERER'])) { |
1022 | $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('privateonly')); | 1023 | $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('visibility')); |
1023 | } else { | 1024 | } else { |
1024 | $location = '?'; | 1025 | $location = '?'; |
1025 | } | 1026 | } |
@@ -1667,7 +1668,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) | |||
1667 | } | 1668 | } |
1668 | } else { | 1669 | } else { |
1669 | // Filter links according search parameters. | 1670 | // Filter links according search parameters. |
1670 | $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all'; | 1671 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; |
1671 | $request = [ | 1672 | $request = [ |
1672 | 'searchtags' => $searchtags, | 1673 | 'searchtags' => $searchtags, |
1673 | 'searchterm' => $searchterm, | 1674 | 'searchterm' => $searchterm, |
@@ -1743,7 +1744,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) | |||
1743 | 'result_count' => count($linksToDisplay), | 1744 | 'result_count' => count($linksToDisplay), |
1744 | 'search_term' => $searchterm, | 1745 | 'search_term' => $searchterm, |
1745 | 'search_tags' => $searchtags, | 1746 | 'search_tags' => $searchtags, |
1746 | 'visibility' => ! empty($_SESSION['privateonly']) ? 'private' : '', | 1747 | 'visibility' => ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '', |
1747 | 'redirector' => $conf->get('redirector.url'), // Optional redirector URL. | 1748 | 'redirector' => $conf->get('redirector.url'), // Optional redirector URL. |
1748 | 'links' => $linkDisp, | 1749 | 'links' => $linkDisp, |
1749 | ); | 1750 | ); |
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..e1726f87 100644 --- a/tpl/default/linklist.paging.html +++ b/tpl/default/linklist.paging.html | |||
@@ -6,8 +6,8 @@ | |||
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={$nextVisibility}" title="{'Filter links by visibility'|t}" |
10 | class={if="$privateonly"}"filter-on"{else}"filter-off"{/if} | 10 | class="{if="$visibility=='private'"}filter-on{elseif="$visibility=='public'"}filter-block{else}filter-off{/if}" |
11 | ><i class="fa fa-key"></i></a> | 11 | ><i class="fa fa-key"></i></a> |
12 | {/if} | 12 | {/if} |
13 | <a href="?untaggedonly" title="{'Filter untagged links'|t}" | 13 | <a href="?untaggedonly" title="{'Filter untagged links'|t}" |
diff --git a/tpl/vintage/linklist.paging.html b/tpl/vintage/linklist.paging.html index 86019c01..156a6b2a 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={$nextVisibility}"> |
5 | {if="$privateonly"} | 5 | {if="$visibility=='private' || $visibility=='public'"} |
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 | ||