?

Log in

No account? Create an account
[theme] - [flexisquares] - [all kinds of spiffy things] - S2 Layers [entries|archive|friends|userinfo]
S2 Layers

[ website | advanced customization ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Links
[Links:| how to post tags page ]
[affiliated communities| fblayers ]

[theme] - [flexisquares] - [all kinds of spiffy things] [Aug. 25th, 2005|09:08 am]
S2 Layers

s2layers

[kunzite1]
[Tags|, , , , , , , , , , , , ]

an advancement upon this entry.
oh... and one entry can never have too many tags. ;)
set tags_aware         = true;                # disable auto-magic tags display in entries
set text_meta_location = "Current Location:"; # add colon
set text_meta_mood     = "Current Mood:";     # add colon
set text_meta_music    = "Current Music:";    # add colon

# create class with text vars and helper functions
class MyUtils {
  # text labels for nav and summary sidebar boxes
  var string text_nav_recent;
  var string text_nav_friends;
  var string text_nav_year;
  var string text_nav_month;
  var string text_nav_day;
  var string text_nav_entry;
  var string text_summary_recent;
  var string text_summary_friends;
  var string text_summary_year;
  var string text_summary_month;
  var string text_summary_day;
  var string text_summary_entry;
  var string text_meta_tags_header;
  var string text_meta_tags_joiner;
  var string text_meta_tags_sep;
  var bool   meta_loc_after_mood;
  var bool   meta_loc_vanilla;

  # count number of comments in a thread
  function num_comments_in_thread(Comment[] cs) : int;

  # set text vars
  function setup();
}

# count number of comments in a thread
function MyUtils::num_comments_in_thread(Comment[] cs) : int {
  var int count = size $cs;
  foreach var Comment c ($cs) {
    if(size $c.replies) {
      $count = $count + $this->num_comments_in_thread($c.replies);
    }
  }
  return $count;
}

# set text vars
function MyUtils::setup() {
  $.text_nav_recent       = "Recent Nav";
  $.text_nav_friends      = "Friends Nav";
  $.text_nav_year         = "Year Nav";
  $.text_nav_month        = "Month Nav";
  $.text_nav_day          = "Day Nav";
  $.text_nav_entry        = "Entry Nav";
  $.text_summary_recent   = "Recent Summary";
  $.text_summary_friends  = "Friends Summary";
  $.text_summary_year     = "Year Summary";
  $.text_summary_month    = "Month Summary";
  $.text_summary_day      = "Day Summary";
  $.text_summary_entry    = "Entry Summary";
  $.text_meta_tags_header = "Current Tags";
  $.text_meta_tags_joiner = ":";
  $.text_meta_tags_sep    = ", ";
  $.meta_loc_after_mood   = false;
  $.meta_loc_vanilla      = false;
}

function print_sidebar_box(string title, string body) {
  # disable silly unordered list-ness of sidebar boxes
  print safe """
  <div class="sbarheader">
    <div class="sbartitle">$title</div>
  </div>
  <div class="sbarbody">$body</div>""";
}

function Page::print_custom_head() {
# add css to now non-silly sidebar boxes
"""
<style type="text/css">
.sbartitle {
  text-align:       left;
  padding:          5px 0px 5px 5px;
  border:           1px solid $*border_color;
  background-color: $*sidebar_header_bgcolor; 
  margin-bottom:    10px;
  margin-top:       10px;
}
.summaryitem {
  border-bottom: 1px $*border_color dashed;
  padding: 5px  0   2px  0;
  margin:  0   15px 0   15px;
}
</style>
""";
}

# convert linklist to something that will fit non-silly sidebar boxes
function print_sidebar_linklist() {
  var Page   p      = get_page();
  var string return = "";
  if (size $p.linklist <= 0) {
    return;
  } elseif (not $*linklist_support) {
    return;
  }
   
  var bool section_open = false;

  $return = "<ul>\n";

  foreach var UserLink l ($p.linklist) {
    if ($l.title) {
      if ($l.is_heading) {
        if ($section_open) {
          $return = $return + "</ul>\n";
        }
        $return = $return + """<li>$l.title</li>\n<ul>""";
        $section_open = true;
      } else {
        $return = $return + """<li><a href="$l.url">$l.title</a></li>\n""";
      }
    }
  }
  $return = $return + "</ul>";
  print_sidebar_box($*text_sidebar_links, $return);
}

# convert calendar to something that will fit non-silly sidebar boxes
function print_sidebar_calendar() {
  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 = """<table class="calendar" align="center">\n""";
    var YearWeek[] theWeeks = $m.weeks;
    foreach var YearWeek w ($theWeeks) {
      $calendar = $calendar + "  <tr>\n";
      var YearDay[] theDays = $w.days;
      var int pre = $w.pre_empty;
      if($pre > 0) {
        $calendar = $calendar + """    <td colspan="$pre" valign="top">&nbsp;</td>""";
      }
      foreach var YearDay d ($theDays) {
        if ($d.num_entries) {
          $calendar = $calendar + """    <td valign="top" class="sbarcalendarposts"><a href="$d.url">$d.day</a></td>""";
        } else {
          $calendar = $calendar + """    <td valign="top" class="sbarcalendar">$d.day</td>""";
        }
      }
      $calendar = $calendar + "  </tr>\n";
    }
    $calendar = $calendar + "</table>";
  }
  if ($calendar != "") { 
    print_sidebar_box($month, $calendar);
  }
}

# reorder sidebar and insert custom one
function print_sidebar() {
  var string header  = "";
  var string content = "";
  var Page   p       = get_page();

  # first sidebar box
  sidebar_order($*sidebar_order_1);

  # nav/summary sidebar box
  $p->lay_print_footer();

  # second sidebar box
  sidebar_order($*sidebar_order_2);

  # third sidebar box
  sidebar_order($*sidebar_order_3);

  # fourth sidebar box
  sidebar_order($*sidebar_order_4);

  # custom sidebar box
  $header  = "Frank";
  $content = """<a href="http://www.livejournal.com/"><img src="http://stat.livejournal.com/img/goat-normal.gif" alt="Frank" title="Frank" border="0" /></a>""";
  print_sidebar_box($header, $content);
}

# hijack this function to create navigation and summary sidebar boxes specific to RecentPage and FriendsPage
# use properties for skiplinks instead of hard-coding earlier/later
function RecentPage::lay_print_footer() {
  # set up text vars
  var MyUtils mu = new MyUtils;
  $mu->setup();

  # navigation
  var string back      = "";
  var string forward   = "";
  var string navheader = $.view == "recent" ? $mu.text_nav_recent : $mu.text_nav_friends;

  if ($.nav.forward_url != "" or $.nav.backward_url != "") {
    if ($.nav.backward_url != "") {
      $back = """<a href="$.nav.backward_url">""" + get_plural_phrase($.nav.backward_count, "text_skiplinks_back") + "</a>";
    }
    if ($back != "") {
      $back = $back + "<br />";
    }
    if ($.nav.forward_url != "") {
      $forward = """<a href="$.nav.forward_url">""" + get_plural_phrase($.nav.forward_count, "text_skiplinks_forward") + "</a>";
    }
  }
  if($back != "" or $forward != "") {
    print_sidebar_box($navheader, "$back$forward");
  }

  # summary
  var string sumheader = $.view == "recent" ? $mu.text_summary_recent : $mu.text_summary_friends;
  var string return    = "";
  var string datetime  = "";
  var string id        = "";
  var string journal   = "";
  var string poster    = "";
  var string subject   = "";

  foreach var Entry e ($.entries) {
    $datetime = $e.time->date_format() + " " + $e.time->time_format();
    $id       = "$e.journal.username$e.itemid";
    $journal  = $e.journal->as_string();
    $poster   = $e.poster->as_string();
    $subject  = $e.subject != "" ? $e->plain_subject() : $*text_nosubject;
    $return   = $return + """<div class="summaryitem">""";
    if ($e.security) {
      $return = $return + "$e.security_icon";
    }
    if($.view == "friends") {
      $return = $return + $poster;
      if($e.poster.username != $e.journal.username) {
        $return = $return + " posting in $journal";
      }
      $return = $return + " &mdash;";
    }
    $return = $return + """ <a href="#$id" title="$datetime">$subject</a>""";
    $return = $return + """ [+<a href="$e.permalink_url">$e.comments.count</a>]</div>\n""";
  }
  print_sidebar_box($sumheader, $return);
}

# add id to months
function YearPage::print_month(YearMonth m) {
  if (not $m.has_entries) {
    return; 
  }
  """
  <table class="yeartable" align="center" id="calendar$m.month">
    <tr>
      <td colspan="4" class="yearmonth" align="left">""";
  print $m->month_format();
  """
      </td>
      <td colspan="3" class="yearmonth" align="right"><a href="$m.url">$*text_view_month</a></td>
    </tr>
    <tr>""";
  foreach var int d (weekdays()) {
    """
      <td width="50px" class="yearday">"""+$*lang_dayname_short[$d]+"</td>";
  }
  "
    </tr>\n";
  foreach var YearWeek w ($m.weeks) {
    $w->print();
  }
  "
  </table><br />
  <br />
  <br />";
}

# hijack this function to create navigation sidebar boxe specific to YearPage
function YearPage::lay_print_footer() {
# set up text vars
var MyUtils mu = new MyUtils;
$mu->setup();

# navigation
var string navheader = $mu.text_nav_year;
var int index        = 0;
var int currentYearIndex;
var string prev      = "";
var int    prev_year;
var string fore      = "";
var int    fore_year;
var string prevText = "";
var string foreText = "";
foreach var YearYear y ($.years) {
  if ($y.displayed) {
    $currentYearIndex = $index;
  }
  $index = $index + 1;
}
if($currentYearIndex > 0){
  $prev     = $.journal->base_url() + "/$.years[$currentYearIndex - 1].year";
  $prevText = $.years[$currentYearIndex - 1].year + "";
}
if($currentYearIndex < (size $.years) - 1){
  $fore     = $.journal->base_url() + "/$.years[$currentYearIndex + 1].year";
  $foreText = $.years[$currentYearIndex + 1].year + "";
}
  var string{}  nav;

  if($prev != "") {
    $prev = """<a href="$prev">$prevText</a>""";
  }

  if($fore != "") {
    $prev = $prev + "<br />";
    $fore = """<a href="$fore">$foreText</a>""";
  }

  if($prev != "" or $fore != "") {
    print_sidebar_box($navheader, "$prev$fore");
  }

  # summary
  var string sumheader = $mu.text_summary_year;
  var string return    = "";
  var string id        = "";
  var int    count     = 1;
  foreach var YearMonth m ($.months) {
    if($m.has_entries) {
      $id     = "calendar" + $count + "";
      $return = $return + """<div class="summaryitem"><a href="#$id">""" + $*lang_monthname_long[$count] + " $m.year</a></div>\n";
    }
    $count++;
  }
  if($return != "") {
    print_sidebar_box($sumheader, $return);
  }
}

# add id to days
function MonthPage::print_body {
  "
  <form method='post' action='$.redir.url'>
    <center><br />";
    $.redir->print_hiddens();
    if ($.prev_url != "") { 
      "
      [<a href='$.prev_url'>&lt;&lt;&lt;</a>]\n"; 
    }
    if (size $.months > 1) {
      "
      <select name='redir_key'>\n";
      foreach var MonthEntryInfo mei ($.months) {
        var string sel;
        if ($mei.date.year == $.date.year and $mei.date.month == $.date.month) {
          $sel = " selected='selected'";
        }
        "
        <option value='$mei.redir_key'$sel>" + $mei.date->date_format($*lang_fmt_month_long) + "</option>";
      }
      "
      </select>
      <input type='submit' value='View' />";
    }
    if ($.next_url != "") {
      "
      [<a href='$.next_url'>&gt;&gt;&gt;</a>]";
    }
    """
    </center>
  </form><br />
  <br />
  <div class="subcontent">
    <div class="entry">
      <dl>""";
    foreach var MonthDay d ($.days) {
      if ($d.has_entries) {
        "
        <dt id=\"day$d.day\">
          <a href=\"$d.url\">
            <b>";
        print lang_ordinal($d.day);
        "
            </b>
          </a>
        </dt>
        <dd>";
        $d->print_subjectlist();
        "
        </dd>";
      }
    }
    "
      </dl>
    </div>
  </div>";
}

# hijack this function to create navigation sidebar boxe specific to MonthPage
function MonthPage::lay_print_footer() {
  # set up text vars
  var MyUtils mu = new MyUtils;
  $mu->setup();

  # navigation
  var string    navheader  = $mu.text_nav_month;
  var string    prev       = $.prev_url;
  var string    fore       = $.next_url;
  var string    prevText   = $.prev_date->date_format("%%month%% %%yyyy%%");
  var string    foreText   = $.next_date->date_format("%%month%% %%yyyy%%");

  if($prev != "") {
    $prev = """<a href="$prev">$prevText</a>""";
  }

  if($fore != "") {
    $prev = $prev + "<br />";
    $fore = """<a href="$fore">$foreText</a>""";
  }

  if($prev != "" or $fore != "") {
    print_sidebar_box($navheader, "$prev$fore");
  }

  # summary
  var string sumheader = $mu.text_summary_month;
  var string return    = "";
  var string id        = "";
  var int    count     = 1;
  foreach var MonthDay d ($.days) {
    if($d.has_entries) {
      $id     = "day" + $count;
      $return = $return + """<div class="summaryitem"><a href="#$id">""" + lang_ordinal($d.day) + """</a> [+<a href="$d.url">""" + size($d.entries) + "</a>]</div>\n";
    }
    $count++;
  }
  if($return != "") {
    print_sidebar_box($sumheader, $return);
  }
}

# hijack this function to create navigation and summary sidebar boxes specific to DayPage
function DayPage::lay_print_footer() {
  # set up text vars
  var MyUtils mu = new MyUtils;
  $mu->setup();

  # navigation
  var string    navheader  = $mu.text_nav_day;
  var string    prev       = $.prev_url;
  var string    fore       = $.next_url;
  var string    prevText   = $*text_day_prev != "" ? $*text_day_prev : $.prev_date->date_format("long_day");
  var string    foreText   = $*text_day_next != "" ? $*text_day_next : $.next_date->date_format("long_day");

  if($prev != "") {
    $prev = """<a href="$prev">$prevText</a>""";
  }

  if($fore != "") {
    $prev = $prev + "<br />";
    $fore = """<a href="$fore">$foreText</a>""";
  }

  if($prev != "" or $fore != "") {
    print_sidebar_box($navheader, "$prev$fore");
  }

  # summary
  var string sumheader = $mu.text_summary_day;
  var string return    = "";
  var string datetime  = "";
  var string id        = "";
  var string journal   = "";
  var string poster    = "";
  var string subject   = "";

  foreach var Entry e ($.entries) {
    $datetime = $e.time->date_format() + " " + $e.time->time_format();
    $id       = "$e.journal.username$e.itemid";
    $journal  = $e.journal->as_string();
    $poster   = $e.poster->as_string();
    $subject  = $e.subject != "" ? $e->plain_subject() : $*text_nosubject;
    $return   = $return + """<div class="summaryitem">""";
    if ($e.security) {
      $return = $return + "$e.security_icon";
    }
    if($.view == "friends") {
      $return = $return + $poster;
      if($e.poster.username != $e.journal.username) {
        $return = $return + " posting in $journal";
      }
      $return = $return + " &mdash;";
    }
    $return = $return + """ <a href="#$id" title="$datetime">$subject</a>""";
    $return = $return + """ [+<a href="$e.permalink_url">$e.comments.count</a>]</div>\n""";
  }
  print_sidebar_box($sumheader, $return);
}

# hijack this function to create navigation and summary sidebar boxes specific to EntryPage
function EntryPage::lay_print_footer() {
  # set up text vars
  var MyUtils mu = new MyUtils;
  $mu->setup();

  # navigation
  var string    navheader  = $mu.text_nav_entry;
  var Link      nav_prev   = $.entry->get_link("nav_prev");
  var Link      nav_next   = $.entry->get_link("nav_next");
  var string    prev       = $nav_prev.url;
  var string    fore       = $nav_next.url;
  var string    prevText   = $nav_prev.caption;
  var string    foreText   = $nav_next.caption;

  if($prev != "") {
    $prev = """<a href="$prev">$prevText</a>""";
  }

  if($fore != "") {
    $prev = $prev + "<br />";
    $fore = """<a href="$fore">$foreText</a>""";
  }

  if($prev != "" or $fore != "") {
    print_sidebar_box($navheader, "$prev$fore");
  }

  # summary
  var string  sumheader = $mu.text_summary_entry;
  var string  summary   = "";
  var int     replies   = 0;
  var string  subject   = "";
  var string  poster    = "";
  foreach var Comment c ($.comments) {
    $replies = $mu->num_comments_in_thread($c.replies);
    $subject = $c.subject != "" ? $c.subject : """<i class="nosubject">$*text_nosubject</i>""";
    $poster  = defined $c.poster ? $c.poster->as_string() : $*text_poster_anonymous;
    $summary = $summary + """<div class="summaryitem">$poster <a href="#$c.dom_id">$subject</a> [+<a href="$c.thread_url">$replies</a>]</div>\n""";
  }
  if($summary != "") {
    print_sidebar_box($sumheader, $summary);
  }
}

# fix tags page view title
function TagsPage::view_title() : string  {
  return "Tags Page";
}

# more data-rich tags page
function TagsPage::print_body() {
  var string   header         = "Visible Tags";
  var string   content        = "";
  var string[] security_order = ["public"];
  var int security_index = 1;
  if(viewer_is_owner()) {
    $security_order[$security_index++] = "private";
    $security_order[$security_index++] = "group";
  }
  if(viewer_logged_in()) {
    $security_order[$security_index++] = "friends";
  }
  var int spacer_colspan = 7;
  var string{} security_labels = {
                                  "public"  => """<img src="http://pics.livejournal.com/kunzite1/pic/000f5p4c" />""",
                                  "private" => """<img src="$*IMGDIR/icon_private.gif" />""",
                                  "friends" => """<img src="$*IMGDIR/icon_protected.gif" />""",
                                  "group"   => """<img src="http://pics.livejournal.com/kunzite1/pic/00074yeb" />"""
                                 };
  var string{} security_headers = {
                                   "public"  => "Public",
                                   "private" => "Private",
                                   "friends" => "Protected",
                                   "group"   => "Group"
                                  };

  if($header != "") {
    $content = $content + "<h1>$header</h1>\n";
  }
  $content = $content + """<table border="1">\n <tr>\n    <th align="center" colspan="2" class="thTop" nowrap="nowrap">&nbsp;Tag&nbsp;</th>\n""" + (viewer_is_owner() ? """<th align="center" class="thTop" nowrap="nowrap">&nbsp;Total&nbsp;</th>\n""" : "");
  foreach var string security($security_order) {
    $content = $content + """    <th align="center" class="thTop" nowrap="nowrap">&nbsp;$security_headers{$security}&nbsp;</th>\n""";
  }
  $content = $content + "  </tr>\n";
  foreach var TagDetail td ($.tags) {
    var int security_count = 0;
    var int group_count    = $td.use_count;
    var string uses = (viewer_is_owner() ? ("""    <td style="font-family: courier; text-align: right;">$td.use_count</td>\n""") : "");
    foreach var string security($security_order) {
      $security_count = $security != "group" ? $td.security_counts{$security} : $group_count;
      $uses           = $uses + """    <td style="font-family: courier; text-align: right;">$security_count</td>\n""";
      $group_count    = $group_count - $security_count;
    }
    $content = $content + """  <tr>\n    <td>$security_labels{$td.visibility}</td><td><a href="$td.url">$td.name</a></td>\n$uses  </tr>\n""";
  }
  $content = $content + "</table>";
  print $content;
}

function Page::print() {
  var string title = $this->title();
  var string page_width = " style=\"width: 620px;\"";
    	
  """
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>$title</title>""";
  if ($*external_stylesheet and $*external_stylesheet_url !="")   	{
    println """<link rel="stylesheet" type="text/css"  media='screen' href="$*external_stylesheet_url" />""";
  } elseif ($*external_stylesheet) {
    println """<link rel='stylesheet' type='text/css' media='screen' href='$.stylesheet_url' />""";
  } else {
    println """<style type="text/css">"""; print_stylesheet(); "</style>";
  }
  $this->print_head();
  """
    </head>
    <body>
      <a name="top"></a>
      <div class="headerimage"></div>
      <div id="content"$page_width>
  """;
  $this->lay_print_header();
  if ($*show_sidebar) {
    """
       <div id="sidebar">""";
  print_sidebar();
  """
         <div class="clear"> </div>
       </div>
  """;
  }
  """
       <div id="maincontent">""";
  $this->print_body();	
  "
       </div>";
  "
      </div>
    </body>
  </html>";
}

function Entry::print_metadata() {
  var MyUtils mu = new MyUtils;
  var string tags_header         = $mu.text_meta_tags_header;
  var string tags_joiner         = $mu.text_meta_tags_joiner;
  var string tags_sep            = $mu.text_meta_tags_sep;
  var bool   show_edit_tags_link = false;          # set to true if you want edit tags link as tags header

  var string currents_open       = """<div class="clear">&nbsp;</div>
            <div class="clear">&nbsp;</div>
	    <div class="currents">"""; # html for opening of currents container
  var string currents_close      = """</div>"""; # html for closing of currents container

  var bool   loc_after_mood      = $mu.meta_loc_after_mood;
  var bool   vanilla_loc         = $mu.meta_loc_vanilla;

  # if you need data specific to the meta to be in these strings you'll have to set those individually down further
  # one example is provided with meta_label_open
  var string meta_label_open     = "";               # html for opening of metadata label
  var string meta_label_close    = """</strong> """; # html for closing of metadata label
  var string meta_val_open       = "";               # html for opening of metadata value
  var string meta_val_close      = """</div>""";     # html for closing of metadata value

  var Link   edit_tags           = $this->get_link("edit_tags"); # helper var to see if remote user can edit tags

  if ((size $.metadata > 0) or ((size $.tags > 0) and ($*tags_aware))){
    if($.metadata{"mood"} == "" and $loc_after_mood) {
      # if we're printing loc after mood but we have no mood, set loc_after_mood to false
      $loc_after_mood = false;
    }
    var string currents = "";             # make var for printing
    $currents           = $currents_open; # add opening of currents container

    foreach var string k ($.metadata){  # step thru metadata
      var string text = $k;             # set text to key
      var string val  = $.metadata{$k}; # get val
      if ($k == "mood"){                # if mood, set text to mood property
        $text = $*text_meta_mood;
        if (defined $.mood_icon){       # if we have a mood icon, add it
          var Image i = $.mood_icon;
          $val        = """<img src="$i.url" width="$i.width" height="$i.height" align="middle" alt="$val" title="$val" /> $val""";
        }
      } 
      elseif ($k == "music") {          # if music, set text to music property
        $text = $*text_meta_music;
      } elseif ($k == "location") {     # if location, set text to loc variable
        $text = $*text_meta_location;
        if($vanilla_loc) {              # if vanilla loc, striphtml() it
          $val = striphtml($val);
        }
      }
      if(not ($k == "location" and $loc_after_mood)) {
        # if we're doing loc right now and printing loc after mood, skip it
        # if we're doing loc right now and we're not printing loc after mood, print it now
        # if we're not doing loc right now, print this piece of meta

        # in this layout, each piece of meta gets its own class
        $meta_label_open  = """<div class="current$k"><strong>""";

        # add the meta
        $currents = $currents + """$meta_label_open$text$meta_label_close$meta_val_open$val$meta_val_close""";
      }

      if($k == "mood" and $loc_after_mood) {
        # if we just now did the mood and we're printing loc after mood, print the loc
        $k    = "location";           # set meta key to "location"
        $text = $*text_meta_location; # set text to loc variable
        $val  = $.metadata{$k};       # get val

        # if we have a loc, do stuff
        if($val != "") {

          # if vanilla loc, striphtml() it
          if($vanilla_loc) {
            $val = striphtml($val);
          }

          # in this layout, each piece of meta gets its own class
          $meta_label_open  = """<div class="current$k"><strong>""";

          # add the meta
          $currents         = $currents + """$meta_label_open$text$meta_label_close$meta_val_open$val$meta_val_close""";
        }
      }
    }
    if ((size $.tags > 0) and $*tags_aware) {
      var string k      = "tags"; # set key to "tags"

      # in this layout, each piece of meta gets its own class
      $meta_label_open  = """<div class="current$k"><strong>""";

      var int tcount = 0; # set counter for tags
      if($edit_tags.url != "" and $show_edit_tags_link) { # if remote user can edit tags, let's give them a link
        $tags_header = """<a href="$edit_tags.url">$tags_header</a>""";
      }

      # add text, open val container
      $currents = $currents + """$meta_label_open$tags_header$tags_joiner$meta_label_close$meta_val_open""";

      # build tag list
      foreach var Tag t ($.tags) {
        $currents = $currents + """<a rel="tag" href="$t.url">$t.name</a>""";
        $tcount++;

        # if we haven't hit the last tag, add a separator
        if ($tcount != size $.tags) { $currents = $currents + $tags_sep; }
      }

      # close val container
      $currents = $currents + $meta_val_close;
    }

    # close currents container
    $currents = $currents + $currents_close;

    # print currents
    println "$currents";
  }
}

# fix userpic and posterinfo issues
# link userpic to allpics page
# alter printing of comment links
# add linkbar next to comments
# use variable for link seperator
function print_entry(Page p, Entry e, Color bgcolor, Color fgcolor) {	      	
  # calculate id string for link references
  # corresponds to the links in the page summaries
  var string id = "$e.journal.username$e.itemid";
  $id = " id=\"$id\" name=\"$id\"";

  # Linkbar
  $e->print_linkbar();

  # Userpic
  var string userpic = "";
  if(defined $e.userpic) {
    $userpic = """<a href="$*SITEROOT/allpics.bml?user=$e.poster.username"><img src="$e.userpic.url" alt="$e.poster.name" title="$e.poster.name" border="0" /></a>""";
  }

  # Poster
  var string poster        = "<a href=\"" + $e.poster->base_url() + "\" style=\"color: $fgcolor;\">$e.poster.username</a>";

  # Journal
  var string journal       = "<a href=\"" + $e.journal->base_url() + "\" style=\"color: $fgcolor;\">$e.journal.username</a>";

  # Build Poster info
  var string posterinfo    = $poster;
  if($e.poster.username != $e.journal.username) {
    $posterinfo = $posterinfo + """<br />\n<span style="color: $fgcolor;">[$journal]</span>""";
  }
  $posterinfo = """<div style="text-align: center;">$posterinfo</div>""";

  # Show userpic?
  var bool   show_userpic  = $*show_entry_userpic and $userpic != "";

  # Is this Friends or Entry view?
  var bool   friends_entry = ($p.view == "friends") or ($p.view == "entry");

  # Is this a Community's Recent view?
  var bool   recent_comm   = ($p.view == "recent") and ($p.journal_type == "C");

  # If we're showing the userpic, is it Friends view or Entry view or a Community's Recent view?
  # If so, let's add a div around the userpic
  if (($show_userpic) and (not($friends_entry or $recent_comm))) {
    $userpic = """<div class="userpic">$userpic</div>""";
  }	
  print """
  <div class="subcontent"$id>
  """;				

  # Print userpic and Poster info, if applicable
  if (($p.view == "recent" and $p.journal_type != "C" ) or $p.view == "day") {
    print $userpic;
  } else {
    if ($p.view == "recent" and $p.journal_type == "C" ) {
      """<div class="userpicfriends" style="background-color: $*entry_bgcolor;">""";
    } else {
      """<div class="userpicfriends" style="background-color: $bgcolor;">""";
    }			
    print $userpic;
				
    # Poster
    if ($friends_entry or $recent_comm) {
      if($userpic != "") {
        print "<br />";
      }
      print """<div style="text-align:center;">$posterinfo</div>""";
    }
    if ($recent_comm) {
      print "</div>";
    }	
    if ($p.view != "recent" and $p.view != "day") {
      print """</div>""";
    }
  }

  # Date, time, subject
  var string time = "";
  $time = $time + """ @ """;
  $time = $time + $e.time->time_format("short");
  var string date = "";
  $date = $date + $e.time->date_format("long_day");
  """
    <div class="datesubject">
      <div class="date">$date$time</div>
      <div class="subject">""";
  if ($e.security != "") {
    $e.security_icon->print();
  }
  var string subject = ($e.subject != "") ? $e.subject : """<i class="nosubject">$*text_nosubject</i>""";
  """
        $subject &nbsp;
      </div>
    </div>
    <div class="entry">
      <div class="entry_text">"""; $e->print_text(); """</div> """;

  # Currents
  $e->print_metadata();

  # Linkbar and Comments
  """
      <div class="clear">&nbsp;</div>
      <div class="comments">""";
  var Link     link       = new Link;
  var string{} link_text  = {"edit_entry" => $*text_edit, "edit_tags" => "Edit Tags", "mem_add" => $*text_memories};
  var string{} link_url   = {"" => ""};
  var string   link_print = "";
  var string   link_sep   = " | ";
  foreach var string link_key ($e.link_keyseq) {
    $link                 = $e->get_link($link_key);
    $link_text{$link_key} = $link_text{$link_key} != "" ? $link_text{$link_key} : $link.caption;
    $link_url{$link_key}  = $link.url;
    if($link_url{$link_key} != "") {
      $link_print = $link_print + """<a href="$link_url{$link_key}">$link_text{$link_key}</a>""";
      $link_print = $link_print + $link_sep;
    }
  }
  if($link_print != "") {
    if(not($e.comments.enabled)) {
      $link_print = $link_print->substr(0, $link_print->length() - $link_sep->length());
    }
  }
  print $link_print;
  $e.comments->print(); 
  """
      </div>
    </div>
  </div>
  
  <div class="separator"></div>
  <div class="clear">&nbsp;</div>""";
}
linkReply

Comments:
[User Picture]From: davidthomas85
2005-08-27 03:06 pm (UTC)
I need so much help its sad. :( lol i am completely new to all this. I have a paid account, and I made a layout I wanna use. [Image at http://i19.photobucket.com/albums/b152/davidmck05/lost_layoutnew.png]. Anyway, does anyone have a code I can use for Boxer? I want to have my LOST image at the top, and the boxer layout underneath it etc.

Any help would be much much MUCH appreciated.

Than you.
(Reply) (Thread)
[User Picture]From: kunzite1
2005-08-27 04:09 pm (UTC)

wow. you are in the wrong place.

i'll hack together a header script for boxer.

this entry is for flexisquares. :P
(Reply) (Parent) (Thread)
[User Picture]From: kunzite1
2005-08-27 04:37 pm (UTC)

this would be what you are looking for. :D
(Reply) (Parent) (Thread)
[User Picture]From: davidthomas85
2005-08-27 08:31 pm (UTC)
OMG I LOVE YOU!!!!! Hahahaha! Thank you SOOOOO much! :D

So, all I do is copy and paste all of that code, and put it into a layer source etc? Or do I leave out some parts of it?
(Reply) (Parent) (Thread)
[User Picture]From: kunzite1
2005-08-27 08:32 pm (UTC)

copy/paste the whole thing.
(Reply) (Parent) (Thread)