r71070 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71069‎ | r71070 | r71071 >
Date:14:03, 14 August 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Work on Special:Extensions interface
Modified paths:
  • /trunk/extensions/Deployment/specials/SpecialExtensions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Deployment/specials/SpecialExtensions.php
@@ -57,24 +57,79 @@
5858
5959 // If the user is authorized, display the page, if not, show an error.
6060 if ( $this->userCanExecute( $wgUser ) ) {
61 - $wgOut->addHTML(
62 - Html::element(
63 - 'button',
64 - array(
65 - 'type' => 'button',
66 - 'onclick' => 'window.location="' . Xml::escapeJsString( SpecialPage::getTitleFor( 'install' )->getFullURL() ) . '"'
67 - ),
68 - wfMsg( 'add-new-extensions' )
69 - )
70 - );
71 -
72 - $wgOut->addWikiText( $this->getExtensionList() );
 61+ $this->displayPage();
7362 } else {
7463 $this->displayRestrictionError();
7564 }
7665 }
7766
7867 /**
 68+ * Creates and outputs the page contents.
 69+ *
 70+ * @since 0.1
 71+ */
 72+ protected function displayPage() {
 73+ global $wgOut;
 74+
 75+ // Shows an "add new" button linking to the Special:Install page.
 76+ $wgOut->addHTML(
 77+ Html::element(
 78+ 'button',
 79+ array(
 80+ 'type' => 'button',
 81+ 'onclick' => 'window.location="' . Xml::escapeJsString( SpecialPage::getTitleFor( 'install' )->getFullURL() ) . '"'
 82+ ),
 83+ wfMsg( 'add-new-extensions' )
 84+ )
 85+ );
 86+
 87+ $wgOut->addWikiText(
 88+ Xml::element( 'h2', array( 'id' => 'mw-version-ext' ), wfMsg( 'version-extensions' ) )
 89+ );
 90+
 91+ $this->displayFilterControl();
 92+
 93+ $this->displayBulkActions();
 94+
 95+ $wgOut->addWikiText( $this->getExtensionList() );
 96+ }
 97+
 98+ /**
 99+ * Creates and outputs the filter control.
 100+ *
 101+ * @since 0.1
 102+ */
 103+ protected function displayFilterControl() {
 104+ global $wgOut, $wgExtensionCredits;
 105+
 106+ $extensionAmount = 0;
 107+ $filterSegments = array();
 108+
 109+ // TODO: links
 110+
 111+ foreach ( $wgExtensionCredits as $type => $extensions ) {
 112+ $amount = count( $extensions );
 113+ $name = SpecialVersion::getExtensionTypeName( $type );
 114+
 115+ $filterSegments[] = "$name ($amount)";
 116+ $extensionAmount += $amount;
 117+ }
 118+
 119+ $filterSegments = array_merge( array( "All ($extensionAmount)" ), $filterSegments );
 120+
 121+ $wgOut->addHTML( implode( ' | ', $filterSegments ) );
 122+ }
 123+
 124+ /**
 125+ * Creates and outputs the bilk actions control.
 126+ *
 127+ * @since 0.1
 128+ */
 129+ protected function displayBulkActions() {
 130+ // TODO
 131+ }
 132+
 133+ /**
79134 * Creates and returns the HTML for the extension list.
80135 *
81136 * @since 0.1
@@ -84,8 +139,7 @@
85140 protected function getExtensionList() {
86141 global $wgExtensionCredits;
87142
88 - $out = Xml::element( 'h2', array( 'id' => 'mw-version-ext' ), wfMsg( 'version-extensions' ) );
89 - $out .= Xml::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-ext' ) );
 143+ $out = Xml::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-ext' ) );
90144
91145 $extensionTypes = SpecialVersion::getExtensionTypes();
92146

Status & tagging log