]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
implement #1123
authorThomas Citharel <tcit@tcit.fr>
Sun, 1 Mar 2015 23:15:49 +0000 (00:15 +0100)
committerThomas Citharel <tcit@tcit.fr>
Sun, 1 Mar 2015 23:15:49 +0000 (00:15 +0100)
inc/poche/Database.class.php
inc/poche/Poche.class.php
themes/baggy/css/main.css
themes/baggy/fonts/icomoon.eot
themes/baggy/fonts/icomoon.svg
themes/baggy/fonts/icomoon.ttf
themes/baggy/fonts/icomoon.woff
themes/baggy/view.twig
themes/default/css/style-default.css
themes/default/view.twig

index 65675afe1a53b6c4ed9510f9850197b99cbfa27a..4f55a7fe20211848564d6284708acd7c0df0a1b8 100755 (executable)
@@ -421,6 +421,26 @@ class Database {
         return $id;
     }
 
+    public function getPreviousArticle($id, $user_id) 
+    {
+        $sql = "SELECT id FROM entries WHERE id = (SELECT max(id) FROM entries WHERE id < ?) AND user_id=? AND is_read=0";
+        $params = array($id, $user_id);
+        $query = $this->executeQuery($sql, $params);
+        $id_entry = $query->fetchAll();
+        $id = $id_entry[0][0];
+        return $id;
+    }
+
+    public function getNextArticle($id, $user_id) 
+    {
+        $sql = "SELECT id FROM entries WHERE id = (SELECT min(id) FROM entries WHERE id > ?) AND user_id=? AND is_read=0";
+        $params = array($id, $user_id);
+        $query = $this->executeQuery($sql, $params);
+        $id_entry = $query->fetchAll();
+        $id = $id_entry[0][0];
+        return $id;
+    }
+
 
     public function updateContent($id, $content, $user_id)
     {
index 30d42c61bb3ffb9ee6b9632d7b6fc44729236640..18e1d0511a85a7d151633b2ae83216d81963aabf 100755 (executable)
@@ -310,11 +310,16 @@ class Poche
                 if ( Tools::isAjaxRequest() ) {
                   echo 1;
                   exit;
-                }
-                else {
+                } else {
                   Tools::redirect();
                 }
                 break;
+            case 'archive_and_next' :
+                $nextid = $this->store->getNextArticle($id, $this->user->getId());
+                $this->store->archiveById($id, $this->user->getId());
+                Tools::logm('archive link #' . $id);
+                Tools::redirect('?view=view&id=' . $nextid);
+                break;
             case 'archive_all' :
                 $this->store->archiveAll($this->user->getId());
                 Tools::logm('archive all links');
@@ -516,6 +521,20 @@ class Poche
                         $flattr->checkItem($entry['url'], $entry['id']);
                     }
                     
+                    # previous and next
+                    $previous = FALSE;
+                    $previous_id = $this->store->getPreviousArticle($id, $this->user->getId());
+                    $next = FALSE;
+                    $next_id = $this->store->getNextArticle($id, $this->user->getId());
+
+                    if ($this->store->retrieveOneById($previous_id, $this->user->getId())) {
+                        $previous = TRUE;
+                    }
+                    if ($this->store->retrieveOneById($next_id, $this->user->getId())) {
+                        $next = TRUE;
+                    }
+                    $navigate = $arrayName = array('previous' => $previous, 'previousid' => $previous_id, 'next' => $next, 'nextid' => $next_id);
+
                     # tags
                     $tags = $this->store->retrieveTagsByEntry($entry['id']);
 
@@ -523,7 +542,8 @@ class Poche
                         'entry' => $entry,
                         'content' => $content,
                         'flattr' => $flattr,
-                        'tags' => $tags
+                        'tags' => $tags,
+                        'navigate' => $navigate
                     );
                 }
                 else {
index b93a78b82e074d7e4c8173188d6349f0371aefcc..1b221021b72e6c6a7b6c31cddc4d0e92cf0f5ead 100755 (executable)
@@ -748,6 +748,15 @@ a.add-to-wallabag-link-after:after {
 .icon-tags:before {
   content: "\e936";
 }
+.icon-previous:before {
+  content: "\e606";
+}
+.icon-next:before {
+  content: "\e605";
+}
+.icon-archiveandnext:before {
+  content: "\e607";
+}
 
 
 /* .icon-image class, for image-based icons
index 3d4d14ae8a3c0b3f97cd8a3c0868a152944a0c3f..057c7bc4e53b1026502171e346538564da634672 100644 (file)
Binary files a/themes/baggy/fonts/icomoon.eot and b/themes/baggy/fonts/icomoon.eot differ
index 19fcfa1f3479f2a4f46148a4a1116fe4b4e2f56c..f4086b53a521589ea951bfc9772020c302dc2337 100644 (file)
 <glyph unicode="&#xe601;" d="M490.666 146.218c-74.070 0-143.7 28.842-196.096 81.196-52.352 52.394-81.236 122.028-81.236 196.14s28.884 143.744 81.236 196.14c16.682 16.682 43.648 16.682 60.332 0s16.682-43.648 0-60.332c-36.266-36.308-56.236-84.522-56.236-135.808s19.968-99.542 56.236-135.808c36.266-36.268 84.438-56.192 135.764-56.192s99.498 19.968 135.766 56.192c36.308 36.268 56.236 84.48 56.236 135.808s-19.968 99.542-56.236 135.808c-16.682 16.682-16.682 43.648 0 60.332s43.648 16.682 60.332 0c52.352-52.438 81.236-122.070 81.236-196.14s-28.884-143.744-81.236-196.14c-52.394-52.352-122.028-81.194-196.096-81.194zM490.666 469.334c-23.594 0-42.666 19.116-42.666 42.666v213.334c0 23.552 19.072 42.666 42.668 42.666s42.668-19.116 42.668-42.666v-213.334c0-23.552-19.072-42.666-42.668-42.666z" />
 <glyph unicode="&#xe602;" d="M512 803.328l-273.664-273.664c-33.324-33.322-33.324-87.34 0-120.662s87.338-33.322 120.662 0l67.668 67.67v-308.992c0-47.104 38.188-85.332 85.334-85.332 47.104 0 85.332 38.23 85.332 85.332v308.992l67.668-67.67c16.682-16.682 38.486-25.004 60.332-25.004s43.648 8.32 60.332 25.004c33.322 33.322 33.322 87.34 0 120.662l-273.664 273.664z" />
 <glyph unicode="&#xe603;" d="M887.757 752.282c0 58.88-88.678 65.382-88.678 65.382l-208.333 13.107c0 0-4.454 56.678-46.541 76.39-42.086 19.61-88.371 13.619-121.651 13.312-33.28-0.358-41.114-42.752-41.114-82.79 0-39.987 0.717-86.221 0.717-115.2 0-52.122-22.886-74.189-80.179-74.189h-118.118c-33.024 2.099-58.726-3.277-58.726-30.003 0-26.778 38.861-254.618 92.211-307.2 30.976-30.515 220.416-51.917 260.301-51.917s26.573 117.811 37.683 117.811c11.11 0 23.245-66.509 86.118-82.074 62.771-15.718 146.637-12.8 151.091-57.498 5.786-58.982 11.11-135.27-27.699-140.698l-87.859-3.482c-60.211 4.301-44.032 70.093-17.459 70.093s39.885 0.973 39.885 0.973l3.328 71.987c0 0-137.882 16.282-143.718-76.698-5.376-84.992 9.216-125.082 19.917-133.786 10.701-8.806 29.235-25.805 198.093-25.805 237.926 0 150.733 693.402 150.733 752.282zM790.528 444.416c-9.318-10.035-43.11 16.384-75.366 16.384-32.307 0-67.123-17.101-75.315-5.786-8.192 11.213 7.475 101.888 68.301 101.888s91.802-102.605 82.381-112.486zM297.165 759.501c0 11.725 2.97 152.781 2.97 152.781l-179.456-176.128c0 0 124.006 0 148.378 0 24.371 0.051 28.109 11.725 28.109 23.347z" />
+<glyph unicode="&#xe604;" d="M1024 369.556l-512 397.426-512-397.428v162.038l512 397.426 512-397.428zM896 384v-384h-256v256h-256v-256h-256v384l384 288z" />
+<glyph unicode="&#xe605;" d="M621.254 82.746l320 320c24.994 24.992 24.994 65.516 0 90.51l-320 320c-24.994 24.992-65.516 24.992-90.51 0-24.994-24.994-24.994-65.516 0-90.51l210.746-210.746h-613.49c-35.346 0-64-28.654-64-64s28.654-64 64-64h613.49l-210.746-210.746c-12.496-12.496-18.744-28.876-18.744-45.254s6.248-32.758 18.744-45.254c24.994-24.994 65.516-24.994 90.51 0z" />
+<glyph unicode="&#xe606;" d="M402.746 82.746l-320 320c-24.994 24.992-24.994 65.516 0 90.51l320 320c24.994 24.992 65.516 24.992 90.51 0 24.994-24.994 24.994-65.516 0-90.51l-210.746-210.746h613.49c35.346 0 64-28.654 64-64s-28.654-64-64-64h-613.49l210.746-210.746c12.496-12.496 18.744-28.876 18.744-45.254s-6.248-32.758-18.744-45.254c-24.994-24.994-65.516-24.994-90.51 0z" />
+<glyph unicode="&#xe607;" d="M262.14 960c-113.728-206.032-132.89-520.304 313.86-509.824v253.824l384-384-384-384v248.372c-534.96-13.942-594.572 472.214-313.86 775.628z" />
 <glyph unicode="&#xe800;" d="M0 51.712v526.336q0 183.296 87.040 284.672t265.216 101.376h561.152q-5.12-5.12-53.248-54.272t-102.4-103.424-111.616-111.616-97.28-95.232-43.008-37.888q-15.36 0-15.36 16.384v159.744h-49.152q-60.416 0-96.256-6.144t-64.512-26.624-39.936-58.368-12.288-98.304v-268.288zM68.608-68.096q5.12 5.12 54.272 54.272t102.4 103.424 111.616 112.64 97.28 95.232 41.984 36.864q15.36 0 15.36-16.384v-159.744h49.152q118.784 0 165.888 36.864t46.080 152.576v268.288l229.376 228.352v-526.336q0-183.296-86.016-284.672t-266.24-101.376h-561.152z" horiz-adv-x="982" />
 <glyph unicode="&#xe801;" d="M301.056 208.384q14.336 14.336 34.816 14.336t36.864-14.336q32.768-34.816 0-71.68l-43.008-40.96q-57.344-57.344-135.168-57.344-79.872 0-137.216 57.344t-57.344 135.168q0 79.872 57.344 137.216l151.552 151.552q71.68 69.632 147.456 78.848t131.072-44.032q16.384-16.384 16.384-36.864t-16.384-36.864q-36.864-32.768-71.68 0-51.2 49.152-135.168-34.816l-151.552-149.504q-26.624-26.624-26.624-65.536t26.624-63.488q26.624-26.624 64.512-26.624t64.512 26.624zM761.856 796.16q57.344-57.344 57.344-135.168 0-79.872-57.344-137.216l-161.792-161.792q-75.776-73.728-153.6-73.728-63.488 0-114.688 51.2-14.336 14.336-14.336 34.816t14.336 36.864q14.336 14.336 35.84 14.336t35.84-14.336q51.2-49.152 124.928 24.576l161.792 159.744q28.672 28.672 28.672 65.536 0 38.912-28.672 63.488-24.576 26.624-57.344 31.744t-61.44-21.504l-51.2-51.2q-16.384-14.336-36.864-14.336t-34.816 14.336q-34.816 34.816 0 71.68l51.2 51.2q55.296 55.296 130.048 52.224t132.096-62.464z" horiz-adv-x="820" />
 <glyph unicode="&#xe802;" d="M877.568 192v-72.704q0-15.36-10.24-25.6t-26.624-11.264h-803.84q-15.36 0-25.6 11.264t-11.264 25.6v72.704q0 15.36 11.264 25.6t25.6 11.264h803.84q15.36 0 26.624-11.264t10.24-25.6zM877.568 484.864v-73.728q0-14.336-10.24-25.6t-26.624-10.24h-803.84q-15.36 0-25.6 10.24t-11.264 25.6v73.728q0 14.336 11.264 25.6t25.6 10.24h803.84q15.36 0 26.624-10.24t10.24-25.6zM877.568 776.704v-72.704q0-15.36-10.24-25.6t-26.624-11.264h-803.84q-15.36 0-25.6 11.264t-11.264 25.6v72.704q0 15.36 11.264 26.624t25.6 10.24h803.84q15.36 0 26.624-10.24t10.24-26.624z" horiz-adv-x="878" />
index 923f56d81c16584c4f1c6d79514e98c751761d56..f53c9590df93f94a17e2ccf1a37323008b0d0a40 100644 (file)
Binary files a/themes/baggy/fonts/icomoon.ttf and b/themes/baggy/fonts/icomoon.ttf differ
index a2e86d3616c36afbe141308cda65ad8a388f60e7..2a12440c6e5b489f479da1dd0c0800efcf84e80c 100644 (file)
Binary files a/themes/baggy/fonts/icomoon.woff and b/themes/baggy/fonts/icomoon.woff differ
index 7320057f86cb081854b72e0ebcb1f07295495cfb..ae02ce484e13cc1ee6931bca0ff3b53932a22b14 100755 (executable)
@@ -8,8 +8,10 @@
         <div id="article_toolbar">
             <ul class="links">
                 <li class="topPosF"><a href="#top" title="{% trans "Back to top" %}" class="tool top icon icon-arrow-up-thick"><span>{% trans "Back to top" %}</span></a></li>
+                {% if navigate.previous %}<li><a href="./?view=view&amp;id={{ navigate.previousid|e }}" class="tool icon icon-previous"><span>{% trans "Previous Article" %}</span></a></li>{% endif %}
                 <li><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.url | e | getDomain }}</span></a></li>
                 <li><a title="{% trans "Mark as read" %}" class="tool icon icon-check {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="javascript: void(null);" id="markAsRead"><span>{% trans "Toggle mark as read" %}</span></a></li>
+                {% if navigate.next %}<li><a title="{% trans "Mark as read and go to next article" %}" class="tool icon archiveandnext-icon" href="./?action=archive_and_next&amp;id={{ entry.id|e }}" id="markAsReadAndNext"><span>{% trans "Toggle mark as read and go to next article" %}</span></a></li>{% endif %}
                 <li><a title="{% trans "Favorite" %}" class="tool icon icon-star {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="javascript: void(null);" id="setFav"><span>{% trans "Toggle favorite" %}</span></a></li>
                 <li><a title="{% trans "Delete" %}" class="tool delete icon icon-trash" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans "Delete" %}</span></a></li>
                 {% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans "Tweet" %}"><span>{% trans "Tweet" %}</span></a></li>{% endif %}
@@ -25,6 +27,7 @@
                 {% if constant('MOBI') == 1 %}<li><a href="./?mobi&amp;method=id&amp;value={{ entry.id|e }}" title="Generate Mobi file">MOBI</a></li>{% endif %}
                 {% if constant('PDF') == 1 %}<li><a href="./?pdf&amp;method=id&amp;value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %}
                 <li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{% trans "Does this article appear wrong?" %}" class="tool bad-display icon icon-delete"><span>{% trans "Does this article appear wrong?" %}</span></a></li>
+                {% if navigate.next %}<li><a href="./?view=view&amp;id={{ navigate.nextid|e }}" class="tool icon icon-next"><span>{% trans "Next Article" %}</span></a></li>{% endif %}
             </ul>
         </div>
         <div id="article">
index da8703f2b2efe5c4972af80441f9415b1a5436c9..8b18320d94a85b721ed605e7226ca71370c5be44 100755 (executable)
@@ -1,7 +1,19 @@
 a.back span {
+    background-image: url('../img/default/home.png');
+}
+
+a.previous span {
     background-image: url('../img/default/left.png');
 }
 
+a.next span {
+    background-image: url('../img/default/right.png');
+}
+
+a.archiveandnext span {
+    background-image: url('../img/default/forward.png');
+}
+
 a.top span {
     background-image: url('../img/default/top.png');
 }
index 44cbf41b8290248cec5e36f3689d33bf8d0954f6..0d4ec174457d03c35e49c0a49aaad8ca9da9c658 100755 (executable)
@@ -5,10 +5,12 @@
         {% include '_pocheit-form.twig' %}
         <div id="article_toolbar">
             <ul>
+                {% if navigate.previous %}<li><a href="./?view=view&amp;id={{ navigate.previousid|e }}" class="tool previous"><span>{% trans "Previous Article" %}</span></a></li>{% endif %}
                 <li><a href="./" title="{% trans "Return home" %}" class="tool back"><span>{% trans "Return home" %}</span></a></li>
                 <li><a href="#top" title="{% trans "Back to top" %}" class="tool top"><span>{% trans "Back to top" %}</span></a></li>
                 <li><a href="{{ entry.url|e }}" target="_blank" title="{% trans "original" %} : {{ entry.title|e }}" class="tool link"><span>{{ entry.url | e | getDomain }}</span></a></li>
                 <li><a title="{% trans "Mark as read" %}" class="tool {% if entry.is_read == 0 %}archive-off{% else %}archive{% endif %}" href="javascript: void(null);" id="markAsRead"><span>{% trans "Toggle mark as read" %}</span></a></li>
+                {% if navigate.next %}<li><a title="{% trans "Mark as read and go to next article" %}" class="tool archiveandnext" href="./?action=archive_and_next&amp;id={{ entry.id|e }}" id="markAsReadAndNext"><span>{% trans "Toggle mark as read and go to next article" %}</span></a></li>{% endif %}
                 <li><a title="{% trans "Favorite" %}" class="tool {% if entry.is_fav == 0 %}fav-off{% else %}fav{% endif %}" href="javascript: void(null);" id="setFav"><span>{% trans "Toggle favorite" %}</span></a></li>
                 <li><a title="{% trans "Delete" %}" class="tool delete" href="./?action=delete&amp;id={{ entry.id|e }}"><span>{% trans "Delete" %}</span></a></li>
                 {% if constant('SHARE_TWITTER') == 1 %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter" title="{% trans "Tweet" %}"><span>{% trans "Tweet" %}</span></a></li>{% endif %}
@@ -25,6 +27,7 @@
                 {% if constant('PDF') == 1 %}<li><a href="./?pdf&amp;method=id&amp;value={{ entry.id|e }}" title="Generate PDF file">PDF</a></li>{% endif %}
                 <li><a href="mailto:hello@wallabag.org?subject=Wrong%20display%20in%20wallabag&amp;body={{ entry.url|url_encode }}" title="{% trans "Does this article appear wrong?" %}" class="tool bad-display"><span>{% trans "Does this article appear wrong?" %}</span></a></li>
                 {% if constant('SHOW_READPERCENT') == 1 %}<li><div id="readLeftPercent">0%</div></li>{% endif %}
+                {% if navigate.next %}<li><a href="./?view=view&amp;id={{ navigate.nextid|e }}" class="tool next"><span>{% trans "Next Article" %}</span></a></li>{% endif %}
             </ul>
         </div>
         <div id="article">