* Some clown with CVS access deleted our MS Word files and replaced them with
[lhc/web/wiklou.git] / includes / Skin.php
index 9baec63..be60733 100644 (file)
@@ -11,7 +11,7 @@
  */
 if( defined( "MEDIAWIKI" ) ) {
 
-# See skin.doc
+# See skin.txt
 require_once( 'Linker.php' );
 require_once( 'Image.php' );
 
@@ -81,19 +81,18 @@ class Skin extends Linker {
        var $rcMoveIndex;
        /**#@-*/
 
-       function Skin() {
-               parent::Linker();
-       }
+       /** Constructor, call parent constructor */
+       function Skin() { parent::Linker(); }
 
        function getSkinNames() {
                global $wgValidSkinNames;
                return $wgValidSkinNames;
        }
 
-       function getStylesheet() {
-               return 'common/wikistandard.css';
-       }
+       /** @return string path to the skin stylesheet */
+       function getStylesheet() { return 'common/wikistandard.css'; }
 
+       /** @return string skin name */
        function getSkinName() {
                return 'standard';
        }
@@ -268,19 +267,41 @@ class Skin extends Linker {
                $csspage = $wgContLang->getNsText( NS_MEDIAWIKI ) . ':' . $this->getSkinName() . '.css';
                $s = '@import "'.$this->makeUrl($csspage, 'action=raw&ctype=text/css')."\";\n";
 
-               if ( 1 == $wgUser->getOption( 'underline' ) ) {
-                       # Don't override browser settings
-               } else {
-                       # CHECK MERGE @@@
-                       # Force no underline
-                       $s .= "a { text-decoration: none; }\n";
-               }
-               if ( 1 == $this->mOptions['highlightbroken'] ) {
+               return $s . $this->reallyDoGetUserStyles();
+       }
+       
+       function reallyDoGetUserStyles() {
+               global $wgUser;
+               $s = '';
+               $underline = $wgUser->getOption( "underline" ) ? 'underline' : 'none';
+               $s .= "a { text-decoration: $underline; }\n";
+               if( $wgUser->getOption( 'highlightbroken' ) ) {
                        $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
+               } else {
+                       $s .= <<<END
+a.new, #quickbar a.new,
+a.stub, #quickbar a.stub {
+       color: inherit;
+       text-decoration: inherit;
+}
+a.new:after, #quickbar a.new:after {
+       content: "?";
+       color: #CC2200;
+       text-decoration: $underline;
+}
+a.stub:after, #quickbar a.stub:after {
+       content: "!";
+       color: #772233;
+       text-decoration: $underline;
+}
+END;
                }
-               if ( 1 == $wgUser->getOption( 'justify' ) ) {
+               if( $wgUser->getOption( 'justify' ) ) {
                        $s .= "#article { text-align: justify; }\n";
                }
+               if( !$wgUser->getOption( 'showtoc' ) ) {
+                       $s .= "#toc { display: none; }\n";
+               }
                return $s;
        }
 
@@ -309,6 +330,12 @@ class Skin extends Linker {
 
                }
                $a['onload'] = $wgOut->getOnloadHandler();
+               if( $wgUser->getOption( 'editsectiononrightclick' ) ) {
+                       if( $a['onload'] != '' ) {
+                               $a['onload'] .= ';';
+                       }
+                       $a['onload'] .= 'setupRightClickEdit()';
+               }
                return $a;
        }
 
@@ -329,7 +356,7 @@ class Skin extends Linker {
        }
 
        function doBeforeContent() {
-               global $wgOut, $wgTitle, $wgContLang, $wgSiteNotice;
+               global $wgOut, $wgTitle, $wgContLang;
                $fname = 'Skin::doBeforeContent';
                wfProfileIn( $fname );
 
@@ -379,8 +406,9 @@ class Skin extends Linker {
                $s .= "</tr>\n</table>\n</div>\n";
                $s .= "\n<div id='article'>\n";
 
-               if( $wgSiteNotice ) {
-                       $s .= "\n<div id='siteNotice'>$wgSiteNotice</div>\n";
+               $notice = wfGetSiteNotice();
+               if( $notice ) {
+                       $s .= "\n<div id='siteNotice'>$notice</div>\n";
                }
                $s .= $this->pageTitle();
                $s .= $this->pageSubtitle() ;
@@ -427,8 +455,8 @@ class Skin extends Linker {
                                        }
                                        # add our current element to the list
                                        $eltitle = Title::NewFromText($element);
-                                       # FIXME : should be makeLink() [AV]
-                                       $return .= $skin->makeLinkObj( $eltitle, $eltitle->getText() ) . ' &gt; ';
+                                       if(!empty($parent)) $return .= ' &gt; ';
+                                       $return .=  $skin->makeLinkObj( $eltitle, $eltitle->getText() ) ;
                                }
                                return $return;
                        }
@@ -452,17 +480,20 @@ class Skin extends Linker {
                return "<td width='152' rowspan='{$rows}'>&nbsp;</td>";
        }
 
-       # This gets called immediately before the </body> tag.
-       #
+       /**
+        * This gets called immediately before the </body> tag.
+        * @return string HTML to be put after </body> ???
+        */
        function afterContent() {
                $printfooter = "<div class=\"printfooter\">\n" . $this->printFooter() . "</div>\n";
                return $printfooter . $this->doAfterContent();
        }
 
+       /** @return string Retrievied from HTML text */
        function printSource() {
                global $wgTitle;
                $url = htmlspecialchars( $wgTitle->getFullURL() );
-               return wfMsg( "retrievedfrom", "<a href=\"$url\">$url</a>" );
+               return wfMsg( 'retrievedfrom', '<a href="'.$url.'">'.$url.'</a>' );
        }
 
        function printFooter() {
@@ -470,9 +501,8 @@ class Skin extends Linker {
                        "</p>\n\n<p>" . $this->pageStats() . "</p>\n";
        }
 
-       function doAfterContent() {
-       # overloaded by derived classes
-       }
+       /** overloaded by derived classes */
+       function doAfterContent() { }
 
        function pageTitleLinks() {
                global $wgOut, $wgTitle, $wgUser, $wgContLang, $wgUseApproval, $wgRequest;
@@ -489,7 +519,7 @@ class Skin extends Linker {
                if ( $wgOut->isArticleRelated() ) {
                        if ( $wgTitle->getNamespace() == NS_IMAGE ) {
                                $name = $wgTitle->getDBkey();
-                               $image = new Image( $wgTitle->getDBkey() );
+                               $image = new Image( $wgTitle );
                                if( $image->exists() ) {
                                        $link = htmlspecialchars( $image->getURL() );
                                        $style = $this->getInternalLinkAttributes( $link, $name );
@@ -572,7 +602,6 @@ class Skin extends Linker {
                global $wgOut, $wgTitle, $wgUser;
 
                $s = '<h1 class="pagetitle">' . htmlspecialchars( $wgOut->getPageTitle() ) . '</h1>';
-               if($wgUser->getOption( 'editsectiononrightclick' ) && $wgTitle->userCanEdit()) { $s=$this->editSectionScript($wgTitle, 0,$s);}
                return $s;
        }
 
@@ -715,8 +744,6 @@ class Skin extends Linker {
                        }
                }
 
-
-
                return $s;
        }
 
@@ -778,7 +805,7 @@ class Skin extends Linker {
                }
 
                if (isset($wgMaxCredits) && $wgMaxCredits != 0) {
-                   require_once("Credits.php");
+                   require_once('Credits.php');
                    $s .= ' ' . getCredits($wgArticle, $wgMaxCredits, $wgShowCreditsIfMax);
                } else {
                    $s .= $this->lastModified();
@@ -856,7 +883,7 @@ class Skin extends Linker {
 
                $timestamp = $wgArticle->getTimestamp();
                if ( $timestamp ) {
-                       $d = $wgLang->timeanddate( $wgArticle->getTimestamp(), true );
+                       $d = $wgLang->timeanddate( $timestamp, true );
                        $s = ' ' . wfMsg( 'lastmodified', $d );
                } else {
                        $s = '';
@@ -955,7 +982,7 @@ class Skin extends Linker {
        function disclaimerLink() {
                $disclaimers = wfMsg( 'disclaimers' );
                if ($disclaimers == '-') {
-                       return "";
+                       return '';
                } else {
                        return $this->makeKnownLink( wfMsgForContent( 'disclaimerpage' ),
                                                     $disclaimers );