Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -257,17 +257,7 @@ |
258 | 258 | * Return error message or empty string if no error occurred. |
259 | 259 | */ |
260 | 260 | public function getErrorString() { |
261 | | - $result = ''; |
262 | | - $first = true; |
263 | | - foreach ($this->m_errors as $e) { |
264 | | - if ($first) { |
265 | | - $first = false; |
266 | | - } else { |
267 | | - $result .= ', '; |
268 | | - } |
269 | | - $result .= '<span class="smwwarning">' . $e . '</span>'; |
270 | | - } |
271 | | - return $result; |
| 261 | + return smwfEncodeMessages($this->m_errors); |
272 | 262 | } |
273 | 263 | |
274 | 264 | /** |
— | — | @@ -639,7 +629,7 @@ |
640 | 630 | // TODO: needs extension for n-ary values |
641 | 631 | $dv = SMWDataValueFactory::newAttributeObjectValue($att, $value); |
642 | 632 | if (!$dv->isValid()) { |
643 | | - $this->m_errors[] = $dv->getError(); |
| 633 | + $this->m_errors = $this->m_errors + $dv->getErrors(); |
644 | 634 | $vd = new SMWValueDescription($dv, SMW_CMP_ANY); |
645 | 635 | } else { |
646 | 636 | $vd = new SMWValueDescription($dv, $comparator); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php |
— | — | @@ -209,12 +209,7 @@ |
210 | 210 | * an empty string if no errors happened. |
211 | 211 | */ |
212 | 212 | public function getErrorText() { |
213 | | - if (count($this->m_errors) > 0) { |
214 | | - $errors = implode(', ', $this->m_errors); |
215 | | - return '<span class="smwttpersist"><span class="smwtticon">warning.png</span><span class="smwttcontent">' . $errors . '</span></span>'; |
216 | | - } else { |
217 | | - return ''; |
218 | | - } |
| 213 | + return smwfEncodeMessages($this->m_errors); |
219 | 214 | } |
220 | 215 | |
221 | 216 | /** |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php |
— | — | @@ -373,6 +373,18 @@ |
374 | 374 | } |
375 | 375 | |
376 | 376 | /** |
| 377 | + * Formats an array of message strings so that it appears as a tooltip. |
| 378 | + */ |
| 379 | + function smwfEncodeMessages($msgarray) { |
| 380 | + if (count($msgarray) > 0) { |
| 381 | + $msgs = implode(', ', $msgarray); |
| 382 | + return '<span class="smwttpersist"><span class="smwtticon">warning.png</span><span class="smwttcontent">' . $msgs . '</span></span>'; |
| 383 | + } else { |
| 384 | + return ''; |
| 385 | + } |
| 386 | + } |
| 387 | + |
| 388 | + /** |
377 | 389 | * Initialise storage objects based on user settings. Called once during init. |
378 | 390 | */ |
379 | 391 | function smwfInitStore() { |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinters.php |
— | — | @@ -116,20 +116,7 @@ |
117 | 117 | * TODO: use joined code for this and the similar method in SMWQueryParser? |
118 | 118 | */ |
119 | 119 | protected function getErrorString($res) { |
120 | | - $result = ''; |
121 | | - $first = true; |
122 | | - foreach ($res->getErrors() as $e) { |
123 | | - if ($first) { |
124 | | - $first = false; |
125 | | - } else { |
126 | | - $result .= ', '; |
127 | | - } |
128 | | - $result .= '<span class="smwwarning">' . $e . '</span>'; |
129 | | - } |
130 | | - if ($result != '') { |
131 | | - $result = '(' . $result . ')'; |
132 | | - } |
133 | | - return $result; |
| 120 | + return smwfEncodeMessages($res->getErrors()); |
134 | 121 | } |
135 | 122 | |
136 | 123 | |