Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
MessageBoxHelper | |
0.00% |
0 / 15 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
addModuleStyles | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
renderWarningBoxes | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * Collection Extension for MediaWiki |
4 | * |
5 | * Copyright (C) PediaPress GmbH |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License along |
18 | * with this program; if not, write to the Free Software Foundation, Inc., |
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
20 | * http://www.gnu.org/copyleft/gpl.html |
21 | */ |
22 | |
23 | namespace MediaWiki\Extension\Collection; |
24 | |
25 | use MediaWiki\Html\Html; |
26 | use MediaWiki\Output\OutputPage; |
27 | |
28 | /** |
29 | * A helper class to easily handle extra styles and render html for messages boxes informing |
30 | * about on-ging Book Creator maintenance and unavailability of PDF generation feature. |
31 | * |
32 | * When Book Creator gets back to stable you can safely remove this class with all usages and all |
33 | * ext.collection.bookcreator.messageBox modules. |
34 | * |
35 | * @see https://phabricator.wikimedia.org/T175996 |
36 | */ |
37 | class MessageBoxHelper { |
38 | |
39 | /** |
40 | * Inject MessageBox modules (styles&icons) to OutputPage |
41 | * |
42 | * @param OutputPage $out |
43 | */ |
44 | public static function addModuleStyles( OutputPage $out ) { |
45 | $out->addModules( [ |
46 | 'ext.collection.bookcreator.messageBox' |
47 | ] ); |
48 | $out->addModuleStyles( [ |
49 | 'mediawiki.hlist', |
50 | 'ext.collection.bookcreator.messageBox.icons', |
51 | ] ); |
52 | } |
53 | |
54 | /** |
55 | * Render boxes informing about PDF feature unavailability. |
56 | * |
57 | * @return string Generated HTML |
58 | */ |
59 | public static function renderWarningBoxes() { |
60 | return Html::noticeBox( |
61 | Html::element( 'h5', [ |
62 | 'class' => 'collection-box-heading collection-icon-info', |
63 | ], wfMessage( 'coll-notice-download-pdf-title' )->text() ) |
64 | . Html::rawElement( 'p', [ 'class' => 'notice-text' ], |
65 | wfMessage( 'coll-notice-download-pdf-text' )->parse() ), |
66 | 'collection-maintenance-box collection-notice-box' |
67 | ); |
68 | } |
69 | |
70 | } |