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

606 lines
20 KiB
Plaintext
Raw Normal View History

2019-02-05 21:49:12 +00:00
# -*-s2-*-
layerinfo type = "layout";
layerinfo name = "Notepad";
layerinfo redist_uniq = "notepad/layout";
layerinfo previews = "notepad/notepad.jpg";
propgroup colors {
property Color body_bgcolor {
des = "Body background color";
}
property Color text_color {
des = "Text color";
}
property Color subject_color {
des = "Text color of subjects";
}
property Color link_color {
des = "Link color";
}
property Color vlink_color {
des = "Visited link color";
}
property Color alink_color {
des = "Active link color";
}
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 = "#8cd5fe";
set text_color = "#000000";
set subject_color = "#ff0000";
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";
propgroup presentation {
property bool show_entry_userpic {
des = "Show the userpic on the journal entries?";
}
property use page_recent_items;
property use page_friends_items;
property use use_shared_pic;
property use view_entry_disabled;
property string page_background_image {
des = "URL to an image to be used for the page background";
}
property bool show_entrynav_icons {
des = "Toggle to show the next, memory, edit, etc icons on the entry view page";
}
property use external_stylesheet;
}
set show_entry_userpic = false;
set view_entry_disabled = false;
set page_background_image = "";
set show_entrynav_icons = true;
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 string imguri {
noui = 1;
des = "URI to notepad images (no trailing slash)";
}
set imguri = "";
function prop_init()
{
if ($*imguri == "") { $*imguri = "$*SITEROOT/img/style/notepad"; }
}
function Page::lay_bottom_navigation() { }
function print_stylesheet ()
{
var string backgroundurl = clean_url($*page_background_image) != "" ? "background-image: url($*page_background_image);" : "";
"""body {
$backgroundurl
background-color: $*body_bgcolor;
}
td,body,p,div {
color: $*text_color;
text-decoration: none;
font-family: verdana,arial,helvetica;
font-size: 12px;
}
a:link {
color: $*link_color;
text-decoration: underline;
font-family: verdana,arial,helvetica;
font-size: 12px;
}
a:visited {
color: $*vlink_color;
text-decoration: underline;
font-family: verdana,arial,helvetica;
font-size:12px;
}
a:active {
color: $*alink_color;
text-decoration: underline;
font-family: verdana,arial,helvetica;
font-size: 12px;
}
a:hover {
color: $*alink_color;
text-decoration: underline;
font-family: verdana,arial,helvetica;
font-size:12px;
}""";
}
function Page::print()
{
var string title = $this->title();
"""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html>\n<head>\n""";
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 width="70%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30"><img src="$*imguri/spacer.gif" width="30" height="10" alt='' /></td>
<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
<a href="$.base_url/">Journal</a>
</td>
<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
<a href="$.base_url/friends">Friends</a>
</td>
<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
<a href="$.base_url/calendar">Archive</a>
</td>
<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
<a href="$.base_url/info">User Info</a>
</td>
<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
<a href="$*SITEROOT/tools/memories.bml?user=$.journal.username">memories</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="80" height="38" style="background-image: url($*imguri/top-left.jpg)">
<img src="$*imguri/spacer.gif" width="80" height="10" alt='' />
</td>
<td height="38" style="background-image: url($*imguri/middle.jpg)">
<img src="$*imguri/spacer.gif" width="10" height="10" alt='' />
</td>
<td width="10" height="38" style="background-image: url($*imguri/top-right.jpg)">
<img src="$*imguri/spacer.gif" width="10" height="10" alt='' />
</td>
</tr>
<tr>
<td width="80" height="38" style="background-image: url($*imguri/side-left.jpg)">
&nbsp;
</td>
<td width="100%" height="38" style="background-image: url($*imguri/middle.jpg)">
<h1>$title</h1>
<p align="center"><img src="$*imguri/hr.gif" width="345" height="23" alt='' /></p>
""";
$this->print_body();
"<p style='text-align: center; font-size: 115%'>"; $this->lay_bottom_navigation(); "</p>";
"""
</td>
<td width="8" height="38" style="background-image: url($*imguri/side-right.jpg)">
&nbsp;
</td>
</tr>
<tr>
<td width="80" height="12" style="background-image: url($*imguri/bottom-left.jpg)">
<img src="$*imguri/spacer.gif" width="70" height="12" alt='' />
</td>
<td height="12" style="background-image: url($*imguri/bottom-line.jpg)">
<img src="$*imguri/spacer.gif" width="10" height="12" alt='' />
</td>
<td width="8" height="12" style="background-image: url($*imguri/bottom-right.jpg)">
<img src="$*imguri/spacer.gif" width="8" height="12" alt='' />
</td>
</tr>
</table>
</body>
</html>
""";
}
function print_entry (Page p, Entry e, Color bgcolor, Color fgcolor, bool hide_text)
{
"<table border='0'><tr>";
if ($p.view == "friends" or
$*show_entry_userpic == true or
$e.journal.username != $e.poster.username)
{
var string userpic = defined $e.userpic ? "<img src='$e.userpic.url' /><br />" : "";
"<td valign='top' width='100' align='center'>";
if ($p.view == "friends" or $*show_entry_userpic == true) { print $userpic; }
if ($p.view == "friends") { "<strong><a href='"; print $e.journal->base_url(); "/'>$e.journal.username</a></strong>"; }
if ($e.journal.username != $e.poster.username)
{
print ($p.view == "friends" ?
"<br />[ <a href='" + $e.poster->base_url() + "/'>$e.poster.username</a> ]" :
"<strong><a href='" + $e.poster->base_url() + "/'>$e.poster.username</a></strong>");
}
"</td>";
}
"""<td valign="top" width='100%'><font size="+1">"""; print $e.time->date_format("med"); " "; print $e.time->time_format();
if ($e.subject) { " <span style='color: $*subject_color'>$e.subject</span>"; }
" $e.security_icon</font>";
if (not $hide_text)
{
print "<p>$e.text</p>";
if (size $e.metadata) {
"<p>";
foreach var string k ($e.metadata) {
var string key = $k;
var string val = $e.metadata{$k};
if ($k == "mood") {
$key = $*text_meta_mood;
} elseif ($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' align='absmiddle' alt='' /> $val";
}
"<strong>$key:</strong> $val<br />";
}
"</p>";
}
}
$e.comments->print();
if ($p.view == "entry" and $*show_entrynav_icons)
{
$e->print_linkbar();
}
"""</td></tr><tr><td colspan="2"></td></tr></table>""";
"""<p align="center"><img src="$*imguri/hr.gif" width="345" height="23" alt='' /></p>""";
}
function Page::print_entry (Entry e)
{
print_entry($this, $e, null Color, null Color, false);
}
function RecentPage::print_body ()
{
foreach var Entry e ($.entries) {
$this->print_entry($e);
}
}
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_bottom_navigation ()
{
var string nav = "";
if ($.nav.backward_url != "") {
$nav = """<a href="$.nav.backward_url">Back a Page</a>""";
}
if ($.nav.forward_url != "" and $.nav.backward_url != "") {
$nav = "$nav - ";
}
if ($.nav.forward_url != "") {
$nav = """$nav<a href="$.nav.forward_url">Forward a Page</a>""";
}
if ($nav != "") { print $nav; }
}
function CommentInfo::print()
{
if (not $.enabled) { return; }
if ($.count > 0 or $.screened)
{
$this->print_readlink(); " - ";
}
$this->print_postlink();
}
function YearPage::lay_bottom_navigation ()
{
$this->print_year_links();
}
function YearPage::print_year_links ()
{
if (size $.years <= 0) { return; }
foreach var YearYear y ($.years)
{
if ($y.displayed) {
"$y.year&nbsp;";
} else {
"<a href='$y.url'>$y.year</a>&nbsp;";
}
}
}
function YearPage::print_body ()
{
"<h2>$.year</h2>";
foreach var YearMonth m ($.months)
{
$this->print_month($m);
}
}
function YearPage::print_month(YearMonth m)
{
if (not $m.has_entries) { return; }
"<p align='center'><table border='1' cellpadding='4' width='80%'>";
# Month Header
"<tr align=center><th colspan='7'>"; print $m->month_format(); "</th></tr>";
# Weekdays
"<tr align='center'>";
foreach var int d (weekdays())
{
"<td>" + $*lang_dayname_short[$d] + "</td>\n";
}
"</tr>";
# Weeks
foreach var YearWeek w ($m.weeks)
{
$w->print();
}
"<tr align='center'><td colspan='7'>";
"<a href='$m.url'>$*text_view_month</a>";
"</td></tr></table></p>";
}
function YearWeek::print()
{
"<tr>";
if ($.pre_empty) { "<td colspan='$.pre_empty'>&nbsp;</td>"; }
foreach var YearDay d ($.days)
{
"<td valign='top'><b><font size='-1'>$d.day</font></b><div align='center'>";
if ($d.num_entries)
{
"<a href='$d.url'>$d.num_entries</a>";
} else {
"&nbsp;";
}
"</div></td>";
}
if ($.post_empty) { "<td colspan='$.post_empty'>&nbsp;</td>"; }
}
function DayPage::lay_bottom_navigation()
{
if (not $.has_entries) { "<img src='$*imguri/hr.gif' alt='' /><br />"; }
print "<a href='$.prev_url'>Back a Day</a> - <a href='$.next_url'>Forward a Day</a>";
}
function DayPage::print_body()
{
if (not $.has_entries) {
"<p>No journal entries for this day.</p>";
} else {
foreach var Entry e ($.entries) { $this->print_entry($e); }
}
}
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", ],
]);
print_entry($this, $.entry, null Color, null Color, $.viewing_thread);
if ($.entry.comments.enabled and $.comment_pages.total_subitems > 0)
{
$this->print_multiform_start();
print "<h2>Comments:</h2>";
if ($.comment_pages.total_subitems > 0) {
$.comment_pages->print();
$this->print_comments($.comments);
}
if ($this.multiform_on) {
"<h2>Mass Action:</h2>";
$this->print_multiform_actionline();
$this->print_multiform_end();
}
}
}
function EntryPage::print_comment (Comment c) {
var Color barlight = $*color_comment_bar->clone();
$barlight->lightness(($barlight->lightness() + 255) / 2);
var Color barc = $c.depth % 2 ? $*color_comment_bar : $barlight;
if ($c.screened) {
$barc = $*comment_bar_screened_bgcolor;
}
var string poster = defined $c.poster ? $c.poster->as_string() : "<i>(Anonymous)</i>";
"<a name='$c.anchor'></a><div id='cmtbar$c.talkid' style='background-color: $barc; 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='' /></td>";
}
"<td><table style='width: 100%'><tr>";
"<td align='left' style='width: 50%'>";
print "<table>";
print "<tr><th align='right'>$*text_comment_from</th><td>$poster</td></tr>\n";
print "<tr><th align='right'>$*text_comment_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'>$*text_comment_ipaddr</th><td>(" + $c.metadata{"poster_ip"} + ")</td></tr>"; }
"</table></td>";
print "<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>";
print "<tr valign='top'><td style='width: 50%'>";
if (defined $c.subject_icon or $c.subject != "") { "<h3>$c.subject_icon $c.subject</h3>\n"; }
print "</td>";
print "<td style='width:50%;' align='right'><strong>(<a href='$c.permalink_url'>$*text_permalink</a>)</strong></td></tr>\n";
print "</table></td></tr></table></div>";
print "<div style='margin-left: 5px'>$c.text</div>\n";
print "<div style='margin-top: 3px; font-size: smaller'>";
if ($c.frozen) {
print "($*text_comment_frozen) ";
} else {
print "(<a href='$c.reply_url'>$*text_comment_reply</a>) ";
}
if ($c.parent_url != "") { "(<a href='$c.parent_url'>$*text_comment_parent</a>) "; }
if ($c.thread_url != "") { "(<a href='$c.thread_url'>$*text_comment_thread</a>) "; }
"</div>\n";
}
function ReplyPage::print_body ()
{
if (not $.entry.comments.enabled)
{
print "<h2>$*text_reply_nocomments_header</h2><p>$*text_reply_nocomments</p>";
return;
}
"<table border='0'><tr>";
"<td valign='top' width='100' align='center'>";
print defined $.replyto.userpic ? "<img src='$.replyto.userpic.url' alt='' /><br />" : "";
print defined $.replyto.poster ? $.replyto.poster->as_string() : "<i>(Anonymous)</i>";
"</td>";
"""<td valign="top"><font size="+1">"""; print $.replyto.time->date_format("med"); " "; print $.replyto.time->time_format();
if ($.replyto.subject) { " <span style='color: $*subject_color'>$.replyto.subject</span>"; }
"</font>";
print "<p>$.replyto.text</p>";
"<a href='$.entry.comments.read_url'>Read Comments</a>";
"""</td></tr>""";
"""<tr><td colspan="2"><p align="center"><img src="$*imguri/hr.gif" width="345" height="23" alt='' /></p>""";
"</td></tr></table>\n";
print "<h2>Reply</h2>";
$.form->print();
}
function print_theme_preview ()
{
"""
<div style="color: $*text_color; background-color: $*body_bgcolor">
<table width="70%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30"><img src="$*imguri/spacer.gif" width="30" height="10" alt='' /></td>
<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
<a href="#" style="color: $*link_color">Tab</a>
</td>
<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
<a href="#" style="color: $*link_color">Tab</a>
</td>
<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
<a href="#" style="color: $*link_color">Tab</a>
</td>
<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
<a href="#" style="color: $*link_color">Tab</a>
</td>
<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
<a href="#" style="color: $*link_color">Tab</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="80" height="38" style="background-image: url($*imguri/top-left.jpg)">
<img src="$*imguri/spacer.gif" width="80" height="10" />
</td>
<td height="38" style="background-image: url($*imguri/middle.jpg)">
<img src="$*imguri/spacer.gif" width="10" height="10" />
</td>
<td width="10" height="38" style="background-image: url($*imguri/top-right.jpg)">
<img src="$*imguri/spacer.gif" width="10" height="10" />
</td>
</tr>
<tr>
<td width="80" height="38" style="background-image: url($*imguri/side-left.jpg)">
&nbsp;
</td>
<td width="100%" height="38" style="background-image: url($*imguri/middle.jpg)">
<h1>John Doe</h1>
<p align="center"><img src="$*imguri/hr.gif" width="345" height="23"></p>
<p align='center'>
<table border='0'><tr><td valign="top">
<h1>Dec. 16th, 2002 06:39 pm <span style='color: $*subject_color'>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet&hellip;</span></h1>
<p>
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><a href="#" style="color: $*vlink_color; font-weight: bold">2 Comments</a> | <a href="#" style="color: $*link_color">Leave a comment</a></p></td></tr>
<tr><td colspan="2"><p align="center"><img src="$*imguri/hr.gif" width="345" height="23"></p></td></tr>
</table>
</p>
</td>
<td width="8" height="38" style="background-image: url($*imguri/side-right.jpg)">
&nbsp;
</td>
</tr>
<tr>
<td width="80" height="12" style="background-image: url($*imguri/bottom-left.jpg)">
<img src="$*imguri/spacer.gif" width="70" height="12" alt='' />
</td>
<td height="12" style="background-image: url($*imguri/bottom-line.jpg)">
<img src="$*imguri/spacer.gif" width="10" height="12" alt='' />
</td>
<td width="8" height="12" style="background-image: url($*imguri/bottom-right.jpg)">
<img src="$*imguri/spacer.gif" width="8" height="12" alt='' />
</td>
</tr>
</table>
</div>
""";
}