5f739a379d6f34bf0063b4530d558c6d3e202306
[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[] = self::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 # Determine if the category has any articles in it
79 $dbr =& wfGetDB( DB_SLAVE );
80 $hasMembers = $dbr->selectField( 'categorylinks', '1',
81 array( 'cl_to' => $nt->getDBkey() ), __METHOD__ );
82 if ( $hasMembers ) {
83 return $this->makeKnownLinkObj( $nt, $text, $query, $trail, $prefix );
84 }
85 }
86
87 if ( $text == '' ) {
88 $text = $nt->getPrefixedText();
89 }
90 return $prefix . $text . $trail;
91 }
92 }
93
94 /**
95 * @todo document
96 * @package MediaWiki
97 * @subpackage Skins
98 */
99 class HTMLDumpTemplate extends QuickTemplate {
100 /**
101 * Template filter callback for MonoBook skin.
102 * Takes an associative array of data set from a SkinTemplate-based
103 * class, and a wrapper for MediaWiki's localization database, and
104 * outputs a formatted page.
105 *
106 * @access private
107 */
108 function execute() {
109 wfSuppressWarnings();
110 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
111 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
112 <head>
113 <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
114 <?php $this->html('headlinks') ?>
115 <title><?php $this->text('pagetitle') ?></title>
116 <style type="text/css">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/htmldump/main.css"; /*]]>*/</style>
117 <link rel="stylesheet" type="text/css" media="print" href="<?php $this->text('stylepath') ?>/common/commonPrint.css" />
118 <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css";</style><![endif]-->
119 <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css";</style><![endif]-->
120 <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css";</style><![endif]-->
121 <!--[if IE]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
122 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
123 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js"></script>
124 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/htmldump/md5.js"></script>
125 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/htmldump/utf8.js"></script>
126 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/htmldump/lookup.js"></script>
127 <?php if($this->data['jsvarurl' ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"></script><?php } ?>
128 <?php if($this->data['pagecss' ]) { ?><style type="text/css"><?php $this->html('pagecss' ) ?></style><?php } ?>
129 <?php if($this->data['usercss' ]) { ?><style type="text/css"><?php $this->html('usercss' ) ?></style><?php } ?>
130 <?php if($this->data['userjs' ]) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script><?php } ?>
131 <?php if($this->data['userjsprev']) { ?><script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script><?php } ?>
132 </head>
133 <body
134 <?php if($this->data['nsclass' ]) { ?>class="<?php $this->text('nsclass') ?>"<?php } ?>>
135 <div id="globalWrapper">
136 <div id="column-content">
137 <div id="content">
138 <a name="top" id="contentTop"></a>
139 <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
140 <h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
141 <div id="bodyContent">
142 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
143 <div id="contentSub"><?php $this->html('subtitle') ?></div>
144 <?php if($this->data['undelete']) { ?><div id="contentSub"><?php $this->html('undelete') ?></div><?php } ?>
145 <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk') ?></div><?php } ?>
146 <!-- start content -->
147 <?php $this->html('bodytext') ?>
148 <?php if($this->data['catlinks']) { ?><div id="catlinks"><?php $this->html('catlinks') ?></div><?php } ?>
149 <!-- end content -->
150 <div class="visualClear"></div>
151 </div>
152 </div>
153 </div>
154 <div id="column-one">
155 <div id="p-cactions" class="portlet">
156 <h5>Views</h5>
157 <ul>
158 <?php foreach($this->data['content_actions'] as $key => $action) {
159 ?><li id="ca-<?php echo htmlspecialchars($key) ?>"
160 <?php if($action['class']) { ?>class="<?php echo htmlspecialchars($action['class']) ?>"<?php } ?>
161 ><a href="<?php echo htmlspecialchars($action['href']) ?>"><?php
162 echo htmlspecialchars($action['text']) ?></a></li><?php
163 } ?>
164 </ul>
165 </div>
166 <div class="portlet" id="p-logo">
167 <a style="background-image: url(<?php $this->text('logopath') ?>);"
168 href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
169 title="<?php $this->msg('mainpage') ?>"></a>
170 </div>
171 <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
172 <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
173 <div class='portlet' id='p-<?php echo htmlspecialchars($bar) ?>'>
174 <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
175 <div class='pBody'>
176 <ul>
177 <?php foreach($cont as $key => $val) { ?>
178 <li id="<?php echo htmlspecialchars($val['id']) ?>"><a href="<?php echo htmlspecialchars($val['href']) ?>"><?php echo htmlspecialchars($val['text'])?></a></li>
179 <?php } ?>
180 </ul>
181 </div>
182 </div>
183 <?php } ?>
184 <div id="p-search" class="portlet">
185 <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
186 <div id="searchBody" class="pBody">
187 <form action="javascript:goToStatic(3)" id="searchform"><div>
188 <input id="searchInput" name="search" type="text"
189 <?php if($this->haveMsg('accesskey-search')) {
190 ?>accesskey="<?php $this->msg('accesskey-search') ?>"<?php }
191 if( isset( $this->data['search'] ) ) {
192 ?> value="<?php $this->text('search') ?>"<?php } ?> />
193 <input type='submit' name="go" class="searchButton" id="searchGoButton"
194 value="<?php $this->msg('go') ?>" />
195 </div></form>
196 </div>
197 </div>
198 <?php if( $this->data['language_urls'] ) { ?><div id="p-lang" class="portlet">
199 <h5><?php $this->msg('otherlanguages') ?></h5>
200 <div class="pBody">
201 <ul>
202 <?php foreach($this->data['language_urls'] as $langlink) { ?>
203 <li>
204 <a href="<?php echo htmlspecialchars($langlink['href'])
205 ?>"><?php echo $langlink['text'] ?></a>
206 </li>
207 <?php } ?>
208 </ul>
209 </div>
210 </div>
211 <?php } ?>
212 </div><!-- end of the left (by default at least) column -->
213 <div class="visualClear"></div>
214 <div id="footer">
215 <?php if($this->data['poweredbyico']) { ?><div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div><?php } ?>
216 <?php if($this->data['copyrightico']) { ?><div id="f-copyrightico"><?php $this->html('copyrightico') ?></div><?php } ?>
217 <ul id="f-list">
218 <?php if($this->data['lastmod' ]) { ?><li id="f-lastmod"><?php $this->html('lastmod') ?></li><?php } ?>
219 <?php if($this->data['numberofwatchingusers' ]) { ?><li id="f-numberofwatchingusers"><?php $this->html('numberofwatchingusers') ?></li><?php } ?>
220 <?php if($this->data['credits' ]) { ?><li id="f-credits"><?php $this->html('credits') ?></li><?php } ?>
221 <?php if($this->data['copyright' ]) { ?><li id="f-copyright"><?php $this->html('copyright') ?></li><?php } ?>
222 <?php if($this->data['about' ]) { ?><li id="f-about"><?php $this->html('about') ?></li><?php } ?>
223 <?php if($this->data['disclaimer']) { ?><li id="f-disclaimer"><?php $this->html('disclaimer') ?></li><?php } ?>
224 <?php if($this->data['tagline']) { ?><li id="f-tagline"><?php echo $this->data['tagline'] ?></li><?php } ?>
225 </ul>
226 </div>
227 </div>
228 </body>
229 </html>
230 <?php
231 wfRestoreWarnings();
232 }
233 }
234 ?>