?

Log in

No account? Create an account
For some reason the developers have seen fit to yank the previous and next links out of the linkbar for individual entries. This is extremely annoying.

Does anybody know how to either turn them back on or hard code them into the linkbar?

Update: Solved by the always amazing kunzite1.

############################################
# settings to change the default link text #
############################################

set text_edit_entry		= "Edit Entry";
set text_edit_tags		= "Edit Tags";
set text_mem_add		= "Add to Memories";
set text_watch_comments		= "Track This";
set text_unwatch_comments	= "UnTrack This";
set text_permalink		= "Link";
set text_entry_prev		= "Previous";
set text_entry_next		= "Next";

#####################################
# linkbar customisation by kunzite1 #
#####################################

function Entry::print_linkbar() {
    var Link link;
    var string url = "";
    var string text = "";
    var string link_key = "";

    print """<div class="asset-meta">\n""";
    print """<ul class="asset-meta-list">>\n""";

    $.comments->print();

    var string{} link_caption = {
        "edit_entry"       => $*text_edit_entry,
        "edit_tags"        => $*text_edit_tags,
        "mem_add"          => $*text_mem_add,
        "watch_comments"   => $*text_watch_comments,
        "unwatch_comments" => $*text_unwatch_comments,
        "nav_prev"         => $*text_entry_prev,
        "nav_next"         => $*text_entry_next,
    };

    foreach $link_key ($.link_keyseq) {
        $link = $this->get_link($link_key);
        if (defined $link) {
            $url = $link.url;
            $text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
            print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
        }
    }

    var Page p = get_page();
    if(($p.view == "entry") or ($p.view == "reply")) {
        foreach $link_key (["nav_prev", "nav_next"]) {
            $link = $this->get_link($link_key);
            if (defined $link) {
                $url = $link.url;
                $text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
                print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
            }
        }
    }

    print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$.permalink_url">$*text_permalink</a></li>""";
    println "\n</ul>\n</div>\n";
}

Tags:

Comments

( 7 comments — Leave a comment )
kunzite1
Sep. 14th, 2006 11:20 am (UTC)
oh yes. i left them out completely on purpose to annoy you. :P
redwolf
Sep. 14th, 2006 11:48 am (UTC)
Cheeky sod. Can I have them back, please, sir?
kunzite1
Sep. 14th, 2006 09:29 pm (UTC)
function Entry::print_linkbar() {
    var Link link;
    var string url = "";
    var string text = "";

    print """<div class="asset-meta">\n""";
    print """<ul class="asset-meta-list">\n""";

    $.comments->print();

    var string{} link_caption = {
        "edit_entry" => $*text_edit_entry,
        "edit_tags" => $*text_edit_tags,
        "mem_add" => $*text_mem_add,
        "watch_comments" => $*text_watch_comments,
        "unwatch_comments" => $*text_unwatch_comments,
    };

    foreach var string link_key ($.link_keyseq) {
        $link = $this->get_link($link_key);
        if (defined $link) {
            $url = $link.url;
            $text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
            print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
        }
    }

    var Page p = get_page();
    if(($p.view == "entry") or ($p.view == "reply")) {
        $link = $this->get_link("nav_prev");
        if (defined $link) {
            $url = $link.url;
            $text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
            print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
        }

        $link = $this->get_link("nav_next");
        if (defined $link) {
            $url = $link.url;
            $text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
            print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
        }
    }

    print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$.permalink_url">$*text_permalink</a></li>""";
    println "\n</ul>\n</div>\n";
}
redwolf
Sep. 14th, 2006 10:35 pm (UTC)
I'm close on this. I needed to define the link captions (those were set earlier in the layer, for those playing at home):

    var string{} link_caption = {
        "edit_entry" => $*text_edit_entry,
        "edit_tags" => $*text_edit_tags,
        "mem_add" => $*text_mem_add,
        "watch_comments" => $*text_watch_comments,
        "unwatch_comments" => $*text_unwatch_comments,
        "unwatch_comments" => $*text_unwatch_comments,
        "unwatch_comments" => $*text_unwatch_comments,
        "nav_prev" => $*text_entry_prev,
        "nav_next" => $*text_entry_next,
    };

But I'm getting an error Unknown local variable $link_key on the red line:

    var Page p = get_page();
    if(($p.view == "entry") or ($p.view == "reply")) {
        $link = $this->get_link("nav_prev");
        if (defined $link) {
            $url = $link.url;
            $text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
            print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
        }

        $link = $this->get_link("nav_next");
        if (defined $link) {
            $url = $link.url;
            $text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
            print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
        }
    }

It doesn't look like $link_key recognises "nav_prev". How do I define it? My brain is brunk this morning and I fully expect it is something mind-numbingly simple that I am overlooking.
kunzite1
Sep. 14th, 2006 10:41 pm (UTC)
bah. stupid logic. this should work:
function Entry::print_linkbar() {
    var Link link;
    var string url = "";
    var string text = "";
    var string link_key = "";

    print """<div class="asset-meta">\n""";
    print """<ul class="asset-meta-list">\n""";

    $.comments->print();

    var string{} link_caption = {
        "edit_entry" => $*text_edit_entry,
        "edit_tags" => $*text_edit_tags,
        "mem_add" => $*text_mem_add,
        "watch_comments" => $*text_watch_comments,
        "unwatch_comments" => $*text_unwatch_comments,
        "nav_prev" => $*text_entry_prev,
        "nav_next" => $*text_entry_next,
    };

    foreach $link_key ($.link_keyseq) {
        $link = $this->get_link($link_key);
        if (defined $link) {
            $url = $link.url;
            $text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
            print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
        }
    }

    var Page p = get_page();
    if(($p.view == "entry") or ($p.view == "reply")) {
        foreach $link_key (["nav_prev", "nav_next"]) {
            $link = $this->get_link($link_key);
            if (defined $link) {
                $url = $link.url;
                $text = $link_caption{$link_key} != "" ? $link_caption{$link_key} : $link.caption;
                print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
            }
        }
    }

    print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$.permalink_url">$*text_permalink</a></li>""";
    println "\n</ul>\n</div>\n";
}
redwolf
Sep. 14th, 2006 11:27 pm (UTC)
w00t! Worked a treat. Have added the code to the post so people can grab it in one lump.

Thanks muchly.
redwolf
Sep. 14th, 2006 10:56 pm (UTC)
::sigh:: The caffeine kicked in a little slow this morning:

    var Page p = get_page();
    if(($p.view == "entry") or ($p.view == "reply")) {
        var string prev_key = "nav_prev";
        $link = $this->get_link($prev_key);
        if (defined $link) {
            $url = $link.url;
            $text = $link_caption{$prev_key} != "" ? $link_caption{$prev_key} : $link.caption;
            print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
        }

        var string next_key = "nav_next";
        $link = $this->get_link($next_key);
        if (defined $link) {
            $url = $link.url;
            $text = $link_caption{$next_key} != "" ? $link_caption{$next_key} : $link.caption;
            print """<li class="asset-meta-comments item asset-meta-no-comments"><a href="$url">$text</a></li>""";
        }
    }

Many thanks for your help kunzite1, you're a gem.

For anyone needing to set the text; if needs to go before the linkbar function:

set text_entry_prev = "previous";
set text_entry_next = "next";
( 7 comments — Leave a comment )

March 2016
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  

Powered by LiveJournal.com
Designed by chasethestars