r63408 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63407‎ | r63408 | r63409 >
Date:19:16, 8 March 2010
Author:yaron
Status:deferred
Tags:
Comment:
Added handling for setting of display color from SCQ using SMW 1.5
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php
@@ -108,7 +108,12 @@
109109 if (count($dates) > 0) {
110110 // handle the 'color=' value, whether it came
111111 // from a compound query or a regular one
112 - if (property_exists($row[0], 'display_options')) {
 112+ // handling is different for SMW 1.5+
 113+ if (method_exists('SMWQueryResult', 'getResults')) {
 114+ $res_subject = $field->getResultSubject();
 115+ if (is_array($res_subject->display_options) && array_key_exists('color', $res_subject->display_options))
 116+ $color = $res_subject->display_options['color'];
 117+ } elseif (property_exists($row[0], 'display_options')) {
113118 if (is_array($row[0]->display_options) && array_key_exists('color', $row[0]->display_options))
114119 $color = $row[0]->display_options['color'];
115120 } elseif (array_key_exists('color', $this->m_params))
@@ -341,7 +346,7 @@
342347 list($event_title, $other_text, $event_date, $color) = $event;
343348 if ($event_date == $date_str) {
344349 if ($this->mTemplate != '') {
345 - $templatetext = '{{' . $this->mTemplate . $other_text .'|thisdate=' . $date_str . '}}';
 350+ $templatetext = '{{' . $this->mTemplate . $other_text . '|thisdate=' . $date_str . '}}';
346351 $templatetext = $wgParser->replaceVariables($templatetext);
347352 $templatetext = $wgParser->recursiveTagParse($templatetext);
348353 $text .= $templatetext;

Status & tagging log