/[Frey]/trunk/lib/Frey/View/Exhibit.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/Frey/View/Exhibit.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 449 - (hide annotations)
Wed Nov 19 04:13:02 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 1345 byte(s)
Exhibit view integration
1 dpavlin 449 package Frey::View::Exhibit;
2     use Moose;
3    
4     extends 'Frey';
5     with 'Frey::Web';
6    
7     use MooseX::Types::Moose qw(Str Int ArrayRef);
8     use MooseX::Types::Structured qw/Dict/;
9    
10     use Data::Dump qw/dump/;
11    
12     =head1 DESCRIPTION
13    
14     present C<sponge> as Exhibit from L<http://simile.mit.edu/exhibit/>
15    
16     =cut
17    
18     has sponge => (
19     is => 'rw',
20     isa => Dict[
21     rows => ArrayRef[ArrayRef],
22     NAME => ArrayRef[Str],
23     ],
24     # required => 1,
25     );
26    
27     sub data {
28     my ($self) = @_;
29    
30     confess "need sponge" unless $self->sponge;
31    
32     my $items;
33     my $names = $self->sponge->{NAME};
34    
35     foreach my $row ( @{ $self->sponge->{rows} } ) {
36     my $item;
37     map { $item->{ $names->[$_] } = $row->[$_] } ( 0 .. $#{ $row } );
38     push @{ $items->{items} }, $item;
39     }
40    
41     return $items;
42     }
43    
44     sub depends {
45     my ($self) = @_;
46     $self->add_head(qq{
47     <link href="/Frey::Pipe/markup?pipe=Frey::DelIcioUs/sponge|Frey::View::Exhibit/data|Frey::JSON/markup"
48     type="application/json" rel="exhibit/data" />
49     });
50     $self->add_head(qq|
51     <script src="http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js"
52     type="text/javascript"></script>
53     |);
54     warn "# depends";
55     }
56    
57     sub markup {
58     my ($self) = @_;
59    
60     return qq|
61     <table width="100%">
62     <tr valign="top">
63     <td ex:role="viewPanel">
64     <div ex:role="view"></div>
65     </td>
66     <td width="25%">
67     browsing controls here...
68     </td>
69     </tr>
70     </table>
71     |;
72     }
73    
74     1;

  ViewVC Help
Powered by ViewVC 1.1.26