diff options
Diffstat (limited to 'TyrianTemplate.php')
-rw-r--r-- | TyrianTemplate.php | 419 |
1 files changed, 419 insertions, 0 deletions
diff --git a/TyrianTemplate.php b/TyrianTemplate.php new file mode 100644 index 0000000..f7a2d06 --- /dev/null +++ b/TyrianTemplate.php @@ -0,0 +1,419 @@ +<?php +/** + * @ingroup Skins + */ +class TyrianTemplate extends BaseTemplate { + function execute() { + wfSuppressWarnings(); + + $this->html( 'headelement' ); + ?> + <header> + <div class="site-title"> + <div class="container"> + <div class="row"> + <div class="site-title-buttons"> + <div class="btn-group btn-group-sm"> + <a href="http://get.gentoo.org/" role="button" class="btn get-gentoo"><span class="fa fa-download"></span> <strong>Get Gentoo!</strong></a> + <div class="btn-group btn-group-sm"> + <button type="button" class="btn gentoo-org-sites dropdown-toggle" data-toggle="dropdown"> + <span class="glyphicon glyphicon-globe"></span> gentoo.org sites <span class="caret"></span> + </button> + <ul class="dropdown-menu"> + <li><a href="http://www.gentoo.org/" title="Main Gentoo website"><span class="fa fa-home fa-fw"></span> gentoo.org</a></li> + <li><a href="http://wiki.gentoo.org/" title="Find and contribute documentation"><span class="fa fa-file-text fa-fw"></span> Wiki</a></li> + <li><a href="https://bugs.gentoo.org/" title="Report issues and find common issues"><span class="fa fa-bug fa-fw"></span> Bugs</a></li> + <li><a href="http://forums.gentoo.org/" title="Discuss with the community"><span class="fa fa-comments-o fa-fw"></span> Forums</a></li> + <li><a href="http://packages.gentoo.org/" title="Find software for your Gentoo"><span class="fa fa-hdd-o fa-fw"></span> Packages</a></li> + <li class="divider"></li> + <li><a href="http://overlays.gentoo.org/" title="Collaborate on maintaining packages"><span class="fa fa-code-fork fa-fw"></span> Overlays</a></li> + <li><a href="http://planet.gentoo.org/" title="Find out what's going on in the developer community"><span class="fa fa-rss fa-fw"></span> Planet</a></li> + <li><a href="http://archives.gentoo.org/" title="Read up on past discussions"><span class="fa fa-archive fa-fw"></span> Archives</a></li> + <li><a href="http://sources.gentoo.org/" title="Browse our source code"><span class="fa fa-code fa-fw"></span> Sources</a></li> + <li class="divider"></li> + <li><a href="http://infra-status.gentoo.org/" title="Get updates on the services provided by Gentoo"><span class="fa fa-tasks fa-fw"></span> Infra Status</a></li> + </ul> + </div> + </div> + </div> + <div class="logo"> + <img src="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/site-logo.png" data-at2x="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/site-logo@2x.png" alt="Gentoo Linux Logo"/> + <span class="site-label">Wiki</span> + </div> + </div> + </div> + </div> + <nav class="tyrian-navbar" role="navigation"> + <div class="container"> + <div class="row"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + </div> + <div class="collapse navbar-collapse navbar-main-collapse"> + <ul class="nav navbar-nav"> + <?php + $this->renderPortals( $this->data['sidebar'] ); + ?> + </ul> + <ul class="nav navbar-nav navbar-right"> + <?php + $this->toolbox(); + $this->personaltools(); + ?> + </ul> + </div> + </div> + </div> + </nav> + <?php $this->cactions(); ?> + </header> + + <div class="container"> + <div class="row"> + <div class="col-md-12"> + <div id="content" class="mw-body" role="main"> + <a id="top"></a> + <?php + if ( $this->data['sitenotice'] ) { + ?> + <div id="siteNotice"><?php + $this->html( 'sitenotice' ) + ?></div><?php + } + ?> + + <h1 id="firstHeading" class="first-header" lang="<?php + $this->data['pageLanguage'] = + $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode(); + $this->text( 'pageLanguage' ); + ?>"><span dir="auto"><?php $this->html( 'title' ) ?></span></h1> + + <div id="bodyContent" class="mw-body-content"> + <div id="siteSub"><?php $this->msg( 'tagline' ) ?></div> + <div id="contentSub"<?php + $this->html( 'userlangattributes' ) ?>><?php $this->html( 'subtitle' ) + ?></div> + <?php if ( $this->data['undelete'] ) { ?> + <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div> + <?php +} + ?><?php + if ( $this->data['newtalk'] ) { + ?> + <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div> + <?php + } + ?> + <div id="jump-to-nav" class="mw-jump"><?php + $this->msg( 'jumpto' ) + ?> <a href="#column-one"><?php + $this->msg( 'jumptonavigation' ) + ?></a><?php + $this->msg( 'comma-separator' ) + ?><a href="#searchInput"><?php + $this->msg( 'jumptosearch' ) + ?></a></div> + + <!-- start content --> + <?php $this->html( 'bodytext' ) ?> + <?php + if ( $this->data['catlinks'] ) { ?> + <div class="well well-sm"> <?php + $this->html( 'catlinks' ); + ?></div> + <?php } + ?> + <!-- end content --> + <?php + if ( $this->data['dataAfterContent'] ) { + $this->html( 'dataAfterContent' + ); + } + ?> + </div> + </div> + </div></div> + </div> + <?php + $validFooterIcons = $this->getFooterIcons( "icononly" ); + $validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links + ?> + <footer> + <div class="container"> + <div class="row"> + <div class="col-md-8"> + <?php + if ( count( $validFooterLinks ) > 0 ) { + ?> + <ul id="f-list"> + <?php + foreach ( $validFooterLinks as $aLink ) { + ?> + <li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li> + <?php + } + ?> + </ul> + <?php + } ?> + </div> + <div class="col-md-4 footericons"> + <?php + foreach ( $validFooterIcons as $blockName => $footerIcons ) { + ?> + <div id="f-<?php echo htmlspecialchars( $blockName ); ?>ico" style="display: inline-block;"> + <?php foreach ( $footerIcons as $icon ) { ?> + <?php echo $this->getSkin()->makeFooterIcon( $icon ); ?> + + <?php + } + ?> + </div> + <?php + } ?> + </div> + </div> + <div class="row"> + <div class="col-md-12"> + <strong>© 2001-2015 Gentoo Foundation, Inc.</strong><br /> + <small> + Gentoo is a trademark of the Gentoo Foundation, Inc. + The contents of this document, unless otherwise expressly stated, are licensed under the + <a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license">CC-BY-SA-3.0</a> license. + The <a href="http://www.gentoo.org/main/en/name-logo.xml">Gentoo Name and Logo Usage Guidelines</a> apply. + </small> + </div> + </div> + </div> + </footer> + + <?php + echo $footerEnd; + ?> + + </div> + <script src="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/bootstrap.min.js"></script> + <script src="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/retina.min.js"></script> + <?php + $this->printTrail(); + echo Html::closeElement( 'body' ); + echo Html::closeElement( 'html' ); + wfRestoreWarnings(); + } // end of execute() method + + /*************************************************************************************************/ + + /** + * @param array $sidebar + */ + protected function renderPortals( $sidebar ) { + // These are already rendered elsewhere + $sidebar['SEARCH'] = false; + $sidebar['TOOLBOX'] = false; + $sidebar['LANGUAGES'] = false; + + foreach ( $sidebar as $boxName => $content ) { + if ( $content === false ) { + continue; + } + + $this->customBox( $boxName, $content ); + } + } + + function searchBox() { + ?> + <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform" class="navbar-form navbar-right" role="search"> + <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/> + + <div class="input-group"> + <?php echo $this->makeSearchInput( array( "id" => "searchInput", "class" => "form-control", "placeholder" => $this->getMsg( 'search' )->escaped() ) ); ?> + <div class="input-group-btn"><?php + echo $this->makeSearchButton( + "go", + array( "id" => "searchGoButton", "class" => "searchButton btn btn-default" ) + ); + + echo $this->makeSearchButton( + "fulltext", + array( "id" => "mw-searchButton", "class" => "searchButton btn btn-default" ) + ); + ?></div> + </div> + </form> + <?php + } + + function cactions() { + $context_actions = array(); + $primary_actions = array(); + $secondary_actions = array(); + + foreach ( $this->data['content_actions'] as $key => $tab ) { + // TODO: handling form_edit separately here is a hack, no idea how it works in Vector. + if ( isset($tab['primary']) && $tab['primary'] == '1' || $key == 'form_edit' ) { + if ( isset($tab['context']) ) { + $context_actions[$key] = $tab; + + if ( strpos( $tab['class'], 'selected' ) !== false ) { + $context_actions[$key]['class'] .= ' active'; + } + } else { + $primary_actions[$key] = $tab; + + if ( strpos( $tab['class'], 'selected' ) !== false ) { + $primary_actions[$key]['class'] .= ' active'; + } + } + } else { + $secondary_actions[$key] = $tab; + + if ( strpos( $tab['class'], 'selected' ) !== false ) { + $secondary_actions[$key]['class'] .= ' active'; + } + } + } + ?> + + <nav class="navbar navbar-grey" id="wiki-actions" role="navigation"> + <div class="container"><div class="row"> + <!-- Brand and toggle get grouped for better mobile display --> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#gw-toolbar"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + </div> + + <!-- Collect the nav links, forms, and other content for toggling --> + <div class="collapse navbar-collapse" id="gw-toolbar"> + <ul class="nav navbar-nav"> + <?php + foreach ( $context_actions as $key => $tab ) { + echo $this->makeListItem( $key, $tab ); + } + ?> + </ul> + <?php + $this->searchBox(); + ?> + <ul class="nav navbar-nav navbar-right"> + <?php + foreach ( $primary_actions as $key => $tab ) { + echo $this->makeListItem( $key, $tab ); + } + ?> <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">more <span class="caret"></span></a> + <ul class="dropdown-menu" role="menu"> + <?php + foreach ( $secondary_actions as $key => $tab ) { + echo $this->makeListItem( $key, $tab ); + } + ?> + </ul> + </li> + </ul> + </div><!-- /.navbar-collapse --> + </div></div><!-- /.container-fluid --> + </nav> + <?php + } + + /*************************************************************************************************/ + function toolbox() { + ?> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-cog"></i> <?php $this->msg( 'toolbox' ) ?> <span class="caret"></span></a> + <ul class="dropdown-menu" role="menu"> + <?php + foreach ( $this->getToolbox() as $key => $tbitem) { + echo $this->makeListItem( $key, $tbitem ); + } + + wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) ); + wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); + ?> + </ul> + </li> + <?php + } + + /*************************************************************************************************/ + function personaltools() { + ?> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> + <span class="glyphicon glyphicon-user" aria-label="<?php $this->msg( 'personaltools' ) ?>"></span> + <?php $this->msg( 'listfiles_user' ) ?> + <span class="caret"></span> + </a> + <ul class="dropdown-menu" role="menu"> + <?php + foreach ( $this->getPersonalTools() as $key => $item ) { + echo $this->makeListItem( $key, $item ); + } + ?> + </ul> + </li> + <?php + } + + /*************************************************************************************************/ + function languageBox() { + if ( $this->data['language_urls'] !== false ) { + ?> + <div id="p-lang" class="portlet" role="navigation"> + <h3<?php $this->html( 'userlangattributes' ) ?>><?php $this->msg( 'otherlanguages' ) ?></h3> + + <div class="pBody"> + <ul> + <?php foreach ( $this->data['language_urls'] as $key => $langlink ) { ?> + <?php echo $this->makeListItem( $key, $langlink ); ?> + + <?php +} + ?> + </ul> + + <?php $this->renderAfterPortlet( 'lang' ); ?> + </div> + </div> + <?php + } + } + + /*************************************************************************************************/ + /** + * @param string $bar + * @param array|string $cont + */ + function customBox( $bar, $cont ) { + $msgObj = wfMessage( $bar ); + + if ( $bar !== 'navigation' ) { ?> + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $bar ); ?> <span class="caret"></span></a> + <ul class="dropdown-menu" role="menu"> + <?php } + + if ( is_array ( $cont ) ) { + foreach ( $cont as $key => $val ) { + echo $this->makeListItem( $key, $val ); + } + } else { + echo "<!-- This would have been a box, but it contains custom html which is not supported. -->"; + } + + if ( $bar !== 'navigation' ) { ?> + </ul> + </li> + <?php } + } +} // end of class |