- Timestamp:
- 05/24/13 00:51:05 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BookmarkApp.pm
r30 r31 84 84 my @all_tags = $bookmarks->get_tags({ selected => $tag }); 85 85 my @cotags = $bookmarks->get_cotags({ tag => \@tags }); 86 87 my $title = 'Bookmarks' . (@tags ? " tagged as " . join(' & ', @tags) : ''); 86 88 87 89 if ($format eq 'json') { … … 102 104 103 105 $xbel->new_document({ 104 title => 'Bookmarks' . ($tag ? " tagged as $tag" : ''),106 title => $title, 105 107 }); 106 108 … … 178 180 $link->{href}->query_form($link->{query}); 179 181 } 180 182 181 183 return $self->tt_process( 182 184 'list.tt', 183 185 { 184 186 base_url => $base_url, 187 title => $title, 185 188 selected_tag => $tag, 186 189 search_tags => \@tags, … … 199 202 200 203 my $tag = $q->param('tag'); 204 my @tags = $q->param('tag'); 205 # special case: handle the empty tag 206 if (@tags == 1 && $tags[0] eq '') { 207 @tags = (); 208 } 209 210 my $title = 'Bookmarks' . (@tags ? " tagged as " . join(' & ', @tags) : ''); 201 211 202 212 require XML::Atom::Feed; … … 205 215 206 216 my $feed = XML::Atom::Feed->new; 207 $feed->title( 'Bookmarks' . ($tag ? " tagged as $tag" : ''));217 $feed->title($title); 208 218 $feed->id($base_uri->canonical . 'feed'); 219 my $html_link = XML::Atom::Link->new; 220 $html_link->type('text/html'); 221 $html_link->rel('alternate'); 222 $html_link->href($base_uri->canonical); 223 $feed->add_link($html_link); 209 224 210 225 # construct a feed from the most recent 12 bookmarks 211 for my $bookmark ($bookmarks->get_bookmarks({ tag => $tag, limit => 12 })) {226 for my $bookmark ($bookmarks->get_bookmarks({ tag => \@tags, limit => 12 })) { 212 227 my $entry = XML::Atom::Entry->new; 213 $entry->id($bookmark-> {bookmark_uri});214 $entry->title($bookmark-> {title});228 $entry->id($bookmark->bookmark_uri->canonical); 229 $entry->title($bookmark->title); 215 230 my $link = XML::Atom::Link->new; 216 $link->href($bookmark-> {uri});231 $link->href($bookmark->uri); 217 232 $entry->add_link($link); 218 $entry->summary('Tags: ' . join(', ', @{ $bookmark-> {tags}}));233 $entry->summary('Tags: ' . join(', ', @{ $bookmark->tags })); 219 234 $feed->add_entry($entry); 220 235 } -
trunk/list.tt
r29 r31 1 1 <html> 2 2 <head> 3 <title> Bookmarks</title>3 <title>[% title %]</title> 4 4 <base href="[% base_url %]"/> 5 5 <style type="text/css">
Note: See TracChangeset
for help on using the changeset viewer.