From 059a3380341c439e1debb4921bbf023a3b424a4b Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 2 Mar 2015 00:15:49 +0100 Subject: [PATCH] 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 65675afe1..4f55a7fe2 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 30d42c61b..18e1d0511 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 b93a78b82..1b221021b 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 3d4d14ae8a3c0b3f97cd8a3c0868a152944a0c3f..057c7bc4e53b1026502171e346538564da634672 100644 GIT binary patch delta 691 zcmZ`$O=wd=5T4oHx34d)Y0XRbB__nAniP~)jBO$!G#7sk)kcDfP^h5>A~d$N1#^%# z7KL6E%PS(bhg#fu;xGs8DCyWi~W&7D^| zWYZ>qf$)^fi0VXiVJdf#w;kx7T8xfY`tn@>_zWQUvRo>jlKB_o0BQ~ZGG$8CJr?hY zzahT0Tp6vNKP(;sSc3TUz+iu|$2mGi{2KA@O0hZwJD^Pb9r5^?Vx@FEeCG>5i28Bg z(BQ}@aH>GK+p7Z?c0XR=`o|5npG9nqZHqKm%JN(Fmd`TOC-quAP?yz-<{xwn?ISE| zpJe)cg;|`26u@tR27Um8bsDH|OsoS1xCBP1t$_!u;V@ouM{av=+O6TAT%2Zt92EF{ z-Ucy%BxX8VG1a2W;ATv;$mXEhmC*f2(NgIwt6>P#e=jIh#@&oF$H zD`1Yi*Fs@A8Hps9jZi~F$S_TMD?)*UoWDY;jx1)5Xv=&gdA@#=*JjlX*Zp+9RpdE+f%#m&0)>0J$bvo=QMW? zEnF`N*QLZyZT2&o!}B%mTvK!*I#KOw-1{Bsy?+LH9zKYFqa9LNOxk%BZ}N&{IkJKP zl=hH1+jSRTu>ec6N%o8P@>%|re-M7rD^|o;ZBo0TeUp3Sm|WC-dR||tYp;7`q>QV+ PxNm@VM1L?JvnKF2**=;L delta 323 zcmbPWvcQmSfdm7?AMuH7W-MvbzOR_*(8?_8ZZPqLO#Ou1CyERVj29Rfgc~wa6I0j( zPUSN&hz2k)FqmZk1vn0~JOuJPfP9sV+>(kyKV}&qe+`h|l9QjD=)Ay_je$YT0LXXA zO{^$j&}PU0@=Jhxg}lVv)NsjV?|}R%Ks#Iu@{3Ctn1M13;&(vu49qN(lNno>nP2cu z=3|nc%*v!C%^@x%&Lz$+&L++(_EhY)*aopKu~5-ZKy8eZ1DRwdCor*Z&Ses3-h79x zLO^E4_i1VI{5D@1xLH8PGFheeV{u`*!}5vMgSC(K5}OQL9NQ9hJ@zIJ0gft;SDYoB2N)QECMj<2lW1ZD0LIT$ AsQ>@~ diff --git a/themes/baggy/fonts/icomoon.svg b/themes/baggy/fonts/icomoon.svg index 19fcfa1f3..f4086b53a 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 923f56d81c16584c4f1c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ta 366 zcmdmCe8NDa+~3WOfsp|SBs>_nLA3av$qOaLCu*zJi@F=6Cl(hlFffS##W|o@AU&rt z4JanVz#!ZJ!V_|zC}yN4rZ6yw&H<`117S9SQ~4P{L7>@W-(2rRrCqEgePOJvVcL8DN1)glVi4_GpK*0k*0R=GDX2{4(%uNM~Jz!v9bOqsX z$z|^f@{3D=Zr7OjXEG!6
diff --git a/themes/default/css/style-default.css b/themes/default/css/style-default.css index da8703f2b..8b18320d9 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 44cbf41b8..0d4ec1744 100755 --- a/themes/default/view.twig +++ b/themes/default/view.twig @@ -5,10 +5,12 @@ {% include '_pocheit-form.twig' %}