layerinfo type = "layout"; layerinfo name = "Bloggish"; layerinfo redist_uniq = "sixhtml/layout"; layerinfo des = "SixApart's standard HTML structure for blogs, to be styled with CSS."; propgroup appearance { property bool use_6a_base { des = "Use 'Base Weblog' styles"; } set use_6a_base = true; property string base_theme { des = "Base Theme"; values = "__none|(None)|april|April|baby|Baby|beckett|Beckett|bluecrush|Blue Crush|bonjour|Bonjour Chatette|bryant|Bryant|classy|Classy|earth|Earth|green|Green|folio|Folio|forestgreen|Forest Green|knitting|Knitting|powell-street|Powell Street|masala|Masala|minimalist|Minimalist|porpoise|Porpoise|purplecrush|Purple Crush|stevenson|Stevenson|sunburned|Sunburned|stitch|Stitch|travel|Travel|wedding|Wedding"; } set base_theme = "powell-street"; property string layout_type { des = "Layout Type"; values = "1C|One column|2CL|Two column (Sidebar on Left)|2CR|Two column (Sidebar on Right)|3C|Three column"; } set layout_type = "2CR"; property string{} theme_stylesheet { noui = 1; } set theme_stylesheet = { "april" => "http://www.typepad.com/.shared/themes/classic/theme-april.css", "baby" => "http://www.typepad.com/.shared/themes/lilia/theme-baby.css", "beckett" => "http://www.typepad.com/.shared/themes/lilia/theme-beckett.css", "bluecrush" => "http://www.typepad.com/.shared/themes/lilia/theme-bluecrush.css", "bonjour" => "http://www.typepad.com/.shared/themes/classic/theme-bonjour.css", "bryant" => "http://www.typepad.com/.shared/themes/lilia/theme-bryant.css", "cityblend" => "http://www.typepad.com/.shared/themes/shea/theme-cityblend.css", "classy" => "http://www.typepad.com/.shared/themes/classic/theme-classy.css", "earth" => "http://www.typepad.com/.shared/themes/classic/theme-earth.css", "green" => "http://www.typepad.com/.shared/themes/classic/theme-green.css", "folio" => "http://www.typepad.com/.shared/themes/shea/theme-folio.css", "forestgreen" => "http://www.typepad.com/.shared/themes/shea/theme-forestgreen.css", "knitting" => "http://www.typepad.com/.shared/themes/lilia/theme-knitting.css", "powell-street" => "http://www.typepad.com/.shared/themes/lilia/theme-powell-street.css", "masala" => "http://www.typepad.com/.shared/themes/lilia/theme-masala.css", "minimalist" => "http://www.typepad.com/.shared/themes/classic/theme-minimalist.css", "porpoise" => "http://www.typepad.com/.shared/themes/shea/theme-porpoise.css", "purplecrush" => "http://www.typepad.com/.shared/themes/lilia/theme-purplecrush.css", "stevenson" => "http://www.typepad.com/.shared/themes/lilia/theme-stevenson.css", "subtle" => "http://www.typepad.com/.shared/themes/lilia/theme-subtle.css", "sunburned" => "http://www.typepad.com/.shared/themes/shea/theme-sunburned.css", "stitch" => "http://www.typepad.com/.shared/themes/lilia/theme-stitch.css", "tickle" => "http://www.typepad.com/.shared/themes/shea/theme-tickle.css", "travel" => "http://www.typepad.com/.shared/themes/lilia/theme-travel.css", "wedding" => "http://www.typepad.com/.shared/themes/lilia/theme-wedding.css", }; } propgroup appearance = "Appearance"; propgroup options { property bool opt_dayhead { des = "Show Day Headings"; } set opt_dayhead = false; property use page_recent_items; property use page_friends_items; property use page_day_sortorder; property use page_year_sortorder; property use view_entry_disabled; property use use_shared_pic; property bool opt_datehead { des = "Show Heading for New Day"; } set opt_datehead = true; property bool opt_showtime { des = "Show Posting Time on Entries"; note = "This is recommended if you regularly post more than one entry per day."; } set opt_showtime = true; property bool opt_userpic_main { des = "Show User Pictures on Entries"; } property bool opt_userpic_friends { des = "Show User Pictures on Entries on your Friends Page"; } property bool opt_userpic_entrypage { des = "Show User Picture on the Entry page"; } property bool opt_userpic_comments { des = "Show User Pictures on Comments"; } set opt_userpic_main = false; set opt_userpic_friends = true; set opt_userpic_entrypage = true; set opt_userpic_comments = true; property string[][] sidebar_primary { des = "Primary sidebar members"; noui = 1; } property string[][] sidebar_secondary { des = "Secondary sidebar members"; noui = 1; } set sidebar_primary = [ [ "userprofile", "", "0", "1" ], [ "viewlinks", "" ], [ "calendar" ], [ "syndicate", "Syndicate" ], [ "links", "Links" ], [ "poweredby" ], ]; set sidebar_secondary = [ [ "tags", "Tags" ], [ "pagesummary", "Page Summary" ], ]; set external_stylesheet = true; } propgroup options = "Options"; propgroup text { property use text_post_comment; property use text_read_comments; property use text_post_comment_friends; property use text_read_comments_friends; property use text_view_recent; property use text_view_archive; property use text_view_friends; property use text_view_userinfo; property use lang_fmt_date_med; property use lang_fmt_time_short; # i18n props. Not in the interface. property string text_comments { des = "Text for the heading above the comments on the entry page"; noui = 1; } set text_comments = "Comments"; } propgroup text = "Text"; function print_custom_stylesheet() {} function print_stylesheet () { if ($*use_6a_base) { """ /* base css */ @import url(http://www.typepad.com/.shared/themes/common/base-weblog.css); @import url($*STATDIR/sixhtml/ljextras.css); """; } if ($*base_theme != "__none") { """/* theme css */ @import url($*theme_stylesheet{$*base_theme}); """; } """ /* user css */ """; print_custom_stylesheet(); } function container_open (string name) { "
\n"; } function container_close () { "
\n"; } function print_banner(Page p) { container_open("banner"); "

$p.global_title

"; ""; container_close(); } function open_module(string intname, string title, string headlink_url, bool nocontent) { println """
"""; if ($title != "") { """

"""; if ($headlink_url != "") { """"""; } print $title; if ($headlink_url != "") { """"""; } "

\n"; } if (not $nocontent) { println """
"""; } } function close_module(bool nocontent) { println "
"; if (not $nocontent) { println "
"; } } function open_module(string intname, string title, string headlink_url) { open_module($intname, $title, $headlink_url, false); } function close_module() { close_module(false); } function print_module_list(string[] list) { println """"""; } function print_module_userprofile(string title, bool show_profile, bool show_userpic) { var Page p = get_page(); if ($show_userpic and not $show_profile) { if (defined $p.journal.default_pic) { open_module("photo", $title, $p.journal.userpic_listing_url); println ""+$p.journal.default_pic; close_module(); } return; } if (not $show_profile and not $show_userpic) { open_module("about", $title, $p.view_url{"userinfo"}, true); close_module(true); return; } open_module("about", $title, $p.view_url{"userinfo"}); println "
"+$p.journal.default_pic+"
"; println "

"+$p.journal.name+"

"; # TODO: Display more stuff such as website link close_module(); } function print_module_viewlinks(string title) { var Page p = get_page(); open_module("viewlinks", $title, ""); var string[] links = []; foreach var string k ($p.views_order) { $links[size $links] = """"""+lang_viewname($k)+""""""; } print_module_list($links); close_module(); } function print_module_poweredby(string title) { var Page p = get_page(); open_module("powered", $title, ""); println """Powered by $*SITENAME"""; close_module(); } function print_module_pagesummary(string title) { var Page p = get_page(); var string[] links = []; if ($p isa RecentPage) { var RecentPage cp = $p as RecentPage; foreach var Entry e ($cp.entries) { $links[size $links] = """"""+striphtml($e.subject)+""; } } if (size($links) < 1) { return; } open_module("pagesummary", $title, ""); print_module_list($links); close_module(); } function print_module_tags(string title) { var Page p = get_page(); var TagDetail[] tags = $p->visible_tag_list(); if (size($tags) < 1) { return; } open_module("categories", $title, ""); # TODO: Link to the TagsPage? var string[] links = []; foreach var TagDetail tag ($tags) { $links[size $links] = """$tag.name"""; } print_module_list($links); close_module(); } function print_module_calendar() { var Page p = get_page(); var YearMonth mon = $p->get_latest_month(); open_module("calendar", $mon->month_format(), ""); println """"""; println ""; foreach var int d (weekdays()) { "\n"; } println ""; foreach var YearWeek week ($mon.weeks) { println ""; foreach var int i (1 .. $week.pre_empty) { print ""; } foreach var YearDay day ($week.days) { print ""; } foreach var int i (1 .. $week.post_empty) { print ""; } println ""; } println """
"+$*lang_dayname_short[$d]+"
 "; if ($day.num_entries > 0) { print """"""; } print $day.day; if ($day.num_entries > 0) { print """"""; } print " 
"""; close_module(); } function print_module_syndicate(string title) { var Page p = get_page(); if ((size $p.data_links_order) < 1) { return; } open_module("syndicate", $title, ""); foreach var string k ($p.data_links_order) { print " $p.data_link{$k} "; } close_module(); } function print_module_customtext(string title, string text, string titlelink_url) { var Page p = get_page(); open_module("customtext", $title, $titlelink_url); print safe $text; close_module(); } function print_module_links(string title) { var Page p = get_page(); var UserLink[] links = $p.linklist; if (size($links) < 1) { return; } var bool box_open = false; if (not $links[0].is_heading) { open_module("typelist", $title, ""); $box_open = true; } var string[] items = []; foreach var UserLink link ($links) { if ($link.is_heading) { if ($box_open) { print_module_list($items); close_module(); $items = []; } open_module("typelist", $link.title, ""); $box_open = true; } if (not $link.is_heading and $link.title != "") { $items[size $items] = """$link.title"""; } } if ($box_open) { print_module_list($items); close_module(); } } function handle_sidebar_array(string[][] list) { foreach var string[] item ($list) { var string module = $item[0]; var string title = $item[1]; if ($module == "userprofile") { var bool show_profile = (int($item[2]) != 0 ? true : false); var bool show_userpic = (int($item[3]) != 0 ? true : false); print_module_userprofile($title, $show_profile, $show_userpic); } elseif ($module == "viewlinks") { print_module_viewlinks($title); } elseif ($module == "poweredby") { print_module_poweredby($title); } elseif ($module == "pagesummary") { print_module_pagesummary($title); } elseif ($module == "tags") { print_module_tags($title); } elseif ($module == "calendar") { print_module_calendar(); } elseif ($module == "syndicate") { print_module_syndicate($title); } elseif ($module == "customtext") { var string text = $item[2]; var string titlelink_url = $item[3]; print_module_customtext($title, $text, $titlelink_url); } elseif ($module == "links") { print_module_links($title); } } } function Page::lay_sidebar_primary() { handle_sidebar_array($*sidebar_primary); } function Page::lay_sidebar_secondary() { handle_sidebar_array($*sidebar_secondary); } function render_layout (Page p, string lay) { if ($lay == "1C") { container_open("alpha"); $p->print_body(); container_close(); return; } if ($lay == "2CL") { container_open("alpha"); $p->lay_sidebar_primary(); container_close(); container_open("beta"); $p->print_body(); container_close(); return; } if ($lay == "2CR") { container_open("alpha"); $p->print_body(); container_close(); container_open("beta"); $p->lay_sidebar_primary(); container_close(); return; } if ($lay == "3C") { container_open("alpha"); $p->lay_sidebar_primary(); container_close(); container_open("beta"); $p->print_body(); container_close(); container_open("gamma"); $p->lay_sidebar_secondary(); container_close(); return; } } function get_layout () : string { var Page p = get_page(); var string lay = $*layout_type; if ($lay == "1C" or $lay == "2CR" or $lay == "2CL" or $lay == "3C") { return $lay; } return "2CR"; } function body_class (string lay) : string { var string{} map = { "1C" => "layout-one-column", "2CL" => "layout-two-column-left", "2CR" => "layout-two-column-right", "3C" => "layout-three-column", }; return $map{$lay}; } function Page::print () { var string lay = get_layout(); var string body_layout_class = body_class($lay); """ """ + $this->title() + """"""; $this->print_head(); if ($*external_stylesheet) { println """"""; } else { println """"""; } """ """; container_open("container"); print_banner($this); container_open("pagebody"); render_layout($this, $lay); container_close(); container_close(); ""; } function RecentPage::print_body() { if ($.nav.backward_url != "" or $.nav.forward_url != "") { println """

"""; if ($.nav.backward_url != "") { println """"""+get_plural_phrase($.nav.backward_count, "text_skiplinks_back")+""; } if ($.nav.backward_url != "" and $.nav.forward_url != "") { print " | "; } if ($.nav.forward_url != "") { println """"""+get_plural_phrase($.nav.forward_count, "text_skiplinks_forward")+""; } println """

"""; } foreach var Entry e ($.entries) { if ($*opt_datehead and $e.new_day) { print """

"""+$e.time->date_format("med")+"""

"""; } # Print the entry $this->print_entry($e); } } function EntryPage::print_body() { $this->print_entry($.entry); """

$*text_comments

"""; foreach var Comment c ($.comments) { $this->print_comment($c); } """
"""; } function lang_posted_by_date_and_time(UserLite poster, DateTime dt, bool showposter, bool showdate, bool showtime) : string { var string posted = ""; if ($showposter) { var string posterstr = (defined $poster ? ""+$poster : ""+$*text_poster_anonymous+""); $posted = "Posted by "+$posterstr; if (not $showtime and not $showdate) { return $posted; } $posted = $posted + ($showdate ? " on " : " at "); } if ($showdate and $showtime) { return $posted + $dt->date_format("med") + " at " + $dt->time_format(); } if ($showdate and not $showtime) { return $posted + $dt->date_format("med"); } if (not $showdate and $showtime) { return $posted + $dt->time_format(); } return ""; } function EntryPage::print_comment(Comment e) { if (not $e.full) { # Collapsed mode "
\n"; ""; "
"; return; } "
\n"; if ($e.subject != "") { "

$e.subject

\n"; } if ($*opt_userpic_comments and defined $e.userpic) { "
$e.userpic
"; } "
"; $e->print_text(); "
"; ""; if (size($e.replies) > 0) { println "
"; foreach var Comment c ($e.replies) { $this->print_comment($c); } println "
"; } "
"; } function Page::print_entry(Entry e) { "
\n"; "

$e.subject

\n"; "
\n"; var bool showuserpic = $*opt_userpic_main; if ($.view == "friends") { $showuserpic = $*opt_userpic_friends; } if ($.view == "entry") { $showuserpic = $*opt_userpic_entrypage; } if ($showuserpic and defined $e.userpic) { "
$e.userpic
"; } "
\n"; $e->print_metadata(); $e->print_text(); "
\n"; var string sep = "|"; var bool showtime = $*opt_showtime; var bool showdate = not $*opt_datehead; var bool showposter = false; if ($.view == "friends") { $showtime = true; $showposter = true; } if ($.view == "day") { $showdate = false; } if ($.view == "entry" or $.view == "reply") { $showdate = true; } if (not $e.poster->equals($e.journal)) { $showposter = true; } ""; "
\n"; "
\n"; }