r70931 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70930‎ | r70931 | r70932 >
Date:09:06, 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/SpecialInstall.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Deployment/specials/SpecialInstall.php
@@ -44,10 +44,17 @@
4545
4646 // If the user is authorized, display the page, if not, show an error.
4747 if ( $this->userCanExecute( $wgUser ) ) {
48 - if ( $wgRequest->wasPosted() ) {
 48+ if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
4949 $this->showCompactSearchOptions();
50 - // TODO
51 - $this->findExtenions();
 50+
 51+ $extensions = $this->findExtenions( $wgRequest->getText( 'filtertype' ), $wgRequest->getText( 'filtervalue' ) );
 52+
 53+ if ( count( $extensions ) > 0 ) {
 54+ $this->showExtensionList();
 55+ }
 56+ else {
 57+ // TODO
 58+ }
5259 }
5360 else {
5461 $this->showFullSearchOptions();
@@ -57,23 +64,97 @@
5865 }
5966 }
6067
 68+ /**
 69+ * Created the HTML for the full set of search options controls and adds it to $wgOut.
 70+ *
 71+ * @since 0.1
 72+ */
6173 protected function showFullSearchOptions() {
62 - // TODO
 74+ global $wgOut, $wgUser, $wgRepositoryLocation;
 75+
 76+ $wgOut->addWikiMsgArray( 'extensions-description', $wgRepositoryLocation );
 77+
 78+ $searchHtml = Html::element( 'h2', array(), wfMsg( 'search-extensions' ) );
 79+ $searchHtml .= wfMsg( 'search-extensions-long' );
 80+
 81+ $searchHtml .= Html::openElement(
 82+ 'form',
 83+ array(
 84+ 'id' => 'searchform',
 85+ 'name' => 'searchform',
 86+ 'method' => 'post',
 87+ 'action' => $this->getTitle()->getLocalURL(),
 88+ )
 89+ );
 90+
 91+ $searchHtml .= Html::rawElement(
 92+ 'select',
 93+ array(
 94+ 'name' => 'filtertype',
 95+ 'id' => 'filtertype'
 96+ ),
 97+ '<option value="term">' . htmlspecialchars( wfMsg( 'search-term' ) ) . '</option>' .
 98+ '<option value="author">' . htmlspecialchars( wfMsg( 'search-author' ) ) . '</option>' .
 99+ '<option value="tag">' . htmlspecialchars( wfMsg( 'search-tag' ) ) . '</option>'
 100+ );
 101+
 102+ $searchHtml .= '&nbsp;&nbsp;';
 103+
 104+ $searchHtml .= Html::input( 'filtervalue' );
 105+
 106+ $searchHtml .= '&nbsp;&nbsp;';
 107+
 108+ $searchHtml .= Html::input(
 109+ '',
 110+ wfMsg( 'search-extensions-button' ),
 111+ 'submit',
 112+ array( 'id' => 'searchform-button' )
 113+ );
 114+
 115+ $searchHtml .= Html::hidden( 'wpEditToken', $wgUser->editToken() );
 116+
 117+ $searchHtml .= Html::closeElement( 'form' );
 118+
 119+ $wgOut->addHTML( $searchHtml );
 120+
 121+ $tagHtml = Html::element( 'h2', array(), wfMsg( 'popular-extension-tags' ) );
 122+ $tagHtml .= wfMsg( 'popular-extension-tags-long' );
 123+
 124+ $wgOut->addHTML( $tagHtml );
63125 }
64126
 127+ /**
 128+ * Created the HTML for the compact search options and adds it to $wgOut.
 129+ *
 130+ * @since 0.1
 131+ */
65132 protected function showCompactSearchOptions() {
 133+ global $wgOut;
66134 // TODO
67135 }
68136
 137+ /**
 138+ * Queries the repository for a list of extensions matching the search criteria
 139+ * and returns these.
 140+ *
 141+ * @since 0.1
 142+ *
 143+ * @param $filterType String
 144+ * @param $filterValue String
 145+ *
 146+ * @return arrau
 147+ */
69148 protected function findExtenions( $filterType, $filterValue ) {
70149 $repository = wfGetRepository();
71150
72 - $repository->findExtenions( $filterType, $filterValue );
 151+ return $repository->findExtenions( $filterType, $filterValue );
73152 }
74153
75154 /**
76155 * Show the extensions that where found in a list.
77156 *
 157+ * @since 0.1
 158+ *
78159 * @param $extensions Array
79160 */
80161 protected function showExtensionList( array $extensions ) {
Index: trunk/extensions/Deployment/Deployment.i18n.php
@@ -45,6 +45,10 @@
4646 'extensions-description' => 'Extensions extend and expand the functionality of MediaWiki. You can browse and search extensions that are in the [$1 MediaWiki Extension Repository] to install via this page.',
4747 'search-extensions' => 'Search',
4848 'search-extensions-long' => 'Search for extensions by keyword, author, or tag.',
 49+ 'search-term' => 'Term',
 50+ 'search-author' => 'Author',
 51+ 'search-tag' => 'Tag',
 52+ 'search-extensions-button' => 'Search extensions',
4953 'popular-extension-tags' => 'Popular tags',
5054 'popular-extension-tags-long' => 'You may also browse based on the most popular tags in the Extension Repository:',
5155
Index: trunk/extensions/Deployment/includes/DistributionRepository.php
@@ -57,7 +57,14 @@
5858 array( 'sslVerifyHost' => true, 'sslVerifyCert' => true )
5959 );
6060
61 - // TODO: parse and return result
 61+ $extensions = array();
 62+
 63+ if ( $response !== false ) {
 64+ $extensions = FormatJson::decode( $response );
 65+ }
 66+ // TODO
 67+ var_dump($extensions);exit;
 68+ return $extensions;
6269 }
6370
6471 }
\ No newline at end of file

Status & tagging log