]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - skins/Modern/SkinModern.php
MediaWiki 1.30.2
[autoinstalls/mediawiki.git] / skins / Modern / SkinModern.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 $template = 'ModernTemplate';
37
38         /**
39          * @param OutputPage $out
40          */
41         function setupSkinUserCss( OutputPage $out ) {
42                 parent::setupSkinUserCss( $out );
43                 $out->addModuleStyles( 'skins.modern' );
44         }
45 }
46
47 /**
48  * @todo document
49  * @ingroup Skins
50  */
51 class ModernTemplate extends MonoBookTemplate {
52
53         /**
54          * Template filter callback for Modern skin.
55          * Takes an associative array of data set from a SkinTemplate-based
56          * class, and a wrapper for MediaWiki's localization database, and
57          * outputs a formatted page.
58          */
59         function execute() {
60                 $this->html( 'headelement' );
61                 ?>
62
63                 <!-- heading -->
64                 <div id="mw_header">
65                         <?php echo $this->getIndicators(); ?>
66                         <h1 id="firstHeading" lang="<?php
67                         $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
68                         $this->text( 'pageLanguage' );
69                         ?>"><?php $this->html( 'title' ) ?></h1>
70                 </div>
71
72                 <div id="mw_main">
73                         <div id="mw_contentwrapper">
74                                 <!-- navigation portlet -->
75                                 <?php $this->cactions(); ?>
76
77                                 <!-- content -->
78                                 <div id="mw_content" role="main">
79                                         <!-- contentholder does nothing by default, but it allows users to style the text inside
80                                                  the content area without affecting the meaning of 'em' in #mw_content, which is used
81                                                  for the margins -->
82                                         <div id="mw_contentholder" class="mw-body">
83                                                 <div class='mw-topboxes'>
84                                                         <div id="mw-js-message"
85                                                                 style="display:none;"<?php $this->html( 'userlangattributes' ) ?>></div>
86                                                         <div class="mw-topbox" id="siteSub"><?php $this->msg( 'tagline' ) ?></div>
87                                                         <?php
88                                                         if ( $this->data['newtalk'] ) {
89                                                                 ?>
90                                                                 <div class="usermessage mw-topbox"><?php $this->html( 'newtalk' ) ?></div>
91                                                         <?php
92                                                         }
93                                                         ?>
94                                                         <?php
95                                                         if ( $this->data['sitenotice'] ) {
96                                                                 ?>
97                                                                 <div class="mw-topbox" id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
98                                                         <?php
99                                                         }
100                                                         ?>
101                                                 </div>
102
103                                                 <div id="contentSub"<?php
104                                                 $this->html( 'userlangattributes' )
105                                                 ?>><?php
106                                                         $this->html( 'subtitle' )
107                                                         ?></div>
108
109                                                 <?php
110                                                 if ( $this->data['undelete'] ) {
111                                                         ?>
112                                                         <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div><?php
113                                                 }
114                                                 ?>
115                                                 <div id="jump-to-nav"><?php $this->msg( 'jumpto' ) ?>
116                                                         <a href="#mw_portlets"><?php
117                                                                 $this->msg( 'jumptonavigation' ) ?></a><?php $this->msg( 'comma-separator' )
118                                                         ?>
119                                                         <a href="#searchInput"><?php $this->msg( 'jumptosearch' ) ?></a>
120                                                 </div>
121
122                                                 <?php $this->html( 'bodytext' ) ?>
123                                                 <div class='mw_clear'></div>
124                                                 <?php
125                                                 if ( $this->data['catlinks'] ) {
126                                                         $this->html( 'catlinks' );
127                                                 }
128                                                 ?>
129                                                 <?php $this->html( 'dataAfterContent' ) ?>
130                                         </div><!-- mw_contentholder -->
131                                 </div><!-- mw_content -->
132                         </div><!-- mw_contentwrapper -->
133
134                         <div id="mw_portlets"<?php $this->html( "userlangattributes" ) ?>>
135                                 <h2><?php $this->msg( 'navigation-heading' ) ?></h2>
136
137                                 <!-- portlets -->
138                                 <?php $this->renderPortals( $this->data['sidebar'] ); ?>
139
140                         </div><!-- mw_portlets -->
141
142
143                 </div><!-- main -->
144
145                 <div class="mw_clear"></div>
146
147                 <!-- personal portlet -->
148                 <div class="portlet" id="p-personal" role="navigation">
149                         <h3><?php $this->msg( 'personaltools' ) ?></h3>
150
151                         <div class="pBody">
152                                 <ul>
153                                         <?php
154                                         foreach ( $this->getPersonalTools() as $key => $item ) {
155                                                 ?>
156                                                 <?php echo $this->makeListItem( $key, $item ); ?>
157
158                                         <?php
159                                         }
160                                         ?>
161                                 </ul>
162                         </div>
163                 </div>
164
165
166                 <!-- footer -->
167                 <div id="footer" role="contentinfo"<?php $this->html( 'userlangattributes' ) ?>>
168                         <ul id="f-list">
169                                 <?php
170                                 foreach ( $this->getFooterLinks( "flat" ) as $aLink ) {
171                                         if ( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
172                                                 ?>
173                                                 <li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li>
174                                         <?php
175                                         }
176                                 }
177                                 ?>
178                         </ul>
179                         <?php
180                         foreach ( $this->getFooterIcons( "nocopyright" ) as $blockName => $footerIcons ) {
181                                 ?>
182                                 <div id="mw_<?php echo htmlspecialchars( $blockName ); ?>">
183                                         <?php
184                                         foreach ( $footerIcons as $icon ) {
185                                                 ?>
186                                                 <?php echo $this->getSkin()->makeFooterIcon( $icon, 'withoutImage' ); ?>
187
188                                         <?php
189                                         } ?>
190                                 </div>
191                         <?php
192                         }
193                         ?>
194                 </div>
195
196                 <?php $this->printTrail(); ?>
197
198         </body>
199 </html>
200                 <?php
201         }
202 }