Follow-up Ia0cc9612d: Fix unexpected leading whitespace in Skin HTML
[lhc/web/wiklou.git] / skins / Modern.php
1 <?php
2 /**
3 * Modern skin, derived from monobook template.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @todo document
21 * @file
22 * @ingroup Skins
23 */
24
25 if ( !defined( 'MEDIAWIKI' ) ) {
26 die( -1 );
27 }
28
29 /**
30 * Inherit main code from SkinTemplate, set the CSS and template filter.
31 * @todo document
32 * @ingroup Skins
33 */
34 class SkinModern extends SkinTemplate {
35 public $skinname = 'modern';
36 public $stylename = 'modern';
37 public $template = 'ModernTemplate';
38 public $useHeadElement = true;
39
40 /**
41 * @param OutputPage $out
42 */
43 function setupSkinUserCss( OutputPage $out ) {
44 parent::setupSkinUserCss( $out );
45 $out->addModuleStyles( 'skins.modern' );
46 }
47 }
48
49 /**
50 * @todo document
51 * @ingroup Skins
52 */
53 class ModernTemplate extends MonoBookTemplate {
54
55 /**
56 * Template filter callback for Modern skin.
57 * Takes an associative array of data set from a SkinTemplate-based
58 * class, and a wrapper for MediaWiki's localization database, and
59 * outputs a formatted page.
60 *
61 * @access private
62 */
63 function execute() {
64 // Suppress warnings to prevent notices about missing indexes in $this->data
65 wfSuppressWarnings();
66
67 $this->html( 'headelement' );
68 ?>
69
70 <!-- heading -->
71 <div id="mw_header"><h1 id="firstHeading" lang="<?php
72 $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
73 $this->text( 'pageLanguage' );
74 ?>"><span dir="auto"><?php $this->html( 'title' ) ?></span></h1></div>
75
76 <div id="mw_main">
77 <div id="mw_contentwrapper">
78 <!-- navigation portlet -->
79 <?php $this->cactions(); ?>
80
81 <!-- content -->
82 <div id="mw_content" role="main">
83 <!-- contentholder does nothing by default, but it allows users to style the text inside
84 the content area without affecting the meaning of 'em' in #mw_content, which is used
85 for the margins -->
86 <div id="mw_contentholder" class="mw-body">
87 <div class='mw-topboxes'>
88 <div id="mw-js-message"
89 style="display:none;"<?php $this->html( 'userlangattributes' ) ?>></div>
90 <div class="mw-topbox" id="siteSub"><?php $this->msg( 'tagline' ) ?></div>
91 <?php
92 if ( $this->data['newtalk'] ) {
93 ?>
94 <div class="usermessage mw-topbox"><?php $this->html( 'newtalk' ) ?></div>
95 <?php
96 }
97 ?>
98 <?php
99 if ( $this->data['sitenotice'] ) {
100 ?>
101 <div class="mw-topbox" id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
102 <?php
103 }
104 ?>
105 </div>
106
107 <div id="contentSub"<?php
108 $this->html( 'userlangattributes' )
109 ?>><?php
110 $this->html( 'subtitle' )
111 ?></div>
112
113 <?php
114 if ( $this->data['undelete'] ) {
115 ?>
116 <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div><?php
117 }
118 ?>
119 <div id="jump-to-nav"><?php $this->msg( 'jumpto' ) ?>
120 <a href="#mw_portlets"><?php
121 $this->msg( 'jumptonavigation' ) ?></a><?php $this->msg( 'comma-separator' )
122 ?>
123 <a href="#searchInput"><?php $this->msg( 'jumptosearch' ) ?></a>
124 </div>
125
126 <?php $this->html( 'bodytext' ) ?>
127 <div class='mw_clear'></div>
128 <?php
129 if ( $this->data['catlinks'] ) {
130 $this->html( 'catlinks' );
131 }
132 ?>
133 <?php $this->html( 'dataAfterContent' ) ?>
134 </div><!-- mw_contentholder -->
135 </div><!-- mw_content -->
136 </div><!-- mw_contentwrapper -->
137
138 <div id="mw_portlets"<?php $this->html( "userlangattributes" ) ?>>
139 <h2><?php $this->msg( 'navigation-heading' ) ?></h2>
140
141 <!-- portlets -->
142 <?php $this->renderPortals( $this->data['sidebar'] ); ?>
143
144 </div><!-- mw_portlets -->
145
146
147 </div><!-- main -->
148
149 <div class="mw_clear"></div>
150
151 <!-- personal portlet -->
152 <div class="portlet" id="p-personal" role="navigation">
153 <h3><?php $this->msg( 'personaltools' ) ?></h3>
154
155 <div class="pBody">
156 <ul>
157 <?php
158 foreach ( $this->getPersonalTools() as $key => $item ) {
159 ?>
160 <?php echo $this->makeListItem( $key, $item ); ?>
161
162 <?php
163 }
164 ?>
165 </ul>
166 </div>
167 </div>
168
169
170 <!-- footer -->
171 <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>>
172 <ul id="f-list">
173 <?php
174 foreach ( $this->getFooterLinks( "flat" ) as $aLink ) {
175 if ( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
176 ?>
177 <li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li>
178 <?php
179 }
180 }
181 ?>
182 </ul>
183 <?php
184 foreach ( $this->getFooterIcons( "nocopyright" ) as $blockName => $footerIcons ) {
185 ?>
186 <div id="mw_<?php echo htmlspecialchars( $blockName ); ?>">
187 <?php
188 foreach ( $footerIcons as $icon ) {
189 ?>
190 <?php echo $this->getSkin()->makeFooterIcon( $icon, 'withoutImage' ); ?>
191
192 <?php
193 } ?>
194 </div>
195 <?php
196 }
197 ?>
198 </div>
199
200 <?php $this->printTrail(); ?>
201
202 </body>
203 </html>
204 <?php
205 wfRestoreWarnings();
206 } // end of execute() method
207 } // end of class