aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2015-01-13 22:45:33 +0100
committerThomas Citharel <tcit@tcit.fr>2015-01-13 22:45:33 +0100
commitaf5c371e951ae2bc9ccd9a7164e0c04101b39ace (patch)
treeeb85531a6bdd00495e4aab5f3493e34984a7dfbf
parent8ae45e7fe27ab416cf2a30cd2c319940037b7cbf (diff)
parent13c7f9a462b71e89d5e252b693fc7d00aca249ec (diff)
downloadwallabag-af5c371e951ae2bc9ccd9a7164e0c04101b39ace.tar.gz
wallabag-af5c371e951ae2bc9ccd9a7164e0c04101b39ace.tar.zst
wallabag-af5c371e951ae2bc9ccd9a7164e0c04101b39ace.zip
Merge pull request #999 from moparisthebest/additions_dev
Miscellaneous additions
-rwxr-xr-xinc/poche/Poche.class.php55
-rwxr-xr-xthemes/baggy/home.twig6
-rwxr-xr-xthemes/default/home.twig8
3 files changed, 55 insertions, 14 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index a29cb327..20897c61 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -180,6 +180,13 @@ class Poche
180 } 180 }
181 } 181 }
182 182
183 // if there are tags, add them to the new article
184 if (isset($_GET['tags'])) {
185 $_POST['value'] = $_GET['tags'];
186 $_POST['entry_id'] = $last_id;
187 $this->action('add_tag', $url);
188 }
189
183 $this->messages->add('s', _('the link has been added successfully')); 190 $this->messages->add('s', _('the link has been added successfully'));
184 } 191 }
185 else { 192 else {
@@ -194,18 +201,31 @@ class Poche
194 } 201 }
195 break; 202 break;
196 case 'delete': 203 case 'delete':
197 $msg = 'delete link #' . $id; 204 if (isset($_GET['search'])) {
198 if ($this->store->deleteById($id, $this->user->getId())) { 205 //when we want to apply a delete to a search
199 if (DOWNLOAD_PICTURES) { 206 $tags = array($_GET['search']);
200 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];
201 } 211 }
202 $this->messages->add('s', _('the link has been deleted successfully')); 212 } else { // delete a single article
213 $entry_ids = array($id);
203 } 214 }
204 else { 215 foreach($entry_ids as $id) {
205 $this->messages->add('e', _('the link wasn\'t deleted')); 216 $msg = 'delete link #' . $id;
206 $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);
207 } 228 }
208 Tools::logm($msg);
209 Tools::redirect('?'); 229 Tools::redirect('?');
210 break; 230 break;
211 case 'toggle_fav' : 231 case 'toggle_fav' :
@@ -220,8 +240,21 @@ class Poche
220 } 240 }
221 break; 241 break;
222 case 'toggle_archive' : 242 case 'toggle_archive' :
223 $this->store->archiveById($id, $this->user->getId()); 243 if (isset($_GET['tag_id'])) {
224 Tools::logm('archive link #' . $id); 244 //when we want to archive a whole tag
245 $tag_id = $_GET['tag_id'];
246 $allentry_ids = $this->store->retrieveEntriesByTag($tag_id, $this->user->getId());
247 $entry_ids = array();
248 foreach ($allentry_ids as $eachentry) {
249 $entry_ids[] = $eachentry[0];
250 }
251 } else { //archive a single article
252 $entry_ids = array($id);
253 }
254 foreach($entry_ids as $id) {
255 $this->store->archiveById($id, $this->user->getId());
256 Tools::logm('archive link #' . $id);
257 }
225 if ( Tools::isAjaxRequest() ) { 258 if ( Tools::isAjaxRequest() ) {
226 echo 1; 259 echo 1;
227 exit; 260 exit;
diff --git a/themes/baggy/home.twig b/themes/baggy/home.twig
index abebe455..93515080 100755
--- a/themes/baggy/home.twig
+++ b/themes/baggy/home.twig
@@ -59,7 +59,11 @@
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
65 {% if tag %}<a title="{% trans "Mark all articles from this tag as read" %}" href="./?action=toggle_archive&amp;tag_id={{ tag.id }}">{% trans "Mark all articles from this tag as read" %}</a><br />{% endif %}
66
63 {% if tag %} 67 {% if tag %}
64 {% if constant('EPUB') == 1 %}<a title="{% trans "Download the articles from this tag in an epub file" %}" href="./?epub&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download as ePub3" %}</a>{% endif %} 68 {% if constant('EPUB') == 1 %}<a title="{% trans "Download the articles from this tag in an epub file" %}" href="./?epub&amp;method=tag&amp;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&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download as Mobi" %}</a>{% endif %} 69 {% if constant('MOBI') == 1 %}<a title="{% trans "Download the articles from this tag in a mobi file" %}" href="./?mobi&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download as Mobi" %}</a>{% endif %}
diff --git a/themes/default/home.twig b/themes/default/home.twig
index c5db5802..b9000559 100755
--- a/themes/default/home.twig
+++ b/themes/default/home.twig
@@ -59,7 +59,11 @@
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
65 {% if tag %}<a title="{% trans "Mark all articles from this tag as read" %}" href="./?action=toggle_archive&amp;tag_id={{ tag.id }}">{% trans "Mark all articles from this tag as read" %}</a><br />{% endif %}
66
63 {% if tag %} 67 {% if tag %}
64 {% if constant('EPUB') == 1 %}<a title="{% trans "Download the articles from this tag in an epub file" %}" href="./?epub&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download as ePub3" %}</a>{% endif %} 68 {% if constant('EPUB') == 1 %}<a title="{% trans "Download the articles from this tag in an epub file" %}" href="./?epub&amp;method=tag&amp;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&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download as Mobi" %}</a>{% endif %} 69 {% if constant('MOBI') == 1 %}<a title="{% trans "Download the articles from this tag in a mobi file" %}" href="./?mobi&amp;method=tag&amp;value={{ tag.value }}">{% trans "Download as Mobi" %}</a>{% endif %}
@@ -73,6 +77,6 @@
73 {% if constant('MOBI') == 1 %}<a title="{% trans "Download the articles from this category in a mobi file" %}" href="./?mobi&amp;method=category&amp;value={{ view }}">{% trans "Download as Mobi" %}</a>{% endif %} 77 {% if constant('MOBI') == 1 %}<a title="{% trans "Download the articles from this category in a mobi file" %}" href="./?mobi&amp;method=category&amp;value={{ view }}">{% trans "Download as Mobi" %}</a>{% endif %}
74 {% if constant('PDF') == 1 %}<a title="{% trans "Download the articles from this category in a pdf file" %}" href="./?pdf&amp;method=category&amp;value={{ view }}">{% trans "Download as PDF" %}</a>{% endif %} 78 {% if constant('PDF') == 1 %}<a title="{% trans "Download the articles from this category in a pdf file" %}" href="./?pdf&amp;method=category&amp;value={{ view }}">{% trans "Download as PDF" %}</a>{% endif %}
75 {% endif %} 79 {% endif %}
76 80
77 {% endif %} 81 {% endif %}
78{% endblock %} 82{% endblock %}