[Bio] / FigKernelPackages / HTML.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/HTML.pm

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

revision 1.1, Mon Dec 1 16:54:26 2003 UTC revision 1.99, Tue Sep 19 21:19:14 2006 UTC
# Line 1  Line 1 
1    #
2    # Copyright (c) 2003-2006 University of Chicago and Fellowship
3    # for Interpretations of Genomes. All Rights Reserved.
4    #
5    # This file is part of the SEED Toolkit.
6    #
7    # The SEED Toolkit is free software. You can redistribute
8    # it and/or modify it under the terms of the SEED Toolkit
9    # Public License.
10    #
11    # You should have received a copy of the SEED Toolkit Public License
12    # along with this program; if not write to the University of Chicago
13    # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14    # Genomes at veronika@thefig.info or download a copy from
15    # http://www.theseed.org/LICENSE.TXT.
16    #
17    
18  package HTML;  package HTML;
19    
20    use Tracer;
21    use FIG;
22  use Carp;  use Carp;
23  use Data::Dumper;  use Data::Dumper;
24  use LWP::UserAgent;  use LWP::UserAgent;
25  use LWP::Simple;  use LWP::Simple;
26    use URI::Escape;  # uri_escape()
27  use URI::URL;  use URI::URL;
28  use HTTP::Request::Common;  use HTTP::Request::Common;
29    use POSIX;
30    
31    use raelib; # now used for the excel function, that should eventually end up in here. Way too experimental!
32    my $raelib=new raelib;
33    
 sub show_page {  
     my($cgi,$html,$no_home) = @_;  
     my $i;  
34    
35      print $cgi->header;  my $top_link_cache;
36      print "<base href=\"" . &FIG::cgi_url . "/\">\n";  
37      for ($i=0; ($i < @$html) && ($html->[$i] !~ /\<body\>/i); $i++) {}  
38      if ($i < @$html)  sub new
39      {      {
40          splice(@$html,$i+1,0,`cat ./Html/html.hdr`);      my($class) = @_;
41    
42        my $self = {};
43    
44        return bless $self, $class;
45      }      }
46      else  
47    sub top_link
48    {
49    
50        #
51        # Determine if this is a toplevel cgi or one in one of the subdirs (currently
52        # just /p2p).
53        #
54    
55        return $top_link_cache if ($top_link_cache);
56    
57        my @parts = split(/\//, $ENV{SCRIPT_NAME});
58        my $top;
59        if ($parts[-2] eq 'FIG')
60      {      {
61          for ($i=0; ($i < @$html) && ($html->[$i] !~ /\<html\>/i); $i++) {}          $top = '.';
62          if ($i < @$html)  #       warn "toplevel @parts\n";
63        }
64        elsif ($parts[-3] eq 'FIG')
65          {          {
66              splice(@$html,$i+1,0,`cat ./Html/html.hdr`);          $top = '..';
67    #       warn "subdir @parts\n";
68          }          }
69          else          else
70          {          {
71              splice(@$html,0,0,`cat ./Html/html.hdr`);          $top = $FIG_Config::cgi_base;
72    #       warn "other @parts\n";
73          }          }
74    
75        $top_link_cache = $top;
76        return $top;
77      }      }
78    
79      @tail = `cat ./Html/html.tail`;  sub compute_html_header
     if (! $no_home)  
80      {      {
81          my $user = $cgi->param('user');      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
82          $user = $user ? $user : "";      my($additional_insert, $user, %options ) = @_;
83          my $link = $cgi->url();  
84          $link =~ s/[a-zA-Z_]+\.cgi$/index.cgi/;      local $/ = "\n";
85          push(@tail,"<hr><a href=\"$link?user=$user\">FIG search</a>\n");  
86        my $header_name = $options{header_name} ? $options{header_name} : "html.hdr";
87        my $tail_name = $options{tail_name} ? $options{tail_name} : "html.tail";
88    
89        my $html_hdr_file = "./Html/$header_name";
90        if (! -f $html_hdr_file)
91        {
92            $html_hdr_file = "$FIG_Config::fig/CGI/Html/$header_name";
93      }      }
94        my @html_hdr = &FIG::file_read($html_hdr_file);
95    
96        # for my $k (sort keys %ENV) { warn "$k = $ENV{$k}\n"; }
97    
98      if (@tail > 0)      #
99        # Determine if this is a toplevel cgi or one in one of the subdirs (currently
100        # just /p2p).
101        #
102    
103        my @parts = split(/\//, $ENV{SCRIPT_NAME});
104        my $top;
105        if ($parts[-2] eq 'FIG')
106      {      {
107          for ($i=0; ($i < @$html) && ($html->[$i] !~ /\<\/body\>/i); $i++) {}          $top = '.';
108          if ($i < @$html)  #       warn "toplevel @parts\n";
109        }
110        elsif ($parts[-3] eq 'FIG')
111          {          {
112              splice(@$html,$i,0,@tail);          $top = '..';
113    #       warn "subdir @parts\n";
114          }          }
115          else          else
116          {          {
117              for ($i=0; ($i < @$html) && ($html->[$i] !~ /\<\/html\>/i); $i++) {}          $top = $FIG_Config::cgi_base;
118              if ($i < @$html)  #       warn "other @parts\n";
119        }
120    
121        $options{no_fig_search} or push( @html_hdr, "<br><a href=\"$top/index.cgi?user=$user\">FIG search</a>\n" );
122    
123        if (@html_hdr)
124        {
125            my $insert_stuff;
126    
127            if (not $options{no_release_info})
128            {
129                my @ver = &FIG::file_head("$FIG_Config::fig_disk/CURRENT_RELEASE", 1);
130                my $ver = $ver[0];
131                chomp $ver;
132                if ($ver =~ /^cvs\.(\d+)$/)
133              {              {
134                  splice(@$html,$i,0,@tail);                  my $d = asctime(localtime($1));
135                    chomp($d);
136                    $ver .=  " ($d)";
137              }              }
138              else              my $host = &FIG::get_local_hostname();
139                $insert_stuff = "SEED version <b>$ver</b> on $host";
140            }
141    
142            if ($additional_insert)
143              {              {
144                  push(@$html,@tail);              $insert_stuff .= "<br>" . $additional_insert;
145              }              }
146    
147            for $_ (@html_hdr)
148            {
149                s,(href|img\s+src)="/FIG/,$1="$top/,g;
150                    s,(\?user\=)\",$1$user",;
151                if ($_ eq "<!-- HEADER_INSERT -->\n")
152                {
153                    $_ = $insert_stuff;
154          }          }
155      }      }
     print @$html;  
156  }  }
157    
158  sub make_table {      return @html_hdr;
159      my($col_hdrs,$tab,$title,$instr) = @_;  }
     my(@tab);  
160    
161      push(@tab,"<table border><caption><b>$title</b></caption>\n");  sub show_page {
162      push(@tab,"<tr><th>" . join("</th><th>",@$col_hdrs) . "</th></tr>\n");      #warn "SHOWPAGE: cgi=", Dumper(@_);
163      my($i,$nowrap);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
164        my($cgi,$html,$no_home, $alt_header, $css, $javasrc, $cookie, $options) = @_;
165        my $i;
166    
167      for ($i=0; ($i < @$instr) && ($instr->[$i] !~ /nowrap/); $i++) {}      my $top = top_link();
     $nowrap = ($i == @$instr) ? "" : " nowrap";  
168    
169      foreach $_ (@$tab)      # ARGUMENTS:
170        #     $cgi is the CGI method
171        #     $html is an array with all the html in it. It is just joined by "\n" (and not <br> or <p>
172        #     $no_home eliminates ONLY the bottom FIG search link in a page
173        #     $alt_header is a reference to an array for an alternate header banner that you can replace the standard one with
174        #     $css is a reference to a hash. The key is the name of the CSS sheet and the value is the URL of that sheet. Note the usual rules about relative css urls
175        #               the sheet named "Default" is considered to be the default style sheet, and if this is not set it points at $FIG_Config::HTML/css/default.css
176        #               the sheet named "Sans Serif" is considered to the the first alternate, and if this is not set it points at $FIG_Config::HTML/css/sanserif.css
177        #     $javasrc is a reference to an array of URLs to javascripts to be included (e.g. "FIG/Html/css/styleswitcher.js")
178        #     $cookie is the name and value of the cookie to set. Note that you should probably use raelib->cookie to get/set your cookies
179        #     $options is a reference to a hash of options that you can pass around the pages
180        #
181        # Find the HTML header
182        #
183    
184        my $html_tail_file = "./Html/$tail_name";
185        if (! -f $html_tail_file)
186        {
187            $html_tail_file = "$FIG_Config::fig/CGI/Html/$tail_name";
188        }
189    
190        my $user = $cgi->param('user') || "";
191        my @html_hdr;
192        if ($alt_header && ref($alt_header) eq "ARRAY")
193      {      {
194          push(@tab,"<tr><td$nowrap>" . join("</td><td$nowrap>",@$_) . "</td></tr>\n");         @html_hdr = @$alt_header;
195      }      }
196      push(@tab,"</table>\n");      else
197      return join("",@tab);      {
198            @html_hdr = compute_html_header(undef,$user,%$options);
199  }  }
200    
201  sub ec_link {      # RAE: I am offloading the handling of cookies to CGI.pm since I don't know how they are set up.
202      my($role) = @_;      # This modification adds the cookies if necessary
203    
204      if ($role =~ /(\d+\.\d+\.\d+\.\d+)/)      # Note: 3/10/05 commented this line out pending the discussion of adding cookies into the seed that we are waiting to see about
205        # to add cookies back in replace these two header lines with each other
206    
207        #print $cgi->header(-cookie=>$cookie);
208        print $cgi->header();
209    
210        #
211        #  The SEED header file goes immediately after <BODY>.  Figure out
212        #  what parts of the HTML document skeleton are there, and fill in
213        #  missing ones.
214        #
215        #  This list should be as comprehensive as feasible:
216        #
217    
218        my %head_tag = ( base     => 1,
219                         basefont => 1,
220                         html     => 1,
221                         isindex  => 1,
222                         link     => 1,
223                         meta     => 1,
224                         nextid   => 1,
225                         style    => 1,
226                         title    => 1,
227                       );
228    
229        #
230        #  This list need not be comprehensive; it is just stopping conditions:
231        #
232    
233        my %body_tag = ( a      => 1,
234                         br     => 1,
235                         center => 1,
236                         form   => 1,
237                         h1     => 1,
238                         h2     => 1,
239                         h3     => 1,
240                         hr     => 1,
241                         img    => 1,
242                         p      => 1,
243                         pre    => 1,
244                         table  => 1
245                       );
246    
247        my $html_line = -1;
248        my $head_line = -1;
249        my $base_line = -1;
250        my $head_end_line = -1;
251        my $body_line = -1;
252        my $last_head_line = -1;  #  If no head tags are found, text goes at top.
253        my $done = 0;
254    
255        for ( $i = 0; $i < @$html; $i++ )
256      {      {
257          return "<a href=\"http://www.genome.ad.jp/dbget-bin/www_bget?ec:$1\">$role</a>";          #  Some special cases:
258      }  
259      else          if ( $html->[$i] =~ /\<html[^0-9a-z]/i ) { $html_line = $i }
260            if ( $html->[$i] =~ /\<head[^0-9a-z]/i ) { $head_line = $i }
261            if ( $html->[$i] =~ /\<base[^0-9a-z]/i ) { $base_line = $i }
262            if ( $html->[$i] =~ /\<\/head\>/i )      { $head_end_line = $i }
263    
264            #  The content goes after this line:
265    
266            if ( $html->[$i] =~ /\<body[^0-9a-z]/i )
267      {      {
268          return $role;              $body_line = $i;
269                last;
270      }      }
271    
272            #  Now the general case.
273            #  Analyze all the html tags on the line:
274    
275            foreach ( $html->[$i] =~ /\<\/?([0-9a-z]+)/ig )
276            {
277                #  At first body tag, we stop the search and put the text
278                #  after the last line with a head tag:
279    
280                if ( $body_tag{ lc $_ } )
281                {
282                    $done = 1;
283                    last;
284  }  }
285    
286  sub role_link {              #  If this is a head tag, then move the marker forward
     my($cgi,$role) = @_;  
287    
288      my $roleR = ($role =~ /^(\d+\.\d+\.\d+\.\d+)\s+-\s+/) ? $1 : $role;              elsif ( $head_tag{ lc $_ } )
289      my $user = $cgi->param('user');              {
290      if (! $user) { $user = "" }                  $last_head_line = $i;
291      my $link = $cgi->url() . "?role=$roleR&user=$user";              }
292      $link =~ s/[a-z]+\.cgi\?/pom.cgi?/;          }
293      return "<a href=$link>$role</a>";          last if $done;      # When done, break loop to avoid increment
294  }  }
295    
296  sub fid_link {      #  Some sanity checks on structure:
     my($cgi,$fid,$local,$just_url) = @_;  
     my($n);  
297    
298      if ($fid =~ /^fig\|\d+\.\d+\.([a-z]+)\.(\d+)/)      if ( 1 )
299      {      {
300          if ($local)          if ( $html_line >= 0 )
301          {          {
302              if ($1 eq "peg")              if ( ( $head_line >= 0 ) && ( $html_line > $head_line ) )
303              {              {
304                  $n = $2;                  print STDERR "<HTML> tag follows <HEAD> tag\n";
305              }              }
306              else              if ( ( $head_end_line >= 0 ) && ( $html_line > $head_end_line ) )
307              {              {
308                  $n = "$1.$2";                  print STDERR "<HTML> tag follows </HEAD> tag\n";
             }  
309          }          }
         else  
         {  
             $n = $fid;  
310          }          }
311          if ($1 ne "peg") { return $n }          if ( $head_line >= 0 )
         my $user = $cgi->param('user');  
         if (! $user) { $user = "" }  
         my $trans = $cgi->param('translate') ? "&translate=1" : "";  
         my $link = $cgi->url() . "?prot=$fid&user=$user$trans";  
         $link =~ s/[a-z_A-Z]+\.cgi\?/protein.cgi?/;  
         if ($just_url)  
312          {          {
313              return $link;              if ( ( $head_end_line >= 0 ) && ( $head_line > $head_end_line ) )
         }  
         else  
314          {          {
315              return "<a href=$link>$n</a>";                  print STDERR "<HEAD> tag follows </HEAD> tag\n";
316          }          }
317      }      }
     return $fid;  
318  }  }
319    
320  sub family_link {      #
321      my($family,$user) = @_;      #  Okay.  Let's put in the html header file, and missing tags:
322        #
323        #  <BODY> goes after last head line
324        #
325        #  RAE:
326        #  Added the javascript for the buttons immediately after body.
327        #  Note if no buttons are added we still (at the moment) add the script,
328        #  but it only adds a little text (495 characters) to the html and noone will notice!
329        #  RAE: This is now deprecated because everything is in an external file, FIG.js, included later
330    
331      return $family;      if ( $body_line < 0 )
332        {
333            $body_line = $last_head_line + 1;
334            splice( @$html, $body_line, 0, "<BODY>\n" );
335  }  }
336    
337  use URI::Escape;      #
338        #  Seed page header (if it exists) goes after <BODY>
339  sub get_html {      #
     my( $url, $type, $kv_pairs) = @_;  
     my( $encoded, $ua, $args, @args, $out, @output, $x );  
   
     $ua = new LWP::UserAgent;  
     $ua->timeout( 900 );  
340    
341      if ($type =~/post/i)      if (@html_hdr)
     {  
         $args = [];  
         foreach $x (@$kv_pairs)  
342          {          {
343              push(@$args, ( $x->[0], $x->[1]) );          splice( @$html, $body_line + 1, 0, @html_hdr );
         }  
         my $request  = POST $url, $args;  
         my $response = $ua->request($request);  
         $out = $response->content;  
344      }      }
345      else  
346      {      #
347          @args = ();      #  </HEAD> goes before <BODY>
348          foreach $x (@$kv_pairs)      #
349    
350        if ( $head_end_line < 0 )
351          {          {
352              push( @args, "$x->[0]=" . uri_escape($x->[1]) );          $head_end_line = $body_line;
353            splice( @$html, $body_line, 0, "</HEAD>\n" );
354          }          }
355    
356          if (@args > 0)      # RAE:
357        # Add css here
358        # Note that at the moment I define these two sheets here. I think this should
359        # be moved out, but I want to try it and see what happens.  css has the format:
360        #
361        # <link rel='stylesheet' title='default' href='/css/default.css' type='text/css'>
362    
363        # convert the default key to the right case. and eliminate dups
364        foreach my $k (keys %$css) {if (lc($k) eq "default") {$css->{'Default'}=$css->{$k}}}
365    
366        if (!$css || !$css->{'Default'})
367          {          {
368              $url .= "?" . join("&",@args);         $css->{'Default'} = "Html/css/default.css";
369          }          }
370          $request = new HTTP::Request('GET', $url);      if (!$css->{"Sans Serif"})
         my $response = $ua->request($request);  
   
         if ($response->is_success)  
371          {          {
372              $out = $response->content;         $css->{'Sans Serif'} = "Html/css/sanserif.css";
373          }          }
374          else  
375        my $csstext = "<link rel='stylesheet' title='default' href='".$css->{'Default'}."' type='text/css'>\n";
376        $csstext   .= "<link rel='alternate stylesheet' title='Sans Serif' href='".$css->{'Sans Serif'}."' type='text/css'>\n";
377    
378        foreach my $k (keys %$css)
379          {          {
380              $out = "<H1>Error: " . $response->code . "</H1>" . $response->message;         next if (lc($k) eq "default" || lc($k) eq "sans serif");
381           $csstext .= "<link rel='alternate stylesheet' title='$k' href='".$css->{$k}."' type='text/css'>\n";
382          }          }
383    
384        $csstext   .= "<link rel='alternate'  title='SEED RSS feeds' href='Html/rss/SEED.rss' type='application/rss+xml'>\n";
385    
386        # RAE: also added support for external javascripts here.
387        # we are cluttering the HTML code with all the javascripts when they could easily be in external files
388        # this solution allows us to source other files
389    
390        # the file FIG.js contains most of the java script we use routinely. Every browser will just cache this and so
391        # it will reduce our overhead.
392    
393        # $javasrc must be a ref to an array with urls (absolute or relative) to the javascripts
394        push @$javasrc, "Html/css/FIG.js";
395        foreach my $script (@$javasrc) {
396            $csstext .= "<script src=\"$script\" type=\"text/javascript\"></script>\n";
397      }      }
 #   set up a document with proper eol characters  
     @output = split(/[\012\015]+/,$out);  
     foreach $out (@output) { $out .= "\n"; }  
398    
 #   Now splice in a line of the form <base href=URL> to cause all relative links to work  
 #   properly.  Remove the header.  
399    
400      for ($i=0; ($i < @output) && ($output[$i] !~ /^\s*\</); $i++) {}  
401      if ($i < @output)      splice( @$html, $head_end_line, 1, "$csstext</HEAD>\n" );  # note here I am replacing the </head> line. Could be bad...? But it doesn't increment everything else.
402    
403        #
404        #  <BASE ...> goes before </HEAD>
405        #
406    
407        if ( $base_line < 0 )
408      {      {
409            #
410            #  Use a relative base address for pages.  Also, because I am
411            #  worried about when FIG_config.pm gets updated (clean installs
412            #  only, or every update?), I provide an alternative derivation
413            #  from $cgi_url. -- GJO
414            #
415            # BASE href needs to be absolute. RDO.
416            #
417            #
418            $base_url = &FIG::cgi_url;
419    #       my $base_url = $FIG_Config::cgi_base;
420    #       if ( ! $base_url )                      # if cgi_base was not defined
421    #       {
422    #           $base_url = $FIG_Config::cgi_url;   # get the full cgi url
423    #           $base_url =~ s~^http://[^/]*~~;     # remove protocol and host
424    #           $base_url =~ m~/$~ || $base_url =~ s~$~/~; # check trailing slash
425    #       }
426    
427          splice(@output,0,$i);          $base_line = $head_end_line;
428            #
429            # RDO 2005-1006. Remove this so proxying works better.
430            #
431    #        splice( @$html, $base_line, 0, "<BASE href=\"$base_url/\">\n" );
432      }      }
433    
434      for ($i=0; ($i < @output) && ($output[$i] !~ /\<body\>/i); $i++) {}      #
435      if ($i == @output)      #  <HTML> goes at the top of the output
436        #
437    
438        if ( $html_line < 0 )
439      {      {
440          $i = -1;          $html_line = 0;
441            splice( @$html, $html_line, 0, "<HTML>\n" );
442      }      }
443      splice(@output,$i+1,0,"<base href=\"$url\">\n");  
444      return @output;      #
445        #  <HEAD> goes after <HTML>
446        #
447    
448        if ( $head_line < 0 )
449        {
450            $head_line = $html_line + 1;
451            splice( @$html, $head_line, 0, "<HEAD>\n" );
452  }  }
453    
454  sub trim_output {      #
455      my($out) = @_;      #  Place FIG search link at bottom of page
456      my $i;      #
457    
458      for ($i=0; ($i < @$out) && ($out->[$i] !~ /^\</); $i++) {}      my @tail = -f $html_tail_file ? `cat $html_tail_file` : ();
459      splice(@$out,0,$i);      if (! $no_home)
460        {
461            my $user = $cgi->param('user') || "";
462            push( @tail, "<hr><a href=\"index.cgi?user=$user\">FIG search</a>\n" );
463        }
464    
465      for ($i=0; ($i < @$out) && ($out->[$i] !~ /\<body\>/i); $i++) {}      #
466      if ($i == @$out)      # See if we have a site-specific tail (for disclaimers, etc).
467        #
468    
469        my $site_tail = "$FIG_Config::fig_disk/config/site_tail.html";
470        my $site_fh;
471        if (open($site_fh, "<$site_tail"))
472        {
473            push(@tail, <$site_fh>);
474            close($site_fh);
475        }
476    
477        #
478        #  Figure out where to insert The SEED tail.  Before </body>,
479        #  or before </html>, or at end of page.
480        #
481        my @tags = ();
482        # Check for a tracing queue.
483        my $traceString = QTrace("HTML");
484        if ($traceString) {
485            push @tags, $traceString;
486        }
487        for ($i=0; ($i < @$html) && ($html->[$i] !~ /\<\/body\>/i); $i++) {}
488        if ($i >= @$html)        # </body> not found; look for </html>
489      {      {
490          for ($i=0; ($i < @$out) && ($out->[$i] !~ /\<html\>/i); $i++) {}          push @tags, "\n</BODY>\n";
491          if ($i == @$out)          # Even if tag is not found, index points to correct place for splice
492            for ($i=0; ($i < @$html) && ($html->[$i] !~ /\<\/html\>/i); $i++) {}
493            if ($i >= @$html)    # </html> not found; add it
494          {          {
495              $i = -1;              push @tags, "</HTML>\n";
496          }          }
497      }      }
498      for ($j=$i+1; ($j < @$out) && ($out->[$j] !~ /^\<hr\>$/); $j++) {}  
499      if ($j < @$out)      if ( @tail )
500      {      {
501          splice(@$out,$i+1,($j-$i));          splice( @$html, $i, 0, @tail, @tags );
502      }      }
503        elsif ( @tags )
     for ($i=0; ($i < @$out) && ($out->[$i] !~ /\<\/body\>/i); $i++) {}  
     if ($i == @$out)  
504      {      {
505          for ($i=0; ($i < @$out) && ($out->[$i] !~ /\<\/html\>/i); $i++) {}          splice( @$html, $i, 0, @tags );
506      }      }
507    
508      for ($j=$i-1; ($j > 0) && ($out->[$j] !~ /FIG search/); $j--) {}      # RAE the chomp will return any new lines at the ends of elements in the array,
509      if ($j > 0)      # and then we can join  with a "\n". This is because somethings put newlines in,
510        # and others don't. This should make nicer looking html
511        #
512        # chomp(@$html);
513        # print join "\n", @$html;
514        #
515        # Apparently the above still breaks things. This is the correct code:
516    
517        foreach $_ (@$html)
518      {      {
519          my @tmp = `cat ./Html/html.tail`;          print $_;
         my $n = @tmp;  
         splice(@$out,$j-$n,$n+1);  
520      }      }
521    
522  }  }
523    
 sub set_prot_links {  
     my($cgi,$x) = @_;  
     my($before,$match,$after);  
524    
525      if ($x =~ /^(.*)(fig\|\d+\.\d+\.peg\.\d+)(.*)$/)  =head1 make_table
526      {  
527          $before = $1;  The main method to convert an array into a table.
528          $match = $2;  
529          $after = $3;  The col_hdrs are set to the <th> headers, the $tab is an array of arrays. The first is the rows, and the second is the columns. The title is the title of the table.
530          return &set_prot_links($cgi,$before) . &HTML::fid_link($cgi,$match) . &set_prot_links($cgi,$after) . "\n";  
531    The options define the settings for the table such as border, width, and class for css formatting. If the option "excelfile" is set to a filename that will be created in FIG_Config::temp, and the link included that allows the user to download the file as an excel file.
532    
533    =cut
534    
535    sub make_table {
536        my($col_hdrs,$tab,$title, %options ) = @_;
537        my(@tab);
538    
539        my $border = defined $options{border} ? "border=\"$options{border}\"" : "border";
540        my $width = defined $options{width} ? "width=\"$options{width}\"" : undef;
541        my $class = defined $options{class} ? "class=\"$options{class}\"" : undef;
542        push( @tab, "\n<table $border $width $class>\n",
543                    "\t<caption><b>$title</b></caption>\n",
544                    "\t<tr>\n\t\t"
545                  . join( "\n", map { &expand($_, "th") } @$col_hdrs )
546                  . "\n\t</tr>\n"
547            );
548        my($i);
549    
550        my $row;
551        foreach $row (@$tab)
552        {
553            push( @tab, "\t<tr>\n"
554                      . join( "\n", map { &expand($_) } @$row )
555                      . "\n\t</tr>\n"
556                );
557      }      }
558      elsif ($x =~ /^(.*)(gi\|\d+)(.*)$/)      push(@tab,"</table>\n");
559      {  
560          $before = $1;      # excelfile should be appropriate for a filename (no spaces/special characters)
561          $match = $2;      if (defined $options{"excelfile"}) {push @tab, $raelib->tab2excel($col_hdrs,$tab,$title,\%options,$options{"excelfile"})}
562          $after = $3;  
563          return &set_prot_links($cgi,$before) . &HTML::gi_link($cgi,$match) . &set_prot_links($cgi,$after) . "\n";      return join("",@tab);
564      }      }
565      elsif ($x =~ /^(.*)(sp\|[A-Z0-9]{6})(.*)$/)  
566    sub abstract_coupling_table {
567        my($cgi,$prot,$coupling) = @_;
568        my %fc;
569    
570        my $col_hdrs = ["coupled to","Score","Type of Coupling", "Type-specific Data"];
571        my $tab = [];
572        my %by_peg;
573        foreach my $x (@$coupling)
574      {      {
575          $before = $1;          my($peg2,$psc,$type,$extra) = @$x;
576          $match = $2;          if (($type !~ /^[ID]FC$/) || (! $fc{$peg2}))
         $after = $3;  
         return &set_prot_links($cgi,$before) . &HTML::sp_link($cgi,$match) . &set_prot_links($cgi,$after) . "\n";  
     }  
     elsif ($x =~ /^(.*)(pirnr\|NF\d+)(.*)$/)  
577      {      {
578          $before = $1;              if ($type =~  /^[ID]FC$/)
579          $match = $2;              {
580          $after = $3;                  $fc{$peg2} = 1;
         return &set_prot_links($cgi,$before) . &HTML::pir_link($cgi,$match) . &set_prot_links($cgi,$after) . "\n";  
     }  
     return $x;  
581  }  }
582    
583  sub gi_link {              $by_peg{$peg2} += $psc;
     my($cgi,$gi) = @_;  
   
     if ($gi =~ /^gi\|(\d+)$/)  
     {  
         return "<a href=http://www.ncbi.nlm.nih.gov:80/entrez/query.fcgi?cmd=Retrieve&db=Protein&list_uids=$1&dopt=GenPept>$gi</a>";  
584      }      }
     return $gi;  
585  }  }
586    
587  sub sp_link {      foreach my $x (sort { ($by_peg{$b->[0]} <=> $by_peg{$a->[0]})
588      my($cgi,$sp) = @_;                            or ($a->[0] cmp $b->[0])
589                              or ($b->[1] <=> $a->[1])
590      if ($sp =~ /^sp\|(\S+)$/)                            or ($a->[2] cmp $b->[2]) } @$coupling)
591      {      {
592          return "<a href=http://us.expasy.org/cgi-bin/get-sprot-entry?$1>$sp</a>";          my($peg2,$psc,$type,$extra) = @$x;
593            push(@$tab,[&fid_link($cgi,$peg2,1),$psc,$type,&set_prot_links($cgi,join(", ",@$extra))]);
594      }      }
595      return $sp;  
596    
597         my $help = "<a href=\"Html/abstract_coupling.html\" target=\"SEED_or_SPROUT_help\">for help</a>";
598    #    my @html = &make_table($col_hdrs,$tab,"Abstract Coupling Data for $prot");
599    #    push(@html,"<hr>\n",$cgi->h3($help),"<br>");
600    #    return @html;
601    
602        return &make_table($col_hdrs,$tab,"Abstract Coupling Data for $prot [$help]");
603  }  }
604    
605  sub pir_link {  sub expand {
606      my($cgi,$pir) = @_;      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
607        my( $x, $tag ) = @_;
608    
609      if ($pir =~ /^pirnr\|(NF\d+)$/)      $tag = "td" unless $tag;
610        my $endtag = $tag;
611    
612        # RAE modified this so that you can pass in a reference to an array where
613        # the first element is the data to display and the second element is optional
614        # things like colspan and align. Note that in this case you need to include the td
615        # use something like ["some data to appear", "td colspan=4 bgcolor=gray"]
616    
617        # per GJO's request modified this line so it can take any tag.
618        if ( ref($x) eq "ARRAY" ) { ($x, $tag) = @$x; $tag =~ /^(\S+)/; $endtag = $1 }
619    
620        if ( $x =~ /^\@([^:]+)\:(.*)$/ )
621      {      {
622          return "<a href=http://pir.georgetown.edu/cgi-bin/nfEntry.pl?id=$1>$pir</a>";          return "\t\t<$tag $1>$2</$endtag>";
623        }
624        else
625        {
626            return "\t\t<$tag>$x</$endtag>";
627      }      }
     return $pir;  
628  }  }
629    
630    
631  1  =head2 merge_table_rows()
632    
633    Merge table rows together. This will merge a table so that adjacent cells with the same content will only be shown once.
634    
635    Something like this:
636    
637        -----------------------
638        |    1     |    a     |
639        -----------------------
640        |    1     |    b     |
641        -----------------------
642        |    2     |    c     |
643        -----------------------
644        |    3     |    d     |
645        -----------------------
646        |    4     |    d     |
647        -----------------------
648        |    5     |    d     |
649        -----------------------
650    
651    Will become:
652    
653        -----------------------
654        |          |    a     |
655        |    1     |-----------
656        |          |    b     |
657        -----------------------
658        |    2     |    c     |
659        -----------------------
660        |    3     |          |
661        ------------          |
662        |    4     |    5     |
663        ------------          |
664        |    5     |          |
665        -----------------------
666    
667    
668    The method takes two arguments. The reference to the array that is the table ($tab). This is the standard table that is created for HTML.pm to draw, and a reference to a hash of columns that you don't want to merge together. The reference to the hash is optional, and if not included, everything will be merged.
669    
670     $tab=&HTML::merge_table_rows($tab);
671    
672     or
673    
674     $skip=(1=>1, 3=>1, 5=>1);
675     $tab=&HTML::merge_table_rows($tab, $skip);  # will merge all columns except 1, 3 and 5. Note the first column in the table is #0
676    
677    
678    =cut
679    
680    
681    
682    
683    sub merge_table_rows {
684     # RAE:
685     # Experimental piece of code. We often want to have rows or columns were cells are merged. It just looks so much nicer
686     # this block should merge adjacent rows that have the same text in them.
687     # use like this:
688     #      $tab=&HTML::merge_table_rows($tab);
689     # before you do a make_table call
690    
691     my $self=shift if UNIVERSAL::isa($_[0],__PACKAGE__);
692     my ($tab, $skip)=@_;
693    
694     my $newtable;
695     my $lastrow;
696     my $rowspan;
697     my $refs;
698    
699     for (my $y=0; $y <= $#$tab; $y++) {
700     #$y is the row in the table;
701      for (my $x=0; $x <= $#{$tab->[$y]}; $x++) {
702       # this is the user definable columns not to merge
703       if ($skip->{$x})
704       {
705        $newtable->[$y]->[$x] = $tab->[$y]->[$x];
706        next;
707       }
708    
709       #$x is the column in the table
710       # if the column in the row we are looking at is the same as the column in the previous row, we don't add
711       # this cell to $newtable. Instead we increment the rowspan of the previous row by one
712    
713       # handle cells that are references to arrays
714       if (ref($tab->[$y]->[$x]) eq "ARRAY") {$refs->[$y]->[$x]=$tab->[$y]->[$x]->[1]; $tab->[$y]->[$x]=$tab->[$y]->[$x]->[0]}
715    
716       # now we go back through the table looking where to draw the merge line:
717       my $lasty=$y;
718       while ($lasty >= 0 && $tab->[$y]->[$x] eq $tab->[$lasty]->[$x]) {$lasty--}
719       $lasty++; # this is the last identical cell. If lasty==y it is the current cell, so we just save the data. Otherwise we increment the rowspan
720       if ($lasty == $y) {
721        # we always want to have something in rows that may otherwise be empty but should be there (see below)
722        unless ($tab->[$y]->[$x]) {$tab->[$y]->[$x]=" &nbsp; "}
723        $newtable->[$y]->[$x] = $tab->[$y]->[$x];
724       }
725       else {$rowspan->[$lasty]->[$x]++}
726      }
727     }
728    
729     # now just join everything back together
730     for (my $y=0; $y <= $#$tab; $y++) {
731      for (my $x=0; $x <= $#{$tab->[$y]}; $x++) {
732       if ($rowspan->[$y]->[$x]) {
733        if ($refs->[$y]->[$x]) {$refs->[$y]->[$x] .= " rowspan=". ($rowspan->[$y]->[$x]+1)}
734        else {$refs->[$y]->[$x] = "td rowspan=". ($rowspan->[$y]->[$x]+1)}
735        $newtable->[$y]->[$x]=[$newtable->[$y]->[$x], $refs->[$y]->[$x]];
736       }
737       elsif ($newtable->[$y]->[$x] && $refs->[$y]->[$x]) {
738        $newtable->[$y]->[$x]=[$newtable->[$y]->[$x], $refs->[$y]->[$x]];
739       }
740      }
741     }
742    
743    
744     # finally we have to remove any completely empty cells that have been added by the array mechanism
745     # (e.g. if you define $a->[2] then $a->[0] and $a->[1] are now undef).
746     # that is why in the loop above I replace empty cells with nbsp. They are now not undef!
747     # I am sure that Gary can do this in one line, but I am hacking.
748     my @trimmed;
749     foreach my $a (@$newtable) {
750      my @row;
751      foreach my $b (@$a) {
752       push @row, $b if ($b);
753      }
754      push @trimmed, \@row;
755     }
756    
757     return \@trimmed;
758    }
759    
760    
761    
762    
763    sub set_ec_links {
764        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
765        my($cgi,$x) = @_;
766        my($before,$match,$after);
767    
768        if ($x =~ /^(.*)(EC \d+\.\d+\.\d+\.\d+)(.*)/s)
769        {
770            $before = $1;
771            $match = $2;
772            $after = $3;
773            return &set_ec_links($cgi,$before) . &HTML::ec_link($match) . &set_ec_links($cgi,$after);
774        }
775        return $x;
776    }
777    
778    sub ec_link {
779        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
780        my($role) = @_;
781    
782        if ($role =~ /(\d+\.\d+\.\d+\.\d+)/)
783        {
784            return "<a href=\"http://www.genome.ad.jp/dbget-bin/www_bget?ec:$1\">$role</a>";
785        }
786        else
787        {
788            return $role;
789        }
790    }
791    
792    sub role_link {
793        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
794        my($cgi,$role) = @_;
795    
796        my $roleR = ($role =~ /^(\d+\.\d+\.\d+\.\d+)\s+-\s+/) ? $1 : $role;
797        my $user = $cgi->param('user');
798        if (! $user) { $user = "" }
799        my $link = $cgi->url() . "?role=$roleR&user=$user";
800        $link =~ s/[a-z]+\.cgi\?/pom.cgi?/;
801        return "<a href=$link>$role</a>";
802    }
803    
804    #
805    # Local means to eliminate the fig|org.peg from the
806    # text of the link.
807    #
808    sub fid_link {
809        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
810        my($cgi,$fid,$local,$just_url) = @_;
811        my($n);
812    
813        my $top = top_link();
814    
815        if ($fid =~ /^fig\|\d+\.\d+\.([a-z]+)\.(\d+)/)
816        {
817            if ($local)
818            {
819                if ($1 eq "peg")
820                {
821                    $n = $2;
822                }
823                else
824                {
825                    $n = "$1.$2";
826                }
827            }
828            else
829            {
830                $n = $fid;
831            }
832    
833            my $link;
834            my $new_framework = $cgi->param('new_framework') ? 1 : 0;
835            #added to format prophage and path island links to feature.cgi
836            my $sprout = $cgi->param('SPROUT') ? "&SPROUT=1" : "";
837            if ($1 ne "peg" && ! $sprout)
838            {
839               my $user = $cgi->param('user');
840               if (! $user) { $user = "" }
841               $link = "$top/feature.cgi?feature=$fid&user=$user$sprout";
842               $link =~ s/[a-z_A-Z0-9]+\.cgi\?/feature.cgi?/;
843            }
844            else
845            {
846                my $user = $cgi->param('user');
847                if (! $user) { $user = "" }
848                my $trans = $cgi->param('translate') ? "&translate=1" : "";
849                my $sprout = $cgi->param('SPROUT') ? "&SPROUT=1" : "";
850    ###a
851    
852    ### This used to be
853    ###     my $link = &FIG::cgi_url . "/protein.cgi?prot=$fid&user=$user$trans$sprout";
854    ###
855    ### The cost became prohibitive in the subsystem spreadsheets.  Hence, we cache the value
856    ###
857    ### RAO
858    
859                #if (! $cgi_url) { $cgi_url = &FIG::cgi_url }
860                #$link = $cgi_url . "/protein.cgi?prot=$fid&user=$user$trans$sprout";
861                $link = "$top/protein.cgi?prot=$fid&user=$user$trans$sprout\&new_framework=$new_framework";
862                $link =~ s/[a-z_A-Z0-9]+\.cgi\?/protein.cgi?/;
863            }
864            if ($just_url)
865            {
866                return $link;
867            }
868            else
869            {
870                return "<a href='$link'>$n</a>";
871            }
872        }
873        return $fid;
874    }
875    
876    sub family_link {
877        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
878        my($family,$user) = @_;
879    
880        return $family;
881    }
882    
883    
884    sub get_html {
885        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
886        my( $url, $type, $kv_pairs) = @_;
887        my( $encoded, $ua, $args, @args, $out, @output, $x );
888    
889        $ua = new LWP::UserAgent;
890        $ua->timeout( 900 );
891        if ($type =~/post/i)
892        {
893            $args = [];
894            foreach $x (@$kv_pairs)
895            {
896                push(@$args, ( $x->[0], $x->[1]) );
897            }
898            my $request  = POST $url, $args;
899            my $response = $ua->request($request);
900            $out = $response->content;
901        }
902    
903        if ($type =~/get/i)
904        {
905            @args = ();
906            foreach $x (@$kv_pairs)
907            {
908                push( @args, "$x->[0]=" . uri_escape($x->[1]) );
909            }
910    
911            if (@args > 0)
912            {
913                $url .= "?" . join("&",@args);
914            }
915            $request = new HTTP::Request('GET', $url);
916            my $response = $ua->request($request);
917    
918            if ($response->is_success)
919            {
920                $out = $response->content;
921            }
922            else
923            {
924                $out = "<H1>Error: " . $response->code . "</H1>" . $response->message;
925            }
926        }
927    #   set up a document with proper eol characters
928        @output = split(/[\012\015]+/,$out);
929        foreach $out (@output) { $out .= "\n"; }
930    
931    #   Now splice in a line of the form <base href=URL> to cause all relative links to work
932    #   properly.  Remove the header.
933    
934        for ($i=0; ($i < @output) && ($output[$i] !~ /^\s*\</); $i++) {}
935        if ($i < @output)
936        {
937    
938            splice(@output,0,$i);
939        }
940    
941        for ($i=0; ($i < @output) && ($output[$i] !~ /\<body\>/i); $i++) {}
942        if ($i == @output)
943        {
944            $i = -1;
945        }
946        splice(@output,$i+1,0,"<base href=\"$url\">\n");
947        return @output;
948    }
949    
950    sub trim_output {
951        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
952        my($out) = @_;
953        my $i;
954    
955        for ($i=0; ($i < @$out) && ($out->[$i] !~ /^\</); $i++) {}
956        splice(@$out,0,$i);
957    
958        for ($i=0; ($i < @$out) && ($out->[$i] !~ /\<body\>/i); $i++) {}
959        if ($i == @$out)
960        {
961            for ($i=0; ($i < @$out) && ($out->[$i] !~ /\<html\>/i); $i++) {}
962            if ($i == @$out)
963            {
964                $i = -1;
965            }
966        }
967        for ($j=$i+1; ($j < @$out) && ($out->[$j] !~ /^\<hr\>$/); $j++) {}
968        if ($j < @$out)
969        {
970            splice(@$out,$i+1,($j-$i));
971        }
972    
973        for ($i=0; ($i < @$out) && ($out->[$i] !~ /\<\/body\>/i); $i++) {}
974        if ($i == @$out)
975        {
976            for ($i=0; ($i < @$out) && ($out->[$i] !~ /\<\/html\>/i); $i++) {}
977        }
978    
979        for ($j=$i-1; ($j > 0) && ($out->[$j] !~ /FIG search/); $j--) {}
980        if ($j > 0)
981        {
982            my @tmp = `cat $html_tail_file`;
983            my $n = @tmp;
984            splice(@$out,$j-$n,$n+1);
985        }
986    }
987    
988    sub set_prot_links {
989        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
990        my($cgi,$x) = @_;
991        my($before,$match,$after);
992    
993        if ($x =~ /^(.*)(fig\|\d+\.\d+\.peg\.\d+)(.*)/s)
994        {
995            $before = $1;
996            $match = $2;
997            $after = $3;
998            return &set_prot_links($cgi,$before) . &HTML::fid_link($cgi,$match) . &set_prot_links($cgi,$after);
999        }
1000        elsif ($x =~ /^(.*)\b([NXYZA][PM]_[0-9\.]+)\b(.*)/s)
1001        {
1002            $before = $1;
1003            $match = $2;
1004            $after = $3;
1005            return &set_prot_links($cgi,$before) . &HTML::refseq_link($cgi,$match) . &set_prot_links($cgi,$after);
1006        }
1007        elsif ($x =~ /^(.*)(gi\|\d+)(.*)/s)
1008        {
1009            $before = $1;
1010            $match = $2;
1011            $after = $3;
1012            return &set_prot_links($cgi,$before) . &HTML::gi_link($cgi,$match) . &set_prot_links($cgi,$after);
1013        }
1014        elsif ($x =~ /^(.*)(tigr\|\w+)(.*)/s)
1015        {
1016            $before = $1;
1017            $match = $2;
1018            $after = $3;
1019            return &set_prot_links($cgi,$before) . &HTML::tigr_link($cgi,$match) . &set_prot_links($cgi,$after);
1020        }
1021        elsif ($x =~ /^(.*)\b(eric\|\S+)\b(.*)/s)
1022        {
1023            $before = $1;
1024            $match = $2;
1025            $after = $3;
1026            return &set_prot_links($cgi,$before) . &HTML::eric_link($cgi,$match) . &set_prot_links($cgi,$after);
1027        }
1028    
1029        elsif ($x =~ /^(.*)\b(bhb\|.*?)\b(.*)/s)
1030        {
1031            $before = $1;
1032            $match = $2;
1033            $after = $3;
1034            return &set_prot_links($cgi,$before) . &HTML::bhb_link($cgi,$match) . &set_prot_links($cgi,$after);
1035        }
1036    
1037        elsif ($x =~ /^(.*)\b(apidb\|[0-9\.a-z_]+)\b(.*)/s)
1038        {
1039            $before = $1;
1040            $match = $2;
1041            $after = $3;
1042            return &set_prot_links($cgi,$before) . &HTML::apidb_link($cgi,$match) . &set_prot_links($cgi,$after);
1043        }
1044    
1045        elsif ($x =~ /^(.*)\b(patric\|.*?)\b(.*)/s)
1046        {
1047            $before = $1;
1048            $match = $2;
1049            $after = $3;
1050            return &set_prot_links($cgi,$before) . &HTML::patric_link($cgi,$match) . &set_prot_links($cgi,$after);
1051        }
1052    
1053        elsif ($x =~ /^(.*)\b(vbrc\|.*?)\b(.*)/s)
1054        {
1055            $before = $1;
1056            $match = $2;
1057            $after = $3;
1058            return &set_prot_links($cgi,$before) . &HTML::vbrc_link($cgi,$match) . &set_prot_links($cgi,$after);
1059        }
1060    
1061        elsif ($x =~ /^(.*)\b(vectorbase\|.*?)\b(.*)/s)
1062        {
1063            $before = $1;
1064            $match = $2;
1065            $after = $3;
1066            return &set_prot_links($cgi,$before) . &HTML::vectorbase_link($cgi,$match) . &set_prot_links($cgi,$after);
1067        }
1068        elsif ($x =~  /^(.*)(uni\|[A-Z0-9]{6})(.*)/s)
1069        {
1070            $before = $1;
1071            $match = $2;
1072            $after = $3;
1073            return &set_prot_links($cgi,$before) . &HTML::uni_link($cgi,$match) . &set_prot_links($cgi,$after);
1074        }
1075        elsif ($x =~ /^(.*)(sp\|[A-Z0-9]{6})(.*)/s)
1076        {
1077            $before = $1;
1078            $match = $2;
1079            $after = $3;
1080            return &set_prot_links($cgi,$before) . &HTML::sp_link($cgi,$match) . &set_prot_links($cgi,$after);
1081        }
1082        elsif ($x =~ /^(.*)(pirnr\|NF\d+)(.*)/s)
1083        {
1084            $before = $1;
1085            $match = $2;
1086            $after = $3;
1087            return &set_prot_links($cgi,$before) . &HTML::pir_link($cgi,$match) . &set_prot_links($cgi,$after);
1088        }
1089        elsif ($x =~ /^(.*)(kegg\|[a-z]{2,4}:[a-zA-Z_0-9]+)(.*)/s)
1090        {
1091            $before = $1;
1092            $match = $2;
1093            $after = $3;
1094            return &set_prot_links($cgi,$before) . &HTML::kegg_link($cgi,$match) . &set_prot_links($cgi,$after);
1095        }
1096        elsif ($x =~ /^(.*)(Ensembl[a-zA-Z]+:[a-zA-Z_0-9\.]+)(.*)/s)
1097        {
1098            $before = $1;
1099            $match = $2;
1100            $after = $3;
1101            return &set_prot_links($cgi,$before) . &HTML::ensembl_link($cgi,$match) . &set_prot_links($cgi,$after);
1102        }
1103        elsif ($x =~ /^(.*)(EntrezGene:[a-zA-Z_0-9\.]+)(.*)/s)
1104        {
1105            $before = $1;
1106            $match = $2;
1107            $after = $3;
1108            return &set_prot_links($cgi,$before) . &HTML::entrezgene_link($cgi,$match) . &set_prot_links($cgi,$after);
1109        }
1110        elsif ($x =~ /^(.*)(MIM:[a-zA-Z_0-9\.]+)(.*)/s)
1111        {
1112            $before = $1;
1113            $match = $2;
1114            $after = $3;
1115            return &set_prot_links($cgi,$before) . &HTML::mim_link($cgi,$match) . &set_prot_links($cgi,$after);
1116        }
1117        elsif ($x =~ /^(.*)(HGNC:[a-zA-Z_0-9\.]+)(.*)/s)
1118        {
1119            $before = $1;
1120            $match = $2;
1121            $after = $3;
1122            return &set_prot_links($cgi,$before) . &HTML::hgnc_link($cgi,$match) . &set_prot_links($cgi,$after);
1123        }
1124        elsif ($x =~ /^(.*)(UniGene:[a-zA-Z_0-9\.]+)(.*)/s)
1125        {
1126            $before = $1;
1127            $match = $2;
1128            $after = $3;
1129            return &set_prot_links($cgi,$before) . &HTML::unigene_link($cgi,$match) . &set_prot_links($cgi,$after);
1130        }
1131    # IPI stopped working. turn off for now.
1132    #    elsif ($x =~ /^(.*)(IPI:[a-zA-Z_0-9\.]+)(.*)/s)
1133    #    {
1134    #        $before = $1;
1135    #        $match = $2;
1136    #        $after = $3;
1137    #        return &set_prot_links($cgi,$before) . &HTML::ipi_link($cgi,$match) . &set_prot_links($cgi,$after);
1138    #    }
1139        elsif ($x =~ /^(.*)(WP:[a-zA-Z_0-9\.]+)(.*)/s)
1140        {
1141            #wormbase
1142    
1143            $before = $1;
1144            $match = $2;
1145            $after = $3;
1146            return &set_prot_links($cgi,$before) . &HTML::wp_link($cgi,$match) . &set_prot_links($cgi,$after);
1147        }
1148        elsif ($x =~ /^(.*)(FB:[a-zA-Z_0-9\.]+)(.*)/s)
1149        {
1150            #flybase
1151    
1152            $before = $1;
1153            $match = $2;
1154            $after = $3;
1155            return &set_prot_links($cgi,$before) . &HTML::fb_link($cgi,$match) . &set_prot_links($cgi,$after);
1156        }
1157        elsif ($x =~ /^(.*)(FlyBaseORFNames:[a-zA-Z_0-9\.]+)(.*)/s)
1158        {
1159            #flybase
1160    
1161            $before = $1;
1162            $match = $2;
1163            $after = $3;
1164            return &set_prot_links($cgi,$before) . &HTML::fborf_link($cgi,$match) . &set_prot_links($cgi,$after);
1165        }
1166        elsif ($x =~ /^(.*)(SGD_LOCUS:[a-zA-Z_0-9\.]+)(.*)/s)
1167        {
1168            #flybase
1169    
1170            $before = $1;
1171            $match = $2;
1172            $after = $3;
1173            return &set_prot_links($cgi,$before) . &HTML::sgd_link($cgi,$match) . &set_prot_links($cgi,$after);
1174        }
1175        elsif ($x =~ /^(.*)(tr\|[a-zA-Z0-9]+)(.*)/s)
1176        {
1177    
1178          $before = $1;
1179          $match = $2;
1180          $after = $3;
1181    
1182          return &set_prot_links($cgi,$before) .  &HTML::trembl_link($cgi,$match) . &set_prot_links($cgi,$after);
1183        }
1184        return $x;
1185    }
1186    
1187    sub trembl_link {
1188        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1189        my($cgi,$id) = @_;
1190    
1191        if ($id =~ /^tr\|(.*)/) {
1192          return "<a href='http://ca.expasy.org/uniprot/$1' target=_blank>$id</a>";
1193        } else {
1194          return "invalid call to trembl link";
1195        }
1196    }
1197    
1198    sub refseq_link {
1199        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1200        my($cgi,$id) = @_;
1201    
1202        if ($id =~ /^[NXYZA]P_/)
1203        {
1204            return "<a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=protein&cmd=search&term=$id' target=_blank>$id</a>";
1205        }
1206        elsif ($id =~ /^[NXYZA]M_/)
1207        {
1208            return "<a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=nuccore&cmd=search&term=$id' target=_blank>$id</a>";
1209        }
1210    }
1211    
1212    sub gi_link {
1213        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1214        my($cgi,$gi) = @_;
1215    
1216        if ($gi =~ /^gi\|(\d+)$/)
1217        {
1218            return "<a href='http://www.ncbi.nlm.nih.gov:80/entrez/query.fcgi?cmd=Retrieve&db=Protein&list_uids=$1&dopt=GenPept' target=_blank>$gi</a>";
1219        }
1220        return $gi;
1221    }
1222    
1223    sub tigr_link {
1224        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1225        my($cgi,$tigr) = @_;
1226    
1227        if ($tigr =~ /^tigr\|(NT|ntbp|ntbpA|BA|BMAA|BXB|GBA)(\w+)$/)
1228        {
1229            my $id=$1.$2;
1230            return "<a href=\"http://pathema.tigr.org/tigr-scripts/pathema/shared/GenePage.cgi?locus=$id\" target=_blank>$tigr</a> (Pathema)";
1231        }
1232        elsif ($tigr =~ /^tigr\|(\S+)$/)
1233        {
1234            return "<a href=\"http://www.tigr.org/tigr-scripts/CMR2/GenePage.spl?locus=$1\" target=_blank>$tigr</a>";
1235        }
1236        return $tigr;
1237    }
1238    
1239    sub eric_link {
1240        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1241        my($cgi,$eric) = @_;
1242    
1243        if ($eric =~ /^eric\|(\S+)/)
1244        {
1245            return "<a href=\"https://asap.ahabs.wisc.edu/asap/feature_info.php?FeatureID=$1\" target=_blank>$eric</a>";
1246        }
1247        return $eric;
1248    }
1249    
1250    sub bhb_link {
1251        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1252        my($cgi,$bhb) = @_;
1253    
1254        return "<a href=\"http://www.biohealthbase.org\" target=_blank>$bhb</a>";
1255    }
1256    
1257    sub apidb_link {
1258        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1259        my($cgi,$api) = @_;
1260    
1261        if ($api =~ /apidb\|(.*?)\.(.*)$/)
1262        {
1263            return "<a href=\"http://www.apidb.org/cgi-bin/redirect.cgi?taxon_id=$1&source_id=$2\" target=_blank>$api</a>";
1264        }
1265        return $api;
1266    }
1267    
1268    sub patric_link {
1269        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1270        my($cgi,$patric) = @_;
1271    
1272        if ($patric =~ /patric\|(.*)/)
1273        {
1274            return "<a href=\"https://patric.vbi.vt.edu/software/curationTool/gep/pgiCuration.php?locus_name=$1\" target=_blank>$patric</a>";
1275        }
1276        return $patric;
1277    }
1278    
1279    sub vbrc_link {
1280        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1281        my($cgi,$vbrc) = @_;
1282    
1283        if ($vbrc =~ /vbrc\|(.*)/)
1284        {
1285            return "<a href=\"http://www.biovirus.org/gene_detail.asp?name=$1\" target=_blank>$vbrc</a>";
1286        }
1287        return $vbrc;
1288    }
1289    
1290    sub vectorbase_link {
1291        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1292        my($cgi,$vec) = @_;
1293        return "<a href=\"http://www.vectorbase.org\" target=_blank>$vec</a>";
1294    }
1295    
1296    
1297    sub uni_link {
1298        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1299        my($cgi,$uni) = @_;
1300    
1301        if ($uni =~ /^uni\|(\S+)$/)
1302        {
1303            #return "<a href=http://www.pir.uniprot.org/cgi-bin/upEntry?id=$1>$uni</a>";
1304            return "<a href='http://www.ebi.uniprot.org/uniprot-srv/uniProtView.do?proteinAc=$1' target=_blank>$uni</a>";
1305        }
1306        return $uni;
1307    }
1308    
1309    sub sp_link {
1310        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1311        my($cgi,$sp) = @_;
1312    
1313        if ($sp =~ /^sp\|(\S+)$/)
1314        {
1315            return "<a href='http://us.expasy.org/cgi-bin/get-sprot-entry?$1' target=_blank>$sp</a>";
1316        }
1317        return $sp;
1318    }
1319    
1320    sub pir_link {
1321        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1322        my($cgi,$pir) = @_;
1323    
1324        if ($pir =~ /^pirnr\|(NF\d+)$/)
1325        {
1326            return "<a href='http://pir.georgetown.edu/cgi-bin/nfEntry.pl?id=$1' target=_blank>$pir</a>";
1327        }
1328        return $pir;
1329    }
1330    
1331    sub kegg_link {
1332        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1333        my($cgi,$kegg) = @_;
1334    
1335        if ($kegg =~ /^kegg\|([^:]+):(\S+)$/)
1336        {
1337            return "<a href='http://www.genome.ad.jp/dbget-bin/www_bget?$1+$2' target=_blank>$kegg</a>";
1338        }
1339        return $kegg;
1340    }
1341    
1342    sub ensembl_link {
1343        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1344        my($cgi,$ensembl) = @_;
1345    
1346        if ($ensembl =~ /^(\S+):(\S+)$/)
1347        {
1348            my $what=$1;
1349            my $key=$2;
1350            my $idx="All";
1351            if ($what eq "EnsemblGene") { $idx = "Gene" }
1352            if ($what eq "EnsemblTranscript") { $idx = "All" }
1353            if ($what eq "EnsemblProtein") { $idx = "All" }
1354    
1355            #I really want to get right to the transcript and peptide pages, but
1356            #can't see how to do that without knowing the org name too, which
1357            #I don't know at this point. (ensembl org name, not real org name)
1358    
1359            return "<a href='http://www.ensembl.org/Homo_sapiens/searchview?species=all&idx=$idx&q=$key' target=_blank>$ensembl</a>";
1360        }
1361        return $ensembl;
1362    }
1363    
1364    sub entrezgene_link {
1365        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1366        my($cgi,$entrezgene) = @_;
1367    
1368        if ($entrezgene =~ /^EntrezGene:(\S+)$/)
1369        {
1370            return "<a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=full_report&list_uids=$1' target=_blank>$entrezgene</a>";
1371        }
1372        return $entrezgene;
1373    }
1374    
1375    sub mim_link {
1376        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1377        my($cgi,$mim) = @_;
1378    
1379        if ($mim =~ /^MIM:(\S+)$/)
1380        {
1381            return "<a href='http://www3.ncbi.nlm.nih.gov/entrez/dispomim.cgi?id=$1' target=_blank>$mim</a>";
1382        }
1383        return $mim;
1384    }
1385    
1386    sub hgnc_link {
1387        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1388        my($cgi,$hgnc) = @_;
1389    
1390        if ($hgnc =~ /^HGNC:(\S+)$/)
1391        {
1392            return "<a href='http://www.gene.ucl.ac.uk/cgi-bin/nomenclature/searchgenes.pl?field=symbol&anchor=equals&match=$1&symbol_search=Search&number=50&format=html&sortby=symbol' target=_blank>$hgnc</a>";
1393        }
1394        return $mim;
1395    }
1396    
1397    sub unigene_link {
1398        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1399        my($cgi,$unigene) = @_;
1400    
1401        if ($unigene =~ /^UniGene:(\S+)$/)
1402        {
1403            return "<a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=unigene&cmd=search&term=$1' target=_blank>$unigene</a>";
1404        }
1405        return $unigene;
1406    }
1407    
1408    sub ipi_link {
1409        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1410        my($cgi,$ipi) = @_;
1411    
1412        if ($ipi =~ /^IPI:(\S+)$/)
1413        {
1414            return "<a href='http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-id+AEoS1R8Jnn+-e+[IPI:\'$1\']+-qnum+1+-enum+1' target=_blank>$ipi</a>";
1415        }
1416        return $ipi;
1417    }
1418    
1419    sub wp_link {
1420        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1421        my($cgi,$wp) = @_;
1422    
1423        #wormbase
1424    
1425        if ($wp =~ /^WP:(\S+)$/)
1426        {
1427            return "<a href='http://www.wormbase.org/db/searches/basic?class=Any&query=$1&Search=Search' target=_blank>$wp</a>";
1428        }
1429        return $wp;
1430    }
1431    
1432    sub fb_link {
1433        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1434        my($cgi,$fb) = @_;
1435    
1436        #flybase
1437    
1438        if ($fb =~ /^FB:(\S+)$/)
1439        {
1440            return "<a href='http://flybase.bio.indiana.edu/.bin/fbidq.html?$1' target=_blank>$fb</a>";
1441        }
1442        return $fb;
1443    }
1444    
1445    sub fborf_link {
1446        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1447        my($cgi,$fb) = @_;
1448    
1449        #flybase
1450    
1451        if ($fb =~ /^FlyBaseORFNames:(\S+)$/)
1452        {
1453            return "<a href='http://flybase.bio.indiana.edu/.bin/fbidq.html?$1' target=_blank>$fb</a>";
1454        }
1455        return $fb;
1456    }
1457    
1458    sub sgd_link {
1459        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1460        my($cgi,$sgd) = @_;
1461    
1462        #yeast
1463    
1464        if ($sgd =~ /^SGD_LOCUS:(\S+)$/)
1465        {
1466            return "<a href='http://db.yeastgenome.org/cgi-bin/locus.pl?locus=$1' target=_blank>$sgd</a>";
1467        }
1468        return $sgd;
1469    }
1470    
1471    
1472    
1473    
1474    sub set_map_links {
1475        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1476        my($cgi,$x) = @_;
1477        my($before,$match,$after);
1478    
1479        my $org = ($cgi->param('org') || $cgi->param('genome') || "");
1480    
1481        if ($x =~ /^(.*)(MAP\d+)(.*)/s)
1482        {
1483            $before = $1;
1484            $match = $2;
1485            $after = $3;
1486            return &set_map_links($cgi,$before) . &map_link($cgi,$match,$org) . &set_map_links($cgi,$after);
1487        }
1488        return $x;
1489    }
1490    
1491    
1492    
1493    sub map_link {
1494        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1495        my($cgi,$map,$org) = @_;
1496    
1497        $user = $cgi->param('user');
1498        $user = $user ? $user : "";
1499        $org = $org ? $org : "";
1500    
1501        my $url = "show_kegg_map.cgi?user=$user&map=$map&org=$org";
1502    #rel    my $url = &FIG::cgi_url() . "/show_kegg_map.cgi?user=$user&map=$map&org=$org";
1503        my $link = "<a href=\"$url\">$map</a>";
1504        return $link;
1505    }
1506    
1507    sub java_buttons {
1508        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1509      ## ADDED BY RAE
1510      # Provides code to include check all/first half/second half/none for javascrspt
1511      # this takes two variables - the form name provided in start_form with the
1512      # -name => field and the checkbox name
1513      my ($form, $button)=@_;
1514    
1515      $java_script="<input type=\"button\" name=\"CheckAll\" value=\"Check All\"\nonClick=\"checkAll(document.$form.$button)\">\n";
1516      $java_script.="<input type=\"button\" name=\"CheckFirst\" value=\"Check First Half\"\nonClick=\"checkFirst(document.$form.$button)\">\n";
1517      $java_script.="<input type=\"button\" name=\"CheckSecond\" value=\"Check Second Half\"\nonClick=\"checkSecond(document.$form.$button)\">\n";
1518      $java_script.="<input type=\"button\" name=\"UnCheckAll\" value=\"Uncheck All\"\nonClick=\"uncheckAll(document.$form.$button)\">\n";
1519    
1520      return $java_script;
1521    }
1522    
1523    sub sub_link {
1524        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1525        my($cgi,$sub) = @_;
1526        my($sub_link);
1527    
1528        my $user = $cgi->param('user');
1529        my $esc_sub = uri_escape( $sub );
1530        $sub =~ s/\_/ /g;
1531        if ($user)
1532        {
1533            $sub_link = "<a href=./subsys.cgi?ssa_name=$esc_sub&request=show_ssa&user=$user>$sub</a>";
1534        }
1535        else
1536        {
1537            $sub_link = "<a href=\"display_subsys.cgi?ssa_name=$esc_sub&request=show_ssa&sort=by_phylo\">$sub</a>";
1538        }
1539        return $sub_link;
1540    }
1541    
1542    sub reaction_link {
1543        my($reaction) = @_;
1544        if ($reaction =~ /^(\*)?(R\d+)/)
1545        {
1546            return "<a href=\"http://www.genome.ad.jp/dbget-bin/www_bget?rn+$2\" target=reaction$$>$reaction</a>";
1547        }
1548        return $reaction;
1549    }
1550    
1551    
1552    sub html_for_assignments {
1553        my($fig,$user,$peg_sets) = @_;
1554        my $i;
1555    
1556        my @vals = ();
1557        my $set = 1;
1558        foreach $peg_set (@$peg_sets)
1559        {
1560            for ($i=0; ($i < @$peg_set); $i++)
1561            {
1562                $peg = $peg_set->[$i];
1563                push(@vals,'show=' . join("@",($set,$i+1,$peg,&FIG::abbrev($fig->org_of($peg)),"")));
1564            }
1565            $set++;
1566        }
1567    
1568        $ENV{'REQUEST_METHOD'} = 'GET';
1569        $ENV{'QUERY_STRING'} = join('&',('request=show_commentary',"uni=1","user=$user",@vals));
1570        my $out = join("",`$FIG_Config::fig/CGI/chromosomal_clusters.cgi`);
1571        $out =~ s/^.*?<form/<form/si;
1572        $out =~ s/^(.*)<table.*/$1/si;
1573        return $out;
1574    }
1575    
1576    =head1 rss_feed
1577    
1578    Add something to the RSS feed. The rss feeds are stored in the Html directory, and there are several RSS feeds:
1579            SEED.rss                - everything gets written here
1580            SEEDgenomes.rss                 - whenever a genome is added to the SEED
1581            SEEDsubsystems.rss      - whenever a subsystem is edited (or should this be added?)
1582    
1583    
1584    RSS feeds must contain a title, description, and link. The title is what is seen e.g. from the firefox or safari pull down menu. The description is seen from within an rss aggregator, and may be displayed on web pages and so on.
1585    
1586    The method takes a reference to an array containing the file names for the RSS feeds to add your item to, and a hash of items for the xml. Only title, description, and link are required tags in the XML.
1587    
1588    The file names are the full name of the file, eg SEEDsubsystems.rss, SEEDgenomes.rss. Be aware that this is a file name, though, so don't uses special characters. The path will be added.
1589    
1590    The has can have these keys:
1591    
1592    REQUIRED:
1593    title       : the title. This is usually what is seen by the user in the pull down menu
1594    description : a more complete description that is often seen is rss viewers but not always
1595    link        : link to the item that was added/edited
1596    All other keys are treated as optional RSS arguments and written to the file.
1597    
1598    At most, $max_entries recent entries are stored in the rss file, and this is currently 50.
1599    
1600    RSS files are quite simple, and contain some standard header information, and then individual items surrounded by an <item> </item> tag. Note that there is also an initial title/description/link set that describes the file.
1601    
1602    
1603    =cut
1604    
1605    sub rss_feed {
1606     shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1607     my ($files, $args)=@_;
1608    
1609     # how many entries to store in the file
1610     my $max_entries=50;
1611    
1612     foreach my $a (keys %$args) {if ($a =~ /^-(.*)/) {my $b=$1; $args->{$b}=$args->{$a}; delete $args->{$a}}}
1613    
1614     my $filepath=$FIG_Config::fig."/CGI/Html/rss";
1615     # check for the directory and if not, make it
1616     mkdir $filepath unless (-d $filepath);
1617    
1618     # note that $info is a hash of references to hashes that are written out as headers in the file
1619     my $info=
1620     {
1621      "SEED.rss" =>
1622       {
1623            title           => "The SEED",
1624            description     => "Latest news from the SEED",
1625            link            => "Html/rss/SEED.rss",
1626       },
1627    
1628      "SEEDsubsystems.rss" =>
1629      {
1630            title           => "SEED Subsystems",
1631            description     => "Recently updated SEED subsystems",
1632            link            => "Html/rss/SEEDsubsystems.rss",
1633      },
1634    
1635      "SEEDsubsystems.rss" =>
1636      {
1637            title           => "SEED Genomes",
1638            description     => "Genomes recently added to the SEED",
1639            link            => &FIG::cgi_url()."/Html/rss/SEEDsubsystems.rss",
1640      },
1641    
1642     };
1643    
1644    
1645     # build the new xml
1646     my $xml = "\t<item>\n";
1647     foreach my $qw ("title", "description", "link") {
1648      unless ($args->{$qw}) {
1649       print STDERR "You need to include a $qw tag in your RSS description\n";
1650       return(0);
1651      }
1652      # we need to do something a bit funky with the link. We can't have ampersands in the <link> </link> in valid html
1653      # so we are going to pull out the links and uri_escape just the part after the .cgi
1654      if ($qw eq "link")
1655      {
1656       $args->{$qw} =~ /^(.*?\.cgi.)(.*)$/;
1657       $args->{$qw} = $1.uri_escape($2) if ($1 && $2);
1658      }
1659    
1660      $xml .= "\t\t<$qw>".$args->{$qw}."</$qw>\n";
1661      delete $args->{$qw};
1662     }
1663    
1664     foreach my $tag (grep {!/type/i} keys %$args)
1665     {
1666      $xml .= "\t\t<$tag>".$args->{$tag}."</$tag>\n";
1667     }
1668    
1669     $xml .= "\t</item>\n";
1670    
1671    
1672     my @files=("SEED.rss");
1673     if ($args->{"type"}) {push @files, "SEED.$type.rss"}
1674    
1675     foreach my $file ("SEED.rss", @$files)
1676     {
1677      if (-e "$filepath/$file")
1678      {
1679       my @out; # the new content of the file
1680       my $itemcount=0; # how many <item> </item>'s are we keeping
1681       my $initem; # are we in an item?
1682       open(IN, "$filepath/$file") || die "Can't open $filepath/$file";
1683       while (<IN>)
1684       {
1685        if (/\<item\>/) {
1686         push @out, $xml, unless ($itemcount);
1687         $itemcount++;
1688         $initem=1;
1689        }
1690        if (/\<\/item\>/) {$initem=0; next if ($itemcount > $max_entries)}
1691        next if ($initem && $itemcount > $max_entries);
1692        push @out, $_;
1693       }
1694       close IN;
1695       open(OUT, ">$filepath/$file") || die "Can't open $filepath/$file for writing";
1696       print OUT @out;
1697      }
1698      else
1699      {
1700       open(OUT, ">$filepath/$file") || die "Can't open $filepath/$file for writing";
1701       print OUT "<?xml version=\"1.0\"?>\n<rss version=\"2.0\">\n<channel>\n";
1702       if ($info->{$file})
1703       {
1704         # we're going to sanity check each of the three options we output, just to be sure
1705         foreach my $qw ("title", "description", "link")
1706         {
1707           if ($info->{$file}->{$qw})
1708           {
1709              print OUT "<$qw>", $info->{$file}->{$qw}, "</$qw>\n";
1710           } else {
1711              print STDERR "Please add a $qw for $file\n"; print OUT "<$qw>$file</$qw>\n";
1712           }
1713         }
1714       }
1715       else {
1716        print STDERR "Please define title, link, and description information for $file\n";
1717        print OUT "<title>$file</title>\n<description>An RSS feed</description>\n<link>", &FIG::cgi_url, "</link>\n";
1718       }
1719       print OUT "\n", $xml;
1720       print OUT "\n", "</channel>\n</rss>\n"
1721      }
1722     }
1723    }
1724    
1725    
1726    
1727    1;
1728    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.99

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3