-$W->{"head_css"} as CSS is now always external.
authorshort <>
Tue, 8 Mar 2005 23:01:37 +0000 (23:01 +0000)
committershort <>
Tue, 8 Mar 2005 23:01:37 +0000 (23:01 +0000)
&url_out: Overwrite given args over persistent ones, prevent multiplicity.
$W->{"body_attr_sub"} replaced by $W->{"body_attr"}.
Inlined CSS moved out to: /My/Web.css

Web.pm

diff --git a/Web.pm b/Web.pm
index 99c0e0b..6b42e82 100644 (file)
--- a/Web.pm
+++ b/Web.pm
@@ -87,7 +87,6 @@ use URI::QueryParam;
 #our $W;
                # $W->{"title"}
                # $W->{"head"}
-               # $W->{"head_css"}
                # $W->{"force_charset"}
                # $W->{"heading_done"}
                # $W->{"footer_passed"}
@@ -122,7 +121,7 @@ my($class,%args)=@_;
        do { $W->{$_}=1  if !defined $W->{$_}; } for ("footer_ids");
        do { $W->{$_}=1  if !defined $W->{$_}; } for ("indexme");
        do { $W->{$_}="" if !defined $W->{$_}; } for ("head");
-       do { $W->{$_}="" if !defined $W->{$_}; } for ("head_css");
+       do { $W->{$_}="" if !defined $W->{$_}; } for ("body_attr");
        do { $W->{$_}="en-US" if !defined $W->{$_}; } for ("language");
 
        my $footer_any=0;
@@ -431,11 +430,15 @@ my($url,%args)=@_;
        $url=top_dir($url,%args) if $url=~m#^/# || $args{"abs"};
 
        my $uri=URI->new($url);
-       for my $key (keys(%{$W->{"args_persistent"}})) {
-               my $val=$W->{"args"}{$key};
-               next if !defined $val;
-               $uri->query_param_append($key=>$val);
-               }
+       # Prefer the $uri values over "args_persistent" values.
+       $uri->query_form_hash({
+                       map({
+                               my $key=$_;
+                               my $val=$W->{"args"}{$key};
+                               (!defined $val ? () : ($key=>$val));
+                               } keys(%{$W->{"args_persistent"}})),
+                       %{$uri->query_form_hash()},
+                       });
        $url="".$uri;
 
        return $url;
@@ -725,35 +728,12 @@ my($class)=@_;
        $title=~s#<[^>]*>##g;
        Wprint "<head>";
        Wprint "<title>$title</title>\n";
-
        if ($W->{"have_css"}) {
-               Wprint <<'HERE';
-<style type="text/css"><!--
-.cvs-id   { font-family: monospace; }
-.error    { color: red;   background-color: transparent; }
-.quote    { font-family: monospace; }
-.nowrap   { white-space: nowrap; }
-.centered { text-align: center; }
-.tab-bold { font-weight: bold; }
-.tab-head { font-weight: bold; }
-/*
-.tab-head { font-weight: bold; color: yellow; background-color: transparent; }
-body {
-               background-color: black;
-               color: white;
-               }
-:link    { color: aqua;   background-color: transparent; }
-:visited { color: teal;   background-color: transparent; }
-h1,h2    { color: yellow; background-color: transparent; }
-*/
-td       { padding: 2px; }
-caption  { caption-side: bottom; }
-.footer img { vertical-align: middle; }
+               # Everything can get overriden later.
+               Wprint <<"HERE";
+<link rel="stylesheet" type="text/css" href="@{[ url_out("/My/Web.css") ]}" />
 HERE
-               Wprint $W->{"head_css"}."\n";
-               Wprint "--></style>\n";
                }
-
        Wprint '<meta name="robots" content="'.($W->{"indexme"} ? "" : "no" ).'index,follow" />'."\n";
        Wprint $W->{"head"};
        for my $type (qw(prev next index contents start up)) {
@@ -762,7 +742,7 @@ HERE
        Wprint "</head><body";
 #      Wprint ' bgcolor="black" text="white" link="aqua" vlink="teal"'
 #                      if $W->{"browser"}->netscape() && (!$W->{"browser"}->major() || $W->{"browser"}->major()<=4);
-       do { &{$_}($W) if $_; } for $W->{"body_attr_sub"};
+       Wprint $W->{"body_attr"};
        Wprint ">\n";
 
        do { &{$_}() if $_; } for ($W->{"heading"});