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;
}
}
# 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'] : '';
/**
* Détermine quels liens afficher : home, fav ou archives
*/
-function display_view()
+function display_view($view)
{
global $db;
break;
}
- switch ($_SESSION['view'])
+ switch ($view)
{
case 'archive':
$sql = "SELECT * FROM entries WHERE is_read=? " . $order;
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);
}
}
-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
--- /dev/null
+<?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
<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