3 * Copyright (c) 2015 Marcin Cieślak (saper.info)
5 * This file is part of Beagle Skin for Mediawiki.
7 * Beagle skin is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * Beagle is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Beagle. If not, see <http://www.gnu.org/licenses/>.
22 * This file is a rewrite of the Beagle Project MediaWiki skin:
23 * http://web.archive.org/web/20090106025017/http://beagle-project.org/
26 * Beagle - modified from MonoBook
27 * by: Joe Shaw (joeshaw@novell.com)
28 * license: TBD, probably GPL
30 * Default artwork used:
31 * "Beagle puppy's head", extracted by Marcin Cieślak
32 * out of the photography by Wikimedia Commons user Juanelverdolaga
33 * https://commons.wikimedia.org/wiki/File:Beagle_puppy%27s_head.png
35 * Availabe under Creative Commons Attribution-Share Alike 4.0:
36 * https://creativecommons.org/licenses/by-sa/4.0/deed.en
40 * Inherit main code from SkinTemplate, set the CSS and template filter.
43 class SkinBeagle
extends SkinTemplate
{
44 var $skinname = 'beagle', $stylename = 'beagle',
45 $template = 'BeagleTemplate', $useHeadElement = true;
47 public function initPage( OutputPage
$out ) {
48 global $wgBeagleImage;
49 parent
::initPage( $out );
50 $out->addInlineStyle( "#header h1 { background: transparent " .
51 "url(" . ( $wgBeagleImage ?
:
52 $this->getSkinStylePath( '/bigielbanner.png' ) . ") " .
55 $out->addModuleStyles( array(
60 * Add CSS via ResourceLoader
62 * @param $out OutputPage
64 function setupSkinUserCss( OutputPage
$out ) {
65 parent
::setupSkinUserCss( $out );
74 class BeagleTemplate
extends BaseTemplate
{
76 function sel( $sel ) {
79 return ' id="' . substr( $sel, 1 ) . '"';
81 return ' class="' . $sel . '"';
86 function div ( $sel = false, $role = false) {
87 print "<div" . $this->sel( $sel );
88 if ( $role ) print " role=\"$role\"";
92 function div_ends ( $sel = false ) {
96 function div_html( $dataitem, $sel ) {
97 if ( $this->data
[ $dataitem ] ) {
99 $this->html( $dataitem );
100 $this->div_ends( $sel );
104 function div_span_html( $dataitem, $sel, $span = false ) {
105 if ( $this->data
[ $dataitem ] ) {
107 if ( $span ) { print "<span" . $this->sel( $span ) . ">" ; }
108 $this->html( $dataitem );
109 if ( $span ) { print "</span>"; }
110 $this->div_ends( $sel );
114 function a_href_msg( $target_id, $msg ) {
115 print " <a href=\"$target_id\">";
120 function jumplinks() {
121 if ( $this->data
['showjumplinks'] ) {
122 $this->div( '#jump-to-nav' );
123 $this->msg( 'jumpto' );
124 $this->a_href_msg( '#nav_top', 'jumptonavigation' );
126 $this->a_href_msg( '#searchInput', 'jumptosearch' );
127 $this->div_ends( '#jump-to-nav' );
131 function data_html( $dataitem ) {
132 if ( $this->data
[ $dataitem ] )
133 $this->html( $dataitem );
136 function data_rem( $dataitem ) {
137 if ( $this->data
[ $dataitem ] ) {
138 print "<!-- Debug output:\n";
139 $this->text( $dataitem );
144 function ul_list( $source, $sel, $last_item = false ) {
145 if ( $source && is_array( $source ) ) {
146 print "<ul" . $this->sel( $sel ) . ">\n";
147 foreach( $source as $key => $action ) {
148 print "\t" . $this->makeListItem( $key, $action ) . "\n";
151 print "\t" . $last_item . "\n";
156 function ul_html ( $source ) {
157 if ( $source && is_array( $source ) ) {
158 print "<ul class=\"nav-bottom\">\n";
159 foreach( $source as $key ) {
161 print $this->html( $key );
168 function ul_plain ( $source ) {
169 if ( $source && is_array( $source ) ) {
170 print "<ul class=\"nav-bottom\">\n";
171 foreach( $source as $value ) {
180 function nav_top( $source ) {
182 $this->ul_list( $source, '#nav-top', '<li class="cheat"></li>' );
186 function nav_bottom( $source ) {
188 $this->ul_list( $source, 'nav-bottom' );
192 function recent_changes_link() {
194 $d[ 'id' ] = 'nn-recentchanges';
195 $d[ 'text' ] = $this->getMsg( 'recentchanges' );
196 $rc = $this->getMsg( 'recentchanges-url' )->inContentLanguage()->text();
197 $title = Title
::newFromText( $rc );
199 $d[ 'href' ] = $title->getLinkURL();
206 function main_bar_source() {
207 $sidebar = $this->getSidebar();
209 if ( isset( $sidebar[ 'navigation' ] ) )
210 if ( isset( $sidebar[ 'navigation' ][ 'content' ] ) )
211 return $sidebar[ 'navigation' ][ 'content' ];
215 function special_pages_source() {
216 $source = $this->getToolbox();
217 $source [ 'recentchanges' ] = $this->recent_changes_link();
221 function page_info() {
222 $this->div( '#article_info', 'contentinfo' );
223 $this->data_html( 'lastmod' );
224 $this->data_html( 'viewcount' );
225 $this->div_ends( '#article_info ');
228 function footer_icons() {
230 foreach ( $this->getFooterIcons( 'icononly' ) as $blockName => $footerIcons )
231 foreach ( $footerIcons as $icon )
232 array_push ( $source, $this->getSkin()->makeFooterIcon( $icon ) );
236 function search_form() { ?
>
237 <div
class="searchForm" role
="search">
238 <form id
="searchForm" class="searchForm" name
="searchForm" action
="<?php $this->text('searchaction') ?>">
239 <input type
="hidden" name
="title" value
="<?php $this->text( 'searchtitle' ) ?>" />
240 <?php
print $this->makeSearchInput(); ?
>
242 <?php
print $this->makeSearchButton( 'go' ); ?
>
244 <?php
print $this->makeSearchButton( 'fulltext' ); ?
>
251 function dotted_spacing() {
252 print "<hr class=\"clear dotted spacing\" />\n";
256 $skin = $this->getSkin();
257 $body = $this->data
['bodycontent'];
259 $skin_path = $this->data
['stylepath'].'/'.$this->data
['stylename'];
262 $this->html( 'headelement' );
264 ?
><!-- START main page container
-->
265 <div id
="pagecontainer">
267 <!-- START subsection header
and subnav
-->
269 <h1
><?php
$this->text( 'pagetitle' ) ?
></h1
>
271 <hr
class="clear spacing" />
273 $this->nav_top( $this->main_bar_source() );
275 <div id
="content" role
="main">
276 <div id
="content-body">
277 <div id
="articleBody">
279 <?php
$this->div_html( 'sitenotice', '#siteNotice' ); ?
>
280 <div id
="articleContent">
282 $this->div_html( 'subtitle', '#contentSub' );
283 $this->div_html( 'undelete', '#contentSub2' );
284 $this->div_html( 'newtalk', '#usermessage' );
286 $this->html( 'bodytext' );
287 $this->data_html( 'catlinks' );
289 </div
><!-- aricleContent
-->
290 </div
><!-- articleBody
-->
291 </div
><!-- content
-body
-->
294 print $this->getIndicators();
297 </div
><!-- content
-->
299 $this->dotted_spacing();
300 $this->html( 'dataAfterContent' );
302 $this->nav_bottom( $this->getPersonalTools() );
303 $this->nav_bottom( $this->data
[ 'content_actions' ] );
304 $this->nav_bottom( $this->data
[ 'language_urls' ] );
305 $this->search_form();
306 $this->nav_bottom( $this->special_pages_source() );
307 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
308 # $this->ul_html( $this->getFooterLinks( )[ 'places' ] );
309 $this->ul_plain( $this->footer_icons() );
311 $this->dotted_spacing();
313 $this->html( 'reporttime' );
314 $this->data_rem( 'debug' );
315 $this->printTrail(); ?
>