layerinfo "type" = "layout";
layerinfo "name" = "Variable Flow";
layerinfo "author_name" = "Martin Atkins";
layerinfo "des" = "A really simple layout that you can customize like crazy!";
layerinfo "redist_uniq" = "variableflow/layout";
layerinfo "previews" = "variableflow/preview.jpg";
# Originally known as "Cleanly Shaven"
#
# This layout is full of customization options, and is designed
# with code overrides in mind.
# It also uses meaningful markup an CSS, for those who like that
# sort of thing. If you like, you can override the stylesheet
# completely in your user layer to drastically change the
# presentation.
propgroup colors {
property Color clr_margin {
des = "Page Background Color";
}
property Color clr_line {
des = "Color of line separating the entry area from the background";
requires = "opt_page_border";
}
property Color clr_back {
des = "Background Color of Main Content Area";
requires = "opt_page_background";
}
property Color clr_text {
des = "Main Text Color";
}
property Color clr_link {
des = "Color of normal links";
}
property Color clr_vlink {
des = "Color of visited links";
}
property Color clr_alink {
des = "Color of links once clicked on";
}
property Color clr_title {
des = "Journal Title Color";
}
set clr_margin = "#337CCD";
set clr_line = "#000000";
set clr_back = "#33ABCD";
set clr_text = "#000000";
set clr_link = "#261A72";
set clr_vlink = "#190F57";
set clr_alink = "#261A72";
set clr_title = "#190F57";
}
propgroup layout {
property string margin_left {
des = "Page Left Margin Size";
values = "0|None|5px|Tiny|5%|Small|10%|Medium|25%|Large|50%|Massive";
}
property string margin_right {
des = "Page Right Margin Size";
values = "0|None|5px|Tiny|5%|Small|10%|Medium|25%|Large|50%|Massive";
}
property string margin_top {
des = "Page Top Margin Size";
values = "0|None|5px|Tiny|5%|Small|10%|Medium|25%|Large|50%|Massive";
}
property string margin_bottom {
des = "Page Bottom Margin Size";
values = "0|None|5px|Tiny|5%|Small|10%|Medium|25%|Large|50%|Massive";
}
set margin_left = "25%";
set margin_right = "25%";
set margin_top = "5px";
set margin_bottom = "5px";
property string padding_left {
des = "Page Left Inner Padding Size";
values = "0|None|5px|Tiny|5%|Small|10%|Medium|25%|Large|50%|Massive";
}
property string padding_right {
des = "Page Right Inner Padding Size";
values = "0|None|5px|Tiny|5%|Small|10%|Medium|25%|Large|50%|Massive";
}
property string padding_top {
des = "Page Top Inner Padding Size";
values = "0|None|5px|Tiny|5%|Small|10%|Medium|25%|Large|50%|Massive";
}
property string padding_bottom {
des = "Page Bottom Inner Padding Size";
values = "0|None|5px|Tiny|5%|Small|10%|Medium|25%|Large|50%|Massive";
}
set padding_left = "5px";
set padding_right = "5px";
set padding_top = "5px";
set padding_bottom = "5px";
property string align_viewlinks {
des = "Position of links to other journal views";
values = "left|Left|right|Right|center|Center";
}
property string align_title {
des = "Position of journal title";
values = "left|Left|right|Right|center|Center";
}
property string align_talklinks {
des = "Position of comment links";
values = "left|Left|right|Right|center|Center";
}
set align_viewlinks = "right";
set align_title = "left";
set align_talklinks = "right";
# Some "advanced" settings which don't appear in the UI,
# either because they have non-obvious interactions with
# other properties or they have issues in certain browsers.
property string adv_page_max_width {
des = "Maximum Width of Content Area";
note = "If you set this, you should also set margin_left and/or margin_right to 'auto'. Internet Explorer 6 does not support this property.";
noui = 1;
}
property string adv_entry_max_width {
des = "Maximum Width of Entry Text";
note = "Internet Explorer 6 does not support this property, and will present entries full-width.";
noui = 1;
}
property bool adv_enable_print_styles {
des = "Enable Print Stylesheet";
note = "If you disable this, your journal views may be unsuitable for printing.";
noui = 1;
}
property bool adv_enable_projection_styles {
des = "Enable Projection Stylesheet";
note = "With this enabled, browsers which support projection stylesheets will see a different stylesheet.";
noui = 1;
}
property bool adv_horrible_userpic_markup {
des = "Enable horrible userpic markup";
note = "With this enabled, the layout will use a table hack to present userpics. With it disabled, the userpics will just be shown raw with class userpic. You'll have to add your own stylesheet rules for them.";
# See the comment within Page::print_entry for more details
noui = 1;
}
set adv_page_max_width = "";
set adv_entry_max_width = "";
set adv_enable_print_styles = true;
set adv_enable_projection_styles = true;
set adv_horrible_userpic_markup = true;
}
propgroup presentation {
property use font_base;
property use font_fallback;
property string font_size {
des = "Size of text";
values = "0.75em|Tiny|1em|Normal|1.1em|Large";
}
set font_size = "0.75em";
property bool opt_page_border {
des = "Draw Line Around Content Box";
note = "With this disabled, the line color option has no effect";
}
property bool opt_page_background {
des = "Content Box has Background";
note = "With this disabled, the Content Box Background Color and Image options have no effect and the page background will show through instead.";
}
set opt_page_border = true;
set opt_page_background = true;
property string url_background_img_page {
des = "Page Background Image URL";
note = "Leave this blank if you do not wish to use a background image.";
palimg_transform = "tint;*clr_back"; # Doesn't do anything right now
}
set url_background_img_page = "";
property string background_properties_page {
des = "Page Background Image Display Options";
values = "scroll|Scrolling, Tiled|scroll no-repeat|Scrolling, No repeat|scroll repeat-x|Scrolling, tile horizontally|scroll repeat-y|Scrolling, tile vertically|fixed|Fixed, Tiled|fixed no-repeat|Fixed, No repeat|fixed repeat-x|Fixed, tile horizontally|fixed repeat-y|Fixed, tile vertically";
requires = "url_background_img_page";
}
set background_properties_page = "scroll";
property string background_position_page {
des = "Page Background Position";
values = "center|Centered|center left|Centered Vertically, Left|center right|Centered Vertically, Right|top center|Top, Centered Horizontally|top left|Top, Left|top right|Top, Right|bottom center|Bottom, Centered Horizontally|bottom left|Bottom, Left|bottom right|Bottom, Right";
requires = "url_background_img_page";
}
set background_position_page = "top left";
property string url_background_img_box {
des = "Content Box Background Image URL";
note = "Leave this blank if you do not wish to use a background image.";
palimg_transform = "tint;*clr_back"; # Doesn't do anything right now
requires = "opt_page_background";
}
set url_background_img_box = "";
property string background_properties_box {
des = "Content Box Background Image Display Options";
values = "scroll|Scrolling, Tiled|scroll no-repeat|Scrolling, No repeat|scroll repeat-x|Scrolling, tile horizontally|scroll repeat-y|Scrolling, tile vertically|fixed|Fixed, Tiled|fixed no-repeat|Fixed, No repeat|fixed repeat-x|Fixed, tile horizontally|fixed repeat-y|Fixed, tile vertically";
requires = "opt_page_background,url_background_img_box";
}
set background_properties_box = "scroll";
property string background_position_box {
des = "Content Box Background Position";
values = "center|Centered|center left|Centered Vertically, Left|center right|Centered Vertically, Right|top center|Top, Centered Horizontally|top left|Top, Left|top right|Top, Right|bottom center|Bottom, Centered Horizontally|bottom left|Bottom, Left|bottom right|Bottom, Right";
requires = "opt_page_background,url_background_img_box";
}
set background_position_box = "top left";
property bool opt_entry_userpics {
des = "Enable Userpics On Entries";
note = "With this disabled, no entries will show userpics, even on the friends page.";
}
set opt_entry_userpics = true;
property bool opt_own_userpics {
des = "Show Own Userpics";
note = "Enable this to show userpics on your own entries. You must also have the previous option enabled. This option has no effect on community journals.";
requires = "opt_entry_userpics";
}
set opt_own_userpics = false;
# This layout has quite a big stylesheet so let's avoid
# transferring it over and over.
set external_stylesheet = true;
# No good support for EntryPage/ReplyPage yet
set view_entry_disabled = true;
}
propgroup options {
# Some standard constructional properties
property use page_recent_items;
property use page_friends_items;
property use page_year_sortorder;
property use page_day_sortorder;
# Tell the system this layout has no linklist support
# If you add linklist support in a user layer, you should also
# set this property to true in your layer.
set linklist_support = false;
}
propgroup text {
property use text_post_comment;
property use text_read_comments;
property use text_post_comment_friends;
property use text_read_comments_friends;
}
function makefontspec() : string
"Forms a CSS 'font-family' value based on the font-related properties."
{
var string fontspec;
if ($*font_base != "") {
$fontspec="\""+$*font_base+"\"";
if ($*font_fallback != "") {
$fontspec=$fontspec+",";
}
}
$fontspec=$fontspec+$*font_fallback;
return $fontspec;
}
function Page::lay_print_viewlinks()
"If you override this, be sure to still use foreach or your style won't support any future views."
{
# Output a list of textual links in a particular order
var bool first = true;
"
\n";
foreach var string vl ($.views_order) {
if ($vl == $.view) {
print "
""";
}
function lang_skipped_back(RecentNav nav) : string
"Return short text saying how many entries have been skipped back. i18n layers should override this."
{
return "Skipped Back $nav.skip";
}
## The properties for these links are currently broken
## in core - they were never updated to work with lang_map_plural.
# So, FIXME: When core does them right, remove the hardcoded English
function RecentPage::lay_print_skiplinks() {
if ($.nav.backward_url != "" or $.nav.forward_url != "") {
println """
";
}
function metadata_title(string which) : string
"Until core provides a function for this, i18n layers should override this."
{
if ($which == "music") {
return "Current Music";
}
elseif ($which == "mood") {
return "Current Mood";
}
else {
return $which;
}
}
# Since there's currently no trusted print_entry_text function
# in core, I have to do this here. Later, when something similar
# is added to core, this can become a wrapper and be deprecated.
function Page::lay_print_entry_text(Entry e) [fixed]
"Don't override this. All it does is print the entry text."
{
print $e.text;
}
# Since the metadata keys have to be hardcoded (bad core design)
# let's separate this out so people can override print_entry
# and still get any new metadata added later.
function Page::lay_print_entry_metadata(Entry e)
"Overriding this is strongly discouraged, since if any new entry metadata is added in the future your overridden version will not support it."
{
if (size $e.metadata > 0) {
# This is horrible and unextensible. We have core to thank.
# C'est la vie.
"
\n";
}
}
function Page::print_entry(Entry e) {
"""
\n""";
var bool altposter = $e.poster.username != $e.journal.username;
var bool showpic = $*opt_entry_userpics and (($.view == "friends" or $altposter) or $*opt_own_userpics);
# By default, this layout uses an ugly table hack to present the userpic
# alongside the entry. This is because I've been bitten on many previous
# occasions by a bug with floats in IE causing text to vanish in certain
# cases. You can set the property adv_horrible_userpic_markup to false
# in a user layer to disable this behavior, but there are no CSS rules
# in the stock stylesheet to handle it, so you'll have to supply your
# own.
if ($showpic) {
if ($*adv_horrible_userpic_markup) {
"""
""";
}
if (defined $e.userpic) {
println """""";
} else {
if ($*adv_horrible_userpic_markup) {
print " ";
}
}
if ($*adv_horrible_userpic_markup) {
"
\n"; $this->lay_print_entry_text($e);
$this->lay_print_entry_metadata($e);
if ($showpic and $*adv_horrible_userpic_markup) {
"
";
}
$e.comments->print();
"
";
}
function CommentInfo::print {
if (not $.enabled) { return; }
"""
""";
if ($.count > 0) {
print """
""";
$this->print_readlink();
println "
";
}
print """
""";
$this->print_postlink();
print "
";
"
";
}
function EntryPage::print_comment (Comment c) {
var Color barlight = $*color_comment_bar->clone();
$barlight->lightness(($barlight->lightness() + 255) / 2);
var string poster = defined $c.poster ? $c.poster->as_string() : "(Anonymous)";
"
";
"
";
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.
$w = $w / 2;
$h = $h / 2;
print "
";
}
"
";
if (defined $c.subject_icon or $c.subject != "") { "