From 7d83b76289605efa52cf631d184093d0096383c5 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 26 Jul 2007 14:39:31 +0200 Subject: [PATCH] Add a link from the front page to the tag cloud (and back) if there are any tags. --- files/pr0n.css | 4 ++++ perl/Sesse/pr0n/Common.pm | 2 +- perl/Sesse/pr0n/Listing.pm | 9 +++++++++ templates/default/mainmenu-events | 1 + templates/default/mainmenu-tags | 1 + 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 templates/default/mainmenu-events create mode 100644 templates/default/mainmenu-tags diff --git a/files/pr0n.css b/files/pr0n.css index acc7ed4..6a27dc1 100644 --- a/files/pr0n.css +++ b/files/pr0n.css @@ -49,6 +49,10 @@ li { font-size: small; font-weight: normal; } +.mainmenu { + font-size: small; + padding-left: 0em; +} * { /* border: 1px solid red; */ } diff --git a/perl/Sesse/pr0n/Common.pm b/perl/Sesse/pr0n/Common.pm index 43ea988..5d5b2be 100644 --- a/perl/Sesse/pr0n/Common.pm +++ b/perl/Sesse/pr0n/Common.pm @@ -268,7 +268,7 @@ sub update_image_info { undef, $id) or die "Couldn't delete old tag information in SQL: $!"; - my $q = $dbh->prepare('INSERT INTO tags (image,tag) VALUES (?,?)') + $q = $dbh->prepare('INSERT INTO tags (image,tag) VALUES (?,?)') or die "Couldn't prepare inserting tag information: $!"; for my $tag (@tags) { diff --git a/perl/Sesse/pr0n/Listing.pm b/perl/Sesse/pr0n/Listing.pm index d344083..b871e88 100644 --- a/perl/Sesse/pr0n/Listing.pm +++ b/perl/Sesse/pr0n/Listing.pm @@ -43,6 +43,7 @@ sub handler { or dberror($r, "Couldn't get events"); Sesse::pr0n::Common::header($r, Sesse::pr0n::Templates::fetch_template($r, 'tag-listing')); + Sesse::pr0n::Templates::print_template($r, 'mainmenu-tags'); my $cloud = HTML::TagCloud->new; @@ -68,6 +69,14 @@ sub handler { or dberror($r, "Couldn't get events"); Sesse::pr0n::Common::header($r, Sesse::pr0n::Templates::fetch_template($r, 'event-listing')); + + # See if there are any tags related to this vhost + my $ref = $dbh->selectrow_hashref('SELECT * FROM tags t JOIN images i ON t.image=i.id WHERE vhost=? LIMIT 1', + undef, $r->get_server_name); + if (defined($ref)) { + Sesse::pr0n::Templates::print_template($r, 'mainmenu-events'); + } + my $allcaption = Sesse::pr0n::Templates::fetch_template($r, 'all-event-title'); $r->print("