Browse Source

Règle le tri dans un dossier : non-lus ET date

Avant, le tri n'était fait qu'en fonction de la date. Il fallait cliquer
sur le lien adéquat pour trier par non-lus puis par date.

Maintenant, cela affiche d'office trié par non-lus ET date.
Christophe HENRY 5 years ago
parent
commit
081c2b1241

+ 1 - 8
article.php

@@ -54,16 +54,9 @@ switch($action){
     case 'selectedFeed':
         $currentFeed = $feedManager->getById($_['feed']);
         $allowedOrder = array('date'=>'pubdate DESC','older'=>'pubdate','unread'=>'unread DESC,pubdate DESC');
-        $order = (isset($_['order'])?$allowedOrder[$_['order']]:$allowedOrder['date']);
+        $order = (isset($_['order'])?$allowedOrder[$_['order']]:$allowedOrder['unread']);
         $events = $currentFeed->getEvents($startArticle,$articlePerPages,$order,$target);
     break;
-    /* AFFICHAGE DES EVENEMENTS D'UN FLUX EN PARTICULIER en mode non lus */
-    case 'selectedFeedNonLu':
-        $currentFeed = $feedManager->getById($_['feed']);
-        $filter = array('unread'=>1, 'feed'=>$currentFeed->getId());
-        $order = 'pubdate DESC';
-        $events = $eventManager->loadAllOnlyColumn($target,$filter,$order,$startArticle.','.$articlePerPages);
-    break;
     /* AFFICHAGE DES EVENEMENTS D'UN DOSSIER EN PARTICULIER */
     case 'selectedFolder':
         $currentFolder = $folderManager->getById($_['folder']);

+ 1 - 14
index.php

@@ -72,7 +72,7 @@ switch($action){
         $tpl->assign('currentFeed',$currentFeed);
         $numberOfItem = $eventManager->rowCount(array('feed'=>$currentFeed->getId()));
         $allowedOrder = array('date'=>'pubdate DESC','older'=>'pubdate','unread'=>'unread DESC,pubdate DESC');
-        $order = (isset($_['order'])?$allowedOrder[$_['order']]:$allowedOrder['date']);
+        $order = (isset($_['order'])?$allowedOrder[$_['order']]:$allowedOrder['unread']);
         $page = (isset($_['page'])?$_['page']:1);
         $pages = ceil($numberOfItem/$articlePerPages);
         $startArticle = ($page-1)*$articlePerPages;
@@ -81,19 +81,6 @@ switch($action){
         $tpl->assign('order',(isset($_['order'])?$_['order']:''));
 
     break;
-    /* AFFICHAGE DES EVENEMENTS D'UN FLUX EN PARTICULIER en mode non lus */
-    case 'selectedFeedNonLu':
-        $currentFeed = $feedManager->getById($_['feed']);
-        $tpl->assign('currentFeed',$currentFeed);
-        $filter = array('unread'=>1, 'feed'=>$currentFeed->getId());
-        $numberOfItem = $eventManager->rowCount($filter);
-        $order = 'pubdate DESC';
-        $page = (isset($_['page'])?$_['page']:1);
-        $pages = ceil($numberOfItem/$articlePerPages);
-        $startArticle = ($page-1)*$articlePerPages;
-        $events = $eventManager->loadAllOnlyColumn($target,$filter,$order,$startArticle.','.$articlePerPages);
-
-        break;
     /* AFFICHAGE DES EVENEMENTS D'UN DOSSIER EN PARTICULIER */
     case 'selectedFolder':
         $currentFolder = $folderManager->getById($_['folder']);

+ 2 - 2
templates/marigolds-old/index.html

@@ -176,7 +176,7 @@
                 <!-- ENTETE ARTICLE -->
                 <header class="articleHead">
 
-                {if="$action=='selectedFeed' || ($action=='selectedFeedNonLu')"}
+                {if="$action=='selectedFeed'"}
                 <!-- AFFICHAGE DES EVENEMENTS D'UN FLUX EN PARTICULIER -->
 
 
@@ -184,7 +184,7 @@
                     <div class="clear"></div>
                         {$currentFeed->getDescription()}
                             {function="_t('SEE_THE')"}
-                    <a href="index.php?action=selectedFeedNonLu&amp;feed={$_['feed']}&amp;page={$page}">{function="ucfirst(_t('UNREAD'))"}</a> |
+                    <a href="index.php?action=selectedFeed&amp;feed={$_['feed']}&amp;page={$page}&amp;order=unread">{function="ucfirst(_t('UNREAD'))"}</a> |
                     <a href="index.php?action=selectedFeed&amp;feed={$_['feed']}&amp;page={$page}&amp;order=older">{function="_t('OLDER')"}</a> {function="_t('IN_FIRST')"}
                 {/if}
 

+ 4 - 4
templates/marigolds-old/js/script.js

@@ -511,7 +511,7 @@ function readThis(element,id,from,callback){
                             $(window).data('nblus', $(window).data('nblus')+1);
                         break;
                         case 'selectedFolder':
-                        case 'selectedFeedNonLu':
+                        case 'selectedFeed':
                             parent.addClass('eventRead');
                             if(callback){
                                 callback();
@@ -548,7 +548,7 @@ function readThis(element,id,from,callback){
                             if( console && console.log && msg!="" ) console.log(msg);
                             parent.removeClass('eventRead');
                             // on compte combien d'article ont été remis à non lus
-                            if ((activeScreen=='') || (activeScreen=='selectedFolder')|| (activeScreen=='selectedFeedNonLu'))
+                            if ((activeScreen=='') || (activeScreen=='selectedFolder')|| (activeScreen=='selectedFeed'))
                                 $(window).data('nblus', $(window).data('nblus')-1);
                             if(callback){
                                 callback();
@@ -576,7 +576,7 @@ function unReadThis(element,id,from){
                         if( console && console.log && msg!="" ) console.log(msg);
                         parent.removeClass('eventRead');
                         // on compte combien d'article ont été remis à non lus
-                        if ((activeScreen=='') || (activeScreen=='selectedFolder')|| (activeScreen=='selectedFeedNonLu'))
+                        if ((activeScreen=='') || (activeScreen=='selectedFolder')|| (activeScreen=='selectedFeed'))
                             $(window).data('nblus', $(window).data('nblus')-1);
 
                         addOrRemoveFeedNumber('+');
@@ -835,4 +835,4 @@ function addOrRemoveFeedNumber(operator){
             }
         }
     }
-}
+}

+ 2 - 2
templates/marigolds/index.html

@@ -176,7 +176,7 @@
                 <!-- ENTETE ARTICLE -->
                 <header class="articleHead">
 
-                {if="$action=='selectedFeed' || ($action=='selectedFeedNonLu')"}
+                {if="$action=='selectedFeed'"}
                 <!-- AFFICHAGE DES EVENEMENTS D'UN FLUX EN PARTICULIER -->
 
 
@@ -184,7 +184,7 @@
                    
                         {$currentFeed->getDescription()} <div class="clear"></div>
                             {function="_t('SEE_THE')"}
-                    <a href="index.php?action=selectedFeedNonLu&amp;feed={$_['feed']}&amp;page={$page}">{function="ucfirst(_t('UNREAD'))"}</a> |
+                    <a href="index.php?action=selectedFeed&amp;feed={$_['feed']}&amp;page={$page}&amp;order=unread">{function="ucfirst(_t('UNREAD'))"}</a> |
                     <a href="index.php?action=selectedFeed&amp;feed={$_['feed']}&amp;page={$page}&amp;order=older">{function="_t('OLDER')"}</a> {function="_t('IN_FIRST')"}
                 {/if}
 

+ 3 - 3
templates/marigolds/js/script.js

@@ -522,7 +522,7 @@ function readThis(element,id,from,callback){
                             $(window).data('nblus', $(window).data('nblus')+1);
                         break;
                         case 'selectedFolder':
-                        case 'selectedFeedNonLu':
+                        case 'selectedFeed':
                             if(callback){
                                 callback();
                             }else{
@@ -557,7 +557,7 @@ function readThis(element,id,from,callback){
                             if( console && console.log && msg!="" ) console.log(msg);
                             parent.removeClass('eventRead');
                             // on compte combien d'article ont été remis à non lus
-                            if ((activeScreen=='') || (activeScreen=='selectedFolder')|| (activeScreen=='selectedFeedNonLu'))
+                            if ((activeScreen=='') || (activeScreen=='selectedFolder')|| (activeScreen=='selectedFeed'))
                                 $(window).data('nblus', $(window).data('nblus')-1);
                             if(callback){
                                 callback();
@@ -585,7 +585,7 @@ function unReadThis(element,id,from){
                         if( console && console.log && msg!="" ) console.log(msg);
                         parent.removeClass('eventRead');
                         // on compte combien d'article ont été remis à non lus
-                        if ((activeScreen=='') || (activeScreen=='selectedFolder')|| (activeScreen=='selectedFeedNonLu'))
+                        if ((activeScreen=='') || (activeScreen=='selectedFolder')|| (activeScreen=='selectedFeed'))
                             $(window).data('nblus', $(window).data('nblus')-1);
 
                         addOrRemoveFeedNumber('+');