Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_ConceptPage.php |
— | — | @@ -14,10 +14,10 @@ |
15 | 15 | * @ingroup SMW |
16 | 16 | */ |
17 | 17 | class SMWConceptPage extends SMWOrderedListPage { |
18 | | - protected $m_errors; |
19 | 18 | |
20 | 19 | /** |
21 | | - * Use higher limit. This operation is very similar to showing members of categories. |
| 20 | + * Initialiye parameters to use a higher limit. This operation is very |
| 21 | + * similar to showing members of categories. |
22 | 22 | */ |
23 | 23 | protected function initParameters() { |
24 | 24 | global $smwgConceptPagingLimit; |
— | — | @@ -26,74 +26,46 @@ |
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
30 | | - * Fill the internal arrays with the list of wiki page data items to be |
31 | | - * displayed (possibly plus one additional article that indicates |
32 | | - * further results). |
| 30 | + * Returns the HTML which is added to $wgOut after the article text. |
| 31 | + * |
| 32 | + * @return string |
33 | 33 | */ |
34 | | - protected function doQuery() { |
| 34 | + protected function getHtml() { |
| 35 | + wfProfileIn( __METHOD__ . ' (SMW)' ); |
| 36 | + |
35 | 37 | if ( $this->limit > 0 ) { |
36 | 38 | $store = smwfGetStore(); |
37 | | - $thisDiWikiPage = SMWDIWikiPage::newFromTitle( $this->mTitle ); |
38 | | - $desc = new SMWConceptDescription( $thisDiWikiPage ); |
39 | | - |
40 | | - if ( $this->from != '' ) { |
41 | | - $diWikiPage = new SMWDIWikiPage( $this->from, NS_MAIN, '' ); // make a dummy wiki page as boundary |
42 | | - $fromdesc = new SMWValueDescription( $diWikiPage, null, SMW_CMP_GEQ ); |
43 | | - $desc = new SMWConjunction( array( $desc, $fromdesc ) ); |
44 | | - $order = 'ASC'; |
45 | | - } elseif ( $this->until != '' ) { |
46 | | - $diWikiPage = new SMWDIWikiPage( $this->until, NS_MAIN, '' ); // make a dummy wiki page as boundary |
47 | | - $fromdesc = new SMWValueDescription( $diWikiPage, null, SMW_CMP_LEQ ); |
48 | | - $neqdesc = new SMWValueDescription( $diWikiPage, null, SMW_CMP_NEQ ); // do not include boundary in this case |
49 | | - $desc = new SMWConjunction( array( $desc, $fromdesc, $neqdesc ) ); |
50 | | - $order = 'DESC'; |
51 | | - } else { |
52 | | - $order = 'ASC'; |
53 | | - } |
54 | | - |
55 | | - $desc->addPrintRequest( new SMWPrintRequest( SMWPrintRequest::PRINT_THIS, '' ) ); |
56 | | - $query = new SMWQuery( $desc ); |
57 | | - $query->sortkeys[''] = $order; |
58 | | - $query->setLimit( $this->limit + 1 ); |
| 39 | + $description = new SMWConceptDescription( $this->getDataItem() ); |
| 40 | + $query = SMWPageLister::getQuery( $description, $this->limit, $this->from, $this->until ); |
| 41 | + $queryResult = $store->getQueryResult( $query ); |
59 | 42 | |
60 | | - $result = $store->getQueryResult( $query ); |
61 | | - $row = $result->getNext(); |
62 | | - |
63 | | - while ( $row !== false ) { |
64 | | - $this->diWikiPages[] = end( $row )->getNextDataItem(); |
65 | | - $row = $result->getNext(); |
| 43 | + $diWikiPages = $queryResult->getResults(); |
| 44 | + if ($this->until != '' ) { |
| 45 | + $diWikiPages = array_reverse( $diWikiPages ); |
66 | 46 | } |
67 | | - |
68 | | - if ( $order == 'DESC' ) { |
69 | | - $this->diWikiPages = array_reverse( $this->diWikiPages ); |
70 | | - } |
71 | | - |
72 | | - $this->m_errors = $query->getErrors(); |
| 47 | + |
| 48 | + $errors = $queryResult->getErrors(); |
73 | 49 | } else { |
74 | | - $this->diWikiPages = array(); |
75 | | - $this->errors = array(); |
| 50 | + $diWikiPages = array(); |
| 51 | + $errors = array(); |
76 | 52 | } |
77 | | - } |
78 | 53 | |
79 | | - /** |
80 | | - * Generates the headline for the page list and the HTML encoded list of pages which |
81 | | - * shall be shown. |
82 | | - */ |
83 | | - protected function getPages() { |
84 | | - wfProfileIn( __METHOD__ . ' (SMW)' ); |
85 | 54 | smwfLoadExtensionMessages( 'SemanticMediaWiki' ); |
86 | | - $r = ''; |
87 | | - $ti = htmlspecialchars( $this->mTitle->getText() ); |
88 | | - $nav = $this->getNavigationLinks(); |
89 | | - $r .= '<a name="SMWResults"></a>' . $nav . "<div id=\"mw-pages\">\n"; |
| 55 | + $pageLister = new SMWPageLister( $diWikiPages, null, $this->getSkin(), $this->limit, $this->from, $this->until ); |
| 56 | + $this->mTitle->setFragment( '#SMWResults' ); // Make navigation point to the result list. |
| 57 | + $navigation = $pageLister->getNavigationLinks( $this->mTitle ); |
90 | 58 | |
91 | | - $r .= '<h2>' . wfMsg( 'smw_concept_header', $ti ) . "</h2>\n"; |
92 | | - $r .= wfMsgExt( 'smw_conceptarticlecount', array( 'parsemag' ), min( $this->limit, count( $this->diWikiPages ) ) ) . smwfEncodeMessages( $this->m_errors ) . "\n"; |
| 59 | + $titleText = htmlspecialchars( $this->mTitle->getText() ); |
| 60 | + $resultNumber = min( $this->limit, count( $diWikiPages ) ); |
93 | 61 | |
94 | | - $r .= $this->formatList(); |
95 | | - $r .= "\n</div>" . $nav; |
| 62 | + $result = "<a name=\"SMWResults\"></a><div id=\"mw-pages\">\n" . |
| 63 | + '<h2>' . wfMsg( 'smw_concept_header', $titleText ) . "</h2>\n" . |
| 64 | + wfMsgExt( 'smw_conceptarticlecount', array( 'parsemag' ), $resultNumber ) . |
| 65 | + smwfEncodeMessages( $errors ) . "\n" . |
| 66 | + $navigation . $pageLister->formatList() . $navigation . "</div>\n"; |
| 67 | + |
96 | 68 | wfProfileOut( __METHOD__ . ' (SMW)' ); |
97 | | - return $r; |
| 69 | + return $result; |
98 | 70 | } |
99 | 71 | |
100 | 72 | /** |
— | — | @@ -103,28 +75,28 @@ |
104 | 76 | * @param int $cutoff |
105 | 77 | * @return string |
106 | 78 | */ |
107 | | - private function formatList( $cutoff = 6 ) { |
108 | | - $end = count( $this->diWikiPages ); |
109 | | - |
110 | | - if ( $end > $this->limit ) { |
111 | | - if ( $this->until != '' ) { |
112 | | - $start = 1; |
113 | | - } else { |
114 | | - $start = 0; |
115 | | - $end --; |
116 | | - } |
117 | | - } else { |
118 | | - $start = 0; |
119 | | - } |
| 79 | +// private function formatList( $cutoff = 6 ) { |
| 80 | +// $end = count( $this->diWikiPages ); |
| 81 | +// |
| 82 | +// if ( $end > $this->limit ) { |
| 83 | +// if ( $this->until != '' ) { |
| 84 | +// $start = 1; |
| 85 | +// } else { |
| 86 | +// $start = 0; |
| 87 | +// $end --; |
| 88 | +// } |
| 89 | +// } else { |
| 90 | +// $start = 0; |
| 91 | +// } |
| 92 | +// |
| 93 | +// if ( count ( $this->diWikiPages ) > $cutoff ) { |
| 94 | +// return $this->columnList( $start, $end, $this->diWikiPages ); |
| 95 | +// } elseif ( count( $this->diWikiPages ) > 0 ) { |
| 96 | +// return $this->shortList( $start, $end, $this->diWikiPages ); |
| 97 | +// } else { |
| 98 | +// return ''; |
| 99 | +// } |
| 100 | +// } |
120 | 101 | |
121 | | - if ( count ( $this->diWikiPages ) > $cutoff ) { |
122 | | - return $this->columnList( $start, $end, $this->diWikiPages ); |
123 | | - } elseif ( count( $this->diWikiPages ) > 0 ) { |
124 | | - return $this->shortList( $start, $end, $this->diWikiPages ); |
125 | | - } else { |
126 | | - return ''; |
127 | | - } |
128 | | - } |
129 | | - |
130 | 102 | } |
131 | 103 | |
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_OrderedListPage.php |
— | — | @@ -2,12 +2,9 @@ |
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Abstract subclass of MediaWiki's Article that handles the common tasks of |
6 | | - * article pages for Types and Properties. Mostly, it implements general processing |
7 | | - * and the generation of suitable navigation links from results sets and HTTP |
8 | | - * parameters. |
9 | | - * |
10 | | - * Some code adapted from CategoryPage.php |
11 | | - * |
| 6 | + * article pages for Concept and Property pages. This is mainly parameter |
| 7 | + * handling and some very basic output control. |
| 8 | + * |
12 | 9 | * @file SMW_OrderedListPage.php |
13 | 10 | * @ingroup SMW |
14 | 11 | * |
— | — | @@ -37,14 +34,6 @@ |
38 | 35 | * @var string |
39 | 36 | */ |
40 | 37 | protected $until; |
41 | | - |
42 | | - /** |
43 | | - * Array of SMWDIWikiPage objects for which information is printed |
44 | | - * (primary ordering method). |
45 | | - * |
46 | | - * @var array of SMWDIWikiPage |
47 | | - */ |
48 | | - protected $diWikiPages; |
49 | 38 | |
50 | 39 | /** |
51 | 40 | * Cache for the current skin, obtained from $wgUser. |
— | — | @@ -61,37 +50,36 @@ |
62 | 51 | protected $mProperty = null; |
63 | 52 | |
64 | 53 | /** |
65 | | - * Overwrite view() from Article.php to add additional html to the output. |
| 54 | + * Overwrite view() from Article.php to add additional HTML to the |
| 55 | + * output. |
66 | 56 | */ |
67 | 57 | public function view() { |
68 | 58 | global $wgRequest, $wgUser; |
69 | 59 | |
| 60 | + parent::view(); |
| 61 | + |
70 | 62 | // Copied from CategoryPage |
71 | 63 | $diff = $wgRequest->getVal( 'diff' ); |
72 | 64 | $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) ); |
73 | | - |
74 | | - if ( isset( $diff ) && $diffOnly ) { |
75 | | - return Article::view(); |
| 65 | + if ( !isset( $diff ) || !$diffOnly ) { |
| 66 | + $this->showList(); |
76 | 67 | } |
77 | | - |
78 | | - Article::view(); |
79 | | - $this->showList(); |
80 | 68 | } |
81 | 69 | |
82 | 70 | /** |
83 | | - * Main method for addig all additional HTML to the output stream. |
| 71 | + * Main method for adding all additional HTML to the output stream. |
84 | 72 | */ |
85 | 73 | protected function showList() { |
86 | | - wfProfileIn( __METHOD__ . ' (SMW)' ); |
87 | | - |
88 | 74 | global $wgOut, $wgRequest; |
89 | 75 | |
| 76 | + wfProfileIn( __METHOD__ . ' (SMW)' ); |
| 77 | + |
90 | 78 | $this->from = $wgRequest->getVal( 'from' ); |
91 | 79 | $this->until = $wgRequest->getVal( 'until' ); |
92 | 80 | |
93 | 81 | if ( $this->initParameters() ) { |
94 | | - $wgOut->addHTML( $this->getHTML() ); |
95 | | - SMWOutputs::commitToOutputPage( $wgOut ); // Flush required CSS to output |
| 82 | + $wgOut->addHTML( "<br id=\"smwfootbr\"/>\n" . $this->getHtml() ); |
| 83 | + SMWOutputs::commitToOutputPage( $wgOut ); |
96 | 84 | } |
97 | 85 | |
98 | 86 | wfProfileOut( __METHOD__ . ' (SMW)' ); |
— | — | @@ -111,86 +99,13 @@ |
112 | 100 | } |
113 | 101 | |
114 | 102 | /** |
115 | | - * Returns HTML which is added to wgOut. |
| 103 | + * Returns the HTML which is added to $wgOut after the article text. |
116 | 104 | * |
117 | 105 | * @return string |
118 | 106 | */ |
119 | | - protected function getHTML() { |
120 | | - $this->clearPageState(); |
121 | | - $this->doQuery(); |
122 | | - $r = "<br id=\"smwfootbr\"/>\n" . $this->getPages(); |
| 107 | + protected abstract function getHtml(); |
123 | 108 | |
124 | | - return $r; |
125 | | - } |
126 | | - |
127 | 109 | /** |
128 | | - * Initialise internal data structures. |
129 | | - */ |
130 | | - protected function clearPageState() { |
131 | | - $this->diWikiPages = array(); |
132 | | - } |
133 | | - |
134 | | - /** |
135 | | - * Execute the DB query and fill the diWikiPages array. |
136 | | - * Implemented by subclasses. |
137 | | - */ |
138 | | - protected abstract function doQuery(); |
139 | | - |
140 | | - /** |
141 | | - * Generates the headline for the page list and the HTML encoded list of pages which |
142 | | - * shall be shown. |
143 | | - */ |
144 | | - protected abstract function getPages(); |
145 | | - |
146 | | - /** |
147 | | - * Generates the prev/next link part to the HTML code of the top and bottom section of the page. |
148 | | - */ |
149 | | - protected function getNavigationLinks( $query = array() ) { |
150 | | - global $wgLang; |
151 | | - |
152 | | - $sk = $this->getSkin(); |
153 | | - $limitText = $wgLang->formatNum( $this->limit ); |
154 | | - |
155 | | - $ac = count( $this->diWikiPages ); |
156 | | - |
157 | | - if ( $this->until != '' ) { |
158 | | - if ( $ac > $this->limit ) { // (we assume that limit is at least 1) |
159 | | - $first = smwfGetStore()->getWikiPageSortKey( $this->diWikiPages[1] ); |
160 | | - } else { |
161 | | - $first = ''; |
162 | | - } |
163 | | - |
164 | | - $last = $this->until; |
165 | | - } elseif ( ( $ac > $this->limit ) || ( $this->from != '' ) ) { |
166 | | - $first = $this->from; |
167 | | - |
168 | | - if ( $ac > $this->limit ) { |
169 | | - $last = smwfGetStore()->getWikiPageSortKey( $this->diWikiPages[$ac - 1] ); |
170 | | - } else { |
171 | | - $last = ''; |
172 | | - } |
173 | | - } else { |
174 | | - return ''; |
175 | | - } |
176 | | - |
177 | | - $prevLink = htmlspecialchars( wfMsg( 'prevn', $limitText ) ); |
178 | | - $this->mTitle->setFragment( '#SMWResults' ); // Make navigation point to the result list. |
179 | | - |
180 | | - if ( $first != '' ) { |
181 | | - $prevLink = $sk->makeLinkObj( $this->mTitle, $prevLink, |
182 | | - wfArrayToCGI( $query + array( 'until' => $first ) ) ); |
183 | | - } |
184 | | - $nextLink = htmlspecialchars( wfMsg( 'nextn', $limitText ) ); |
185 | | - |
186 | | - if ( $last != '' ) { |
187 | | - $nextLink = $sk->makeLinkObj( $this->mTitle, $nextLink, |
188 | | - wfArrayToCGI( $query + array( 'from' => $last ) ) ); |
189 | | - } |
190 | | - |
191 | | - return "($prevLink) ($nextLink)"; |
192 | | - } |
193 | | - |
194 | | - /** |
195 | 110 | * Fetch and return the relevant skin object. |
196 | 111 | * |
197 | 112 | * @return Skin |
— | — | @@ -209,114 +124,7 @@ |
210 | 125 | * @return SMWDIWikiPage |
211 | 126 | */ |
212 | 127 | protected function getDataItem() { |
213 | | - $title = $this->getTitle(); |
214 | | - return new SMWDIWikiPage( $title->getDBKey(), $title->getNamespace(), $title->getInterwiki() ); |
| 128 | + return SMWDIWikiPage::newFromTitle( $this->getTitle() ); |
215 | 129 | } |
216 | 130 | |
217 | | - /** |
218 | | - * Format a list of SMWDIWikiPage objects chunked by letter in a three-column |
219 | | - * list, ordered vertically. |
220 | | - * |
221 | | - * @param $start integer |
222 | | - * @param $end integer |
223 | | - * @param $diWikiPages of SMWDIWikiPage |
224 | | - * |
225 | | - * @return string |
226 | | - */ |
227 | | - protected function columnList( $start, $end, $diWikiPages ) { |
228 | | - global $wgContLang; |
229 | | - |
230 | | - // Divide list into three equal chunks. |
231 | | - $chunk = (int) ( ( $end - $start + 1 ) / 3 ); |
232 | | - |
233 | | - // Get and display header. |
234 | | - $r = '<table width="100%"><tr valign="top">'; |
235 | | - |
236 | | - $prevStartChar = 'none'; |
237 | | - |
238 | | - // Loop through the chunks. |
239 | | - for ( $startChunk = $start, $endChunk = $chunk, $chunkIndex = 0; |
240 | | - $chunkIndex < 3; |
241 | | - ++$chunkIndex, $startChunk = $endChunk, $endChunk += $chunk + 1 ) { |
242 | | - $r .= "<td>\n"; |
243 | | - $atColumnTop = true; |
244 | | - |
245 | | - // output all diWikiPages |
246 | | - for ( $index = $startChunk ; $index < $endChunk && $index < $end; ++$index ) { |
247 | | - $dataValue = SMWDataValueFactory::newDataItemValue( $diWikiPages[$index], $this->mProperty ); |
248 | | - // check for change of starting letter or begining of chunk |
249 | | - $sortkey = smwfGetStore()->getWikiPageSortKey( $diWikiPages[$index] ); |
250 | | - $startChar = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) ); |
251 | | - |
252 | | - if ( ( $index == $startChunk ) || |
253 | | - ( $startChar != $prevStartChar ) ) { |
254 | | - if ( $atColumnTop ) { |
255 | | - $atColumnTop = false; |
256 | | - } else { |
257 | | - $r .= "</ul>\n"; |
258 | | - } |
259 | | - |
260 | | - if ( $startChar == $prevStartChar ) { |
261 | | - $cont_msg = ' ' . wfMsgHtml( 'listingcontinuesabbrev' ); |
262 | | - } else { |
263 | | - $cont_msg = ''; |
264 | | - } |
265 | | - |
266 | | - $r .= "<h3>" . htmlspecialchars( $startChar ) . $cont_msg . "</h3>\n<ul>"; |
267 | | - |
268 | | - $prevStartChar = $startChar; |
269 | | - } |
270 | | - |
271 | | - $r .= "<li>" . $dataValue->getLongHTMLText( $this->getSkin() ) . "</li>\n"; |
272 | | - } |
273 | | - |
274 | | - if ( !$atColumnTop ) { |
275 | | - $r .= "</ul>\n"; |
276 | | - } |
277 | | - |
278 | | - $r .= "</td>\n"; |
279 | | - } |
280 | | - |
281 | | - $r .= '</tr></table>'; |
282 | | - |
283 | | - return $r; |
284 | | - } |
285 | | - |
286 | | - /** |
287 | | - * Format a list of diWikiPages chunked by letter in a bullet list. |
288 | | - * |
289 | | - * @param $start integer |
290 | | - * @param $end integer |
291 | | - * @param $diWikiPages array of SMWDataItem |
292 | | - * |
293 | | - * @return string |
294 | | - */ |
295 | | - protected function shortList( $start, $end, array $diWikiPages ) { |
296 | | - global $wgContLang; |
297 | | - |
298 | | - $startDv = SMWDataValueFactory::newDataItemValue( $diWikiPages[$start], $this->mProperty ); |
299 | | - $sortkey = smwfGetStore()->getWikiPageSortKey( $diWikiPages[$start] ); |
300 | | - $startChar = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) ); |
301 | | - $r = '<h3>' . htmlspecialchars( $startChar ) . "</h3>\n" . |
302 | | - '<ul><li>' . $startDv->getLongHTMLText( $this->getSkin() ) . '</li>'; |
303 | | - |
304 | | - $prevStartChar = $startChar; |
305 | | - for ( $index = $start + 1; $index < $end; $index++ ) { |
306 | | - $dataValue = SMWDataValueFactory::newDataItemValue( $diWikiPages[$index], $this->mProperty ); |
307 | | - $sortkey = smwfGetStore()->getWikiPageSortKey( $diWikiPages[$index] ); |
308 | | - $startChar = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) ); |
309 | | - |
310 | | - if ( $startChar != $prevStartChar ) { |
311 | | - $r .= "</ul><h3>" . htmlspecialchars( $startChar ) . "</h3>\n<ul>"; |
312 | | - $prevStartChar = $startChar; |
313 | | - } |
314 | | - |
315 | | - $r .= '<li>' . $dataValue->getLongHTMLText( $this->getSkin() ) . '</li>'; |
316 | | - } |
317 | | - |
318 | | - $r .= '</ul>'; |
319 | | - |
320 | | - return $r; |
321 | | - } |
322 | | - |
323 | | -} |
\ No newline at end of file |
| 131 | +} |
Index: trunk/extensions/SemanticMediaWiki/includes/articlepages/SMW_PropertyPage.php |
— | — | @@ -4,8 +4,6 @@ |
5 | 5 | * Implementation of MediaWiki's Article that shows additional information on |
6 | 6 | * property pages. Very similar to CategoryPage, but with different printout |
7 | 7 | * that also displays values for each subject with the given property. |
8 | | - * |
9 | | - * Some code based on CategoryPage.php |
10 | 8 | * |
11 | 9 | * @file SMW_PropertyPage.php |
12 | 10 | * @ingroup SMW |
— | — | @@ -14,8 +12,6 @@ |
15 | 13 | */ |
16 | 14 | class SMWPropertyPage extends SMWOrderedListPage { |
17 | 15 | |
18 | | - private $subproperties; // list of sub-properties of this property |
19 | | - |
20 | 16 | /** |
21 | 17 | * @see SMWOrderedListPage::initParameters() |
22 | 18 | * @note We use a smaller limit here; property pages might become large. |
— | — | @@ -27,105 +23,113 @@ |
28 | 24 | return true; |
29 | 25 | } |
30 | 26 | |
31 | | - protected function clearPageState() { |
32 | | - parent::clearPageState(); |
33 | | - $this->subproperties = array(); |
| 27 | + /** |
| 28 | + * Returns the HTML which is added to $wgOut after the article text. |
| 29 | + * |
| 30 | + * @return string |
| 31 | + */ |
| 32 | + protected function getHtml() { |
| 33 | + wfProfileIn( __METHOD__ . ' (SMW)' ); |
| 34 | + smwfLoadExtensionMessages( 'SemanticMediaWiki' ); |
| 35 | + |
| 36 | + $result = $this->getSubpropertyList() . $this->getPropertyValueList(); |
| 37 | + |
| 38 | + wfProfileOut( __METHOD__ . ' (SMW)' ); |
| 39 | + return $result; |
34 | 40 | } |
35 | 41 | |
36 | 42 | /** |
37 | | - * Fill the internal arrays with the set of data items to be displayed |
38 | | - * (possibly plus one additional item that indicates further results). |
| 43 | + * Get the HTML for displaying subproperties of this property. This list |
| 44 | + * is usually short and we implement no additional navigation. |
| 45 | + * |
| 46 | + * @return string |
39 | 47 | */ |
40 | | - protected function doQuery() { |
| 48 | + protected function getSubpropertyList() { |
41 | 49 | $store = smwfGetStore(); |
42 | | - |
43 | | - if ( $this->limit > 0 ) { // for limit==0 there is no paging, and no query |
44 | | - $options = new SMWRequestOptions(); |
45 | | - $options->limit = $this->limit + 1; |
46 | | - $options->sort = true; |
47 | | - $reverse = false; |
48 | | - |
49 | | - if ( $this->from != '' ) { |
50 | | - $options->boundary = $this->from; |
51 | | - $options->ascending = true; |
52 | | - $options->include_boundary = true; |
53 | | - } elseif ( $this->until != '' ) { |
54 | | - $options->boundary = $this->until; |
55 | | - $options->ascending = false; |
56 | | - $options->include_boundary = false; |
57 | | - $reverse = true; |
| 50 | + $options = new SMWRequestOptions(); |
| 51 | + $options->sort = true; |
| 52 | + $options->ascending = true; |
| 53 | + $subproperties = $store->getPropertySubjects( new SMWDIProperty( '_SUBP' ), $this->getDataItem(), $options ); |
| 54 | + |
| 55 | + $result = ''; |
| 56 | + |
| 57 | + $resultCount = count( $subproperties ); |
| 58 | + if ( $resultCount > 0 ) { |
| 59 | + $titleText = htmlspecialchars( $this->mTitle->getText() ); |
| 60 | + $result .= "<div id=\"mw-subcategories\">\n<h2>" . wfMsg( 'smw_subproperty_header', $titleText ) . "</h2>\n<p>"; |
| 61 | + |
| 62 | + if ( !$this->mProperty->isUserDefined() ) { |
| 63 | + $result .= wfMsg( 'smw_isspecprop' ) . ' '; |
58 | 64 | } |
| 65 | + |
| 66 | + $result .= wfMsgExt( 'smw_subpropertyarticlecount', array( 'parsemag' ), $resultCount ) . "</p>\n"; |
59 | 67 | |
60 | | - $this->diWikiPages = $store->getAllPropertySubjects( $this->mProperty, $options ); |
61 | | - |
62 | | - if ( $reverse ) { |
63 | | - $this->diWikiPages = array_reverse( $this->diWikiPages ); |
| 68 | + if ( $resultCount < 6 ) { |
| 69 | + $result .= SMWPageLister::getShortList( 0, $resultCount, $subproperties, null, $this->getSkin() ); |
| 70 | + } else { |
| 71 | + $result .= SMWPageLister::getColumnList( 0, $resultCount, $subproperties, null, $this->getSkin() ); |
64 | 72 | } |
65 | | - } else { |
66 | | - $this->diWikiPages = array(); |
| 73 | + |
| 74 | + $result .= "\n</div>"; |
67 | 75 | } |
68 | 76 | |
69 | | - // retrieve all subproperties of this property |
70 | | - $s_options = new SMWRequestOptions(); |
71 | | - $s_options->sort = true; |
72 | | - $s_options->ascending = true; |
73 | | - $this->subproperties = $store->getPropertySubjects( new SMWDIProperty( '_SUBP' ), $this->getDataItem(), $s_options ); |
| 77 | + return $result; |
74 | 78 | } |
75 | 79 | |
76 | 80 | /** |
77 | | - * Generates the headline for the page list and the HTML encoded list |
78 | | - * of pages which shall be shown. |
| 81 | + * Get the HTML for displaying values of this property, based on the |
| 82 | + * current from/until and limit settings. |
| 83 | + * |
| 84 | + * @return string |
79 | 85 | */ |
80 | | - protected function getPages() { |
81 | | - wfProfileIn( __METHOD__ . ' (SMW)' ); |
82 | | - smwfLoadExtensionMessages( 'SemanticMediaWiki' ); |
83 | | - $r = ''; |
84 | | - $ti = htmlspecialchars( $this->mTitle->getText() ); |
85 | | - |
86 | | - if ( count( $this->subproperties ) > 0 ) { |
87 | | - $r .= "<div id=\"mw-subcategories\">\n<h2>" . wfMsg( 'smw_subproperty_header', $ti ) . "</h2>\n<p>"; |
88 | | - |
89 | | - if ( !$this->mProperty->isUserDefined() ) { |
90 | | - $r .= wfMsg( 'smw_isspecprop' ) . ' '; |
| 86 | + protected function getPropertyValueList() { |
| 87 | + if ( $this->limit > 0 ) { // for limit==0 there is no paging, and no query |
| 88 | + $store = smwfGetStore(); |
| 89 | + $options = SMWPageLister::getRequestOptions( $this->limit, $this->from, $this->until ); |
| 90 | + $diWikiPages = $store->getAllPropertySubjects( $this->mProperty, $options ); |
| 91 | + |
| 92 | + if ( !$options->ascending ) { |
| 93 | + $diWikiPages = array_reverse( $diWikiPages ); |
91 | 94 | } |
92 | | - |
93 | | - $r .= wfMsgExt( 'smw_subpropertyarticlecount', array( 'parsemag' ), count( $this->subproperties ) ) . "</p>\n"; |
94 | | - $r .= ( count( $this->subproperties ) < 6 ) ? |
95 | | - $this->shortList( 0, count( $this->subproperties ), $this->subproperties ): |
96 | | - $this->columnList( 0, count( $this->subproperties ), $this->subproperties ); |
97 | | - |
98 | | - $r .= "\n</div>"; |
| 95 | + } else { |
| 96 | + return ''; |
99 | 97 | } |
100 | | - |
101 | | - if ( count( $this->diWikiPages ) > 0 ) { |
102 | | - $nav = $this->getNavigationLinks(); |
103 | | - |
104 | | - $r .= '<a name="SMWResults"></a>' . $nav . "<div id=\"mw-pages\">\n" . |
105 | | - '<h2>' . wfMsg( 'smw_attribute_header', $ti ) . "</h2>\n<p>"; |
106 | | - |
| 98 | + |
| 99 | + $result = ''; |
| 100 | + |
| 101 | + if ( count( $diWikiPages ) > 0 ) { |
| 102 | + $pageLister = new SMWPageLister( $diWikiPages, null, $this->getSkin(), $this->limit, $this->from, $this->until ); |
| 103 | + $this->mTitle->setFragment( '#SMWResults' ); // Make navigation point to the result list. |
| 104 | + $navigation = $pageLister->getNavigationLinks( $this->mTitle ); |
| 105 | + |
| 106 | + $titleText = htmlspecialchars( $this->mTitle->getText() ); |
| 107 | + $resultNumber = min( $this->limit, count( $diWikiPages ) ); |
| 108 | + |
| 109 | + $result .= "<a name=\"SMWResults\"></a><div id=\"mw-pages\">\n" . |
| 110 | + '<h2>' . wfMsg( 'smw_attribute_header', $titleText ) . "</h2>\n<p>"; |
107 | 111 | if ( !$this->mProperty->isUserDefined() ) { |
108 | | - $r .= wfMsg( 'smw_isspecprop' ) . ' '; |
| 112 | + $result .= wfMsg( 'smw_isspecprop' ) . ' '; |
109 | 113 | } |
110 | | - |
111 | | - $r .= wfMsgExt( 'smw_attributearticlecount', array( 'parsemag' ), min( $this->limit, count( $this->diWikiPages ) ) ) . "</p>\n" . |
112 | | - $this->subjectObjectList() . "\n</div>" . $nav; |
| 114 | + $result .= wfMsgExt( 'smw_attributearticlecount', array( 'parsemag' ), $resultNumber ) . "</p>\n" . |
| 115 | + $navigation . $this->subjectObjectList( $diWikiPages ) . $navigation . "\n</div>"; |
113 | 116 | } |
114 | | - |
115 | | - wfProfileOut( __METHOD__ . ' (SMW)' ); |
116 | | - |
117 | | - return $r; |
| 117 | + |
| 118 | + return $result; |
118 | 119 | } |
119 | 120 | |
120 | 121 | /** |
121 | 122 | * Format $diWikiPages chunked by letter in a table that shows subject |
122 | 123 | * articles in one column and object articles/values in the other one. |
| 124 | + * |
| 125 | + * @param $diWikiPages array |
| 126 | + * @return string |
123 | 127 | */ |
124 | | - private function subjectObjectList() { |
| 128 | + protected function subjectObjectList( array $diWikiPages ) { |
125 | 129 | global $wgContLang, $smwgMaxPropertyValues; |
126 | 130 | $store = smwfGetStore(); |
127 | 131 | |
128 | | - $ac = count( $this->diWikiPages ); |
129 | | - |
| 132 | + $ac = count( $diWikiPages ); |
| 133 | + |
130 | 134 | if ( $ac > $this->limit ) { |
131 | 135 | if ( $this->until != '' ) { |
132 | 136 | $start = 1; |
— | — | @@ -139,19 +143,19 @@ |
140 | 144 | |
141 | 145 | $r = '<table style="width: 100%; ">'; |
142 | 146 | $prev_start_char = 'None'; |
143 | | - |
| 147 | + |
144 | 148 | for ( $index = $start; $index < $ac; $index++ ) { |
145 | | - $diWikiPage = $this->diWikiPages[$index]; |
| 149 | + $diWikiPage = $diWikiPages[$index]; |
146 | 150 | $dvWikiPage = SMWDataValueFactory::newDataItemValue( $diWikiPage, null ); |
147 | 151 | $sortkey = smwfGetStore()->getWikiPageSortKey( $diWikiPage ); |
148 | 152 | $start_char = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) ); |
149 | | - |
| 153 | + |
150 | 154 | // Header for index letters |
151 | 155 | if ( $start_char != $prev_start_char ) { |
152 | 156 | $r .= '<tr><th class="smwpropname"><h3>' . htmlspecialchars( $start_char ) . "</h3></th><th></th></tr>\n"; |
153 | 157 | $prev_start_char = $start_char; |
154 | 158 | } |
155 | | - |
| 159 | + |
156 | 160 | // Property name |
157 | 161 | $searchlink = SMWInfolink::newBrowsingLink( '+', $dvWikiPage->getShortHTMLText() ); |
158 | 162 | $r .= '<tr><td class="smwpropname">' . $dvWikiPage->getLongHTMLText( $this->getSkin() ) . |
— | — | @@ -180,9 +184,9 @@ |
181 | 185 | |
182 | 186 | $r .= "</td></tr>\n"; |
183 | 187 | } |
184 | | - |
| 188 | + |
185 | 189 | $r .= '</table>'; |
186 | | - |
| 190 | + |
187 | 191 | return $r; |
188 | 192 | } |
189 | 193 | |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_PageLister.php |
— | — | @@ -0,0 +1,312 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Helper class to generate HTML lists of wiki pages, with support for paged |
| 6 | + * navigation using the from/until and limit settings as in MediaWiki's |
| 7 | + * CategoryPage. |
| 8 | + * |
| 9 | + * The class attempts to allow as much code as possible to be shared among |
| 10 | + * different places where similar lists are used. |
| 11 | + * |
| 12 | + * Some code adapted from CategoryPage.php |
| 13 | + * |
| 14 | + * @file SMW_OrderedListPage.php |
| 15 | + * @ingroup SMW |
| 16 | + * |
| 17 | + * @author Nikolas Iwan |
| 18 | + * @author Markus Krötzsch |
| 19 | + * @author Jeroen De Dauw |
| 20 | + */ |
| 21 | +class SMWPageLister { |
| 22 | + |
| 23 | + protected $mDiWikiPages; |
| 24 | + protected $mDiProperty; |
| 25 | + protected $mSkin; |
| 26 | + protected $mLimit; |
| 27 | + protected $mFrom; |
| 28 | + protected $mUntil; |
| 29 | + |
| 30 | + /** |
| 31 | + * Constructor |
| 32 | + * |
| 33 | + * @param $diWikiPages array of SMWDIWikiPage |
| 34 | + * @param $diProperty mixed SMWDIProperty that the wikipages are values of, or null |
| 35 | + * @param $skin Skin object to use for making links |
| 36 | + * @param $limit integer maximal amount of items to display |
| 37 | + * @param $from string if the results were selected starting from this string |
| 38 | + * @param $until string if the results were selected reaching until this string |
| 39 | + */ |
| 40 | + public function __construct( array $diWikiPages, $diProperty, $skin, $limit, $from = '', $until = '' ) { |
| 41 | + $this->mDiWikiPages = $diWikiPages; |
| 42 | + $this->mDiProperty = $diProperty; |
| 43 | + $this->mSkin = $skin; |
| 44 | + $this->mLimit = $limit; |
| 45 | + $this->mFrom = $from; |
| 46 | + $this->mUntil = $until; |
| 47 | + } |
| 48 | + |
| 49 | + /** |
| 50 | + * Generates the prev/next link part to the HTML code of the top and |
| 51 | + * bottom section of the page. Whether and how these links appear |
| 52 | + * depends on specified boundaries, limit, and results. The title is |
| 53 | + * required to create a link to the right page. The query array gives |
| 54 | + * optional further parameters to append to all navigation links. |
| 55 | + * |
| 56 | + * @param $title Title |
| 57 | + * @param $query array that associates parameter names to parameter values |
| 58 | + * @return string |
| 59 | + */ |
| 60 | + public function getNavigationLinks( Title $title, $query = array() ) { |
| 61 | + global $wgLang; |
| 62 | + |
| 63 | + $limitText = $wgLang->formatNum( $this->mLimit ); |
| 64 | + |
| 65 | + $resultCount = count( $this->mDiWikiPages ); |
| 66 | + $beyondLimit = ( $resultCount > $this->mLimit ); |
| 67 | + |
| 68 | + if ( $this->mUntil != '' ) { |
| 69 | + if ( $beyondLimit ) { |
| 70 | + $first = smwfGetStore()->getWikiPageSortKey( $this->mDiWikiPages[1] ); |
| 71 | + } else { |
| 72 | + $first = ''; |
| 73 | + } |
| 74 | + |
| 75 | + $last = $this->mUntil; |
| 76 | + } elseif ( $beyondLimit || ( $this->mFrom != '' ) ) { |
| 77 | + $first = $this->mFrom; |
| 78 | + |
| 79 | + if ( $beyondLimit ) { |
| 80 | + $last = smwfGetStore()->getWikiPageSortKey( $this->mDiWikiPages[$resultCount - 1] ); |
| 81 | + } else { |
| 82 | + $last = ''; |
| 83 | + } |
| 84 | + } else { |
| 85 | + return ''; |
| 86 | + } |
| 87 | + |
| 88 | + $prevLink = htmlspecialchars( wfMsg( 'prevn', $limitText ) ); |
| 89 | + if ( $first != '' ) { |
| 90 | + $prevLink = $this->makeSelfLink( $title, $prevLink, $query + array( 'until' => $first ) ); |
| 91 | + } |
| 92 | + |
| 93 | + $nextLink = htmlspecialchars( wfMsg( 'nextn', $limitText ) ); |
| 94 | + if ( $last != '' ) { |
| 95 | + $nextLink = $this->makeSelfLink( $title, $nextLink, $query + array( 'from' => $last ) ); |
| 96 | + } |
| 97 | + |
| 98 | + return "($prevLink) ($nextLink)"; |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * Format an HTML link with the given text and parameters. |
| 103 | + * |
| 104 | + * @return string |
| 105 | + */ |
| 106 | + protected function makeSelfLink( Title $title, $linkText, array $parameters ) { |
| 107 | + return $this->mSkin->makeLinkObj( $title, $linkText, wfArrayToCGI( $parameters ) ); |
| 108 | + } |
| 109 | + |
| 110 | + /** |
| 111 | + * Make SMWRequestOptions suitable for obtaining a list of results for |
| 112 | + * the given limit, and from or until string. One more result than the |
| 113 | + * limit will be created, and the results may have to be reversed in |
| 114 | + * order if ascending is set to false in the resulting object. |
| 115 | + * |
| 116 | + * @param $limit integer |
| 117 | + * @param $from string can be empty if no from condition is desired |
| 118 | + * @param $until string can be empty if no until condition is desired |
| 119 | + * @return SMWRequestOptions |
| 120 | + */ |
| 121 | + public static function getRequestOptions( $limit, $from, $until ) { |
| 122 | + $options = new SMWRequestOptions(); |
| 123 | + $options->limit = $limit + 1; |
| 124 | + $options->sort = true; |
| 125 | + |
| 126 | + if ( $from != '' ) { |
| 127 | + $options->boundary = $from; |
| 128 | + $options->ascending = true; |
| 129 | + $options->include_boundary = true; |
| 130 | + } elseif ( $until != '' ) { |
| 131 | + $options->boundary = $until; |
| 132 | + $options->ascending = false; |
| 133 | + $options->include_boundary = false; |
| 134 | + } |
| 135 | + |
| 136 | + return $options; |
| 137 | + } |
| 138 | + |
| 139 | + /** |
| 140 | + * Make SMWQuery suitable for obtaining a list of results based on the |
| 141 | + * given description, limit, and from or until string. One more result |
| 142 | + * than the limit will be created, and the results may have to be |
| 143 | + * reversed in order if $until is nonempty. |
| 144 | + * |
| 145 | + * @param $description SMWDescription main query description |
| 146 | + * @param $limit integer |
| 147 | + * @param $from string can be empty if no from condition is desired |
| 148 | + * @param $until string can be empty if no until condition is desired |
| 149 | + * @return SMWQuery |
| 150 | + */ |
| 151 | + public static function getQuery( SMWDescription $description, $limit, $from, $until ) { |
| 152 | + if ( $from != '' ) { |
| 153 | + $diWikiPage = new SMWDIWikiPage( $from, NS_MAIN, '' ); // make a dummy wiki page as boundary |
| 154 | + $fromDescription = new SMWValueDescription( $diWikiPage, null, SMW_CMP_GEQ ); |
| 155 | + $queryDescription = new SMWConjunction( array( $description, $fromDescription ) ); |
| 156 | + $order = 'ASC'; |
| 157 | + } elseif ( $until != '' ) { |
| 158 | + $diWikiPage = new SMWDIWikiPage( $until, NS_MAIN, '' ); // make a dummy wiki page as boundary |
| 159 | + $untilDescription = new SMWValueDescription( $diWikiPage, null, SMW_CMP_LESS ); // do not include boundary in this case |
| 160 | + $queryDescription = new SMWConjunction( array( $description, $untilDescription ) ); |
| 161 | + $order = 'DESC'; |
| 162 | + } else { |
| 163 | + $queryDescription = $description; |
| 164 | + $order = 'ASC'; |
| 165 | + } |
| 166 | + |
| 167 | + $queryDescription->addPrintRequest( new SMWPrintRequest( SMWPrintRequest::PRINT_THIS, '' ) ); |
| 168 | + |
| 169 | + $query = new SMWQuery( $queryDescription ); |
| 170 | + $query->sortkeys[''] = $order; |
| 171 | + $query->setLimit( $limit + 1 ); |
| 172 | + |
| 173 | + return $query; |
| 174 | + } |
| 175 | + |
| 176 | + /** |
| 177 | + * Format a list of data items chunked by letter, either as a |
| 178 | + * bullet list or a columnar format, depending on the length. |
| 179 | + * |
| 180 | + * @param $cutoff integer, use columns for more results than that |
| 181 | + * @return string |
| 182 | + */ |
| 183 | + public function formatList( $cutoff = 6 ) { |
| 184 | + $end = count( $this->mDiWikiPages ); |
| 185 | + $start = 0; |
| 186 | + if ( $end > $this->mLimit ) { |
| 187 | + if ( $this->mFrom != '' ) { |
| 188 | + $end -= 1; |
| 189 | + } else { |
| 190 | + $start += 1; |
| 191 | + } |
| 192 | + } |
| 193 | + |
| 194 | + if ( count ( $this->mDiWikiPages ) > $cutoff ) { |
| 195 | + return self::getColumnList( $start, $end, $this->mDiWikiPages, $this->mDiProperty, $this->mSkin ); |
| 196 | + } elseif ( count( $diWikiPages ) > 0 ) { |
| 197 | + return self::getShortList( $start, $end, $this->mDiWikiPages, $this->mDiProperty, $this->mSkin ); |
| 198 | + } else { |
| 199 | + return ''; |
| 200 | + } |
| 201 | + } |
| 202 | + |
| 203 | + /** |
| 204 | + * Format a list of SMWDIWikiPage objects chunked by letter in a three-column |
| 205 | + * list, ordered vertically. |
| 206 | + * |
| 207 | + * @param $start integer |
| 208 | + * @param $end integer |
| 209 | + * @param $diWikiPages array of SMWDIWikiPage |
| 210 | + * @param $diProperty SMWDIProperty that the wikipages are values of, or null |
| 211 | + * @param $skin Skin object to use for making links |
| 212 | + * |
| 213 | + * @return string |
| 214 | + */ |
| 215 | + public static function getColumnList( $start, $end, array $diWikiPages, $diProperty, $skin ) { |
| 216 | + global $wgContLang; |
| 217 | + |
| 218 | + // Divide list into three equal chunks. |
| 219 | + $chunk = (int) ( ( $end - $start + 1 ) / 3 ); |
| 220 | + |
| 221 | + // Get and display header. |
| 222 | + $r = '<table width="100%"><tr valign="top">'; |
| 223 | + |
| 224 | + $prevStartChar = 'none'; |
| 225 | + |
| 226 | + // Loop through the chunks. |
| 227 | + for ( $startChunk = $start, $endChunk = $chunk, $chunkIndex = 0; |
| 228 | + $chunkIndex < 3; |
| 229 | + ++$chunkIndex, $startChunk = $endChunk, $endChunk += $chunk + 1 ) { |
| 230 | + $r .= "<td>\n"; |
| 231 | + $atColumnTop = true; |
| 232 | + |
| 233 | + // output all diWikiPages |
| 234 | + for ( $index = $startChunk ; $index < $endChunk && $index < $end; ++$index ) { |
| 235 | + $dataValue = SMWDataValueFactory::newDataItemValue( $diWikiPages[$index], $diProperty ); |
| 236 | + // check for change of starting letter or begining of chunk |
| 237 | + $sortkey = smwfGetStore()->getWikiPageSortKey( $diWikiPages[$index] ); |
| 238 | + $startChar = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) ); |
| 239 | + |
| 240 | + if ( ( $index == $startChunk ) || |
| 241 | + ( $startChar != $prevStartChar ) ) { |
| 242 | + if ( $atColumnTop ) { |
| 243 | + $atColumnTop = false; |
| 244 | + } else { |
| 245 | + $r .= "</ul>\n"; |
| 246 | + } |
| 247 | + |
| 248 | + if ( $startChar == $prevStartChar ) { |
| 249 | + $cont_msg = ' ' . wfMsgHtml( 'listingcontinuesabbrev' ); |
| 250 | + } else { |
| 251 | + $cont_msg = ''; |
| 252 | + } |
| 253 | + |
| 254 | + $r .= "<h3>" . htmlspecialchars( $startChar ) . $cont_msg . "</h3>\n<ul>"; |
| 255 | + |
| 256 | + $prevStartChar = $startChar; |
| 257 | + } |
| 258 | + |
| 259 | + $r .= "<li>" . $dataValue->getLongHTMLText( $skin ) . "</li>\n"; |
| 260 | + } |
| 261 | + |
| 262 | + if ( !$atColumnTop ) { |
| 263 | + $r .= "</ul>\n"; |
| 264 | + } |
| 265 | + |
| 266 | + $r .= "</td>\n"; |
| 267 | + } |
| 268 | + |
| 269 | + $r .= '</tr></table>'; |
| 270 | + |
| 271 | + return $r; |
| 272 | + } |
| 273 | + |
| 274 | + /** |
| 275 | + * Format a list of diWikiPages chunked by letter in a bullet list. |
| 276 | + * |
| 277 | + * @param $start integer |
| 278 | + * @param $end integer |
| 279 | + * @param $diWikiPages array of SMWDataItem |
| 280 | + * @param $diProperty SMWDIProperty that the wikipages are values of, or null |
| 281 | + * @param $skin Skin object to use for making links |
| 282 | + * |
| 283 | + * @return string |
| 284 | + */ |
| 285 | + public static function getShortList( $start, $end, array $diWikiPages, $diProperty, $skin ) { |
| 286 | + global $wgContLang; |
| 287 | + |
| 288 | + $startDv = SMWDataValueFactory::newDataItemValue( $diWikiPages[$start], $diProperty ); |
| 289 | + $sortkey = smwfGetStore()->getWikiPageSortKey( $diWikiPages[$start] ); |
| 290 | + $startChar = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) ); |
| 291 | + $r = '<h3>' . htmlspecialchars( $startChar ) . "</h3>\n" . |
| 292 | + '<ul><li>' . $startDv->getLongHTMLText( $skin ) . '</li>'; |
| 293 | + |
| 294 | + $prevStartChar = $startChar; |
| 295 | + for ( $index = $start + 1; $index < $end; $index++ ) { |
| 296 | + $dataValue = SMWDataValueFactory::newDataItemValue( $diWikiPages[$index], $diProperty ); |
| 297 | + $sortkey = smwfGetStore()->getWikiPageSortKey( $diWikiPages[$index] ); |
| 298 | + $startChar = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) ); |
| 299 | + |
| 300 | + if ( $startChar != $prevStartChar ) { |
| 301 | + $r .= "</ul><h3>" . htmlspecialchars( $startChar ) . "</h3>\n<ul>"; |
| 302 | + $prevStartChar = $startChar; |
| 303 | + } |
| 304 | + |
| 305 | + $r .= '<li>' . $dataValue->getLongHTMLText( $skin ) . '</li>'; |
| 306 | + } |
| 307 | + |
| 308 | + $r .= '</ul>'; |
| 309 | + |
| 310 | + return $r; |
| 311 | + } |
| 312 | + |
| 313 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/SemanticMediaWiki/includes/SMW_PageLister.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 314 | + native |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php |
— | — | @@ -109,9 +109,10 @@ |
110 | 110 | $wgAutoloadClasses['SMWParseData'] = $incDir . 'SMW_ParseData.php'; |
111 | 111 | $wgAutoloadClasses['SMWParserExtensions'] = $incDir . 'SMW_ParserExtensions.php'; |
112 | 112 | $wgAutoloadClasses['SMWPropertyChange'] = $incDir . 'SMW_PropertyChange.php'; |
113 | | - $wgAutoloadClasses['SMWPropertyChanges'] = $incDir . 'SMW_PropertyChanges.php'; |
| 113 | + $wgAutoloadClasses['SMWPropertyChanges'] = $incDir . 'SMW_PropertyChanges.php'; |
114 | 114 | $wgAutoloadClasses['SMWQueryLanguage'] = $incDir . 'SMW_QueryLanguage.php'; |
115 | 115 | $wgAutoloadClasses['SMWSemanticData'] = $incDir . 'SMW_SemanticData.php'; |
| 116 | + $wgAutoloadClasses['SMWPageLister'] = $incDir . 'SMW_PageLister.php'; |
116 | 117 | |
117 | 118 | // Article pages |
118 | 119 | $apDir = $smwgIP . 'includes/articlepages/'; |