]> git.sesse.net Git - pr0n/commitdiff
Add a link from the front page to the tag cloud (and back) if there are any
authorSteinar H. Gunderson <sesse@debian.org>
Thu, 26 Jul 2007 12:39:31 +0000 (14:39 +0200)
committerSteinar H. Gunderson <sesse@debian.org>
Thu, 26 Jul 2007 12:39:31 +0000 (14:39 +0200)
tags.

files/pr0n.css
perl/Sesse/pr0n/Common.pm
perl/Sesse/pr0n/Listing.pm
templates/default/mainmenu-events [new file with mode: 0644]
templates/default/mainmenu-tags [new file with mode: 0644]

index acc7ed422321159e9ee3e1a1dacbdf4ff50987ab..6a27dc1fcbcb8f5c6604620a4ff63931ce4a5321 100644 (file)
@@ -49,6 +49,10 @@ li {
        font-size: small;
        font-weight: normal;
 }
+.mainmenu {
+       font-size: small;
+       padding-left: 0em;
+}
 * {
 /*     border: 1px solid red; */
 }
index 43ea98853ffbd6e41f9e108512009d46063f1cb5..5d5b2be1602f7c06c57b73d88fd4b000bad0b6e3 100644 (file)
@@ -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) {
index d344083a0518225fcbaf36c8ce4430b0cc89577b..b871e88d1451170fb8566d27f2f76a1a6a5a88a8 100644 (file)
@@ -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("    <ul>\n");
                $r->print("      <li><a href=\"+all/\">$allcaption</a></li>\n");
diff --git a/templates/default/mainmenu-events b/templates/default/mainmenu-events
new file mode 100644 (file)
index 0000000..d40f0f3
--- /dev/null
@@ -0,0 +1 @@
+<p class="mainmenu">Events | <a href="/+tags/">Tags</a></p>
diff --git a/templates/default/mainmenu-tags b/templates/default/mainmenu-tags
new file mode 100644 (file)
index 0000000..a6f681e
--- /dev/null
@@ -0,0 +1 @@
+<p class="mainmenu"><a href="/">Events</a> | Tags</p>