Index: trunk/extensions/Deployment/specials/SpecialExtensions.php |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | * Constructor. |
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | | - parent::__construct( 'Extensions', 'siteadmin' ); |
| 46 | + parent::__construct( 'Extensions' ); |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
— | — | @@ -53,18 +53,13 @@ |
54 | 54 | * @param $arg String |
55 | 55 | */ |
56 | 56 | public function execute( $arg ) { |
57 | | - global $wgOut, $wgUser; |
| 57 | + global $wgOut; |
58 | 58 | |
59 | 59 | $this->typeFilter = is_null( $arg ) ? 'all' : $arg; |
60 | 60 | |
61 | 61 | $wgOut->setPageTitle( wfMsg( 'extensions-title' ) ); |
62 | 62 | |
63 | | - // If the user is authorized, display the page, if not, show an error. |
64 | | - if ( $this->userCanExecute( $wgUser ) ) { |
65 | | - $this->displayPage(); |
66 | | - } else { |
67 | | - $this->displayRestrictionError(); |
68 | | - } |
| 63 | + $this->displayPage(); |
69 | 64 | } |
70 | 65 | |
71 | 66 | /** |
— | — | @@ -73,9 +68,35 @@ |
74 | 69 | * @since 0.1 |
75 | 70 | */ |
76 | 71 | protected function displayPage() { |
| 72 | + global $wgOut, $wgUser; |
| 73 | + |
| 74 | + if ( $wgUser->isAllowed( 'siteadmin' ) ) { |
| 75 | + $this->displayAddNewButton(); |
| 76 | + } |
| 77 | + else { |
| 78 | + // TODO: fix url |
| 79 | + $wgOut->addWikiMsgArray( 'extension-page-explanation', '' ); |
| 80 | + } |
| 81 | + |
| 82 | + $wgOut->addHTML( |
| 83 | + Xml::element( 'h2', array( 'id' => 'mw-version-ext' ), wfMsg( 'version-extensions' ) ) |
| 84 | + ); |
| 85 | + |
| 86 | + $this->displayFilterControl(); |
| 87 | + |
| 88 | + $this->displayBulkActions(); |
| 89 | + |
| 90 | + $this->displayExtensionList(); |
| 91 | + } |
| 92 | + |
| 93 | + /** |
| 94 | + * Created and outputs an "add new" button linking to the Special:Install page. |
| 95 | + * |
| 96 | + * @since 0.1 |
| 97 | + */ |
| 98 | + protected function displayAddNewButton() { |
77 | 99 | global $wgOut; |
78 | 100 | |
79 | | - // Shows an "add new" button linking to the Special:Install page. |
80 | 101 | $wgOut->addHTML( |
81 | 102 | Html::element( |
82 | 103 | 'button', |
— | — | @@ -85,17 +106,7 @@ |
86 | 107 | ), |
87 | 108 | wfMsg( 'add-new-extensions' ) |
88 | 109 | ) |
89 | | - ); |
90 | | - |
91 | | - $wgOut->addWikiText( |
92 | | - Xml::element( 'h2', array( 'id' => 'mw-version-ext' ), wfMsg( 'version-extensions' ) ) |
93 | | - ); |
94 | | - |
95 | | - $this->displayFilterControl(); |
96 | | - |
97 | | - $this->displayBulkActions(); |
98 | | - |
99 | | - $this->displayExtensionList(); |
| 110 | + ); |
100 | 111 | } |
101 | 112 | |
102 | 113 | /** |
— | — | @@ -258,6 +269,8 @@ |
259 | 270 | * @return string |
260 | 271 | */ |
261 | 272 | protected function getItemNameTdContents( array $extension ) { |
| 273 | + global $wgUser; |
| 274 | + |
262 | 275 | $name = Html::element( 'b', array(), $extension['name'] ); |
263 | 276 | |
264 | 277 | $controls = array(); |
— | — | @@ -271,8 +284,7 @@ |
272 | 285 | wfMsg( 'extensionlist-details' ) |
273 | 286 | ); |
274 | 287 | |
275 | | - // TODO: permission check |
276 | | - if ( true ) { |
| 288 | + if ( $wgUser->isAllowed( 'siteadmin' ) ) { |
277 | 289 | $controls[] = Html::element( |
278 | 290 | 'a', |
279 | 291 | array( |
Index: trunk/extensions/Deployment/Deployment.i18n.php |
— | — | @@ -17,7 +17,8 @@ |
18 | 18 | $messages['en'] = array( |
19 | 19 | // General |
20 | 20 | 'deployment-desc' => 'Provides a way to install extensions via GUI and update them and the wiki itself via another GUI', |
21 | | - |
| 21 | + 'extension' => 'Extension', |
| 22 | + |
22 | 23 | // Special pages |
23 | 24 | 'specialpages-group-administration' => 'Wiki administration', |
24 | 25 | |
— | — | @@ -53,6 +54,7 @@ |
54 | 55 | 'add-new-extensions' => 'Add new', |
55 | 56 | 'extension-type-all' => 'All', |
56 | 57 | 'extension-bulk-actions' => 'Bulk Actions', |
| 58 | + 'extension-page-explanation' => 'This page lists the installed extensions on this wiki. For more info about this wiki installation, see [$1 Special:Version].', |
57 | 59 | |
58 | 60 | // Special:Update |
59 | 61 | 'mediawiki-up-to-date' => 'You have the latest version of MediaWiki.', |