mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-23 08:06:33 +00:00
Add ability to delete all articles matching a search
This commit is contained in:
parent
7f782e4496
commit
512e5e5bd1
3 changed files with 28 additions and 11 deletions
|
@ -201,18 +201,31 @@ class Poche
|
|||
}
|
||||
break;
|
||||
case 'delete':
|
||||
$msg = 'delete link #' . $id;
|
||||
if ($this->store->deleteById($id, $this->user->getId())) {
|
||||
if (DOWNLOAD_PICTURES) {
|
||||
Picture::removeDirectory(ABS_PATH . $id);
|
||||
if (isset($_GET['search'])) {
|
||||
//when we want to apply a delete to a search
|
||||
$tags = array($_GET['search']);
|
||||
$allentry_ids = $this->store->search($tags[0], $this->user->getId());
|
||||
$entry_ids = array();
|
||||
foreach ($allentry_ids as $eachentry) {
|
||||
$entry_ids[] = $eachentry[0];
|
||||
}
|
||||
$this->messages->add('s', _('the link has been deleted successfully'));
|
||||
} else { // delete a single article
|
||||
$entry_ids = array($id);
|
||||
}
|
||||
else {
|
||||
$this->messages->add('e', _('the link wasn\'t deleted'));
|
||||
$msg = 'error : can\'t delete link #' . $id;
|
||||
foreach($entry_ids as $id) {
|
||||
$msg = 'delete link #' . $id;
|
||||
if ($this->store->deleteById($id, $this->user->getId())) {
|
||||
if (DOWNLOAD_PICTURES) {
|
||||
Picture::removeDirectory(ABS_PATH . $id);
|
||||
}
|
||||
$this->messages->add('s', _('the link has been deleted successfully'));
|
||||
}
|
||||
else {
|
||||
$this->messages->add('e', _('the link wasn\'t deleted'));
|
||||
$msg = 'error : can\'t delete link #' . $id;
|
||||
}
|
||||
Tools::logm($msg);
|
||||
}
|
||||
Tools::logm($msg);
|
||||
Tools::redirect('?');
|
||||
break;
|
||||
case 'toggle_fav' :
|
||||
|
|
|
@ -60,6 +60,8 @@
|
|||
{% if view == 'home' %}{% if nb_results > 1 %}<p><a title="{% trans "Mark all the entries as read" %}" href="./?action=archive_all">{% trans "Mark all the entries as read" %}</a></p>{% endif %}{% endif %}
|
||||
{% if searchterm is defined %}<a title="{% trans "Tag these results as" %} {{ searchterm }}" href="./?action=add_tag&search={{ searchterm }}">{% trans "Tag these results as" %} {{ searchterm }}</a>{% endif %}<br />
|
||||
|
||||
{% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}<br />
|
||||
|
||||
{% if tag %}
|
||||
{% if constant('EPUB') == 1 %}<a title="{% trans "Download the articles from this tag in an epub file" %}" href="./?epub&method=tag&value={{ tag.value }}">{% trans "Download as ePub3" %}</a>{% endif %}
|
||||
{% if constant('MOBI') == 1 %}<a title="{% trans "Download the articles from this tag in a mobi file" %}" href="./?mobi&method=tag&value={{ tag.value }}">{% trans "Download as Mobi" %}</a>{% endif %}
|
||||
|
|
|
@ -60,6 +60,8 @@
|
|||
{% if view == 'home' %}{% if nb_results > 1 %}<p><a title="{% trans "Mark all the entries as read" %}" href="./?action=archive_all">{% trans "Mark all the entries as read" %}</a></p>{% endif %}{% endif %}
|
||||
{% if searchterm is defined %}<a title="{% trans "Tag these results as" %} {{ searchterm }}" href="./?action=add_tag&search={{ searchterm }}">{% trans "Tag these results as" %} {{ searchterm }}</a>{% endif %}<br />
|
||||
|
||||
{% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}<br />
|
||||
|
||||
{% if tag %}
|
||||
{% if constant('EPUB') == 1 %}<a title="{% trans "Download the articles from this tag in an epub file" %}" href="./?epub&method=tag&value={{ tag.value }}">{% trans "Download as ePub3" %}</a>{% endif %}
|
||||
{% if constant('MOBI') == 1 %}<a title="{% trans "Download the articles from this tag in a mobi file" %}" href="./?mobi&method=tag&value={{ tag.value }}">{% trans "Download as Mobi" %}</a>{% endif %}
|
||||
|
|
Loading…
Reference in a new issue