* Removed messages in English, they'll be inherited from the parent.
[lhc/web/wiklou.git] / includes / SkinTemplate.php
index 3252809..8404dbc 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() );
 
@@ -583,7 +589,6 @@ class SkinTemplate extends Skin {
                                                );
                                        }
                                }
-                               }
                        } else {
                                //article doesn't exist or is deleted
                                if($wgUser->isAllowed('delete')){
@@ -598,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,
@@ -613,15 +618,29 @@ class SkinTemplate extends Skin {
                                        );
                                }
 
-                       # Validate tab. TODO: add validation to logged-in user rights 
-                       if($wgUseValidation){ # && $wgUser->isAllowed('validate')){
-                               $content_actions['validate'] = array(
-                                       'class' => ($action == 'validate') ? 'selected' : false,
-                                       'text' => wfMsg('val_tab'),
-                                       'href' => $this->mTitle->getLocalUrl( 'action=validate' )
-                               );
+                               # 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 */
 
@@ -658,6 +677,11 @@ class SkinTemplate extends Skin {
                wfProfileOut( $fname );
                return $content_actions;
        }
+       
+       function getNavigationLinks() {
+               global $wgNavigationLinks;
+               return $wgNavigationLinks;
+       }
 
        /**
         * build array of global navigation links
@@ -668,19 +692,20 @@ 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 != '-') {
                                $dest = wfMsgForContent( $link['href'] );
                                wfProfileIn( "$fname-{$link['text']}2" );
-                           $result[] = array(
-                                                                 'text' => $text,
-                                                                 'href' => $this->makeInternalOrExternalUrl( $dest ),
-                                                                 'id' => 'n-'.$link['text']
-                                                                 );
+                               $result[] = array(
+                                       'text' => $text,
+                                       'href' => $this->makeInternalOrExternalUrl( $dest ),
+                                       'id' => 'n-'.$link['text']
+                               );
                                wfProfileOut( "$fname-{$link['text']}2" );
                        }
                        wfProfileOut( "$fname-{$link['text']}" );
@@ -699,7 +724,7 @@ class SkinTemplate extends Skin {
                wfProfileIn( $fname );
                
                global $wgUser, $wgRequest;
-               global $wgSiteSupportPage, $wgDisableUploads;
+               global $wgSiteSupportPage, $wgEnableUploads, $wgUploadNavigationUrl;
 
                $action = $wgRequest->getText( 'action' );
                $oldid = $wgRequest->getVal( 'oldid' );
@@ -715,8 +740,12 @@ 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 ) {
-                       $nav_urls['upload'] = array('href' => $this->makeSpecialUrl('Upload'));
+               if( $wgEnableUploads ) {
+                       if ($wgUploadNavigationUrl) {
+                               $nav_urls['upload'] = array('href' => $wgUploadNavigationUrl );                 
+                       } else {                        
+                               $nav_urls['upload'] = array('href' => $this->makeSpecialUrl('Upload'));
+                       }
                } else {
                        $nav_urls['upload'] = false;
                }
@@ -864,26 +893,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;
        }