?

Log in

No account? Create an account
[theme] - [bloggish] - [fix and alter a whole mess-load of 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] - [bloggish] - [fix and alter a whole mess-load of things] [Sep. 9th, 2005|02:37 pm]
S2 Layers

s2layers

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

in response to thehumangame's comment in vincel's s2styles post.
layout previews.
# set commands
  # add custom boxes
  # add tags, alter metadata printing

# function overrides
  # fix width of reply form

  # add unique id's to days

  # fix date header on day page

  # add custom boxes

  # fix/alter entry linkbar

  # fix/alter comment linkbar

  # alter metadata printing

  # fix printing of poster info
  # alter metadata printing
  # fix/alter entry linkbar
  # if screened comments, show readlink

  # remove border from yearweeks

  # make yearmonth headers look like day view headers

  # make monthday headers look like day view headers

  # add multiform to entrypage

  # add subject icon to comments
  # add multiform check to comments
  # fix/alter comment linkbar

  # fix tags page view title
  # add my spiffy tags page with day view-like headers

# add custom box
set sidebar_primary = [
    [ "userprofile", "", "0", "1" ],
    [ "viewlinks", "" ],
    [ "calendar" ],
    [ "syndicate", "Syndicate" ],
    [ "links", "Links" ],
    [ "customtext", "", "", ""],
    [ "poweredby" ],
];

# add tags, alter mood/music cuz i removed printing of the : in Entry::print_metadata();
set tags_aware         = true;
set text_meta_location = "Current Location:";
set text_meta_mood     = "Current Mood:";
set text_meta_music    = "Current Music:";

function Page::print_custom_head() {
"""
<style type="text/css">
#commenttext { /* FIX THAT DAMN REPLY FORM! */
  width: 90%;
}
</style>
""";
}

function DayPage::print_body() {
  # give each day a unique id
  # add date-header class to date header

  if ($.has_entries) {
    var string id = $.date->date_format("day%%yyyy%%%%mm%%%%dd%%");
    """
    <div class="day" id="$id">
      <h2 class="date-header">""";
    print $.date->date_format("long");
    """
      </h2>""";

    foreach var Entry e ($.entries) {
      $this->print_entry($e);
    }
    """
    </div>""";
  } else {
    """<p>$*text_noentries_day</p>""";
  }

  """
  <div class="skiplinks">
    <a href="$.prev_url">$*text_day_prev</a> | <a href="$.next_url">$*text_day_next</a>
  </div>""";
}

function print_module_customtext(string title, string text, string titlelink_url) {
  var Page p = get_page();

  open_module("customA", "Frank A", "http://www.livejournal.com/site/goat.bml");
  """<img src="http://stat.livejournal.com/img/goat-normal.gif" alt="Frank" title="Frank" />""";
  close_module();

  open_module("customB", "Frank B", "http://www.livejournal.com/site/goat.bml");
  """<img src="http://stat.livejournal.com/img/goat-normal.gif" alt="Frank" title="Frank" />""";
  close_module();
}

function Entry::print_linkbar() {
  var string   link_seperator = """&nbsp;<span class="separator">|</span>&nbsp;"""; # same as var string sep in Page::print_entry()
                                                                                    # add &nbsp;'s to sep to force them spaces

  # initialize array/hashes
  var string[] link_keyseq    = [""];
  var string{} link_url       = {"" => ""};
  var string{} link_caption   = {"" => ""};
  var string{} link_image     = {"" => ""};

  var string print           = "";                                         # var for printing
  var Page   p               = get_page();                                 # page handle to determine interentry
  var bool   show_interentry = ($p.view == "entry" or $p.view == "reply"); # if entry/reply view, show interentry
  var int    keyseq_index    = 0;                                          # set index point for new link_keyseq array

  if($show_interentry) {
    # if show interentry, put previous entry link first
    $link_keyseq[$keyseq_index++] = "nav_prev";

    # get previous entry link information
    var Link prev             = $this->get_link("nav_prev");
    $link_url{"nav_prev"}     = $prev.url;
    $link_caption{"nav_prev"} = $prev.caption;
    $link_image{"nav_prev"}   = $prev.icon.url;

    # get next entry link information
    var Link next             = $this->get_link("nav_next");
    $link_url{"nav_next"}     = $next.url;
    $link_caption{"nav_next"} = $next.caption;
    $link_image{"nav_next"}   = $next.icon.url;
  }

  # gather current linkbar
  foreach var string link_key ($.link_keyseq) {
    var Link  link            = $this->get_link($link_key);
    $link_url{$link_key}      = $link.url;
    $link_caption{$link_key}  = $link.caption;
    $link_image{$link_key}    = $link.icon.url;
    $link_keyseq[$keyseq_index++] = $link_key; # add this to new link_keyseq array
  }
  if($show_interentry) {
    # if show interentry, put next entry link last
    $link_keyseq[$keyseq_index++] = "nav_next";
  }

  #################################################################################################################
  # by now, the above hashes should look something like:                                                          #
  #                                                                                                               #
  # If interentry:                                                                                                #
  #   Previous Entry:                                                                                             # 
  #    $link_url{"nav_prev"}     = http://www.livejournal.com/go.bml?journal=exampleusername&itemid=256&dir=prev  #
  #    $link_caption{"nav_prev"} = Previous Entry                                                                 #
  #    $link_image{"nav_prev"}   = http://stat.livejournal.com/img/btn_prev.gif                                   #
  #                                                                                                               #
  # Edit Entry:                                                                                                   # 
  #  $link_url{"edit_entry"}     = http://www.livejournal.com/editjournal.bml?journal=exampleusername&itemid=256  #
  #  $link_caption{"edit_entry"} = Edit Entry                                                                     #
  #  $link_image{"edit_entry"}   = http://stat.livejournal.com/img/btn_edit.gif                                   #
  #                                                                                                               #
  # Edit Tags:                                                                                                    # 
  #  $link_url{"edit_tags"}      = http://www.livejournal.com/edittags.bml?journal=exampleusername&itemid=256     #
  #  $link_caption{"edit_tags"}  = Edit Tags                                                                      #
  #  $link_image{"edit_tags"}    = http://stat.livejournal.com/img/btn_edittags.gif                               #
  #                                                                                                               #
  # Add to Memories:                                                                                              # 
  #  $link_url{"mem_add"}        = http://www.livejournal.com/tools/memadd.bml?journal=exampleusername&itemid=256 #
  #  $link_caption{"mem_add"}    = Add to Memories                                                                #
  #  $link_image{"mem_add"}      = http://stat.livejournal.com/img/btn_memories.gif                               #
  #                                                                                                               #
  # If interentry:                                                                                                #
  #   Next Entry:                                                                                                 #
  #    $link_url{"nav_next"}     = http://www.livejournal.com/go.bml?journal=exampleusername&itemid=256&dir=next  #
  #    $link_caption{"nav_next"} = Next Entry                                                                     #
  #    $link_image{"nav_next"}   = http://stat.livejournal.com/img/btn_next.gif                                   #
  #################################################################################################################

  # disable images
  $link_image{"nav_prev"   } = "";
  $link_image{"edit_entry" } = "";
  $link_image{"edit_tags"  } = "";
  $link_image{"mem_add"    } = "";
  $link_image{"tell_friend"} = "";
  $link_image{"nav_next"   } = "";

  # loop thru linkbar and add links to print var
  foreach var string link_key ($link_keyseq) {
    # if we can do performed action, url will be present
    if($link_url{$link_key} != "") {
      $print = $print + """<a href="$link_url{$link_key}">""";
      # if image url available, use it
      if($link_image{$link_key} != "") {
        $print = $print + """<img src="$link_image{$link_key}" alt="$link_caption{$link_key}" title="$link_caption{$link_key}" border="0" />""";
      } else {
        # else, just use text
        $print = $print + "$link_caption{$link_key}";
      }
      # add a seperator
      $print = $print + "</a>$link_seperator";
    }
  }

  # hack off last seperator
  $print = $print->substr(0, $print->length() - $link_seperator->length());

  # we're done! let's print it!
  print $print;
}

function Comment::print_linkbar() {
  var string   link_seperator = """&nbsp;<span class="separator">|</span>&nbsp;"""; # same as var string sep in Page::print_entry()
                                                                                    # add &nbsp;'s to sep to force them spaces

  # initialize array/hashes
  var string[] link_keyseq    = [""];
  var string{} link_url       = {"" => ""};
  var string{} link_caption   = {"" => ""};
  var string{} link_image     = {"" => ""};

  var string print           = "";                                         # var for printing
  var int    keyseq_index    = 0;                                          # set index point for new link_keyseq array

  # gather current linkbar
  foreach var string link_key ($.link_keyseq) {
    var Link  link            = $this->get_link($link_key);
    $link_url{$link_key}      = $link.url;
    $link_caption{$link_key}  = $link.caption;
    $link_image{$link_key}    = $link.icon.url;
    $link_keyseq[$keyseq_index++] = $link_key; # add this to new link_keyseq array
  }

  #####################################################################################################################################
  # by now, the above hashes should look something like:                                                                              #
  #                                                                                                                                   #
  # Delete Comment:                                                                                                                   # 
  #  $link_url{"delete_comment"}     = http://www.livejournal.com/delcomment.bml?journal=exampleusername&id=256                       #
  #  $link_caption{"delete_comment"} = Delete                                                                                         #
  #  $link_image{"delete_comment"}   = http://stat.livejournal.com/img/btn_del.gif                                                    #
  #                                                                                                                                   #
  # If not frozen:                                                                                                                    #
  #   Freeze Comment:                                                                                                                 #
  #    $link_url{"freeze_thread"}     = http://www.livejournal.com/talkscreen.bml?mode=freeze&journal=exampleusername&talkid=256      #
  #    $link_caption{"freeze_thread"} = Freeze                                                                                        #
  #    $link_image{"freeze_thread"}   = http://stat.livejournal.com/img/btn_freeze.gif                                                #
  #                                                                                                                                   #
  # If frozen:                                                                                                                        #
  #   Unfreeze Comment:                                                                                                               #
  #    $link_url{"unfreeze_thread"}     = http://www.livejournal.com/talkscreen.bml?mode=unfreeze&journal=exampleusername&talkid=256  #
  #    $link_caption{"unfreeze_thread"} = Unfreeze                                                                                    #
  #    $link_image{"unfreeze_thread"}   = http://stat.livejournal.com/img/btn_unfreeze.gif                                            #
  #                                                                                                                                   #
  # If not screened:                                                                                                                  #
  #   Screen Comment:                                                                                                                 #
  #    $link_url{"screen_comment"}     = http://www.livejournal.com/talkscreen.bml?mode=screen&journal=exampleusername&talkid=256     #
  #    $link_caption{"screen_comment"} = Screen                                                                                       #
  #    $link_image{"screen_comment"}   = http://stat.livejournal.com/img/btn_scr.gif                                                  #
  #                                                                                                                                   #
  # If screened:                                                                                                                      #
  #   Unscreen Comment:                                                                                                               #
  #    $link_url{"unscreen_comment"}     = http://www.livejournal.com/talkscreen.bml?mode=unfreeze&journal=exampleusername&talkid=256 #
  #    $link_caption{"unscreen_comment"} = Unscreen                                                                                   #
  #    $link_image{"unscreen_comment"}   = http://stat.livejournal.com/img/btn_unscr.gif                                              #
  #####################################################################################################################################

  # disable images
  $link_image{"delete_comment"  } = "";
  $link_image{"freeze_thread"   } = "";
  $link_image{"unfreeze_thread" } = "";
  $link_image{"screen_comment"  } = "";
  $link_image{"unscreen_comment"} = "";

  # loop thru linkbar and add links to print var
  foreach var string link_key ($link_keyseq) {
    # if we can do performed action, url will be present
    if($link_url{$link_key} != "") {
      $print = $print + """<a href="$link_url{$link_key}">""";
      # if image url available, use it
      if($link_image{$link_key} != "") {
        $print = $print + """<img src="$link_image{$link_key}" alt="$link_caption{$link_key}" title="$link_caption{$link_key}" border="0" />""";
      } else {
        # else, just use text
        $print = $print + "$link_caption{$link_key}";
      }
      # add a seperator
      $print = $print + "</a>$link_seperator";
    }
  }

  # hack off last seperator
  $print = $print->substr(0, $print->length() - $link_seperator->length());

  # we're done! let's print it!
  print $print;
}

function Entry::print_metadata() {
  var string tags_header         = "Current Tags"; # text for tags header,    "Current Tags"
  var string tags_joiner         = ":";            # text for tags joiner,    ":"
  var string tags_sep            = ", ";           # text for tags separator, ", "
  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="metadata">"""; # html for opening of currents container
  var string currents_close      = """</div><br />"""; # html for closing of currents container

  var bool   loc_after_mood      = false;               # set to true to print location after mood
  var bool   vanilla_loc         = false;               # set to true to delinkify location

  var string meta_label_open     = """<strong>""";   # 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      = """<br />""";     # 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

        # 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);
          }

          # 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"

      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";
  }
}

function Page::print_entry(Entry e) {
  var string subject = $e.subject != "" ? $e.subject : """<i class="nosubject">$*text_nosubject</i>""";

  "
  <div class='entry'" + ($e.dom_id ? " id='$e.dom_id'" : "") + ">\n";
  """
    <h3 class="entry-header">$subject</h3>""";
  """
    <div class="entry-content">""";

  var bool showuserpic = $*opt_userpic_main;
  if ($.view == "friends") { $showuserpic = $*opt_userpic_friends;   }
  if ($.view == "entry")   { $showuserpic = $*opt_userpic_entrypage; }
  if ($showuserpic and defined $e.userpic) {
    """
      <div class="entry-userpic">$e.userpic</div>""";
  }

  """
      <div class="entry-body">""";
  $e->print_metadata();
  $e->print_text();
  """
      </div>""";

  # add &nbsp;'s to sep to force them spaces
  var string sep = """&nbsp;<span class="separator">|</span>&nbsp;""";

  var bool showtime   = $*opt_showtime;
  var bool showdate   = not $*opt_datehead;
  var bool showposter = false;
  if ($.view == "friends")                    { $showposter = true;                    $showtime = true; }
  if ($.view == "day")                        {                     $showdate = false;                   }
  if ($.view == "entry" or $.view == "reply") {                     $showdate = true;                    }
  if (not $e.poster->equals($e.journal))      { $showposter = true;                                      }

  """
      <p class="entry-footer">""";
  if (defined $e.security_icon) {
    print """<span class="lj-entry-securityicon">$e.security_icon</span> """;
  }

  if ($showdate or $showtime or $showposter) {
    # add a <br /> here instead of a seperator
    # linkbar is too long to not do so
    print lang_posted_by_date_and_time($e, $e.poster, $e.journal, $e.time, $showposter, $showdate, $showtime) + "<br />";
  }

    """
        <a class="permalink" href="$e.permalink_url">$*text_permalink</a>$sep""";

  $e->print_linkbar();

  if ($.view != "reply") {
    if ($e.comments.enabled) {
      " $sep "; $e.comments->print_postlink();
    }
  }
  if ($.view != "entry") {
    if (($e.comments.count > 0) or $e.comments.screened) {
      " $sep "; $e.comments->print_readlink();
      if($e.comments.screened) {
        "&nbsp;w/ screened";
      }
    }
  }

  """
      </p>
    </div>
  </div>""";
}

function YearWeek::print() {
  """
      <tr valign="top" style="height: 2em;">""";
  if ($.pre_empty > 0) {
    """
        <td class="emptyday" colspan="$.pre_empty">&nbsp;</td>\n""";
  }
  foreach var YearDay d ($.days) {
    """
        <td>
          <div style="font-style:italic; text-align: right;">$d.day</div>""";
    if ($d.num_entries > 0) {
      """
          <div style="text-align: center;"><a href="$d.url">$d.num_entries</a></div>""";
    }
    """
        </td>""";
  }
  if ($.post_empty > 0) {
    """
        <td colspan="$.post_empty">&nbsp;</td>""";
  }
  """
      </tr>""";
}

function YearPage::print_month(YearMonth m) {
  if (not $m.has_entries) { return; }

  var string id    = "anchor$m.month";
  var string title = $m->month_format();
  var string url   = $m.url;

  """
  <div class="yearmonth" id="$id">
    <h2 class="date-header">""";
  print """<a href="$url">$title</a>""";
  """
    </h2>""";
  """
    <a name="$id"></a>
    <table cellspacing="0" cellpadding="0" border="0" width="100%">
      <tr>
  """;

  foreach var int d (weekdays()) {
    """
        <th width="14%">$*lang_dayname_short[$d]</th>
    """;
  }
  """
      </tr>
  """;
  foreach var YearWeek w ($m.weeks) {
    $w->print();
  }
  """
    </table>
  </div>
  <br />
  """;
}

function MonthPage::print_body {
  var string id   = "";
  var string text = "";
  var string url  = "";

  """
  <form method="post" action="$.redir.url">
    <center>""";
  $.redir->print_hiddens();
  if ($.prev_url != "") { "[<a href='$.prev_url'>&lt;&lt;&lt;</a>]\n"; }
  if (size $.months > 1) {
    """
      <select name="redir_key">""";
    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>\n<input type='submit' value='View' />";
  }
  if ($.next_url != "") { "\n[<a href='$.next_url'>&gt;&gt;&gt;</a>]\n"; }
  """
    </center>
  </form>""";
  foreach var MonthDay d ($.days) {
    if ($d.has_entries) {
      $id   = $d.date->date_format("anchor%%yyyy%%%%mm%%%%dd%%");
      $text = lang_ordinal($d.day);
      $url  = $d.url;
      """
    <div class="monthday" id="$id">
      <h2 class="date-header">
        <a href="$url">$text</a>
      </h2>""";
      $d->print_subjectlist();
      """
    </div>
    <br />""";
    }
  }
}

function EntryPage::print_body() {
  # let's toss in the multiform stuff

  $this->print_entry($.entry);

  if ($this.multiform_on) {
    $this->print_multiform_start();
  }

  """
  <a id="comments"></a>
  <div class="comments">
    <h3 class="comments-header">$*text_comments</h3>
    <div class="comments-content">
      <!-- comment list -->
  """;

  foreach var Comment c ($.comments) {
    $this->print_comment($c);
  }

  """
    </div>
  </div>
  """;

  if ($this.multiform_on) {
    $this->print_multiform_actionline();
    $this->print_multiform_end();
  }

}

function EntryPage::print_comment(Comment e) {
  if (not $e.full) {
    # Collapsed mode

   "
    <div class='comment collapsed-comment'"+($e.dom_id ? " id='$e.dom_id'" : "")+">\n";
    """
      <div class="comment-footer">""";
    var string subject = $e.subject;
    if ($subject == "") { $subject = $*text_nosubject; }
    """
        <a href="$e.permalink_url" class="collapsed-comment-link">$subject</a> <span class='separator'>-</span> """;
    print lang_posted_by_date_and_time($e, $e.poster, $e.journal, $e.time, true, true, true) + "<br />";
    """
      </div>
    </div>""";

    return;
  }

  "
  <div class='comment'"+($e.dom_id ? " id='$e.dom_id'" : "")+">\n";
  if ($e.subject != "") {
    """
    <h3 class="comment-header">$e.subject</h3>""";
  }

  if ($*opt_userpic_comments and defined $e.userpic) {
    """
    <div class="comment-userpic">$e.userpic</div>""";
  }

  """
    <div class="comment-content">""";
  $e->print_text();
  """
    </div>
    <div class="comment-footer">""";

  # add &nbsp;'s to sep to force them spaces
  var string sep = """&nbsp;<span class="separator">|</span>&nbsp;""";

  # add subject icon, just like security icon in entries
  if (defined $e.subject_icon) {
    print """<span class="lj-entry-securityicon">$e.subject_icon</span> """;
  }

  print lang_posted_by_date_and_time($e, $e.poster, $e.journal, $e.time, true, true, true) + "<br />";

  # let's toss in the mass action select box after a seperator
  if ($.multiform_on) {
    """$sep<label for="ljcomsel_$e.talkid">$*text_multiform_check</label> """;
    $e->print_multiform_check();
  }

  # add a <br /> here instead of a seperator
  # linkbar is too long to not do so
  "<br />";

  "<a class='permalink' href='$e.permalink_url'>$*text_permalink</a>";

  # better support for reply/parent/thread links
  # re-order links
  var string parent = $e.parent_url != ""                                    ? """$sep<a href="$e.parent_url">$*text_comment_parent</a>""" : "";
  var string thread = $e.thread_url != ""                                    ? """$sep<a href="$e.thread_url">$*text_comment_thread</a>""" : "";
  var string reply  = " $sep " + (((not $e.frozen) and ($e.reply_url != "")) ? """<a href="$e.reply_url">$*text_comment_reply</a>"""       : $*text_comment_frozen);
  "$parent$thread$reply";

  # add delete/[un]screen/[un]freeze links, kick to next line as to decrease accidental deletion/etc of comments
  "<br />";
  $e->print_linkbar();

  "</div>";

  if (size($e.replies) > 0) {
    println """<div class="comment-replies">""";

    foreach var Comment c ($e.replies) {
      $this->print_comment($c);
    }

    println "</div>";
  }
  "</div>";
}

function TagsPage::view_title() : string  {
  return "Tags Page";
}

function TagsPage::print_body() {
  var string text = "Visible Tags";

  """
    <div>
      <h2 class="date-header">
        $text
      </h2>
  """;

  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 colspan = viewer_is_owner() ? 3 : 2;
  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"
                                  };

  $content = $content + """<table width="100%">\n<tr>\n  <th align="center" colspan="2" nowrap="nowrap">&nbsp;Tag&nbsp;</th>\n""" + (viewer_is_owner() ? """<th align="center" nowrap="nowrap">&nbsp;Total&nbsp;</th>\n""" : "");
  foreach var string security($security_order) {
    $content = $content + """  <th align="center" 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>""") : "");
    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>""";
      $group_count    = $group_count - $security_count;
    }
    $content = $content + """<tr><td>$security_labels{$td.visibility}</td><td><a href="$td.url">$td.name</a></td>$uses</tr>\n""";
  }
  $content = $content + "</table>";
  print $content;
  """
  </div>""";
}
linkReply

Comments:
[User Picture]From: arewar
2005-09-28 04:23 pm (UTC)
You're a hero.

The only thing that I know of that should be added is Tag support, and possily a page summary.
(Reply) (Thread)
[User Picture]From: kunzite1
2005-09-28 04:32 pm (UTC)

tags are in the metadata function for entries.

i think what you mean is a tags module and then adding a page summary module.

seems that there's a page summary module (print_module_pagesummary(string title)) that is only useful if it's on RecentPage. it could be expanded...

seems that there's a tags module as well:
print_module_tags(string title)

they're just not activated in my test layer. you can go thru the painstaking effort of doing the set commands:
set sidebar_primary = [
    [ "userprofile", "",        "0", "1" ],
    [ "pagesummary", "summary"           ],
    [ "tags",        "tag list"          ]
];
or just call them from the print_module_customtext(string title, string text, string titlelink_url) function:
function print_module_customtext(string title, string text, string titlelink_url){ 
  print_module_pagesummary("summary");
  print_module_tags("tag list");
}
(Reply) (Parent) (Thread)
[User Picture]From: girlrac3r
2005-10-03 06:41 pm (UTC)
omg. i love it :D
(Reply) (Thread)
From: tiassa
2005-11-25 10:52 am (UTC)
I'm attempting to use this on my journal, but I'm not very good with coding and for the life of me I can't figure out how to rename the "Link", "Edit Entry", "Edit Tags", and "Add to Memories" links. If you could help me out, I would very much appreciate it...
(Reply) (Thread)
[User Picture]From: kunzite1
2005-12-13 04:55 pm (UTC)

  # disable images
  $link_image{"nav_prev"   } = "";
  $link_image{"edit_entry" } = "";
  $link_image{"edit_tags"  } = "";
  $link_image{"mem_add"    } = "";
  $link_image{"tell_friend"} = "";
  $link_image{"nav_next"   } = "";

  # alter link text
  $link_caption{"nav_prev"   } = "Prev";
  $link_caption{"edit_entry" } = "Edit";
  $link_caption{"edit_tags"  } = "Tag";
  $link_caption{"mem_add"    } = "Mem";
  $link_caption{"tell_friend"} = "Tell";
  $link_caption{"nav_next"   } = "Next";
(Reply) (Parent) (Thread)
[User Picture]From: velvet_noise
2005-11-30 09:38 am (UTC)
Just leaving a comment to thank you for this. It's finally helped me to get my head around how s2 works. Well, vaguely. As much as my brain can cope with.

You are brilliant.
(Reply) (Thread)
[User Picture]From: indianyellow
2005-12-13 04:52 pm (UTC)
I just wanted to say thanks for this too! Thanks! :-)
(Reply) (Thread)
[User Picture]From: kunzite1
2005-12-13 04:53 pm (UTC)

many welcomes. i just wish the lj guys would see what i do for their users. x.x
(Reply) (Parent) (Thread)
[User Picture]From: clemenceau
2005-12-26 04:10 pm (UTC)

?

I'm definitely a n00b when it comes to S2, and I have no idea what I'm supposed to do with this code to apply it to my journal. I have a permanent account, so I'm sure I'm just missing something big.
(Reply) (Thread)
[User Picture]From: kunzite1
2005-12-26 08:26 pm (UTC)

Re: ?

crash course in s2.

once you learn how to use layers, you'll be able to use this code.
(Reply) (Parent) (Thread)
[User Picture]From: woofiegrrl
2006-02-09 08:25 pm (UTC)

Re: ?

Okay, I'm an idiot. I had this working fine when I was using Stevenson. Then I switched to Powell Street and it went poof. Now when I try to put it back, it doesn't seem to have any effect. My layer is 5861793 if that helps. I've already learned about layers and all that, I've even already done this properly, but I must be something really obvious that's making this fail. Any thoughts?
(Reply) (Parent) (Thread)
[User Picture]From: woofiegrrl
2006-02-09 08:26 pm (UTC)

Re: ?

Ahem - missing something really obvious.
(Reply) (Parent) (Thread)
[User Picture]From: kunzite1
2006-02-10 08:48 am (UTC)

Re: ?

layer not viewable.
(Reply) (Parent) (Thread)
[User Picture]From: potmunkey
2006-03-03 09:02 am (UTC)
How do I get my sidebar to actually sit on the side and not on the bottom of the page?

I've noticed that with some layouts it works fine but others it's always on the bottom

Also, is it possible to get everything nice and centered? and add a header?

Thanks
(Reply) (Thread)
[User Picture]From: kunzite1
2006-03-03 09:05 am (UTC)

1: you're not using bloggish. you seem to be using quite lickable.
2: sidebar sitting at bottom is known bug that is most likely related to the css parser.
3: once above css parser problem is resolved, it'll be easier. for now, try a different layout, as it seems you're doing.
(Reply) (Parent) (Thread)
[User Picture]From: potmunkey
2006-03-03 09:13 am (UTC)
well yes, I know I'm using quite lickable right now, but I'm editing my theme layer for bloggish and I don't want to apply it until I get it just the way I want

is the centering thing a problem with the css too?
(Reply) (Parent) (Thread)
[User Picture]From: kunzite1
2006-03-03 09:15 am (UTC)

i am unable to view your style without knowing the s2id.
i am unable to view your layer without it being set to source_viewable and you providing the layerid number associated with the layer.

depending on how you try to do the centering, it could work.

if you provide the above information, i could take a look at it and we could go from there.
(Reply) (Parent) (Thread)
[User Picture]From: potmunkey
2006-03-03 09:30 am (UTC)
layerid 6153488

I haven't really added anything to it yet, except an abbreviated version of your above code
(Reply) (Parent) (Thread)
[User Picture]From: kunzite1
2006-03-03 05:02 pm (UTC)

i'd also like the s2id if i could.
it'll allow me to see the output of your journal using this layer.
(Reply) (Parent) (Thread)
[User Picture]From: potmunkey
2006-03-03 11:48 pm (UTC)
sorry about that, #10461554
(Reply) (Parent) (Thread)
[User Picture]From: kunzite1
2006-03-04 03:11 am (UTC)

bleh. the css is too complicated.

whine here if you like.
(Reply) (Parent) (Thread)
[User Picture]From: roark28
2006-04-06 04:34 am (UTC)
Thank you x5million ^__^♥ *Adds to memories*
(Reply) (Thread)
[User Picture]From: amcam
2006-09-16 07:56 pm (UTC)
hello -- do you remember me?
i was editing font face/size/color/weight/style in my layers file and i'm not sure what's happened. i went to my journal (this was several days ago and no one knows what's going on) and it was fine, my changes were made. then later i returned (and refreshed) and it looked like you see now, my previous layout competing with this yellow/gray line/diced up layout. i have NO IDEA what is wrong or how to find out. could you help me? :p

- thanks
(Reply) (Thread)
(Deleted comment)
[User Picture]From: kunzite1
2006-09-16 09:43 pm (UTC)
don't post your layer code.
put the following in to the top of your layer and compile:
layerinfo "source_viewable" = 1;

then give me the number at the end of the URL.
(Reply) (Parent) (Thread)
[User Picture]From: amcam
2006-09-16 09:49 pm (UTC)
ok, here it is:

5228569
(Reply) (Parent) (Thread)
[User Picture]From: amcam
2006-09-18 10:09 pm (UTC)
thank you so much for taking the time to help me, I've tried so many things that other people suggested and nothing works.
(Reply) (Parent) (Thread)
[User Picture]From: kunzite1
2006-09-18 11:22 pm (UTC)
if you could toss me a couple screenshots, that'd be handy.
(Reply) (Parent) (Thread)