Index: trunk/extensions/SemanticResultFormats/Math/SRF_Math.php |
— | — | @@ -93,8 +93,6 @@ |
94 | 94 | * |
95 | 95 | * @param SMWDataValue $dataValue |
96 | 96 | * @param array $numbers |
97 | | - * |
98 | | - * @return array |
99 | 97 | */ |
100 | 98 | public static function addNumbersForDataValue( SMWDataValue $dataValue, array &$numbers ) { |
101 | 99 | // Make use of instanceof instead of getTypeId so that deriving classes will get handled as well. |
— | — | @@ -123,13 +121,11 @@ |
124 | 122 | * |
125 | 123 | * @param SMWDataItem $dataItem |
126 | 124 | * @param array $numbers |
127 | | - * |
128 | | - * @return array |
129 | 125 | */ |
130 | 126 | public static function addNumbersForDataItem( SMWDataItem $dataItem, array &$numbers ) { |
131 | 127 | switch ( $dataItem->getDIType() ) { |
132 | | - case SMWDataItem::TYPE_NUMBER: /* case SMWDataItem::TYPE_WIKIPAGE: */ |
133 | | - $numbers[] = /* !method_exists( $dataItem, 'getNumber' ) ? $dataItem->getDBkey() : */ $dataItem->getNumber(); |
| 128 | + case SMWDataItem::TYPE_NUMBER: |
| 129 | + $numbers[] = $dataItem->getNumber(); |
134 | 130 | break; |
135 | 131 | case SMWDataItem::TYPE_CONTAINER: |
136 | 132 | foreach ( $dataItem->getDataItems() as $di ) { |
Index: trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php |
— | — | @@ -6,6 +6,8 @@ |
7 | 7 | * @ingroup SemanticResultFormats |
8 | 8 | * |
9 | 9 | * @author Markus Krötzsch |
| 10 | + * |
| 11 | + * FIXME: this code is just insane; rewrite from 0 is probably the only way to get it right |
10 | 12 | */ |
11 | 13 | |
12 | 14 | /** |
— | — | @@ -90,9 +92,9 @@ |
91 | 93 | } |
92 | 94 | |
93 | 95 | // print header |
94 | | - $link = $res->getQueryLink( wfMsgForContent( 'smw_iq_altresults' ) ); |
| 96 | + $link = $res->getQueryLink( wfMsgForContent( 'srf-timeline-allresults' ) ); |
95 | 97 | $result = "<div class=\"smwtimeline\" id=\"smwtimeline$smwgIQRunningNumber\" style=\"height: $this->m_tlsize\">"; |
96 | | - $result .= '<span class="smwtlcomment">' . wfMsgForContent( 'smw_iq_nojs' ) . ' ' . $link->getText( $outputmode, $this->mLinker ) . '</span>'; // note for people without JavaScript |
| 98 | + $result .= '<span class="smwtlcomment">' . wfMsgForContent( 'srf-timeline-nojs' ) . ' ' . $link->getText( $outputmode, $this->mLinker ) . '</span>'; // note for people without JavaScript |
97 | 99 | |
98 | 100 | foreach ( $this->m_tlbands as $band ) { |
99 | 101 | $result .= '<span class="smwtlband" style="display:none;">' . htmlspecialchars( $band ) . '</span>'; |
— | — | @@ -154,6 +156,8 @@ |
155 | 157 | * @return string |
156 | 158 | */ |
157 | 159 | protected function getEventsHTML( SMWQueryResult $res, $outputmode, $isEventline ) { |
| 160 | + global $curarticle, $cururl; // why not, code flow has reached max insanity already |
| 161 | + |
158 | 162 | $positions = array(); // possible positions, collected to select one for centering |
159 | 163 | $curcolor = 0; // color cycling is used for eventline |
160 | 164 | |
— | — | @@ -167,6 +171,7 @@ |
168 | 172 | $hastitle = false; // true as soon as some label for the event was found |
169 | 173 | $curdata = ''; // current *inner* print data (within some event span) |
170 | 174 | $curmeta = ''; // current event meta data |
| 175 | + $cururl = ''; |
171 | 176 | $curarticle = ''; // label of current article, if it was found; needed only for eventline labeling |
172 | 177 | $first_col = true; |
173 | 178 | |
— | — | @@ -223,7 +228,7 @@ |
224 | 229 | |
225 | 230 | if ( $isEventline ) { |
226 | 231 | foreach ( $events as $event ) { |
227 | | - $result .= '<span class="smwtlevent" style="display:none;" ><span class="smwtlstart">' . $event[0] . '</span><span class="smwtlurl">' . $event[1] . '</span><span class="smwtlcoloricon">' . $curcolor . '</span>'; |
| 232 | + $result .= '<span class="smwtlevent" style="display:none;" ><span class="smwtlstart">' . $event[0] . '</span><span class="smwtlurl">' . str_replace( ' ', '_', $curarticle ) . '</span><span class="smwtlcoloricon">' . $curcolor . '</span>'; |
228 | 233 | if ( $curarticle != '' ) $result .= '<span class="smwtlprefix">' . $curarticle . ' </span>'; |
229 | 234 | $result .= $curdata . '</span>'; |
230 | 235 | $positions[$event[2]] = $event[0]; |
— | — | @@ -279,6 +284,7 @@ |
280 | 285 | */ |
281 | 286 | protected function handlePropertyValue( SMWDataValue $object, $outputmode, SMWPrintRequest $pr, $first_col, |
282 | 287 | &$hastitle, &$hastime, $first_value, $isEventline, &$curmeta, &$curdata, $date_value, &$output, array &$positions ) { |
| 288 | + global $curarticle, $cururl; |
283 | 289 | |
284 | 290 | $event = false; |
285 | 291 | |
— | — | @@ -339,10 +345,12 @@ |
340 | 346 | $objectlabel |
341 | 347 | ); |
342 | 348 | |
343 | | - if ( ( $pr->getMode() == SMWPrintRequest::PRINT_THIS ) ) { |
344 | | - // NOTE: type Title of $object implied |
345 | | - $curarticle = $object->getLongWikiText(); |
| 349 | + if ( $pr->getMode() == SMWPrintRequest::PRINT_THIS ) { |
| 350 | + $curarticle = $object->getShortText( $outputmode, false ); |
| 351 | + $cururl = $object->getTitle()->getFullUrl(); |
346 | 352 | } |
| 353 | + |
| 354 | + // NOTE: type Title of $object implied |
347 | 355 | $hastitle = true; |
348 | 356 | } |
349 | 357 | } elseif ( $output ) { |
— | — | @@ -358,7 +366,7 @@ |
359 | 367 | if ( $isEventline && ( $pr->getMode() == SMWPrintRequest::PRINT_PROP ) && ( $pr->getTypeID() == '_dat' ) && ( '' != $pr->getLabel() ) && ( $date_value != $this->m_tlstart ) && ( $date_value != $this->m_tlend ) ) { |
360 | 368 | // SMW >= 1.6 |
361 | 369 | if ( method_exists ( $object, 'getDataItem' ) ) { |
362 | | - $numericValue = $object->getDataItem()->getForCalendarModel( SMWDITime::CM_GREGORIAN ); |
| 370 | + $numericValue = $object->getDataItem()->getSortKey(); |
363 | 371 | } // SMW 1.5.x |
364 | 372 | elseif ( method_exists ( $object, 'getValueKey' ) ) { |
365 | 373 | $numericValue = $object->getValueKey(); |
— | — | @@ -370,10 +378,10 @@ |
371 | 379 | $event = array( |
372 | 380 | $object->getXMLSchemaDate(), |
373 | 381 | $pr->getLabel(), |
374 | | - $numericValue |
| 382 | + $numericValue, |
375 | 383 | ); |
376 | 384 | } |
377 | | - |
| 385 | + |
378 | 386 | return $event; |
379 | 387 | } |
380 | 388 | |
Index: trunk/extensions/SemanticResultFormats/SRF_Messages.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | 'srf_printername_min' => 'Minimum number', |
49 | 49 | 'srf_paramdesc_limit' => 'The maximum number of pages to query', |
50 | 50 | 'srf_printername_product' => 'Product of numbers', |
51 | | - // format "timeline" |
| 51 | + // formats "timeline" and "eventline" |
52 | 52 | 'srf_printername_timeline' => 'Timeline', |
53 | 53 | 'srf_printername_eventline' => 'Eventline', |
54 | 54 | 'srf_paramdesc_timelinebands' => 'Defines which bands are displayed in the result.', |
— | — | @@ -55,6 +55,8 @@ |
56 | 56 | 'srf_paramdesc_timelinestart' => 'A property name used to define a first time point', |
57 | 57 | 'srf_paramdesc_timelineend' => 'A property name used to define a second time point', |
58 | 58 | 'srf_paramdesc_timelinesize' => 'The height of the timeline (default is 300px)', |
| 59 | + 'srf-timeline-allresults' => 'Further results for this query.', |
| 60 | + 'srf-timeline-nojs' => 'You need to have JavaScript enabled to view the interactive timeline.', |
59 | 61 | |
60 | 62 | // format "Exhibit" |
61 | 63 | 'srf_paramdesc_views' => 'The views to be displayed', |