to make sure that these work, make sure that the function that prints entries calls Entry::print_linkbar() and Entry::print_metadata(). also make sure that Entry::print_comment(Comment c) calls Comment::print_linkbar().
function Comment::print_linkbar() {
var bool add_links = false;
var bool first_sep = false;
var bool last_sep = false;
var string img_id = "";
var string link_key = "";
var string link_link = "";
var string link_sep = "";
var string print = "";
var string[] link_keyseq = [];
var string{} link_captions = {};
var string{} link_images = {};
var string{} link_urls = {};
var Link link = new Link;
# add a sep before the links?
$first_sep = true;
# add a sep after the links?
$last_sep = false;
# define the sep
$link_sep = """ | """;
# define the link order
# comment_reply : reply to comment
# comment_parent : parent of comment
# comment_thread : comment thread
# delete_comment : delete comment
# freeze_thread : freeze thread
# permalink : permalink of comment
# screen_comment : screen comment
# unfreeze_thread : unfreeze thread
# unscreen_comment : unscreen comment
# unwatch_thread : untrack/unwatch thread
# watch_thread : track/watch thread
# watching_parent : tracking/watching parent of comment
$link_keyseq = [ # comment_reply, comment_parent, comment_thread, permalink, delete_comment, freeze_thread, screen_comment, unscreen_comment, unfreeze_thread, unwatch_thread, watch_thread, watching_parent
"comment_reply",
"comment_parent",
"comment_thread",
"permalink",
"delete_comment",
"freeze_thread",
"screen_comment",
"unscreen_comment",
"unfreeze_thread",
"unwatch_thread",
"watch_thread",
"watching_parent",
];
# define the link images
$link_images = {
"permalink" => "
http://mike.mm1swebcreations.com/lj/silk/link.png",
"nav_prev" => "
http://mike.mm1swebcreations.com/lj/silk/arrow_left.png",
"edit_entry" => "
http://mike.mm1swebcreations.com/lj/silk/pencil.png",
"edit_tags" => "
http://mike.mm1swebcreations.com/lj/silk/tag_blue_edit.png",
"mem_add" => "
http://mike.mm1swebcreations.com/lj/silk/disk.png",
"tell_friend" => "
http://mike.mm1swebcreations.com/lj/silk/email_go.png",
"watch_comments" => "
http://mike.mm1swebcreations.com/lj/silk/map_add.png",
"unwatch_comments" => "
http://mike.mm1swebcreations.com/lj/silk/map_delete.png",
"nav_next" => "
http://mike.mm1swebcreations.com/lj/silk/arrow_right.png",
"comment_frozen" => "
http://mike.mm1swebcreations.com/lj/silk/comment_frozen.png",
"comment_parent" => "
http://mike.mm1swebcreations.com/lj/silk/arrow_up.png",
"comment_reply" => "
http://mike.mm1swebcreations.com/lj/silk/comment_add.png",
"comment_thread" => "
http://mike.mm1swebcreations.com/lj/silk/comment.png",
"delete_comment" => "
http://mike.mm1swebcreations.com/lj/silk/cancel.png",
"freeze_thread" => "
http://mike.mm1swebcreations.com/lj/silk/lightbulb_off.png",
"screen_comment" => "
http://mike.mm1swebcreations.com/lj/silk/eye_cross.png",
"unscreen_comment" => "
http://mike.mm1swebcreations.com/lj/silk/eye.png",
"unfreeze_thread" => "
http://mike.mm1swebcreations.com/lj/silk/lightbulb.png",
"unwatch_thread" => "
http://mike.mm1swebcreations.com/lj/silk/map_delete.png",
"watch_thread" => "
http://mike.mm1swebcreations.com/lj/silk/map_add.png",
"watching_parent" => "
http://mike.mm1swebcreations.com/lj/silk/map_magnify.png",
};
# define permalink data
$link_key = "permalink";
$link_captions{$link_key} = $*text_permalink;
$link_urls{$link_key} = $.permalink_url;
# define reply link data
$link_key = "comment_reply";
$link_captions{$link_key} = $.frozen ? $*text_comment_frozen : $*text_comment_reply;
$link_images{$link_key} = $.frozen ? $link_images{"comment_frozen"} : $link_images{"comment_reply"};
$link_urls{$link_key} = $.frozen ? "" : $.reply_url;
# define parent link data
$link_key = "comment_parent";
$link_captions{$link_key} = $*text_comment_parent;
$link_urls{$link_key} = $.parent_url;
# define thread link data
$link_key = "comment_thread";
$link_captions{$link_key} = $*text_comment_thread;
$link_urls{$link_key} = $.thread_url;
# if there aren't any links defined in the array, let's add 'em
$add_links = (size($link_keyseq) < 1);
# cycle thru links and gather data
foreach $link_key ($.link_keyseq) {
$link = $this->get_link($link_key);
$link_captions{$link_key} = $link_captions{$link_key} != "" ? $link_captions{$link_key} : $link.caption;
$link_images{$link_key} = $link_images{$link_key} != "" ? $link_images{$link_key} : $link.icon.url;
$link_urls{$link_key} = $link_urls{$link_key} != "" ? $link_urls{$link_key} : $link.url;
# if we're adding links
if($add_links) {
# add it to the array
$link_keyseq[size($link_keyseq)] = $link_key;
}
}
# give linkbar a css class
$print = $print + """""";
# if we've got links to process
if(size($link_keyseq) > 0) {
# if we're adding a first sep
if($first_sep) {
# add it
$print = $print + $link_sep;
}
# cycle thru links
foreach $link_key ($link_keyseq) {
var bool have_img = $link_images{$link_key} != ""; # do we have an image?
var bool have_url = $link_urls{$link_key} != ""; # do we have a url?
var bool is_reply = $link_key == "comment_reply"; # is this the reply link?
if($have_url or $is_reply) { # if we have a url or it's the reply link
if($have_url or ($is_reply and not $have_url)) { # if we have a url, or it's the reply link without a url
$link_link = $link_captions{$link_key}; # set the link text
if($have_img) { # if we have an image
if($link_key->contains("freeze")) { # if it's the [un]freeze link
$img_id = "fuf"; # set img id prefix of "fuf"
} elseif ($link_key->contains("screen")) { # if it's the [un]screen link
$img_id = "sus"; # set img id prefix of "sus"
} elseif ($link_key->contains("watch")) { # if it's the [un]track/watch link
$img_id = "tut"; # set img id prefix of "tut"
} else { # else, we're not doing a special image
$img_id = ""; # set img id prefix of nothing
}
if($img_id != "") { # if we have an img id prefix
$img_id = " id=\"${img_id}_${.talkid}\""; # set it up
}
# add the image
$link_link = """
""";
}
# if we have a url, apply it
if($have_url) {
$link_link = """
$link_link""";
}
# add a link sep
$print = $print + $link_link + $link_sep;
} else {
# else, we're doing the reply link with a url
print $print; # print what we've got
$print = ""; # set print var to nothing
# create array for QR reply link
var string{} opts = {};
# if we have an image
if($have_img) {
$opts{"img_url"} = $link_images{$link_key}; # set image url
$opts{"alt"} = $link_captions{$link_key}; # set image alt
$opts{"title"} = $link_captions{$link_key}; # set image title
} else {
# else, we don't have an image
$opts{"linktext"} = $link_captions{$link_key}; # set linktext
}
# set url
$opts{"reply_url"} = $link_urls{$link_key};
# print QR reply link
$this->print_reply_link($opts);
# add a link sep
$print = $print + $link_sep;
}
}
}
# if we don't have a sep on the end
if(not $last_sep) {
# hack it off
$print = $print->substr(0, $print->length() - $link_sep->length());
}
}
# close span
$print = $print + "";
# print linkbar
print $print;
# print reply container
$this->print_reply_container();
}
function CommentInfo::print() {
# define a link sep
var string link_sep = """ | """;
var bool show_readlink = $.show_readlink; # are we showing the link to read comments?
var bool show_postlink = $.show_postlink; # are we showing the link to post a comment?
var bool show_sep = $show_readlink and $show_postlink; # are we showing both and therefore need a sep?
# give comment links a css class
"""""";
# if we're showing the readlink
if($show_readlink) {
# print it
$this->print_readlink();
}
# if we're showing both links
if($show_sep) {
# print a sep
print $link_sep;
}
# if we're showing the postlink
if($show_postlink) {
# print it
$this->print_postlink();
}
"";
}
function CommentInfo::print_postlink() {
# get page handle
var Page p = get_page();
# define image url for postlink
var string image_url = "
http://mike.mm1swebcreations.com/lj/silk/comments_add.png";
# get postlink url
var string url = $.post_url;
# get postlink text
var string text = get_plural_phrase(0, "text_post_comment" + ($p.view == "friends" ? "_friends" : ""));
# if we've reached max comments
if($.maxcomments) {
$url = ""; # clear url
$text = $*text_max_comments; # set max comments text
}
# if we have a url
if($url != "") {
# open it
"""
""";
}
# if we have an image
if($image_url != "") {
# print it
"""
""";
} else {
# else, print text
print $text;
}
# if we have a url
if($url != "") {
# close it
"""""";
}
}
function CommentInfo::print_readlink() {
# get page handle
var Page p = get_page();
# define image url for readlink
var string image_url = "
http://mike.mm1swebcreations.com/lj/silk/comments.png";
# get readlink url
var string url = $.read_url;
# get readlink text
var string text = get_plural_phrase($.count, "text_read_comments" + ($p.view == "friends" ? "_friends" : ""));
# if we have a url
if($url != "") {
# open it
"""
""";
}
# if we have an image
if($image_url != "") {
# print it
"""
""";
} else {
# else, print text
print $text;
}
# if we have a url
if($url != "") {
# close it
"""""";
}
}
function Entry::print_linkbar() {
var Page p = get_page();
var bool add_links = false;
var bool first_sep = false;
var bool interentry = ($p.view == "entry") or ($p.view == "reply");
var bool last_sep = false;
var string link_key = "";
var string link_link = "";
var string link_sep = "";
var string print = "";
var string[] link_keyseq = [];
var string{} link_captions = {};
var string{} link_images = {};
var string{} link_urls = {};
var Link link = new Link;
# add a sep before the links?
$first_sep = true;
# add a sep after the links?
$last_sep = false;
# define the sep
$link_sep = """ | """;
# define the link order
# edit_entry : edit entry
# edit_tags : edit tags
# mem_add : add to memories
# nav_next : next entry
# nav_prev : previous entry
# permalink : permalink of entry
# tell_friend : tell a friend
# unwatch_comments : untrack/unwatch comments
# watch_comments : track/watch comments
$link_keyseq = [ # permalink, nav_prev, edit_entry, edit_tags, mem_add, tell_friend, watch_comments, unwatch_comments, nav_next
"permalink",
"nav_prev",
"edit_entry",
"edit_tags",
"mem_add",
"tell_friend",
"watch_comments",
"unwatch_comments",
"nav_next",
];
# define the link images
$link_images = {
"permalink" => "
http://mike.mm1swebcreations.com/lj/silk/link.png",
"nav_prev" => "
http://mike.mm1swebcreations.com/lj/silk/arrow_left.png",
"edit_entry" => "
http://mike.mm1swebcreations.com/lj/silk/pencil.png",
"edit_tags" => "
http://mike.mm1swebcreations.com/lj/silk/tag_blue_edit.png",
"mem_add" => "
http://mike.mm1swebcreations.com/lj/silk/disk.png",
"tell_friend" => "
http://mike.mm1swebcreations.com/lj/silk/email_go.png",
"watch_comments" => "
http://mike.mm1swebcreations.com/lj/silk/map_add.png",
"unwatch_comments" => "
http://mike.mm1swebcreations.com/lj/silk/map_delete.png",
"nav_next" => "
http://mike.mm1swebcreations.com/lj/silk/arrow_right.png",
"comment_parent" => "
http://mike.mm1swebcreations.com/lj/silk/arrow_up.png",
"comment_reply" => "
http://mike.mm1swebcreations.com/lj/silk/comment_add.png",
"comment_thread" => "
http://mike.mm1swebcreations.com/lj/silk/comment.png",
"delete_comment" => "
http://mike.mm1swebcreations.com/lj/silk/cancel.png",
"freeze_thread" => "
http://mike.mm1swebcreations.com/lj/silk/lightbulb_off.png",
"screen_comment" => "
http://mike.mm1swebcreations.com/lj/silk/eye_cross.png",
"unscreen_comment" => "
http://mike.mm1swebcreations.com/lj/silk/eye.png",
"unfreeze_thread" => "
http://mike.mm1swebcreations.com/lj/silk/lightbulb.png",
"unwatch_thread" => "
http://mike.mm1swebcreations.com/lj/silk/map_delete.png",
"watch_thread" => "
http://mike.mm1swebcreations.com/lj/silk/map_add.png",
"watching_parent" => "
http://mike.mm1swebcreations.com/lj/silk/map_magnify.png",
};
# if there aren't any links defined in the array, let's add 'em
$add_links = (size($link_keyseq) < 1);
# define permalink data
$link_key = "permalink";
$link_captions{$link_key} = $*text_permalink;
$link_urls{$link_key} = $.permalink_url;
# if we're viewing an entry
if($interentry) {
# get previous entry link data
$link_key = "nav_prev";
$link = $this->get_link($link_key);
$link_captions{$link_key} = $link_captions{$link_key} != "" ? $link_captions{$link_key} : $link.caption;
$link_images{$link_key} = $link_images{$link_key} != "" ? $link_images{$link_key} : $link.icon.url;
$link_urls{$link_key} = $link_urls{$link_key} != "" ? $link_urls{$link_key} : $link.url;
# if we're adding links
if($add_links) {
# add it to the array
$link_keyseq[size($link_keyseq)] = $link_key;
}
}
# cycle thru links and gather data
foreach $link_key ($.link_keyseq) {
$link = $this->get_link($link_key);
$link_captions{$link_key} = $link_captions{$link_key} != "" ? $link_captions{$link_key} : $link.caption;
$link_images{$link_key} = $link_images{$link_key} != "" ? $link_images{$link_key} : $link.icon.url;
$link_urls{$link_key} = $link_urls{$link_key} != "" ? $link_urls{$link_key} : $link.url;
# if we're adding links
if($add_links) {
# add it to the array
$link_keyseq[size($link_keyseq)] = $link_key;
}
}
# if we're viewing an entry
if($interentry) {
# get next entry link data
$link_key = "nav_next";
$link = $this->get_link($link_key);
$link_captions{$link_key} = $link_captions{$link_key} != "" ? $link_captions{$link_key} : $link.caption;
$link_images{$link_key} = $link_images{$link_key} != "" ? $link_images{$link_key} : $link.icon.url;
$link_urls{$link_key} = $link_urls{$link_key} != "" ? $link_urls{$link_key} : $link.url;
# if we're adding links
if($add_links) {
# add it to the array
$link_keyseq[size($link_keyseq)] = $link_key;
}
}
# give linkbar a css class
$print = $print + """""";
# if we've got links to process
if(size($link_keyseq) > 0) {
# if we're adding a first sep
if($first_sep) {
# add it
$print = $print + $link_sep;
}
# cycle thru links
foreach $link_key ($link_keyseq) {
var bool have_img = $link_images{$link_key} != ""; # do we have an image?
var bool have_url = $link_urls{$link_key} != ""; # do we have a url?
# if we have a url
if($have_url) {
# set the link text
$link_link = $link_captions{$link_key};
# if we have an image
if($have_img) {
# add the image
$link_link = """
""";
}
# if we have a url, apply it
$link_link = """
$link_link""";
# add a link sep
$print = $print + $link_link + $link_sep;
}
}
# if we don't have a sep on the end
if(not $last_sep) {
# hack it off
$print = $print->substr(0, $print->length() - $link_sep->length());
}
}
# close span
$print = $print + "";
# print linkbar
print $print;
}
function Entry::print_metadata() {
var string[] metadata = [];
var string{} meta_images = {};
var string{} meta_labels = {};
# define the meta order
# location : current location
# mood : current mood
# music : current music
# tags : current tags
$metadata = [ # location, mood, music, tags
"location",
"mood",
"music",
"tags"
];
# define the meta labels
$meta_labels = {
"location" => lang_metadata_title("location"),
"mood" => lang_metadata_title("mood"),
"music" => lang_metadata_title("music"),
"picture_keyword" => "Picture Keyword:",
"tags" => "Current Tags:",
};
# define the meta images
$meta_images = {
"location" => "
http://mike.mm1swebcreations.com/lj/silk/map_magnify.png",
"mood" => "
http://mike.mm1swebcreations.com/lj/silk/user.png",
"music" => "
http://mike.mm1swebcreations.com/lj/silk/music.png",
"picture_keyword" => "",
"tags" => "
http://mike.mm1swebcreations.com/lj/silk/tag_blue.png",
};
var string currents_open = """
"""; # html to open metadata container
var string meta_label_open = """
"""; # html to open metadata label
var string meta_label_close = """"""; # html to close metadata label
var string meta_val_open = " "; # html to open metadata value
var string meta_val_close = """"""; # html to close metadata value
var string currents_close = """"""; # html to close metadata container
var bool vanilla_loc = false; # strip current location value?
var bool have_meta = (size($.metadata) > 0); # do we have meta?
var bool have_tags = ((size($.tags) > 0) and $*tags_aware); # do we have tags?
var int tcount = 0;
var string currents = "";
var string image = "";
var string k = "";
var string label = "";
var string meta = "";
var string tag = "";
var string val = "";
var Tag t = new Tag;
# if we have meta or we have tags
if($have_meta or $have_tags) {
# add opening of metadata container
$currents = $currents + $currents_open;
# cycle thru meta
foreach $k ($metadata) {
$label = $meta_labels{$k} != "" ? $meta_labels{$k} : lang_metadata_title($k); # get label
$image = $meta_images{$k} != "" ? $meta_images{$k} : ""; # get image
$val = $.metadata{$k}; # get value
# if we have an image
if($image != "") {
# add it
$label = """
""";
}
# if we're doing the location and we're stripping t
if(($k == "location") and $vanilla_loc) {
# do it
$val = striphtml($val);
}
# this piece of meta has a specific class
$meta_label_open = """
""";
# if we're doing tags
if($k == "tags") {
# clear val
$val = "";
# if we have tags
if($have_tags) {
# cycle thru tags
foreach $t ($.tags) {
$tag = """
$t.name"""; # build tag
$val = $val + $tag; # add tag to val
$tcount++; # increment tag counter
# if current count is less than the size of the tags
if($tcount < size($.tags)) {
# add a sep
$val = $val + ", ";
}
}
}
}
# if we have a val
if($val != "") {
# build meta row
$meta = $meta_label_open + $label + $meta_label_close + $meta_val_open + $val + $meta_val_close;
}
# add meta
$currents = $currents + $meta;
}
# add closing of metadata container
$currents = $currents + $currents_close;
}
# print metadata
print $currents;
}