From 9fee2e7266a269a8795b96b972cdc62bbcb3329b Mon Sep 17 00:00:00 2001 From: nicosomb Date: Tue, 16 Apr 2013 12:58:03 +0200 Subject: Fixed #13 - tri par date / tri par titre --- css/style.css | 15 +++++++++++++++ img/down.png | Bin 0 -> 216 bytes img/up.png | Bin 0 -> 212 bytes inc/config.php | 2 +- inc/functions.php | 4 ++-- index.php | 4 ++-- js/poche.js | 4 ++-- process.php | 16 ++++++++++++++++ tpl/home.html | 10 ++++------ 9 files changed, 42 insertions(+), 13 deletions(-) create mode 100755 img/down.png create mode 100755 img/up.png create mode 100644 process.php diff --git a/css/style.css b/css/style.css index ee99dbcf..e0041a2d 100644 --- a/css/style.css +++ b/css/style.css @@ -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 index 00000000..b9d536a7 Binary files /dev/null and b/img/down.png differ diff --git a/img/up.png b/img/up.png new file mode 100755 index 00000000..954a8c0a Binary files /dev/null and b/img/up.png differ diff --git a/inc/config.php b/inc/config.php index 4c1978b5..d468228d 100644 --- a/inc/config.php +++ b/inc/config.php @@ -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'] : ''; diff --git a/inc/functions.php b/inc/functions.php index a7430585..464410cb 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -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; diff --git a/index.php b/index.php index f62cf139..c303f8e3 100755 --- a/index.php +++ b/index.php @@ -10,10 +10,10 @@ 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); diff --git a/js/poche.js b/js/poche.js index f0e39b38..98fc48ea 100644 --- a/js/poche.js +++ b/js/poche.js @@ -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 index 00000000..14686885 --- /dev/null +++ b/process.php @@ -0,0 +1,16 @@ + + * @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 diff --git a/tpl/home.html b/tpl/home.html index d9612532..568b9274 100644 --- a/tpl/home.html +++ b/tpl/home.html @@ -9,10 +9,8 @@
  • archive
  • poche it !
  • - +
    \ No newline at end of file -- cgit v1.2.3