/[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 1081 - (show annotations)
Sun Dec 2 03:00:07 2007 UTC (16 years, 7 months ago) by dpavlin
File size: 2174 byte(s)
better search results (some css design)

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 dump( $action->result->content );
24
25 if ( my $results = $action->result->content( 'results' ) ) {
26 ul {
27 while ( my $ds = $results->next ) {
28 warn "view :: ds = ",dump( $ds );
29 li {
30 show( $action->argument_value('database'), $ds )
31 }
32 }
33 }
34 }
35 };
36
37 #
38 # Webpacus biblographic result template
39 #
40
41 private template 'webpacus' => sub {
42 my $self = shift;
43 my $ds = shift || die "no ds?";
44 div {
45 $ds->display( 'TitleProper' ) . '. ' . $ds->display( 'Series' )
46 }
47 div { $ds->display( 'DatePublication' ) }
48 my $po = $ds->display( 'PripadajuciOznaka' );
49 warn('$po=',dump($po));
50 my @po = $ds->display( 'PripadajuciOznaka' );
51 warn('@po=',dump(@po));
52 ul { attr { class => 'linked'};
53 foreach my $i ( @po ) {
54 warn("i=",dump($i));
55 foreach my $j ( @$i ) {
56 warn("j=",dump($j));
57 li { $j }
58 }
59 }
60 }
61 div { $ds->display( 'Fond' ) }
62 div { $ds->display( 'ISBN' ) }
63 tt { $ds->display( 'database' ) . '/' . $ds->display( 'input' ) . '/' . $ds->display( 'id' ) }
64 };
65
66 #
67 # PerlMonks node result
68 #
69
70 private template 'perlmonks' => sub {
71 my $self = shift;
72 my $ds = shift || die "no ds?";
73
74 div {
75 { class is 'title' }
76 hyperlink(
77 url => 'http://www.perlmonks.org/?node_id=' . $ds->display('Node_ID'),
78 label => $ds->display( 'Title' )
79 );
80 }
81 tt { $ds->display( 'database' ) . '/' . $ds->display( 'input' ) . '/' . $ds->display( 'id' ) }
82 span { { class is 'score' } $ds->display('score') }
83 span { { class is 'date' } _('Date'), ': ', $ds->display( 'Date' ) }
84 span { { class is 'type' } _('Type'), ': ', $ds->display( 'Type' ) }
85
86 my $content = $ds->display( 'Content' );
87 if ( $content ) {
88 div { { class is 'content' } outs_raw($content) }
89 }
90 };
91
92 1;

  ViewVC Help
Powered by ViewVC 1.1.26