From 86a26a896db925d5d3ee8e0d6ed226a565214912 Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 20 Oct 2005 11:27:13 +0000 Subject: =?UTF-8?q?comincia=20a=20far=20finta=20di=20andare.=20le=20icone?= =?UTF-8?q?=20non=20vengono=20caricate,=20non=20so=20perch=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Bookmarks/C/Main.pm | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'lib/Bookmarks/C') diff --git a/lib/Bookmarks/C/Main.pm b/lib/Bookmarks/C/Main.pm index 7182a9e..89c985d 100644 --- a/lib/Bookmarks/C/Main.pm +++ b/lib/Bookmarks/C/Main.pm @@ -23,17 +23,43 @@ Catalyst component. =cut -sub default : Private { - my ( $self, $c ) = @_; - $c->res->redirect($c->req->base,'/tags'); -} - sub tags : Global { my ( $self, $c ) = @_; $c->stash->{template}='tags'; $c->stash->{tags}=[Bookmarks::M::DB::Tags->get_all_tags_by_popularity()]; } +sub tag : Regex('^tag/(.*)$') { + my ( $self, $c ) = @_; + + my $tagname=$c->req->snippets->[0]; + my ($tag)=Bookmarks::M::DB::Tags->search({name=>$tagname}); + if (!defined $tag) { + $c->stash->{tagname}=$tagname; + $c->stash->{template}='notag'; + } + else { + my @links=$tag->ordered_links(); + $c->stash->{tag}=$tag; + $c->stash->{links}=[@links]; + $c->stash->{template}='links'; + } +} + +sub icon : Global { + my ( $self, $c ) = @_; + + my $link=Bookmarks::M::DB::Links->retrieve($c->req->param('link')); + if ($link->icon()) { + $c->res->content_type('image/x-icon'); + $c->res->body($link->icon()); + } + else { + $c->res->status(404); + $c->res->body('nonce'); + } +} + =back -- cgit v1.2.3