r96815 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96814‎ | r96815 | r96816 >
Date:22:10, 11 September 2011
Author:jeroendedauw
Status:ok (Comments)
Tags:
Comment:
navigation++
Modified paths:
  • /trunk/extensions/Survey/Survey.i18n.php (modified) (history)
  • /trunk/extensions/Survey/specials/SpecialSurvey.php (modified) (history)
  • /trunk/extensions/Survey/specials/SpecialSurveyPage.php (modified) (history)
  • /trunk/extensions/Survey/specials/SpecialSurveyStats.php (modified) (history)
  • /trunk/extensions/Survey/specials/SpecialTakeSurvey.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/Survey.i18n.php
@@ -47,6 +47,7 @@
4848 'survey-navigation-edit' => '[[Special:Survey/$1|Edit this survey]]',
4949 'survey-navigation-take' => '[[Special:TakeSurvey/$1|Take this survey]]',
5050 'survey-navigation-list' => '[[Special:Surveys|Surveys list]]',
 51+ 'survey-navigation-stats' => '[[Special:SurveyStats/$1|View statistics]]',
5152
5253 // Special:Surveys
5354 'surveys-special-addnew' => 'Add a new survey',
Index: trunk/extensions/Survey/specials/SpecialSurveyPage.php
@@ -106,4 +106,15 @@
107107 );
108108 }
109109
 110+ /**
 111+ * Display navigation links.
 112+ *
 113+ * @since 0.1
 114+ *
 115+ * @param array $links
 116+ */
 117+ protected function displayNavigation( array $links ) {
 118+ $this->getOutput()->addHTML( Html::rawElement( 'p', array(), implode( ' - ', $links ) ) );
 119+ }
 120+
110121 }
Index: trunk/extensions/Survey/specials/SpecialSurveyStats.php
@@ -39,7 +39,13 @@
4040
4141 if ( Survey::has( array( 'name' => $subPage ) ) ) {
4242 $survey = Survey::newFromName( $subPage );
43 - $this->displayNavigation( $survey );
 43+
 44+ $this->displayNavigation( array(
 45+ wfMsgExt( 'survey-navigation-edit', 'parseinline', $survey->getField( 'name' ) ),
 46+ wfMsgExt( 'survey-navigation-take', 'parseinline', $survey->getField( 'name' ) ),
 47+ wfMsgExt( 'survey-navigation-list', 'parseinline' )
 48+ ) );
 49+
4450 $this->displayStats( $survey );
4551 }
4652 else {
@@ -49,23 +55,6 @@
5056 }
5157
5258 /**
53 - * Display links to edit and take the survey.
54 - *
55 - * @since 0.1
56 - *
57 - * @param Survey $survey
58 - */
59 - protected function displayNavigation( Survey $survey ) {
60 - $links = array(
61 - wfMsgExt( 'survey-navigation-edit', 'parseinline', $survey->getField( 'name' ) ),
62 - wfMsgExt( 'survey-navigation-take', 'parseinline', $survey->getField( 'name' ) ),
63 - wfMsgExt( 'survey-navigation-list', 'parseinline' )
64 - );
65 -
66 - $this->getOutput()->addHTML( Html::rawElement( 'p', array(), implode( ' - ', $links ) ) );
67 - }
68 -
69 - /**
7059 * Display the statistics that go with the survey.
7160 *
7261 * @since 0.1
Index: trunk/extensions/Survey/specials/SpecialSurvey.php
@@ -47,6 +47,13 @@
4848 if ( $survey === false ) {
4949 $survey = new Survey( array( 'name' => $subPage ), true );
5050 }
 51+ else {
 52+ $this->displayNavigation( array(
 53+ wfMsgExt( 'survey-navigation-take', 'parseinline', $subPage ),
 54+ wfMsgExt( 'survey-navigation-stats', 'parseinline', $subPage ),
 55+ wfMsgExt( 'survey-navigation-list', 'parseinline' )
 56+ ) );
 57+ }
5158
5259 $this->showSurvey( $survey );
5360 $this->addModules( 'ext.survey.special.survey' );
Index: trunk/extensions/Survey/specials/SpecialTakeSurvey.php
@@ -62,6 +62,12 @@
6363 * @param string $subPage
6464 */
6565 protected function displaySurvey( $subPage ) {
 66+ $this->displayNavigation( array(
 67+ wfMsgExt( 'survey-navigation-edit', 'parseinline', $subPage ),
 68+ wfMsgExt( 'survey-navigation-stats', 'parseinline', $subPage ),
 69+ wfMsgExt( 'survey-navigation-list', 'parseinline' )
 70+ ) );
 71+
6672 $this->getOutput()->addWikiText( Xml::element(
6773 'survey',
6874 array(

Follow-up revisions

RevisionCommit summaryAuthorDate
r96818Follow up to r96815;jeroendedauw22:49, 11 September 2011

Comments

#Comment by Krinkle (talk | contribs)   22:13, 11 September 2011
+	protected function displayNavigation( array $links ) {
+		$this->getOutput()->addHTML( Html::rawElement( 'p', array(), implode( ' - ', $links ) ) );
+	}

Perhaps use Language->pipeList() instead ? Using dash as separator in navigation is uncommon in MediaWiki.

#Comment by Jeroen De Dauw (talk | contribs)   22:49, 11 September 2011

Cool, applied in follow up :)

Status & tagging log