/[mws]/trunk/httpd.pl
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/httpd.pl

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

revision 6 by dpavlin, Wed May 5 13:42:27 2004 UTC revision 12 by dpavlin, Thu May 6 12:40:11 2004 UTC
# Line 69  while ( my $c = $d->accept ) { Line 69  while ( my $c = $d->accept ) {
69                  # XXX LOG                  # XXX LOG
70                  print $r->method," ",$url,Dumper($param);                  print $r->method," ",$url,Dumper($param);
71    
72                  # generate HTML                  # template file name (use ?format=html as default)
73                    my $tpl_file = 'master.';
74                    $tpl_file .= $param->{'format'} || 'html';
75    
76                    #
77                    # implement functionality and generate HTML
78                    #
79                  my $html;                  my $html;
80    
81                  my $s=$param->{'search'};                  if ($param->{'search_val'} && $param->{'search_fld'} && !$param->{'search'}) {
82                            $param->{'search'} = $param->{'search_fld'}.":".$param->{'search_val'};
83                  if ($s) {                  }
84    
85                          print STDERR "search: $s\n";                  # show search results
86                    # ?search=foo:bar
87                    if ($param->{'search'}) {
88    
89                          my $results = $mws->search($s);                          print STDERR "search: ",$param->{'search'},"\n";
90    
91                            my $results = $mws->search($param->{'search'});
92                          my @res = $mws->fetch_all_results();                          my @res = $mws->fetch_all_results();
93    
                         my $tpl_file = 'master.';  
                         $tpl_file .= $param->{'format'} || 'html';  
   
94                          $tt->process($tpl_file, {                          $tt->process($tpl_file, {
95                                  query   => $s,                                  query   => $param->{'search'},
96                                  results => \@res,                                  results => \@res,
97                                  param   => $param,                                  param   => $param,
98                          }, \$html) || die $tt->error();                          }, \$html) || die $tt->error();
99    
100                    #
101                    # ?show_id=XXXXxxxx___message_id___xxxxXXXX
102                    } elsif ($param->{'show_id'}) {
103                            
104                            my $row = $mws->fetch_result_by_id($param->{'show_id'});
105                            $tt->process($tpl_file, {
106                                    message => $row,
107                            }, \$html) || die $tt->error();
108                  }                  }
109    
110                    #
111                    # send HTMLto client
112                    #
113    
114                  my $res = HTTP::Response->new(RC_OK);                  my $res = HTTP::Response->new(RC_OK);
115                  $res->header( 'Content-type' => 'text/html; charset=iso-8859-2' );                  $res->header( 'Content-type' => 'text/html; charset=iso-8859-2' );
116                  $res->content($html);                  $res->content($html);
# Line 104  while ( my $c = $d->accept ) { Line 123  while ( my $c = $d->accept ) {
123    
124  # template toolkit filter  # template toolkit filter
125    
126    #use Text::Context::EitherSide;
127    
128  sub body5_filter {  sub body5_filter {
129          my $text = shift;          my $text = shift;
130          $text =~ s/^\s+//gs;          $text =~ s/^\s+//gs;
131          $text =~ s/^(.*?[\n\r]+){5}.*$/$1/s;          $text =~ s/^[\>:\|=]+\s*.*?$//msg;      # remove quoted text
132            $text =~ s/[\n\r]+/\n/gs;               # compress cr/lf
133            $text =~ s,^((?:.*?[\n\r]){5}).*$,$1<span style="color:#808080">--8&lt;--[cut]--8&lt;--</span>,s;
134            $text =~ s/[\n\r]+--\s*[\n\r]+.*$//s;
135    
136    #       my $context = Text::Context::EitherSide->new($text, context => 5);
137    #       return $context->as_string("perl");
138    
139          return $text;          return $text;
140  }  }
141    

Legend:
Removed from v.6  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC 1.1.26