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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1000 - (hide annotations)
Sun Nov 4 17:19:12 2007 UTC (16 years, 5 months ago) by dpavlin
File size: 1740 byte(s)
 r1540@llin:  dpavlin | 2007-11-04 18:19:13 +0100
 make private template for each database

1 dpavlin 946 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 dpavlin 999 render_param( $action => 'database', default_value => get('database') ),
17 dpavlin 946 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 dpavlin 963 while ( my $ds = $results->next ) {
28     warn "view :: ds = ",dump( $ds );
29 dpavlin 946 li {
30 dpavlin 1000 show( $action->argument_value('database'), $ds )
31 dpavlin 946 }
32     }
33     }
34     }
35 dpavlin 1000 };
36 dpavlin 946
37 dpavlin 1000 #
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 dpavlin 946 };
65    
66 dpavlin 1000 #
67     # PerlMonks node result
68     #
69    
70     private template 'perlmonks' => sub {
71     my $self = shift;
72     my $ds = shift || die "no ds?";
73     div {
74     $ds->display( 'Title' );
75     }
76     tt { $ds->display( 'database' ) . '/' . $ds->display( 'input' ) . '/' . $ds->display( 'id' ) }
77     };
78    
79 dpavlin 946 1;

  ViewVC Help
Powered by ViewVC 1.1.26