Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -59,17 +59,29 @@ |
60 | 60 | reset( $params ); |
61 | 61 | $this->articletext = current( $params ); |
62 | 62 | } |
| 63 | + |
63 | 64 | $this->subject = SMWDataValueFactory::newTypeIDValue( '_wpg', $this->articletext ); |
64 | 65 | $offsettext = $wgRequest->getVal( 'offset' ); |
65 | 66 | $this->offset = ( is_null( $offsettext ) ) ? 0 : intval( $offsettext ); |
| 67 | + |
66 | 68 | $dir = $wgRequest->getVal( 'dir' ); |
| 69 | + |
67 | 70 | if ( $smwgBrowseShowAll ) { |
68 | 71 | $this->showoutgoing = true; |
69 | 72 | $this->showincoming = true; |
70 | 73 | } |
71 | | - if ( ( $dir == 'both' ) || ( $dir == 'in' ) ) $this->showincoming = true; |
72 | | - if ( $dir == 'in' ) $this->showoutgoing = false; |
73 | | - if ( $dir == 'out' ) $this->showincoming = false; |
| 74 | + |
| 75 | + if ( $dir === 'both' || $dir === 'in' ) { |
| 76 | + $this->showincoming = true; |
| 77 | + } |
| 78 | + |
| 79 | + if ( $dir === 'in' ) { |
| 80 | + $this->showoutgoing = false; |
| 81 | + } |
| 82 | + |
| 83 | + if ( $dir === 'out' ) { |
| 84 | + $this->showincoming = false; |
| 85 | + } |
74 | 86 | |
75 | 87 | $wgOut->addHTML( $this->displayBrowse() ); |
76 | 88 | SMWOutputs::commitToOutputPage( $wgOut ); // make sure locally collected output data is pushed to the output! |
— | — | @@ -85,15 +97,18 @@ |
86 | 98 | global $wgContLang, $wgOut; |
87 | 99 | $html = "\n"; |
88 | 100 | $leftside = !( $wgContLang->isRTL() ); // For right to left languages, all is mirrored |
| 101 | + |
89 | 102 | if ( $this->subject->isValid() ) { |
90 | 103 | $wgOut->addStyle( '../extensions/SemanticMediaWiki/skins/SMW_custom.css' ); |
91 | 104 | |
92 | 105 | $html .= $this->displayHead(); |
| 106 | + |
93 | 107 | if ( $this->showoutgoing ) { |
94 | 108 | $data = smwfGetStore()->getSemanticData( $this->subject->getDataItem() ); |
95 | 109 | $html .= $this->displayData( $data, $leftside ); |
96 | 110 | $html .= $this->displayCenter(); |
97 | 111 | } |
| 112 | + |
98 | 113 | if ( $this->showincoming ) { |
99 | 114 | list( $indata, $more ) = $this->getInData(); |
100 | 115 | global $smwgBrowseShowInverse; |
— | — | @@ -103,10 +118,17 @@ |
104 | 119 | } |
105 | 120 | |
106 | 121 | $this->articletext = $this->subject->getWikiValue(); |
| 122 | + |
107 | 123 | // Add a bit space between the factbox and the query form |
108 | | - if ( !$this->including() ) $html .= "<p>   </p>\n"; |
| 124 | + if ( !$this->including() ) { |
| 125 | + $html .= "<p>   </p>\n"; |
| 126 | + } |
109 | 127 | } |
110 | | - if ( !$this->including() ) $html .= $this->queryForm(); |
| 128 | + |
| 129 | + if ( !$this->including() ) { |
| 130 | + $html .= $this->queryForm(); |
| 131 | + } |
| 132 | + |
111 | 133 | $wgOut->addHTML( $html ); |
112 | 134 | } |
113 | 135 | |
— | — | @@ -294,16 +316,16 @@ |
295 | 317 | * @return string HTML with the link to this page |
296 | 318 | */ |
297 | 319 | private function linkHere( $text, $out, $in, $offset ) { |
298 | | - $dir = $out ? ( $in ? 'both' : 'out' ) : 'in'; |
299 | 320 | $frag = ( $text == wfMsg( 'smw_browse_show_incoming' ) ) ? '#smw_browse_incoming' : ''; |
300 | 321 | |
301 | 322 | return Html::element( |
302 | 323 | 'a', |
303 | 324 | array( |
304 | 325 | 'href' => SpecialPage::getSafeTitleFor( 'Browse' )->getLocalURL( array( |
305 | | - 'offset' => "{$offset}&dir={$dir}", |
306 | | - 'article' => $this->subject->getLongWikiText() . $frag |
307 | | - ) ) |
| 326 | + 'offset' => $offset, |
| 327 | + 'dir' => $out ? ( $in ? 'both' : 'out' ) : 'in', |
| 328 | + 'article' => $this->subject->getLongWikiText() |
| 329 | + ) ) . $frag |
308 | 330 | ), |
309 | 331 | $text |
310 | 332 | ); |