diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-01-24 18:46:31 +0100 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2018-01-24 18:46:31 +0100 |
commit | d2f6d909e529898c43b32defb890ec8e2d6b72f5 (patch) | |
tree | 1c75ee1302f9968e8a25d5157347d5d4c8c52519 | |
parent | 9d4736a3e95332198896f97ecc8a83abb0cbe85b (diff) | |
download | Shaarli-d2f6d909e529898c43b32defb890ec8e2d6b72f5.tar.gz Shaarli-d2f6d909e529898c43b32defb890ec8e2d6b72f5.tar.zst Shaarli-d2f6d909e529898c43b32defb890ec8e2d6b72f5.zip |
Public/private filter: use two separate buttons
#1038
-rw-r--r-- | application/PageBuilder.php | 21 | ||||
-rw-r--r-- | inc/languages/fr/LC_MESSAGES/shaarli.po | 61 | ||||
-rw-r--r-- | index.php | 16 | ||||
-rw-r--r-- | tpl/default/linklist.paging.html | 9 | ||||
-rw-r--r-- | tpl/vintage/linklist.paging.html | 4 |
5 files changed, 54 insertions, 57 deletions
diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 0902d00d..3233d6b6 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php | |||
@@ -85,7 +85,6 @@ class PageBuilder | |||
85 | $this->tpl->assign('scripturl', index_url($_SERVER)); | 85 | $this->tpl->assign('scripturl', index_url($_SERVER)); |
86 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; | 86 | $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : ''; |
87 | $this->tpl->assign('visibility', $visibility); | 87 | $this->tpl->assign('visibility', $visibility); |
88 | $this->tpl->assign('nextVisibility', $this->getNextVisibility($visibility)); | ||
89 | $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); | 88 | $this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly'])); |
90 | $this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli')); | 89 | $this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli')); |
91 | if ($this->conf->exists('general.header_link')) { | 90 | if ($this->conf->exists('general.header_link')) { |
@@ -172,24 +171,4 @@ class PageBuilder | |||
172 | $this->tpl->assign('error_message', $message); | 171 | $this->tpl->assign('error_message', $message); |
173 | $this->renderPage('404'); | 172 | $this->renderPage('404'); |
174 | } | 173 | } |
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 | } | ||
195 | } | 174 | } |
diff --git a/inc/languages/fr/LC_MESSAGES/shaarli.po b/inc/languages/fr/LC_MESSAGES/shaarli.po index b62ff6ed..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-12-16 14:27+0100\n" | 4 | "POT-Creation-Date: 2018-01-24 18:43+0100\n" |
5 | "PO-Revision-Date: 2017-12-16 14:27+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.5\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:169 | 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:171 | 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 | ||
@@ -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:1093 | 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:1098 index.php:1139 index.php:1215 index.php:1245 index.php:1345 | 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:1103 | 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:1123 | 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:1176 | 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:1227 | 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:1228 | 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:1444 | 303 | #: index.php:1454 |
304 | msgid "Note: " | 304 | msgid "Note: " |
305 | msgstr "Note : " | 305 | msgstr "Note : " |
306 | 306 | ||
307 | #: index.php:1553 | 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:1973 | 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:1983 | 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 | ||
@@ -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 links by visibility" | 936 | msgid "Only display private links" |
937 | msgstr "Filtrer les liens par visibilité" | 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:17 | 944 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:20 |
940 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:17 | 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:21 | 949 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24 |
945 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:73 | 950 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:76 |
946 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:21 | 951 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:24 |
947 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:73 | 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:66 | 958 | #: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:69 |
954 | #: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:66 | 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 | ||
@@ -1284,8 +1289,8 @@ 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 | ||
1287 | #~ msgid "Filter private links" | 1292 | #~ msgid "Filter links by visibility" |
1288 | #~ msgstr "Filtrer par liens privés" | 1293 | #~ msgstr "Filtrer les liens par visibilité" |
1289 | 1294 | ||
1290 | #~ msgid "Redirector" | 1295 | #~ msgid "Redirector" |
1291 | #~ msgstr "Redirecteur" | 1296 | #~ msgstr "Redirecteur" |
@@ -1012,11 +1012,21 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager) | |||
1012 | 1012 | ||
1013 | // -------- User wants to see only private links (toggle) | 1013 | // -------- User wants to see only private links (toggle) |
1014 | if (isset($_GET['visibility'])) { | 1014 | if (isset($_GET['visibility'])) { |
1015 | unset($_SESSION['visibility']); | ||
1016 | if ($_GET['visibility'] === 'private') { | 1015 | if ($_GET['visibility'] === 'private') { |
1017 | $_SESSION['visibility'] = 'private'; // See only private links | 1016 | // Visibility not set or not already private, set private, otherwise reset it |
1017 | if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'private') { | ||
1018 | // See only private links | ||
1019 | $_SESSION['visibility'] = 'private'; | ||
1020 | } else { | ||
1021 | unset($_SESSION['visibility']); | ||
1022 | } | ||
1018 | } else if ($_GET['visibility'] === 'public') { | 1023 | } else if ($_GET['visibility'] === 'public') { |
1019 | $_SESSION['visibility'] = 'public'; // See only public links | 1024 | if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'public') { |
1025 | // See only public links | ||
1026 | $_SESSION['visibility'] = 'public'; | ||
1027 | } else { | ||
1028 | unset($_SESSION['visibility']); | ||
1029 | } | ||
1020 | } | 1030 | } |
1021 | 1031 | ||
1022 | if (! empty($_SERVER['HTTP_REFERER'])) { | 1032 | if (! empty($_SERVER['HTTP_REFERER'])) { |
diff --git a/tpl/default/linklist.paging.html b/tpl/default/linklist.paging.html index e1726f87..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="?visibility={$nextVisibility}" title="{'Filter links by visibility'|t}" | 9 | <a href="?visibility=private" title="{'Only display private links'|t}" |
10 | class="{if="$visibility=='private'"}filter-on{elseif="$visibility=='public'"}filter-block{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 156a6b2a..12828a97 100644 --- a/tpl/vintage/linklist.paging.html +++ b/tpl/vintage/linklist.paging.html | |||
@@ -1,8 +1,8 @@ | |||
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="?visibility={$nextVisibility}"> | 4 | <a href="?visibility=private"> |
5 | {if="$visibility=='private' || $visibility=='public'"} | 5 | {if="$visibility=='private'"} |
6 | <img src="images/private_16x16_active.png#" width="16" height="16" title="Filter links by visibility" alt="Filter links by visibility"> | 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="Filter links by visibility" alt="Filter links by visibility"> | 8 | <img src="images/private_16x16.png#" width="16" height="16" title="Filter links by visibility" alt="Filter links by visibility"> |