From: ArthurHoaro Date: Wed, 8 May 2019 09:00:33 +0000 (+0200) Subject: Merge pull request #1296 from ArthurHoaro/feature/sticky-label X-Git-Tag: v0.11.0~20 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=160d9a7741c2db94ba03de0bfda14601c6afdff9;hp=d3defcac1c6785ea074070ba6290e68efe16b1a8;p=github%2Fshaarli%2FShaarli.git Merge pull request #1296 from ArthurHoaro/feature/sticky-label Display sticky label in linklist --- diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 00000000..09e5a6a5 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,15 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation with MkDocs +mkdocs: + configuration: mkdocs.yml + +# Optionally set the version of Python and requirements required to build your docs +# https://github.com/rtfd/readthedocs.org/issues/5250 +python: + version: 3.5 \ No newline at end of file diff --git a/AUTHORS b/AUTHORS index db23ad32..7fa2734a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,13 +1,15 @@ - 687 ArthurHoaro - 355 VirtualTam - 195 nodiscc + 734 ArthurHoaro + 400 VirtualTam + 215 nodiscc 56 Sébastien Sauvage 15 Florian Eula 13 Emilien Klein 12 Nicolas Danelon 9 Willi Eggeling 8 Christophe HENRY + 7 Luce Carević 6 B. van Berkum + 6 llune 5 Lucas Cimon 5 Mark Schmitz 5 kalvn @@ -15,7 +17,7 @@ 4 David Sferruzza 4 Immánuel Fodor 3 Teromene - 3 llune + 2 Alexandre G.-Raymond 2 Chris Kuethe 2 Felix Bartels 2 Knah Tsaeb @@ -27,11 +29,12 @@ 2 julienCXX 2 philipp-r 2 pips + 2 trailjeep 1 Adrien Oliva 1 Adrien le Maire - 1 Alexandre G.-Raymond 1 Alexis J 1 Angristan + 1 Bish Erbas <42714627+bisherbas@users.noreply.github.com> 1 BoboTiG 1 Bronco 1 Buster One <37770318+buster-one@users.noreply.github.com> diff --git a/CHANGELOG.md b/CHANGELOG.md index ada0f109..865e0370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [v0.10.4](https://github.com/shaarli/Shaarli/releases/tag/v0.10.4) - 2019-04-16 +### Fixed +- Fix thumbnails disabling if PHP GD is not installed +- Fix a warning if links sticky status isn't set + ## [v0.10.3](https://github.com/shaarli/Shaarli/releases/tag/v0.10.3) - 2019-02-23 ### Added - Add OpenGraph metadata tags on permalink page diff --git a/README.md b/README.md index ea2c8176..21f2eae7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ _It is designed to be personal (single-user), fast and handy._ [![](https://img.shields.io/badge/stable-v0.9.7-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.9.7) [![](https://img.shields.io/travis/shaarli/Shaarli/stable.svg?label=stable)](https://travis-ci.org/shaarli/Shaarli) • -[![](https://img.shields.io/badge/latest-v0.10.3-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.10.3) +[![](https://img.shields.io/badge/latest-v0.10.4-blue.svg)](https://github.com/shaarli/Shaarli/releases/tag/v0.10.4) [![](https://img.shields.io/travis/shaarli/Shaarli/latest.svg?label=latest)](https://travis-ci.org/shaarli/Shaarli) • [![](https://img.shields.io/badge/master-v0.11.x-blue.svg)](https://github.com/shaarli/Shaarli) diff --git a/application/Router.php b/application/Router.php index 05877acd..d7187487 100644 --- a/application/Router.php +++ b/application/Router.php @@ -38,6 +38,8 @@ class Router public static $PAGE_DELETELINK = 'delete_link'; + public static $PAGE_CHANGE_VISIBILITY = 'change_visibility'; + public static $PAGE_PINLINK = 'pin'; public static $PAGE_EXPORT = 'export'; @@ -149,6 +151,10 @@ class Router return self::$PAGE_DELETELINK; } + if (isset($get[self::$PAGE_CHANGE_VISIBILITY])) { + return self::$PAGE_CHANGE_VISIBILITY; + } + if (startsWith($query, 'do=' . self::$PAGE_PINLINK)) { return self::$PAGE_PINLINK; } diff --git a/assets/default/js/base.js b/assets/default/js/base.js index 99e03370..d5c29c69 100644 --- a/assets/default/js/base.js +++ b/assets/default/js/base.js @@ -466,6 +466,28 @@ function init(description) { }); } + const changeVisibilityButtons = document.querySelectorAll('.actions-change-visibility'); + if (changeVisibilityButtons != null && token != null) { + [...changeVisibilityButtons].forEach((button) => { + button.addEventListener('click', (event) => { + event.preventDefault(); + const visibility = event.target.getAttribute('data-visibility'); + + const links = []; + const linkCheckedCheckboxes = document.querySelectorAll('.link-checkbox:checked'); + [...linkCheckedCheckboxes].forEach((checkbox) => { + links.push({ + id: checkbox.value, + title: document.querySelector(`.linklist-item[data-id="${checkbox.value}"] .linklist-link`).innerHTML, + }); + }); + + const ids = links.map(item => item.id); + window.location = `?change_visibility&token=${token.value}&newVisibility=${visibility}&ids=${ids.join('+')}`; + }); + }); + } + /** * Select all button */ diff --git a/doc/md/Download-and-Installation.md b/doc/md/Download-and-Installation.md index 1c4ad947..8c9e8a32 100644 --- a/doc/md/Download-and-Installation.md +++ b/doc/md/Download-and-Installation.md @@ -24,11 +24,11 @@ Using one of the following methods: In most cases, you should download the latest Shaarli release from the [releases](https://github.com/shaarli/Shaarli/releases) page. Download our **shaarli-full** archive to include dependencies. -The current latest released version is `v0.10.3` +The current latest released version is `v0.10.4` ```bash -$ wget https://github.com/shaarli/Shaarli/releases/download/v0.10.3/shaarli-v0.10.3-full.zip -$ unzip shaarli-v0.10.3-full.zip +$ wget https://github.com/shaarli/Shaarli/releases/download/v0.10.4/shaarli-v0.10.4-full.zip +$ unzip shaarli-v0.10.4-full.zip $ mv Shaarli /path/to/shaarli/ ``` diff --git a/inc/languages/fr/LC_MESSAGES/shaarli.po b/inc/languages/fr/LC_MESSAGES/shaarli.po index 102c80da..649f6dd5 100644 --- a/inc/languages/fr/LC_MESSAGES/shaarli.po +++ b/inc/languages/fr/LC_MESSAGES/shaarli.po @@ -1255,6 +1255,9 @@ msgstr "" #~ msgid "Selection" #~ msgstr "Choisir" +#~ msgid "Select all" +#~ msgstr "Tout sélectionner" + #~ msgid "Public" #~ msgstr "Publics" diff --git a/index.php b/index.php index a96c9cfd..68e0364c 100644 --- a/index.php +++ b/index.php @@ -1266,6 +1266,51 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager, exit; } + // -------- User clicked either "Set public" or "Set private" bulk operation + if ($targetPage == Router::$PAGE_CHANGE_VISIBILITY) { + if (! $sessionManager->checkToken($_GET['token'])) { + die(t('Wrong token.')); + } + + $ids = trim($_GET['ids']); + if (strpos($ids, ' ') !== false) { + // multiple, space-separated ids provided + $ids = array_values(array_filter(preg_split('/\s+/', escape($ids)))); + } else { + // only a single id provided + $ids = [$ids]; + } + + // assert at least one id is given + if (!count($ids)) { + die('no id provided'); + } + // assert that the visibility is valid + if (!isset($_GET['newVisibility']) || !in_array($_GET['newVisibility'], ['public', 'private'])) { + die('invalid visibility'); + } else { + $private = $_GET['newVisibility'] === 'private'; + } + foreach ($ids as $id) { + $id = (int) escape($id); + $link = $LINKSDB[$id]; + $link['private'] = $private; + $pluginManager->executeHooks('save_link', $link); + $LINKSDB[$id] = $link; + } + $LINKSDB->save($conf->get('resource.page_cache')); // save to disk + + $location = '?'; + if (isset($_SERVER['HTTP_REFERER'])) { + $location = generateLocation( + $_SERVER['HTTP_REFERER'], + $_SERVER['HTTP_HOST'] + ); + } + header('Location: ' . $location); // After deleting the link, redirect to appropriate location + exit; + } + // -------- User clicked the "EDIT" button on a link: Display link edit form. if (isset($_GET['edit_link'])) { $id = (int) escape($_GET['edit_link']); @@ -1888,7 +1933,7 @@ $app->group('/api/v1', function () { $this->put('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:putTag')->setName('putTag'); $this->delete('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:deleteTag')->setName('deleteTag'); - $this->get('/history', '\Shaarli\Api\Controllers\History:getHistory')->setName('getHistory'); + $this->get('/history', '\Shaarli\Api\Controllers\HistoryController:getHistory')->setName('getHistory'); })->add('\Shaarli\Api\ApiMiddleware'); $response = $app->run(true); diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html index a43786de..a2aaac82 100644 --- a/tpl/default/linklist.html +++ b/tpl/default/linklist.html @@ -94,7 +94,7 @@ {'tagged'|t} {loop="$exploded_tags"} - {$value} + {$value} {/loop} {/if} @@ -196,18 +196,18 @@ - + - - + - + title="{$strToggleSticky}" aria-label="{$strToggleSticky}" class="pin-link {if="$value.sticky"}pinned-link{/if} pure-u-0 pure-u-lg-visible"> + @@ -249,10 +249,10 @@ {ignore}do not add space or line break between these div - Firefox issue{/ignore} class="linklist-item-infos-url pure-u-lg-5-12 pure-u-1"> - {$value.url} + {$value.url}
@@ -265,12 +265,12 @@ {/if} {if="$is_logged_in"} · - - + · - + {/if}
diff --git a/tpl/default/linklist.paging.html b/tpl/default/linklist.paging.html index fe665a84..4e50495a 100644 --- a/tpl/default/linklist.paging.html +++ b/tpl/default/linklist.paging.html @@ -6,21 +6,21 @@ {'Filters'|t} {if="$is_logged_in"} - - + + > {/if} - - + - - + > + + {loop="$action_plugin"} {$value.attr.class=isset($value.attr.class) ? $value.attr.class : ''} @@ -59,8 +59,8 @@
- - + + diff --git a/tpl/default/page.footer.html b/tpl/default/page.footer.html index 5af39be7..f7ae2b84 100644 --- a/tpl/default/page.footer.html +++ b/tpl/default/page.footer.html @@ -2,7 +2,7 @@
- +
diff --git a/tpl/default/page.header.html b/tpl/default/page.header.html index 4f6dd4d8..2832ebbb 100644 --- a/tpl/default/page.header.html +++ b/tpl/default/page.header.html @@ -20,7 +20,7 @@ {if="$is_logged_in || $openshaarli"}
  • - {'Shaare'|t} + {'Shaare'|t}
  • @@ -67,27 +67,27 @@
  • - - + +
  • {if="!$is_logged_in"}
  • - + id="login-button" aria-label="{'Login'|t}" title="{'Login'|t}"> +
  • {else}
  • - - + +
  • {/if} @@ -118,7 +118,18 @@ diff --git a/tpl/default/tag.sort.html b/tpl/default/tag.sort.html index 89acda0d..d24c9f64 100644 --- a/tpl/default/tag.sort.html +++ b/tpl/default/tag.sort.html @@ -1,8 +1,8 @@ \ No newline at end of file