/[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 1170 by dpavlin, Sat Apr 25 21:25:15 2009 UTC revision 1173 by dpavlin, Sat Apr 25 22:26:29 2009 UTC
# Line 22  print header( Line 22  print header(
22    
23  sub dump_yaml {  sub dump_yaml {
24          my $name = shift;          my $name = shift;
25          print qq|<pre># $name\n|, YAML::Dump( @_ ), qq|</pre>| if $debug;          print qq|<div class=dump><tt>$name</tt><pre>|, YAML::Dump( @_ ), qq|</pre></div>| if $debug;
26  }  }
27    
28  sub show_pager {  sub show_pager {
# Line 76  sub show_pager { Line 76  sub show_pager {
76  }  }
77    
78  my $path = $ENV{PATH_INFO} || 'ecas';  my $path = $ENV{PATH_INFO} || 'ecas';
79    $path =~ s{^/+}{};
80    $path =~ s{/+$}{};
81  my $dir = $0;  my $dir = $0;
82  $dir =~ s{/[^/]+.cgi}{};  $dir =~ s{/[^/]+.cgi}{};
83    
84    dump_yaml( 'dir', $dir );
85    
86  my $config = YAML::LoadFile( "$dir/$path/config.yml" );  my $config = YAML::LoadFile( "$dir/$path/config.yml" );
87    
88  my $database = (keys %{ $config->{databases} })[0];  my $database = (keys %{ $config->{databases} })[0];
# Line 133  foreach ( @{ $db->{input} } ) { Line 137  foreach ( @{ $db->{input} } ) {
137    
138  warn "## only_input = ", dump( $only_input );  warn "## only_input = ", dump( $only_input );
139    
140    my @style = ( '../../style.css' );
141    push @style, "../../$path/$path.css" if -e "$dir/$path/$path.css";
142    dump_yaml( 'style', \@style );
143    
144  print  print
145          start_html(          start_html(
146                  -title => $db->{name},                  -title => $db->{name},
147                  -style => '../../style.css',                  -style => [ @style ],
148          ),          ),
149          h1( $db->{name} ),          h1( $db->{name} ),
150          qq|<div id=description>|, $db->{description}, qq|</div>|,          qq|<div id=description>|, $db->{description}, qq|</div>|,
# Line 150  print Line 158  print
158                  popup_menu( -name => 'attr_operator', %$attr_operator ),                  popup_menu( -name => 'attr_operator', %$attr_operator ),
159                  submit,                  submit,
160                  hidden( -name => 'entries_per_page', -default => $entries_per_page ),                  hidden( -name => 'entries_per_page', -default => $entries_per_page ),
161                  hidden( -name => 'current_page', -default => 1 ),                  # we need current_page fixed at 1 so that every submit through form will reset it
162                    qq|<input type=hidden name=current_page value=1 >|,
163                  checkbox( -name => 'debug', -default => 0 ), # FIXME hidden?                  checkbox( -name => 'debug', -default => 0 ), # FIXME hidden?
164                  qq|<div id=inputs>|,                  qq|<div id=inputs>|,
165                  h2( 'Select input' ),                  h2( 'Select input' ),
# Line 172  if ( my $search = param('search') ) { Line 181  if ( my $search = param('search') ) {
181          my $swish = SWISH::API->new( "$dir/../var/swish/$database" );          my $swish = SWISH::API->new( "$dir/../var/swish/$database" );
182          $swish->abort_last_error if $swish->Error;          $swish->abort_last_error if $swish->Error;
183    
         param( 'entries_per_page', $entries_per_page ) unless param('entries_per_page'); # FIXME not needed?  
184          my $pager = Data::Page->new;          my $pager = Data::Page->new;
         $pager->total_entries( param('current_page') * param('entries_per_page') );  
185          $pager->$_( param($_) ) foreach ( qw/entries_per_page current_page/ );          $pager->$_( param($_) ) foreach ( qw/entries_per_page current_page/ );
186    
187          dump_yaml( 'pager', $pager );          dump_yaml( 'pager', $pager );

Legend:
Removed from v.1170  
changed lines
  Added in v.1173

  ViewVC Help
Powered by ViewVC 1.1.26