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
ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt'))
);
$this->tpl->assign('scripturl', index_url($_SERVER));
ApplicationUtils::getVersionHash(SHAARLI_VERSION, $this->conf->get('credentials.salt'))
);
$this->tpl->assign('scripturl', index_url($_SERVER));
- $this->tpl->assign('privateonly', !empty($_SESSION['privateonly'])); // Show only private links?
+ $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '';
+ $this->tpl->assign('visibility', $visibility);
+ $this->tpl->assign('nextVisibility', $this->getNextVisibility($visibility));
$this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly']));
$this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli'));
if ($this->conf->exists('general.header_link')) {
$this->tpl->assign('untaggedonly', !empty($_SESSION['untaggedonly']));
$this->tpl->assign('pagetitle', $this->conf->get('general.title', 'Shaarli'));
if ($this->conf->exists('general.header_link')) {
$this->tpl->assign('error_message', $message);
$this->renderPage('404');
}
$this->tpl->assign('error_message', $message);
$this->renderPage('404');
}
+
+ /**
+ * Return the next visibility option:
+ * private -> public -> all
+ *
+ * @param string $current visibility value
+ *
+ * @return string next visibility value
+ */
+ protected function getNextVisibility($current)
+ {
+ switch ($current) {
+ case 'private':
+ return 'public';
+ case 'public':
+ return '';
+ default:
+ return 'private';
+ }
+ }
$this->linkDB->save($this->conf->get('resource.page_cache'));
return true;
}
$this->linkDB->save($this->conf->get('resource.page_cache'));
return true;
}
+
+ /**
+ * Change privateonly session key to visibility.
+ */
+ public function updateMethodVisibilitySession()
+ {
+ if (isset($_SESSION['privateonly'])) {
+ unset($_SESSION['privateonly']);
+ $_SESSION['visibility'] = 'private';
+ }
+ return true;
+ }
msgid ""
msgstr ""
"Project-Id-Version: Shaarli\n"
msgid ""
msgstr ""
"Project-Id-Version: Shaarli\n"
-"POT-Creation-Date: 2017-11-11 10:59+0100\n"
-"PO-Revision-Date: 2017-11-11 11:00+0100\n"
+"POT-Creation-Date: 2017-12-16 14:27+0100\n"
+"PO-Revision-Date: 2017-12-16 14:27+0100\n"
"Last-Translator: \n"
"Language-Team: Shaarli\n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Last-Translator: \n"
"Language-Team: Shaarli\n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Poedit 2.0.4\n"
+"X-Generator: Poedit 2.0.5\n"
"X-Poedit-Basepath: ../../../..\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-Basepath: ../../../..\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Poedit-SourceCharset: UTF-8\n"
"a été importé avec succès en %d secondes : %d liens importés, %d liens "
"écrasés, %d liens ignorés."
"a été importé avec succès en %d secondes : %d liens importés, %d liens "
"écrasés, %d liens ignorés."
-#: application/PageBuilder.php:167
+#: application/PageBuilder.php:169
msgid "The page you are trying to reach does not exist or has been deleted."
msgstr "La page que vous essayez de consulter n'existe pas ou a été supprimée."
msgid "The page you are trying to reach does not exist or has been deleted."
msgstr "La page que vous essayez de consulter n'existe pas ou a été supprimée."
-#: application/PageBuilder.php:169
+#: application/PageBuilder.php:171
msgid "404 Not Found"
msgstr "404 Introuvable"
msgid "404 Not Found"
msgstr "404 Introuvable"
msgid "Couldn't retrieve Updater class methods."
msgstr "Impossible de récupérer les méthodes de la classe Updater."
msgid "Couldn't retrieve Updater class methods."
msgstr "Impossible de récupérer les méthodes de la classe Updater."
-#: application/Updater.php:493
+#: application/Updater.php:506
msgid "An error occurred while running the update "
msgstr "Une erreur s'est produite lors de l'exécution de la mise à jour "
msgid "An error occurred while running the update "
msgstr "Une erreur s'est produite lors de l'exécution de la mise à jour "
-#: application/Updater.php:533
+#: application/Updater.php:546
msgid "Updates file path is not set, can't write updates."
msgstr ""
"Le chemin vers le fichier de mise à jour n'est pas défini, impossible "
"d'écrire les mises à jour."
msgid "Updates file path is not set, can't write updates."
msgstr ""
"Le chemin vers le fichier de mise à jour n'est pas défini, impossible "
"d'écrire les mises à jour."
-#: application/Updater.php:538
+#: application/Updater.php:551
msgid "Unable to write updates in "
msgstr "Impossible d'écrire les mises à jour dans "
msgid "Unable to write updates in "
msgstr "Impossible d'écrire les mises à jour dans "
msgid "Wrong login/password."
msgstr "Nom d'utilisateur ou mot de passe incorrects."
msgid "Wrong login/password."
msgstr "Nom d'utilisateur ou mot de passe incorrects."
msgid "You are not supposed to change a password on an Open Shaarli."
msgstr ""
"Vous n'êtes pas censé modifier le mot de passe d'un Shaarli en mode ouvert."
msgid "You are not supposed to change a password on an Open Shaarli."
msgstr ""
"Vous n'êtes pas censé modifier le mot de passe d'un Shaarli en mode ouvert."
-#: index.php:1097 index.php:1138 index.php:1214 index.php:1244 index.php:1344
+#: index.php:1098 index.php:1139 index.php:1215 index.php:1245 index.php:1345
msgid "Wrong token."
msgstr "Jeton invalide."
msgid "Wrong token."
msgstr "Jeton invalide."
msgid "The old password is not correct."
msgstr "L'ancien mot de passe est incorrect."
msgid "The old password is not correct."
msgstr "L'ancien mot de passe est incorrect."
msgid "Your password has been changed"
msgstr "Votre mot de passe a été modifié"
msgid "Your password has been changed"
msgstr "Votre mot de passe a été modifié"
msgid "Configuration was saved."
msgstr "La configuration a été sauvegardé."
msgid "Configuration was saved."
msgstr "La configuration a été sauvegardé."
#, php-format
msgid "The tag was removed from %d link."
msgid_plural "The tag was removed from %d links."
msgstr[0] "Le tag a été supprimé de %d lien."
msgstr[1] "Le tag a été supprimé de %d liens."
#, php-format
msgid "The tag was removed from %d link."
msgid_plural "The tag was removed from %d links."
msgstr[0] "Le tag a été supprimé de %d lien."
msgstr[1] "Le tag a été supprimé de %d liens."
#, php-format
msgid "The tag was renamed in %d link."
msgid_plural "The tag was renamed in %d links."
msgstr[0] "Le tag a été renommé dans %d lien."
msgstr[1] "Le tag a été renommé dans %d liens."
#, php-format
msgid "The tag was renamed in %d link."
msgid_plural "The tag was renamed in %d links."
msgstr[0] "Le tag a été renommé dans %d lien."
msgstr[1] "Le tag a été renommé dans %d liens."
msgid "Note: "
msgstr "Note : "
msgid "Note: "
msgstr "Note : "
#, php-format
msgid ""
"The file you are trying to upload is probably bigger than what this "
#, php-format
msgid ""
"The file you are trying to upload is probably bigger than what this "
"le serveur web peut accepter (%s). Merci de l'envoyer en parties plus "
"légères."
"le serveur web peut accepter (%s). Merci de l'envoyer en parties plus "
"légères."
#, php-format
msgid ""
"<pre>Sessions do not seem to work correctly on your server.<br>Make sure the "
#, php-format
msgid ""
"<pre>Sessions do not seem to work correctly on your server.<br>Make sure the "
"cookies. Nous vous recommandons d'accéder à votre serveur depuis son adresse "
"IP ou un <em>Fully Qualified Domain Name</em>.<br>"
"cookies. Nous vous recommandons d'accéder à votre serveur depuis son adresse "
"IP ou un <em>Fully Qualified Domain Name</em>.<br>"
msgid "Click to try again."
msgstr "Cliquer ici pour réessayer."
msgid "Click to try again."
msgstr "Cliquer ici pour réessayer."
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:38
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:124
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:124
#: tmp/linklist.b91ef64efc3688266305ea9b42e5017e.rtpl.php:38
#: tmp/page.header.b91ef64efc3688266305ea9b42e5017e.rtpl.php:124
#: tmp/page.header.cedf684561d925457130839629000a81.rtpl.php:124
-#: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:33
-#: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:61
-#: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:33
-#: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:71
+#: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36
+#: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:64
+#: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:36
+#: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:74
msgid "Filter by tag"
msgstr "Filtrer par tag"
msgid "Filter by tag"
msgstr "Filtrer par tag"
#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:12
#: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:12
#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:12
#: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:12
-msgid "Filter private links"
-msgstr "Filtrer par liens privés"
+msgid "Filter links by visibility"
+msgstr "Filtrer les liens par visibilité"
-#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:18
-#: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:18
+#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:17
+#: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:17
msgid "Filter untagged links"
msgstr "Filtrer par liens privés"
msgid "Filter untagged links"
msgstr "Filtrer par liens privés"
-#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:22
-#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:74
-#: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:22
-#: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:74
+#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:21
+#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:73
+#: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:21
+#: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:73
#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:43
#: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:43
msgid "Fold all"
msgstr "Replier tout"
#: tmp/page.footer.b91ef64efc3688266305ea9b42e5017e.rtpl.php:43
#: tmp/page.footer.cedf684561d925457130839629000a81.rtpl.php:43
msgid "Fold all"
msgstr "Replier tout"
-#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:67
-#: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:67
+#: tmp/linklist.paging.b91ef64efc3688266305ea9b42e5017e.rtpl.php:66
+#: tmp/linklist.paging.cedf684561d925457130839629000a81.rtpl.php:66
msgid "Links per page"
msgstr "Liens par page"
msgid "Links per page"
msgstr "Liens par page"
msgid "tags"
msgstr "tags"
msgid "tags"
msgstr "tags"
-#: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:23
-#: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:23
+#: tmp/tag.cloud.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24
+#: tmp/tag.list.b91ef64efc3688266305ea9b42e5017e.rtpl.php:24
msgid "List all links with those tags"
msgstr "Lister tous les liens avec ces tags"
msgid "List all links with those tags"
msgstr "Lister tous les liens avec ces tags"
"Glisser ce lien dans votre barre de favoris ou cliquer droit dessus et « "
"Ajouter aux favoris »"
"Glisser ce lien dans votre barre de favoris ou cliquer droit dessus et « "
"Ajouter aux favoris »"
+#~ msgid "Filter private links"
+#~ msgstr "Filtrer par liens privés"
+
#~ msgid "Redirector"
#~ msgstr "Redirecteur"
#~ msgid "Redirector"
#~ msgstr "Redirecteur"
unset($_SESSION['uid']);
unset($_SESSION['ip']);
unset($_SESSION['username']);
unset($_SESSION['uid']);
unset($_SESSION['ip']);
unset($_SESSION['username']);
- unset($_SESSION['privateonly']);
+ unset($_SESSION['visibility']);
unset($_SESSION['untaggedonly']);
}
setcookie('shaarli_staySignedIn', FALSE, 0, WEB_PATH);
unset($_SESSION['untaggedonly']);
}
setcookie('shaarli_staySignedIn', FALSE, 0, WEB_PATH);
// -------- Tag cloud
if ($targetPage == Router::$PAGE_TAGCLOUD)
{
// -------- Tag cloud
if ($targetPage == Router::$PAGE_TAGCLOUD)
{
- $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all';
+ $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '';
$filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : [];
$tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility);
$filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : [];
$tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility);
// -------- Tag list
if ($targetPage == Router::$PAGE_TAGLIST)
{
// -------- Tag list
if ($targetPage == Router::$PAGE_TAGLIST)
{
- $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all';
+ $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '';
$filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : [];
$tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility);
foreach ($filteringTags as $tag) {
$filteringTags = isset($_GET['searchtags']) ? explode(' ', $_GET['searchtags']) : [];
$tags = $LINKSDB->linksCountPerTag($filteringTags, $visibility);
foreach ($filteringTags as $tag) {
}
// -------- User wants to see only private links (toggle)
}
// -------- User wants to see only private links (toggle)
- if (isset($_GET['privateonly'])) {
- if (empty($_SESSION['privateonly'])) {
- $_SESSION['privateonly'] = 1; // See only private links
- } else {
- unset($_SESSION['privateonly']); // See all links
+ if (isset($_GET['visibility'])) {
+ unset($_SESSION['visibility']);
+ if ($_GET['visibility'] === 'private') {
+ $_SESSION['visibility'] = 'private'; // See only private links
+ } else if ($_GET['visibility'] === 'public') {
+ $_SESSION['visibility'] = 'public'; // See only public links
}
if (! empty($_SERVER['HTTP_REFERER'])) {
}
if (! empty($_SERVER['HTTP_REFERER'])) {
- $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('privateonly'));
+ $location = generateLocation($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'], array('visibility'));
} else {
$location = '?';
}
} else {
$location = '?';
}
}
} else {
// Filter links according search parameters.
}
} else {
// Filter links according search parameters.
- $visibility = ! empty($_SESSION['privateonly']) ? 'private' : 'all';
+ $visibility = ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '';
$request = [
'searchtags' => $searchtags,
'searchterm' => $searchterm,
$request = [
'searchtags' => $searchtags,
'searchterm' => $searchterm,
'result_count' => count($linksToDisplay),
'search_term' => $searchterm,
'search_tags' => $searchtags,
'result_count' => count($linksToDisplay),
'search_term' => $searchterm,
'search_tags' => $searchtags,
- 'visibility' => ! empty($_SESSION['privateonly']) ? 'private' : '',
+ 'visibility' => ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '',
'redirector' => $conf->get('redirector.url'), // Optional redirector URL.
'links' => $linkDisp,
);
'redirector' => $conf->get('redirector.url'), // Optional redirector URL.
'links' => $linkDisp,
);
+.linklist-filters .filter-block {
+ color: #f5f5f5;
+ background: #ac2925;
+}
+
.linklist-pages {
margin: 5px 0;
color: #252525;
.linklist-pages {
margin: 5px 0;
color: #252525;
{'Filters'|t}
</span>
{if="isLoggedIn()"}
{'Filters'|t}
</span>
{if="isLoggedIn()"}
- <a href="?privateonly" title="{'Filter private links'|t}"
- class={if="$privateonly"}"filter-on"{else}"filter-off"{/if}
+ <a href="?visibility={$nextVisibility}" title="{'Filter links by visibility'|t}"
+ class="{if="$visibility=='private'"}filter-on{elseif="$visibility=='public'"}filter-block{else}filter-off{/if}"
><i class="fa fa-key"></i></a>
{/if}
<a href="?untaggedonly" title="{'Filter untagged links'|t}"
><i class="fa fa-key"></i></a>
{/if}
<a href="?untaggedonly" title="{'Filter untagged links'|t}"
<div class="paging">
{if="isLoggedIn()"}
<div class="paging_privatelinks">
<div class="paging">
{if="isLoggedIn()"}
<div class="paging_privatelinks">
- <a href="?privateonly">
- {if="$privateonly"}
- <img src="images/private_16x16_active.png#" width="16" height="16" title="Click to see all links" alt="Click to see all links">
+ <a href="?visibility={$nextVisibility}">
+ {if="$visibility=='private' || $visibility=='public'"}
+ <img src="images/private_16x16_active.png#" width="16" height="16" title="Filter links by visibility" alt="Filter links by visibility">
- <img src="images/private_16x16.png#" width="16" height="16" title="Click to see only private links" alt="Click to see only private links">
+ <img src="images/private_16x16.png#" width="16" height="16" title="Filter links by visibility" alt="Filter links by visibility">