/[webpac2]/Webpacus2/lib/Webpacus/View.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

Contents of /Webpacus2/lib/Webpacus/View.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1086 - (show annotations)
Sun Dec 23 22:07:55 2007 UTC (16 years, 4 months ago) by dpavlin
File size: 2687 byte(s)
hidra template

1 package Webpacus::View;
2
3 use strict;
4 use warnings;
5
6 use Jifty::View::Declare -base;
7
8 use Data::Dump qw/dump/;
9
10
11 template '/' => page {
12 my $action = new_action( class => 'Search' );
13 h1 { _("Search out data") },
14 form {
15 render_param( $action => 'field', default_value => get('field') ),
16 render_param( $action => 'database', default_value => get('database') ),
17 render_param( $action => 'query', default_value => get('query') ),
18 form_submit(
19 label => _('Search'),
20 );
21 };
22
23 # warn "## action->result->content = ",dump( $action->result->content );
24
25 my $results = $action->result->content( 'results' );
26 #warn "## results = ",dump( $results );
27
28 if ( $results ) {
29 ul {
30 while ( my $ds = $results->next ) {
31 warn "view :: ds = ",dump( $ds );
32 li {
33 show( $action->argument_value('database'), $ds )
34 }
35 }
36 }
37 }
38 };
39
40 #
41 # Webpacus biblographic result template
42 #
43
44 private template 'webpacus' => sub {
45 my $self = shift;
46 my $ds = shift || die "no ds?";
47 div {
48 $ds->display( 'TitleProper' ) . '. ' . $ds->display( 'Series' )
49 }
50 div { $ds->display( 'DatePublication' ) }
51 my $po = $ds->display( 'PripadajuciOznaka' );
52 warn('$po=',dump($po));
53 my @po = $ds->display( 'PripadajuciOznaka' );
54 warn('@po=',dump(@po));
55 ul { attr { class => 'linked'};
56 foreach my $i ( @po ) {
57 warn("i=",dump($i));
58 foreach my $j ( @$i ) {
59 warn("j=",dump($j));
60 li { $j }
61 }
62 }
63 }
64 div { $ds->display( 'Fond' ) }
65 div { $ds->display( 'ISBN' ) }
66 tt { $ds->display( 'database' ) . '/' . $ds->display( 'input' ) . '/' . $ds->display( 'id' ) }
67 };
68
69 #
70 # PerlMonks node result
71 #
72
73 private template 'perlmonks' => sub {
74 my $self = shift;
75 my $ds = shift || die "no ds?";
76
77 div {
78 { class is 'title' }
79 hyperlink(
80 url => 'http://www.perlmonks.org/?node_id=' . $ds->display('Node_ID'),
81 label => $ds->display( 'Title' )
82 );
83 }
84 tt { $ds->display( 'database' ) . '/' . $ds->display( 'input' ) . '/' . $ds->display( 'id' ) }
85 span { { class is 'score' } $ds->display('score') }
86 span { { class is 'date' } _('Date'), ': ', $ds->display( 'Date' ) }
87 span { { class is 'type' } _('Type'), ': ', $ds->display( 'Type' ) }
88
89 my $content = $ds->display( 'Content' );
90 if ( $content ) {
91 div { { class is 'content' } outs_raw($content) }
92 }
93 };
94
95 #
96 # hidra node result
97 #
98
99 private template 'hidra' => sub {
100 my $self = shift;
101 my $ds = shift || die "no ds?";
102
103 warn "## hidra ds == ",dump($ds);
104
105 div {
106 { class is 'title' }
107 hyperlink(
108 url => $ds->display('URL'),
109 label => $ds->display( 'TitleProper' )
110 );
111 };
112
113 tt { $ds->display( 'database' ) . '/' . $ds->display( 'input' ) . '/' . $ds->display( 'id' ) }
114 span { { class is 'score' } $ds->display('score') }
115
116 };
117
118 1;

  ViewVC Help
Powered by ViewVC 1.1.26