-
Notifications
You must be signed in to change notification settings - Fork 0
/
TekheletTemplate.php
423 lines (385 loc) · 13.5 KB
/
TekheletTemplate.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
<?php
/**
* Tekhelet - The look of the Kisow Foundation Wiki.
* Matthew R. Kisow, D.Sc. <matthew.kisow@kisow.org>
* Copyright, Kisow Foundation, Inc. 2015-2018.
*
* The Tekhelet theme is based in part on the Tyrian theme by Alex Legler.
**/
class TekheletTemplate extends BaseTemplate {
function execute() {
wfSuppressWarnings();
$this->html( 'headelement' );
$this->header();
?>
<div class="container">
<div class="row">
<div class="col-md-12">
<div id="content" class="mw-body" role="main">
<a id="top"></a>
<?php if ( $this->data['sitenotice'] ) { ?>
<div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
<?php } ?>
<h1 id="firstHeading" class="first-header" lang="<?php $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode(); $this->text( 'pageLanguage' ); ?>">
<span dir="auto"><?php $this->html( 'title' ) ?></span>
</h1>
<div id="bodyContent" class="mw-body-content">
<div id="siteSub"><?php $this->msg( 'tagline' ) ?></div>
<div id="contentSub"<?php $this->html( 'userlangattributes' ) ?>>
<?php $this->html( 'subtitle' ) ?>
</div>
<?php if ( $this->data['undelete'] ) { ?>
<div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
<?php } ?>
<?php if ( $this->data['newtalk'] ) { ?>
<div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
<?php } ?>
<div id="jump-to-nav" class="mw-jump">
<?php $this->msg( 'jumpto' ) ?>
<a href="#column-one"><?php $this->msg( 'jumptonavigation' ) ?></a><?php $this->msg( 'comma-separator' ) ?>
<a href="#searchInput"><?php $this->msg( 'jumptosearch' ) ?></a>
</div>
<!-- start content -->
<?php $this->html( 'bodytext' ) ?>
<?php if ( $this->data['catlinks'] ) { ?>
<?php $this->html( 'catlinks' ); ?>
<?php } ?>
<!-- end content -->
<?php if ( $this->data['dataAfterContent'] ) {
$this->html( 'dataAfterContent' );
} ?>
</div>
</div>
</div>
</div>
</div>
<?php $this->footer(); ?>
<script>
window.RLQ = window.RLQ || []; window.RLQ.push( function () {
$.getScript("https://assets.kisow.org/tekhelet/bootstrap.min.js");
} );
</script>
<?php
$this->printTrail();
echo Html::closeElement( 'body' );
echo Html::closeElement( 'html' );
wfRestoreWarnings();
} // end of execute() method
/*************************************************************************************************/
function header() {
?>
<div class="mw-jump sr-only">
<?php $this->msg( 'jumpto' ) ?>
<a href="#top">content</a>
</div>
<header>
<div class="site-title">
<div class="container">
<div class="row">
<div class="site-title-buttons">
<div class="btn-group btn-group-sm">
<div class="btn-group btn-group-sm">
<a class="btn kisow-org-sites dropdown-toggle" data-toggle="dropdown" data-target="#" href="#">
<span class="fa fa-fw fa-map-o"></span> <span class="hidden-xs">kisow.org sites</span> <span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right">
<li><a href="https://www.kisow.org/" title="Main Foundation Website"><span class="fa fa-home fa-fw"></span> kisow.org</a></li>
<li><a href="https://wiki.kisow.org/" title="Find and contribute documentation"><span class="fa fa-file-text-o fa-fw"></span> Wiki</a></li>
<!-- <li class="divider"></li> -->
</ul>
</div>
</div>
</div>
<div class="logo">
<a href="/" title="Back to the homepage" class="site-logo"><object data="https://assets.kisow.org/tekhelet/site-logo.svg" type="image/svg+xml">
<img src="https://assets.kisow.org/tekhelet/site-logo.png" alt="Kisow Foundation Logo">
</object></a>
<span class="site-label">Wiki</span>
</div>
</div>
</div>
</div>
<nav class="tekhelet-navbar" role="navigation">
<div class="container">
<div class="row">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse navbar-main-collapse">
<ul class="nav navbar-nav">
<?php
$this->renderPortals( $this->data['sidebar'] );
?>
</ul>
<ul class="nav navbar-nav navbar-right hidden-xs">
<?php
$this->toolbox();
$this->personaltools();
?>
</ul>
</div>
</div>
</div>
</nav>
<?php $this->cactions(); ?>
</header>
<?php
}
function footer() {
$validFooterIcons = $this->getFooterIcons( "icononly" );
$validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links
?>
<footer>
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-offset-2 col-md-7">
<?php if ( count( $validFooterLinks ) > 0 ) { ?>
<div class="spacer"></div>
<ul id="f-list">
<?php foreach ( $validFooterLinks as $aLink ) { ?>
<?php if ($aLink === 'copyright') continue; ?>
<li id="<?php echo $aLink ?>"><?php $this->html( $aLink ) ?></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<div class="col-xs-12 col-md-3">
<!-- No questions or comments, the Wiki has enough information on how to contact us. -->
</div>
</div>
<div class="row">
<div class="col-xs-3 col-md-2">
<ul class="footerlinks three-icons">
<li><a href="https://twitter.com/kisow" title="@Kisow on Twitter"><span class="fa fa-twitter fa-fw"></span></a></li>
<li><a href="https://www.facebook.com/kisow.org" title="Kisow on Facebook"><span class="fa fa-facebook fa-fw"></span></a></li>
</ul>
</div>
<div class="col-xs-9 col-md-9">
<strong>© 2015–2018 Kisow Foundation, Inc.</strong><br />
<small>
The Kisow Foundation® is a registered trademark of the Kisow Foundation, Inc.
The contents of this document, unless otherwise expressly stated, are licensed under the
<a href="https://creativecommons.org/licenses/by-sa/3.0/" rel="license">CC-BY-SA-3.0</a> license.
The <a href="https://wiki.kisow.org/wiki/Foundation:Copyright">Kisow Foundation Name and Logo Usage Guidelines</a> apply.
</small>
</div>
</div>
</div>
</footer>
<?php
echo $footerEnd;
}
/**
* @param array $sidebar
**/
protected function renderPortals( $sidebar ) {
// These are already rendered elsewhere
$sidebar['SEARCH'] = false;
$sidebar['TOOLBOX'] = false;
$sidebar['LANGUAGES'] = false;
foreach ( $sidebar as $boxName => $content ) {
if ( $content === false ) {
continue;
}
$this->customBox( $boxName, $content );
}
}
function searchBox() {
?>
<form action="<?php $this->text( 'wgScript' ) ?>" id="searchform" class="navbar-form navbar-right" role="search">
<input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
<div class="input-group">
<?php echo $this->makeSearchInput( array( "id" => "searchInput", "class" => "form-control", "placeholder" => $this->getMsg( 'search' )->escaped() ) ); ?>
<div class="input-group-btn"><?php
echo $this->makeSearchButton(
"go",
array( "id" => "searchGoButton", "class" => "searchButton btn btn-default" )
);
echo $this->makeSearchButton(
"fulltext",
array( "id" => "mw-searchButton", "class" => "searchButton btn btn-default" )
);
?></div>
</div>
</form>
<?php
}
function cactions() {
$context_actions = array();
$primary_actions = array();
$secondary_actions = array();
foreach ( $this->data['content_actions'] as $key => $tab ) {
if ( isset($tab['primary']) && $tab['primary'] == '1' || $key == 'form_edit' ) {
if ( isset($tab['context']) ) {
$context_actions[$key] = $tab;
if ( strpos( $tab['class'], 'selected' ) !== false ) {
$context_actions[$key]['class'] .= ' active';
}
} else {
$primary_actions[$key] = $tab;
if ( strpos( $tab['class'], 'selected' ) !== false ) {
$primary_actions[$key]['class'] .= ' active';
}
}
} else {
$secondary_actions[$key] = $tab;
if ( strpos( $tab['class'], 'selected' ) !== false ) {
$secondary_actions[$key]['class'] .= ' active';
}
}
}
?>
<nav class="navbar navbar-grey navbar-stick" id="wiki-actions" role="navigation">
<div class="container"><div class="row">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#gw-toolbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="gw-toolbar">
<ul class="nav navbar-nav">
<?php
foreach ( $context_actions as $key => $tab ) {
echo $this->makeListItem( $key, $tab );
}
?>
</ul>
<?php
$this->searchBox();
?>
<ul class="nav navbar-nav navbar-right hidden-xs">
<?php
foreach ( $primary_actions as $key => $tab ) {
echo $this->makeListItem( $key, $tab );
}
?><li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">more <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<?php
foreach ( $secondary_actions as $key => $tab ) {
echo $this->makeListItem( $key, $tab );
}
?>
</ul>
</li>
</ul>
</div>
</div></div>
</nav>
<?php
}
/*************************************************************************************************/
function toolbox() {
?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-cog"></i> <?php $this->msg( 'toolbox' ) ?> <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<?php
foreach ( $this->getToolbox() as $key => $tbitem) {
echo $this->makeListItem( $key, $tbitem );
}
wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) );
?>
</ul>
</li>
<?php
}
/*************************************************************************************************/
function personaltools() {
$personal_tools = $this->getPersonalTools();
$notifications_message_tool = NULL;
$notifications_alert_tool = NULL;
?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="glyphicon glyphicon-user" aria-label="<?php $this->msg( 'personaltools' ) ?>"></span>
<?php
if (isset($personal_tools['userpage'])) {
echo $personal_tools['userpage']['links'][0]['text'];
} else {
$this->msg( 'listfiles_user' );
} ?>
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<?php
foreach ( $personal_tools as $key => $item ) {
if ($key === 'notifications-alert') {
$notifications_alert_tool = $item;
} else if ($key === 'notifications-message') {
$notifications_message_tool = $item;
} else {
echo $this->makeListItem( $key, $item );
}
}
?>
</ul>
</li>
<?php
if (!is_null($notifications_message_tool)) {
echo $this->makeListItem('notifications-message', $notifications_message_tool);
}
if (!is_null($notifications_alert_tool)) {
echo $this->makeListItem('notifications-alert', $notifications_alert_tool);
}
}
/*************************************************************************************************/
function languageBox() {
if ( $this->data['language_urls'] !== false ) {
?>
<div id="p-lang" class="portlet" role="navigation">
<h3<?php $this->html( 'userlangattributes' ) ?>><?php $this->msg( 'otherlanguages' ) ?></h3>
<div class="pBody">
<ul>
<?php foreach ( $this->data['language_urls'] as $key => $langlink ) { ?>
<?php echo $this->makeListItem( $key, $langlink ); ?>
<?php
}
?>
</ul>
<?php $this->renderAfterPortlet( 'lang' ); ?>
</div>
</div>
<?php
}
}
/*************************************************************************************************/
/**
* @param string $bar
* @param array|string $cont
**/
function customBox( $bar, $cont ) {
$msgObj = wfMessage( $bar );
if ( $bar !== 'navigation' ) { ?>
<li class="dropdown">
<a href="/wiki/Kisow_Wiki:Menu-<?php echo htmlspecialchars( $bar ) ?>" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $bar ); ?> <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<?php }
if ( is_array ( $cont ) ) {
foreach ( $cont as $key => $val ) {
if ( $val['text'] === '---' ) {
echo '<li role="presentation" class="divider"></li>';
} elseif ( substr( $val['text'], 0, 7 ) === 'header:' ) {
echo '<li role="presentation" class="dropdown-header">' . htmlspecialchars( substr( $val['text'], 7 ) ) . '</li>';
} else {
echo $this->makeListItem( $key, $val );
}
}
} else {
echo "<!-- This would have been a box, but it contains custom HTML which is not supported. -->";
}
if ( $bar !== 'navigation' ) { ?>
</ul>
</li>
<?php }
}
}