/[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 1139 by dpavlin, Wed Apr 22 12:51:23 2009 UTC revision 1140 by dpavlin, Wed Apr 22 13:20:49 2009 UTC
# Line 40  sub show_pager { Line 40  sub show_pager {
40                  push @show_pages, ( $pager->current_page + 1 .. $pager->current_page + $after_current + $range_around, '', $pager->last_page );                  push @show_pages, ( $pager->current_page + 1 .. $pager->current_page + $after_current + $range_around, '', $pager->last_page );
41          }          }
42    
43          dump_yaml( 'show_pages', \@show_pages );  #       dump_yaml( 'show_pages', \@show_pages );
44    
45          return '' unless $#show_pages;          return '' unless $#show_pages;
46    
47          my ( $prev, $next ) = ( '<<', '>>' );          my ( $prev, $next ) = ( '<<', '>>' );
48    
49          return          return
50                    $pager->previous_page ? $coderef->( $pager->previous_page, $prev ) : $prev                    $pager->previous_page ? $coderef->( $pager->previous_page, $prev ) : qq|<span class=skip>$prev</span>|
51                  , join( ' ', map {                  , join( ' ', map {
52                          if ( $_ == $pager->current_page ) {                          if ( $_ == $pager->current_page ) {
53                                  qq|<span class=current_page>$_</span>|;                                  qq|<span class=current_page>$_</span>|;
# Line 57  sub show_pager { Line 57  sub show_pager {
57                                  $coderef->( $_ );                                  $coderef->( $_ );
58                          }                          }
59                  } @show_pages )                  } @show_pages )
60                  , $pager->next_page ? $coderef->( $pager->next_page, $next ) : $next                  , $pager->next_page ? $coderef->( $pager->next_page, $next ) : qq|<span class=skip>$next</span>|
61                  ;                  ;
62                                    
63  }  }
# Line 130  if ( my $search = param('search') ) { Line 130  if ( my $search = param('search') ) {
130          my $nres = $node->search( $cond, 0 );          my $nres = $node->search( $cond, 0 );
131          $pager->total_entries( $nres->hits );          $pager->total_entries( $nres->hits );
132    
133    
134          dump_yaml( 'cond', $cond );          dump_yaml( 'cond', $cond );
135    
136          if ( ! $nres ) {          if ( ! $nres ) {
# Line 137  if ( my $search = param('search') ) { Line 138  if ( my $search = param('search') ) {
138                  printf qq|<div class="error">$no_results</div>|, $search;                  printf qq|<div class="error">$no_results</div>|, $search;
139          } else {          } else {
140    
141                  my $results = "Got %d results for search '%s'";                  my $results = "%d results for search '%s' showing results %d - %d on page %d";
142                  printf qq|<div class="message">$results</div>|, $nres->hits, $search;                  printf qq|<div class="message">$results</div>|, $nres->hits, $search, $pager->first, $pager->last, $pager->current_page;
143    
144                  print                  my $pager_html =
                         qq|<div class=pager>|,  
145                          join(' ', show_pager( $pager,                          join(' ', show_pager( $pager,
146                                  sub {                                  sub {
147                                          my ($page,$label) = @_;                                          my ($page,$label) = @_;
# Line 150  if ( my $search = param('search') ) { Line 150  if ( my $search = param('search') ) {
150                                          $label = $page unless defined $label;                                          $label = $page unless defined $label;
151                                          qq|<a href="$url">$label</a>|;                                          qq|<a href="$url">$label</a>|;
152                                  }                                  }
153                          )),                          ))
                         qq|</div>|  
154                  ;                  ;
155    
156                    print qq|<div class="pager top">$pager_html</div>| if $pager_html;
157    
158                  my $start = $pager->first;                  my $start = $pager->first;
159                  print qq|<ol start=$start>|;                  print qq|<ol start=$start>|;
160    
# Line 175  if ( my $search = param('search') ) { Line 176  if ( my $search = param('search') ) {
176                          print qq|</li>\n|;                          print qq|</li>\n|;
177                  }                  }
178                  print qq|</ol>|;                  print qq|</ol>|;
179    
180                    print qq|<div class="pager bottom">$pager_html</div>| if $pager_html;
181          }          }
182          print qq|</div>|;          print qq|</div>|;
183    

Legend:
Removed from v.1139  
changed lines
  Added in v.1140

  ViewVC Help
Powered by ViewVC 1.1.26