/[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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 454 by dpavlin, Wed Nov 19 04:28:27 2008 UTC revision 455 by dpavlin, Wed Nov 19 15:28:23 2008 UTC
# Line 24  has sponge => ( Line 24  has sponge => (
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;
# Line 51  sub data { Line 51  sub data {
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"
# Line 61  sub depends { Line 61  sub depends {
61          warn "# depends";          warn "# depends";
62  }  }
63    
64  sub markup {  sub as_markup {
65          my ($self) = @_;          my ($self) = @_;
66    
67          return qq|          return qq|

Legend:
Removed from v.454  
changed lines
  Added in v.455

  ViewVC Help
Powered by ViewVC 1.1.26