Last modified: 2008-05-06 14:57:45 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T15970, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 13970 - allow own print stylesheets for SkinTemplate based skins
allow own print stylesheets for SkinTemplate based skins
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: css
  Show dependency treegraph
 
Reported: 2008-05-06 09:27 UTC by Gernot Hillier
Modified: 2008-05-06 14:57 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
allow overriding of print stylesheet in SkinTemplate-based skins (2.52 KB, patch)
2008-05-06 09:27 UTC, Gernot Hillier
Details
make getPrintCss protected to allow overriding in derived classes... (398 bytes, patch)
2008-05-06 14:48 UTC, Gernot Hillier
Details

Description Gernot Hillier 2008-05-06 09:27:27 UTC
Created attachment 4880 [details]
allow overriding of print stylesheet in SkinTemplate-based skins

As discussed with Simetrical on IRC yesterday (see http://tools.wikimedia.de/~amidaniel/chanlogs/%23mediawiki/20080505.txt, threads starting at 14:06:51 and 15:21:37), I developed a small patch for SkinTemplate (Monobook) based skins which allows to override the printing stylesheet (commonPrint.css) in own skins.

It simply adds a method getPrintCss() to SkinTemplate which returns the print stylesheet to be used. This method can then be overrided by own skin classes. 

The attached patch was developed against today's HEAD and tested with an own skin on a MediaWiki 1.11.1 installation.
Comment 1 Danny B. 2008-05-06 10:21:25 UTC
Bug 2889 related.
Comment 2 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-05-06 14:07:11 UTC
(In reply to comment #0)
> The attached patch was developed against today's HEAD and tested with an own
> skin on a MediaWiki 1.11.1 installation.

It can't have been tested too thoroughly, since you didn't declare "global $wgStylePath" in getPrintCss(), so it raised a warning and just returned "/common/commonPrint.css".  :)  You should always develop MediaWiki with error_reporting( E_ALL | E_STRICT ); ini_set( 'display_errors', '1' );.  Also, profiling is unnecessary for a function that does practically nothing.

With those changes, patch committed in r34310 (also r34311).

(In reply to comment #1)
> Bug 2889 related.

No, it's not.
Comment 3 Gernot Hillier 2008-05-06 14:47:12 UTC
(In reply to comment #2)
> > The attached patch was developed against today's HEAD and tested with an own
> > skin on a MediaWiki 1.11.1 installation.
> 
> It can't have been tested too thoroughly, since you didn't declare "global
> $wgStylePath" in getPrintCss(), so it raised a warning and just returned
> "/common/commonPrint.css".  :)  You should always develop MediaWiki with
> error_reporting( E_ALL | E_STRICT ); ini_set( 'display_errors', '1' );.  Also,
> profiling is unnecessary for a function that does practically nothing.

Oops, I'm awfully sorry for that! I did test that my use case works (overriding the stylesheet in own skin), but not that I don't break the default path. Ehrm... :-(((

However, I saw that I even had another problem in my patch: my comments told to make the function private which you did.

This, however, makes it impossible to override it in a sub class (doesn't work for me). So please additionally apply the following patch.

Comment 4 Gernot Hillier 2008-05-06 14:48:35 UTC
Created attachment 4883 [details]
make getPrintCss protected to allow overriding in derived classes...
Comment 5 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-05-06 14:53:11 UTC
My quick test with a dummy file seemed to indicate that private functions could be overridden.  But you're right, when I try to actually override this in a child skin, it fails.  Fixed in r34315.
Comment 6 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-05-06 14:57:45 UTC
Er, fixed for real in r34317.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links