Add ability to delete all articles matching a search

This commit is contained in:
Travis Burtrum 2015-01-12 19:11:45 -05:00
parent acd99aa010
commit 7667694cc8
4 changed files with 30 additions and 9 deletions

View File

@ -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' :

View File

@ -61,6 +61,9 @@
{% if searchterm is defined %}<p><a title="{% trans "Tag these results as" %} {{ searchterm }}" href="./?action=add_tag&search={{ searchterm }}">
{% trans "Tag these results as" %} {{ searchterm }}</p></a>{% endif %}
{% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">
{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}
{% if tag %}<p><a title="{% trans "Download the articles from this tag in an epub" %}" href="./?epub&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download the articles from this tag in an epub" %}</p></a>
{% elseif search_term is defined %}<p><a title="{% trans "Download the articles from this search in an epub" %}" href="./?epub&amp;method=search&amp;value={{ search_term }}">{% trans "Download the articles from this search in an epub" %}</p></a>

View File

@ -55,6 +55,8 @@
{% 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 %}
{% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}
{% if tag %}<a title="{% trans "Download the articles from this tag in an epub" %}" href="./?epub&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download the articles from this tag in an epub" %}</a>
{% elseif searchterm is defined %}<a title="{% trans "Download the articles from this search in an epub" %}" href="./?epub&amp;method=search&amp;value={{ searchterm }}">{% trans "Download the articles from this search in an epub" %}</a>
{% else %}<a title="{% trans "Download the articles from this category in an epub" %}" href="./?epub&amp;method=category&amp;value={{ view }}">{% trans "Download the articles from this category in an epub" %}</a>{% endif %}

View File

@ -63,6 +63,9 @@
{% 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 %}
{% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">
{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}
{% if tag %}<a title="{% trans "Download the articles from this tag in an epub" %}" href="./?epub&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download the articles from this tag in an epub" %}</a>
{% elseif searchterm is defined %}<a title="{% trans "Download the articles from this search in an epub" %}" href="./?epub&amp;method=search&amp;value={{ searchterm }}">{% trans "Download the articles from this search in an epub" %}</a>
{% else %}<a title="{% trans "Download the articles from this category in an epub" %}" href="./?epub&amp;method=category&amp;value={{ view }}">{% trans "Download the articles from this category in an epub" %}</a>{% endif %}