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