]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fixed #13 - tri par date / tri par titre
authornicosomb <nicolas@loeuillet.org>
Tue, 16 Apr 2013 10:58:03 +0000 (12:58 +0200)
committernicosomb <nicolas@loeuillet.org>
Tue, 16 Apr 2013 10:58:03 +0000 (12:58 +0200)
css/style.css
img/down.png [new file with mode: 0755]
img/up.png [new file with mode: 0755]
inc/config.php
inc/functions.php
index.php
js/poche.js
process.php [new file with mode: 0644]
tpl/home.html

index ee99dbcfc775ab60ce545c9452eff3dd8678ffd3..e0041a2d891d2c17cbe6b88b7e5a95e48a4cf9a2 100644 (file)
@@ -32,6 +32,21 @@ header {
     color: #F1F1F1;
 }
 
+#main ul#sort {
+    padding: 0;
+    list-style-type: none;
+    text-align: center;
+}
+
+#main ul#sort li {
+    display: inline;
+    font-size: 0.9em;
+}
+
+#main ul#sort img:hover {
+    cursor: pointer;
+}
+
 #main, #article {
     margin: 0 auto;
 }
diff --git a/img/down.png b/img/down.png
new file mode 100755 (executable)
index 0000000..b9d536a
Binary files /dev/null and b/img/down.png differ
diff --git a/img/up.png b/img/up.png
new file mode 100755 (executable)
index 0000000..954a8c0
Binary files /dev/null and b/img/up.png differ
index 4c1978b545153e9a7e063ebc1285d0b2cbfff418..d468228d201a14cf1facd4711f5e335a71f4c0d4 100644 (file)
@@ -35,8 +35,8 @@ if (!isset($_SESSION['token_poche'])) {
 }
 
 # Traitement des paramètres et déclenchement des actions
+$view               = (isset ($_REQUEST['view'])) ? htmlentities($_REQUEST['view']) : 'index';
 $action             = (isset ($_REQUEST['action'])) ? htmlentities($_REQUEST['action']) : '';
-$_SESSION['view']   = (isset ($_GET['view'])) ? htmlentities($_GET['view']) : 'index';
 $_SESSION['sort']   = (isset ($_REQUEST['sort'])) ? htmlentities($_REQUEST['sort']) : 'id';
 $id                 = (isset ($_REQUEST['id'])) ? htmlspecialchars($_REQUEST['id']) : '';
 $url                = (isset ($_GET['url'])) ? $_GET['url'] : '';
index a7430585ba80989caa8c9910fb09b7fd8ff8a385..464410cb56d6f7f5b819996a4dfc250ce08776e3 100755 (executable)
@@ -182,7 +182,7 @@ function action_to_do($action, $id, $url, $token)
 /**
  * Détermine quels liens afficher : home, fav ou archives
  */
-function display_view()
+function display_view($view)
 {
     global $db;
 
@@ -205,7 +205,7 @@ function display_view()
             break;
     }
 
-    switch ($_SESSION['view'])
+    switch ($view)
     {
         case 'archive':
             $sql    = "SELECT * FROM entries WHERE is_read=? " . $order;
index f62cf139af989ea8e8f0eb642a9c5033e8df79a7..c303f8e368a2c7176ae6587de410ae87446d7927 100755 (executable)
--- a/index.php
+++ b/index.php
 
 include dirname(__FILE__).'/inc/config.php';
 
-$entries = display_view();
+$entries = display_view($view);
 
 $tpl->assign('title', 'poche, a read it later open source system');
-$tpl->assign('view', $_SESSION['view']);
+$tpl->assign('view', $view);
 $tpl->assign('poche_url', get_poche_url());
 $tpl->assign('entries', $entries);
 $tpl->assign('load_all_js', 1);
index f0e39b381397d840ee8442f1dfc4f0420589dd70..98fc48ea3f5fba7af2afaa9099df76b394d40a89 100644 (file)
@@ -22,6 +22,6 @@ function toggle_archive(element, id, token, view_article) {
     }
 }
 
-function sort_links(sort, token) {
-    $('#content').load('process.php', { sort: sort, token: token } );
+function sort_links(view, sort, token) {
+    $('#content').load('process.php', { view: view, sort: sort, token: token } );
 }
\ No newline at end of file
diff --git a/process.php b/process.php
new file mode 100644 (file)
index 0000000..1468688
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+/**
+ * poche, a read it later open source system
+ *
+ * @category   poche
+ * @author     Nicolas Lœuillet <support@inthepoche.com>
+ * @copyright  2013
+ * @license    http://www.wtfpl.net/ see COPYING file
+ */
+
+include dirname(__FILE__).'/inc/config.php';
+
+$entries = display_view($view);
+$tpl->assign('token', $_SESSION['token_poche']);
+$tpl->assign('entries', $entries);
+$tpl->draw('entries');
\ No newline at end of file
index d96125320af932e7e6c91f3e4cea859db9cef53d..568b9274d45f1530ad20426a38cdf9f1c7df2501 100644 (file)
@@ -9,10 +9,8 @@
                 <li><a href="?view=archive" {if="$view == 'archive'"}class="current"{/if}>archive</a></li>
                 <li><a style="cursor: move" title="i am a bookmarklet, use me !" href="javascript:(function(){var%20url%20=%20location.href%20||%20url;window.open('{$poche_url}?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it !</a></li>
             </ul>
-<!--             <ul>
-                <li onclick="sort_links('ia', '{$token}');">tri par id asc</li>
-                <li onclick="sort_links('id', '{$token}');">tri par id desc</li>
-                <li onclick="sort_links('ta', '{$token}');">tri par title asc</li>
-                <li onclick="sort_links('td', '{$token}');">tri par title desc</li>
-            </ul> -->
+            <ul id="sort">
+                <li><img src="img/up.png" onclick="sort_links('{$view}', 'ia', '{$token}');" title="by date asc" /> by date <img src="img/down.png" onclick="sort_links('{$view}', 'id', '{$token}');" title="by date desc" /></li>
+                <li><img src="img/up.png" onclick="sort_links('{$view}', 'ta', '{$token}');" title="by title asc" /> by title <img src="img/down.png" onclick="sort_links('{$view}', 'td', '{$token}');" title="by title desc" /></li>
+            </ul>
             <div id="content">
\ No newline at end of file