Changeset 112 in bookmarks for trunk/lib/Bookmarks/List.pm
- Timestamp:
- 02/17/16 22:05:50 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Bookmarks/List.pm
r106 r112 32 32 text => 'JSON', 33 33 type => 'application/json', 34 path => 'list', 34 35 query => { 35 36 %$query, … … 40 41 text => 'XBEL', 41 42 type => 'application/xml', 43 path => 'list', 42 44 query => { 43 45 %$query, … … 56 58 text => 'CSV', 57 59 type => 'text/csv', 60 path => 'list', 58 61 query => { 59 62 %$query, … … 64 67 text => 'URI List', 65 68 type => 'text/uri-list', 69 path => 'list', 66 70 query => { 67 71 %$query, … … 72 76 text => 'HTML', 73 77 type => 'text/html', 78 path => 'list', 74 79 query => { 75 80 %$query, … … 105 110 sub as_xbel { 106 111 my $self = shift; 107 require XML::XBEL; 108 #TODO: conditional support; if XML::XBEL is not present, return a 5xx response 112 113 eval { require XML::XBEL; } or 114 return [406, ['Content-Type' => 'text/plain'], ['This server does not support XBEL lists']]; 109 115 110 116 my $xbel = XML::XBEL->new; … … 147 153 sub as_csv { 148 154 my $self = shift; 149 require Text::CSV::Encoded; 155 156 eval { require Text::CSV::Encoded } or 157 return [406, ['Content-Type' => 'text/plain'], ['This server does not support CSV lists']]; 158 150 159 my $csv = Text::CSV::Encoded->new({ encoding_out => 'utf8' }); 151 160 my $text = qq{id,uri,title,tags,ctime,mtime\n}; … … 182 191 my $template = Template->new({ INCLUDE_PATH => File::Basename::dirname($INC{'Bookmarks/List.pm'}) }); 183 192 184 my @all_tags = $self->bookmarks->get_tags({ selected => @{ $self->tags }[0] });185 my @cotags = $self->bookmarks->get_cotags({ search => $self->search });186 187 193 $template->process( 188 ' list.tt',194 'html_list.tt', 189 195 { 190 196 base_url => $self->bookmarks->base_uri, 191 197 title => $self->title, 192 198 query => $self->query, 193 selected_tag => @{ $self->tags }[0],194 search_tags => $self->tags,195 199 links => [ $self->_get_list_links('text/html', { q => $self->query, tag => $self->tags }) ], 196 all_tags => \@all_tags,197 cotags => \@cotags,198 200 resources => $self->results, 199 201 pages => $self->search->pages, … … 207 209 my $self = shift; 208 210 209 require XML::Atom; 211 eval { require XML::Atom } or 212 return [406, ['Content-Type' => 'text/plain'], ['This server does not support Atom lists']]; 213 210 214 $XML::Atom::DefaultVersion = "1.0"; 211 215
Note: See TracChangeset
for help on using the changeset viewer.