From 059a3380341c439e1debb4921bbf023a3b424a4b Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 2 Mar 2015 00:15:49 +0100 Subject: implement #1123 --- inc/poche/Database.class.php | 20 ++++++++++++++++++++ inc/poche/Poche.class.php | 26 +++++++++++++++++++++++--- themes/baggy/css/main.css | 9 +++++++++ themes/baggy/fonts/icomoon.eot | Bin 6304 -> 6672 bytes themes/baggy/fonts/icomoon.svg | 4 ++++ themes/baggy/fonts/icomoon.ttf | Bin 6140 -> 6508 bytes themes/baggy/fonts/icomoon.woff | Bin 6216 -> 6584 bytes themes/baggy/view.twig | 3 +++ themes/default/css/style-default.css | 12 ++++++++++++ themes/default/view.twig | 3 +++ 10 files changed, 74 insertions(+), 3 deletions(-) diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 65675afe..4f55a7fe 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -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) { diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 30d42c61..18e1d051 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -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 { diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css index b93a78b8..1b221021 100755 --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css @@ -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 diff --git a/themes/baggy/fonts/icomoon.eot b/themes/baggy/fonts/icomoon.eot index 3d4d14ae..057c7bc4 100644 Binary files a/themes/baggy/fonts/icomoon.eot and b/themes/baggy/fonts/icomoon.eot differ diff --git a/themes/baggy/fonts/icomoon.svg b/themes/baggy/fonts/icomoon.svg index 19fcfa1f..f4086b53 100644 --- a/themes/baggy/fonts/icomoon.svg +++ b/themes/baggy/fonts/icomoon.svg @@ -11,6 +11,10 @@ + + + + diff --git a/themes/baggy/fonts/icomoon.ttf b/themes/baggy/fonts/icomoon.ttf index 923f56d8..f53c9590 100644 Binary files a/themes/baggy/fonts/icomoon.ttf and b/themes/baggy/fonts/icomoon.ttf differ diff --git a/themes/baggy/fonts/icomoon.woff b/themes/baggy/fonts/icomoon.woff index a2e86d36..2a12440c 100644 Binary files a/themes/baggy/fonts/icomoon.woff and b/themes/baggy/fonts/icomoon.woff differ diff --git a/themes/baggy/view.twig b/themes/baggy/view.twig index 7320057f..ae02ce48 100755 --- a/themes/baggy/view.twig +++ b/themes/baggy/view.twig @@ -8,8 +8,10 @@
diff --git a/themes/default/css/style-default.css b/themes/default/css/style-default.css index da8703f2..8b18320d 100755 --- a/themes/default/css/style-default.css +++ b/themes/default/css/style-default.css @@ -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'); } diff --git a/themes/default/view.twig b/themes/default/view.twig index 44cbf41b..0d4ec174 100755 --- a/themes/default/view.twig +++ b/themes/default/view.twig @@ -5,10 +5,12 @@ {% include '_pocheit-form.twig' %}
-- cgit v1.2.3