diff options
author | moparisthebest <admin@moparisthebest.com> | 2015-01-12 19:11:45 -0500 |
---|---|---|
committer | moparisthebest <admin@moparisthebest.com> | 2015-01-12 19:52:41 -0500 |
commit | 512e5e5bd195ea4547dc7fa29f34a9d205bd7a54 (patch) | |
tree | 3ab4e2b2a847bc9eab910f20e9d08afee462b064 | |
parent | 7f782e44965b005efe01d347dedd1825872b9345 (diff) | |
download | wallabag-512e5e5bd195ea4547dc7fa29f34a9d205bd7a54.tar.gz wallabag-512e5e5bd195ea4547dc7fa29f34a9d205bd7a54.tar.zst wallabag-512e5e5bd195ea4547dc7fa29f34a9d205bd7a54.zip |
Add ability to delete all articles matching a search
-rwxr-xr-x | inc/poche/Poche.class.php | 31 | ||||
-rwxr-xr-x | themes/baggy/home.twig | 4 | ||||
-rwxr-xr-x | themes/default/home.twig | 4 |
3 files changed, 28 insertions, 11 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index c7c59878..540aa55e 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -201,18 +201,31 @@ class Poche | |||
201 | } | 201 | } |
202 | break; | 202 | break; |
203 | case 'delete': | 203 | case 'delete': |
204 | $msg = 'delete link #' . $id; | 204 | if (isset($_GET['search'])) { |
205 | if ($this->store->deleteById($id, $this->user->getId())) { | 205 | //when we want to apply a delete to a search |
206 | if (DOWNLOAD_PICTURES) { | 206 | $tags = array($_GET['search']); |
207 | Picture::removeDirectory(ABS_PATH . $id); | 207 | $allentry_ids = $this->store->search($tags[0], $this->user->getId()); |
208 | $entry_ids = array(); | ||
209 | foreach ($allentry_ids as $eachentry) { | ||
210 | $entry_ids[] = $eachentry[0]; | ||
208 | } | 211 | } |
209 | $this->messages->add('s', _('the link has been deleted successfully')); | 212 | } else { // delete a single article |
213 | $entry_ids = array($id); | ||
210 | } | 214 | } |
211 | else { | 215 | foreach($entry_ids as $id) { |
212 | $this->messages->add('e', _('the link wasn\'t deleted')); | 216 | $msg = 'delete link #' . $id; |
213 | $msg = 'error : can\'t delete link #' . $id; | 217 | if ($this->store->deleteById($id, $this->user->getId())) { |
218 | if (DOWNLOAD_PICTURES) { | ||
219 | Picture::removeDirectory(ABS_PATH . $id); | ||
220 | } | ||
221 | $this->messages->add('s', _('the link has been deleted successfully')); | ||
222 | } | ||
223 | else { | ||
224 | $this->messages->add('e', _('the link wasn\'t deleted')); | ||
225 | $msg = 'error : can\'t delete link #' . $id; | ||
226 | } | ||
227 | Tools::logm($msg); | ||
214 | } | 228 | } |
215 | Tools::logm($msg); | ||
216 | Tools::redirect('?'); | 229 | Tools::redirect('?'); |
217 | break; | 230 | break; |
218 | case 'toggle_fav' : | 231 | case 'toggle_fav' : |
diff --git a/themes/baggy/home.twig b/themes/baggy/home.twig index abebe455..9cd66395 100755 --- a/themes/baggy/home.twig +++ b/themes/baggy/home.twig | |||
@@ -59,7 +59,9 @@ | |||
59 | {{ block('pager') }} | 59 | {{ block('pager') }} |
60 | {% 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 %} | 60 | {% 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 %} |
61 | {% 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 /> | 61 | {% 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 /> |
62 | 62 | ||
63 | {% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}<br /> | ||
64 | |||
63 | {% if tag %} | 65 | {% if tag %} |
64 | {% 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 %} | 66 | {% 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 %} |
65 | {% 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 %} | 67 | {% 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 %} |
diff --git a/themes/default/home.twig b/themes/default/home.twig index c5db5802..88e6a6ea 100755 --- a/themes/default/home.twig +++ b/themes/default/home.twig | |||
@@ -59,7 +59,9 @@ | |||
59 | {{ block('pager') }} | 59 | {{ block('pager') }} |
60 | {% 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 %} | 60 | {% 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 %} |
61 | {% 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 /> | 61 | {% 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 /> |
62 | 62 | ||
63 | {% if searchterm is defined %}<a title="{% trans "Delete results matching" %} {{ searchterm }}" href="./?action=delete&search={{ searchterm }}">{% trans "Delete results matching" %} {{ searchterm }}</a>{% endif %}<br /> | ||
64 | |||
63 | {% if tag %} | 65 | {% if tag %} |
64 | {% 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 %} | 66 | {% 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 %} |
65 | {% 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 %} | 67 | {% 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 %} |