\t^*$ between the comment and params for consistant formatting
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index 45e3082..c9f0233 100644 (file)
@@ -146,7 +146,7 @@ class SkinTemplate extends Skin {
                global $wgTitle, $wgArticle, $wgUser, $wgLang, $wgContLang, $wgOut;
                global $wgScript, $wgStylePath, $wgLanguageCode, $wgContLanguageCode, $wgUseNewInterlanguage;
                global $wgMimeType, $wgOutputEncoding, $wgUseDatabaseMessages, $wgRequest;
-               global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses, $wgSiteNotice;
+               global $wgDisableCounters, $wgLogo, $action, $wgFeedClasses;
                global $wgMaxCredits, $wgShowCreditsIfMax;
                global $wgPageShowWatchingUsers;
 
@@ -287,6 +287,8 @@ class SkinTemplate extends Skin {
                                } else {
                                        $tpl->set('viewcount', false);
                                }
+                       } else {
+                               $tpl->set('viewcount', false);
                        }
 
                        if ($wgPageShowWatchingUsers) {
@@ -342,8 +344,7 @@ class SkinTemplate extends Skin {
 
                $tpl->setRef( 'debug', $out->mDebugtext );
                $tpl->set( 'reporttime', $out->reportTime() );
-               $tpl->set( 'sitenotice', $wgSiteNotice );
-               $tpl->set( 'tagline', wfMsg('tagline') );
+               $tpl->set( 'sitenotice', wfGetSiteNotice() );
 
                $printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
                $out->mBodytext .= $printfooter ;
@@ -376,6 +377,11 @@ class SkinTemplate extends Skin {
                } else {
                        $tpl->set('body_ondblclick', false);
                }
+               if( $this->iseditable && $wgUser->getOption( 'editsectiononrightclick' ) ) {
+                       $tpl->set( 'body_onload', 'setupRightClickEdit()' );
+               } else {
+                       $tpl->set( 'body_onload', false );
+               }
                $tpl->set( 'navigation_urls', $this->buildNavigationUrls() );
                $tpl->set( 'nav_urls', $this->buildNavUrls() );
 
@@ -488,7 +494,7 @@ class SkinTemplate extends Skin {
         * @access private
         */
        function buildContentActionUrls () {
-               global $wgContLang;
+               global $wgContLang, $wgUseValidation;
                $fname = 'SkinTemplate::buildContentActionUrls';
                wfProfileIn( $fname );
                
@@ -589,7 +595,7 @@ class SkinTemplate extends Skin {
                                        if( $n = $this->mTitle->isDeleted() ) {
                                                $content_actions['undelete'] = array(
                                                        'class' => false,
-                                                       'text' => wfMsg( "undelete_short", $n ),
+                                                       'text' => ($n == 1) ? wfMsg( 'undelete_short1' ) : wfMsg('undelete_short', $n ),
                                                        'href' => $this->makeSpecialUrl('Undelete/'.$this->thispage)
                                                );
                                        }
@@ -597,7 +603,7 @@ class SkinTemplate extends Skin {
                        }
                        wfProfileOut( "$fname-live" );
 
-                       if ( $wgUser->isLoggedIn() and $action != 'submit' ) {
+                       if( $wgUser->isLoggedIn() and $action != 'submit' ) {
                                if( !$this->mTitle->userIsWatching()) {
                                        $content_actions['watch'] = array(
                                                'class' => ($action == 'watch' or $action == 'unwatch') ? 'selected' : false,
@@ -611,8 +617,30 @@ class SkinTemplate extends Skin {
                                                'href' => $this->mTitle->getLocalUrl( 'action=unwatch' )
                                        );
                                }
-                       }
 
+                               # Validate tab. TODO: add validation to logged-in user rights 
+                               if($wgUseValidation && ( $action == "" || $action=='view' ) ){ # && $wgUser->isAllowed('validate')){
+                                       if ( $oldid ) $oid = IntVal( $oldid ) ; # Use the oldid
+                                       else
+                                               {# Trying to get the current article revision through this weird stunt
+                                               $tid = $this->mTitle->getArticleID();
+                                               $tns = $this->mTitle->getNamespace();
+                                               $sql = "SELECT page_latest FROM page WHERE page_id={$tid} AND page_namespace={$tns}" ;
+                                               $res = wfQuery( $sql, DB_READ );
+                                               if( $s = wfFetchObject( $res ) )
+                                                       $oid = $s->page_latest ;
+                                               else $oid = "" ; # Something's wrong, like the article has been deleted in the last 10 ns
+                                               }
+                                       if ( $oid != "" ) {
+                                               $oid = "&revision={$oid}" ;
+                                               $content_actions['validate'] = array(
+                                                       'class' => ($action == 'validate') ? 'selected' : false,
+                                                       'text' => wfMsg('val_tab'),
+                                                       'href' => $this->mTitle->getLocalUrl( "action=validate{$oid}" )
+                                                       );
+                                       }
+                               }
+                       }
                } else {
                        /* show special page tab */
 
@@ -649,6 +677,11 @@ class SkinTemplate extends Skin {
                wfProfileOut( $fname );
                return $content_actions;
        }
+       
+       function getNavigationLinks() {
+               global $wgNavigationLinks;
+               return $wgNavigationLinks;
+       }
 
        /**
         * build array of global navigation links
@@ -659,9 +692,10 @@ class SkinTemplate extends Skin {
                $fname = 'SkinTemplate::buildNavigationUrls';
                wfProfileIn( $fname );
                
-               global $wgNavigationLinks;
+               $links = $this->getNavigationLinks();
+               
                $result = array();
-               foreach ( $wgNavigationLinks as $link ) {
+               foreach ( $links as $link ) {
                        $text = wfMsg( $link['text'] );
                        wfProfileIn( "$fname-{$link['text']}" );
                        if ($text != '-') {
@@ -690,7 +724,7 @@ class SkinTemplate extends Skin {
                wfProfileIn( $fname );
                
                global $wgUser, $wgRequest;
-               global $wgSiteSupportPage, $wgDisableUploads;
+               global $wgSiteSupportPage, $wgEnableUploads;
 
                $action = $wgRequest->getText( 'action' );
                $oldid = $wgRequest->getVal( 'oldid' );
@@ -706,7 +740,7 @@ class SkinTemplate extends Skin {
                // $nav_urls['sitesupport'] = array('href' => $this->makeI18nUrl('sitesupportpage'));
                $nav_urls['sitesupport'] = array('href' => $wgSiteSupportPage);
                $nav_urls['help'] = array('href' => $this->makeI18nUrl('helppage'));
-               if( $this->loggedin && !$wgDisableUploads ) {
+               if( $this->loggedin && $wgEnableUploads ) {
                        $nav_urls['upload'] = array('href' => $this->makeSpecialUrl('Upload'));
                } else {
                        $nav_urls['upload'] = false;
@@ -855,26 +889,14 @@ class SkinTemplate extends Skin {
         * returns css with user-specific options
         * @access public
         */
+
        function getUserStylesheet() {
                $fname = 'SkinTemplate::getUserStylesheet';
                wfProfileIn( $fname );
                
                global $wgUser;
                $s = "/* generated user stylesheet */\n";
-
-               if( $wgUser->isLoggedIn() ) {
-                       if ( $wgUser->getOption( "underline" ) ) {
-                               $s .= "a { text-decoration: underline; }\n";
-                       } else {
-                               $s .= "a { text-decoration: none; }\n";
-                       }
-               }
-               if ( !$wgUser->getOption( "highlightbroken" ) ) {
-                       $s .= "a.new, #quickbar a.new { color: #CC2200; }\n";
-               }
-               if ( $wgUser->getOption( "justify" ) ) {
-                       $s .= "#bodyContent { text-align: justify; }\n";
-               }
+               $s .= $this->reallyDoGetUserStyles();
                wfProfileOut( $fname );
                return $s;
        }
@@ -999,4 +1021,4 @@ class QuickTemplate {
 }
 
 } // end of if( defined( 'MEDIAWIKI' ) ) 
-?>
\ No newline at end of file
+?>