ljr/livejournal/bin/upgrading/s2layers/classic/layout.s2

786 lines
24 KiB
Plaintext
Executable File

# -*-s2-*-
layerinfo type = "layout";
layerinfo name = "Classic";
layerinfo redist_uniq = "classic/layout";
layerinfo previews = "classic/classic.jpg";
propgroup colors {
property Color body_bgcolor {
des = "Background color of page";
s1color = "stronger_back";
}
property Color main_bgcolor {
des = "Background color of main text area";
s1color = "page_back";
}
property Color main_fgcolor {
des = "Color of text on main text areas";
s1color = "page_text";
}
property Color headerbar_bgcolor {
des = "Background color of header bars";
s1color = "strong_back";
}
property Color headerbar_fgcolor {
des = "Color of text on header bars";
s1color = "strong_text";
}
property Color metabar_bgcolor {
des = "Background color of side bar";
s1color = "weak_back";
}
property Color metabar_fgcolor {
des = "Color of text on side bar";
s1color = "weak_text";
}
property Color page_title_color {
des = "Text color of the page's main title";
s1color = "page_text_title";
}
property Color page_subtitle_color {
des = "Text color of the page's subtitles";
s1color = "page_text_em";
}
property Color link_color {
des = "Text color of links";
s1color = "page_link";
}
property Color vlink_color {
des = "Text color of visited links";
s1color = "page_vlink";
}
property Color alink_color {
des = "Text color of active links";
s1color = "page_alink";
}
property Color comment_bar_one_bgcolor {
des = "Alternating background color for comment bars (one)";
}
property Color comment_bar_two_fgcolor {
des = "Text color on alternating comment bars (one)";
}
property Color comment_bar_two_bgcolor {
des = "Alternating background color for comment bars (two)";
}
property Color comment_bar_one_fgcolor {
des = "Text color on alternating comment bars (two)";
}
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 body_bgcolor = "#6666cc";
set main_bgcolor = "#ffffff";
set main_fgcolor = "#000000";
set headerbar_bgcolor = "#c0c0ff";
set headerbar_fgcolor = "#000000";
set metabar_bgcolor = "#eeeeff";
set metabar_fgcolor = "#000000";
set page_title_color = "#8b1a1a";
set page_subtitle_color = "#c00000";
set link_color = "#000050";
set vlink_color = "#500050";
set alink_color = "#ff00c0";
set comment_bar_one_bgcolor = "#c0c0ff";
set comment_bar_one_fgcolor = "#000000";
set comment_bar_two_bgcolor = "#eeeeff";
set comment_bar_two_fgcolor = "#000000";
set comment_bar_screened_bgcolor = "#dddddd";
set comment_bar_screened_fgcolor = "#000000";
set tags_aware = true;
propgroup presentation {
property bool show_entry_userpic {
des = "Show your userpic with your journal's entries?";
}
property use font_base;
property use font_fallback;
property use page_recent_items;
property use page_friends_items;
property use view_entry_disabled;
property use use_shared_pic;
property bool show_entrynav_icons {
des = "Toggle to show the next, memory, edit, etc icons on the entry view page";
}
property string page_background_image {
des = "URL to an image to be used for the page background";
}
property use external_stylesheet;
}
set show_entry_userpic = false;
set font_base = "Arial, Helvetica";
set font_fallback = "sans-serif";
set page_recent_items = 20;
set page_friends_items = 25;
set view_entry_disabled = false;
set show_entrynav_icons = true;
set page_background_image = "";
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_website_default_name;
}
function print_stylesheet ()
{
print clean_url($*page_background_image) != "" ? "body { background-image: url($*page_background_image); }" : "";
var string font;
if ($*font_base) {
$font = "\"$*font_base\"";
if ($*font_fallback != "none") {
$font = "$font, ";
}
}
if ($*font_fallback != "none") {
$font = "$font $*font_fallback";
}
if ($font != "") {
"""
body, table, td, th, .page_title, #yearheader {
font-family: $font;
}
""";
}
"""
body,.body {
background-color: $*body_bgcolor;
color: $*main_fgcolor;
padding: 5pt;
}
a, a:link {
color: $*link_color;
}
a:vlink {
color: $*vlink_color;
}
a:alink {
color: $*alink_color;
}
table.main {
background-color: $*main_bgcolor;
color: $*main_fgcolor;
}
.page_title {
color: $*page_title_color;
font-size: 18pt;
}
.view_links {
font-family: monospace;
white-space: nowrap;
}
.view_links2 {
font-family: monospace;
font-size: 9pt;
}
th.headerbar {
background-color: $*headerbar_bgcolor;
color: $*headerbar_fgcolor;
font-weight: bold;
font-size: 16pt;
text-align: left;
}
td.metabar {
text-align: right;
white-space: nowrap;
background-color: $*metabar_bgcolor;
color: $*metabar_fgcolor;
}
.subject {
color: $*page_subtitle_color;
font-weight: bold;
}
.comments {
text-align: right;
}
#yearheader {
color: $*page_subtitle_color;
font-weight: bold;
font-style: italic;
font-size: 14pt;
}
th.monthheader {
background-color: $*headerbar_bgcolor;
font-size: 12pt;
}
th.daysheader {
background-color: $*metabar_bgcolor;
font-weight: normal;
}
td.weekday_empty {
background-color: $*metabar_bgcolor;
}
.day_id {
font-weight: bold;
font-size: 10pt;
}
#archiveyearpage_nav {
font-size: 14pt;
font-weight: bold;
}
""";
}
function Page::lay_nav_blurb() { }
function Page::lay_primary_userpic() : Image {
return $.journal.default_pic;
}
function EntryPage::lay_primary_userpic() : Image {
return $.entry.userpic;
}
function Page::print_linklist() {
if (size $.linklist <= 0) {
return;
}
var bool section_open = false;
println "<span class='view_links2'>";
foreach var UserLink l ($.linklist) {
if ($l.title) {
if ($l.is_heading) {
if ($section_open) {
println "<br />";
}
println """<span style="font-weight: bold;">$l.title</span> """;
$section_open = true;
} else {
println """[<a href="$l.url">$l.title</a>]""";
}
}
}
if ($section_open) {
println "</span><br /><br />";
}
println "";
}
function Page::print ()
{
var string title = $this->title();
var string userpic;
var Image default_userpic = $this->lay_primary_userpic();
if (defined $default_userpic)
{
$userpic = "<img align='right' style='padding: 2px' src='$default_userpic.url' "+
"width='$default_userpic.width' height='$default_userpic.height' alt='' />";
}
var string website_name = $.journal.website_name ? $.journal.website_name : $*text_website_default_name;
var string website = $.journal.website_url ?
"""<td><a href="$.journal.website_url">$website_name</a></td><td class="body">&nbsp;</td>""" :
"";
var string links;
foreach var string v ($.views_order) {
$links = $links + ($.view == $v ?
"["+lang_viewname($v)+"]" :
"[<a href='$.view_url{$v}'>"+lang_viewname($v)+"</a>]");
}
"""
<html>
<head>
""";
if ($*external_stylesheet) {
println """<link rel="stylesheet" href="$.stylesheet_url" type="text/css" />""";
} else {
println """<style type="text/css">"""; print_stylesheet(); "</style>";
}
$this->print_head();
"""
<title>$title</title>
</head>
<body>
<table class="main" width='100%'><tr><td>
$userpic
<span class="page_title">$title</span>
<p class="view_links">$links</p>
""";
if (size $.linklist > 0 and $*linklist_support) {
$this->print_linklist();
}
$this->lay_nav_blurb();
$this->print_body();
"</td></tr></table>\n";
### Affliations
"<table class='main' align='right'><tr>";
print $website; "<td>"; server_sig(); "</td></tr>";
"</table>\n</body>\n</html>";
}
function print_entry (Page p, Entry e, Color bgcolor, Color fgcolor, bool hide_text)
{
var string time = $e.time->time_format();
var string userpic = "";
if (defined $e.userpic)
{
$userpic = "<img src='$e.userpic.url' alt='[User Picture]' height='$e.userpic.height' width='$e.userpic.width' />";
}
if ($e.new_day or $p.view == "entry")
{
"<tr><th colspan='2' align='left' class='headerbar'>";
print $e.time->date_format("%%month%% %%dayord%%, %%yyyy%%");
"</th></tr>\n";
} elseif ($p.view == "day") {
"<tr><th class='headerbar'>Time</td><td class='headerbar' style='width: 100%'>Event</th></tr>";
}
"<tr valign='top'>";
# Metabar
"<td style='background-color: $bgcolor;' class='metabar'>";
# Time
"<em>$time</em><br />";
# Altposter crap
if ($p.view == "friends")
{
"<strong><a style='color: $fgcolor' href='" + $e.journal->base_url() + "/'>";
print $e.journal.username;
"</a></strong><br />";
}
if ($e.journal.username != $e.poster.username)
{
"[<a href='" + $e.poster->base_url() + "/'>";
print $e.poster.username;
"</a>]<br />";
}
if ($userpic != "" and ($p.view == "friends" or $*show_entry_userpic == true))
{
print $userpic;
}
# Security icon
if ($e.security) { print $e.security_icon; }
# Permalink
"<p>[<a href='$e.permalink_url'>$*text_permalink</a>]</p>";
"</td>";
# Entry
"<td style='text-align:left'>";
if ($p.view == "entry" and $*show_entrynav_icons)
{
print "<div style='text-align: center'>";
$e->print_linkbar();
print "</div>";
}
if ($e.subject) { "\n\n<span class='subject'>$e.subject</span><br />"; }
if (not $hide_text) {
print $e.text; "\n\n";
if (size $e.metadata or size $e.tags)
{
"<p>";
foreach var string k ($e.metadata)
{
var string key = $k;
var string val = $e.metadata{$k};
if ($k == "mood") { $key = $*text_meta_mood; }
if ($k == "music") { $key = $*text_meta_music; }
if ($k == "mood" and defined $e.mood_icon)
{
var Image i = $e.mood_icon;
$val = "<img src='$i.url' width='$i.width' height='$i.height' alt='' /> $val";
}
"<strong>$key:</strong> $val<br />";
}
if ($e.tags) {
var int tcount = 0;
"<strong>Tags:</strong> ";
foreach var Tag t ($e.tags) {
"""<a rel="tag" href="$t.url">$t.name</a>""";
$tcount++;
if ($tcount != size $e.tags) { ", "; }
}
"<br />";
}
"</p>";
}
}
$e.comments->print();
"</td>";
"</tr>\n";
}
function Page::print_entry (Entry e)
{
print_entry($this, $e, $*metabar_bgcolor, $*metabar_fgcolor, false);
}
function FriendsPage::print_entry (Entry e)
{
var Friend f = $.friends{$e.journal.username};
print_entry($this, $e, $f.bgcolor, $f.fgcolor, false);
}
function RecentPage::lay_nav_blurb ()
{
var string user = "<a href='$.base_url/info'>$.journal.name</a>";
if ($.nav.skip > 0)
{
"Below are $.nav.count entries, after skipping $.nav.skip most recent ones in the \"$user\" journal:";
} else {
"Below are the $.nav.count most recent journal entries recorded in the \"$user\" journal:";
}
}
function RecentPage::print_body ()
{
var string nav = "";
if ($.nav.forward_url != "" or $.nav.backward_url != "")
{
if ($.nav.backward_url != "")
{
$nav = "<a href='$.nav.backward_url'>&lt;&lt; Previous $.nav.backward_count entries</a>";
}
if ($.nav.backward_url != "" and $.nav.forward_url != "")
{
$nav = "$nav --";
}
if ($.nav.forward_url != "")
{
$nav = "$nav <a href='$.nav.forward_url'>Next $.nav.forward_count entries &gt;&gt;</a>";
}
$nav = "<p align='center'>[$nav]</p>";
}
if ($nav != "") { print $nav; }
"<table style='margin-left: 30px'>\n";
foreach var Entry e ($.entries) { $this->print_entry($e); }
"</table>\n";
if ($nav != "") { print $nav; }
}
function FriendsPage::lay_nav_blurb ()
{
var int total = size $.entries;
if ($.nav.skip > 0)
{
"Below are $total friends entries, after skipping $.nav.skip most recent ones:";
} else {
"Below are the $total most recent friends journal entries:";
}
}
function CommentInfo::print ()
{
if (not $.enabled) { return; }
"<p class='comments'>(";
if ($.count > 0 or $.screened) {
$this->print_readlink();
"&nbsp;|&nbsp;";
}
$this->print_postlink();
")</p>";
}
function YearPage::lay_nav_blurb()
{
"<p id='yearpage_nav'>";
$this->print_year_links();
"</p>";
}
function YearPage::print_body
{
"<p id='yearheader'>$.year&hellip;</p>\n";
foreach var YearMonth m ($.months) {
$this->print_month($m);
}
}
function YearPage::print_year_links ()
{
foreach var YearYear y ($.years) {
if ($y.displayed) {
"[ $y.year ]";
} else {
"[ <a href=\"$y.url\">$y.year</a> ]";
}
}
}
function YearPage::print_month(YearMonth m)
{
if (not $m.has_entries) { return; }
# Table Wrapper
"<center><p><table border='1' cellpadding='4' width='80%'>\n";
# Month Header
"<tr align='center'><th colspan='7' class='monthheader'>\n";
print $m->month_format();
"</th></tr>\n";
# Weekdays Header
"<tr align='center'>\n";
foreach var int d (weekdays()) {
"<th class='daysheader'>"+$*lang_dayname_short[$d]+"</th>\n";
}
"</tr>\n";
# Weeks
foreach var YearWeek w ($m.weeks) {
$w->print();
}
# Footer
"<tr><td colspan='7'><div style='text-align: center'><a href='$m.url'>$*text_view_month</a></div></td></tr>\n";
# End Table
"</table></p></center>\n";
}
function YearWeek::print ()
{
"<tr>";
if ($.pre_empty) { "<td colspan='$.pre_empty' class='weekday_empty'>&nbsp;</td>"; }
foreach var YearDay d ($.days) {
"<td valign='top'><span class='day_id'>$d.day</span><div style='text-align: center'>";
if ($d.num_entries) {
"<a href='$d.url'>$d.num_entries</a>";
} else {
"&nbsp;";
}
"</div></td>\n";
}
if ($.post_empty) { "<td colspan='$.post_empty' class='weekday_empty'>&nbsp;</td>"; }
"</tr>";
}
function DayPage::print_body ()
{
"<h2 class='daypage_header'>"; print $.date->date_format("%%month%% %%dayord%%, %%yyyy%%"); "</h2>";
if (not $.has_entries)
{
"<blockquote><em>"; print ehtml($*text_noentries_day); "</em></blockquote>";
} else {
"<table style='margin-left: 30px'>";
foreach var Entry e ($.entries) { $this->print_entry($e); }
"</table>";
}
var string tprev = ehtml($*text_day_prev);
var string tnext = ehtml($*text_day_next);
"<table align='center'><tr align='middle'>\n";
"<td width='33%' align='left'><a href='$.prev_url'>$tprev</a></td>\n";
"<td align='center' width='33%'>";
"<strong>"; print $.date->date_format("%%yyyy%%/%%mm%%/%%dd%%"); "</strong><br />";
"[<a href='"; print $this.journal->base_url(); "/calendar'>$*text_view_archive</a>]</td>\n";
"<td width='33%' align='right'><a href='$.next_url'>$tnext</a></td>\n";
"</tr></table>";
}
function EntryPage::print_body () {
set_handler("unscreen_comment_#", [
[ "style_bgcolor", "cmtbar#", "$*comment_bar_one_bgcolor", ],
[ "style_color", "cmtbar#", "$*comment_bar_one_fgcolor", ],
]);
set_handler("screen_comment_#", [
[ "style_bgcolor", "cmtbar#", "$*comment_bar_screened_bgcolor", ],
[ "style_color", "cmtbar#", "$*comment_bar_screened_fgcolor", ],
]);
"<table style='margin-left: 30px'>\n";
print_entry($this, $.entry, $*metabar_bgcolor, $*metabar_fgcolor, $.viewing_thread);
if ($.entry.comments.enabled and $.comment_pages.total_subitems > 0)
{
$this->print_multiform_start();
"<tr valign='top'><th class='headerbar' colspan='2'>Comments</th></tr>";
"<tr valign='top'><td style='background-color: $*metabar_bgcolor'>&nbsp;</td><td style='width: 100%'>";
if ($.comment_pages.total_subitems > 0) {
$.comment_pages->print();
$this->print_comments($.comments);
}
"</td></tr>";
if ($this.multiform_on) {
"<tr valign='top'><th class='headerbar' colspan='2'>Mass Action</th></tr>";
"<tr valign='top'><td style='background-color: $*metabar_bgcolor'>&nbsp;</td><td style='width: 100%'>";
$this->print_multiform_actionline();
$this->print_multiform_end();
"</td></tr>";
}
}
"</table>\n";
}
function EntryPage::print_comment (Comment c) {
var Color background; var Color color;
if ($c.screened) {
$background = $*comment_bar_screened_bgcolor;
$color = $*comment_bar_screened_fgcolor;
} elseif ($c.depth % 2) {
$background = $*comment_bar_one_bgcolor;
$color = $*comment_bar_one_fgcolor;
} else {
$background = $*comment_bar_two_bgcolor;
$color = $*comment_bar_two_fgcolor;
}
var string poster = defined $c.poster ? $c.poster->as_string() : "<i>(Anonymous)</i>";
var string sub_icon;
if (defined $c.subject_icon) {
$sub_icon = $c.subject_icon->as_string();
}
"<a name='$c.anchor'></a><div id='cmtbar$c.talkid' style='background-color: $background; color: $color; margin-top: 10px; width: 100%'>";
"<table cellpadding='2' cellspacing='0' summary='0' style='width: 100%'><tr valign='top'>";
if (defined $c.userpic and $*comment_userpic_style != "off") {
var int w = $c.userpic.width;
var int h = $c.userpic.height;
# WARNING: this will later be done by the system (it'll be a
# constructional property), so don't copy this hack into your
# layout layers or you'll be messed up later.
if ($*comment_userpic_style == "small") {
$w = $w / 2;
$h = $h / 2;
}
print "<td style='width: 102px'><img src='$c.userpic.url' width='$w' height='$h' alt='[User Picture]' /></td>";
}
"<td style='width: 100%'><table style='width: 100%'><tr>";
### From, date, etc
"<td align='left' style='width: 50%'>";
print "<table>";
print "<tr><th align='right'>From:</th><td>$poster</td></tr>\n";
print "<tr><th align='right'>Date:</th><td style='white-space: nowrap'>";
print $c.time->date_format("long") + " - " + $c.time->time_format() + "</td></tr>";
if ($c.metadata{"poster_ip"}) { print "<tr><th align='right'>IP Address:</th><td>(" + $c.metadata{"poster_ip"} + ")</td></tr>"; }
"</table></td>";
### Gadgets
"<td align='right' style='width: 50%'>";
if ($this.multiform_on) {
" <label for='ljcomsel_$c.talkid'>$*text_multiform_check</label>";
$c->print_multiform_check();
}
$c->print_linkbar();
"</td></tr>";
### Subject / icon
print "<tr valign='top'><td style='width: 50%'>";
print (defined $c.subject_icon or $c.subject != "") ? "<h3>$c.subject_icon $c.subject</h3>" : "";
print "</td>";
### Permalink
print "<td style='width: 50%' align='right'><strong>(<a href='$c.permalink_url'>Link</a>)</strong></td></tr>";
print "</table></td></tr></table></div>";
print "<div style='margin-left: 5px'>$c.text</div>";
print "<div style='margin-top: 3px; font-size: smaller'>";
if ($c.frozen) {
print "(Replies frozen) ";
} else {
print "(<a href='$c.reply_url'>Reply to this</a>) ";
}
if ($c.parent_url != "") { "(<a href='$c.parent_url'>Parent</a>) "; }
if ($c.thread_url != "") { "(<a href='$c.thread_url'>Thread</a>) "; }
"</div>";
}
function ReplyPage::print_body()
{
"<table style='margin-left: 30px'>\n";
if (not $.entry.comments.enabled) {
print "<tr><th class='headerbar'>$*text_reply_nocomments_header</th></tr><tr><td>$*text_reply_nocomments</td></tr></table>";
return;
}
var string time = $.replyto.time->time_format();
var string userpic = "";
if (defined $.replyto.userpic)
{
$userpic = "<img src='$.replyto.userpic.url' />";
}
"<tr><th class='headerbar'>Time</td><th class='headerbar' style='width: 100%'>Text</th></tr>";
"<tr valign='top'>";
# Metabar
"<td style='background-color: $*metabar_bgcolor;' class='metabar'>";
# Time
"<em>$time</em><br />";
if ($userpic)
{
print $userpic + "<br />\n";
}
print defined $.replyto.poster ? $.replyto.poster->as_string() : "<i>(Anonymous)</i>";
# Permalink
"<p>[<a href='$.replyto.permalink_url'>$*text_permalink</a>]</p>";
"</td>";
# Text
"<td style='text-align:left'>";
if ($.replyto.subject != "") { "\n\n<span class='subject'>$.replyto.subject</span><br />"; }
print $.replyto.text; "\n\n";
"</td></tr>\n";
"<div align='center'><a href='$.entry.comments.read_url'>( Read Comments )</a></div>";
"<tr valign='top'><th class='headerbar' colspan='2'>Reply:</th></tr>";
"<tr valing='top'><td style='background-color: $*metabar_bgcolor'>&nbsp;</td><td>";
$.form->print();
"</td></tr></table>";
}
function print_theme_preview ()
{
"""
<table width='100%' style='background-color: $*body_bgcolor'>
<tr><td>
<table height='95%' cellpadding='5' width='100%' bgcolor='$*main_bgcolor'>
<tr><td>
<span style='font: normal bold 16pt $*font_base, $*font_fallback; color: $*page_title_color'>John Doe</span>
<ul><table>
<tr><td align="left" style="background-color: $*headerbar_bgcolor; color: $*headerbar_fgcolor" colspan="2">
<span style='font: normal bold 14pt $*font_base, $*font_fallback'>Friday, November 15th, 2002</span>
</td></tr>
<tr valign="top"><td style="text-align: right; background-color: $*metabar_bgcolor; white-space: nowrap">
<span style="font: italic normal 10pt $*font_base, $*font_fallback; color: $*metabar_fgcolor">
10:21 pm</span>
</td><td>
<p style="text-align:left">
<span style="font: italic bold 10pt $*font_base, $*font_fallback; color: $*page_subtitle_color">
Neque porro quisquam est&hellip;
</span><br />
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
</p><p style="text-align:right; font-size: 8pt">
(<a href="#" style="font-weight: bold; color: $*link_color">1 Comment</a> |
<a href="#" style="color: $*vlink_color">Comment on this</a>)
</p>
</td></tr>
</table></ul>
</td></tr>
</table>
</td></tr>
</table>
""";
}