Port Modern to resourceloader
[lhc/web/wiklou.git] / skins / Modern.php
1 <?php
2 /**
3 * Modern skin, derived from monobook template.
4 *
5 * @todo document
6 * @file
7 * @ingroup Skins
8 */
9
10 if( !defined( 'MEDIAWIKI' ) )
11 die( -1 );
12
13 require( dirname(__FILE__) . '/MonoBook.php' );
14
15 /**
16 * Inherit main code from SkinTemplate, set the CSS and template filter.
17 * @todo document
18 * @ingroup Skins
19 */
20 class SkinModern extends SkinTemplate {
21 var $skinname = 'modern', $stylename = 'modern',
22 $template = 'ModernTemplate', $useHeadElement = true;
23
24 function setupSkinUserCss( OutputPage $out ){
25 parent::setupSkinUserCss( $out );
26 $out->addModuleStyles ('skins.modern');
27 }
28 }
29
30 /**
31 * @todo document
32 * @ingroup Skins
33 */
34 class ModernTemplate extends MonoBookTemplate {
35 var $skin;
36 /**
37 * Template filter callback for Modern skin.
38 * Takes an associative array of data set from a SkinTemplate-based
39 * class, and a wrapper for MediaWiki's localization database, and
40 * outputs a formatted page.
41 *
42 * @access private
43 */
44 function execute() {
45 global $wgRequest;
46 $this->skin = $skin = $this->data['skin'];
47 $action = $wgRequest->getText( 'action' );
48
49 // Suppress warnings to prevent notices about missing indexes in $this->data
50 wfSuppressWarnings();
51
52 $this->html( 'headelement' );
53 ?>
54
55 <!-- heading -->
56 <div id="mw_header"><h1 id="firstHeading"><?php $this->html('title') ?></h1></div>
57
58 <div id="mw_main">
59 <div id="mw_contentwrapper">
60 <!-- navigation portlet -->
61 <div id="p-cactions" class="portlet">
62 <h5><?php $this->msg('views') ?></h5>
63 <div class="pBody">
64 <ul>
65 <?php foreach($this->data['content_actions'] as $key => $tab) {
66 echo '
67 <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
68 if( $tab['class'] ) {
69 echo ' class="'.htmlspecialchars($tab['class']).'"';
70 }
71 echo'><a href="'.htmlspecialchars($tab['href']).'"';
72 if( isset($tab["tooltiponly"]) && $tab["tooltiponly"] ) {
73 echo $skin->tooltip( "ca-$key" );
74 } else {
75 echo $skin->tooltipAndAccesskey( "ca-$key" );
76 }
77 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
78 } ?>
79 </ul>
80 </div>
81 </div>
82
83 <!-- content -->
84 <div id="mw_content">
85 <!-- contentholder does nothing by default, but it allows users to style the text inside
86 the content area without affecting the meaning of 'em' in #mw_content, which is used
87 for the margins -->
88 <div id="mw_contentholder" <?php $this->html("specialpageattributes") ?>>
89 <div class='mw-topboxes'>
90 <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes')?>></div>
91 <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
92 <?php if($this->data['newtalk'] ) {
93 ?><div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div>
94 <?php } ?>
95 <?php if($this->data['sitenotice']) {
96 ?><div class="mw-topbox" id="siteNotice"><?php $this->html('sitenotice') ?></div>
97 <?php } ?>
98 </div>
99
100 <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div>
101
102 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
103 <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#mw_portlets"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
104
105 <?php $this->html('bodytext') ?>
106 <div class='mw_clear'></div>
107 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
108 <?php $this->html ('dataAfterContent') ?>
109 </div><!-- mw_contentholder -->
110 </div><!-- mw_content -->
111 </div><!-- mw_contentwrapper -->
112
113 <div id="mw_portlets"<?php $this->html("userlangattributes") ?>>
114
115 <!-- portlets -->
116 <?php
117 $sidebar = $this->data['sidebar'];
118 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
119 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
120 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
121
122 foreach ($sidebar as $boxName => $cont) {
123 if ( $boxName == 'SEARCH' ) {
124 $this->searchBox();
125 } elseif ( $boxName == 'TOOLBOX' ) {
126 $this->toolbox();
127 } elseif ( $boxName == 'LANGUAGES' ) {
128 $this->languageBox();
129 } else {
130 $this->customBox( $boxName, $cont );
131 }
132 }
133 ?>
134
135 </div><!-- mw_portlets -->
136
137
138 </div><!-- main -->
139
140 <div class="mw_clear"></div>
141
142 <!-- personal portlet -->
143 <div class="portlet" id="p-personal">
144 <h5><?php $this->msg('personaltools') ?></h5>
145 <div class="pBody">
146 <ul>
147 <?php foreach($this->getPersonalTools() as $key => $item) { ?>
148 <?php echo $this->makeListItem($key, $item); ?>
149
150 <?php } ?>
151 </ul>
152 </div>
153 </div>
154
155
156 <!-- footer -->
157 <div id="footer"<?php $this->html('userlangattributes') ?>>
158 <ul id="f-list">
159 <?php
160 foreach( $this->getFooterLinks("flat") as $aLink ) {
161 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
162 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
163 <?php }
164 }
165 ?>
166 </ul>
167 <?php
168 foreach ( $this->getFooterIcons("nocopyright") as $blockName => $footerIcons ) { ?>
169 <div id="mw_<?php echo htmlspecialchars($blockName); ?>">
170 <?php
171 foreach ( $footerIcons as $icon ) { ?>
172 <?php echo $this->skin->makeFooterIcon( $icon, 'withoutImage' ); ?>
173
174 <?php
175 } ?>
176 </div>
177 <?php
178 }
179 ?>
180 </div>
181
182 <?php $this->printTrail(); ?>
183 </body></html>
184 <?php
185 wfRestoreWarnings();
186 } // end of execute() method
187 } // end of class
188
189