Implement the RequestContext class. Some credit to IAlex, ;) other credit for me...
[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
36 /**
37 * @var Skin
38 */
39 var $skin;
40 /**
41 * Template filter callback for Modern skin.
42 * Takes an associative array of data set from a SkinTemplate-based
43 * class, and a wrapper for MediaWiki's localization database, and
44 * outputs a formatted page.
45 *
46 * @access private
47 */
48 function execute() {
49 $this->skin = $skin = $this->data['skin'];
50
51 // Suppress warnings to prevent notices about missing indexes in $this->data
52 wfSuppressWarnings();
53
54 $this->html( 'headelement' );
55 ?>
56
57 <!-- heading -->
58 <div id="mw_header"><h1 id="firstHeading"><?php $this->html('title') ?></h1></div>
59
60 <div id="mw_main">
61 <div id="mw_contentwrapper">
62 <!-- navigation portlet -->
63 <?php $this->cactions( $skin ); ?>
64
65 <!-- content -->
66 <div id="mw_content">
67 <!-- contentholder does nothing by default, but it allows users to style the text inside
68 the content area without affecting the meaning of 'em' in #mw_content, which is used
69 for the margins -->
70 <div id="mw_contentholder" <?php $this->html("specialpageattributes") ?>>
71 <div class='mw-topboxes'>
72 <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes')?>></div>
73 <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
74 <?php if($this->data['newtalk'] ) {
75 ?><div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div>
76 <?php } ?>
77 <?php if($this->data['sitenotice']) {
78 ?><div class="mw-topbox" id="siteNotice"><?php $this->html('sitenotice') ?></div>
79 <?php } ?>
80 </div>
81
82 <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div>
83
84 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
85 <?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 } ?>
86
87 <?php $this->html('bodytext') ?>
88 <div class='mw_clear'></div>
89 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
90 <?php $this->html ('dataAfterContent') ?>
91 </div><!-- mw_contentholder -->
92 </div><!-- mw_content -->
93 </div><!-- mw_contentwrapper -->
94
95 <div id="mw_portlets"<?php $this->html("userlangattributes") ?>>
96
97 <!-- portlets -->
98 <?php
99 $sidebar = $this->data['sidebar'];
100 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
101 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
102 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
103
104 foreach ($sidebar as $boxName => $cont) {
105 if ( $boxName == 'SEARCH' ) {
106 $this->searchBox();
107 } elseif ( $boxName == 'TOOLBOX' ) {
108 $this->toolbox();
109 } elseif ( $boxName == 'LANGUAGES' ) {
110 $this->languageBox();
111 } else {
112 $this->customBox( $boxName, $cont );
113 }
114 }
115 ?>
116
117 </div><!-- mw_portlets -->
118
119
120 </div><!-- main -->
121
122 <div class="mw_clear"></div>
123
124 <!-- personal portlet -->
125 <div class="portlet" id="p-personal">
126 <h5><?php $this->msg('personaltools') ?></h5>
127 <div class="pBody">
128 <ul>
129 <?php foreach($this->getPersonalTools() as $key => $item) { ?>
130 <?php echo $this->makeListItem($key, $item); ?>
131
132 <?php } ?>
133 </ul>
134 </div>
135 </div>
136
137
138 <!-- footer -->
139 <div id="footer"<?php $this->html('userlangattributes') ?>>
140 <ul id="f-list">
141 <?php
142 foreach( $this->getFooterLinks("flat") as $aLink ) {
143 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
144 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
145 <?php }
146 }
147 ?>
148 </ul>
149 <?php
150 foreach ( $this->getFooterIcons("nocopyright") as $blockName => $footerIcons ) { ?>
151 <div id="mw_<?php echo htmlspecialchars($blockName); ?>">
152 <?php
153 foreach ( $footerIcons as $icon ) { ?>
154 <?php echo $this->skin->makeFooterIcon( $icon, 'withoutImage' ); ?>
155
156 <?php
157 } ?>
158 </div>
159 <?php
160 }
161 ?>
162 </div>
163
164 <?php $this->printTrail(); ?>
165 </body></html>
166 <?php
167 wfRestoreWarnings();
168 } // end of execute() method
169 } // end of class
170
171