1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* FusionForge nouveau |
4
|
|
|
* |
5
|
|
|
* Translated from gwicke's previous TAL template version to remove |
6
|
|
|
* dependency on PHPTAL. |
7
|
|
|
* |
8
|
|
|
* @todo document |
9
|
|
|
* @file |
10
|
|
|
* @ingroup Skins |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
if( !defined( 'MEDIAWIKI' ) ) |
14
|
|
|
die( -1 ); |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Inherit main code from SkinTemplate, set the CSS and template filter. |
18
|
|
|
* @todo document |
19
|
|
|
* @ingroup Skins |
20
|
|
|
*/ |
21
|
|
|
class SkinTuleap extends SkinTemplate { |
22
|
|
|
|
23
|
|
|
CONST MEDIAWIKI_URL = '/\/plugins\/mediawiki\/wiki\/(.*)\/index.php\//'; |
24
|
|
|
|
25
|
|
|
/** Using fusionforge. */ |
26
|
|
|
var $skinname = 'tuleap', $stylename = 'tuleap', |
27
|
|
|
$template = 'TuleapTemplate', $useHeadElement = true; |
28
|
|
|
|
29
|
|
|
function setupTemplate( $classname, $repository = false, $cache_dir = false ) { |
30
|
|
|
$tc = new $classname(); |
31
|
|
|
|
32
|
|
|
$tc->params = array(); |
33
|
|
|
if (($tc->project = $project = |
34
|
|
|
group_get_object_by_name($GLOBALS['fusionforgeproject']))) { |
35
|
|
|
$tc->params['group'] = $GLOBALS['group_id'] = |
36
|
|
|
$project->getID(); |
37
|
|
|
$tc->params['toptab'] = 'plugin_mediawiki'; |
38
|
|
|
//$page_name = substr($_SERVER['REQUEST_URI'], (strpos($_SERVER['REQUEST_URI'], 'index.php/') + strlen('index.php/')), strlen($_SERVER['REQUEST_URI'])); |
39
|
|
|
$page_name = preg_replace(self::MEDIAWIKI_URL,'',$_SERVER['REQUEST_URI']); |
40
|
|
|
$tc->params['title'] = 'Mediawiki-' . $page_name; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
return $tc; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param $out OutputPage |
48
|
|
|
*/ |
49
|
|
|
function setupSkinUserCss( OutputPage $out ) { |
50
|
|
|
global $wgHandheldStyle; |
51
|
|
|
/* add Tuleap styles */ |
52
|
|
|
foreach ($GLOBALS['HTML']->getAllStyleSheets() as $sheet) { |
53
|
|
|
$out->addStyle($sheet['css'], $sheet['media']); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
parent::setupSkinUserCss( $out ); |
57
|
|
|
|
58
|
|
|
$out->addModuleStyles( 'skins.monobook' ); |
59
|
|
|
|
60
|
|
|
// Ugh. Can't do this properly because $wgHandheldStyle may be a URL |
61
|
|
|
if( $wgHandheldStyle ) { |
62
|
|
|
// Currently in testing... try 'chick/main.css' |
63
|
|
|
$out->addStyle( $wgHandheldStyle, 'handheld' ); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
// TODO: Migrate all of these |
67
|
|
|
$out->addStyle( 'tuleap/main.css', 'screen'); |
68
|
|
|
$out->addStyle( 'tuleap/TuleapSkin.css', 'screen'); |
69
|
|
|
$out->addStyle( 'tuleap/IE60Fixes.css', 'screen', 'IE 6' ); |
70
|
|
|
$out->addStyle( 'tuleap/IE70Fixes.css', 'screen', 'IE 7' ); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @todo document |
76
|
|
|
* @ingroup Skins |
77
|
|
|
*/ |
78
|
|
|
class TuleapTemplate extends BaseTemplate { |
79
|
|
|
|
80
|
|
|
var $project = false; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Template filter callback for FusionForge skin. |
84
|
|
|
* Takes an associative array of data set from a SkinTemplate-based |
85
|
|
|
* class, and a wrapper for MediaWiki's localization database, and |
86
|
|
|
* outputs a formatted page. |
87
|
|
|
* |
88
|
|
|
* @access private |
89
|
|
|
*/ |
90
|
|
|
function execute() { |
91
|
|
|
global $wgHtml5; |
92
|
|
|
// Suppress warnings to prevent notices about missing indexes in $this->data |
93
|
|
|
wfSuppressWarnings(); |
94
|
|
|
|
95
|
|
|
$this->html( 'headelement' ); |
96
|
|
|
|
97
|
|
|
echo "\n<!-- FUSIONFORGE BodyHeader BEGIN -->\n"; |
98
|
|
|
$GLOBALS['HTML']->header($this->params); |
99
|
|
|
echo "<div id=\"ff-mw-wrapper\"><div style=\"font-size:x-small;\">\n"; |
100
|
|
|
echo "<!-- FUSIONFORGE BodyHeader END -->\n"; |
101
|
|
|
|
102
|
|
|
?><div id="globalWrapper"> |
103
|
|
|
<div id="column-content"><div id="content"> |
104
|
|
|
<a id="top"></a> |
105
|
|
|
<?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?> |
106
|
|
|
|
107
|
|
|
<h1 id="firstHeading" class="firstHeading"><span<?php if ($wgHtml5) echo ' dir="auto"'; ?>><?php $this->html('title') ?></span></h1> |
108
|
|
|
<div id="bodyContent" class="mw-body"> |
109
|
|
|
<div id="siteSub"><?php $this->msg('tagline') ?></div> |
110
|
|
|
<div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div> |
111
|
|
|
<?php if($this->data['undelete']) { ?> |
112
|
|
|
<div id="contentSub2"><?php $this->html('undelete') ?></div> |
113
|
|
|
<?php } ?><?php if($this->data['newtalk'] ) { ?> |
114
|
|
|
<div class="usermessage"><?php $this->html('newtalk') ?></div> |
115
|
|
|
<?php } ?><?php if($this->data['showjumplinks']) { ?> |
116
|
|
|
<div id="jump-to-nav" class="mw-jump"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div> |
117
|
|
|
<?php } ?> |
118
|
|
|
<!-- start content --> |
119
|
|
|
<?php $this->html('bodytext') ?> |
120
|
|
|
<?php if($this->data['catlinks']) { $this->html('catlinks'); } ?> |
121
|
|
|
<!-- end content --> |
122
|
|
|
<?php if($this->data['dataAfterContent']) { $this->html ('dataAfterContent'); } ?> |
123
|
|
|
<div class="visualClear"></div> |
124
|
|
|
</div> |
125
|
|
|
</div></div> |
126
|
|
|
<div id="column-one"<?php $this->html('userlangattributes') ?>> |
127
|
|
|
<?php $this->cactions(); ?> |
128
|
|
|
<div class="portlet" id="p-personal"> |
129
|
|
|
<h5><?php $this->msg('personaltools') ?></h5> |
130
|
|
|
<div class="pBody"> |
131
|
|
|
<?php |
132
|
|
|
$ul_shown = false; |
133
|
|
|
foreach ($this->getPersonalTools() as $key => $item) { |
134
|
|
|
if (!$ul_shown) { |
135
|
|
|
?> |
136
|
|
|
<ul<?php $this->html('userlangattributes') ?>> |
137
|
|
|
<?php |
138
|
|
|
$ul_shown = true; |
139
|
|
|
} |
140
|
|
|
echo "\n" . $this->makeListItem($key, $item); |
141
|
|
|
} |
142
|
|
|
if ($ul_shown) { |
143
|
|
|
echo "\n</ul>\n"; |
144
|
|
|
} |
145
|
|
|
?> |
146
|
|
|
</div> |
147
|
|
|
</div> |
148
|
|
|
<?php |
149
|
|
|
$this->renderPortals( $this->data['sidebar'] ); |
150
|
|
|
?> |
151
|
|
|
</div><!-- end of the left (by default at least) column --> |
152
|
|
|
<div class="visualClear"></div> |
153
|
|
|
<?php |
154
|
|
|
$validFooterIcons = $this->getFooterIcons( "icononly" ); |
155
|
|
|
$validFooterLinks = $this->getFooterLinks( "flat" ); // Additional footer links |
156
|
|
|
|
157
|
|
|
if ( count( $validFooterIcons ) + count( $validFooterLinks ) > 0 ) { ?> |
158
|
|
|
<div id="footer"<?php $this->html('userlangattributes') ?>> |
159
|
|
|
<?php |
160
|
|
|
$footerEnd = '</div>'; |
161
|
|
|
} else { |
162
|
|
|
$footerEnd = ''; |
163
|
|
|
} |
164
|
|
|
foreach ( $validFooterIcons as $blockName => $footerIcons ) { ?> |
165
|
|
|
<div id="f-<?php echo htmlspecialchars($blockName); ?>ico"> |
166
|
|
|
<?php foreach ( $footerIcons as $icon ) { ?> |
167
|
|
|
<?php echo $this->getSkin()->makeFooterIcon( $icon ); ?> |
168
|
|
|
|
169
|
|
|
<?php } |
170
|
|
|
?> |
171
|
|
|
</div> |
172
|
|
|
<?php } |
173
|
|
|
|
174
|
|
|
if ( count( $validFooterLinks ) > 0 ) { |
175
|
|
|
?> <ul id="f-list"> |
176
|
|
|
<?php |
177
|
|
|
foreach( $validFooterLinks as $aLink ) { ?> |
178
|
|
|
<li id="<?php echo $aLink ?>"><?php $this->html($aLink) ?></li> |
179
|
|
|
<?php |
180
|
|
|
} |
181
|
|
|
?> |
182
|
|
|
</ul> |
183
|
|
|
<?php } |
184
|
|
|
echo $footerEnd; |
185
|
|
|
?> |
186
|
|
|
|
187
|
|
|
</div> |
188
|
|
|
<?php |
189
|
|
|
$this->printTrail(); |
190
|
|
|
echo "</div></div>\n"; |
191
|
|
|
$GLOBALS['HTML']->footer($this->params); |
192
|
|
|
wfRestoreWarnings(); |
193
|
|
|
} // end of execute() method |
194
|
|
|
|
195
|
|
|
/*************************************************************************************************/ |
196
|
|
|
|
197
|
|
|
protected function renderPortals( $sidebar ) { |
198
|
|
|
if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true; |
199
|
|
|
if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true; |
200
|
|
|
if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true; |
201
|
|
|
|
202
|
|
|
if (session_loggedin()) { |
203
|
|
|
$efbox_log_text = _('Log Out'); |
204
|
|
|
$efbox_log_link = "/account/logout.php?return_to=" . |
205
|
|
|
urlencode(getStringFromServer('REQUEST_URI')); |
206
|
|
|
} else { |
207
|
|
|
$efbox_log_text = _('Log In'); |
208
|
|
|
$efbox_log_link = "/account/login.php?return_to=" . |
209
|
|
|
urlencode(getStringFromServer('REQUEST_URI')); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
foreach( $sidebar as $boxName => $content ) { |
213
|
|
|
if ( $content === false ) |
214
|
|
|
continue; |
215
|
|
|
|
216
|
|
|
if ( $boxName == 'SEARCH' ) { |
217
|
|
|
//keep empty to remove html search box |
218
|
|
|
} elseif ( $boxName == 'TOOLBOX' ) { |
219
|
|
|
$this->toolbox(); |
220
|
|
|
} elseif ( $boxName == 'LANGUAGES' ) { |
221
|
|
|
$this->languageBox(); |
222
|
|
|
} else { |
223
|
|
|
$this->customBox( $boxName, $content ); |
224
|
|
|
} |
225
|
|
|
} |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
/** |
229
|
|
|
* Prints the cactions bar. |
230
|
|
|
* Shared between MonoBook and Modern |
231
|
|
|
*/ |
232
|
|
|
function cactions() { |
233
|
|
|
?> |
234
|
|
|
<div id="p-cactions" class="portlet"> |
235
|
|
|
<h5><?php $this->msg('views') ?></h5> |
236
|
|
|
<div class="pBody"> |
237
|
|
|
<ul><?php |
238
|
|
|
foreach($this->data['content_actions'] as $key => $tab) { |
239
|
|
|
echo ' |
240
|
|
|
' . $this->makeListItem( $key, $tab ); |
241
|
|
|
} ?> |
242
|
|
|
|
243
|
|
|
</ul> |
244
|
|
|
</div> |
245
|
|
|
</div> |
246
|
|
|
<?php |
247
|
|
|
} |
248
|
|
|
/*************************************************************************************************/ |
249
|
|
|
function toolbox() { |
250
|
|
|
?> |
251
|
|
|
<div class="portlet" id="p-tb"> |
252
|
|
|
<h5><?php $this->msg('toolbox') ?></h5> |
253
|
|
|
<div class="pBody"> |
254
|
|
|
<ul> |
255
|
|
|
<?php |
256
|
|
|
foreach ( $this->getToolbox() as $key => $tbitem ) { ?> |
257
|
|
|
<?php echo $this->makeListItem($key, $tbitem); ?> |
258
|
|
|
|
259
|
|
|
<?php |
260
|
|
|
} |
261
|
|
|
wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) ); |
262
|
|
|
wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this, true ) ); |
263
|
|
|
?> |
264
|
|
|
</ul> |
265
|
|
|
</div> |
266
|
|
|
</div> |
267
|
|
|
<?php |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/*************************************************************************************************/ |
271
|
|
|
function languageBox() { |
272
|
|
|
if( $this->data['language_urls'] ) { |
273
|
|
|
?> |
274
|
|
|
<div id="p-lang" class="portlet"> |
275
|
|
|
<h5<?php $this->html('userlangattributes') ?>><?php $this->msg('otherlanguages') ?></h5> |
276
|
|
|
<div class="pBody"> |
277
|
|
|
<ul> |
278
|
|
|
<?php foreach($this->data['language_urls'] as $key => $langlink) { ?> |
279
|
|
|
<?php echo $this->makeListItem($key, $langlink); ?> |
280
|
|
|
|
281
|
|
|
<?php } ?> |
282
|
|
|
</ul> |
283
|
|
|
</div> |
284
|
|
|
</div> |
285
|
|
|
<?php |
286
|
|
|
} |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/*************************************************************************************************/ |
290
|
|
|
function customBox( $bar, $cont ) { |
291
|
|
|
$portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer::escapeId( "p-$bar" ) ); |
292
|
|
|
$tooltip = Linker::titleAttrib( "p-$bar" ); |
293
|
|
|
if ( $tooltip !== false ) { |
294
|
|
|
$portletAttribs['title'] = $tooltip; |
295
|
|
|
} |
296
|
|
|
echo ' ' . Html::openElement( 'div', $portletAttribs ); |
297
|
|
|
?> |
298
|
|
|
|
299
|
|
|
<h5><?php $msg = wfMessage( $bar ); echo htmlspecialchars( $msg->exists() ? $msg->text() : $bar ); ?></h5> |
300
|
|
|
<div class='pBody'> |
301
|
|
|
<?php if ( is_array( $cont ) ) { ?> |
302
|
|
|
<ul> |
303
|
|
|
<?php foreach($cont as $key => $val) { ?> |
304
|
|
|
<?php echo $this->makeListItem($key, $val); ?> |
305
|
|
|
|
306
|
|
|
<?php } ?> |
307
|
|
|
</ul> |
308
|
|
|
<?php } else { |
309
|
|
|
# allow raw HTML block to be defined by extensions |
310
|
|
|
print $cont; |
311
|
|
|
} |
312
|
|
|
?> |
313
|
|
|
</div> |
314
|
|
|
</div> |
315
|
|
|
<?php |
316
|
|
|
} |
317
|
|
|
} // end of class |
318
|
|
|
|