2014-08-07 11:38:34 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Vector - Modern version of MonoBook with fresh look and many usability
|
|
|
|
* improvements.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @ingroup Skins
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2018-01-30 23:56:42 +00:00
|
|
|
* QuickTemplate subclass for Vector
|
2014-08-07 11:38:34 +00:00
|
|
|
* @ingroup Skins
|
|
|
|
*/
|
|
|
|
class VectorTemplate extends BaseTemplate {
|
|
|
|
/* Functions */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Outputs the entire contents of the (X)HTML page
|
|
|
|
*/
|
|
|
|
public function execute() {
|
2017-07-26 17:15:27 +00:00
|
|
|
$this->data['namespace_urls'] = $this->data['content_navigation']['namespaces'];
|
|
|
|
$this->data['view_urls'] = $this->data['content_navigation']['views'];
|
|
|
|
$this->data['action_urls'] = $this->data['content_navigation']['actions'];
|
|
|
|
$this->data['variant_urls'] = $this->data['content_navigation']['variants'];
|
2014-08-07 11:38:34 +00:00
|
|
|
|
2017-07-26 17:15:27 +00:00
|
|
|
// Move the watch/unwatch star outside of the collapsed "actions" menu to the main "views" menu
|
2014-08-13 18:39:38 +00:00
|
|
|
if ( $this->config->get( 'VectorUseIconWatch' ) ) {
|
2014-08-07 11:38:34 +00:00
|
|
|
$mode = $this->getSkin()->getUser()->isWatched( $this->getSkin()->getRelevantTitle() )
|
|
|
|
? 'unwatch'
|
|
|
|
: 'watch';
|
|
|
|
|
2017-07-26 17:15:27 +00:00
|
|
|
if ( isset( $this->data['action_urls'][$mode] ) ) {
|
|
|
|
$this->data['view_urls'][$mode] = $this->data['action_urls'][$mode];
|
|
|
|
unset( $this->data['action_urls'][$mode] );
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
|
|
|
}
|
2015-06-08 21:12:40 +00:00
|
|
|
$this->data['pageLanguage'] =
|
|
|
|
$this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
|
|
|
|
|
2014-08-07 11:38:34 +00:00
|
|
|
// Output HTML Page
|
|
|
|
$this->html( 'headelement' );
|
|
|
|
?>
|
|
|
|
<div id="mw-page-base" class="noprint"></div>
|
|
|
|
<div id="mw-head-base" class="noprint"></div>
|
|
|
|
<div id="content" class="mw-body" role="main">
|
|
|
|
<a id="top"></a>
|
|
|
|
<?php
|
|
|
|
if ( $this->data['sitenotice'] ) {
|
2017-11-09 05:41:12 +00:00
|
|
|
echo Html::rawElement( 'div',
|
2017-11-14 05:19:14 +00:00
|
|
|
[
|
|
|
|
'id' => 'siteNotice',
|
|
|
|
'class' => 'mw-body-content',
|
|
|
|
],
|
2017-11-09 05:41:12 +00:00
|
|
|
// Raw HTML
|
|
|
|
$this->get( 'sitenotice' )
|
|
|
|
);
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
2016-03-07 13:24:27 +00:00
|
|
|
if ( is_callable( [ $this, 'getIndicators' ] ) ) {
|
2014-12-29 19:13:39 +00:00
|
|
|
echo $this->getIndicators();
|
|
|
|
}
|
2015-06-25 11:52:44 +00:00
|
|
|
// Loose comparison with '!=' is intentional, to catch null and false too, but not '0'
|
|
|
|
if ( $this->data['title'] != '' ) {
|
2017-11-09 05:41:12 +00:00
|
|
|
echo Html::rawElement( 'h1',
|
|
|
|
[
|
|
|
|
'id' => 'firstHeading',
|
|
|
|
'class' => 'firstHeading',
|
|
|
|
'lang' => $this->get( 'pageLanguage' ),
|
|
|
|
],
|
|
|
|
// Raw HTML
|
|
|
|
$this->get( 'title' )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->html( 'prebodyhtml' );
|
2014-12-29 19:13:39 +00:00
|
|
|
?>
|
2014-08-07 11:38:34 +00:00
|
|
|
<div id="bodyContent" class="mw-body-content">
|
|
|
|
<?php
|
|
|
|
if ( $this->data['isarticle'] ) {
|
2017-11-09 05:41:12 +00:00
|
|
|
echo Html::element( 'div',
|
|
|
|
[
|
|
|
|
'id' => 'siteSub',
|
|
|
|
'class' => 'noprint',
|
|
|
|
],
|
|
|
|
$this->getMsg( 'tagline' )->text()
|
|
|
|
);
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
|
|
|
?>
|
2015-06-17 22:41:48 +00:00
|
|
|
<div id="contentSub"<?php $this->html( 'userlangattributes' ) ?>><?php
|
|
|
|
$this->html( 'subtitle' )
|
|
|
|
?></div>
|
2014-08-07 11:38:34 +00:00
|
|
|
<?php
|
|
|
|
if ( $this->data['undelete'] ) {
|
2017-11-09 05:41:12 +00:00
|
|
|
echo Html::rawElement( 'div',
|
|
|
|
[ 'id' => 'contentSub2' ],
|
|
|
|
// Raw HTML
|
|
|
|
$this->get( 'undelete' )
|
|
|
|
);
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
|
|
|
if ( $this->data['newtalk'] ) {
|
2017-11-09 05:41:12 +00:00
|
|
|
echo Html::rawElement( 'div',
|
|
|
|
[ 'class' => 'usermessage' ],
|
|
|
|
// Raw HTML
|
|
|
|
$this->get( 'newtalk' )
|
|
|
|
);
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
Re-implement and improve mw-jump links with pure CSS
* Improve their accessibility by giving both links
a full label "Jump to x" and "Jump to y" instead
of "Jump to: ", "x", "y".
This also makes things much better for localisation, for which
we generally discourage use of concatenation.
* Use pure CSS for the toggling of the visibility on focus,
instead of relying on JavaScript. Especially given the
JS comes form core's 'jquery.mw-jump' module, which is
considered technical debt per T195256. Alternatively,
that could be copied to vector.js, but pure CSS
is possible, so why not.
* Use plain <a> links in the HTML instead of wrapped in a <div>.
This solves the long-standing problem whereby the margin
between #contentSub and #mw-content-text had to be awkwardly
negated and overridden in core and on various to make sure that
the wrapper itself would become visible as needed, in a way that
has margin around this. This whole problem doesn't apply when
simply using inline links that aren't part of the regular flow
with .mixin-screen-reader-text. On focus, the individually
focussed link appears in regular flow, without the need for
any custom styles.
* This uses :not(:focus) to naturally make it render in the default
way on focus, and visibibly hidden/clipped otherwise.
This is supported in IE9+ and Android 2+.
There is a way to make it work with CSS2 for IE7-8, by applying
the mixin to '.mw-jump-link' only and then undoing all of
'position', 'width', 'height', 'clip', and 'margin' on :focus.
But I'm not sure that's worth it here. The fallback in IE7-8
for not supporting ":not(:focus)" is that the accessibility
link is simply visible always, which seems like a good fallback
for accessibility, and doesn't hurt anything.
Bug: T195256
Change-Id: Icaadb290f692b3617688d32cbb66dfb007f1c82c
2018-05-21 16:28:07 +00:00
|
|
|
// Keep this empty `div` for compatibility with gadgets and user scripts
|
|
|
|
// using this place to insert extra elements before.
|
|
|
|
echo Html::element( 'div', [ 'id' => 'jump-to-nav' ] );
|
2014-08-07 11:38:34 +00:00
|
|
|
?>
|
Re-implement and improve mw-jump links with pure CSS
* Improve their accessibility by giving both links
a full label "Jump to x" and "Jump to y" instead
of "Jump to: ", "x", "y".
This also makes things much better for localisation, for which
we generally discourage use of concatenation.
* Use pure CSS for the toggling of the visibility on focus,
instead of relying on JavaScript. Especially given the
JS comes form core's 'jquery.mw-jump' module, which is
considered technical debt per T195256. Alternatively,
that could be copied to vector.js, but pure CSS
is possible, so why not.
* Use plain <a> links in the HTML instead of wrapped in a <div>.
This solves the long-standing problem whereby the margin
between #contentSub and #mw-content-text had to be awkwardly
negated and overridden in core and on various to make sure that
the wrapper itself would become visible as needed, in a way that
has margin around this. This whole problem doesn't apply when
simply using inline links that aren't part of the regular flow
with .mixin-screen-reader-text. On focus, the individually
focussed link appears in regular flow, without the need for
any custom styles.
* This uses :not(:focus) to naturally make it render in the default
way on focus, and visibibly hidden/clipped otherwise.
This is supported in IE9+ and Android 2+.
There is a way to make it work with CSS2 for IE7-8, by applying
the mixin to '.mw-jump-link' only and then undoing all of
'position', 'width', 'height', 'clip', and 'margin' on :focus.
But I'm not sure that's worth it here. The fallback in IE7-8
for not supporting ":not(:focus)" is that the accessibility
link is simply visible always, which seems like a good fallback
for accessibility, and doesn't hurt anything.
Bug: T195256
Change-Id: Icaadb290f692b3617688d32cbb66dfb007f1c82c
2018-05-21 16:28:07 +00:00
|
|
|
<a class="mw-jump-link" href="#mw-head"><?php $this->msg( 'vector-jumptonavigation' ) ?></a>
|
|
|
|
<a class="mw-jump-link" href="#p-search"><?php $this->msg( 'vector-jumptosearch' ) ?></a>
|
2014-08-07 11:38:34 +00:00
|
|
|
<?php
|
2015-06-08 21:12:40 +00:00
|
|
|
$this->html( 'bodycontent' );
|
|
|
|
|
2014-08-07 11:38:34 +00:00
|
|
|
if ( $this->data['printfooter'] ) {
|
|
|
|
?>
|
|
|
|
<div class="printfooter">
|
|
|
|
<?php $this->html( 'printfooter' ); ?>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
}
|
2015-06-08 21:12:40 +00:00
|
|
|
|
2014-08-07 11:38:34 +00:00
|
|
|
if ( $this->data['catlinks'] ) {
|
|
|
|
$this->html( 'catlinks' );
|
|
|
|
}
|
2015-06-08 21:12:40 +00:00
|
|
|
|
2014-08-07 11:38:34 +00:00
|
|
|
if ( $this->data['dataAfterContent'] ) {
|
|
|
|
$this->html( 'dataAfterContent' );
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="visualClear"></div>
|
|
|
|
<?php $this->html( 'debughtml' ); ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="mw-navigation">
|
|
|
|
<h2><?php $this->msg( 'navigation-heading' ) ?></h2>
|
|
|
|
<div id="mw-head">
|
2018-01-30 23:59:35 +00:00
|
|
|
<?php $this->renderNavigation( [ 'PERSONAL' ] ); ?>
|
2014-08-07 11:38:34 +00:00
|
|
|
<div id="left-navigation">
|
2016-03-07 13:24:27 +00:00
|
|
|
<?php $this->renderNavigation( [ 'NAMESPACES', 'VARIANTS' ] ); ?>
|
2014-08-07 11:38:34 +00:00
|
|
|
</div>
|
|
|
|
<div id="right-navigation">
|
2016-03-07 13:24:27 +00:00
|
|
|
<?php $this->renderNavigation( [ 'VIEWS', 'ACTIONS', 'SEARCH' ] ); ?>
|
2014-08-07 11:38:34 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="mw-panel">
|
2014-09-22 18:04:22 +00:00
|
|
|
<div id="p-logo" role="banner"><a class="mw-wiki-logo" href="<?php
|
2014-08-07 11:38:34 +00:00
|
|
|
echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] )
|
|
|
|
?>" <?php
|
|
|
|
echo Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) )
|
|
|
|
?>></a></div>
|
|
|
|
<?php $this->renderPortals( $this->data['sidebar'] ); ?>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-01-06 16:48:54 +00:00
|
|
|
<?php Hooks::run( 'VectorBeforeFooter' ); ?>
|
2014-08-07 11:38:34 +00:00
|
|
|
<div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>>
|
|
|
|
<?php
|
|
|
|
foreach ( $this->getFooterLinks() as $category => $links ) {
|
2017-11-09 05:34:13 +00:00
|
|
|
?>
|
|
|
|
<ul id="footer-<?php echo $category ?>">
|
|
|
|
<?php
|
|
|
|
foreach ( $links as $link ) {
|
2014-08-07 11:38:34 +00:00
|
|
|
?>
|
2017-11-09 05:34:13 +00:00
|
|
|
<li id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
2014-08-07 11:38:34 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2016-03-07 13:09:39 +00:00
|
|
|
<?php $footericons = $this->getFooterIcons( 'icononly' );
|
2014-08-07 11:38:34 +00:00
|
|
|
if ( count( $footericons ) > 0 ) {
|
|
|
|
?>
|
|
|
|
<ul id="footer-icons" class="noprint">
|
|
|
|
<?php
|
|
|
|
foreach ( $footericons as $blockName => $footerIcons ) {
|
2017-11-09 05:34:13 +00:00
|
|
|
?>
|
|
|
|
<li id="footer-<?php echo htmlspecialchars( $blockName ); ?>ico">
|
|
|
|
<?php
|
|
|
|
foreach ( $footerIcons as $icon ) {
|
|
|
|
echo $this->getSkin()->makeFooterIcon( $icon );
|
|
|
|
}
|
2014-08-07 11:38:34 +00:00
|
|
|
?>
|
2017-11-09 05:34:13 +00:00
|
|
|
</li>
|
2014-08-07 11:38:34 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2017-11-09 05:34:13 +00:00
|
|
|
<div style="clear: both;"></div>
|
2014-08-07 11:38:34 +00:00
|
|
|
</div>
|
|
|
|
<?php $this->printTrail(); ?>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
2014-09-26 03:32:03 +00:00
|
|
|
<?php
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Render a series of portals
|
|
|
|
*
|
|
|
|
* @param array $portals
|
|
|
|
*/
|
2018-01-30 23:59:35 +00:00
|
|
|
protected function renderPortals( array $portals ) {
|
2014-08-07 11:38:34 +00:00
|
|
|
// Force the rendering of the following portals
|
|
|
|
if ( !isset( $portals['TOOLBOX'] ) ) {
|
|
|
|
$portals['TOOLBOX'] = true;
|
|
|
|
}
|
|
|
|
if ( !isset( $portals['LANGUAGES'] ) ) {
|
|
|
|
$portals['LANGUAGES'] = true;
|
|
|
|
}
|
|
|
|
// Render portals
|
|
|
|
foreach ( $portals as $name => $content ) {
|
|
|
|
if ( $content === false ) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-01-10 20:38:46 +00:00
|
|
|
// Numeric strings gets an integer when set as key, cast back - T73639
|
|
|
|
$name = (string)$name;
|
|
|
|
|
2014-08-07 11:38:34 +00:00
|
|
|
switch ( $name ) {
|
|
|
|
case 'SEARCH':
|
|
|
|
break;
|
|
|
|
case 'TOOLBOX':
|
|
|
|
$this->renderPortal( 'tb', $this->getToolbox(), 'toolbox', 'SkinTemplateToolboxEnd' );
|
2017-01-06 16:48:54 +00:00
|
|
|
Hooks::run( 'VectorAfterToolbox' );
|
2014-08-07 11:38:34 +00:00
|
|
|
break;
|
|
|
|
case 'LANGUAGES':
|
|
|
|
if ( $this->data['language_urls'] !== false ) {
|
|
|
|
$this->renderPortal( 'lang', $this->data['language_urls'], 'otherlanguages' );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$this->renderPortal( $name, $content );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $name
|
2018-01-30 23:59:35 +00:00
|
|
|
* @param array|string $content
|
2014-08-07 11:38:34 +00:00
|
|
|
* @param null|string $msg
|
|
|
|
* @param null|string|array $hook
|
|
|
|
*/
|
|
|
|
protected function renderPortal( $name, $content, $msg = null, $hook = null ) {
|
|
|
|
if ( $msg === null ) {
|
|
|
|
$msg = $name;
|
|
|
|
}
|
2018-06-12 14:39:57 +00:00
|
|
|
$msgObj = $this->getMsg( $msg );
|
2018-04-13 23:05:12 +00:00
|
|
|
$labelId = Sanitizer::escapeIdForAttribute( "p-$name-label" );
|
2014-08-07 11:38:34 +00:00
|
|
|
?>
|
2018-04-13 23:05:12 +00:00
|
|
|
<div class="portal" role="navigation" id="<?php
|
|
|
|
echo htmlspecialchars( Sanitizer::escapeIdForAttribute( "p-$name" ) )
|
|
|
|
?>"<?php
|
2014-08-07 11:38:34 +00:00
|
|
|
echo Linker::tooltip( 'p-' . $name )
|
2018-04-13 23:05:12 +00:00
|
|
|
?> aria-labelledby="<?php echo htmlspecialchars( $labelId ) ?>">
|
|
|
|
<h3<?php $this->html( 'userlangattributes' ) ?> id="<?php echo htmlspecialchars( $labelId )
|
|
|
|
?>"><?php
|
2014-08-07 11:38:34 +00:00
|
|
|
echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $msg );
|
|
|
|
?></h3>
|
|
|
|
<div class="body">
|
|
|
|
<?php
|
|
|
|
if ( is_array( $content ) ) {
|
2017-11-09 05:34:13 +00:00
|
|
|
?>
|
|
|
|
<ul>
|
|
|
|
<?php
|
|
|
|
foreach ( $content as $key => $val ) {
|
|
|
|
echo $this->makeListItem( $key, $val );
|
|
|
|
}
|
|
|
|
if ( $hook !== null ) {
|
|
|
|
// Avoid PHP 7.1 warning
|
|
|
|
$skin = $this;
|
|
|
|
Hooks::run( $hook, [ &$skin, true ] );
|
|
|
|
}
|
2014-08-07 11:38:34 +00:00
|
|
|
?>
|
2017-11-09 05:34:13 +00:00
|
|
|
</ul>
|
2014-08-07 11:38:34 +00:00
|
|
|
<?php
|
|
|
|
} else {
|
2017-06-23 20:06:01 +00:00
|
|
|
// Allow raw HTML block to be defined by extensions
|
|
|
|
echo $content;
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->renderAfterPortlet( $name );
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-09-21 17:18:12 +00:00
|
|
|
* Render one or more navigations elements by name, automatically reversed by css
|
2014-08-07 11:38:34 +00:00
|
|
|
* when UI is in RTL mode
|
|
|
|
*
|
|
|
|
* @param array $elements
|
|
|
|
*/
|
2018-01-30 23:59:35 +00:00
|
|
|
protected function renderNavigation( array $elements ) {
|
2014-08-07 11:38:34 +00:00
|
|
|
// Render elements
|
|
|
|
foreach ( $elements as $name => $element ) {
|
|
|
|
switch ( $element ) {
|
|
|
|
case 'NAMESPACES':
|
|
|
|
?>
|
|
|
|
<div id="p-namespaces" role="navigation" class="vectorTabs<?php
|
|
|
|
if ( count( $this->data['namespace_urls'] ) == 0 ) {
|
|
|
|
echo ' emptyPortlet';
|
|
|
|
}
|
|
|
|
?>" aria-labelledby="p-namespaces-label">
|
|
|
|
<h3 id="p-namespaces-label"><?php $this->msg( 'namespaces' ) ?></h3>
|
|
|
|
<ul<?php $this->html( 'userlangattributes' ) ?>>
|
|
|
|
<?php
|
2017-07-26 17:15:27 +00:00
|
|
|
foreach ( $this->data['namespace_urls'] as $key => $item ) {
|
2017-11-09 05:34:13 +00:00
|
|
|
echo $this->makeListItem( $key, $item, [
|
2017-07-26 17:15:27 +00:00
|
|
|
'vector-wrap' => true,
|
2017-11-09 05:34:13 +00:00
|
|
|
] );
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
case 'VARIANTS':
|
|
|
|
?>
|
|
|
|
<div id="p-variants" role="navigation" class="vectorMenu<?php
|
|
|
|
if ( count( $this->data['variant_urls'] ) == 0 ) {
|
|
|
|
echo ' emptyPortlet';
|
|
|
|
}
|
|
|
|
?>" aria-labelledby="p-variants-label">
|
|
|
|
<?php
|
|
|
|
// Replace the label with the name of currently chosen variant, if any
|
|
|
|
$variantLabel = $this->getMsg( 'variants' )->text();
|
2017-07-26 17:15:27 +00:00
|
|
|
foreach ( $this->data['variant_urls'] as $item ) {
|
|
|
|
if ( isset( $item['class'] ) && stripos( $item['class'], 'selected' ) !== false ) {
|
|
|
|
$variantLabel = $item['text'];
|
2014-08-07 11:38:34 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2017-06-16 16:34:14 +00:00
|
|
|
<input type="checkbox" class="vectorMenuCheckbox" aria-labelledby="p-variants-label" />
|
2015-06-09 13:36:04 +00:00
|
|
|
<h3 id="p-variants-label">
|
2017-07-04 15:51:10 +00:00
|
|
|
<span><?php echo htmlspecialchars( $variantLabel ) ?></span>
|
2015-06-09 13:36:04 +00:00
|
|
|
</h3>
|
2014-08-07 11:38:34 +00:00
|
|
|
<div class="menu">
|
|
|
|
<ul>
|
|
|
|
<?php
|
2017-07-26 17:15:27 +00:00
|
|
|
foreach ( $this->data['variant_urls'] as $key => $item ) {
|
2017-11-09 05:34:13 +00:00
|
|
|
echo $this->makeListItem( $key, $item );
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
case 'VIEWS':
|
|
|
|
?>
|
|
|
|
<div id="p-views" role="navigation" class="vectorTabs<?php
|
|
|
|
if ( count( $this->data['view_urls'] ) == 0 ) {
|
|
|
|
echo ' emptyPortlet';
|
|
|
|
}
|
|
|
|
?>" aria-labelledby="p-views-label">
|
|
|
|
<h3 id="p-views-label"><?php $this->msg( 'views' ) ?></h3>
|
2015-06-08 21:12:40 +00:00
|
|
|
<ul<?php $this->html( 'userlangattributes' ) ?>>
|
2014-08-07 11:38:34 +00:00
|
|
|
<?php
|
2017-07-26 17:15:27 +00:00
|
|
|
foreach ( $this->data['view_urls'] as $key => $item ) {
|
2017-11-09 05:34:13 +00:00
|
|
|
echo $this->makeListItem( $key, $item, [
|
2017-07-26 17:15:27 +00:00
|
|
|
'vector-wrap' => true,
|
|
|
|
'vector-collapsible' => true,
|
2017-11-09 05:34:13 +00:00
|
|
|
] );
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
case 'ACTIONS':
|
|
|
|
?>
|
|
|
|
<div id="p-cactions" role="navigation" class="vectorMenu<?php
|
|
|
|
if ( count( $this->data['action_urls'] ) == 0 ) {
|
|
|
|
echo ' emptyPortlet';
|
|
|
|
}
|
|
|
|
?>" aria-labelledby="p-cactions-label">
|
2017-06-16 16:34:14 +00:00
|
|
|
<input type="checkbox" class="vectorMenuCheckbox" aria-labelledby="p-cactions-label" />
|
2014-08-07 11:38:34 +00:00
|
|
|
<h3 id="p-cactions-label"><span><?php
|
|
|
|
$this->msg( 'vector-more-actions' )
|
2017-07-04 15:51:10 +00:00
|
|
|
?></span></h3>
|
2014-08-07 11:38:34 +00:00
|
|
|
<div class="menu">
|
|
|
|
<ul<?php $this->html( 'userlangattributes' ) ?>>
|
|
|
|
<?php
|
2017-07-26 17:15:27 +00:00
|
|
|
foreach ( $this->data['action_urls'] as $key => $item ) {
|
2017-11-09 05:34:13 +00:00
|
|
|
echo $this->makeListItem( $key, $item );
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
case 'PERSONAL':
|
|
|
|
?>
|
|
|
|
<div id="p-personal" role="navigation" class="<?php
|
|
|
|
if ( count( $this->data['personal_urls'] ) == 0 ) {
|
|
|
|
echo ' emptyPortlet';
|
|
|
|
}
|
|
|
|
?>" aria-labelledby="p-personal-label">
|
|
|
|
<h3 id="p-personal-label"><?php $this->msg( 'personaltools' ) ?></h3>
|
|
|
|
<ul<?php $this->html( 'userlangattributes' ) ?>>
|
|
|
|
<?php
|
2016-02-24 20:54:48 +00:00
|
|
|
$notLoggedIn = '';
|
|
|
|
|
|
|
|
if ( !$this->getSkin()->getUser()->isLoggedIn() &&
|
2017-06-23 20:06:01 +00:00
|
|
|
User::groupHasPermission( '*', 'edit' )
|
|
|
|
) {
|
2016-02-24 20:54:48 +00:00
|
|
|
$notLoggedIn =
|
2018-06-12 14:56:24 +00:00
|
|
|
Html::element( 'li',
|
2016-02-24 20:54:48 +00:00
|
|
|
[ 'id' => 'pt-anonuserpage' ],
|
2018-06-12 14:56:24 +00:00
|
|
|
$this->getMsg( 'notloggedin' )->text()
|
2016-02-24 20:54:48 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-05-18 20:23:15 +00:00
|
|
|
$personalTools = $this->getPersonalTools();
|
|
|
|
|
|
|
|
$langSelector = '';
|
|
|
|
if ( array_key_exists( 'uls', $personalTools ) ) {
|
|
|
|
$langSelector = $this->makeListItem( 'uls', $personalTools[ 'uls' ] );
|
|
|
|
unset( $personalTools[ 'uls' ] );
|
|
|
|
}
|
|
|
|
|
2017-10-04 16:58:10 +00:00
|
|
|
echo $langSelector;
|
|
|
|
echo $notLoggedIn;
|
2014-08-07 11:38:34 +00:00
|
|
|
foreach ( $personalTools as $key => $item ) {
|
|
|
|
echo $this->makeListItem( $key, $item );
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
case 'SEARCH':
|
|
|
|
?>
|
|
|
|
<div id="p-search" role="search">
|
|
|
|
<h3<?php $this->html( 'userlangattributes' ) ?>>
|
|
|
|
<label for="searchInput"><?php $this->msg( 'search' ) ?></label>
|
|
|
|
</h3>
|
|
|
|
<form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
|
2015-06-08 21:12:40 +00:00
|
|
|
<div<?php echo $this->config->get( 'VectorUseSimpleSearch' ) ? ' id="simpleSearch"' : '' ?>>
|
2017-11-09 05:34:13 +00:00
|
|
|
<?php
|
|
|
|
echo $this->makeSearchInput( [ 'id' => 'searchInput' ] );
|
|
|
|
echo Html::hidden( 'title', $this->get( 'searchtitle' ) );
|
|
|
|
/* We construct two buttons (for 'go' and 'fulltext' search modes),
|
|
|
|
* but only one will be visible and actionable at a time (they are
|
|
|
|
* overlaid on top of each other in CSS).
|
|
|
|
* * Browsers will use the 'fulltext' one by default (as it's the
|
|
|
|
* first in tree-order), which is desirable when they are unable
|
|
|
|
* to show search suggestions (either due to being broken or
|
|
|
|
* having JavaScript turned off).
|
|
|
|
* * The mediawiki.searchSuggest module, after doing tests for the
|
|
|
|
* broken browsers, removes the 'fulltext' button and handles
|
|
|
|
* 'fulltext' search itself; this will reveal the 'go' button and
|
|
|
|
* cause it to be used.
|
|
|
|
*/
|
|
|
|
echo $this->makeSearchButton(
|
|
|
|
'fulltext',
|
|
|
|
[ 'id' => 'mw-searchButton', 'class' => 'searchButton mw-fallbackSearchButton' ]
|
|
|
|
);
|
|
|
|
echo $this->makeSearchButton(
|
|
|
|
'go',
|
|
|
|
[ 'id' => 'searchButton', 'class' => 'searchButton' ]
|
|
|
|
);
|
|
|
|
?>
|
2015-06-08 21:12:40 +00:00
|
|
|
</div>
|
2014-08-07 11:38:34 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-07-26 17:15:27 +00:00
|
|
|
|
|
|
|
/**
|
2017-09-09 10:03:21 +00:00
|
|
|
* @inheritDoc
|
2017-07-26 17:15:27 +00:00
|
|
|
*/
|
|
|
|
public function makeLink( $key, $item, $options = [] ) {
|
|
|
|
$html = parent::makeLink( $key, $item, $options );
|
|
|
|
// Add an extra wrapper because our CSS is weird
|
|
|
|
if ( isset( $options['vector-wrap'] ) && $options['vector-wrap'] ) {
|
|
|
|
$html = Html::rawElement( 'span', [], $html );
|
|
|
|
}
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-09-09 10:03:21 +00:00
|
|
|
* @inheritDoc
|
2017-07-26 17:15:27 +00:00
|
|
|
*/
|
|
|
|
public function makeListItem( $key, $item, $options = [] ) {
|
|
|
|
// For fancy styling of watch/unwatch star
|
|
|
|
if (
|
|
|
|
$this->config->get( 'VectorUseIconWatch' )
|
|
|
|
&& ( $key === 'watch' || $key === 'unwatch' )
|
|
|
|
) {
|
|
|
|
$item['class'] = rtrim( 'icon ' . $item['class'], ' ' );
|
|
|
|
$item['primary'] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add CSS class 'collapsible' to links which are not marked as "primary"
|
|
|
|
if (
|
2017-07-31 15:11:29 +00:00
|
|
|
isset( $options['vector-collapsible'] ) && $options['vector-collapsible'] ) {
|
2017-07-26 17:15:27 +00:00
|
|
|
$item['class'] = rtrim( 'collapsible ' . $item['class'], ' ' );
|
|
|
|
}
|
|
|
|
|
|
|
|
// We don't use this, prevent it from popping up in HTML output
|
|
|
|
unset( $item['redundant'] );
|
|
|
|
|
|
|
|
return parent::makeListItem( $key, $item, $options );
|
|
|
|
}
|
2014-08-07 11:38:34 +00:00
|
|
|
}
|