r182 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r181‎ | r182 | r183 >
Date:21:39, 21 February 2002
Author:magnus_manske
Status:old
Tags:
Comment:
different backbround colors for namespaces
Modified paths:
  • /trunk/phpwiki/fpw/basicFunctions.php (modified) (history)
  • /trunk/phpwiki/fpw/wiki.phtml (modified) (history)
  • /trunk/phpwiki/fpw/wikiTextEn.php (modified) (history)
  • /trunk/phpwiki/fpw/wikiUser.php (modified) (history)

Diff [purge]

Index: trunk/phpwiki/fpw/wikiUser.php
@@ -52,10 +52,12 @@
5353
5454 # Creates a style sheet for the page from the skin & link style options
5555 function styleSheet( $action = "view" ) {
 56+ global $namespaceBackground ;
5657 $ret = "<style type=\"text/css\"><!--\n";
5758 $ret .= "body { ";
5859 $textcolor = $this->options[text];
5960 $bgcolor = $this->options[background];
 61+ if ( $namespaceBackground != "" ) $bgcolor = $namespaceBackground ;
6062 if ( $textcolor == "" )
6163 $textcolor = "black"; # For un-coloring links. Should be "inherit" but Netscape 4.x messes it up
6264 else
Index: trunk/phpwiki/fpw/basicFunctions.php
@@ -71,12 +71,13 @@
7272 # Called when editing/saving a page
7373 function edit ( $title ) {
7474 global $EditBox , $SaveButton , $PreviewButton , $MinorEdit , $FromEditForm , $wikiIPblocked ;
75 - global $user , $CommentBox , $vpage , $EditTime , $wikiDescribePage , $wikiUser ;
 75+ global $user , $CommentBox , $vpage , $EditTime , $wikiDescribePage , $wikiUser , $namespaceBackground , $wikiNamespaceBackground ;
7676 global $wikiCannotEditPage , $wikiEditConflictMessage , $wikiPreviewAppend , $wikiEditHelp , $wikiRecodeInput ;
7777 global $wikiSummary , $wikiMinorEdit , $wikiCopyrightNotice , $wikiSave , $wikiPreview , $wikiDontSaveChanges ;
7878 $npage = new WikiPage ;
7979 $npage->title = $title ;
8080 $npage->makeAll () ;
 81+ if ( $npage->namespace ) $namespaceBackground = $wikiNamespaceBackground[strtolower($npage->namespace)] ;
8182 $ret = "" ;
8283 if ( !$vpage->canEdit() ) return $wikiCannotEditPage ;
8384 if ( $EditTime == "" ) $EditTime = date ( "YmdHis" ) ; # Stored for edit conflict detection
@@ -210,7 +211,7 @@
211212 }
212213
213214 function view ( $title ) {
214 - global $FromEditForm , $action ;
 215+ global $FromEditForm , $action , $namespaceBackground , $wikiNamespaceBackground ;
215216 global $vpage , $wikiDescribePage ;
216217 if ( $FromEditForm ) {
217218 $s = doEdit ( $title ) ;
@@ -222,6 +223,7 @@
223224 }
224225 $vpage = new WikiPage ;
225226 $vpage->load ( $title ) ;
 227+ if ( $vpage->namespace ) $namespaceBackground = $wikiNamespaceBackground[strtolower($vpage->namespace)] ;
226228 if ( $vpage->contents == $wikiDescribePage ) {
227229 $action = "edit" ;
228230 return doEdit ( $title ) ;
Index: trunk/phpwiki/fpw/wikiTextEn.php
@@ -20,6 +20,16 @@
2121 $wikiRecentChangesText = "Track the most recent changes to Wikipedia on this page. [[Welcome, newcomers]]! Please have a look at these pages: [[Wikipedia FAQ]], [[Wikipedia policy]] (especially [[naming conventions]] and [[neutral point of view]]), and [[most common Wikipedia faux pas]].<br>If you want to see the Wikipedia succeed, it's very important that you don't add material restricted by others' [[copyright]]s. The legal liability could really hurt the project, so please don't do it.<br>See also the [http://meta.wikipedia.com/wiki.phtml?title=special:RecentChanges recent meta discussion]" ;
2222 $wikiMetaDescription = "$1... Read more here at wikipedia, the free encyclopedia!" ;
2323
 24+# Namespace backgrounds
 25+$wikiNamespaceBackground = array () ;
 26+$wikiNamespaceBackground["talk"] = "#CCCCCC" ;
 27+$wikiNamespaceBackground["user_talk"] = $wikiNamespaceBackground["talk"] ;
 28+$wikiNamespaceBackground["wikipedia_talk"] = $wikiNamespaceBackground["talk"] ;
 29+$wikiNamespaceBackground["user"] = "#CCFFFF" ;
 30+$wikiNamespaceBackground["wikipedia"] = "#CCFFCC" ;
 31+$wikiNamespaceBackground["log"] = "#FFCCCC" ;
 32+$wikiNamespaceBackground["special"] = "#FFCC66" ;
 33+
2434 # Used in header/footer
2535 $wikiMainPageTitle = "Wikipedia : The free encyclopedia" ; # This is the title that is displayed on the main page
2636 $wikiArticleSubtitle = "From Wikipedia, the free encyclopedia." ;
Index: trunk/phpwiki/fpw/wiki.phtml
@@ -48,7 +48,7 @@
4949 # Main program
5050 global $action , $title , $pageTitle ;
5151 global $user , $search , $expiration ;
52 - global $THESCRIPT ;
 52+ global $THESCRIPT , $namespaceBackground , $wikiNamespaceBackground ;
5353
5454 global $metaDescription , $metaKeywords , $wikiCharset ; # For meta tags in the HTML code
5555 $expiration = time()+31536000 ; # Cookies set will expire in one year from now
@@ -96,6 +96,8 @@
9797 $action = strtolower ( trim ( $action ) ) ;
9898 $title = urldecode ( $title ) ;
9999
 100+ if ( strtolower ( substr ( $title , 0 , 8 ) ) == "special:" ) $namespaceBackground = $wikiNamespaceBackground["special"] ;
 101+
100102 # Do what is asked
101103 if ( isset ( $search ) ) {
102104 include_once ( "./special_dosearch.php" ) ;

Status & tagging log