(bug 24212) Added MediaWiki:ImagePage.css which is also included on foreign client...
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Fri, 2 Jul 2010 19:54:46 +0000 (19:54 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Fri, 2 Jul 2010 19:54:46 +0000 (19:54 +0000)
RELEASE-NOTES
includes/ImagePage.php
includes/Setup.php
includes/Skin.php
includes/filerepo/FileRepo.php

index 70ca062..2060f26 100644 (file)
@@ -100,6 +100,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * texvc now supports \bcancel and \xcancel in addition to \cancel and \cancelto
 * Added scriptExtension setting to $wgForeignFileRepos
 * ForeignApiRepo uses scriptDirUrl if apiBase not set
+* (bug 24212) Added MediaWiki:ImagePage.css which is also included on foreign
+  client wikis.
 
 === Bug fixes in 1.17 ===
 * (bug 17560) Half-broken deletion moved image files to deletion archive
index a696755..001d84d 100644 (file)
@@ -152,6 +152,11 @@ class ImagePage extends Article {
                        $wgOut->addHTML(
                                "<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '$expand', '$collapse');</script>\n" );
                }
+               
+               $css = $this->repo->getDescriptionStylesheetUrl();
+               if ( $css ) {
+                       $wgOut->addStyle( $css );
+               }
        }
        
        public function getRedirectTarget() {
index 91964be..77832a1 100644 (file)
@@ -84,6 +84,8 @@ if ( !$wgLocalFileRepo ) {
                'class' => 'LocalRepo',
                'name' => 'local',
                'directory' => $wgUploadDirectory,
+               'scriptDirUrl' => $wgScriptPath,
+               'scriptExtension' => $wgScriptExtension,
                'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl . $wgUploadPath : $wgUploadPath,
                'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
                'thumbScriptUrl' => $wgThumbnailScriptPath,
index ab34b33..9495c07 100644 (file)
@@ -616,11 +616,7 @@ CSS;
                // Per-site custom styles
                if( $wgUseSiteCss ) {
                        global $wgHandheldStyle;
-                       $query = wfArrayToCGI( array(
-                               'usemsgcache' => 'yes',
-                               'ctype' => 'text/css',
-                               'smaxage' => $wgSquidMaxage
-                       ) + $siteargs );
+                       $query = wfArrayToCGI( self::getDynamicStylesheetQuery() );
                        # Site settings must override extension css! (bug 15025)
                        $out->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) );
                        $out->addStyle( self::makeNSUrl( 'Print.css', $query, NS_MEDIAWIKI ), 'print' );
@@ -666,6 +662,22 @@ CSS;
 
                wfProfileOut( __METHOD__ );
        }
+       
+       /**
+        * Get the query to generate a dynamic stylesheet
+        * 
+        * @return array
+        */
+       public static function getDynamicStylesheetQuery() {
+               global $wgSquidMaxage;
+               return array(
+                               'action' => 'raw',
+                               'maxage' => $wgSquidMaxage,
+                               'usemsgcache' => 'yes',
+                               'ctype' => 'text/css',
+                               'smaxage' => $wgSquidMaxage,
+                       );
+       }
 
        /**
         * Add skin specific stylesheets
index e5ea48d..6229896 100644 (file)
@@ -372,6 +372,17 @@ abstract class FileRepo {
                        }
                }
        }
+       
+       /**
+        * Get the URL of the stylesheet to apply to description pages
+        * @return string
+        */
+       function getDescriptionStylesheetUrl() {
+               if ( $this->scriptDirUrl ) {
+                       return self::makeUrl( 'title=MediaWiki:ImagePage.css&' .
+                               wfArrayToCGI( Skin::getDynamicStylesheetQuery() ) );
+               }
+       }
 
        /**
         * Store a file to a given destination.