Skip to content

Commit

Permalink
Add LINK REL stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
pudge committed Oct 29, 2001
1 parent 1c12ba4 commit 2c7c400
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
13 changes: 9 additions & 4 deletions Slash/Utility/Anchor/Anchor.pm
Expand Up @@ -102,7 +102,12 @@ sub header {
my $form = getCurrentForm();

my $adhtml = '';
$title ||= '';
if (ref($title)) {
$title->{title} ||= '';
} else {
$title ||= '';
$title = { title => $title };
}

unless ($form->{ssi}) {
my $r = Apache->request;
Expand Down Expand Up @@ -135,10 +140,10 @@ sub header {
$user->{currentSection} = $section || '';
getSectionColors();

$title =~ s/<(.*?)>//g;
$title->{title} =~ s/<(.*?)>//g;

# This is ALWAYS displayed. Let the template handle $title.
slashDisplay('html-header', { title => $title }, { Nocomm => 1 })
slashDisplay('html-header', { title => $title->{title} }, { Nocomm => 1 })
unless $noheader;

# ssi = 1 IS NOT THE SAME as ssi = 'yes'
Expand All @@ -151,7 +156,7 @@ sub header {
# $adhtml = getAd(1);
# }

slashDisplay('header');
slashDisplay('header', $title);

print createMenu('admin') if $user->{is_admin};
}
Expand Down
21 changes: 17 additions & 4 deletions themes/slashcode/htdocs/article.pl
Expand Up @@ -32,14 +32,27 @@ sub main {
"$SECT->{title} | $story->{title}" :
"$constants->{sitename} | $story->{title}";

header($title, $story->{section});
# set things up to use the <LINK> tag in the header
my $next = $slashdb->getStoryByTime('>', $story, $SECT);
my $prev = $slashdb->getStoryByTime('<', $story, $SECT);

my $links = {
title => $title,
'link' => {
section => $SECT->{title},
prev => $prev,
'next' => $next,
author => $story->{uid},
},
};
header($links, $story->{section});

if ($user->{seclev} >= 100) {
my $newestthree = $slashdb->getBlock('newestthree','block');
my $nextthree = $slashdb->getNextThree($story->{time});
my $nextstories = {};

for(@$nextthree) {
for (@$nextthree) {
my $tmpstory = $slashdb->getStory($_->[0], ['title', 'uid', 'time']);
my $author = $slashdb->getUser($tmpstory->{uid},'nickname');
$nextstories->{$_->[0]}{author} = $slashdb->getUser($tmpstory->{uid},'nickname');
Expand All @@ -59,8 +72,8 @@ sub main {
section_block => $slashdb->getBlock($SECT->{section}),
show_poll => $pollbooth ? 1 : 0,
story => $story,
'next' => $slashdb->getStoryByTime('>', $story, $SECT),
prev => $slashdb->getStoryByTime('<', $story, $SECT),
'next' => $next,
prev => $prev,
});

my $discussion = $slashdb->getDiscussionBySid($story->{sid});
Expand Down
22 changes: 21 additions & 1 deletion themes/slashcode/templates/header;misc;default
Expand Up @@ -3,7 +3,7 @@ default
__description__
Text that makes up the top of a page

No specially passed variables
* link, an optional variable with data for the <LINK> tags
__title__

__page__
Expand All @@ -13,6 +13,26 @@ en_US
__name__
header
__template__
[%# reserved for article.pl links only ... others possible. %]
[%# journals, comments, admin story list? %]
[%# should this be a separate template? %]
[% IF env.script_name.search('article\.pl') -%]
[%- IF link.prev %]
<LINK REL="prev" HREF="[% constants.rootdir %]/article.pl?sid=[% link.prev.sid %]" TITLE="[% link.prev.title | strip_attribute %]">
[%- END ; IF link.next %]
<LINK REL="next" HREF="[% constants.rootdir %]/article.pl?sid=[% link.next.sid %]" TITLE="[% link.next.title | strip_attribute %]">
[%- END ; IF link.author # author is uid %]
<LINK REL="author" HREF="[% constants.rootdir %]/search.pl?op=stories&amp;author=[% link.author %]">
[%- END ;
ELSE ; # default author link, where author is a nickname
IF link.author %]
<LINK REL="author" HREF="[% constants.rootdir %]/~[% link.author | fixparam %]/" TITLE="[% link.author | strip_param %]">
[%- END ;
END ; IF link.section %]
<LINK REL="parent" HREF="[% constants.rootdir %]/index.pl?section=[% link.section | fixparam %]" TITLE="[% link.section | strip_attribute %]">
[%- END %]
<LINK REL="top" HREF="[% constants.rootdir %]/" TITLE="[% constants.slogan | strip_attribute %]">
<LINK REL="search" HREF="[% constants.rootdir %]/search.pl" TITLE="Search [% constants.sitename | strip_attribute %]">
</HEAD>
<BODY BGCOLOR="[% user.bg.0 %]" TEXT="[% user.fg.1 %]" LINK="[% user.bg.3 %]" VLINK="[% user.fg.1 %]">

Expand Down

0 comments on commit 2c7c400

Please sign in to comment.