r98519 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98518‎ | r98519 | r98520 >
Date:14:38, 30 September 2011
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
follow up to r98488; fixing compat of calendar format
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/iCalendar/SRF_iCalendar.php
@@ -22,8 +22,8 @@
2323 protected function handleParameters( array $params, $outputmode ) {
2424 parent::handleParameters( $params, $outputmode );
2525
26 - $this->m_params = trim( $this->params['title'] );
27 - $this->m_description = trim( $this->params['icalendardescription'] );
 26+ $this->m_params = trim( $params['title'] );
 27+ $this->m_description = trim( $params['icalendardescription'] );
2828 }
2929
3030 public function getMimeType( $res ) {
Index: trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php
@@ -12,28 +12,21 @@
1313 */
1414 class SRFCalendar extends SMWResultPrinter {
1515
16 - protected $mTemplate = '';
17 - protected $mUserParam = '';
 16+ protected $mTemplate;
 17+ protected $mUserParam;
1818 protected $mRealUserLang = null;
1919
20 - protected function handleParameters( $params, $outputmode ) {
 20+ protected function handleParameters( array $params, $outputmode ) {
2121 parent::handleParameters( $params, $outputmode );
2222
23 - if ( array_key_exists( 'template', $params ) ) {
24 - $this->mTemplate = trim( $params['template'] );
25 - }
 23+ $this->mTemplate = trim( $params['template'] );
 24+ $this->mUserParam = trim( $params['userparam'] );
2625
27 - if ( array_key_exists( 'userparam', $params ) ) {
28 - $this->mUserParam = trim( $params['userparam'] );
29 - }
30 -
31 - if ( array_key_exists( 'lang', $params ) ) {
32 - global $wgLang;
33 - // store the actual user's language, so we can revert
34 - // back to it after printing the calendar
35 - $this->mRealUserLang = clone ( $wgLang );
36 - $wgLang = Language::factory( trim( $params['lang'] ) );
37 - }
 26+ global $wgLang;
 27+ // store the actual user's language, so we can revert
 28+ // back to it after printing the calendar
 29+ $this->mRealUserLang = clone ( $wgLang );
 30+ $wgLang = Language::factory( trim( $params['lang'] ) );
3831 }
3932
4033 public function getName() {
@@ -508,7 +501,16 @@
509502 */
510503 public function getParameters() {
511504 $params = parent::getParameters();
512 - $params[] = array( 'name' => 'lang', 'type' => 'string', 'description' => wfMsg( 'srf_paramdesc_calendarlang' ) );
 505+
 506+ $params['lang'] = new Parameter( 'lang' );
 507+ $params['lang']->setMessage( 'srf_paramdesc_calendarlang' );
 508+
 509+ $params['template'] = new Parameter( 'template' );
 510+ $params['template']->setDefault( '' );
 511+
 512+ $params['userparam'] = new Parameter( 'userparam' );
 513+ $params['userparam']->setDefault( '' );
 514+
513515 return $params;
514516 }
515517

Follow-up revisions

RevisionCommit summaryAuthorDate
r98526follow up to r98519jeroendedauw15:29, 30 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98488refactoring nessasery because of changes in r98036...dasch23:20, 29 September 2011

Comments

#Comment by DaSch (talk | contribs)   15:26, 30 September 2011

seams to me, that language handling was changed the way that it does not work correctly anymore BTW: when the calendar depends on the language set by the user and the parameter $srfgFirstDayOfWeek has to be set in the language the calendar is displayed this will fail when any user will change the language to another then the wikis language

And reporting that the value for $srfgFirstDayOfWeek is wrong is not supperessed although error_reporting is 0

#Comment by Jeroen De Dauw (talk | contribs)   15:30, 30 September 2011

Right. I should be more careful. Fixed in follow up.

Status & tagging log