I run a custom Vector installation for a corporate-ish setup. Since the wiki is readonly unless people log in I've hidden some of the scarier wiki stuff. Here's my diff of Vector.php:
Index: skins/Vector.php =================================================================== --- skins/Vector.php (revision 68624) +++ skins/Vector.php (working copy) @@ -435,13 +435,13 @@ 'tagline', ), 'places' => array( - 'privacy', - 'about', - 'disclaimer', +# 'privacy', +# 'about', +# 'disclaimer', ), 'icons' => array( - 'poweredbyico', - 'copyrightico', +# 'poweredbyico', +# 'copyrightico', ), ); $footerlinksClasses = array( @@ -582,7 +582,7 @@ private function renderPortals( $portals ) { // Force the rendering of the following portals if ( !isset( $portals['SEARCH'] ) ) $portals['SEARCH'] = true; - if ( !isset( $portals['TOOLBOX'] ) ) $portals['TOOLBOX'] = true; +# if ( !isset( $portals['TOOLBOX'] ) ) $portals['TOOLBOX'] = true; if ( !isset( $portals['LANGUAGES'] ) ) $portals['LANGUAGES'] = true; // Render portals foreach ( $portals as $name => $content ) {
I could just add hooks to munge those things. E.g.:
wfRunHooks( 'SkinVectorExecuteFooterlinks, array( &$this, &$footerlinks ) );
And:
wfRunHooks( 'SkinVectorRenderPortalsPortals, array( &$this, &$portals ) );
But I thought I'd ask if someone (particularly Trevor) has suggestions on how to do it better. I can't see a quick and sane way to do it for the general case, since Vector uses a diffrent $footerlinks structure than MonoBook.
That's fine for my purposes, but might not be such a good idea for MediaWiki. I think per-skin hooks aren't an inherently bad idea though.
It would be used similar to how you can use SkinBuildSidebar now, here's something from my LocalSettings.php:
# Hide scary stuff in the sidebar from users that aren't logged in. Derived from # http://www.mediawiki.org/wiki/Manual:Interface/Sidebar#Change_sidebar_conten... $wgHooks['SkinBuildSidebar'][] = 'efHideSidebar';
function efHideSidebar($skin, &$bar) { global $wgUser;
if (!$wgUser->isAllowed( 'edit' )) { unset($bar['vf-navigation-users']); unset($bar['TOOLBOX']); }
if (!$wgUser->isAllowed( 'block' )) { unset($bar['vf-navigation-admins']); }
return true; }
2010/7/7 Ævar Arnfjörð Bjarmason avarab@gmail.com:
But I thought I'd ask if someone (particularly Trevor) has suggestions on how to do it better. I can't see a quick and sane way to do it for the general case, since Vector uses a diffrent $footerlinks structure than MonoBook.
That's fine for my purposes, but might not be such a good idea for MediaWiki. I think per-skin hooks aren't an inherently bad idea though.
Although I agree that having hooks for these things would be nice, wouldn't it suffice for your purposes to just hide these things with CSS?
Roan Kattouw (Catrope)
On Thu, Jul 8, 2010 at 09:13, Roan Kattouw roan.kattouw@gmail.com wrote:
Although I agree that having hooks for these things would be nice, wouldn't it suffice for your purposes to just hide these things with CSS?
I could probably get away with it. But I'd rather munge the output than count on CSS, so the site wouldn't look different on some limited mobile devices, or text browsers.
On 07/08/2010 12:13 PM, Roan Kattouw wrote:
2010/7/7 Ævar Arnfjörð Bjarmasonavarab@gmail.com:
But I thought I'd ask if someone (particularly Trevor) has suggestions on how to do it better. I can't see a quick and sane way to do it for the general case, since Vector uses a diffrent $footerlinks structure than MonoBook.
That's fine for my purposes, but might not be such a good idea for MediaWiki. I think per-skin hooks aren't an inherently bad idea though.
Although I agree that having hooks for these things would be nice, wouldn't it suffice for your purposes to just hide these things with CSS?
That's what I did in the custom skin I wrote for a local non-profit's wiki (currently at http://lup.vyznev.net/). It's basically a restyled copy of MonoBook with very few changes to the PHP code (which means I can easily keep it up with upstream changes), but one change I did make was to inject a class="loggedin" or "notloggedin" to the outermost wrapper div and show or hide a bunch of navigation elements depending on that.
You can see the difference by going to that page and pasting something like javascript:void(document.getElementById('globalWrapper').className='loggedin'); to the address bar. Indeed, one reason why I did it this way is that, if I wanted, I could add a "Show advanced options" link/button that would do just that.
Without the style sheets, the site just looks more or less like MonoBook does when viewed the same way. Which is actually pretty nice; someone's clearly put a lot of thought into graceful degradation there.
(When I wrote the skin, I actually first thought of basing it on Vector. However, after looking at the code I came to the conclusion that, at least for now, the code for MonoBook is both simpler and less of a moving target. That said, I do plan to add some Vectorish features, such as a collapsible sidebar for logged-in users.)
Ævar Arnfjörð Bjarmason wrote:
I run a custom Vector installation for a corporate-ish setup. Since the wiki is readonly unless people log in I've hidden some of the scarier wiki stuff. Here's my diff of Vector.php:
Index: skins/Vector.php =================================================================== --- skins/Vector.php (revision 68624) +++ skins/Vector.php (working copy) @@ -435,13 +435,13 @@ 'tagline', ), 'places' => array( - 'privacy', - 'about', - 'disclaimer', +# 'privacy', +# 'about', +# 'disclaimer', ),
Just set to - MediaWiki:Privacy, MediaWiki:Aboutsite and MediaWiki:Disclaimers
'icons' => array( - 'poweredbyico', - 'copyrightico', +# 'poweredbyico', +# 'copyrightico', ), );
For copyrightico set to false $wgCopyrightIcon and $wgRightsIcon.
I could just add hooks to munge those things. E.g.:
wfRunHooks( 'SkinVectorExecuteFooterlinks, array( &$this,
&$footerlinks ) );
And:
wfRunHooks( 'SkinVectorRenderPortalsPortals, array( &$this, &$portals ) );
No more skin specific hooks, please. You could create a custom skin just to inherit and unset some items. Creating it as a different skin even if mostly equal is generally a good idea.
$footerlinksClasses = array( @@ -582,7 +582,7 @@ private function renderPortals( $portals ) { // Force the rendering of the following portals if ( !isset( $portals['SEARCH'] ) )
$portals['SEARCH'] = true; - if ( !isset( $portals['TOOLBOX'] ) ) $portals['TOOLBOX'] = true; +# if ( !isset( $portals['TOOLBOX'] ) ) $portals['TOOLBOX'] = true; if ( !isset( $portals['LANGUAGES'] ) ) $portals['LANGUAGES'] = true; // Render portals foreach ( $portals as $name => $content ) {
I did this on a custom skin by creating an empty toolbox() function in the child class. Then vector was changed to use a switch instead of calls. :(
But I thought I'd ask if someone (particularly Trevor) has suggestions on how to do it better. I can't see a quick and sane way to do it for the general case, since Vector uses a diffrent $footerlinks structure than MonoBook.
That's fine for my purposes, but might not be such a good idea for MediaWiki. I think per-skin hooks aren't an inherently bad idea though.
PS: Do you guys consider that the id change on vector of footer-icon-poweredby to footer-icons-poweredbyico and footer-icon-copyright to footer-icons-copyrightico should be backported to 1.16?
wikitech-l@lists.wikimedia.org