1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
# navi_user.rb $Revision: 1.5 $
#
# navi_user:
# modeday/commentΤȤɽסץʥӥ
# סּפѹplugin
# ʤϡʥӥɽʤޤˤб
#
# @secure=true Ǥưޤ
#
# Copyright (c) 2002 Junichiro KITA <kita@kitaj.no-ip.com>
# Distributed under the GPL
=begin ChangeLog
2003-01-12 TADA Tadashi <sho@spc.gr.jp>
* Change labels. thanks to Shintaro KAKUTANI <shintaro@kakutani.com>.
2002-10-06 TADA Tadashi <sho@spc.gr.jp>
* for tDiary 1.5.0.20021003.
=end
eval( <<MODIFY_CLASS, TOPLEVEL_BINDING )
module TDiary
class TDiaryMonth
attr_reader :diaries
end
end
MODIFY_CLASS
def navi_user
result = ''
result << %Q[<span class="adminmenu"><a href="#{@index_page}">#{navi_index}</a></span>\n] unless @index_page.empty?
if /^(day|comment)$/ =~ @mode
cgi = CGI.new
def cgi.referer; nil; end
days = []
yms = []
today = @date.strftime('%Y%m%d')
this_month = @date.strftime('%Y%m')
@years.keys.each do |y|
yms += @years[y].collect {|m| y + m}
end
yms |= [this_month]
yms.sort!
yms.unshift(nil).push(nil)
yms[yms.index(this_month) - 1, 3].each do |ym|
next unless ym
cgi.params['date'] = [ym]
m = TDiaryMonth.new(cgi, '', @conf)
days += m.diaries.keys.sort
end
days |= [today]
days.sort!
days.unshift(nil).push(nil)
prev_day, cur_day, next_day = days[days.index(today) - 1, 3]
if prev_day
result << %Q[<span class="adminmenu"><a href="#{@index}#{anchor prev_day}"><#{navi_prev_diary(navi_user_format(prev_day))}</a></span>\n]
end
if next_day
result << %Q[<span class="adminmenu"><a href="#{@index}#{anchor next_day}">#{navi_next_diary(navi_user_format(next_day))}></a></span>\n]
end
end
result << %Q[<span class="adminmenu"><a href="#{@index}">#{navi_latest}</a></span>\n] unless @mode == 'latest'
result
end
def navi_user_format( day )
Time::local( *day.scan( /^(\d{4})(\d\d)(\d\d)$/ )[0] )
end
|