r70950 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70949‎ | r70950 | r70951 >
Date:13:23, 12 August 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Work on Special:Install
Modified paths:
  • /trunk/extensions/Deployment/Deployment.i18n.php (modified) (history)
  • /trunk/extensions/Deployment/includes/DistributionRepository.php (modified) (history)
  • /trunk/extensions/Deployment/specials/SpecialExtensions.php (modified) (history)
  • /trunk/extensions/Deployment/specials/SpecialInstall.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Deployment/specials/SpecialExtensions.php
@@ -84,8 +84,8 @@
8585 protected function getExtensionList() {
8686 global $wgExtensionCredits;
8787
88 - $out = Xml::element( 'h2', array( 'id' => 'mw-version-ext' ), wfMsg( 'version-extensions' ) ) .
89 - Xml::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-ext' ) );
 88+ $out = Xml::element( 'h2', array( 'id' => 'mw-version-ext' ), wfMsg( 'version-extensions' ) );
 89+ $out .= Xml::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-ext' ) );
9090
9191 $extensionTypes = SpecialVersion::getExtensionTypes();
9292
Index: trunk/extensions/Deployment/specials/SpecialInstall.php
@@ -50,7 +50,7 @@
5151 $extensions = $this->findExtenions( $wgRequest->getText( 'filtertype' ), $wgRequest->getText( 'filtervalue' ) );
5252
5353 if ( count( $extensions ) > 0 ) {
54 - $this->showExtensionList();
 54+ $this->showExtensionList( $extensions );
5555 }
5656 else {
5757 // TODO
@@ -152,6 +152,7 @@
153153
154154 /**
155155 * Show the extensions that where found in a list.
 156+ * This method assumes it gets only called when there are more then 0 extensions.
156157 *
157158 * @since 0.1
158159 *
@@ -160,15 +161,63 @@
161162 protected function showExtensionList( array $extensions ) {
162163 global $wgOut;
163164
164 - // TODO: this is just a debug mockup
 165+ $listHtml = Html::openElement(
 166+ 'table',
 167+ array( 'class' => 'wikitable' )
 168+ );
165169
166 - $list = array();
 170+ $listHtml .= '<tr>' .
 171+ Html::element( 'th', array(), wfMsg( 'extensionlist-name' ) ) .
 172+ Html::element( 'th', array(), wfMsg( 'extensionlist-version' ) ) .
 173+ Html::element( 'th', array(), wfMsg( 'extensionlist-stability' ) ) .
 174+ Html::element( 'th', array(), wfMsg( 'extensionlist-description' ) )
 175+ . '</tr>';
167176
168177 foreach ( $extensions as $extension ) {
169 - $list[] = $extension['name'];
170 - }
 178+ $listHtml .= $this->getExtensionForList( $extension );
 179+ }
 180+
 181+ $listHtml .= Html::closeElement( 'table' );
171182
172 - $wgOut->addHTML( implode( ',', $list ) );
 183+ $wgOut->addHTML( $listHtml );
173184 }
174185
 186+ /**
 187+ * Creates and returns the html for a single extension in the list.
 188+ *
 189+ * @since 0.1
 190+ *
 191+ * @param $extensions Object
 192+ *
 193+ * @return string
 194+ */
 195+ protected function getExtensionForList( $extension ) {
 196+ $html = '<tr>';
 197+
 198+ $html .= Html::rawElement(
 199+ 'td',
 200+ array(),
 201+ Html::element(
 202+ 'a',
 203+ array(
 204+ 'href' => $extension->url,
 205+ 'class' => 'external text'
 206+ ),
 207+ $extension->name
 208+ )
 209+ );
 210+
 211+ $html .= Html::element( 'td', array(), $extension->version );
 212+ $html .= Html::element( 'td', array(), 'Stable' ); // TODO
 213+
 214+ $html .= Html::element(
 215+ 'td',
 216+ array(),
 217+ $extension->description . ' ' .
 218+ wfMsgExt( 'extensionlist-createdby', 'parsemag', $extension->authors )
 219+ );
 220+
 221+ return $html . '</tr>';
 222+ }
 223+
175224 }
\ No newline at end of file
Index: trunk/extensions/Deployment/Deployment.i18n.php
@@ -60,6 +60,7 @@
6161 'extensionlist-details' => 'Details',
6262 'extensionlist-download' => 'Download',
6363 'extensionlist-installnow' => 'Install now',
 64+ 'extensionlist-createdby' => 'By $1',
6465
6566 'stability-alpha' => 'Alpha',
6667 'stability-beta' => 'Beta',
Index: trunk/extensions/Deployment/includes/DistributionRepository.php
@@ -60,10 +60,9 @@
6161 $extensions = array();
6262
6363 if ( $response !== false ) {
64 - $extensions = FormatJson::decode( $response );
 64+ $extensions = FormatJson::decode( $response )->query->extensions;
6565 }
66 - // TODO
67 - var_dump($extensions);exit;
 66+
6867 return $extensions;
6968 }
7069

Follow-up revisions

RevisionCommit summaryAuthorDate
r70953Follow up to r70950jeroendedauw13:46, 12 August 2010

Status & tagging log