Robert Vogel has submitted this change and it was merged. Change subject: Pass context to HTMLForm, don't use HTMLForm::setTitle ......................................................................
Pass context to HTMLForm, don't use HTMLForm::setTitle Change-Id: I3f060734f739d6897715078aa7f049c7102dfdd2 --- M specialpages/BibManagerCreate_body.php M specialpages/BibManagerDelete_body.php M specialpages/BibManagerEdit_body.php M specialpages/BibManagerImport_body.php M specialpages/BibManagerList_body.php 5 files changed, 19 insertions(+), 24 deletions(-) Approvals: Robert Vogel: Verified; Looks good to me, approved diff --git a/specialpages/BibManagerCreate_body.php b/specialpages/BibManagerCreate_body.php index 58d4680..64dd160 100644 --- a/specialpages/BibManagerCreate_body.php +++ b/specialpages/BibManagerCreate_body.php @@ -50,7 +50,7 @@ wfRunHooks( 'BibManagerCreateBeforeTypeSelectFormCreate', array ( $this, &$formDescriptor ) ); - $entryTypeSelectionForm = new HTMLForm( $formDescriptor ); + $entryTypeSelectionForm = new HTMLForm( $formDescriptor, $this->getContext() ); $entryTypeSelectionForm->setSubmitText( wfMsg( 'bm_select_entry_type_submit' ) ); $entryTypeSelectionForm->setSubmitId( 'bm_select_entry_type_submit' ); $entryTypeSelectionForm->setSubmitCallback( array ( $this, 'onSubmit' ) ); @@ -62,10 +62,9 @@ $importParams['bm_bibtexCitation'] = $citation; } - $entryTypeSelectionForm->setTitle( $this->getTitle() ); $entryTypeSelectionForm->addPostText( wfMsg( - 'bm_bibtex_string_import_link', + 'bm_bibtex_string_import_link', SpecialPage::getTitleFor( 'BibManagerImport' )->getLocalURL( $importParams ) ) ); @@ -85,7 +84,7 @@ global $wgOut, $wgRequest; $citation = $wgRequest->getVal( 'bm_bibtexCitation' ); if ( !isset( $formData['bm_bibtexCitation'] ) && !empty( $citation ) ) { - //This should not be necessary, but it seems the hidden field from + //This should not be necessary, but it seems the hidden field from //the type selection form is not properly included in $formData $formData['bm_bibtexCitation'] = $citation; } @@ -94,4 +93,4 @@ ); return true; } -} \ No newline at end of file +} diff --git a/specialpages/BibManagerDelete_body.php b/specialpages/BibManagerDelete_body.php index 85c263e..a6861e8 100644 --- a/specialpages/BibManagerDelete_body.php +++ b/specialpages/BibManagerDelete_body.php @@ -68,9 +68,8 @@ ) ); - $htmlForm = new HTMLForm( $formDescriptor, 'bm_delete' ); + $htmlForm = new HTMLForm( $formDescriptor, $this->getContext(), 'bm_delete' ); $htmlForm->setSubmitText( wfMsg( 'bm_delete_submit' ) ); - $htmlForm->setTitle( $this->getTitle() ); $htmlForm->setSubmitCallback( array ( $this, 'formSubmit' ) ); //TODO: Add cancel button that returns user to the place he came from. I.e. filtered overview @@ -94,13 +93,13 @@ if ( $result === true ) { $wgOut->addHtml( wfMsg( 'bm_success_save-complete' ) ); - $wgOut->addHtml( - wfMsg( - 'bm_success_link-to-list', + $wgOut->addHtml( + wfMsg( + 'bm_success_link-to-list', SpecialPage::getTitleFor( "BibManagerList" )->getLocalURL() ) ); } return $result; } -} \ No newline at end of file +} diff --git a/specialpages/BibManagerEdit_body.php b/specialpages/BibManagerEdit_body.php index f248ad0..bfbaed5 100644 --- a/specialpages/BibManagerEdit_body.php +++ b/specialpages/BibManagerEdit_body.php @@ -101,9 +101,8 @@ wfRunHooks( 'BibManagerEditBeforeFormCreate', array ( $this, &$formDescriptor ) ); - $htmlForm = new HTMLForm( $formDescriptor, 'bm_edit' ); + $htmlForm = new HTMLForm( $formDescriptor, $this->getContext(), 'bm_edit' ); $htmlForm->setSubmitText( wfMsg( 'bm_edit_submit' ) ); - $htmlForm->setTitle( $this->getTitle() ); $htmlForm->setSubmitCallback( array ( $this, 'submitForm' ) ); //TODO: Add cancel button that returns user to the place he came from. I.e. filtered overview @@ -117,11 +116,11 @@ * @global OutputPage $wgOut * @global WebRequest $wgRequest * @param array $formData - * @return boolean + * @return boolean */ public function submitForm ( $formData ) { global $wgOut, $wgRequest; - + $repo = BibManagerRepository::singleton(); $typeDefs = BibManagerFieldsList::getTypeDefinitions(); $entryType = $wgRequest->getVal( 'bm_select_type', '' ); //Hidden fields are not included in $formData??? @@ -146,4 +145,4 @@ return true; } -} \ No newline at end of file +} diff --git a/specialpages/BibManagerImport_body.php b/specialpages/BibManagerImport_body.php index f2a4428..e4d9bff 100644 --- a/specialpages/BibManagerImport_body.php +++ b/specialpages/BibManagerImport_body.php @@ -32,9 +32,8 @@ 'rows' => 25 ); - $htmlForm = new HTMLForm( $formDescriptor, 'bm_edit' ); + $htmlForm = new HTMLForm( $formDescriptor, $this->getContext(), 'bm_edit' ); $htmlForm->setSubmitText( wfMsg( 'bm_edit_submit' ) ); - $htmlForm->setTitle( $this->getTitle() ); $htmlForm->setSubmitCallback( array ( $this, 'submitForm' ) ); $wgOut->addHTML( '<div id="bm_form">' ); @@ -46,7 +45,7 @@ * Submit callback for import form * @global OutputPage $wgOut * @param array $formData - * @return mixed true on success, array of error messages on failure + * @return mixed true on success, array of error messages on failure */ public function submitForm ( $formData ) { global $wgOut; @@ -55,7 +54,7 @@ $bibtex->setOption("extractAuthors", false); $bibtex->content = $formData['bm_bibtex']; $bibtex->parse(); - + $errors = array ( ); $repo = BibManagerRepository::singleton(); $cleanedEntries = array ( ); @@ -71,7 +70,7 @@ ); $submittedFields = array ( ); - + foreach ( $entry as $key => $value ) { if ( in_array( $key, $entryFields ) ) { $submittedFields['bm_' . $key] = $value; @@ -101,4 +100,4 @@ return true; } -} \ No newline at end of file +} diff --git a/specialpages/BibManagerList_body.php b/specialpages/BibManagerList_body.php index 9e5106b..3b95146 100644 --- a/specialpages/BibManagerList_body.php +++ b/specialpages/BibManagerList_body.php @@ -50,9 +50,8 @@ ) ); - $htmlForm = new HTMLForm( $formDescriptor, 'bm_list_search' ); + $htmlForm = new HTMLForm( $formDescriptor, $this->getContext(), 'bm_list_search' ); $htmlForm->setSubmitText( wfMsg( 'bm_list_search_submit' ) ); - $htmlForm->setTitle( $this->getTitle() ); $htmlForm->setSubmitCallback( array ( $this, 'submitForm' ) ); $htmlForm->show(); -- To view, visit https://gerrit.wikimedia.org/r/105955 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3f060734f739d6897715078aa7f049c7102dfdd2 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/BibManager Gerrit-Branch: master Gerrit-Owner: Siebrand <siebr...@wikimedia.org> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Robert Vogel <vo...@hallowelt.biz> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits