[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.81, Tue Jan 24 23:51:22 2006 UTC revision 1.90, Sat May 6 22:04:12 2006 UTC
# Line 28  Line 28 
28  use HTTP::Request::Common;  use HTTP::Request::Common;
29  use POSIX;  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    
34    
35  my $top_link_cache;  my $top_link_cache;
36    
# Line 78  Line 81 
81      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
82      my($additional_insert, $user, %options ) = @_;      my($additional_insert, $user, %options ) = @_;
83    
84        local $/ = "\n";
85    
86      my $header_name = $options{header_name} ? $options{header_name} : "html.hdr";      my $header_name = $options{header_name} ? $options{header_name} : "html.hdr";
87      my $tail_name = $options{tail_name} ? $options{tail_name} : "html.tail";      my $tail_name = $options{tail_name} ? $options{tail_name} : "html.tail";
88    
# Line 156  Line 161 
161  sub show_page {  sub show_page {
162      #warn "SHOWPAGE: cgi=", Dumper(@_);      #warn "SHOWPAGE: cgi=", Dumper(@_);
163      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
164      my($cgi,$html,$no_home, $alt_header, $css, $javasrc, $cookie) = @_;      my($cgi,$html,$no_home, $alt_header, $css, $javasrc, $cookie, $options) = @_;
165      my $i;      my $i;
166    
167      my $top = top_link();      my $top = top_link();
# Line 171  Line 176 
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      #               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")      #     $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      #     $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      # Find the HTML header
182      #      #
# Line 189  Line 195 
195      }      }
196      else      else
197      {      {
198          @html_hdr = compute_html_header(undef,$user);          @html_hdr = compute_html_header(undef,$user,%$options);
199      }      }
200    
201      # RAE: I am offloading the handling of cookies to CGI.pm since I don't know how they are set up.      # RAE: I am offloading the handling of cookies to CGI.pm since I don't know how they are set up.
# Line 515  Line 521 
521    
522  }  }
523    
524    
525    =head1 make_table
526    
527    The main method to convert an array into a table.
528    
529    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    
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 {  sub make_table {
536      my($col_hdrs,$tab,$title, %options ) = @_;      my($col_hdrs,$tab,$title, %options ) = @_;
537      my(@tab);      my(@tab);
# Line 539  Line 556 
556              );              );
557      }      }
558      push(@tab,"</table>\n");      push(@tab,"</table>\n");
559    
560        # excelfile should be appropriate for a filename (no spaces/special characters)
561        if (defined $options{"excelfile"}) {push @tab, $raelib->tab2excel($col_hdrs,$tab,$title,\%options,$options{"excelfile"})}
562    
563      return join("",@tab);      return join("",@tab);
564  }  }
565    
# Line 845  Line 866 
866          }          }
867          else          else
868          {          {
869              return "<a href=$link>$n</a>";              return "<a href='$link'>$n</a>";
870          }          }
871      }      }
872      return $fid;      return $fid;
# Line 988  Line 1009 
1009          $after = $3;          $after = $3;
1010          return &set_prot_links($cgi,$before) . &HTML::gi_link($cgi,$match) . &set_prot_links($cgi,$after);          return &set_prot_links($cgi,$before) . &HTML::gi_link($cgi,$match) . &set_prot_links($cgi,$after);
1011      }      }
1012      elsif ($x =~ /^(.*)(tigr\|[0-9a-zA-Z]+)(.*)/s)      elsif ($x =~ /^(.*)(tigr\|\w+)(.*)/s)
1013      {      {
1014          $before = $1;          $before = $1;
1015          $match = $2;          $match = $2;
1016          $after = $3;          $after = $3;
1017          return &set_prot_links($cgi,$before) . &HTML::tigr_link($cgi,$match) . &set_prot_links($cgi,$after);          return &set_prot_links($cgi,$before) . &HTML::tigr_link($cgi,$match) . &set_prot_links($cgi,$after);
1018      }      }
1019      elsif ($x =~ /^(.*)\beric\|\w+\b(.*)/s)      elsif ($x =~ /^(.*)\b(eric\|\S+)\b(.*)/s)
1020      {      {
1021          $before = $1;          $before = $1;
1022          $match = $2;          $match = $2;
# Line 1091  Line 1112 
1112          $after = $3;          $after = $3;
1113          return &set_prot_links($cgi,$before) . &HTML::mim_link($cgi,$match) . &set_prot_links($cgi,$after);          return &set_prot_links($cgi,$before) . &HTML::mim_link($cgi,$match) . &set_prot_links($cgi,$after);
1114      }      }
1115      elsif ($x =~ /^(.*)(UniGene:[a-zA-Z_0-9\.]+)(.*)/s)      elsif ($x =~ /^(.*)(HGNC:[a-zA-Z_0-9\.]+)(.*)/s)
1116      {      {
1117          $before = $1;          $before = $1;
1118          $match = $2;          $match = $2;
1119          $after = $3;          $after = $3;
1120          return &set_prot_links($cgi,$before) . &HTML::unigene_link($cgi,$match) . &set_prot_links($cgi,$after);          return &set_prot_links($cgi,$before) . &HTML::hgnc_link($cgi,$match) . &set_prot_links($cgi,$after);
1121      }      }
1122      elsif ($x =~ /^(.*)(IPI:[a-zA-Z_0-9\.]+)(.*)/s)      elsif ($x =~ /^(.*)(UniGene:[a-zA-Z_0-9\.]+)(.*)/s)
1123      {      {
1124          $before = $1;          $before = $1;
1125          $match = $2;          $match = $2;
1126          $after = $3;          $after = $3;
1127          return &set_prot_links($cgi,$before) . &HTML::ipi_link($cgi,$match) . &set_prot_links($cgi,$after);          return &set_prot_links($cgi,$before) . &HTML::unigene_link($cgi,$match) . &set_prot_links($cgi,$after);
1128      }      }
1129    # IPI stopped working. turn off for now.
1130    #    elsif ($x =~ /^(.*)(IPI:[a-zA-Z_0-9\.]+)(.*)/s)
1131    #    {
1132    #        $before = $1;
1133    #        $match = $2;
1134    #        $after = $3;
1135    #        return &set_prot_links($cgi,$before) . &HTML::ipi_link($cgi,$match) . &set_prot_links($cgi,$after);
1136    #    }
1137      elsif ($x =~ /^(.*)(WP:[a-zA-Z_0-9\.]+)(.*)/s)      elsif ($x =~ /^(.*)(WP:[a-zA-Z_0-9\.]+)(.*)/s)
1138      {      {
1139          #wormbase          #wormbase
# Line 1173  Line 1202 
1202      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1203      my($cgi,$tigr) = @_;      my($cgi,$tigr) = @_;
1204    
1205      if ($tigr =~ /^tigr\|(NT|ntbp|ntbpA|BA|BMAA|BXB|GBA)([0-9a-zA-Z]+)$/)      if ($tigr =~ /^tigr\|(NT|ntbp|ntbpA|BA|BMAA|BXB|GBA)(\w+)$/)
1206      {      {
1207          my $id=$1.$2;          my $id=$1.$2;
1208          return "<a href=\"http://pathema.tigr.org/tigr-scripts/pathema/shared/GenePage.cgi?locus=$id\">$tigr</a> (Pathema)";          return "<a href=\"http://pathema.tigr.org/tigr-scripts/pathema/shared/GenePage.cgi?locus=$id\">$tigr</a> (Pathema)";
1209      }      }
1210      elsif ($tigr =~ /^tigr\|([0-9a-zA-Z]+)$/)      elsif ($tigr =~ /^tigr\|(\S+)$/)
1211      {      {
1212          return "<a href=\"http://www.tigr.org/tigr-scripts/CMR2/GenePage.spl?locus=$1\">$?tigr</a>";          return "<a href=\"http://www.tigr.org/tigr-scripts/CMR2/GenePage.spl?locus=$1\">$tigr</a>";
1213      }      }
1214      return $tigr;      return $tigr;
1215  }  }
# Line 1189  Line 1218 
1218      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1219      my($cgi,$eric) = @_;      my($cgi,$eric) = @_;
1220    
1221      if ($eric =~ /^eric\|(\w+)$/)      if ($eric =~ /^eric\|(\S+)/)
1222      {      {
1223          return "<a href=\"https://asap.ahabs.wisc.edu/asap/feature_info.php?FeatureID=$1\">$eric</a>";          return "<a href=\"https://asap.ahabs.wisc.edu/asap/feature_info.php?FeatureID=$1\">$eric</a>";
1224      }      }
# Line 1295  Line 1324 
1324      {      {
1325          my $what=$1;          my $what=$1;
1326          my $key=$2;          my $key=$2;
1327          my $idx="all";          my $idx="All";
1328          if ($what eq "EnsemblGene") { $idx = "Gene" }          if ($what eq "EnsemblGene") { $idx = "Gene" }
1329          if ($what eq "EnsemblTranscript") { $idx = "all" }          if ($what eq "EnsemblTranscript") { $idx = "All" }
1330          if ($what eq "EnsemblProtein") { $idx = "all" }          if ($what eq "EnsemblProtein") { $idx = "All" }
1331    
1332          #I really want to get right to the transcript and peptide pages, but          #I really want to get right to the transcript and peptide pages, but
1333          #can't see how to do that without knowing the org name too, which          #can't see how to do that without knowing the org name too, which
1334          #I don't know at this point. (ensembl org name, not real org name)          #I don't know at this point. (ensembl org name, not real org name)
1335    
1336          return "<a href=http://www.ensembl.org/Homo_sapiens/textview?species=all&idx=$idx&q=$key>$ensembl</a>";          return "<a href=http://www.ensembl.org/Homo_sapiens/searchview?species=all&idx=$idx&q=$key>$ensembl</a>";
1337      }      }
1338      return $ensembl;      return $ensembl;
1339  }  }
# Line 1331  Line 1360 
1360      return $mim;      return $mim;
1361  }  }
1362    
1363    sub hgnc_link {
1364        shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1365        my($cgi,$hgnc) = @_;
1366    
1367        if ($hgnc =~ /^HGNC:(\S+)$/)
1368        {
1369            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>$hgnc</a>";
1370        }
1371        return $mim;
1372    }
1373    
1374  sub unigene_link {  sub unigene_link {
1375      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
1376      my($cgi,$unigene) = @_;      my($cgi,$unigene) = @_;
# Line 1463  Line 1503 
1503      my($sub_link);      my($sub_link);
1504    
1505      my $user = $cgi->param('user');      my $user = $cgi->param('user');
     if ($user)  
     {  
1506          my $esc_sub = uri_escape( $sub );          my $esc_sub = uri_escape( $sub );
1507          $sub =~ s/\_/ /g;          $sub =~ s/\_/ /g;
1508        if ($user)
1509        {
1510          $sub_link = "<a href=./subsys.cgi?ssa_name=$esc_sub&request=show_ssa&user=$user>$sub</a>";          $sub_link = "<a href=./subsys.cgi?ssa_name=$esc_sub&request=show_ssa&user=$user>$sub</a>";
1511      }      }
1512      else      else
1513      {      {
1514          $sub_link = $sub;          $sub_link = "<a href=\"display_subsys.cgi?ssa_name=$esc_sub&request=show_ssa&sort=by_phylo\">$sub</a>";
1515      }      }
1516      return $sub_link;      return $sub_link;
1517  }  }

Legend:
Removed from v.1.81  
changed lines
  Added in v.1.90

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3