r37321 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37320‎ | r37321 | r37322 >
Date:14:54, 8 July 2008
Author:daniel
Status:old
Tags:
Comment:
adopted Modern skin
Modified paths:
  • /branches/daniel/playground/skins/Modern.php (modified) (history)
  • /branches/daniel/playground/skins/MonoBook.php (modified) (history)

Diff [purge]

Index: branches/daniel/playground/skins/MonoBook.php
@@ -237,17 +237,6 @@
238238
239239 function executeHeadScripts( ) { /////////////////////////////////////////////////////////////////////////////////////////////////////////
240240 ?>
241 - <style type="text/css" media="screen, projection">/*<![CDATA[*/
242 - @import "<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
243 - @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
244 - /*]]>*/</style>
245 - <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('printcss') ?>?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
246 - <?php if( in_array( 'IE50', $this->skin->cssfiles ) ) { ?><!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
247 - <?php } if( in_array( 'IE55', $this->skin->cssfiles ) ) { ?><!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
248 - <?php } if( in_array( 'IE60', $this->skin->cssfiles ) ) { ?><!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
249 - <?php } if( in_array( 'IE70', $this->skin->cssfiles ) ) { ?><!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
250 - <?php } ?><!--[if lt IE 7]><?php if( in_array( 'IE', $this->skin->cssfiles ) ) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
251 - <?php } ?><meta http-equiv="imagetoolbar" content="no" /><![endif]-->
252241
253242 <?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
254243
@@ -368,6 +357,17 @@
369358 <?php $this->html('headlinks') ?>
370359 <title><?php $this->text('pagetitle') ?></title>
371360
 361+ <style type="text/css" media="screen, projection">/*<![CDATA[*/
 362+ @import "<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
 363+ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
 364+ /*]]>*/</style>
 365+ <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('printcss') ?>?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
 366+ <?php if( in_array( 'IE50', $this->skin->cssfiles ) ) { ?><!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
 367+ <?php } if( in_array( 'IE55', $this->skin->cssfiles ) ) { ?><!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
 368+ <?php } if( in_array( 'IE60', $this->skin->cssfiles ) ) { ?><!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
 369+ <?php } if( in_array( 'IE70', $this->skin->cssfiles ) ) { ?><!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
 370+ <?php } ?><!--[if lt IE 7]><?php if( in_array( 'IE', $this->skin->cssfiles ) ) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
 371+ <?php } ?><meta http-equiv="imagetoolbar" content="no" /><![endif]-->
372372 <?php
373373 $this->executeHeadScripts();
374374 ?>
Index: branches/daniel/playground/skins/Modern.php
@@ -10,6 +10,9 @@
1111 if( !defined( 'MEDIAWIKI' ) )
1212 die( -1 );
1313
 14+/** */
 15+require_once( dirname(__FILE__) . '/MonoBook.php' );
 16+
1417 /**
1518 * Inherit main code from SkinTemplate, set the CSS and template filter.
1619 * @todo document
@@ -37,7 +40,56 @@
3841 * @todo document
3942 * @ingroup Skins
4043 */
41 -class ModernTemplate extends QuickTemplate {
 44+class ModernTemplate extends MonoBookTemplate {
 45+
 46+ function executeSidebarPortlets() {
 47+ $logo = '<a style="background-image: url(' . htmlspecialchars( $this->data['logopath'] ) . ');" ' .
 48+ 'href="' . htmlspecialchars($this->data['nav_urls']['mainpage']['href']).'" ' .
 49+ $this->skin->tooltipAndAccesskey('n-mainpage') . '></a>';
 50+
 51+ $hints = array( 'portletClass' => 'generated-sidebar portlet' );
 52+
 53+ foreach ($this->data['sidebar'] as $bar => $cont) {
 54+ $this->executePortlet( $bar, $cont, $hints );
 55+ }
 56+
 57+ $this->executePortlet( 'search', $this->skin,
 58+ array( 'noTitle' => true, 'noBody' => true, #XXX: title and body are a bit special. This is somewhat nasty.
 59+ 'contentGenerator' => array( &$this, 'executeSearchForm' ) ) );
 60+
 61+ $this->executePortlet( 'tb',
 62+ $this->data['toolbox_urls'],
 63+ array( 'titleMessage' => 'toolbox',
 64+ 'idPrefix' => 't-',
 65+ 'endOfListHooks' => array( 'MonoBookTemplateToolboxEnd', 'SkinTemplateToolboxEnd' ) ) );
 66+
 67+ $this->executePortlet( 'lang',
 68+ $this->data['language_urls'],
 69+ array( 'titleMessage' => 'otherlanguages' ) );
 70+ }
 71+
 72+
 73+ function executeFooter() { /////////////////////////////////////////////////////////////////////////////////////////////////////////
 74+ // Generate additional footer links
 75+ ?>
 76+ <ul id="f-list">
 77+ <?php
 78+ $footer = wfMsg( 'footertext' );
 79+ if ( !wfEmptyMsg('footertext', $footer) ) {
 80+ echo $footer;
 81+ }
 82+ else {
 83+ foreach( $this->data['footer_links'] as $lnk ) {
 84+ ?> <li id="<?php echo $lnk['id']; ?>"><?php echo $lnk['html']; ?></li>
 85+ <?php
 86+ }
 87+ }
 88+ ?>
 89+ </ul>
 90+ <?php echo $this->html("poweredbyico"); ?>
 91+ <?php
 92+ }
 93+
4294 /**
4395 * Template filter callback for Modern skin.
4496 * Takes an associative array of data set from a SkinTemplate-based
@@ -71,27 +123,9 @@
72124 <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/print.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
73125 <!--[if lt IE 7]><meta http-equiv="imagetoolbar" content="no" /><![endif]-->
74126
75 - <?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
76 -
77 - <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
78 - <!-- Head Scripts -->
79 -<?php $this->html('headscripts') ?>
80 -<?php if($this->data['jsvarurl' ]) { ?>
81 - <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"><!-- site js --></script>
82 -<?php } ?>
83 -<?php if($this->data['pagecss' ]) { ?>
84 - <style type="text/css"><?php $this->html('pagecss' ) ?></style>
85 -<?php }
86 - if($this->data['usercss' ]) { ?>
87 - <style type="text/css"><?php $this->html('usercss' ) ?></style>
88 -<?php }
89 - if($this->data['userjs' ]) { ?>
90 - <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
91 -<?php }
92 - if($this->data['userjsprev']) { ?>
93 - <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
94 -<?php }
95 - if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
 127+ <?php
 128+ $this->executeHeadScripts();
 129+ ?>
96130 </head>
97131 <body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
98132 <?php if($this->data['body_onload' ]) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
@@ -105,19 +139,12 @@
106140 <div id="mw_main">
107141 <div id="mw_contentwrapper">
108142 <!-- navigation portlet -->
109 - <div id="p-cactions" class="portlet">
110 - <h5><?php $this->msg('views') ?></h5>
111 - <div class="pBody">
112 - <ul>
113 - <?php foreach($this->data['content_actions'] as $key => $tab) { ?>
114 - <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
115 - if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }
116 - ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php
117 - echo htmlspecialchars($tab['text']) ?></a></li>
118 - <?php } ?>
119 - </ul>
120 - </div>
121 - </div>
 143+ <?php
 144+ $this->executePortlet( 'cactions',
 145+ $this->data['content_actions'],
 146+ array( 'titleMessage' => 'views',
 147+ 'idPrefix' => 'ca-') );
 148+ ?>
122149
123150 <!-- content -->
124151 <div id="mw_content">
@@ -148,154 +175,29 @@
149176 </div><!-- mw_contentwrapper -->
150177
151178 <div id="mw_portlets">
152 -
153 - <!-- other portlets -->
154 - <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
155 - <div class='generated-sidebar portlet' id='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php echo $skin->tooltip('p-'.$bar) ?>>
156 - <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
157 - <div class='pBody'>
158 -<?php if ( is_array( $cont ) ) { ?>
159 - <ul>
160 -<?php foreach($cont as $key => $val) { ?>
161 - <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
162 - if ( $val['active'] ) { ?> class="active" <?php }
163 - ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
164 -<?php } ?>
165 - </ul>
166 -<?php } else {
167 - # allow raw HTML block to be defined by extensions
168 - print $cont;
169 - }
170 -?>
171 - </div><!-- pBody -->
172 - </div><!-- portlet -->
173 - <?php } ?>
174 -
175 - <!-- search -->
176 - <div id="p-search" class="portlet">
177 - <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
178 - <div id="searchBody" class="pBody">
179 - <form action="<?php $this->text('searchaction') ?>" id="searchform"><div>
180 - <input id="searchInput" name="search" type="text"<?php echo $skin->tooltipAndAccesskey('search');
181 - if( isset( $this->data['search'] ) ) {
182 - ?> value="<?php $this->text('search') ?>"<?php } ?> />
183 - <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-go' ); ?> />&nbsp;
184 - <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
185 - </div></form>
186 - </div><!-- pBody -->
187 - </div><!-- portlet -->
188 -
189 - <!-- toolbox -->
190 - <div class="portlet" id="p-tb">
191 - <h5><?php $this->msg('toolbox') ?></h5>
192 - <div class="pBody">
193 - <ul>
194 -<?php
195 - if($this->data['notspecialpage']) { ?>
196 - <li id="t-whatlinkshere"><a href="<?php
197 - echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
198 - ?>"<?php echo $skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
199 -<?php
200 - if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
201 - <li id="t-recentchangeslinked"><a href="<?php
202 - echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
203 - ?>"<?php echo $skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked') ?></a></li>
204 -<?php }
205 - }
206 - if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
207 - <li id="t-trackbacklink"><a href="<?php
208 - echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
209 - ?>"<?php echo $skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li>
210 -<?php }
211 - if($this->data['feeds']) { ?>
212 - <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
213 - ?><span id="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php
214 - echo htmlspecialchars($feed['href']) ?>"<?php echo $skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;</span>
215 - <?php } ?></li><?php
216 - }
217 -
218 - foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
219 -
220 - if($this->data['nav_urls'][$special]) {
221 - ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
222 - ?>"<?php echo $skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li>
223 -<?php }
224 - }
225 -
226 - if(!empty($this->data['nav_urls']['print']['href'])) { ?>
227 - <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
228 - ?>"<?php echo $skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
229 - }
230 -
231 - if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
232 - <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
233 - ?>"<?php echo $skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php
234 - } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
235 - <li id="t-ispermalink"<?php echo $skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
236 - }
237 -
238 - wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
239 -?> </ul>
240 - </div><!-- pBody -->
241 - </div><!-- portlet -->
242 -
243 - <!-- languages -->
244 -<?php
245 - if( $this->data['language_urls'] ) { ?>
246 - <div id="p-lang" class="portlet">
247 - <h5><?php $this->msg('otherlanguages') ?></h5>
248 - <div class="pBody">
249 - <ul>
250 -<?php foreach($this->data['language_urls'] as $langlink) { ?>
251 - <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
252 - ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li>
253 -<?php } ?>
254 - </ul>
255 - </div><!-- pBody -->
256 - </div><!-- portlet -->
257 -<?php } ?>
258 -
 179+ <?php
 180+ $this->executeSidebarPortlets();
 181+ ?>
259182 </div><!-- mw_portlets -->
260183
261 -
262184 </div><!-- main -->
263185
264186 <div class="mw_clear"></div>
265187
266188 <!-- personal portlet -->
267 - <div class="portlet" id="p-personal">
268 - <h5><?php $this->msg('personaltools') ?></h5>
269 - <div class="pBody">
270 - <ul>
271 -<?php foreach($this->data['personal_urls'] as $key => $item) { ?>
272 - <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php
273 - if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
274 - echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
275 - if(!empty($item['class'])) { ?> class="<?php
276 - echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
277 - echo htmlspecialchars($item['text']) ?></a></li>
278 -<?php } ?>
279 - </ul>
280 - </div>
281 - </div>
 189+ <?php
 190+ $this->executePortlet( 'personal',
 191+ $this->data['personal_urls'],
 192+ array( 'titleMessage' => 'personaltools',
 193+ 'idPrefix' => 'pt-',
 194+ 'useClassForLinks' => true ) );
 195+ ?>
282196
283 -
284197 <!-- footer -->
285198 <div id="footer">
286 - <ul id="f-list">
287 -<?php
288 - $footerlinks = array(
289 - 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
290 - 'privacy', 'about', 'disclaimer', 'tagline',
291 - );
292 - foreach( $footerlinks as $aLink ) {
293 - if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
294 -?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
295 -<?php }
296 - }
297 -?>
298 - </ul>
299 - <?php echo $this->html("poweredbyico"); ?>
 199+ <?php
 200+ $this->executeFooter();
 201+ ?>
300202 </div>
301203
302204 <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>

Status & tagging log