Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | $offset = $wgRequest->getVal( 'offset' ); |
42 | 42 | if ('' == $offset) $offset = 0; |
43 | 43 | $mode = $wgRequest->getVal( 'mode' ); |
44 | | - if (('' == $mode) || ('in' == $mode) || (wfMsg('smw_browse_in') == $mode)) { $mode = 'in'; } else { $mode = 'out'; } |
| 44 | + if (('' == $mode) || ('out' == $mode)) { $mode = 'out'; } else { $mode = 'in'; } |
45 | 45 | $html = ''; |
46 | 46 | $spectitle = Title::makeTitle( NS_SPECIAL, 'SMWBrowse' ); |
47 | 47 | |
— | — | @@ -48,9 +48,8 @@ |
49 | 49 | $html .= '<form name="smwbrowse" action="' . $spectitle->escapeLocalURL() . '" method="get">' . "\n"; |
50 | 50 | $html .= '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '"/>' ; |
51 | 51 | $html .= wfMsg('smw_browse_article') . "<br />\n"; |
52 | | - $html .= '<input type="submit" name="mode" value="' . wfMsg('smw_browse_in') .'"/>'."\n"; |
53 | 52 | $html .= '<input type="text" name="article" value="' . htmlspecialchars($articletext) . '" />' . "\n"; |
54 | | - $html .= '<input type="submit" name="mode" value="' . wfMsg('smw_browse_out') . "\"/>\n</form>\n"; |
| 53 | + $html .= '<input type="submit" value="' . wfMsg('smw_browse_go') . "\"/>\n</form>\n"; |
55 | 54 | |
56 | 55 | if ('' == $articletext) { // empty, no article name given |
57 | 56 | $html .= wfMsg('smw_browse_docu') . "\n"; |
— | — | @@ -65,61 +64,45 @@ |
66 | 65 | |
67 | 66 | // prepare navigation bar |
68 | 67 | if ($offset > 0) |
69 | | - $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . '&article=' . urlencode($articletext) )) . '">' . wfMsg('smw_result_prev') . '</a>'; |
| 68 | + $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse','offset=' . max(0,$offset-$limit) . '&article=' . urlencode($articletext) )) . '&mode=in">' . wfMsg('smw_result_prev') . '</a>'; |
70 | 69 | else |
71 | 70 | $navigation = wfMsg('smw_result_prev'); |
72 | 71 | |
73 | 72 | $navigation .= ' <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '– ' . ($offset + min(count($results), $limit)) . '</b> '; |
74 | 73 | |
75 | 74 | if (count($results)==($limit+1)) |
76 | | - $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse', 'offset=' . ($offset+$limit) . '&limit=' . $limit . '&article=' . urlencode($articletext) )) . '">' . wfMsg('smw_result_next') . '</a>'; |
| 75 | + $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse', 'offset=' . ($offset+$limit) . '&article=' . urlencode($articletext) )) . '&mode=in">' . wfMsg('smw_result_next') . '</a>'; |
77 | 76 | else |
78 | 77 | $navigation .= wfMsg('smw_result_next'); |
79 | 78 | |
80 | | - $max = false; $first=true; |
81 | | - foreach (array(10,20,50,100,200) as $l) { |
82 | | - if ($max) continue; |
83 | | - if ($first) { |
84 | | - $navigation .= ' ('; |
85 | | - $first = false; |
86 | | - } else |
87 | | - $navigation .= ' | '; |
88 | | - if ($l > $smwgIQMaxLimit) { |
89 | | - $l = $smwgIQMaxLimit; |
90 | | - $max = true; |
91 | | - } |
92 | | - if ( $limit != $l ) { |
93 | | - $navigation .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse','offset=' . $offset . '&limit=' . $l . '&article=' . urlencode($articletext) )) . '">' . $l . '</a>'; |
94 | | - } else { |
95 | | - $navigation .= '<b>' . $l . '</b>'; |
96 | | - } |
97 | | - } |
98 | | - $navigation .= ')'; |
99 | | - |
100 | | - // no need to show the navigation bars when there is not enough to navigate |
101 | | - if (($offset>0) || (count($results)>$limit)) |
102 | | - $html .= '<br />' . $navigation; |
103 | 79 | if (count($results) == 0) { |
104 | 80 | $html .= wfMsg( 'smw_browse_noin', $skin->makeSpecialUrl('SMWBrowse', 'article=' . urlencode($articletext) . '&mode=out' )); |
105 | 81 | } else { |
106 | | - $html .= '<table style="width: 100%; ">' . "\n"; |
| 82 | + $html .= 'See all <a href="' . $skin->makeSpecialUrl('SMWBrowse', 'mode=out&article=' . urlencode($articletext)) . '">outgoing links of ' . $article->getText() . "</a><br /><br />\n"; // TODO |
| 83 | + // no need to show the navigation bars when there is not enough to navigate |
| 84 | + if (($offset>0) || (count($results)>$limit)) |
| 85 | + $html .= $navigation; |
| 86 | + $html .= '<table style="width: 100%; "><tr><td colspan="2"><hr /></td></tr>' . "\n"; |
107 | 87 | foreach ($results as $result) { |
108 | 88 | $innerlimit = 6; |
109 | 89 | $subjectoptions = new SMWRequestOptions(); |
110 | 90 | $subjectoptions->limit = $innerlimit; |
111 | | - $html .= '<tr><td class="smwattname">' . "\n"; |
| 91 | + $html .= '<tr><td class="smwsubjects">' . "\n"; |
112 | 92 | $subjects = &smwfGetStore()->getRelationSubjects($result, $article, $subjectoptions); |
113 | | - $more = (count($subjects) == $innerlimit); |
| 93 | + $subjectcount = count($subjects); |
| 94 | + $more = ($subjectcount == $innerlimit); |
114 | 95 | $innercount = 0; |
115 | 96 | foreach ($subjects as $subject) { |
116 | 97 | $innercount += 1; |
117 | 98 | if (($innercount < $innerlimit) || !$more) { |
118 | | - $html .= $skin->makeKnownLinkObj($subject) . ' <span class="smwsearch"><a href="' . $skin->makeSpecialUrl('SMWBrowse', 'article=' . urlencode($subject->getText())) . '">+</a></span>' . "<br />\n"; |
| 99 | + $subjectlink = SMWInfolink::newBrowsingLink('+',$subject->getText(), FALSE); |
| 100 | + $html .= $skin->makeKnownLinkObj($subject) . ' ' . $subjectlink->getHTML($skin); |
| 101 | + if ($innercount<$subjectcount) $html .= ", \n"; |
119 | 102 | } else { |
120 | 103 | $html .= '<a href="' . $skin->makeSpecialUrl('SearchByRelation', 'type=' . urlencode($result->getText()) . '&target=' . urlencode($article->getText())) . '">' . wfMsg("smw_browse_more") . "</a><br />\n"; |
121 | 104 | } |
122 | 105 | } |
123 | | - $html .= '</td><td class="smwatts">' . $skin->makeLinkObj($result, $result->getText()) . " " . $skin->makeLinkObj($article) . "</td></tr>\n"; |
| 106 | + $html .= '</td><td class="smwrelright">' . $skin->makeLinkObj($result, $result->getText()) . " " . $article->getText() . '</td></tr><tr><td colspan="2"><hr /></td></tr>' . "\n"; |
124 | 107 | } |
125 | 108 | $html .= "</table>\n"; |
126 | 109 | } |
— | — | @@ -127,52 +110,14 @@ |
128 | 111 | $html .= $navigation; |
129 | 112 | } else { // outgoing links |
130 | 113 | $options = new SMWRequestOptions(); |
131 | | - $options->limit = $limit+1; |
132 | | - $options->offset = $offset; |
133 | | - // get results (get one more, to see if we have to add a link to more) |
134 | 114 | $results = &smwfGetStore()->getOutRelations($article, $options); |
135 | 115 | |
136 | 116 | $html .= "<p> </p>\n" . wfMsg('smw_browse_displayout', $skin->makeLinkObj($article)) . "<br />\n"; |
137 | 117 | |
138 | | - // prepare navigation bar |
139 | | - if ($offset > 0) |
140 | | - $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . '&article=' . urlencode($articletext) )) . '">' . wfMsg('smw_result_prev') . '</a>'; |
141 | | - else |
142 | | - $navigation = wfMsg('smw_result_prev'); |
143 | | - |
144 | | - $navigation .= ' <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '– ' . ($offset + min(count($results), $limit)) . '</b> '; |
145 | | - |
146 | | - if (count($results)==($limit+1)) |
147 | | - $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse', 'offset=' . ($offset+$limit) . '&limit=' . $limit . '&article=' . urlencode($articletext) )) . '">' . wfMsg('smw_result_next') . '</a>'; |
148 | | - else |
149 | | - $navigation .= wfMsg('smw_result_next'); |
150 | | - |
151 | | - $max = false; $first=true; |
152 | | - foreach (array(10,20,50,100,200) as $l) { |
153 | | - if ($max) continue; |
154 | | - if ($first) { |
155 | | - $navigation .= ' ('; |
156 | | - $first = false; |
157 | | - } else |
158 | | - $navigation .= ' | '; |
159 | | - if ($l > $smwgIQMaxLimit) { |
160 | | - $l = $smwgIQMaxLimit; |
161 | | - $max = true; |
162 | | - } |
163 | | - if ( $limit != $l ) { |
164 | | - $navigation .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SMWBrowse','offset=' . $offset . '&limit=' . $l . '&article=' . urlencode($articletext) )) . '">' . $l . '</a>'; |
165 | | - } else { |
166 | | - $navigation .= '<b>' . $l . '</b>'; |
167 | | - } |
168 | | - } |
169 | | - $navigation .= ')'; |
170 | | - |
171 | | - // no need to show the navigation bars when there is not enough to navigate |
172 | | - if (($offset>0) || (count($results)>$limit)) |
173 | | - $html .= '<br />' . $navigation; |
174 | 118 | if (count($results) == 0) { |
175 | 119 | $html .= wfMsg( 'smw_browse_noout', $skin->makeSpecialUrl('SMWBrowse', 'article=' . urlencode($articletext) . '&mode=in' )); |
176 | 120 | } else { |
| 121 | + $html .= 'See all <a href="' . $skin->makeSpecialUrl('SMWBrowse', 'mode=in&article=' . urlencode($articletext)) . '">incoming links of ' . $article->getText() . "</a><br /><br />\n"; // TODO |
177 | 122 | $html .= '<table style="width: 100%; ">' . "\n"; |
178 | 123 | foreach ($results as $result) { |
179 | 124 | $objectoptions = new SMWRequestOptions(); |
— | — | @@ -181,14 +126,13 @@ |
182 | 127 | $html .= '</td><td class="smwatts">' . "\n"; |
183 | 128 | $objects = &smwfGetStore()->getRelationObjects($article, $result, $objectoptions); |
184 | 129 | foreach ($objects as $object) { |
185 | | - $html .= $skin->makeLinkObj($object) . ' <span class="smwsearch"><a href="' . $skin->makeSpecialUrl('SMWBrowse', 'article=' . urlencode($object->getText()) . '&mode=out') . '">+</a></span>' . "<br />\n"; |
| 130 | + $searchlink = SMWInfolink::newBrowsingLink('+',$object->getText()); |
| 131 | + $html .= $skin->makeLinkObj($object) . $searchlink->getHTML($skin) . "<br />\n"; |
186 | 132 | } |
187 | 133 | $html .= "</td></tr>\n"; |
188 | 134 | } |
189 | 135 | $html .= "</table>\n"; |
190 | 136 | } |
191 | | - if (($offset>0) || (count($results)>$limit)) |
192 | | - $html .= $navigation; |
193 | 137 | } |
194 | 138 | |
195 | 139 | $wgOut->addHTML($html); |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_LanguageEn.php |
— | — | @@ -184,6 +184,7 @@ |
185 | 185 | // Messages for the browsing system |
186 | 186 | 'smwbrowse' => 'Browse article', |
187 | 187 | 'smw_browse_article' => 'Enter the name of the article to start browsing from.', |
| 188 | + 'smw_browse_go' => 'Go', |
188 | 189 | 'smw_browse_in' => 'Incoming', |
189 | 190 | 'smw_browse_out' => 'Outgoing', |
190 | 191 | 'smw_browse_docu' => '<p>Search for all properties of the given article.</p>', |
Index: trunk/extensions/SemanticMediaWiki/skins/SMW_custom.css |
— | — | @@ -83,6 +83,17 @@ |
84 | 84 | padding-right: 1em; |
85 | 85 | } |
86 | 86 | |
| 87 | +td.smwsubjects{ |
| 88 | + text-align: right; |
| 89 | + vertical-align: top; |
| 90 | + padding-right: 1em; |
| 91 | + width: 65%; |
| 92 | +} |
| 93 | + |
| 94 | +td.swmrelright{ |
| 95 | + vertical-align: middle; |
| 96 | +} |
| 97 | + |
87 | 98 | td.smwrels, td.smwatts, td.smwspecs{ |
88 | 99 | vertical-align: top; |
89 | 100 | width: 75%; |
— | — | @@ -154,7 +165,7 @@ |
155 | 166 | padding-right: 20px; |
156 | 167 | color: #888888; |
157 | 168 | background: url(rdf_flyer.18.gif) center right no-repeat; |
158 | | - |
| 169 | + |
159 | 170 | } |
160 | 171 | |
161 | 172 | #bodyContent span.rdflink a:hover{ |