/[webpac2]/trunk/vhost/webpac2.cgi
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/vhost/webpac2.cgi

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

revision 1135 by dpavlin, Tue Apr 21 23:17:21 2009 UTC revision 1137 by dpavlin, Tue Apr 21 23:17:23 2009 UTC
# Line 16  sub dump_yaml { Line 16  sub dump_yaml {
16          print qq|<pre># $name\n|, YAML::Dump( @_ ), qq|</pre>|;          print qq|<pre># $name\n|, YAML::Dump( @_ ), qq|</pre>|;
17  }  }
18    
19  my $path = $ENV{PATH_INFO};  my $path = $ENV{PATH_INFO} || 'ecas';
20  my $dir = $0;  my $dir = $0;
21  $dir =~ s{/[^/]+.cgi}{};  $dir =~ s{/[^/]+.cgi}{};
22    
# Line 25  my $config = YAML::LoadFile( "$dir/$path Line 25  my $config = YAML::LoadFile( "$dir/$path
25  my $database = (keys %{ $config->{databases} })[0];  my $database = (keys %{ $config->{databases} })[0];
26  die "$database not in $path" unless $path =~ m{\Q$database\E};  die "$database not in $path" unless $path =~ m{\Q$database\E};
27    
28    my $html_markup = "$dir/$path/html.pm";
29    my $html_markup_skip;
30    if ( -e $html_markup ) {
31            require $html_markup;
32            $html_markup = $database . '::html';
33    } else {
34            undef $html_markup;
35    }
36    
37  my $estraier = YAML::LoadFile( "$dir/../var/estraier/$database.yaml" );  my $estraier = YAML::LoadFile( "$dir/../var/estraier/$database.yaml" );
38    
39  my $db = $config->{databases}->{$database};  my $db = $config->{databases}->{$database};
# Line 75  if ( my $search = param('search') ) { Line 84  if ( my $search = param('search') ) {
84                  foreach my $i ( 1 .. $nres->doc_num ) {                  foreach my $i ( 1 .. $nres->doc_num ) {
85                          my $rdoc = $nres->get_doc( $i - 1 );                          my $rdoc = $nres->get_doc( $i - 1 );
86                          print qq|<li>|;                          print qq|<li>|;
87                          print qq|<div><label>$_</label><span class=$_>|, $rdoc->attr( $_ ), qq|</span></div>|                          foreach my $attr ( @attr ) {
88                                  foreach @attr;                                  my $v = $rdoc->attr( $attr );
89                                    if ( defined $v && $html_markup && ! $html_markup_skip->{$attr} ) {
90                                            eval "\$v = $html_markup->$attr( \$v );";
91                                            if ( $@ ) {
92                                                    warn "disable html markup for $attr: $@";
93                                                    $html_markup_skip->{$attr} = $@;
94                                            }
95                                    }
96                                    next unless defined $v;
97                                    print qq|<div><label>$attr</label><span class=$attr>$v</span></div>\n|;
98                            }
99                          print qq|</li>\n|;                          print qq|</li>\n|;
100                  }                  }
101                  print qq|</ol>|;                  print qq|</ol>|;
# Line 86  if ( my $search = param('search') ) { Line 105  if ( my $search = param('search') ) {
105    
106  dump_yaml( 'estraier', $estraier );  dump_yaml( 'estraier', $estraier );
107  dump_yaml( 'db', $db );  dump_yaml( 'db', $db );
108    dump_yaml( 'html_markup_skip', $html_markup_skip );
109    
110  print   end_html;  print   end_html;

Legend:
Removed from v.1135  
changed lines
  Added in v.1137

  ViewVC Help
Powered by ViewVC 1.1.26