Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -237,7 +237,7 @@ |
238 | 238 | $wgOut->setHTMLTitle( $this->subject->getTitle() ); |
239 | 239 | $html = "<table class=\"smwb-factbox\" cellpadding=\"0\" cellspacing=\"0\">\n" . |
240 | 240 | "<tr class=\"smwb-title\"><td colspan=\"2\">\n" . |
241 | | - $this->subject->getShortHTMLText( smwfGetLinker() ) . "\n" . |
| 241 | + $this->subject->getLongHTMLText( smwfGetLinker() ) . "\n" . |
242 | 242 | "</td></tr>\n</table>\n"; |
243 | 243 | |
244 | 244 | return $html; |
Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_WikiPage.php |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | if ( $value != '' ) { |
100 | 100 | if ( $value{0} == '#' ) { |
101 | 101 | if ( is_null( $this->m_contextPage ) ) { |
102 | | - $this->addError( wfMsgForContent( 'smw_notitle', $value ) ); |
| 102 | + $this->addError( wfMsgForContent( 'smw_notitle', $value ) ); |
103 | 103 | return; |
104 | 104 | } else { |
105 | 105 | $this->m_title = Title::makeTitle( $this->m_contextPage->getNamespace(), |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | $this->addError( wfMsgForContent( 'smw_wrong_namespace', |
119 | 119 | $wgContLang->getNsText( $this->m_fixNamespace ) ) ); |
120 | 120 | } else { |
121 | | - $this->m_fragment = $this->m_title->getFragment(); |
| 121 | + $this->m_fragment = str_replace( ' ', '_', $this->m_title->getFragment() ); |
122 | 122 | $this->m_prefixedtext = ''; |
123 | 123 | $this->m_id = -1; // unset id |
124 | 124 | $this->m_dataitem = SMWDIWikiPage::newFromTitle( $this->m_title, $this->m_typeid ); |
— | — | @@ -250,9 +250,9 @@ |
251 | 251 | // There should not be a linebreak after an impage, just like there is no linebreak after |
252 | 252 | // other values (whether formatted or not). |
253 | 253 | return '[[' . $this->getWikiLinkTarget() . '|' . |
254 | | - $this->getWikiValue() . '|frameless|border|text-top]]'; |
| 254 | + $this->getLongCaptionText() . '|frameless|border|text-top]]'; |
255 | 255 | } else { |
256 | | - return '[[:' . $this->getWikiLinkTarget() . '|' . $this->getWikiValue() . ']]'; |
| 256 | + return '[[:' . $this->getWikiLinkTarget() . '|' . $this->getLongCaptionText() . ']]'; |
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
— | — | @@ -276,10 +276,10 @@ |
277 | 277 | return htmlspecialchars( $this->getWikiValue() ); |
278 | 278 | } elseif ( $this->getNamespace() == NS_MEDIA ) { // this extra case is really needed |
279 | 279 | return $linker->makeMediaLinkObj( $this->getTitle(), |
280 | | - htmlspecialchars( $this->getWikiValue() ) ); |
| 280 | + htmlspecialchars( $this->getLongCaptionText() ) ); |
281 | 281 | } else { // all others use default linking, no embedding of images here |
282 | 282 | return $linker->makeLinkObj( $this->getTitle(), |
283 | | - htmlspecialchars( $this->getWikiValue() ) ); |
| 283 | + htmlspecialchars( $this->getLongCaptionText() ) ); |
284 | 284 | } |
285 | 285 | } |
286 | 286 | |
— | — | @@ -425,7 +425,7 @@ |
426 | 426 | * @return string |
427 | 427 | */ |
428 | 428 | protected function getShortCaptionText() { |
429 | | - if ( $this->m_fragment && $this->m_fragment{0} != '_' ) { |
| 429 | + if ( $this->m_fragment != '' && $this->m_fragment{0} != '_' ) { |
430 | 430 | $fragmentText = '#' . $this->m_fragment; |
431 | 431 | } else { |
432 | 432 | $fragmentText = ''; |
— | — | @@ -434,6 +434,25 @@ |
435 | 435 | } |
436 | 436 | |
437 | 437 | /** |
| 438 | + * Get a long caption used to label this value. In particular, this |
| 439 | + * includes namespace and interwiki prefixes, while fragments are only |
| 440 | + * included if they do not start with an underscore (used for generated |
| 441 | + * fragment names that are not helpful for users and that might change |
| 442 | + * easily). |
| 443 | + * |
| 444 | + * @since 1.7 |
| 445 | + * @return string |
| 446 | + */ |
| 447 | + protected function getLongCaptionText() { |
| 448 | + if ( $this->m_fragment && $this->m_fragment{0} != '_' ) { |
| 449 | + $fragmentText = '#' . $this->m_fragment; |
| 450 | + } else { |
| 451 | + $fragmentText = ''; |
| 452 | + } |
| 453 | + return ( $this->m_fixNamespace == NS_MAIN ? $this->getPrefixedText() : $this->getText() ) . $fragmentText; |
| 454 | + } |
| 455 | + |
| 456 | + /** |
438 | 457 | * Compute a text that can be used in wiki text to link to this |
439 | 458 | * datavalue. Processing includes some escaping and adding the |
440 | 459 | * fragment. |
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php |
— | — | @@ -157,7 +157,7 @@ |
158 | 158 | |
159 | 159 | // Property name |
160 | 160 | $searchlink = SMWInfolink::newBrowsingLink( '+', $dvWikiPage->getShortHTMLText() ); |
161 | | - $r .= '<tr><td class="smwpropname">' . $dvWikiPage->getLongHTMLText( smwfGetLinker() ) . |
| 161 | + $r .= '<tr><td class="smwpropname">' . $dvWikiPage->getShortHTMLText( smwfGetLinker() ) . |
162 | 162 | ' ' . $searchlink->getHTML( smwfGetLinker() ) . '</td><td class="smwprops">'; |
163 | 163 | |
164 | 164 | // Property values |
— | — | @@ -174,7 +174,7 @@ |
175 | 175 | |
176 | 176 | if ( $i < $smwgMaxPropertyValues + 1 ) { |
177 | 177 | $dv = SMWDataValueFactory::newDataItemValue( $di, $this->mProperty ); |
178 | | - $r .= $dv->getLongHTMLText( smwfGetLinker() ) . $dv->getInfolinkText( SMW_OUTPUT_HTML, smwfGetLinker() ); |
| 178 | + $r .= $dv->getShortHTMLText( smwfGetLinker() ) . $dv->getInfolinkText( SMW_OUTPUT_HTML, smwfGetLinker() ); |
179 | 179 | } else { |
180 | 180 | $searchlink = SMWInfolink::newInversePropertySearchLink( '…', $dvWikiPage->getWikiValue(), $this->mTitle->getText() ); |
181 | 181 | $r .= $searchlink->getHTML( smwfGetLinker() ); |