forked from OSAS/strapping-mediawiki
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Strapping.skin.php
761 lines (638 loc) · 29 KB
/
Strapping.skin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
<?php
/**
* Vector - Modern version of MonoBook with fresh look and many usability
* improvements.
*
* @todo document
* @file
* @ingroup Skins
*/
if( !defined( 'MEDIAWIKI' ) ) {
die( -1 );
}
/**
* SkinTemplate class for Vector skin
* @ingroup Skins
*/
class SkinStrapping extends SkinTemplate {
var $skinname = 'strapping', $stylename = 'strapping',
$template = 'StrappingTemplate', $useHeadElement = true;
/**
* Initializes output page and sets up skin-specific parameters
* @param $out OutputPage object to initialize
*/
public function initPage( OutputPage $out ) {
global $wgLocalStylePath;
parent::initPage( $out );
// Append CSS which includes IE only behavior fixes for hover support -
// this is better than including this in a CSS fille since it doesn't
// wait for the CSS file to load before fetching the HTC file.
$min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '' : '.min';
$out->addHeadItem( 'csshover',
'<!--[if lt IE 7]><style type="text/css">body{behavior:url("' .
htmlspecialchars( $wgLocalStylePath ) .
"/{$this->stylename}/csshover{$min}.htc\")}</style><![endif]-->"
);
$out->addHeadItem('responsive', '<meta name="viewport" content="width=device-width, initial-scale=1.0">');
$out->addModuleScripts( 'skins.strapping' );
}
/**
* Load skin and user CSS files in the correct order
* fixes bug 22916
* @param $out OutputPage object
*/
function setupSkinUserCss( OutputPage $out ){
global $wgResourceModules;
parent::setupSkinUserCss( $out );
// FIXME: This is the "proper" way to include CSS
// however, MediaWiki's ResourceLoader messes up media queries
// See: https://bugzilla.wikimedia.org/show_bug.cgi?id=38586
// &: http://stackoverflow.com/questions/11593312/do-media-queries-work-in-mediawiki
//
//$out->addModuleStyles( 'skins.strapping' );
// Instead, we're going to manually add each,
// so we can use media queries
foreach ( $wgResourceModules['skins.strapping']['styles'] as $cssfile => $cssvals ) {
if (isset($cssvals)) {
$out->addStyle( $cssfile, $cssvals['media'] );
} else {
$out->addStyle( $cssfile );
}
}
}
}
/**
* QuickTemplate class for Vector skin
* @ingroup Skins
*/
class StrappingTemplate extends BaseTemplate {
/* Functions */
/**
* Outputs the entire contents of the (X)HTML page
*/
public function execute() {
global $wgGroupPermissions;
global $wgVectorUseIconWatch;
global $wgSearchPlacement;
global $wgStrappingSkinLogoLocation;
global $wgStrappingSkinLoginLocation;
global $wgStrappingSkinAnonNavbar;
global $wgStrappingSkinUseStandardLayout;
if (!$wgSearchPlacement) {
$wgSearchPlacement['header'] = true;
$wgSearchPlacement['nav'] = false;
$wgSearchPlacement['footer'] = false;
}
// Build additional attributes for navigation urls
$nav = $this->data['content_navigation'];
if ( $wgVectorUseIconWatch ) {
$mode = $this->getSkin()->getUser()->isWatched($this->getSkin()->getTitle()) ? 'unwatch' : 'watch';
if ( isset( $nav['actions'][$mode] ) ) {
$nav['views'][$mode] = $nav['actions'][$mode];
$nav['views'][$mode]['class'] = rtrim( 'icon ' . $nav['views'][$mode]['class'], ' ' );
$nav['views'][$mode]['primary'] = true;
unset( $nav['actions'][$mode] );
}
}
$xmlID = '';
foreach ( $nav as $section => $links ) {
foreach ( $links as $key => $link ) {
if ( $section == 'views' && !( isset( $link['primary'] ) && $link['primary'] ) ) {
$link['class'] = rtrim( 'collapsible ' . $link['class'], ' ' );
}
$xmlID = isset( $link['id'] ) ? $link['id'] : 'ca-' . $xmlID;
$nav[$section][$key]['attributes'] =
' id="' . Sanitizer::escapeId( $xmlID ) . '"';
if ( $link['class'] ) {
$nav[$section][$key]['attributes'] .=
' class="' . htmlspecialchars( $link['class'] ) . '"';
unset( $nav[$section][$key]['class'] );
}
if ( isset( $link['tooltiponly'] ) && $link['tooltiponly'] ) {
$nav[$section][$key]['key'] =
Linker::tooltip( $xmlID );
} else {
$nav[$section][$key]['key'] =
Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( $xmlID ) );
}
}
}
$this->data['namespace_urls'] = $nav['namespaces'];
$this->data['view_urls'] = $nav['views'];
$this->data['action_urls'] = $nav['actions'];
$this->data['variant_urls'] = $nav['variants'];
// Output HTML Page
$this->html( 'headelement' );
?>
<?php if ( $wgGroupPermissions['*']['edit'] || $wgStrappingSkinAnonNavbar || $this->data['loggedin'] ) { ?>
<div id="userbar" class="navbar navbar-static navbar-default">
<div class="container">
<div class="navbar-nav">
<?php
if ( $wgStrappingSkinLogoLocation == 'navbar' ) {
$this->renderLogo();
}
# Page header & menu
$this->renderNavigation( array( 'PAGE' ) );
# This content in other languages
if ( $this->data['language_urls'] ) {
$this->renderNavigation( array( 'LANGUAGES' ) );
}
# Edit button
$this->renderNavigation( array( 'EDIT' ) );
# Actions menu
$this->renderNavigation( array( 'ACTIONS' ) );
# Sidebar items to display in navbar
$this->renderNavigation( array( 'SIDEBARNAV' ) );
if ( !isset( $portals['TOOLBOX'] ) ) {
$this->renderNavigation( array( 'TOOLBOX' ) );
}
?>
</div>
<div class="nav navbar-nav navbar-right">
<?php
if ($wgSearchPlacement['header']) {
$this->renderNavigation( array( 'SEARCH' ) );
}
# Personal menu (at the right)
$this->renderNavigation( array( 'PERSONAL' ) );
?>
</div>
</div>
</div>
<?php } ?>
<div id="mw-page-base" class="noprint"></div>
<div id="mw-head-base" class="noprint"></div>
<!-- Header -->
<div id="page-header" class="container <?php echo $this->data['loggedin'] ? 'signed-in' : 'signed-out'; ?>"><div class="row vertical-align">
<?php
if ( $wgStrappingSkinLogoLocation == 'bodycontent' ) {
$this->renderLogo();
} ?>
<div class="col-sm-9 col-md-9">
<ul class="navigation nav navbar-nav nav-pills pull-right searchform-disabled">
<?php
$this->renderNavigation( array( 'SIDEBAR' ) );
if ($wgSearchPlacement['nav']) {
$this->renderNavigation( array( 'SEARCHNAV' ) );
}
?>
</ul>
</div>
</div></div>
<?php if ($this->data['loggedin']) {
$userStateClass = "user-loggedin";
} else {
$userStateClass = "user-loggedout";
} ?>
<?php if ($wgGroupPermissions['*']['edit'] || $this->data['loggedin']) {
$userStateClass += " editable";
} else {
$userStateClass += " not-editable";
} ?>
<!-- content -->
<section id="content" class="mw-body container <?php echo $userStateClass; ?>">
<div id="top"></div>
<div id="mw-js-message" style="display:none;"<?php $this->html( 'userlangattributes' ) ?>></div>
<?php if ( $this->data['sitenotice'] ): ?>
<!-- sitenotice -->
<div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
<!-- /sitenotice -->
<?php endif; ?>
<!-- bodyContent -->
<div id="bodyContent">
<?php if( $this->data['newtalk'] ): ?>
<!-- newtalk -->
<div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
<!-- /newtalk -->
<?php endif; ?>
<?php if ( $this->data['showjumplinks'] ): ?>
<!-- jumpto -->
<div id="jump-to-nav" class="mw-jump">
<?php $this->msg( 'jumpto' ) ?> <a href="#mw-head"><?php $this->msg( 'jumptonavigation' ) ?></a>,
<a href="#p-search"><?php $this->msg( 'jumptosearch' ) ?></a>
</div>
<!-- /jumpto -->
<?php endif; ?>
<!-- innerbodycontent -->
<?php # Peek into the body content of articles, to see if a custom layout is used
if ($wgStrappingSkinUseStandardLayout || preg_match("/<div.*class.*row.*>/i", $this->data['bodycontent']) && $this->data['articleid']) {
# If there's a custom layout, the H1 and layout is up to the page ?>
<div id="innerbodycontent" class="layout">
<h1 id="firstHeading" class="firstHeading page-header">
<span dir="auto"><?php $this->html( 'title' ) ?></span>
</h1>
<!-- subtitle -->
<div id="contentSub" <?php $this->html( 'userlangattributes' ) ?>><?php $this->html( 'subtitle' ) ?></div>
<!-- /subtitle -->
<?php if ( $this->data['undelete'] ): ?>
<!-- undelete -->
<div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
<!-- /undelete -->
<?php endif; ?>
<?php $this->html( 'bodycontent' ); ?>
</div>
<?php } else {
# If there's no custom layout, then we automagically add one ?>
<div id="innerbodycontent" class="row nolayout"><div class="col-md-10 col-sm-10">
<h1 id="firstHeading" class="firstHeading page-header">
<span dir="auto"><?php $this->html( 'title' ) ?></span>
</h1>
<!-- subtitle -->
<div id="contentSub" <?php $this->html( 'userlangattributes' ) ?>><?php $this->html( 'subtitle' ) ?></div>
<!-- /subtitle -->
<?php if ( $this->data['undelete'] ): ?>
<!-- undelete -->
<div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
<!-- /undelete -->
<?php endif; ?>
<?php $this->html( 'bodycontent' ); ?>
</div></div>
<?php } ?>
<!-- /innerbodycontent -->
<?php if ( $this->data['printfooter'] ): ?>
<!-- printfooter -->
<div class="printfooter">
<?php $this->html( 'printfooter' ); ?>
</div>
<!-- /printfooter -->
<?php endif; ?>
<?php if ( $this->data['catlinks'] ): ?>
<!-- catlinks -->
<?php $this->html( 'catlinks' ); ?>
<!-- /catlinks -->
<?php endif; ?>
<?php if ( $this->data['dataAfterContent'] ): ?>
<!-- dataAfterContent -->
<?php $this->html( 'dataAfterContent' ); ?>
<!-- /dataAfterContent -->
<?php endif; ?>
<div class="visualClear"></div>
<!-- debughtml -->
<?php $this->html( 'debughtml' ); ?>
<!-- /debughtml -->
</div>
<!-- /bodyContent -->
</section>
<!-- /content -->
<!-- footer -->
<?php
/* Support a custom footer, or use MediaWiki's default, if footer.php does not exist. */
$footerfile = dirname(__FILE__).'/footer.php';
if ( file_exists($footerfile) ):
?><div id="footer" class="footer container custom-footer"><?php
include( $footerfile );
?></div><?php
else:
?>
<div id="footer" class="footer container"<?php $this->html( 'userlangattributes' ) ?>>
<div class="row">
<?php
$footerLinks = $this->getFooterLinks();
if (is_array($footerLinks)) {
foreach($footerLinks as $category => $links ):
if ($category === 'info') { continue; } ?>
<ul id="footer-<?php echo $category ?>">
<?php foreach( $links as $link ): ?>
<li id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li>
<?php endforeach; ?>
<?php
if ($category === 'places') {
# Show sign in link, if not signed in
if ($wgStrappingSkinLoginLocation == 'footer' && !$this->data['loggedin']) {
$personalTemp = $this->getPersonalTools();
if (isset($personalTemp['login'])) {
$loginType = 'login';
} else {
$loginType = 'anonlogin';
}
?><li id="pt-login"><a href="<?php echo $personalTemp[$loginType]['links'][0]['href'] ?>"><?php echo $personalTemp[$loginType]['links'][0]['text']; ?></a></li><?php
}
# Show the search in footer to all
if ($wgSearchPlacement['footer']) {
echo '<li>';
$this->renderNavigation( array( 'SEARCHFOOTER' ) );
echo '</li>';
}
}
?>
</ul>
<?php
endforeach;
}
?>
<?php $footericons = $this->getFooterIcons("icononly");
if ( count( $footericons ) > 0 ): ?>
<ul id="footer-icons" class="noprint">
<?php foreach ( $footericons as $blockName => $footerIcons ): ?>
<li id="footer-<?php echo htmlspecialchars( $blockName ); ?>ico">
<?php foreach ( $footerIcons as $icon ): ?>
<?php echo $this->getSkin()->makeFooterIcon( $icon ); ?>
<?php endforeach; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
<!-- /footer -->
<?php endif; ?>
<?php $this->printTrail(); ?>
</body>
</html>
<?php
}
/**
* Render logo
*/
private function renderLogo() {
$mainPageLink = $this->data['nav_urls']['mainpage']['href'];
$toolTip = Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) );
?>
<ul class="col-sm-3 col-md-3 nav navbar-nav logo-container" role="navigation"><li id="p-logo"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>" <?php echo Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( 'p-logo' ) ) ?>><img src="<?php $this->text( 'logopath' ); ?>" alt="<?php $this->html('sitename'); ?>"></a><li></ul>
<?php
}
/**
* Render one or more navigations elements by name, automatically reveresed
* when UI is in RTL mode
*
* @param $elements array
*/
private function renderNavigation( $elements ) {
global $wgVectorUseSimpleSearch;
global $wgStrappingSkinLoginLocation;
global $wgStrappingSkinDisplaySidebarNavigation;
global $wgStrappingSkinSidebarItemsInNavbar;
// If only one element was given, wrap it in an array, allowing more
// flexible arguments
if ( !is_array( $elements ) ) {
$elements = array( $elements );
// If there's a series of elements, reverse them when in RTL mode
} elseif ( $this->data['rtl'] ) {
$elements = array_reverse( $elements );
}
// Render elements
foreach ( $elements as $name => $element ) {
echo "\n<!-- {$name} -->\n";
switch ( $element ) {
case 'EDIT':
if ( !array_key_exists('edit', $this->data['content_actions']) ) {
break;
}
$navTemp = $this->data['content_actions']['edit'];
if ($navTemp) { ?>
<div class="actions nav navbar-nav">
<a id="b-edit" href="<?php echo $navTemp['href']; ?>" class="btn btn-default navbar-btn"><i class="icon-edit"></i> <?php echo $navTemp['text']; ?></a>
</div>
<?php }
break;
case 'PAGE':
$theMsg = 'namespaces';
$theData = array_merge($this->data['namespace_urls'], $this->data['view_urls']);
?>
<div class="navbar-header">
<ul class="nav navbar-nav"><li class="dropdown">
<?php
foreach ( $theData as $link ) {
if ( array_key_exists( 'context', $link ) && $link['context'] == 'subject' ) {
?>
<a class="dropdown-toggle navbar-brand" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo htmlspecialchars( $link['text'] ); ?> <span class="caret"></span></a>
<?php } ?>
<?php } ?>
<ul class="dropdown-menu">
<?php
foreach ( $theData as $link ) {
# Skip a few redundant links
if (preg_match('/^ca-(view|edit)$/', $link['id'])) { continue; }
?><li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?> tabindex="-1"><?php echo htmlspecialchars( $link['text'] ) ?></a></li><?php
} ?>
</ul>
</li></ul>
</div> <?php
break;
case 'TOOLBOX':
$theMsg = 'toolbox';
$theData = array_reverse($this->getToolbox());
?>
<ul class="nav navbar-nav" role="navigation">
<li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
<a data-toggle="dropdown" class="dropdown-toggle" role="button"><?php $this->msg($theMsg) ?> <b class="caret"></b></a>
<ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
<?php
foreach( $theData as $key => $item ) {
if (preg_match('/specialpages|whatlinkshere/', $key)) {
echo '<li class="divider"></li>';
}
echo $this->makeListItem( $key, $item );
}
?>
</ul>
</li>
</ul>
<?php
break;
case 'VARIANTS':
$theMsg = 'variants';
$theData = $this->data['variant_urls'];
?>
<?php if (count($theData) > 0) { ?>
<ul class="nav" role="navigation">
<li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
<a data-toggle="dropdown" class="dropdown-toggle" role="button"><?php $this->msg($theMsg) ?> <b class="caret"></b></a>
<ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
<?php foreach ( $theData as $link ): ?>
<li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?> tabindex="-1"><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
<?php endforeach; ?>
</ul>
</li>
</ul>
<?php }
break;
case 'VIEWS':
$theMsg = 'views';
$theData = $this->data['view_urls'];
?>
<?php if (count($theData) > 0) { ?>
<ul class="nav" role="navigation">
<li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
<a data-toggle="dropdown" class="dropdown-toggle" role="button"><?php $this->msg($theMsg) ?> <b class="caret"></b></a>
<ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
<?php foreach ( $theData as $link ): ?>
<li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?> tabindex="-1"><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
<?php endforeach; ?>
</ul>
</li>
</ul>
<?php }
break;
case 'ACTIONS':
$theMsg = 'actions';
$theData = array_reverse($this->data['action_urls']);
if (count($theData) > 0) {
?><ul class="nav navbar-nav" role="navigation">
<li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
<a data-toggle="dropdown" class="dropdown-toggle" role="button"><?php echo $this->msg( 'actions' ); ?> <b class="caret"></b></a>
<ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
<?php foreach ( $theData as $link ):
if (preg_match('/MovePage/', $link['href'])) {
echo '<li class="divider"></li>';
}
?>
<li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?> tabindex="-1"><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
<?php endforeach; ?>
</ul>
</li>
</ul><?php
}
break;
case 'PERSONAL':
$theMsg = 'personaltools';
$theData = $this->getPersonalTools();
$theTitle = $this->data['username'];
$showPersonal = false;
foreach ( $theData as $key => $item ) {
if ( !preg_match('/(notifications|login|createaccount)/', $key) ) {
$showPersonal = true;
}
}
?>
<ul class="nav navbar-nav" role="navigation">
<li class="dropdown" id="p-notifications" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
<?php if ( array_key_exists('notifications', $theData) ) {
echo $this->makeListItem( 'notifications', $theData['notifications'] );
} ?>
</li>
<?php if ( $wgStrappingSkinLoginLocation == 'navbar' ): ?>
<li class="dropdown" id="p-createaccount" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
<?php if ( array_key_exists('createaccount', $theData) ) {
echo $this->makeListItem( 'createaccount', $theData['createaccount'] );
} ?>
</li>
<li class="dropdown" id="p-login" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
<?php if ( array_key_exists('login', $theData) ) {
echo $this->makeListItem( 'login', $theData['login'] );
} ?>
</li>
<?php endif; ?>
<?php
if ( $showPersonal ):
?>
<li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( !$showPersonal ) echo ' emptyPortlet'; ?>">
<a data-toggle="dropdown" class="dropdown-toggle" role="button">
<i class="icon-user"></i>
<?php echo $theTitle; ?> <b class="caret"></b></a>
<ul aria-labelledby="<?php echo $this->msg($theMsg); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
<?php foreach( $theData as $key => $item ) {
if (preg_match('/preferences|logout/', $key)) {
echo '<li class="divider"></li>';
} else if ( preg_match('/(notifications|login|createaccount)/', $key) ) {
continue;
}
echo $this->makeListItem( $key, $item );
} ?>
</ul>
</li>
<?php endif; ?>
</ul>
<?php
break;
case 'SEARCH':
?>
<form class="nav navbar-nav navbar-form" action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
<input id="searchInput" class="search-query form-control" type="search" accesskey="f" title="<?php $this->text('searchtitle'); ?>" placeholder="<?php $this->msg('search'); ?>" name="search" value="<?php echo htmlspecialchars ($this->data['search']); ?>" type="search">
<?php echo $this->makeSearchButton( 'fulltext', array( 'id' => 'mw-searchButton', 'class' => 'searchButton btn hidden' ) ); ?>
</form>
<?php
break;
case 'SEARCHNAV':
?>
<li>
<a id="n-Search" class="search-link"><i class="icon-search"></i>Search</a>
<form class="navbar-search" action="<?php $this->text( 'wgScript' ) ?>" id="nav-searchform">
<input id="nav-searchInput" class="search-query" type="search" accesskey="f" title="<?php $this->text('searchtitle'); ?>" placeholder="<?php $this->msg('search'); ?>" name="search" value="<?php echo htmlspecialchars ($this->data['search']); ?>">
<?php echo $this->makeSearchButton( 'fulltext', array( 'id' => 'mw-searchButton', 'class' => 'searchButton btn hidden' ) ); ?>
</form>
</li>
<?php
break;
case 'SEARCHFOOTER':
?>
<form class="" action="<?php $this->text( 'wgScript' ) ?>" id="footer-search">
<i class="icon-search"></i><b class="border"></b><input id="footer-searchInput" class="search-query" type="search" accesskey="f" title="<?php $this->text('searchtitle'); ?>" placeholder="<?php $this->msg('search'); ?>" name="search" value="<?php echo htmlspecialchars ($this->data['search']); ?>">
<?php echo $this->makeSearchButton( 'fulltext', array( 'id' => 'mw-searchButton', 'class' => 'searchButton btn hidden' ) ); ?>
</form>
<?php
break;
case 'SIDEBARNAV':
foreach ( $this->data['sidebar'] as $name => $content ) {
if ( !$content ) {
continue;
}
if ( !in_array( $name, $wgStrappingSkinSidebarItemsInNavbar ) ) {
continue;
}
$msgObj = wfMessage( $name );
$name = htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $name ); ?>
<ul class="nav navbar-nav" role="navigation">
<li class="dropdown" id="p-<?php echo $name; ?>" class="vectorMenu">
<a data-toggle="dropdown" class="dropdown-toggle" role="menu"><?php echo htmlspecialchars( $name ); ?> <b class="caret"></b></a>
<ul aria-labelledby="<?php echo htmlspecialchars( $name ); ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>><?php
# This is a rather hacky way to name the nav.
# (There are probably bugs here...)
foreach( $content as $key => $val ) {
$navClasses = '';
if (array_key_exists('view', $this->data['content_navigation']['views']) && $this->data['content_navigation']['views']['view']['href'] == $val['href']) {
$navClasses = 'active';
}?>
<li class="<?php echo $navClasses ?>"><?php echo $this->makeLink($key, $val); ?></li><?php
}
}?>
</ul></li></ul><?php
break;
case 'SIDEBAR':
foreach ( $this->data['sidebar'] as $name => $content ) {
if ( !isset($content) ) {
continue;
}
if ( in_array( $name, $wgStrappingSkinSidebarItemsInNavbar ) ) {
continue;
}
$msgObj = wfMessage( $name );
$name = htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $name );
if ( $wgStrappingSkinDisplaySidebarNavigation ) { ?>
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" role="button"><?php echo htmlspecialchars( $name ); ?><b class="caret"></b></a>
<ul aria-labelledby="<?php echo htmlspecialchars( $name ); ?>" role="menu" class="dropdown-menu"><?php
}
# This is a rather hacky way to name the nav.
# (There are probably bugs here...)
foreach( $content as $key => $val ) {
$navClasses = '';
if (array_key_exists('view', $this->data['content_navigation']['views']) && $this->data['content_navigation']['views']['view']['href'] == $val['href']) {
$navClasses = 'active';
}?>
<li class="<?php echo $navClasses ?>"><?php echo $this->makeLink($key, $val); ?></li><?php
}
if ( $wgStrappingSkinDisplaySidebarNavigation ) {?> </ul> </li><?php
} }
break;
case 'LANGUAGES':
$theMsg = 'otherlanguages';
$msgObj = wfMessage( $theMsg );
$name = htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $theMsg );
$theData = $this->data['language_urls']; ?>
<ul class="nav navbar-nav" role="navigation">
<li class="dropdown" id="p-<?php echo $theMsg; ?>" class="vectorMenu<?php if ( count($theData) == 0 ) echo ' emptyPortlet'; ?>">
<a data-toggle="dropdown" class="dropdown-toggle" role="menu"><?php echo $name ?> <b class="caret"></b></a>
<ul aria-labelledby="<?php echo $name; ?>" role="menu" class="dropdown-menu" <?php $this->html( 'userlangattributes' ) ?>>
<?php foreach( $theData as $key => $val ) { ?>
<li><?php echo $this->makeLink($key, $val); ?></li><?php
}?>
</ul> </li>
</ul><?php
break;
}
echo "\n<!-- /{$name} -->\n";
}
}
}