:guard_fixed_num => 8,#add 2008/11/07 tkt:guard is fixed for under this number
:guard_fixed_day => 5,#add 2008/11/07 tkt:this day is guard fixed
:epilogue_period_min => 10, #add 2008/12/7 tkt:minutes for epilogue modified, limit min.
- :config_min_entries => true, #this flag enable to min_entries + config_min_entries_num
- :config_min_entries_num => 2, #this num is add to min_entries
- :coretime_start => 22, #this time is start of coretime
- :coretime_end => 23, #this time is end of coretime
+ :config_min_entries => true, #2009/12/27 add:this flag enable to min_entries + config_min_entries_num
+ :config_min_entries_num => 2, #2009/12/27 add:this num is add to min_entries
+ :coretime_start => 22, #2009/12/27 add:this time is start of coretime
+ :coretime_end => 23, #2009/12/27 add:this time is end of coretime
+ :log_separate => true, #2009/12/29 add:this flag enable to display separated village's logs
+ :log_size => 100, #2009/12/29 add:this size is size of separate
}
end
def handle_log
- print Page::LogIndex.new(@login.form).result()
+ #mod@tkt 2009/12/29: print Page::LogIndex.new(@login.form).result()
+ print Page::LogIndex.new(@login.form, @req['logindex']).result()
end
def handle_vid
end
class LogIndex < Base
- def initialize(login)
+ #mod@tkt 2009/12/29 def initialize(login)
+ def initialize(login, logindex)
require 'cache'
super()
-
+
ckey = File.mtime(S[:vilsdb_path]).to_i.to_s
cache = Cache::FileCache.new(:root_dir => S[:cache_dir] + 'log/')
cache.set_object(ckey, @villages)
end
+ #add@tkt 2009/12/29:for log seperate start
+ if S[:log_separate]
+ log(logindex)
+ else
+ reverse()
+ end
+ #add@tkt 2009/12/29:for log seperate end
@login = login
@title = '終了した村の記録'
end
+
+ #add@tkt 2009/12/29:for log separate start
+ def log(logindex)
+ initilize_log(logindex)
+ separates()
+ if @logindex == ''
+ recently()
+ elsif @logindex == 0
+
+ else
+ order_logindex()
+ end
+ end
+
+ def initilize_log(logindex)
+ @logindex = (logindex == '') ? logindex : logindex.to_i
+ @logsize = S[:log_size]
+ @last_vid = get_recently_index() - 1
+ end
+
+ def separates()
+ @separates = []
+ separate = @villages.size / @logsize
+ if @villages.size % @logsize == 0
+ separate -= 1
+ end
+
+ index = 0
+ while index <= separate
+ @separates[index] = index * @logsize + 1
+ index += 1
+ end
+ end
+
+ def recently()
+ max = @villages.size + 1
+ min = get_min_index(max)
+ limit(min, max)
+ reverse()
+ end
+
+ def order_logindex()
+ min = @logindex.to_i
+ max = get_max_index(min)
+ limit(min, max)
+ end
+
+ def get_min_index(max)
+ min = 1
+ if max >= @logsize
+ min = max - @logsize
+ end
+ min
+ end
+ def get_max_index(min)
+ max = min + @logsize
+ if max > @villages.size
+ max = @villages.size + 1
+ end
+ max
+ end
+
+ def get_recently_index()
+ recent = 1
+ vldb = Store.new('db/vil.db')
+ vldb.transaction do
+ recent = vldb['recent_vid'].to_i
+ end
+ recent
+ end
+
+ def limit(startIndex, endIndex)
+ @villages.delete_if{|v|
+ (startIndex > v['vid'].to_i || v['vid'].to_i >= endIndex)
+ }
+ end
+
+ def reverse()
+ @villages.reverse!
+ end
+ #add@tkt 2009/12/29:for log separate end
end
class History < Base
.main {
margin: 8px 16px 8px 16px;
- }
+}
/* Id Elements */
#player #exitform {
text-align: right;
}
+
+
+/**add@tkt 2009/12/29:for log seperate start**/
+table.minilist {
+ border-collapse: collapse;
+ margin: 3px 0px 3px 0px;
+}
+table.minilist td {
+ font-size: 80%;
+ border: 1px solid #223;
+ padding: 3px 6px 3px 6px;
+}
+table.minilist td.desc {
+ font-size: 75%;
+ padding-left:16px;
+ color:#ccc;
+}
+/**add@tkt 2009/12/29:for log seperate end**/
\ No newline at end of file
<h2>終了した村の記録</h2>
-<table width="100%" style="padding-left: 2em;">
+<!-- 村番号ごとのリンク -->
+<% if S[:log_separate] %>
+<table class="minilist" >
+<tr>
+<td>
+<% count = 1 %>
+<% if @logindex == 0 %>
+ すべての村
+<% else %>
+ <a href="?cmd=log&logindex=0">すべての村</a>
+<% end %>
+</td>
+<% @separates.each { |sep| %>
+<% if count % 7 == 0%>
+ </tr><tr>
+<% end
+ count += 1
+%>
+ <td>
+<% if @logindex == sep %>
+ <%= sep %>村~
+<% else %>
+ <a href="?cmd=log&logindex=<%= sep %>"><%= sep %>村~</a>
+<% end %>
+ </td>
+<% } %>
+</tr>
+</table>
+<% end %>
+
+<!-- ログテーブル -->
+<table width="100%" style="padding-left: 0.5em; padding-right:0em;">
<tr style="text-align: left"><th>村名</th><th>人数</th><th>1日目開始 ~ エピローグ終了</td>
-<% @villages.reverse_each {|vil| %>
-<tr><td>
+<% @villages.each {|vil| %>
+<tr><td style="padding-left:1px;">
<a href="./?vid=<%= vil['vid'].to_s %>"><%= vil['vid'].to_s %> <%= vil['name'] %></a>
</td>
<td>
</tr>
<% } %>
</table>
+
+<!-- 村番号ごとのリンク -->
+<% if S[:log_separate] %>
+ <table class="minilist" >
+ <tr>
+ <td class="desc" colspan="<%=@separates.size + 1 %>"><%=@last_vid%>の村のうち、
+ <% if @logindex == '' %>最新の<% end %>
+ <%= @villages.size %>村を表示しています。</td>
+ </tr>
+ <tr>
+ <td>
+ <% count = 1 %>
+ <% if @logindex == 0 %>
+ すべての村
+ <% else %>
+ <a href="?cmd=log&logindex=0">すべての村</a>
+ <% end %>
+ </td>
+
+ <% @separates.each { |sep| %>
+ <% if count % 7 == 0%>
+ </tr><tr>
+ <% end
+ count += 1
+ %>
+ <td>
+ <% if @logindex == sep %>
+ <%= sep %>村~
+ <% else %>
+ <a href="?cmd=log&logindex=<%= sep %>"><%= sep %>村~</a>
+ <% end %>
+ </td>
+ <% } %>
+ </tr>
+ </table>
+<% end %>
\ No newline at end of file