r90 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89‎ | r90 | r91 >
Date:03:21, 8 February 2002
Author:vibber
Status:old
Tags:
Comment:
Moved style sheet generation to wikiUser class
Modified paths:
  • /trunk/phpwiki/fpw/wiki.phtml (modified) (history)
  • /trunk/phpwiki/fpw/wikiUser.php (modified) (history)

Diff [purge]

Index: trunk/phpwiki/fpw/wikiUser.php
@@ -49,6 +49,48 @@
5050 $this->options["tabLine1"] = "" ;
5151 $this->options["tabLine2"] = " bgcolor=\"#333333\"" ;
5252 }
 53+
 54+ # Creates a style sheet for the page from the skin & link style options
 55+ function styleSheet( $action = "view" ) {
 56+ $ret = "<style type=\"text/css\"><!--\n";
 57+ $ret .= "body { ";
 58+ $textcolor = $this->options[text];
 59+ $bgcolor = $this->options[background];
 60+ if ( $textcolor == "" )
 61+ $textcolor = "black"; # For un-coloring links. Should be "inherit" but Netscape 4.x messes it up
 62+ else
 63+ $ret .= "color: $textcolor; ";
 64+ if ( $bgcolor == "" )
 65+ $bgcolor = "white";
 66+ else
 67+ $ret .= "background: $bgcolor; ";
 68+ $ret .= "}\n";
 69+
 70+ $ret .= "p.bodytext { " . (($this->options[justify] == "yes") ? "text-align: justify; " : "") . "}\n";
 71+ $ret .= "a { text-decoration: " . (($this->options[underlineLinks] == "no") ? "none" : "underline") . "; }\n";
 72+
 73+ $qbside = ( $this->options["quickBar"] == "left" ) ? "right" : "left";
 74+ $ret .= "a.interwiki, a.external { color: #3333BB; text-decoration: none; }\n" .
 75+ "a.red { color: red; text-decoration: none; }\n" .
 76+ "a.green { color: green; text-decoration: none; }\n" .
 77+ ".topbar { border-bottom-width: 2; border-bottom-style: ridge; }\n" .
 78+ ".middle { }\n" .
 79+ ".quickbar { border-$qbside-width: 2; border-$qbside-style: ridge; }\n" .
 80+ ".footer { border-top-color: black; border-top-width: 2; border-top-style: groove; }\n";
 81+
 82+ if ( $action == "print" ) {
 83+ $ret .= "a { color: inherit; text-decoration: none; font-style: italic; }\n ";
 84+ $ret .= "a.newlink { color: inherit; font-style: inherit; }\n.newlinkedge { display: none; }\n";
 85+ } elseif ( $this->options[markupNewTopics] == "red") {
 86+ $ret .= "a.newlink { color: red; }\n.newlinkedge { display: none; }\n";
 87+ } elseif ( $this->options[markupNewTopics] == "inverse") {
 88+ $ret .= "a.newlink { color: white; background: blue; }\n.newlinkedge { display: inline; }\n";
 89+ } else {
 90+ $ret .= "a.newlink { color: $textcolor; text-decoration: none; }\n.newlinkedge { display: inline; }\n";
 91+ }
 92+ $ret .= "//--></style>";
 93+ return $ret;
 94+ }
5395
5496 #### Management functions
5597
Index: trunk/phpwiki/fpw/wiki.phtml
@@ -125,54 +125,16 @@
126126 if ( $action == edit ) $pageTitle = str_replace ( "$1" , $title , $wikiEditTitle ) ;
127127 $pageTitle = str_replace ( "_" , " " , $pageTitle ) ;
128128 $pageTitle = str_replace ( "$1" , $pageTitle , $wikiTitleTag ) ;
129 - #$bodyOptions .= $user->options["background"] ;
130 - #$bodyOptions .= $user->options["text"] ;
131 - if ( $user->options["underlineLinks"] == "no" ) $bodyOptions .= " link=blue vlink=blue alink=blue " ;
 129+ #if ( $user->options["underlineLinks"] == "no" ) $bodyOptions .= " link=blue vlink=blue alink=blue " ;
 130+ $styleSheet = $user->styleSheet ( $action ) ;
 131+ # Netscape 4 doesn't do well with the stylesheet text/background color
 132+ if ( $user->options[text] != "" ) $bodyOptions .= " textcolor=\"" . $user->options[text] . "\"";
 133+ if ( $user->options[background] != "" ) $bodyOptions .= " bgcolor=\"" . $user->options[background] . "\"";
132134
133135 if ( $metaDescription != "" ) $metaDescription = "<META name=\"description\" content=\"$metaDescription\">" ;
134136 if ( $metaKeywords != "" ) $metaKeywords = "<META name=\"keywords\" content=\"$metaKeywords\">" ;
135137 if ( $charset != "") $metaCharset = "<META HTTP-EQUIV=\"Content-type\" content=\"text/html; charset=$charset\">" ;
136138
137 - # FIXME: Is there a better place to set up the style sheet?
138 - $styleSheet = "<style type=\"text/css\"><!--\n";
139 - $textcolor = $user->options["text"];
140 - $bgcolor = $user->options["background"];
141 - $styleSheet .= "body { ";
142 - if ( $textcolor == "" ) {
143 - $textcolor = "black"; # A reasonable default, I guess?
144 - } else {
145 - $styleSheet .= "color: $textcolor; ";
146 - $bodyOptions .= " textcolor=\"$textcolor\"";
147 - }
148 - if ( $bgcolor == "" ) {
149 - $bgcolor = "white";
150 - } else {
151 - $styleSheet .= "background: $bgcolor; ";
152 - $bodyOptions .= " bgcolor=\"$bgcolor\"";
153 - }
154 - $styleSheet .= "}\n";
155 -
156 - $styleSheet .= "p.bodytext { " . (($user->options[justify] == yes) ? "text-align: justify; " : "") . "}\n";
157 - $styleSheet .= "a { text-decoration: " . (($user->options[underlineLinks] == "no") ? "none" : "underline") . "; }\n";
158 - $qbside = ( $user->options["quickBar"] == "left" ) ? "right" : "left";
159 - $styleSheet .= "a.interwiki, a.external { color: #3333BB; text-decoration: none; }\n" .
160 - "a.red { color: red; text-decoration: none; }\n" .
161 - "a.green { color: green; text-decoration: none; }\n" .
162 - ".topbar { border-bottom-width: 2; border-bottom-style: ridge; }\n" .
163 - ".middle { }\n" .
164 - ".quickbar { border-$qbside-width: 2; border-$qbside-style: ridge; }\n" .
165 - ".footer { border-top-color: black; border-top-width: 2; border-top-style: groove; }\n";
166 - if ( $user->options[markupNewTopics] == "red") {
167 - $styleSheet .= "a.newlink { color: red; }\n.newlinkedge { display: none; }\n";
168 - } elseif ( $user->options[markupNewTopics] == "inverse") {
169 - $styleSheet .= "a.newlink { color: white; background: blue; }\n";
170 - $styleSheet .= ".newlinkedge { display: inline; }\n";
171 - } else {
172 - $styleSheet .= "a.newlink { color: $textcolor; text-decoration: none; }\n";
173 - $styleSheet .= ".newlinkedge { display: inline; }\n";
174 - }
175 - $styleSheet .= "//--></style>";
176 -
177139 $head = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" ;
178140 $head .= "<HTML><HEAD><TITLE>$pageTitle</TITLE>\n" ;
179141 $head .= "$metaCharset\n" ;

Status & tagging log