aboutsummaryrefslogtreecommitdiff
blob: f198fccf4d1bcdc69c798999aed8d9f14ea1d0ac (plain)
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
<?php
/**
 * @ingroup Skins
 */
class TyrianTemplate 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 src="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/bootstrap.min.js"></script>
		<script src="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/retina.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">
							<a href="http://get.gentoo.org/" role="button" class="btn get-gentoo"><span class="fa fa-download"></span> <strong>Get Gentoo!</strong></a>
							<div class="btn-group btn-group-sm">
								<a class="btn gentoo-org-sites dropdown-toggle" data-toggle="dropdown" data-target="#" href="#more-gentoo">
									<span class="glyphicon glyphicon-globe"></span> gentoo.org sites <span class="caret"></span>
								</a>
								<ul class="dropdown-menu">
									<li><a href="http://www.gentoo.org/" title="Main Gentoo website"><span class="fa fa-home fa-fw"></span> gentoo.org</a></li>
									<li><a href="http://wiki.gentoo.org/" title="Find and contribute documentation"><span class="fa fa-file-text fa-fw"></span> Wiki</a></li>
									<li><a href="https://bugs.gentoo.org/" title="Report issues and find common issues"><span class="fa fa-bug fa-fw"></span> Bugs</a></li>
									<li><a href="http://forums.gentoo.org/" title="Discuss with the community"><span class="fa fa-comments-o fa-fw"></span> Forums</a></li>
									<li><a href="http://packages.gentoo.org/" title="Find software for your Gentoo"><span class="fa fa-hdd-o fa-fw"></span> Packages</a></li>
									<li class="divider"></li>
									<li><a href="http://overlays.gentoo.org/" title="Collaborate on maintaining packages"><span class="fa fa-code-fork fa-fw"></span> Overlays</a></li>
									<li><a href="http://planet.gentoo.org/" title="Find out what's going on in the developer community"><span class="fa fa-rss fa-fw"></span> Planet</a></li>
									<li><a href="http://archives.gentoo.org/" title="Read up on past discussions"><span class="fa fa-archive fa-fw"></span> Archives</a></li>
									<li><a href="http://sources.gentoo.org/" title="Browse our source code"><span class="fa fa-code fa-fw"></span> Sources</a></li>
									<li class="divider"></li>
									<li><a href="http://infra-status.gentoo.org/" title="Get updates on the services provided by Gentoo"><span class="fa fa-tasks fa-fw"></span> Infra Status</a></li>
								</ul>
							</div>
						</div>
					</div>
					<div class="logo">
						<img src="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/site-logo.png" data-at2x="https://1b9a50f4f9de4348cd9f-e703bc50ba0aa66772a874f8c7698be7.ssl.cf5.rackcdn.com/site-logo@2x.png" alt="Gentoo Linux Logo"/>
						<span class="site-label">Wiki</span>
					</div>
				</div>
			</div>
		</div>
		<nav class="tyrian-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="http://twitter.com/gentoo" title="@Gentoo on Twitter"><span class="fa fa-twitter fa-fw"></span></a></li>
						<li><a href="https://plus.google.com/+Gentoo" title="+Gentoo on Google+"><span class="fa fa-google-plus fa-fw"></span></a></li>
						<li><a href="https://www.facebook.com/gentoo.org" title="Gentoo on Facebook"><span class="fa fa-facebook fa-fw"></span></a></li>
					</ul>
				</div>
				<div class="col-xs-9 col-md-9">
					<strong>&copy; 2001&ndash;2015 Gentoo Foundation, Inc.</strong><br />
					<small>
						Gentoo is a trademark of the Gentoo Foundation, Inc.
						The contents of this document, unless otherwise expressly stated, are licensed under the
						<a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license">CC-BY-SA-3.0</a> license.
						The <a href="http://www.gentoo.org/main/en/name-logo.xml">Gentoo 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 ) {
			// TODO: handling form_edit separately here is a hack, no idea how it works in Vector.
			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">
		    <!-- Brand and toggle get grouped for better mobile display -->
		    <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>

		    <!-- Collect the nav links, forms, and other content for toggling -->
		    <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><!-- /.navbar-collapse -->
		  </div></div><!-- /.container-fluid -->
		</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() {
		?>
		<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 $this->msg( 'listfiles_user' ) ?>
				<span class="caret"></span>
			</a>
			<ul class="dropdown-menu" role="menu">
				<?php
					foreach ( $this->getPersonalTools() as $key => $item ) {
						echo $this->makeListItem( $key, $item );
					}
				?>
			</ul>
		</li>
	<?php
	}

	/*************************************************************************************************/
	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/Gentoo_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 }
	}
} // end of class