Ticket #149: tag_sort.diff

File tag_sort.diff, 2.7 kB (added by Darth_Sebulba05@…, 3 years ago)

Tag sorting.

  • schema.php

     
    300301                "rss.output.title"                      => array('Gregarius','Gregarius','string','Sets the title of this feedreader.',NULL), 
    301302                "rss.config.ajaxparallelsize"                   => array('3','3','num','Sets the number of feeds to update in parallel. Remember to set rss.config.serverpush to false.',NULL), 
    302303                "rss.config.ajaxbatchsize"                      => array('3','3','num','Sets the number of feeds in a batch when using the ajax updater. Remember to set rss.config.serverpush to false.',NULL), 
    303                 "rss.config.defaultdashboard"                   => array('true','true','boolean','If the first page seen when entering the admin section should be the dashboard',NULL) 
     304                "rss.config.defaultdashboard"                   => array('true','true','boolean','If the first page seen when entering the admin section should be the dashboard',NULL), 
     305                "rss.output.tagsorting"                 => array('alphabetial,count,date,0','alphabetical,count,date,0','enum','How the tag listing should be sorted',NULL) 
    304306        ); 
    305307         
    306308         
  • cls/alltags.php

     
    7272         */ 
    7373        function populate() { 
    7474                // the all tags weighted list 
    75                 $sql = "select t.id, tag, count(*) as cnt from " 
    76                         .getTable('metatag'); 
     75                $sql = "select t.id, t.tag, count(*) as cnt from " 
     76                        .getTable('metatag') . " m"; 
    7777                if($this -> type == 'channel'){ 
    78                         $sql .= " left join " . getTable('channels') . " c on (fid=c.id)," 
    79                                 .getTable('tag')." t "." where tid=t.id " 
    80                                 . " and ttype = 'channel'"; 
     78                        $sql .= " left join " . getTable('channels') . " c on (m.fid=c.id)," 
     79                                .getTable('tag')." t "." where m.tid=t.id " 
     80                                . " and m.ttype = 'channel'"; 
    8181                }else{ 
    82                         $sql .= " left join ".getTable('item')." i on (fid=i.id)," 
    83                                 .getTable('tag')." t "." where tid=t.id " 
    84                                 ." and ttype = 'item'"; 
     82                        $sql .= " left join ".getTable('item')." i on (m.fid=i.id)," 
     83                                .getTable('tag')." t "." where m.tid=t.id " 
     84                                ." and m.ttype = 'item'"; 
    8585                } 
    8686 
    87  
    8887                // Don't count tags of private items 
    8988                if (hidePrivate()) { 
    9089                        $sql .= " and not(i.unread & ".FEED_MODE_PRIVATE_STATE.") "; 
    9190                } 
    9291                 
    93                 $sql .= "group by tid order by tag"; 
     92                $sql .= "group by m.tid"; 
    9493 
     94    switch(getConfig("rss.output.tagsorting")) { 
     95        case "date"         : $sql .= " order by m.tdate, t.tag"; 
     96                              break; 
     97        case "count"        : $sql .= " order by cnt, t.tag"; 
     98                              break; 
     99        case "alphabetical" : $sql .= " order by t.tag"; 
     100        default             : 
     101                              break; 
     102    } 
    95103                 
    96104                $res = rss_query($sql); 
    97105                $max = 0;