Show
Ignore:
Timestamp:
07/10/08 19:30:26 (4 months ago)
Author:
sho
Message:

platform/tdiary/plugin/category_to_tagcroud.rb: sorted categories in case-insensitive.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • platform/tdiary/plugin/category_to_tagcloud.rb

    r7917 r15640  
    4949 
    5050        html = %{<ul class="tagcloud">} 
    51         tags.sort.each do |tag| 
     51        tags.sort{|a,b| a.downcase <=> b.downcase}.each do |tag| 
    5252                count = @counts[tag] 
    5353                level = ((Math.sqrt(count) - min) * factor).to_i 
     
    108108                ymd = categorized[key].keys.sort.reverse 
    109109                diff = (Time.now - Time.local(ymd[0][0,4], ymd[0][4,2], ymd[0][6,2])) / 86400 
    110                 url = "#{@conf.index}?year=#{Time.now.year};month=#{(Time.now.month - 1) / 3 + 1}Q;category=#{CGI.escape(key)}" 
     110                url = "#{@conf.index}?category=#{CGI.escape(key)}" 
    111111                add(key, url, count, "#{styleclass(diff.to_i)}") 
    112112        end 
     
    143143 
    144144 
    145 return '' unless category_enable? 
    146 module Category 
    147         class Tagcloud_Info < Info 
    148                 def years 
    149                         now_year = Time.now.year 
    150                         now_month = Time.now.month 
    151                         r = Hash.new 
    152  
    153                         months = [ 
    154                                 ['01'],['01','02'],['01','02','03'],['02','03','04'],['03','04','05'], 
    155                                 ['04','05','06'],['05','06','07'],['06','07','08'],['07','08','09'], 
    156                                 ['08','09','10'],['09','10','11'],['10','11','12'] 
    157                         ][now_month - 1] 
    158  
    159                         r[now_year.to_s] = months 
    160                         case now_month 
    161                         when 1 
    162                                 r["#{now_year - 1}"] = ['11','12'] 
    163                         when 2 
    164                                 r["#{now_year - 1}"] = ['12'] 
     145if category_enable? 
     146        module Category 
     147                class Tagcloud_Info < Info 
     148                        def years 
     149                                now_year = Time.now.year 
     150                                now_month = Time.now.month 
     151                                r = Hash.new 
     152         
     153                                months = [ 
     154                                        ['01'],['01','02'],['01','02','03'],['02','03','04'],['03','04','05'], 
     155                                        ['04','05','06'],['05','06','07'],['06','07','08'],['07','08','09'], 
     156                                        ['08','09','10'],['09','10','11'],['10','11','12'] 
     157                                ][now_month - 1] 
     158         
     159                                r[now_year.to_s] = months 
     160                                case now_month 
     161                                when 1 
     162                                        r["#{now_year - 1}"] = ['11','12'] 
     163                                when 2 
     164                                        r["#{now_year - 1}"] = ['12'] 
     165                                end 
     166                                r 
    165167                        end 
    166                         r 
    167168                end 
    168169        end 
    169170end 
    170171 
    171  
    172172## vim: ts=3