r71077 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71076‎ | r71077 | r71078 >
Date:17:38, 14 August 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r71076
Modified paths:
  • /trunk/extensions/Deployment/Deployment.i18n.php (modified) (history)
  • /trunk/extensions/Deployment/specials/SpecialExtensions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Deployment/specials/SpecialExtensions.php
@@ -42,7 +42,7 @@
4343 * Constructor.
4444 */
4545 public function __construct() {
46 - parent::__construct( 'Extensions', 'siteadmin' );
 46+ parent::__construct( 'Extensions' );
4747 }
4848
4949 /**
@@ -53,18 +53,13 @@
5454 * @param $arg String
5555 */
5656 public function execute( $arg ) {
57 - global $wgOut, $wgUser;
 57+ global $wgOut;
5858
5959 $this->typeFilter = is_null( $arg ) ? 'all' : $arg;
6060
6161 $wgOut->setPageTitle( wfMsg( 'extensions-title' ) );
6262
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();
6964 }
7065
7166 /**
@@ -73,9 +68,35 @@
7469 * @since 0.1
7570 */
7671 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() {
7799 global $wgOut;
78100
79 - // Shows an "add new" button linking to the Special:Install page.
80101 $wgOut->addHTML(
81102 Html::element(
82103 'button',
@@ -85,17 +106,7 @@
86107 ),
87108 wfMsg( 'add-new-extensions' )
88109 )
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+ );
100111 }
101112
102113 /**
@@ -258,6 +269,8 @@
259270 * @return string
260271 */
261272 protected function getItemNameTdContents( array $extension ) {
 273+ global $wgUser;
 274+
262275 $name = Html::element( 'b', array(), $extension['name'] );
263276
264277 $controls = array();
@@ -271,8 +284,7 @@
272285 wfMsg( 'extensionlist-details' )
273286 );
274287
275 - // TODO: permission check
276 - if ( true ) {
 288+ if ( $wgUser->isAllowed( 'siteadmin' ) ) {
277289 $controls[] = Html::element(
278290 'a',
279291 array(
Index: trunk/extensions/Deployment/Deployment.i18n.php
@@ -17,7 +17,8 @@
1818 $messages['en'] = array(
1919 // General
2020 '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+
2223 // Special pages
2324 'specialpages-group-administration' => 'Wiki administration',
2425
@@ -53,6 +54,7 @@
5455 'add-new-extensions' => 'Add new',
5556 'extension-type-all' => 'All',
5657 '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].',
5759
5860 // Special:Update
5961 'mediawiki-up-to-date' => 'You have the latest version of MediaWiki.',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r71076Work on Special:Extensions interfacejeroendedauw17:21, 14 August 2010

Status & tagging log