* Remove legacy PHPTal code, hasn't been maintained in ages.
[lhc/web/wiklou.git] / skins / disabled / HTMLDump.php
1 <?php
2
3 /**
4 * Default skin for HTML dumps, based on MonoBook.php
5 */
6
7 if( !defined( 'MEDIAWIKI' ) )
8 die( -1 );
9
10 /** */
11 require_once( 'includes/SkinTemplate.php' );
12
13 /**
14 * Inherit main code from SkinTemplate, set the CSS and template filter.
15 * @todo document
16 * @package MediaWiki
17 * @subpackage Skins
18 */
19 class SkinHTMLDump extends SkinTemplate {
20 /** Using monobook. */
21 function initPage( &$out ) {
22 SkinTemplate::initPage( $out );
23 $this->template = 'HTMLDumpTemplate';
24 }
25
26 function buildSidebar() {
27 $sections = parent::buildSidebar();
28 $badMessages = array( 'recentchanges-url', 'randompage-url' );
29 $badUrls = array();
30 foreach ( $badMessages as $msg ) {
31 $badUrls[] = $this->makeInternalOrExternalUrl( wfMsgForContent( $msg ) );
32 }
33
34 foreach ( $sections as $heading => $section ) {
35 foreach ( $section as $index => $link ) {
36 if ( in_array( $link['href'], $badUrls ) ) {
37 unset( $sections[$heading][$index] );
38 }
39 }
40 }
41 return $sections;
42 }
43
44 function buildContentActionUrls() {
45 global $wgHTMLDump;
46
47 $content_actions = array();
48 $nskey = $this->getNameSpaceKey();
49 $content_actions[$nskey] = $this->tabAction(
50 $this->mTitle->getSubjectPage(),
51 $nskey,
52 !$this->mTitle->isTalkPage() );
53
54 $content_actions['talk'] = $this->tabAction(
55 $this->mTitle->getTalkPage(),
56 'talk',
57 $this->mTitle->isTalkPage(),
58 '',
59 true);
60
61 if ( isset( $wgHTMLDump ) ) {
62 $content_actions['current'] = array(
63 'text' => wfMsg( 'currentrev' ),
64 'href' => str_replace( '$1', wfUrlencode( $this->mTitle->getPrefixedDBkey() ),
65 $wgHTMLDump->oldArticlePath ),
66 'class' => false
67 );
68 }
69 return $content_actions;
70 }
71
72 function makeBrokenLinkObj( &$nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
73 if ( !isset( $nt ) ) {
74 return "<!-- ERROR -->{$prefix}{$text}{$trail}";
75 }
76
77 if ( $nt->getNamespace() == NS_CATEGORY ) {
78 return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
79 }
80
81 if ( $text == '' ) {
82 $text = $nt->getPrefixedText();
83 }
84 return $prefix . $text . $trail;
85 }
86 }
87
88 /**
89 * @todo document
90 * @package MediaWiki
91 * @subpackage Skins
92 */
93 class HTMLDumpTemplate extends QuickTemplate {
94 /**
95 * Template filter callback for MonoBook skin.
96 * Takes an associative array of data set from a SkinTemplate-based
97 * class, and a wrapper for MediaWiki's localization database, and
98 * outputs a formatted page.
99 *
100 * @access private
101 */
102 function execute() {
103 wfSuppressWarnings();
104 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
105 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
106 <head>
107 <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
108 <?php $this->html('headlinks') ?>
109 <title><?php $this->text('pagetitle') ?></title>
110 <style type="text/css">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/htmldump/main.css"; /*]]>*/</style>
111 <link rel="stylesheet" type="text/css" media="print" href="<?php $this->text('stylepath') ?>/common/commonPrint.css" />
112 <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css";</style><![endif]-->
113 <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css";</style><![endif]-->
114 <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css";</style><![endif]-->
115 <!--[if IE]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
116 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
117 <?php if($this->data['jsvarurl' ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"></script><?php } ?>
118 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js"></script>
119 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/htmldump/md5.js"></script>
120 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/htmldump/utf8.js"></script>
121 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/htmldump/lookup.js"></script>
122 <?php if($this->data['pagecss' ]) { ?><style type="text/css"><?php $this->html('pagecss' ) ?></style><?php } ?>
123 <?php if($this->data['usercss' ]) { ?><style type="text/css"><?php $this->html('usercss' ) ?></style><?php } ?>
124 <?php if($this->data['userjs' ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script><?php } ?>
125 <?php if($this->data['userjsprev']) { ?><script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script><?php } ?>
126 </head>
127 <body
128 <?php if($this->data['nsclass' ]) { ?>class="<?php $this->text('nsclass') ?>"<?php } ?>>
129 <div id="globalWrapper">
130 <div id="column-content">
131 <div id="content">
132 <a name="top" id="contentTop"></a>
133 <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
134 <h1 class="firstHeading"><?php $this->text('title') ?></h1>
135 <div id="bodyContent">
136 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
137 <div id="contentSub"><?php $this->html('subtitle') ?></div>
138 <?php if($this->data['undelete']) { ?><div id="contentSub"><?php $this->html('undelete') ?></div><?php } ?>
139 <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk') ?></div><?php } ?>
140 <!-- start content -->
141 <?php $this->html('bodytext') ?>
142 <?php if($this->data['catlinks']) { ?><div id="catlinks"><?php $this->html('catlinks') ?></div><?php } ?>
143 <!-- end content -->
144 <div class="visualClear"></div>
145 </div>
146 </div>
147 </div>
148 <div id="column-one">
149 <div id="p-cactions" class="portlet">
150 <h5>Views</h5>
151 <ul>
152 <?php foreach($this->data['content_actions'] as $key => $action) {
153 ?><li id="ca-<?php echo htmlspecialchars($key) ?>"
154 <?php if($action['class']) { ?>class="<?php echo htmlspecialchars($action['class']) ?>"<?php } ?>
155 ><a href="<?php echo htmlspecialchars($action['href']) ?>"><?php
156 echo htmlspecialchars($action['text']) ?></a></li><?php
157 } ?>
158 </ul>
159 </div>
160 <div class="portlet" id="p-logo">
161 <a style="background-image: url(<?php $this->text('logopath') ?>);"
162 href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
163 title="<?php $this->msg('mainpage') ?>"></a>
164 </div>
165 <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
166 <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
167 <div class='portlet' id='p-<?php echo htmlspecialchars($bar) ?>'>
168 <h5><?php $this->msg( $bar ) ?></h5>
169 <div class='pBody'>
170 <ul>
171 <?php foreach($cont as $key => $val) { ?>
172 <li id="<?php echo htmlspecialchars($val['id']) ?>"><a href="<?php echo htmlspecialchars($val['href']) ?>"><?php echo htmlspecialchars($val['text'])?></a></li>
173 <?php } ?>
174 </ul>
175 </div>
176 </div>
177 <?php } ?>
178 <div id="p-search" class="portlet">
179 <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
180 <div class="pBody">
181 <form action="javascript:goToStatic(3)" id="searchform"><div>
182 <input id="searchInput" name="search" type="text"
183 <?php if($this->haveMsg('accesskey-search')) {
184 ?>accesskey="<?php $this->msg('accesskey-search') ?>"<?php }
185 if( isset( $this->data['search'] ) ) {
186 ?> value="<?php $this->text('search') ?>"<?php } ?> />
187 <input type='submit' name="go" class="searchButton" id="searchGoButton"
188 value="<?php $this->msg('go') ?>" />
189 </div></form>
190 </div>
191 </div>
192 <?php if( $this->data['language_urls'] ) { ?><div id="p-lang" class="portlet">
193 <h5><?php $this->msg('otherlanguages') ?></h5>
194 <div class="pBody">
195 <ul>
196 <?php foreach($this->data['language_urls'] as $langlink) { ?>
197 <li>
198 <a href="<?php echo htmlspecialchars($langlink['href'])
199 ?>"><?php echo $langlink['text'] ?></a>
200 </li>
201 <?php } ?>
202 </ul>
203 </div>
204 </div>
205 <?php } ?>
206 </div><!-- end of the left (by default at least) column -->
207 <div class="visualClear"></div>
208 <div id="footer">
209 <?php if($this->data['poweredbyico']) { ?><div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div><?php } ?>
210 <?php if($this->data['copyrightico']) { ?><div id="f-copyrightico"><?php $this->html('copyrightico') ?></div><?php } ?>
211 <ul id="f-list">
212 <?php if($this->data['lastmod' ]) { ?><li id="f-lastmod"><?php $this->html('lastmod') ?></li><?php } ?>
213 <?php if($this->data['numberofwatchingusers' ]) { ?><li id="f-numberofwatchingusers"><?php $this->html('numberofwatchingusers') ?></li><?php } ?>
214 <?php if($this->data['credits' ]) { ?><li id="f-credits"><?php $this->html('credits') ?></li><?php } ?>
215 <?php if($this->data['copyright' ]) { ?><li id="f-copyright"><?php $this->html('copyright') ?></li><?php } ?>
216 <?php if($this->data['about' ]) { ?><li id="f-about"><?php $this->html('about') ?></li><?php } ?>
217 <?php if($this->data['disclaimer']) { ?><li id="f-disclaimer"><?php $this->html('disclaimer') ?></li><?php } ?>
218 <?php if($this->data['tagline']) { ?><li id="f-tagline"><?php echo $this->data['tagline'] ?></li><?php } ?>
219 </ul>
220 </div>
221 </div>
222 </body>
223 </html>
224 <?php
225 wfRestoreWarnings();
226 }
227 }
228 ?>