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

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

revision 198 by dpavlin, Sun Dec 21 06:35:43 2003 UTC revision 302 by dpavlin, Sun Apr 4 22:09:57 2004 UTC
# Line 43  my $from_utf8 = Text::Iconv->new('UTF8', Line 43  my $from_utf8 = Text::Iconv->new('UTF8',
43  sub url_ex {  sub url_ex {
44          my $q = shift || die "suff2file needs CGI object!";          my $q = shift || die "suff2file needs CGI object!";
45          my $tpl = shift || die "url_ex needs template name!";          my $tpl = shift || die "url_ex needs template name!";
46          return suff2file($BASE_PATH, $q->url(-path => 1),$TEMPLATE_PATH,$tpl);          return suff2file($BASE_PATH, $q->url(-absolute => 1,-path => 1),$TEMPLATE_PATH,$tpl);
47  }  }
48    
49  sub suff2file($$$$) {  sub suff2file($$$$) {
# Line 53  sub suff2file($$$$) { Line 53  sub suff2file($$$$) {
53    
54          # strip everything to and including base path, leaving only          # strip everything to and including base path, leaving only
55          # additional (virtual) path          # additional (virtual) path
56          if ($p =~ s,^.*?$base_path,,) {          if ($base_path eq "/") {
57                    $p =~ s,/*,,g;
58                    my ($name,$ext) = split(/\./,$tpl);
59                    $p = $name . "-" . $p . "." . $ext;
60            } elsif ($p =~ s,^.*?$base_path,,) {
61                  $p =~ s,/*,,g;                  $p =~ s,/*,,g;
62                  my ($name,$ext) = split(/\./,$tpl);                  my ($name,$ext) = split(/\./,$tpl);
63                  $p = $name . $p . "." . $ext;                  $p = $name . $p . "." . $ext;
# Line 97  sub in_template { Line 101  sub in_template {
101                  die "can't parse TEMPLATE path";                  die "can't parse TEMPLATE path";
102          }          }
103    
104          my $master_tpl = suff2file($BASE_PATH, $q->url(-path => 1),$dir,$tpl);          my $master_tpl = suff2file($BASE_PATH, $q->url(-absolute => 1, -path => 1),$dir,$tpl);
105          if (open(T, $master_tpl)) {          if (open(T, $master_tpl)) {
106                  my $template_html = join("\n",<T>);                  my $template_html = join("\n",<T>);
107                  close(T);                  close(T);
# Line 221  sub show_results_list { Line 225  sub show_results_list {
225                  return $html;                  return $html;
226          }          }
227    
228            my $sort = 'swishrank';
229            if ($q->param("sort")) {
230                    $sort = 'headline';
231                    push @persist_vars, "sort";
232            }
233    
234          # call swish          # call swish
235          my $sh = SWISH->connect('Fork',          my $sh = SWISH->connect('Fork',
236                  prog     => $SWISH,                  prog     => $SWISH,
# Line 238  sub show_results_list { Line 248  sub show_results_list {
248    
249                  },                  },
250                  #startnum => 0,                  #startnum => 0,
251                  maxhits => $MAX_HITS                  maxhits => $MAX_HITS,
252                    sortorder => $sort,
253          );          );
254    
255          die $SWISH::errstr unless $sh;          die $SWISH::errstr unless $sh;

Legend:
Removed from v.198  
changed lines
  Added in v.302

  ViewVC Help
Powered by ViewVC 1.1.26