24 |
# required => 1, |
# required => 1, |
25 |
); |
); |
26 |
|
|
27 |
sub data { |
sub as_data { |
28 |
my ($self) = @_; |
my ($self) = @_; |
29 |
|
|
30 |
confess "need sponge" unless $self->sponge; |
confess "need sponge" unless $self->as_sponge; |
31 |
|
|
32 |
my $items; |
my $items; |
33 |
my $names = $self->sponge->{NAME}; |
my $names = $self->as_sponge->{NAME}; |
34 |
|
|
35 |
my $id = 0; |
my $id = 0; |
36 |
my $have_id = grep { m{^id$} } @$names; |
my $have_id = grep { m{^id$} } @$names; |
37 |
my $have_label = grep { m{^label$} } @$names; |
my $have_label = grep { m{^label$} } @$names; |
38 |
|
|
39 |
foreach my $row ( @{ $self->sponge->{rows} } ) { |
foreach my $row ( @{ $self->as_sponge->{rows} } ) { |
40 |
my $item; |
my $item; |
41 |
map { $item->{ $names->[$_] } = $row->[$_] } ( 0 .. $#{ $row } ); |
map { $item->{ $names->[$_] } = $row->[$_] } ( 0 .. $#{ $row } ); |
42 |
$item->{id} = $id unless $have_id; |
$item->{id} = $id unless $have_id; |
51 |
sub depends { |
sub depends { |
52 |
my ($self) = @_; |
my ($self) = @_; |
53 |
$self->add_head(qq{ |
$self->add_head(qq{ |
54 |
<link href="/Frey::Pipe/markup?pipe=Frey::DelIcioUs/sponge|Frey::View::Exhibit/data|Frey::JSON/markup" |
<link href="/Frey::Pipe/as_markup?pipe=Frey::DelIcioUs/as_sponge|Frey::View::Exhibit/as_data|Frey::JSON/as_markup" |
55 |
type="application/json" rel="exhibit/data" /> |
type="application/json" rel="exhibit/as_data" /> |
56 |
}); |
}); |
57 |
$self->add_head(qq| |
$self->add_head(qq| |
58 |
<script src="http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js" |
<script src="http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js" |
61 |
warn "# depends"; |
warn "# depends"; |
62 |
} |
} |
63 |
|
|
64 |
sub markup { |
sub as_markup { |
65 |
my ($self) = @_; |
my ($self) = @_; |
66 |
|
|
67 |
return qq| |
return qq| |