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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
# $Revision: 1.19 $
# recent_list: ǶΥȥ롤֥ȥɽ
# ѥ(å̤):
# days: ʬɽ뤫(20)
# date_format: ɽեޥå(եեޥå)
# title_with_body: truedzƥѥ饰դؤΥtitle°ˤΥѥ饰դΰ(false)
# show_size: trueĹɽ(false)
# show_title: truedzΥȥɽ(false)
#
# : 奢⡼ɤǤϻȤޤ
# : ȥꥹȤϡ쥤Ȥפʤ
# ʤޤإåեåtableȤäꡢCSS
# ɬפǤ礦
#
# Copyright (c) 2001,2002 Junichiro KITA <kita@kitaj.no-ip.com>
# Distributed under the GPL
#
=begin ChengeLog
2003-09-25 TADA Tadashi <sho@spc.gr.jp>
* use @conf.shorten.
2003-03-06 Junichiro Kita <kita@kitaj.no-ip.com>
* section.shorten -> section.body.shorten. thanks to mput <root@mput.dip.jp>.
2003-02-11 Junichiro Kita <kita@kitaj.no-ip.com>
* support for category. thanks to garsl<garsl@imasy.org> and yoshimi.
2002-12-20 TADA Tadashi <sho@spc.gr.jp>
* use Plugin#apply_plugin.
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 recent_list(days = 30, date_format = nil, title_with_body = nil, show_size = nil, show_title = nil, extra_erb = 'obsolete')
days = days.to_i
date_format ||= @date_format
result = ""
if extra_erb != 'obsolete'
result << %Q|<p class="message">option 'extra_erb' is obsolete!<p>|
end
cgi = CGI::new
def cgi.referer; nil; end
catch(:exit) {
@years.keys.sort.reverse_each do |year|
@years[year].sort.reverse_each do |month|
cgi.params['date'] = ["#{year}#{month}"]
m = TDiaryMonth::new(cgi, '', @conf)
m.diaries.keys.sort.reverse_each do |date|
next unless m.diaries[date].visible?
result << %Q|<p class="recentitem"><a href="#{@index}#{anchor date}">#{m.diaries[date].date.strftime(date_format)}</a>\n|
if show_title and m.diaries[date].title
result << %Q| #{m.diaries[date].title}|
end
if show_size == true
s = 0
m.diaries[date].each_section do |section|
s = s + section.to_s.size.to_i
end
result << ":#{s}"
end
result << %Q|</p>\n<div class="recentsubtitles">\n|
i = 1
if !@plugin_files.grep(/\/category.rb$/).empty? and m.diaries[date].categorizable?
m.diaries[date].each_section do |section|
if section.stripped_subtitle
result << %Q| <a href="#{@index}#{anchor "%s#p%02d" % [date, i]}"|
result << %Q| title="#{CGI::escapeHTML( @conf.shorten( apply_plugin( section.body_to_html, true) ) )}"| \
if title_with_body == true
result << %Q|>#{i}</a>. | \
<< %Q|#{section.stripped_subtitle_to_html}<br>\n|
end
i += 1
end
else
m.diaries[date].each_section do |section|
if section.subtitle
result << %Q| <a href="#{@index}#{anchor "%s#p%02d" % [date, i]}"|
result << %Q| title="#{CGI::escapeHTML( @conf.shorten( apply_plugin(section.body_to_html, true) ) )}"| \
if title_with_body == true
result << %Q|>#{i}</a>. | \
<< %Q|#{section.subtitle_to_html}<br>\n|
end
i += 1
end
end
result << "</div>\n"
days -= 1
throw :exit if days == 0
end
end
end
}
apply_plugin( result )
end
# vim: ts=3
|