[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.32, Sat Feb 19 00:22:57 2005 UTC revision 1.36, Tue Mar 15 21:01:14 2005 UTC
# Line 21  Line 21 
21  sub compute_html_header  sub compute_html_header
22  {  {
23      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
24      my($additional_insert) = @_;      my($additional_insert,$user) = @_;
25      my $html_hdr_file = "./Html/html.hdr";      my $html_hdr_file = "./Html/html.hdr";
26      if (! -f $html_hdr_file)      if (! -f $html_hdr_file)
27      {      {
# Line 65  Line 65 
65  sub show_page {  sub show_page {
66      #warn "SHOWPAGE: cgi=", Dumper(@_);      #warn "SHOWPAGE: cgi=", Dumper(@_);
67      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
68      my($cgi,$html,$no_home) = @_;      my($cgi,$html,$no_home, $alt_header, $css) = @_;
69      my $i;      my $i;
70    
71    
72        # ARGUMENTS:
73        #     $cgi is the CGI method
74        #     $html is an array with all the html in it. It is just joined by "\n" (and not <br> or <p>
75        #     $no_home eliminates ONLY the bottom FIG search link in a page
76        #     $alt_header is a reference to an array for an alternate header banner that you can replace the standard one with
77        #     $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
78        #               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
79        #               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
80    
81      #      #
82      # Find the HTML header      # Find the HTML header
83      #      #
# Line 78  Line 88 
88          $html_tail_file = "$FIG_Config::fig/CGI/Html/html.tail";          $html_tail_file = "$FIG_Config::fig/CGI/Html/html.tail";
89      }      }
90    
     my @html_hdr = compute_html_header();  
   
91      my $user = $cgi->param('user') || "";      my $user = $cgi->param('user') || "";
92        my @html_hdr;
93        if ($alt_header)
94        {
95           @html_hdr = @$alt_header;
96        }
97        else
98        {
99            @html_hdr = compute_html_header(undef,$user);
100        }
101    
102    
103      print $cgi->header;      print $cgi->header;
104    
# Line 199  Line 217 
217      #      #
218      #  <BODY> goes after last head line      #  <BODY> goes after last head line
219      #      #
220      #  RAE: Added the javascript for the buttons immediately after body.      #  RAE:
221        #  Added the javascript for the buttons immediately after body.
222      #  Note if no buttons are added we still (at the moment) add the script,      #  Note if no buttons are added we still (at the moment) add the script,
223      #  but it only adds a little text (495 characters) to the html and noone will notice!      #  but it only adds a little text (495 characters) to the html and noone will notice!
224    
# Line 229  Line 248 
248          splice( @$html, $body_line, 0, "</HEAD>\n" );          splice( @$html, $body_line, 0, "</HEAD>\n" );
249      }      }
250    
251        # RAE:
252        # Add css here
253        # Note that at the moment I define these two sheets here. I think this should be moved out, but I want to try it and see what happens
254        # css has the format
255        # <link rel='stylesheet' title='default' href='/css/default.css' type='text/css'>
256    
257        # convert the default key to the right case. and eliminate dups
258        foreach my $k (keys %$css) {if (lc($k) eq "default") {$css->{'Default'}=$css->{$k}}}
259    
260        if (!$css || !$css->{'Default'})
261        {
262           $css->{'Default'}="/FIG/Html/css/default.css";
263        }
264        if (!$css->{"Sans Serif"})
265        {
266           $css->{'Sans Serif'}="/FIG/Html/css/sanserif.css";
267        }
268        my $csstext = "<link rel='stylesheet' title='default' href='".$css->{'Default'}."' type='text/css'>\n";
269        $csstext   .= "<link rel='alternate stylesheet' title='Sans Serif' href='".$css->{'Sans Serif'}."' type='text/css'>\n";
270    
271        foreach my $k (keys %$css)
272        {
273           next if (lc($k) eq "default" || lc($k) eq "sans serif");
274           $csstext .= "<link rel='stylesheet' title='$k' href='".$css->{$k}."' type='text/css'>\n";
275        }
276        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.
277    
278      #      #
279      #  <BASE ...> goes before </HEAD>      #  <BASE ...> goes before </HEAD>
280      #      #
# Line 328  Line 374 
374          splice( @$html, $i, 0, @tags );          splice( @$html, $i, 0, @tags );
375      }      }
376    
377      print @$html;      # RAE the chomp will return any new lines at the ends of elements in the array, and then we can join  with a "\n"
378        # this is because somethings put newlines in, and others don't. This should make nicer looking html
379        chomp(@$html);
380        print join "\n", @$html;
381  }  }
382    
383  sub make_table {  sub make_table {

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.36

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3