[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.97, Tue Jul 25 19:32:19 2006 UTC revision 1.100, Sun Sep 24 15:22:58 2006 UTC
# Line 17  Line 17 
17    
18  package HTML;  package HTML;
19    
20    use strict;
21  use Tracer;  use Tracer;
22  use FIG;  use FIG;
23  use Carp;  use Carp;
# Line 28  Line 29 
29  use HTTP::Request::Common;  use HTTP::Request::Common;
30  use POSIX;  use POSIX;
31    
32  use raelib; # now used for the excel function, that should eventually end up in here. Way too experimental!  #use raelib; # now used for the excel function, that should eventually end up in here. Way too experimental!
33  my $raelib=new raelib;  my $raelib;
34    
35    
36  my $top_link_cache;  my $top_link_cache;
# Line 181  Line 182 
182      # Find the HTML header      # Find the HTML header
183      #      #
184    
185      my $html_tail_file = "./Html/$tail_name";      ### TRS ### "tail_name" has no value here.
186      if (! -f $html_tail_file)      my $html_tail_file = ""; # "./Html/$tail_name";
187      {  #    if (! -f $html_tail_file)
188          $html_tail_file = "$FIG_Config::fig/CGI/Html/$tail_name";  #    {
189      }  #        $html_tail_file = "$FIG_Config::fig/CGI/Html/$tail_name";
190    #    }
191    
192      my $user = $cgi->param('user') || "";      my $user = $cgi->param('user') || "";
193      my @html_hdr;      my @html_hdr;
# Line 415  Line 417 
417          # BASE href needs to be absolute. RDO.          # BASE href needs to be absolute. RDO.
418          #          #
419          #          #
420          $base_url = &FIG::cgi_url;  #        $base_url = &FIG::cgi_url;
421  #       my $base_url = $FIG_Config::cgi_base;  #       my $base_url = $FIG_Config::cgi_base;
422  #       if ( ! $base_url )                      # if cgi_base was not defined  #       if ( ! $base_url )                      # if cgi_base was not defined
423  #       {  #       {
# Line 558  Line 560 
560      push(@tab,"</table>\n");      push(@tab,"</table>\n");
561    
562      # excelfile should be appropriate for a filename (no spaces/special characters)      # excelfile should be appropriate for a filename (no spaces/special characters)
563      if (defined $options{"excelfile"}) {push @tab, $raelib->tab2excel($col_hdrs,$tab,$title,\%options,$options{"excelfile"})}      if (defined $options{"excelfile"}) {
564            if (! defined($raelib)) {
565                require raelib;
566                $raelib = new raelib;
567            }
568            push @tab, $raelib->tab2excel($col_hdrs,$tab,$title,\%options,$options{"excelfile"})}
569    
570      return join("",@tab);      return join("",@tab);
571  }  }
# Line 833  Line 840 
840          my $link;          my $link;
841          my $new_framework = $cgi->param('new_framework') ? 1 : 0;          my $new_framework = $cgi->param('new_framework') ? 1 : 0;
842          #added to format prophage and path island links to feature.cgi          #added to format prophage and path island links to feature.cgi
843          if ($1 ne "peg")          my $sprout = $cgi->param('SPROUT') ? "&SPROUT=1" : "";
844            if ($1 ne "peg" && ! $sprout)
845          {          {
846             my $user = $cgi->param('user');             my $user = $cgi->param('user');
847             if (! $user) { $user = "" }             if (! $user) { $user = "" }
848             my $sprout = $cgi->param('SPROUT') ? "&SPROUT=1" : "";             $link = "$top/feature.cgi?feature=$fid&user=$user$sprout";
            $link = "$top/feature.cgi?feature=$fid&user=$user$trans$sprout";  
849             $link =~ s/[a-z_A-Z0-9]+\.cgi\?/feature.cgi?/;             $link =~ s/[a-z_A-Z0-9]+\.cgi\?/feature.cgi?/;
850          }          }
851          else          else
# Line 912  Line 919 
919          {          {
920              $url .= "?" . join("&",@args);              $url .= "?" . join("&",@args);
921          }          }
922          $request = new HTTP::Request('GET', $url);          my $request = new HTTP::Request('GET', $url);
923          my $response = $ua->request($request);          my $response = $ua->request($request);
924    
925          if ($response->is_success)          if ($response->is_success)
# Line 930  Line 937 
937    
938  #   Now splice in a line of the form <base href=URL> to cause all relative links to work  #   Now splice in a line of the form <base href=URL> to cause all relative links to work
939  #   properly.  Remove the header.  #   properly.  Remove the header.
940        my $i;
941      for ($i=0; ($i < @output) && ($output[$i] !~ /^\s*\</); $i++) {}      for ($i=0; ($i < @output) && ($output[$i] !~ /^\s*\</); $i++) {}
942      if ($i < @output)      if ($i < @output) {
     {  
   
943          splice(@output,0,$i);          splice(@output,0,$i);
944      }      }
945    
# Line 950  Line 955 
955  sub trim_output {  sub trim_output {
956      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
957      my($out) = @_;      my($out) = @_;
958      my $i;      my ($i, $j);
959    
960      for ($i=0; ($i < @$out) && ($out->[$i] !~ /^\</); $i++) {}      for ($i=0; ($i < @$out) && ($out->[$i] !~ /^\</); $i++) {}
961      splice(@$out,0,$i);      splice(@$out,0,$i);
# Line 979  Line 984 
984      for ($j=$i-1; ($j > 0) && ($out->[$j] !~ /FIG search/); $j--) {}      for ($j=$i-1; ($j > 0) && ($out->[$j] !~ /FIG search/); $j--) {}
985      if ($j > 0)      if ($j > 0)
986      {      {
987          my @tmp = `cat $html_tail_file`;           ### TRS ###
988          my $n = @tmp;  #        my @tmp = `cat $html_tail_file`;
989          splice(@$out,$j-$n,$n+1);  #        my $n = @tmp;
990    #        splice(@$out,$j-$n,$n+1);
991      }      }
992  }  }
993    
# Line 1391  Line 1397 
1397      {      {
1398          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>";          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>";
1399      }      }
1400      return $mim;      ### TRS ###: was $mim, changed to $hgnc
1401        return $hgnc;
1402  }  }
1403    
1404  sub unigene_link {  sub unigene_link {
# Line 1494  Line 1501 
1501      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1502      my($cgi,$map,$org) = @_;      my($cgi,$map,$org) = @_;
1503    
1504      $user = $cgi->param('user');      my $user = $cgi->param('user');
1505      $user = $user ? $user : "";      $user = $user ? $user : "";
1506      $org = $org ? $org : "";      $org = $org ? $org : "";
1507    
# Line 1512  Line 1519 
1519    # -name => field and the checkbox name    # -name => field and the checkbox name
1520    my ($form, $button)=@_;    my ($form, $button)=@_;
1521    
1522    $java_script="<input type=\"button\" name=\"CheckAll\" value=\"Check All\"\nonClick=\"checkAll(document.$form.$button)\">\n";    my $java_script="<input type=\"button\" name=\"CheckAll\" value=\"Check All\"\nonClick=\"checkAll(document.$form.$button)\">\n";
1523    $java_script.="<input type=\"button\" name=\"CheckFirst\" value=\"Check First Half\"\nonClick=\"checkFirst(document.$form.$button)\">\n";    $java_script.="<input type=\"button\" name=\"CheckFirst\" value=\"Check First Half\"\nonClick=\"checkFirst(document.$form.$button)\">\n";
1524    $java_script.="<input type=\"button\" name=\"CheckSecond\" value=\"Check Second Half\"\nonClick=\"checkSecond(document.$form.$button)\">\n";    $java_script.="<input type=\"button\" name=\"CheckSecond\" value=\"Check Second Half\"\nonClick=\"checkSecond(document.$form.$button)\">\n";
1525    $java_script.="<input type=\"button\" name=\"UnCheckAll\" value=\"Uncheck All\"\nonClick=\"uncheckAll(document.$form.$button)\">\n";    $java_script.="<input type=\"button\" name=\"UnCheckAll\" value=\"Uncheck All\"\nonClick=\"uncheckAll(document.$form.$button)\">\n";
# Line 1541  Line 1548 
1548    
1549  sub reaction_link {  sub reaction_link {
1550      my($reaction) = @_;      my($reaction) = @_;
1551        if ($reaction =~ /^(\*)?(R\d+)/)
     if ($reaction =~ /^R\d+/)  
1552      {      {
1553          return "<a href=\"http://www.genome.ad.jp/dbget-bin/www_bget?rn+$reaction\" target=reaction$$>$reaction</a>";          return "<a href=\"http://www.genome.ad.jp/dbget-bin/www_bget?rn+$2\" target=reaction$$>$reaction</a>";
1554      }      }
1555      return $reaction;      return $reaction;
1556  }  }
1557    
1558    
1559  sub html_for_assignments {  sub html_for_assignments {
1560      my($fig,$user,$peg_sets) = @_;      my($fig,$user,$peg_sets) = @_;
1561      my $i;      my $i;
1562    
1563      my @vals = ();      my @vals = ();
1564      my $set = 1;      my $set = 1;
1565      foreach $peg_set (@$peg_sets)      foreach my $peg_set (@$peg_sets)
1566      {      {
1567          for ($i=0; ($i < @$peg_set); $i++)          for ($i=0; ($i < @$peg_set); $i++)
1568          {          {
1569              $peg = $peg_set->[$i];              my $peg = $peg_set->[$i];
1570              push(@vals,'show=' . join("@",($set,$i+1,$peg,&FIG::abbrev($fig->org_of($peg)),"")));              push(@vals,'show=' . join("@",($set,$i+1,$peg,&FIG::abbrev($fig->org_of($peg)),"")));
1571          }          }
1572          $set++;          $set++;
# Line 1670  Line 1677 
1677    
1678    
1679   my @files=("SEED.rss");   my @files=("SEED.rss");
1680   if ($args->{"type"}) {push @files, "SEED.$type.rss"}   if ($args->{"type"}) {
1681        ### TRS ### "$type" had no value here, so guessed what it should be.
1682        my $type = $args->{type};
1683        push @files, "SEED.$type.rss"
1684    }
1685    
1686   foreach my $file ("SEED.rss", @$files)   foreach my $file ("SEED.rss", @$files)
1687   {   {

Legend:
Removed from v.1.97  
changed lines
  Added in v.1.100

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3