[theme] - [opal] - [k1ified summary]

Feb 14, 2006 17:27


function Page::lay_entry_nav (Entry e) : string {
var string line = "";
var string date = "";
if($e.new_day) {
$date = $e.time->date_format("short");
}
var string time = $e.time->time_format();
var string subject = ($e.subject != "") ? " :: " + $e->get_plain_subject() : """ :: $*text_nosubject""";
var string j = ($.view == "friends" and (not $e.poster->equals($e.journal))) ? " : $e.journal " : "";
var string item = ($.view == "friends" or (not $e.poster->equals($e.journal))) ? $e.poster->as_string() + """$j """ : """$date $time""";
var string comments = "";
if($e.comments.count > 0 or $e.comments.screened) {
$comments = """
[+$e.comments.count]""";
}
$line = box_item("$item $subject$comments");

return $line;
}

function Page::lay_print_summary() {
var int count = $*summary_items;
if($count == 0) { return; }

var string text = "";

if($this isa RecentPage) {
var RecentPage rp = $this as RecentPage;

foreach var Entry e ($rp.entries) {
if($count > 0) {
$text = $text + $this->lay_entry_nav($e);
}
$count--;
}
}

if($this isa YearPage) {
var YearPage yp = $this as YearPage;

var int num_entries = 0;

foreach var YearMonth m ($yp.months) {
if($count > 0) {
var string mon = $m->month_format();
if($m.has_entries) {
$num_entries = 0;
foreach var YearWeek w ($m.weeks) {
foreach var YearDay d ($w.days) {
$num_entries = $num_entries + $d.num_entries;
}
}
$text = $text + box_item(""" $mon [$num_entries entries]""");
}
}
$count--;
}
}

if($this isa MonthPage) {
var MonthPage mp = $this as MonthPage;

foreach var MonthDay d ($mp.days) {
if($count > 0) {
var string day = lang_ordinal($d.day);
if($d.has_entries) {
$text = $text + box_item(""" $day [$d.num_entries entries]""");
}
}
}
}

if($this isa DayPage) {
var DayPage dp = $this as DayPage;

foreach var Entry e ($dp.entries) {
$text = $text + $this->lay_entry_nav($e);
}
}

if($this isa EntryPage) {
var EntryPage ep = $this as EntryPage;

$text = $this->lay_entry_nav($ep.entry);

foreach var Comment c ($ep.comments) {
if($count > 0) {
var string line = "";
var string subject = $c.subject != "" ? $c.subject : """$*text_nosubject""";
$line = """$c.poster :: $subject""";
var int num = num_comments_in_thread($c.replies);
if($num > 0) {
$line = $line + """ [+$num]""";
}
$text = $text + box_item($line);
}
}
}

if($text != "") {
if($count < 0) {
$count = $count * -1;
$text = $text + """
+$count more""";
}
print_box($*page_summary_title, $text);
}
}

function lay_print_summary, function lay_entry_nav, class page, layout opal

Previous post Next post
Up