/[webpac]/trunk/WebPac.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

Diff of /trunk/WebPac.pm

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

revision 47 by dpavlin, Sun Mar 23 01:17:49 2003 UTC revision 677 by dpavlin, Thu Feb 24 09:11:35 2005 UTC
# Line 3  package WebPac; Line 3  package WebPac;
3  use base 'CGI::Application';  use base 'CGI::Application';
4  use strict;  use strict;
5    
 use HTML::Pager;  
6  use HTML::FillInForm;  use HTML::FillInForm;
7  use SWISH;  use SWISH::API;
8  use Text::Iconv;  use Text::Iconv;
9  use DBI;  use DBI;
10    use Config::IniFiles;
11    use Text::Unaccent;
12    use Data::Pageset;
13    
14  use lib '..';  use lib '..';
15  use index_DBI;  use index_DBI_filter;
16  use back2html;  use back2html;
17    
18  # configuration options  
19  # FIX: they really should go in configuration file!  # read global.conf configuration
20  my $TEMPLATE_PATH = '/data/webpac/template_html';  my $cfg_global = new Config::IniFiles( -file => '../global.conf' ) || die "can't open 'global.conf'";
21  my $CHARSET = 'ISO-8859-2';  
22  my $SWISH = '/usr/bin/swish-e';  # configuration options from global.conf
23  my $INDEX = '/data/webpac/index/isis.index';  my $TEMPLATE_PATH = $cfg_global->val('webpac', 'template_html') || die "need template_html in global.conf, section webpac";
24  my $MAX_HITS = 500;  my $CHARSET = $cfg_global->val('webpac', 'charset') || 'ISO-8859-1';
25  my $ON_PAGE = 10;  my $SWISH = $cfg_global->val('webpac', 'swish') || '/usr/bin/swish-e';
26    my $INDEX = $cfg_global->val('webpac', 'index') || die "need index in global.conf, section webpac";
27    my $MAX_HITS = $cfg_global->val('webpac', 'max_hits') || 0;
28    my $ON_PAGE =$cfg_global->val('webpac', 'on_page') || 10;
29    my $MIN_WILDCARD =$cfg_global->val('webpac', 'min_wildcard') || 1;
30    my $TEMPLATE =$cfg_global->val('webpac', 'template');
31    my $UNAC_FILTER =$cfg_global->val('global', 'my_unac_filter');
32    my $BASE_PATH =$cfg_global->val('webpac', 'base_path');
33    # for pager
34    my $pages_per_set = $cfg_global->val('webpac', 'pages_per_set') || 10;
35    
36  Text::Iconv->raise_error(0);     # Conversion errors raise exceptions  Text::Iconv->raise_error(0);     # Conversion errors raise exceptions
37    
38  my $from_utf8 = Text::Iconv->new('UTF8', $CHARSET);  my $from_utf8 = Text::Iconv->new('UTF8', $CHARSET);
39    
40    if ($UNAC_FILTER) {
41            require $UNAC_FILTER;
42    } else {
43            sub WebPac::my_unac_string {
44                    my ($charset, $string) = (@_);
45                    return $string;
46            }
47    }
48    
49    # use path from cgi script to support templates in subdirs
50    sub url_ex {
51            my $q = shift || die "suff2file needs CGI object!";
52            my $tpl = shift || die "url_ex needs template name!";
53            return suff2file($BASE_PATH, $q->url(-absolute => 1,-path => 1),$TEMPLATE_PATH,$tpl);
54    }
55    
56    sub suff2file($$$$) {
57            my ($base_path, $p, $path, $tpl) = @_;
58    
59            return $tpl if (! $base_path);
60    
61            # strip everything to and including base path, leaving only
62            # additional (virtual) path
63            if ($base_path eq "/") {
64                    $p =~ s,/*,,g;
65                    my ($name,$ext) = split(/\./,$tpl);
66                    $p = $name . "-" . $p . "." . $ext;
67            } elsif ($p =~ s,^.*?$base_path,,) {
68                    $p =~ s,/*,,g;
69                    my ($name,$ext) = split(/\./,$tpl);
70                    $p = $name . $p . "." . $ext;
71            } else {
72                    # if unable reset it!
73                    $p = $tpl;
74            }
75    
76            if ( -e "$path/$p") {
77                    return $p;
78            } else {
79                    return $tpl;
80            }
81    
82    }
83    
84  sub setup {  sub setup {
85          my $self = shift;          my $self = shift;
86          $self->tmpl_path($TEMPLATE_PATH);          $self->tmpl_path($TEMPLATE_PATH);
# Line 41  sub setup { Line 96  sub setup {
96          $self->header_props(-charset=>$CHARSET);          $self->header_props(-charset=>$CHARSET);
97  }  }
98    
99    sub in_template {
100            my $q = shift || die "need CGI object!";
101            my $html = shift || die "This page is left unintentionally blank";
102            return $html if (! defined($TEMPLATE));
103    
104            my ($dir,$tpl);
105            if ($TEMPLATE =~ m,^(.*?/*)([^/]+)$,) {
106                    ($dir,$tpl) = ($1,$2);
107            } else {
108                    die "can't parse TEMPLATE path";
109            }
110    
111            my $master_tpl = suff2file($BASE_PATH, $q->url(-absolute => 1, -path => 1),$dir,$tpl);
112            if (open(T, $master_tpl)) {
113                    my $template_html = join("\n",<T>);
114                    close(T);
115                    $template_html =~ s/##webpac##/$html/gsi;
116                    return $template_html;
117            } else {
118                    return "Can't read template '$master_tpl'";
119            }
120    }
121    
122    #--------------------------------------------------------------------------
123    
124    #
125    # make pager navigation and fill template variables
126    # compatibile with HTML::Pager
127    #
128    
129    sub make_pager($$$) {
130            my ($q,$tmpl,$pager) = @_;
131    
132            #
133            # pager navigation
134            #
135            my ($pager_prev,$pager_next, $pager_jump) = ('','','');
136    
137            my $nav_fmt=qq{ <a href="%s">%s</a> };
138    
139            if ($pager->current_page() > $pager->first_page) {
140                    $q->param('PAGER_offset', $pager->current_page - 1);
141                    $pager_prev .= sprintf($nav_fmt,$q->url(-relative=>1, -query=>1),'&lt;&lt;');
142            }
143    
144            if ($pager->previous_set) {
145                    $q->param('PAGER_offset', $pager->previous_set);
146                    $pager_prev .= sprintf($nav_fmt,$q->url(-relative=>1, -query=>1),'..');
147            }
148    
149    
150            foreach my $p (@{$pager->pages_in_set()}) {
151                    next if ($p <= 0);
152                    if($p == $pager->current_page()) {
153                            $pager_jump .= "<b>$p</b> ";
154                    } else {
155                            $q->param('PAGER_offset', $p);
156                            $pager_jump .= sprintf($nav_fmt,$q->url(-relative=>1, -query=>1),$p);
157                    }
158            }
159    
160            if ($pager->next_set) {
161                    $q->param('PAGER_offset', $pager->next_set);
162                    $pager_next .= sprintf($nav_fmt,$q->url(-relative=>1, -query=>1),'..');
163            }
164    
165            if ($pager->current_page() < $pager->last_page) {
166                    $q->param('PAGER_offset', $pager->current_page + 1);
167                    $pager_next .= sprintf($nav_fmt,$q->url(-relative=>1, -query=>1),'&gt;&gt;');
168            }
169    
170            $tmpl->param('PAGER_PREV', $pager_prev);
171            $tmpl->param('PAGER_JUMP', $pager_jump);
172            $tmpl->param('PAGER_NEXT', $pager_next);
173    
174    }
175    
176    #
177    # put persisten variables in template
178    #
179    
180    sub make_pager_vars {
181            my $q = shift @_;
182            my $tmpl = shift @_;
183            my @persist_vars = @_;
184            my $hidden_vars = '';
185            my $hidden_search = '';
186            foreach my $v (@persist_vars) {
187                    foreach my $val ($q->param($v)) {
188                            next if (! $val || $val eq '');
189                            $hidden_vars .= '<input type="hidden" name="'.$v.'" value="'.$val.'"/>'."\n";
190                            $hidden_search .= '<input type="hidden" name="'.$v.'" value="'.$val.'"/>'."\n" if ($v ne "rm");
191                    }
192            }
193    
194            $tmpl->param('PAGER_HIDDEN', $hidden_vars);
195            $tmpl->param('SEARCH_HIDDEN', $hidden_search);
196            $tmpl->param('PAGER_JAVASCRIPT', qq#
197    <SCRIPT LANGUAGE="Javascript">
198    <!-- Begin
199            // dummy emulator for HTML::Pager templates
200            function PAGER_set_offset_and_submit() {
201                    return true;
202            }
203    // End -->
204    </script>  
205            #);
206    }
207    
208    #--------------------------------------------------------------------------
209    
210  sub show_search_form {  sub show_search_form {
211          my $self = shift;          my $self = shift;
212    
213          # Get the CGI.pm query object          # Get the CGI.pm query object
214          my $q = $self->query();          my $q = $self->query();
215    
216          my $tmpl = $self->load_tmpl('search.html');          my $tmpl = $self->load_tmpl(url_ex($q,'search.html'));
217          my $html = $tmpl->output;          my $html = $tmpl->output;
218    
219          my $fif = new HTML::FillInForm;          my $fif = new HTML::FillInForm;
220    
221          return $fif->fill(scalarref => \$html, fobject => $q,          return in_template($q,$fif->fill(scalarref => \$html, fobject => $q,
222                  target => 'search');                  target => 'search'));
223  }  }
224    
225  sub show_results_list {  sub show_results_list {
# Line 61  sub show_results_list { Line 227  sub show_results_list {
227    
228          my $q = $self->query();          my $q = $self->query();
229    
230          my @swish_results;      # results from swish          # submit was reset?
231            if ($q->param('reset')) {
232                    $q->delete_all;
233                    return $self->show_search_form();
234            }
235    
236          # load template for this page          # load template for this page
237    
# Line 70  sub show_results_list { Line 240  sub show_results_list {
240          my @path_arr = $q->param('path');          my @path_arr = $q->param('path');
241          my $full = $q->param('full');          my $full = $q->param('full');
242    
243          for(my $i = 1; $i <=10; $i++) {          my @persist_vars = ( 'rm', 'persist_search' );
244            my @url_params = ( 'rm=results', 'show_full=1', 'last_PAGER_offset='.($q->param('PAGER_offset') || 0) );
245    
246            my @persist_search_vars;
247            my @url_params_persist;
248            if ($q->param("persist_search")) {
249                    @persist_search_vars = split(/\s*,\s*/, $q->param("persist_search"));
250                    push @url_params_persist, "persist_search=".$q->url_param("persist_search");
251                    push @url_params,"persist_search=".$q->url_param("persist_search");
252            }
253    
254            # support parametars "f" and "v" for start
255            for(my $i = 0; $i <=30; $i++) {
256    
257                    $i = '' if ($i == 0);
258    
259                  return show_index($self, $i) if ($q->param("f".$i."_index"));                  return show_index($self, $i) if ($q->param("f".$i."_index"));
260    
261                    next if (! $q->param("v$i") || $q->param("v$i") eq '');
262                  next if (! $q->param("f$i"));                  next if (! $q->param("f$i"));
                 next if (! $q->param("v$i"));  
263    
264                  # re-write query from +/- to and/and not                  my $persist = grep(/^$i$/,@persist_search_vars);
265                  my $s;          
266                  my $search = $q->param("v$i");                  push @persist_vars, "f$i";
267                  while ($search =~ s/\s*("[^"]+")\s*/ /) {                  push @persist_vars, "v$i";
268                          $s .= "$1 ";                  push @persist_vars, "e$i" if ($q->param("e$i"));
269    
270                    # create url parametars (and persistent ones)
271    
272                    push @url_params,"f$i=".$q->url_param("f$i");
273                    push @url_params_persist,"f$i=".$q->url_param("f$i") if ($persist);
274    
275                    foreach my $v ($q->url_param("v$i")) {
276                            # escape quotes so that phrase search work
277                            $v =~ s/"/%22/g;
278                            push @url_params,"v$i=$v";
279                            push @url_params_persist,"v$i=$v" if ($persist);
280                  }                  }
                 $search =~ s/^\s+//;  
                 $search =~ s/\s+$//;  
281    
282                  foreach (split(/\s+/,$search)) {                  if ($q->param("e$i")) {
283                          if (m/^([+-])(\S+)/) {                          push @url_params,"e$i=".$q->url_param("e$i");
284                                  $s.= ($s) ? "and " : "";  #                       push @url_params_persist,"e$i=".$q->url_param("e$i");
                                 $s.="not " if ($1 eq "-");  
                                 $s.="$2* ";  
                         } else {  
                                 $s.="$_* ";  
                         }  
285                  }                  }
                 $s =~ s/\*+/*/g;  
286    
287                  push @s_arr,$q->param("f$i")."_swish=($s)";                  my $wc="*";     # swish wildcard
288                    $wc="" if ($i eq "");   # don't apply wildcard on field 0
289    
290                    # re-write query from +/- to and/and not
291                    my @param_vals = $q->param("v$i");
292                    my @swish_q;
293                    my ($pre,$post,$exact) = ('','','');
294                    while (my $search = shift @param_vals) {
295                            my $s;
296                            # remove accents
297                            $search = my_unac_string($CHARSET,$search);
298                            while ($search =~ s/\s*("[^"]+")\s*/ /) {
299                                    $s .= "$1 ";
300                            }
301                            $search =~ s/^\s+//;
302                            $search =~ s/\s+$//;
303    
304                            # filed e[nr] is exact match bitmask
305                            # 1 = beginning, 2=end, 3=both
306                            my $exact_flag = $q->param("e$i") || 0;
307                            $pre = '"xxbxx ' if ($exact_flag & 1);
308                            $post = ' xxexx"' if ($exact_flag & 2);
309                            # add qotes on other side
310                            if ($q->param("e$i")) {
311                                    $pre = '"' if (! $pre);
312                                    $post = '"' if (! $post);
313                                    # what about wildcards?
314                                    $wc = '';
315                                    $wc = '*' if ($q->param("e$i") & 4);
316                                    $exact = '_exact';
317                            }
318    
319                            foreach (split(/\s+/,$search)) {
320                                    if (m/^([+-])(\S+)/) {
321                                            $s.= ($s) ? "and " : "";
322                                            $s.="not " if ($1 eq "-");
323                                            $s.=$2.$wc." ";
324                                    } elsif (m/^\s*(and|or|not)\s*$/i) {
325                                            $s.=$_." ";
326                                    # don't add * to words with less than x chars
327                                    } elsif (length($_) <= $MIN_WILDCARD) {
328                                            $s.=$_." ";
329                                    } else {
330                                            $s.=$_.$wc." ";
331                                    }
332                            }
333                            $s =~ s/\*+/*/g;
334                            $s = $pre.$s.$post if ($q->param("e$i"));
335                            push @swish_q,$s;
336                    }
337                    # FIXME default operator for multi-value fields is or. There is
338                    # no way to change it, except here for now. Is there need?
339                    push @s_arr, $q->param("f$i")."_swish".$exact."=(".join(" or ",@swish_q).")";
340          }          }
341    
342          my $tmpl = $self->load_tmpl('results.html');          my $tmpl = $self->load_tmpl(url_ex($q,'results.html'), global_vars => 1, die_on_bad_params => 0);
343    
344          # call swish          $tmpl->param('url_params',"?".join("&",@url_params));
         my $sh = SWISH->connect('Fork',  
                 prog     => $SWISH,  
                 indexes  => $INDEX,  
                 properties  => [qw/swishdocpath swishrank swishtitle headline html/],  
                 results  => sub {  
                         my ($sh,$hit) = @_;  
   
                         push @swish_results, {  
                                 nr => ($#swish_results + 2),  
                                 path => $hit->swishdocpath,  
                                 headline => $from_utf8->convert($hit->headline),  
                                 html => back2html($from_utf8->convert($hit->html)),  
                                 rank => $hit->swishrank };  
   
                 },  
                 #startnum => 0,  
                 maxhits => $MAX_HITS  
         );  
345    
346          die $SWISH::errstr unless $sh;          sub esc_html {
347                    my $html = shift;
348                    $html =~ s/</&lt;/g;
349                    $html =~ s/>/&gt;/g;
350                    return $html;
351            }
352    
353            my $sort = 'swishrank';
354            if ($q->param("sort")) {
355                    $sort = 'headline';
356                    push @persist_vars, "sort";
357            }
358    
359            my $sortby = $q->param("sortby");
360            if ($sortby) {
361                    $sort = $sortby;
362                    push @persist_vars, "sortby";
363            }
364            $tmpl->param('url_params_paths',"?".join("&",@url_params).'&'.join("&",map { my $t = $_; $t =~ s/\#/%23/g; "path=$t"; } @path_arr));
365    
366          # construct swish query          # construct swish query
367          my $sw_q = join(" and ",@s_arr);          my $sw_q = join(" and ",@s_arr);
368          if (@path_arr) {          if (@path_arr && $q->param('show_full')) {
369                  $sw_q .= "and (swishdocpath=\"";                  $sw_q .= "and (swishdocpath=\"";
370                  $sw_q .= join("\" or swishdocpath=\"",@path_arr);                  $sw_q .= join("\" or swishdocpath=\"",@path_arr);
371                  $sw_q .= "\")";                  $sw_q .= "\")";
372                  $tmpl->param('full',1); # show full records                  $tmpl->param('full',1); # show full records
373            } elsif ($q->param('show_full')) {
374                    # just show full path, no path defined
375                    $tmpl->param('full',1);
376            } else {
377                    $tmpl->param('full',0);
378          }          }
379    
380          my $hits = $sh->query($sw_q);          my $swish_msg = ' ';
381    
382            # create new swish instance
383            my $swish = SWISH::API->new($INDEX);
384            $swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error;
385    
386            # execute query and get number of results from SWISH-E
387            my $search = $swish->New_Search_Object;
388    
389            $search->SetSort($sort);
390    
391            my $results = $search->Execute($sw_q);
392            $swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error;
393    
394            my $hits = $results->Hits;
395    
396          $tmpl->param('hits',$hits);          $tmpl->param('hits',$hits);
397          $tmpl->param('search',$sw_q);          my $search_msg = $sw_q;
398            $search_msg .= '<em>'.$swish_msg.'</em>' if ($swish_msg);
399            $tmpl->param('search', $search_msg);
400    
401            $tmpl->param('PAGER_offset',$q->param("PAGER_offset") || 0);
402            $tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0);
403    
404            #
405            # build pager
406            #
407    
408            my $current_page = $q->param('PAGER_offset') || 1;
409    
410            my $pager = Data::Pageset->new({
411                    'total_entries' => $hits,
412                    'entries_per_page' => $ON_PAGE,
413                    'current_page' => $current_page,
414                    'pages_per_set' => $pages_per_set,
415            });
416    
417            $results->SeekResult( $pager->first - 1 );
418    
419            # get number of entries on this page
420            my $i = $pager->entries_on_this_page;
421    
422            # results from swish for template
423            my @pager_data_list;
424    
425            for(my $i=$pager->first; $i<=$pager->last; $i++) {
426    
427                    my $result = $results->NextResult;
428                    last if (! $result);
429    
430                    my $r = {
431                            nr => $i,
432                            path => $result->Property('swishdocpath'),
433                            headline => esc_html($from_utf8->convert($result->Property('headline'))),
434                            rank => $result->Property('swishrank')
435                    };
436    
437                    $r->{html} = back2html($from_utf8->convert($result->Property('html')), join("&",@url_params_persist)) if ($q->param('show_full'));
438    
439                    push @pager_data_list, $r;
440            }
441    
442    
         # create a Pager object  
         my $pager = HTML::Pager->new(  
                 # required parameters  
                 query => $q,  
                 get_data_callback => sub {  
                         my ($offset, $rows) = @_;  
   
                         my @result;  
                         for (my $i=0; $i<$rows; $i++) {  
                                 push @result, $swish_results[$offset+$i] if $swish_results[$offset+$i];  
                         }  
                         return \@result;  
                 },  
                 rows => $hits,  
                 page_size => $ON_PAGE,  
                 # some optional parameters  
                 persist_vars => [  
                         'rm',  
                         'f1', 'v1',  
                         'f2', 'v2',  
                         'f3', 'v3',  
                         'f4', 'v4',  
                         'f5', 'v5',  
                         'f6', 'v6',  
                         'f7', 'v7',  
                         'f8', 'v8',  
                         'f9', 'v9',  
                         ],  
                 #cell_space_color => '#000000',  
                 #cell_background_color => '#ffffff',  
                 #nav_background_color => '#dddddd',  
                 #javascript_presubmit => 'last_minute_javascript()',  
                 debug => 1,  
                 template => $tmpl,  
         );  
443    
444          my $html = $pager->output;          # put something in template
445            make_pager($q, $tmpl, $pager);
446            make_pager_vars($q, $tmpl, @persist_vars);
447            $tmpl->param('PAGER_DATA_LIST', \@pager_data_list);
448    
449          return $html;          my $html = $tmpl->output;
450    
451            return in_template($q,$html);
452  }  }
453    
454  sub show_index {  sub show_index {
# Line 187  sub show_index { Line 460  sub show_index {
460          my $field = $q->param("f$i");          my $field = $q->param("f$i");
461          my $limit = $q->param("v$i");          my $limit = $q->param("v$i");
462    
463            my $filter = $q->param("filter");
464    
465          my $html;          my $html;
466    
467          my $index = new index_DBI();          my $index = new index_DBI(
468                    $cfg_global->val('global', 'dbi_dbd'),
469                    $cfg_global->val('global', 'dbi_dsn'),
470                    $cfg_global->val('global', 'dbi_user'),
471                    $cfg_global->val('global', 'dbi_passwd') || ''
472            );
473    
474            my $total = $index->count($field,$limit,$filter);
475    
476          my $total = $index->check($field);          if (! defined($total)) {
477          if (! $total) {                  my $tmpl = $self->load_tmpl(url_ex($q,'no_index.html'));
                 my $tmpl = $self->load_tmpl('no_index.html');  
478                  $tmpl->param('field',$field);                  $tmpl->param('field',$field);
479                  $html = $tmpl->output;                  $html = $tmpl->output;
480                  return $html;                  return $html;
481          }          }
482    
483          my $tmpl = $self->load_tmpl('index_res.html');          my $tmpl = $self->load_tmpl(url_ex($q,'index_res.html'), global_vars => 1, die_on_bad_params => 0);
484          $tmpl->param('field',$field);          $tmpl->param('field',$field);
485          $tmpl->param('limit',$limit);          $tmpl->param('limit',$limit);
486          $tmpl->param('total',$total);          $tmpl->param('total',$total);
487    
488  # FIX: I should set offset and leave out limit from fetch!!  # FIXME I should set offset and leave out limit from fetch!!
489  #       if (! $q->param("PAGER_offset") {  #       if (! $q->param("PAGER_offset") {
490  #               $q->param("Pager_offet)  #               $q->param("Pager_offet)
491  #       }  #       }
492    
         my $pager = HTML::Pager->new(  
                 query => $q,  
                 get_data_callback => sub {  
                         my ($offset, $rows) = @_;  
   
                         my @result = $index->fetch($field,'item',$limit, $offset, $rows);  
                         return \@result;  
                 },  
                 rows => $total,  
                 page_size => $ON_PAGE,  
                 persist_vars => [  
                         'rm',  
                         "f$i", "v$i", "f".$i."_index",  
                         'offset',  
                         ],  
                 debug => 1,  
                 template => $tmpl,  
         );  
493    
494          return $pager->output;          #
495            # build pager
496            #
497            my $pager = Data::Pageset->new({
498                    'total_entries' => $total,
499                    'entries_per_page' => $ON_PAGE,
500                    'current_page' => $q->param('PAGER_offset') || 1,
501                    'pages_per_set' => $pages_per_set
502            });
503    
504            my @persist_vars = qw{rm f$i v$i f$i_index offset};
505    
506            make_pager($q, $tmpl, $pager);
507            make_pager_vars($q, $tmpl, @persist_vars);
508    
509            my @pager_data_list = $index->fetch($field,$limit, $pager->first - 1, $pager->entries_on_this_page, $filter);
510            $tmpl->param('PAGER_DATA_LIST', \@pager_data_list);
511    
512            return in_template($q,$tmpl->output);
513  }  }
514    
515  1;  1;

Legend:
Removed from v.47  
changed lines
  Added in v.677

  ViewVC Help
Powered by ViewVC 1.1.26