# -*-s2-*- layerinfo type = "layout"; layerinfo name = "Unearthed"; layerinfo redist_uniq = "unearthed/layout"; layerinfo author_name = "Jesse Proulx"; layerinfo author_email = "jproulx@livejournal.com"; layerinfo des = "Based loosely on the design of the Unearthing T. rex website."; propgroup presentation { property use page_recent_items; property use page_friends_items; property use view_entry_disabled; property int content_width { des = "Entire width of the main content, in percentages"; values = "60|60%|70|70%|80|80%|90|90%"; } property string content_align { des = "Content alignment"; values = "right|Left|center|Center|left|Right"; } set content_width = 90; set content_align = "center"; property use use_shared_pic; property bool show_entry_userpic { des = "Show user picture icons with each of your entries?"; } set show_entry_userpic = true; property string dropshadow { des = "Show drop shadows on content boxes"; values = "none|No drop shadows|bottomright|Bottom-Right|bottomleft|Bottom-Left|topright|Top-Right|topleft|Top-Left"; } set dropshadow = "bottomright"; property string title_texture { des = "Select a background texture for the page title:"; values = "none|None|brushed_metal|Brushed Metal|burlap|Burlap|camouflage|Camouflage|canvas|Canvas|chalk|Chalk|cork|Cork|explosion|Explosion|fibers|Fibers|floral|Floral|ice|Ice|manila|Manila|marble|Marble|paper|Paper|ridge|Ridge|rough|Rough|stucco|Stucco|terracotta|Terracotta|type|Type|wavy|Wavy|weave|Weave|wood|Wood"; } set title_texture = "marble"; property string free_text { des = "Short introductory blurb or description"; rows = 10; cols = 40; } property string show_top_box { des = "Show the introduction box (located at the top)?"; values = "no|No|all|Yes, on all pages|recent|Yes, only on the Recent Entries page|friends|Yes, only on the Friends Entries page"; } set show_top_box = "recent"; property string box_sidebar_align { des = "Show box sidebars on which side?"; values = "left|Left|right|Right"; } set box_sidebar_align = "right"; } propgroup colors = "Colors"; propgroup colors { property Color stronger_bgcolor { des = "Header background color"; } set stronger_bgcolor = "#336699"; property Color stronger_fgcolor { des = "Text color on headers"; } property Color strong_bgcolor { des = "Menu background color"; } set strong_bgcolor = "#6699cc"; property Color strong_fgcolor { des = "Text color on menus"; } property Color neutral_bgcolor { des = "Title background color"; } set neutral_bgcolor = "#dddddd"; property Color neutral_fgcolor { des = "Text color on titles"; } property Color weak_bgcolor { des = "Content background color"; } set weak_bgcolor = "#c1c1c1"; property Color weak_fgcolor { des = "Text color on content areas"; } property Color weaker_bgcolor { des = "Page background color"; } set weaker_bgcolor = "#ffffff"; property Color weaker_fgcolor { des = "Default text color for the page"; } property Color link_color { des = "Link color"; noui = 1; } property Color vlink_color { des = "Visited link color"; noui = 1; } set link_color = "#0000ff"; set vlink_color = "#ff00ff"; property Color comment_bar_one_bgcolor { des = "Background color for comment bars"; } property Color comment_bar_one_fgcolor { des = "Text color on comment bars"; } property Color comment_bar_two_bgcolor { des = "Alternating background color for comment bars"; } property Color comment_bar_two_fgcolor { des = "Text color on alternating comment bars"; } property Color comment_bar_screened_bgcolor { des = "Background bar color for screened comments"; } property Color comment_bar_screened_fgcolor { des = "Text color on background bar for screened comments"; } set comment_bar_one_bgcolor = "#dddddd"; set comment_bar_one_fgcolor = "#000000"; set comment_bar_two_bgcolor = "#999999"; set comment_bar_two_fgcolor = "#000000"; set comment_bar_screened_bgcolor = "#f1f1f1"; set comment_bar_screened_fgcolor = "#000000"; } propgroup background = "Background"; propgroup background { property string background_image { des = "Background image"; note = "URL to an image to be used for the page background (leave blank for none). Background's aren't recommended with this style due to non-transparent drop-down shadows."; } property string background_repeat { des = "Background image repeat"; values = "repeat|Repeat|no-repeat|Don't repeat|repeat-x|Repeat across only|repeat-y|Repeat down only"; } property string background_position { des = "Background image position"; note = "Does not apply if background image is repeating in both directions."; values = "center|Center|center left|Center-left|center right|Center-right|top|Top|top left|Top-left|top right|Top-right|bottom|Bottom|bottom left|Bottom-left|bottom right|Bottom-right|left|Left|right|Right"; } property string background_scrolling { des = "Background image scrolling"; note = "Not supported in all browsers, but allows for the background image to be in a fixed position when scrolling."; values = "scroll|Scroll|fixed|Fixed"; } set background_image = ""; set background_repeat = "repeat"; set background_position = "center"; set background_scrolling = "scroll"; } propgroup fonts { property string main_font { des = "Preferred Font"; maxlength = 25; size = 10; example = "Arial"; note = "Leave blank for your browser's default font"; } property string main_font_fallback { des = "Alternative font style"; values = "sans-serif|Sans-serif|serif|Serif|cursive|Cursive|monospace|Monospaced|none|Use browser's default"; note = "This general style will serve as a fallback if your preferred font is unavailable."; } set main_font = "Georgia"; set main_font_fallback = "serif"; property string header_font { des = "Font for the top header box"; maxlength = 25; size = 10; example = "Arial"; note = "Leave blank for your browser's default font"; } property string header_font_fallback { des = "Alternative font style"; values = "sans-serif|Sans-serif|serif|Serif|cursive|Cursive|monospace|Monospaced|none|Use browser's default"; note = "This general style will serve as a fallback if your preferred font is unavailable."; } property string header_font_size { des = "Font size for the top header box"; values = "2em|Small|3em|Medium|4em|Large"; } set header_font = "Trebuchet MS"; set header_font_fallback = "sans-serif"; set header_font_size = "3em"; property string content_font { des = "Font for the content boxes"; maxlength = 25; size = 10; example = "Arial"; note = "Leave blank for your browser's default font"; } property string content_font_fallback { des = "Alternative font style"; values = "sans-serif|Sans-serif|serif|Serif|cursive|Cursive|monospace|Monospaced|none|Use browser's default"; note = "This general style will serve as a fallback if your preferred font is unavailable."; } set content_font = "Georgia"; set content_font_fallback = "sans-serif"; } propgroup text { property string text_linksheader { des = "Title text for link lists"; } property string text_topboxheader { des = "Title text for the top box"; } property string text_minicalheader { des = "Title for the mini-calendar"; } property string text_metaentryheader { des = "Title for entry sidebars"; } property string text_entrytitle { des = "Navigation menu title for single entries"; noui = 1; } property string text_prevyear { noui = 1; } property string text_nextyear { noui = 1; } property string text_prevmonth { noui = 1; } property string text_nextmonth { noui = 1; } property use text_view_userinfo; property use text_view_recent; property use text_view_friends; property use text_view_archive; property use text_read_comments; property use text_read_comments_friends; property use text_post_comment; property use text_post_comment_friends; property use text_comment_reply; property use text_reply_back; property use text_nosubject; property use text_noentries_day; property use text_meta_music; property use text_meta_mood; property use text_permalink; set text_linksheader = "Links:"; set text_permalink = "Permanent Link"; set text_topboxheader = "About this Journal"; set text_minicalheader = "Current Month"; set text_metaentryheader = "About this Entry"; set text_entrytitle = "Entry"; set text_prevyear = "Previous Year"; set text_nextyear = "Next Year"; set text_prevmonth = "Previous Month"; set text_nextmonth = "Next Month"; } set tags_aware = true; ################################################################################ # # Color scheme functions # function color_ideal_foreground(Color bg) : Color "Used to determine the best text color (out of white and black currently) given a single solid background color" { var Color fg = $bg->inverse(); var int saturation = $fg->saturation(); $saturation = $saturation >= 127 ? 255 : 0; $fg->saturation($saturation); var int lightness = $fg->lightness(); $lightness = $lightness >= 120 ? 255 : 0; $fg->lightness($lightness); return $fg; } function color_offset(Color color) : Color "Create an offset color for black or white text" { var Color ret = $color->clone(); if ($color.as_string == "#000000") { $ret = "#333333"; } else { $ret = "#999999"; } return $ret; } function color_link_colors(Color bg) : Color[] "Determine sound link colors based on background color" { ### Default link colors are blue and purple var Color link = $*link_color->clone(); var Color visited = $*vlink_color->clone(); ### Thing is, strong colors on strong colors looks silly if ($bg->saturation() > 230) { if ($bg->lightness() > 97 and $bg->lightness() < 161) { var int lightness = $bg->lightness() > 50 ? 161 : 97; $link->lightness($lightness); $visited->lightness($lightness); } } return [$bg, $link, $visited]; } ################################################################################ # # Property initialization # function prop_init() { if (isnull $*stronger_fgcolor) { $*stronger_fgcolor = color_ideal_foreground($*stronger_bgcolor); } if (isnull $*strong_fgcolor) { $*strong_fgcolor = color_ideal_foreground($*strong_bgcolor); } if (isnull $*neutral_fgcolor) { $*neutral_fgcolor = color_ideal_foreground($*neutral_bgcolor); } if (isnull $*weak_fgcolor) { $*weak_fgcolor = color_ideal_foreground($*weak_bgcolor); } if (isnull $*weaker_fgcolor) { $*weaker_fgcolor = color_ideal_foreground($*weaker_bgcolor); } ### Hack! if ($*title_texture == "type") { $*title_texture = palimg_tint("textures/$*title_texture" + ".png", $*stronger_fgcolor, $*stronger_bgcolor); } elseif ($*title_texture != "none") { $*title_texture = palimg_tint("textures/$*title_texture" + ".png", $*stronger_bgcolor); } } ################################################################################ # # Drop shadow functions # function dropshadow_open(string{} opts) : string { var string ret = ""; var string tint = $opts{"bgcolor"}->substr(1, 6) + $opts{"fgcolor"}->substr(1, 6); var string width = $opts{"width"} ? $opts{"width"} : "100%"; var string height = $opts{"height"} ? $opts{"height"} : ""; var string style = $opts{"style"}; if ($*dropshadow == "none") { return ""; } $ret = $ret + """"""; if ($*dropshadow == "topright" or $*dropshadow == "topleft") { $ret = $ret + "" + "" + ""; } $ret = $ret + ""; if ($*dropshadow == "bottomleft" or $*dropshadow == "topleft") { if ($*dropshadow == "bottomleft") { $ret = $ret + ""; } if ($*dropshadow == "topleft") { $ret = $ret + ""; } } $ret = $ret + ""; if ($*dropshadow == "bottomright" or $*dropshadow == "topright") { if ($*dropshadow == "bottomright") { $ret = $ret + ""; } if ($*dropshadow == "topright") { $ret = $ret + ""; } } $ret = $ret + ""; if ($*dropshadow == "bottomright" or $*dropshadow == "bottomleft") { $ret = $ret + "" + "" + ""; } $ret = $ret + "
" + "" + ""; return $ret; } function dropshadow_close(string{} opts) : string { var string ret = ""; var string tint = $opts{"bgcolor"}->substr(1, 6) + $opts{"fgcolor"}->substr(1, 6); var string width = $opts{"width"} ? $opts{"width"} : "100%"; var string height = $opts{"height"} ? $opts{"height"} : "100%"; var string style = $opts{"style"}; if ($*dropshadow == "none") { return ""; } $ret = $ret + "" + "" + "
"; return $ret; } function dropshadow (string content, string{} opts) : string "Given a string, prints a table around it that emulates a drop-shadow" { var string ret = ""; if ($*dropshadow == "none") { return """
$content
"""; } $ret = $ret + dropshadow_open($opts); $ret = $ret + $content; $ret = $ret + dropshadow_close($opts); return $ret; } function format_box(string id, string title, string contents, string sidebar_title, string sidebar) : string { var string ret = """"""; $ret = $ret + """"""; if ($*box_sidebar_align == "left") { $ret = $ret + """"""; } $ret = $ret + """"""; if ($*box_sidebar_align == "right") { $ret = $ret + """"""; } $ret = $ret + """
$title
"""; $ret = $ret + """"""; $ret = $ret + """"""; $ret = $ret + """
$sidebar_title
$sidebar
$contents"""; $ret = $ret + """"""; $ret = $ret + """"""; $ret = $ret + """
$sidebar_title
$sidebar
"""; return $ret; } ################################################################################ # # Stylesheet # function appended_to_stylesheet() { } function css_fontspec(string base, string fallback) "Prints a CSS font-family specification based on the base and fallback given" { if ($base != "" or $fallback != "none") { "font-family: "; if ($base != "") { "\"$base\""; if ($fallback != "none") { ", "; } } if ($fallback != "none") { print $fallback; } ";"; } } function print_stylesheet () { println """ body { font-size: 1em; margin: 0; padding: 0; background-color: $*weaker_bgcolor; color: $*weaker_fgcolor; """; print " "; css_fontspec($*main_font, $*main_font_fallback); println ""; if(clean_url($*background_image) != "") { println """ background-image: url('$*background_image'); background-position: $*background_position; background-repeat: $*background_repeat; background-attachment: $*background_scrolling; """; } println """ } #Content { background-color: $*weaker_bgcolor; width: $*content_width%; padding: 0; """; var int margin = 100 - $*content_width; if ($margin > 0) { if ($*content_align == "center") { $margin = $margin / 2; println """ margin-right: $margin%;"""; println """ margin-left: $margin%"""; } else { println """ margin-$*content_align: $margin%;"""; } } println """ } #Title { color: $*stronger_fgcolor; background-color: $*stronger_bgcolor; """; if ($*title_texture != "none") { println """ background-image: url("$*title_texture");"""; } println """ } """; println """ #GlobalTitle { width: 80%; margin-left: 20%; font-size: $*header_font_size; margin-bottom: 0; margin-top: 0; } #GlobalSubtitle { width: 75%; margin-left: 25%; font-size: .80em; margin-top: 2px; margin-bottom: 0; font-style: italic; } .overflow, .BoxContent { overflow: auto; } #Header { """; print " "; css_fontspec($*header_font, $*header_font_fallback); println ""; println """ width: 100%; background-color: $*strong_bgcolor; color: $*strong_fgcolor; margin-bottom: 10px; } .Box { """; print " "; css_fontspec($*content_font, $*content_font_fallback); println ""; println """ background-color: $*weak_bgcolor; color: $*weak_fgcolor; width: 100%; } .BoxContents { background-color: $*weak_bgcolor; color: $*weak_fgcolor; width: 100%; } .DropShadow { margin-bottom: 10px } .BoxSideBar { width: 175px; height: 100%; background-color: $*strong_bgcolor; color: $*strong_fgcolor; } """; var Color[] sidebar_links = color_link_colors($*strong_bgcolor); println """ .BoxSideBar table { width: 175px; height: 100%; } .BoxSidebar table a { background-color: $*strong_bgcolor; color: $sidebar_links[1]; } .BoxSidebar table a:visited { background-color: $*strong_bgcolor; color: $sidebar_links[2]; } .BoxSideBar table th { background-color: $*stronger_bgcolor; color: $*stronger_fgcolor; } .BoxSideBarContents { height: 100%; padding: 5px; } .BoxTitle { text-align: left; background-color: $*neutral_bgcolor; color: $*neutral_fgcolor; padding: 5px; } .BoxContents { padding: 5px; } """; var string headernav_bg = palimg_tint("shadow/t.gif",$*stronger_bgcolor,$*strong_bgcolor); println """ .HeaderNavMenu { background: $*strong_bgcolor url("$headernav_bg") top center repeat-x; width: 100%; background-color: $*strong_bgcolor; margin: 0; padding-left: 0; padding-top: 5px; } .HeaderNavSubMenu { width: 100%; background-color: $*neutral_bgcolor; margin: 0; padding-left: 20px; } .HeaderNavMenu li, .HeaderNavSubMenu li { margin-right: 10px; display: inline; padding-left: 5px; padding-right: 5px; padding-top: 5px; } """; var string headernavactive_bg = palimg_tint("shadow/t.gif",$*stronger_bgcolor,$*neutral_bgcolor); var Color inactive = $*strong_bgcolor->lighter(); var string headernavinactive_bg = palimg_tint("shadow/t.gif",$*stronger_bgcolor,$inactive); println """ .HeaderNavMenu li.inactive { background: $inactive url("$headernavinactive_bg") top repeat-x; margin-right: 25px; display: inline; } .HeaderNavMenu li#active { background: $*neutral_bgcolor url("$headernavactive_bg") top repeat-x; color: $*neutral_fgcolor; font-weight: bold; margin-right: 25px; display: inline; } .HeaderNavMenu li#active a { color: $*neutral_fgcolor; } .HeaderNavMenuFirst { margin-left: 50px; padding: 0; visibility: hidden; } .HeaderNavMenu li { color: $*strong_fgcolor; } .HeaderNavMenu li a { color: $*strong_fgcolor; text-decoration: none; } .HeaderNavSubMenu li { color: $*neutral_fgcolor; } .HeaderNavSubMenu li a { color: $*neutral_fgcolor; text-decoration: none; } #FooterNavMenu { text-align: center; background-color: $*weak_bgcolor; color: $*weak_fgcolor; } #FooterNavMenu a { background-color: $*weak_bgcolor; color: $*weak_fgcolor; } #FooterNavMenu a:visited { background-color: $*weak_bgcolor; color: $*weak_fgcolor; } .CommentBarOne, .CommentBarTwo, .CommentBarScreened { width: 100%; margin-top: 1em; height: 100%; } .CommentBarOne { background-color: $*comment_bar_one_bgcolor; color: $*comment_bar_one_fgcolor; } .CommentBarTwo { background-color: $*comment_bar_two_bgcolor; color: $*comment_bar_two_fgcolor; } .CommentBarScreened { background-color: $*comment_bar_screened_bgcolor; color: $*comment_bar_screened_fgcolor; } """; var Color highlightday = $*strong_bgcolor->lighter(); println """ #MiniCal { width: 175px; height: 3em; } .MiniCalDayPosts, .MiniCalDay { text-align: center; font-size: .8em; border: 1px inset #000; width: 14%; } .MiniCalDayPosts { background-color: $highlightday; } .MiniCalDayPosts a { color: $*strong_fgcolor; display: block; text-decoration: none; width: 100%; } """; appended_to_stylesheet(); } ################################################################################ # # Page # function Page::lay_add_header_nav() : string { return ""; } function Page::lay_sub_menu() : string[] { var string[] ret = []; return $ret; } function Page::lay_footer_menu() : string[] { var string[] ret = []; return $ret; } function Page::lay_entry_sidebar(Entry e) : string { var string ret; if ($e.poster.username != $e.journal.username) { if (defined $e.userpic and $*show_entry_userpic) { var int margin = (175 - $e.userpic.width) / 2; $ret = dropshadow($e.userpic->as_string(), { "bgcolor" => $*strong_bgcolor.as_string, "fgcolor" => "#000000", "width" => string($e.userpic.width) + "px", "height" => string($e.userpic.height) + "px", "style" => "margin-left: " + $margin + "px; margin-right: " + $margin + "px;", }); } $ret = $ret + $e.poster->as_string() + ":
"; } elseif (defined $e.userpic and $*show_entry_userpic) { var int margin = (175 - $e.userpic.width) / 2; $ret = dropshadow($e.userpic->as_string(), { "bgcolor" => $*strong_bgcolor.as_string, "fgcolor" => "#000000", "width" => string($e.userpic.width) + "px", "height" => string($e.userpic.height) + "px", "style" => "margin-left: " + $margin + "px; margin-right: " + $margin + "px;", }); } return $ret; } function Page::lay_show_entry_text : bool { return true; } function Page::lay_entry_sidebar_nav() : string { return ""; } function linklist() : string { var string return = ""; var Page p = get_page(); if (size $p.linklist <= 0) { return ""; } var bool section_open = false; $return = $return + """$*text_linksheader
"""; foreach var UserLink l ($p.linklist) { if ($l.title) { if ($l.is_heading) { if ($section_open) { $return = $return + """
"""; } $return = $return + """$l.title """; $section_open = true; } else { $return = $return + """$l.title """; } } } return $return; } function mini_calendar() : string { var string calendar = ""; var Page p = get_page(); var YearMonth m = $p->get_latest_month(); var string month = $m->month_format(); if($m.has_entries) { $calendar = """"""; var YearWeek[] theWeeks = $m.weeks; foreach var YearWeek w ($theWeeks) { $calendar = $calendar + ""; var YearDay[] theDays = $w.days; var int pre = $w.pre_empty; if($pre > 0) { $calendar = $calendar + """"""; } foreach var YearDay d ($theDays) { if ($d.num_entries) { $calendar = $calendar + """"""; } else { $calendar = $calendar + """"""; } } $calendar = $calendar + "\n"; } $calendar = $calendar + "
 $d.day$d.day
"; } if ($calendar == "") { return "No entries to show"; } return $calendar; } function top_box() : string { var string return = ""; var string contents = ""; if ($*free_text) { $contents = $contents + $*free_text + "
"; } $contents = $contents + linklist(); $contents = format_box("TopBox", $*text_topboxheader, $contents, $*text_minicalheader, mini_calendar()); var Color offset = color_offset($*weaker_fgcolor); $return = dropshadow($contents, { "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $offset.as_string, "width" => "95%", }); return $return; } function Page::lay_print_top_box() { if ($*show_top_box != "all") { return; } print top_box(); } function Page::print_entry(Entry e) { var string id = "entry_$e.itemid"; var string title = "$e.security_icon" + ($e.subject != "" ? " $e.subject" : " $*text_nosubject"); var string contents = ""; var string sidebar = ""; var string date = $e.time->date_format("med"); var string time = $e.time->time_format("short"); $title = """$date @ $time """ + $title; if (size $e.metadata) { $contents = $contents + """
"""; foreach var string k ($e.metadata) { var string text = $k; var string val = $e.metadata{$k}; if ($k == "mood") { $text = $*text_meta_mood; } elseif ($k == "music") { $text = $*text_meta_music; } if ($k == "mood" and defined $e.mood_icon) { var Image i = $e.mood_icon; $val = " $val"; } $contents = $contents + """$text: $val
"""; } $contents = $contents + "
"; } if ($e.tags) { var int tcount = 0; $contents = $contents + "
Tags: "; foreach var Tag t ($e.tags) { $contents = $contents + """"""; $tcount++; if ($tcount != size $e.tags) { $contents = $contents + ", "; } } $contents = $contents + "
"; } if (size $e.metadata or size $e.tags) { $contents = $contents + "
"; } $contents = $contents + ($this->lay_show_entry_text() ? $e.text : ""); $sidebar = $sidebar + $this->lay_entry_sidebar($e); # Comments $sidebar = $sidebar + """
"""; if ($e.comments.enabled) { if (($e.comments.count > 0 or $e.comments.screened) and $.view != "entry") { $sidebar = $sidebar + """""" + get_plural_phrase($e.comments.count, $.view == "friends" ? "text_read_comments_friends" : "text_read_comments") + ""; $sidebar = $sidebar + "
"; } if ($.view != "reply") { $sidebar = $sidebar + """""" + ($.view == "friends" ? $*text_post_comment_friends : $*text_post_comment) + "
"; } } $sidebar = $sidebar + """$*text_permalink
"""; if ($.view == "entry" or $.view == "reply") { $sidebar = $sidebar + "
"; var Link l = new Link; foreach var string ls ($e.link_keyseq) { $l = $e->get_link($ls); if (defined $l) { $sidebar = $sidebar + """$l.caption
"""; } } } $sidebar = $sidebar + $this->lay_entry_sidebar_nav(); $sidebar = $sidebar + "
"; var string entry = format_box($id, $title, $contents, $*text_metaentryheader, $sidebar); var Color offset = color_offset($*weaker_fgcolor); print dropshadow($entry, { "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $offset.as_string, "width" => "95%", }); } function Page::print() { var string title = $this->title(); println """"""; println """"""; println """$title"""; println """"""; $this->print_head(); println """"""; println """
"""; $this->lay_print_top_box(); $this->print_body(); var string footer = ""; foreach var string v ($.views_order) { $footer = $footer + """""" + lang_viewname($v) + " | "; } var string[] footermenu = $this->lay_footer_menu(); if (size $footermenu > 0) { foreach var string menuitem ($footermenu) { $footer = $footer + """$menuitem | """; } } $footer = $footer + """Top"""; println dropshadow("""
$footer
""", { "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $*weaker_fgcolor.as_string, "style" => "margin-left: 10%; margin-right: 10%; ", "width" => "80%", }); println """
"""; } ################################################################################ # # RecentPage # function RecentPage::lay_print_top_box() { if ($*show_top_box != "recent" and $*show_top_box != "all") { return; } print top_box(); } function RecentPage::lay_sub_menu() : string[] { var string[] ret = []; var int i = 0; if (viewer_is_owner()) { $ret[$i] = """
  • Update Journal
  • """; $i++; } if ($.nav.forward_url != "" or $.nav.backward_url != "") { if ($.nav.backward_url != "") { var string previous = get_plural_phrase($.nav.backward_count, "text_skiplinks_back"); $ret[$i] = """$previous"""; $i++; } if ($.nav.forward_url != "") { var string next = get_plural_phrase($.nav.forward_count, "text_skiplinks_forward"); $ret[$i] = """$next"""; $i++; } } return $ret; } function RecentPage::lay_footer_menu() : string[] { var string[] ret = []; var int i = 0; if ($.nav.forward_url != "" or $.nav.backward_url != "") { if ($.nav.backward_url != "") { var string previous = get_plural_phrase($.nav.backward_count, "text_skiplinks_back"); $ret[$i] = """$previous"""; $i++; } if ($.nav.forward_url != "") { var string next = get_plural_phrase($.nav.forward_count, "text_skiplinks_forward"); $ret[$i] = """$next"""; $i++; } } return $ret; } function RecentPage::print_body { foreach var Entry e ($.entries) { $this->print_entry($e); } } ################################################################################ # # FriendsPage # function FriendsPage::lay_print_top_box() { if ($*show_top_box == "friends" or $*show_top_box == "all") { print top_box(); } } function FriendsPage::lay_entry_sidebar(Entry e) : string { var string ret; if (defined $e.userpic and $*show_entry_userpic) { var int margin = (175 - $e.userpic.width) / 2; $ret = dropshadow($e.userpic->as_string(), { "bgcolor" => $*strong_bgcolor.as_string, "fgcolor" => "#000000", "width" => string($e.userpic.width) + "px", "height" => string($e.userpic.height) + "px", "style" => "margin-left: " + $margin + "px; margin-right: " + $margin + "px;", }); } if ($e.poster.username != $e.journal.username) { $ret = $ret + $e.poster->as_string() + ", posting in "; } $ret = $ret + $e.journal->as_string() + "
    "; return $ret; } ################################################################################ # # EntryPage # function EntryPage::lay_show_entry_text : bool { return not $.viewing_thread; } function EntryPage::lay_add_header_nav() : string { var string ret = ""; $ret = """
  • $*text_entrytitle
  • """; return $ret; } function EntryPage::lay_entry_sidebar_nav() : string { var string return; if ($.comment_pages.all_subitems_displayed) { return ""; } $return = "
    "; foreach var int i (1 .. $.comment_pages.total) { if ($i == $.comment_pages.current) { $return = $return + "[Page $i]
    "; } else { var string url_of = $.comment_pages->url_of($i); $return = $return + """[Page $i]
    """; } } return $return; } function EntryPage::lay_sub_menu() : string[] { var string[] return; var int i = 0; var Link prev = $.entry->get_link("nav_prev"); var Link next = $.entry->get_link("nav_next"); if ($prev.url != "" or $next.url != "") { if ($prev.url != "") { $return[$i] = """$prev.caption"""; $i++; } if ($next.url != "") { $return[$i] = """$next.caption"""; } } return $return; } function EntryPage::lay_footer_menu() : string[] { var string[] return; var int i = 0; var Link prev = $.entry->get_link("nav_prev"); var Link next = $.entry->get_link("nav_next"); if ($prev.url != "" or $next.url != "") { if ($prev.url != "") { $return[$i] = """$prev.caption"""; $i++; } if ($next.url != "") { $return[$i] = """$next.caption"""; } } return $return; } function EntryPage::print_body { set_handler("unscreen_comment_#", [ [ "set_class", "cmtbar#", "CommentBarOne", ], ]); set_handler("screen_comment_#", [ [ "set_class", "cmtbar#", "CommentBarScreened", ], ]); var Entry e = $.entry; $this->print_entry($e); if ($.entry.comments.enabled and ($.entry.comments.count > 0 or $.entry.comments.screened)) { var string{} opts = { "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $*weaker_fgcolor.as_string, "width" => "95%", }; print dropshadow_open($opts); print """
    """; if ($.comment_pages.total_subitems > 0) { $this->print_multiform_start(); $this->print_comments($.comments); print """
    """; $this->print_multiform_actionline(); print "
    "; $this->print_multiform_end(); } print "
    "; print dropshadow_close($opts); } elseif (not $.entry.comments.enabled) { print dropshadow("""
    $*text_reply_nocomments
    """, { "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $*weaker_fgcolor.as_string, "width" => "95%", }); } } function EntryPage::print_comment(Comment c) { var string class = ""; if ($c.screened) { $class = "CommentBarScreened"; } elseif ($c.depth % 2) { $class = "CommentBarOne"; } else { $class = "CommentBarTwo"; } var string poster = defined $c.poster ? $c.poster->as_string() : "$*text_poster_anonymous"; var string sub_icon; if (defined $c.subject_icon) { $sub_icon = $c.subject_icon->as_string(); } println """
    """; println """"""; if (defined $c.userpic and $*comment_userpic_style != "off") { var int w = $c.userpic.width; var int h = $c.userpic.height; if ($*comment_userpic_style == "small") { $w = $w / 2; $h = $h / 2; } println """"""; } println """
    [User Picture Icon]"""; println """"; println """"; println """"; println """"""; println "
    """; println ""; println """"""; println """"; if ($c.metadata{"poster_ip"}) { println """"; } println "
    From:$poster
    Date:"""; println $c.time->date_format("long") + " - " + $c.time->time_format() + "
    $*text_comment_ipaddr(""" + $c.metadata{"poster_ip"} + ")
    """; if ($this.multiform_on) { println """ """; $c->print_multiform_check(); } $c->print_linkbar(); println "
    """; println (defined $c.subject_icon or $c.subject != "") ? """

    $c.subject_icon $c.subject

    """ : ""; println "
    ($*text_permalink)
    "; println """
    $c.text
    """; println """
    """; if ($c.frozen) { println """($*text_comment_frozen) """; } else { "("; $c->print_reply_link({"linktext" => $*text_comment_reply}); ")"; } if ($c.parent_url != "") { println """($*text_comment_parent) """; } if ($c.thread_url != "") { println """($*text_comment_thread) """; } $c->print_reply_container(); println "
    "; } ################################################################################ # # ReplyPage # function ReplyPage::lay_add_header_nav() : string { var string ret = ""; $ret = """
  • $*text_entrytitle
  • """; return $ret; } function ReplyPage::lay_show_entry_text : bool { return $.entry.permalink_url == $.replyto.permalink_url; } function ReplyPage::print_body { $this->print_entry($.entry); if (not $.entry.comments.enabled) { print "

    $*text_reply_nocomments_header/h2>

    $*text_reply_nocomments

    "; return; } var Color offset = color_offset($*weaker_fgcolor); if ($.entry.permalink_url != $.replyto.permalink_url) { var string sidebar; if (defined $.replyto.userpic) { var int margin = (175 - $.replyto.userpic.width) / 2; $sidebar = $sidebar + dropshadow($.replyto.userpic->as_string(), { "bgcolor" => $*strong_bgcolor.as_string, "fgcolor" => "#000000", "width" => string($.replyto.userpic.width) + "px", "height" => string($.replyto.userpic.height) + "px", "style" => "margin-left: " + $margin + "px; margin-right: " + $margin + "px;", }); } $sidebar = $sidebar + lang_user_wrote($.replyto.poster); $sidebar = $sidebar + "
    "+lang_at_datetime($.replyto.time); var string box = format_box("", $.replyto.subject != "" ? $.replyto.subject : $*text_nosubject, $.replyto.text, "", $sidebar); print dropshadow($box, { "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $offset.as_string, "width" => "95%", }); } print dropshadow_open({ "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $offset.as_string, "width" => "95%", }); print """
    """; $.form->print(); print """
    """; print dropshadow_close({ "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $offset.as_string, }); } function lang_user_wrote(UserLite u) : string "Returns text describing that the user wrote something. i18nc layers should override this." { if (defined $u) { return $u->as_string()+" replied to "; } else { return "An anonymous user wrote"; } } ################################################################################ # # YearPage # function YearPage::lay_footer_menu() : string[] { var string[] ret; var int i = 0; var int menu = 0; foreach var YearYear y ($.years) { if ($y.displayed) { if (defined $.years[$i - 1]) { var YearYear prev = $.years[$i - 1]; $ret[$menu] = """$*text_prevyear"""; $menu++; } if (defined $.years[$i + 1]) { var YearYear next = $.years[$i + 1]; $ret[$menu] = """$*text_nextyear"""; $menu++; } } $i++; } return $ret; } function YearPage::lay_sub_menu() : string[] { var string[] ret; var int i = 0; foreach var YearYear y ($.years) { if ($y.displayed) { $ret[$i] = """$y.year\n"""; } else { $ret[$i] = """$y.year\n"""; } $i++; } return $ret; } function YearPage::print_body { foreach var YearMonth m ($.months) { $this->print_month($m); } } function YearPage::print_month(YearMonth m) { if (not $m.has_entries) { return; } var string month; $month = $month + """"""; foreach var int d (weekdays()) { $month = $month + "\n"; } $month = $month + "\n"; foreach var YearWeek w ($m.weeks) { $month = $month + """\n"""; if ($w.pre_empty > 0) { $month = $month + """\n"""; } foreach var YearDay d ($w.days) { $month = $month + """\n"""; } if ($w.post_empty > 0) { $month = $month + """\n"""; } $month = $month + ""; } $month = $month + "
    " + $*lang_dayname_short[$d] + "
     \n"""; $month = $month + """
    $d.day
    \n"""; if ($d.num_entries > 0) { $month = $month + """\n"""; } $month = $month + """
     
    "; $month = format_box("", $m->month_format(), $month, "Links", """$*text_view_month"""); var Color offset = color_offset($*weaker_fgcolor); print dropshadow($month, { "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $offset.as_string, "width" => "95%", }); } ################################################################################ # # MonthPage # function MonthPage::lay_sub_menu () : string[] { var string[] ret = []; var int i; var string links = ""; if ($.prev_url != "") { $ret[$i] = """$*text_prevmonth"""; $i++; } if ($.next_url != "") { $ret[$i] = """$*text_nextmonth"""; $i++; } return $ret; } function MonthPage::lay_footer_menu () : string[] { var string[] ret = []; var int i; var string links = ""; if ($.prev_url != "") { $ret[$i] = """$*text_prevmonth"""; $i++; } if ($.next_url != "") { $ret[$i] = """$*text_nextmonth"""; $i++; } return $ret; } function MonthPage::print_body { "
    "; $.redir->print_hiddens(); if (size $.months > 1) { "\n"; } "
    \n"; var string days = "
    "; var string links = "
    """; $links = $links + """"""; var string month = format_box("",$.date->date_format($*lang_fmt_month_long),$days,"Links",$links); var Color offset = color_offset($*weaker_fgcolor); print dropshadow($month, { "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $offset.as_string, "width" => "100%", }); } ################################################################################ # # DayPage # function DayPage::lay_sub_menu() : string[] { var string[] ret = []; $ret[0] = """$*text_day_prev"""; $ret[1] = """$*text_day_next"""; return $ret; } function DayPage::lay_footer_menu() : string[] { var string[] ret = []; $ret[0] = """$*text_day_prev"""; $ret[1] = """$*text_day_next"""; return $ret; } function DayPage::print_body() { if ($.has_entries) { foreach var Entry e ($.entries) { $this->print_entry($e); } } else { var Color offset = color_offset($*weaker_fgcolor); print dropshadow("

    $*text_noentries_day

    ", { "bgcolor" => $*weaker_bgcolor.as_string, "fgcolor" => $offset.as_string, "width" => "95%", }); } }