[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.36, Tue Mar 15 21:01:14 2005 UTC revision 1.39, Sun Mar 20 00:08:39 2005 UTC
# 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, $alt_header, $css) = @_;      my($cgi,$html,$no_home, $alt_header, $css, $javasrc) = @_;
69      my $i;      my $i;
70    
71    
# Line 77  Line 77 
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      #     $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      #               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      #               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        #     $javasrc is a reference to an array of URLs to javascripts to be included (e.g. "/FIG/Html/css/styleswitcher.js")
81      #      #
82      # Find the HTML header      # Find the HTML header
83      #      #
# Line 90  Line 90 
90    
91      my $user = $cgi->param('user') || "";      my $user = $cgi->param('user') || "";
92      my @html_hdr;      my @html_hdr;
93      if ($alt_header)      if ($alt_header && ref($alt_header) eq "ARRAY")
94      {      {
95         @html_hdr = @$alt_header;         @html_hdr = @$alt_header;
96      }      }
# Line 271  Line 271 
271      foreach my $k (keys %$css)      foreach my $k (keys %$css)
272      {      {
273         next if (lc($k) eq "default" || lc($k) eq "sans serif");         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";         $csstext .= "<link rel='alternate stylesheet' title='$k' href='".$css->{$k}."' type='text/css'>\n";
275        }
276    
277    
278        # RAE: also added support for external javascripts here.
279        # we are cluttering the HTML code with all the javascripts when they could easily be in external files
280        # this solution allows us to source other files
281    
282        # $javasrc must be a ref to an array with urls (absolute or relative) to the javascripts
283        if ($javasrc && ref($javasrc) eq "ARRAY") {
284         foreach my $script (@$javasrc) {
285          $csstext .= "<script src=\"$script\" type=\"text/javascript\"></script>\n";
286      }      }
287        }
288    
289    
290    
291      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.      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.
292    
293      #      #
# Line 376  Line 391 
391    
392      # RAE the chomp will return any new lines at the ends of elements in the array, and then we can join  with a "\n"      # RAE the chomp will return any new lines at the ends of elements in the array, and then we can join  with a "\n"
393      # this is because somethings put newlines in, and others don't. This should make nicer looking html      # this is because somethings put newlines in, and others don't. This should make nicer looking html
394      chomp(@$html);      #chomp(@$html);
395      print join "\n", @$html;      #print join "\n", @$html;
396    
397        # Apparently the above still breaks things. This is the correct code:
398        print @$html;
399  }  }
400    
401  sub make_table {  sub make_table {

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3