Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php |
— | — | @@ -193,7 +193,7 @@ |
194 | 194 | $printer = SMWQueryProcessor::getResultPrinter($this->m_params['format'], SMWQueryProcessor::SPECIAL_PAGE); |
195 | 195 | $result_mime = $printer->getMimeType($res); |
196 | 196 | if ($result_mime == false) { |
197 | | - if ($res->getCount() > 0) { |
| 197 | + if ( $res->getCount() > 0 ) { |
198 | 198 | $navigation = $this->getNavigationBar($res, $urltail); |
199 | 199 | $result = '<div style="text-align: center;">' . $navigation; |
200 | 200 | $result .= '</div>' . $printer->getResult($res, $this->m_params,SMW_OUTPUT_HTML); |
— | — | @@ -264,21 +264,27 @@ |
265 | 265 | $result .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail . '&eq=yes&sc=1')) . '" rel="nofollow">' . wfMsg('smw_add_sortcondition') . '</a>'; // note that $urltail uses a , separated list for sorting, so setting sc to 1 always adds one new condition |
266 | 266 | } |
267 | 267 | |
268 | | - $result .= '<div>'.wfMsg('smw_ask_format_as').' <input type="hidden" name="eq" value="yes"/>' . |
| 268 | + $printer = SMWQueryProcessor::getResultPrinter('broadtable',SMWQueryProcessor::SPECIAL_PAGE); |
| 269 | + $result .= '<br /><br />' . wfMsg('smw_ask_format_as').' <input type="hidden" name="eq" value="yes"/>' . |
269 | 270 | '<select name="p">' . |
270 | | - '<option value="format=broadtable"'.($this->m_params['format'] == 'broadtable' ? ' selected' : '').'>broadtable ('.wfMsg('smw_ask_defaultformat').')</option>'."\n"; |
| 271 | + '<option value="format=broadtable"'.($this->m_params['format'] == 'broadtable' ? ' selected' : ''). '>' . |
| 272 | + $printer->getName() . ' ('.wfMsg('smw_ask_defaultformat').')</option>'."\n"; |
271 | 273 | |
272 | | - foreach (array_keys($smwgResultFormats) as $format) |
273 | | - { |
274 | | - if ($format != 'broadtable') |
275 | | - { |
276 | | - $result .= '<option value="format='.$format.'"'.($this->m_params['format'] == $format ? ' selected' : '').'>'.$format."</option>\n"; |
| 274 | + $formats = array(); |
| 275 | + foreach (array_keys($smwgResultFormats) as $format) { |
| 276 | + if ( ($format != 'broadtable') && ($format != 'count') && ($format != 'debug') ) { // special formats "count" and "debug" currently not supported |
| 277 | + $printer = SMWQueryProcessor::getResultPrinter($format,SMWQueryProcessor::SPECIAL_PAGE); |
| 278 | + $formats[$format] = $printer->getName(); |
277 | 279 | } |
278 | 280 | } |
| 281 | + natcasesort($formats); |
| 282 | + foreach ($formats as $format => $name) { |
| 283 | + $result .= '<option value="format='.$format.'"'.($this->m_params['format'] == $format ? ' selected' : '').'>'.$name."</option>\n"; |
| 284 | + } |
279 | 285 | |
280 | | - $result .= '</select></div>'; |
| 286 | + $result .= '</select><br />'; |
281 | 287 | |
282 | | - $result .= '<input type="submit" value="' . wfMsg('smw_ask_submit') . '"/>' . |
| 288 | + $result .= '<br /><input type="submit" value="' . wfMsg('smw_ask_submit') . '"/>' . |
283 | 289 | '<input type="hidden" name="eq" value="yes"/>' . |
284 | 290 | ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail)) . '" rel="nofollow">' . wfMsg('smw_ask_hidequery') . '</a> ' . |
285 | 291 | SMWAskPage::$pipeseparator . |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Auto.php |
— | — | @@ -30,4 +30,9 @@ |
31 | 31 | return ''; // acutally not needed in this implementation |
32 | 32 | } |
33 | 33 | |
| 34 | + public function getName() { |
| 35 | + wfLoadExtensionMessages('SemanticMediaWiki'); |
| 36 | + return wfMsgForContent('smw_printername_auto'); |
| 37 | + } |
| 38 | + |
34 | 39 | } |
\ No newline at end of file |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php |
— | — | @@ -305,6 +305,17 @@ |
306 | 306 | } |
307 | 307 | |
308 | 308 | /** |
| 309 | + * Get a human readable label for this printer. The default is to |
| 310 | + * return just the format identifier. Concrete implementations may |
| 311 | + * refer to messages here. The format name is normally not used in |
| 312 | + * wiki text but only in forms etc. hence the user language should be |
| 313 | + * used when retrieving messages. |
| 314 | + */ |
| 315 | + public function getName() { |
| 316 | + return $this->mFormat; |
| 317 | + } |
| 318 | + |
| 319 | + /** |
309 | 320 | * Provides a simple formatted string of all the error messages that occurred. |
310 | 321 | * Can be used if not specific error formatting is desired. Compatible with HTML |
311 | 322 | * and Wiki. |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php |
— | — | @@ -36,6 +36,10 @@ |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
| 40 | + public function getName() { |
| 41 | + wfLoadExtensionMessages('SemanticMediaWiki'); |
| 42 | + return wfMsgForContent('smw_printername_' . $this->mFormat); |
| 43 | + } |
40 | 44 | |
41 | 45 | protected function getResultText($res,$outputmode) { |
42 | 46 | // Determine mark-up strings used around list items: |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_RSSlink.php |
— | — | @@ -40,6 +40,11 @@ |
41 | 41 | return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; |
42 | 42 | } |
43 | 43 | |
| 44 | + public function getName() { |
| 45 | + wfLoadExtensionMessages('SemanticMediaWiki'); |
| 46 | + return wfMsgForContent('smw_printername_rss'); |
| 47 | + } |
| 48 | + |
44 | 49 | protected function getResultText($res, $outputmode) { |
45 | 50 | global $smwgIQRunningNumber, $wgSitename, $wgServer, $smwgRSSEnabled, $wgRequest; |
46 | 51 | $result = ''; |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Table.php |
— | — | @@ -13,6 +13,12 @@ |
14 | 14 | */ |
15 | 15 | class SMWTableResultPrinter extends SMWResultPrinter { |
16 | 16 | |
| 17 | + public function getName() { |
| 18 | + wfLoadExtensionMessages('SemanticMediaWiki'); |
| 19 | + return wfMsgForContent('smw_printername_' . $this->mFormat); |
| 20 | + } |
| 21 | + |
| 22 | + |
17 | 23 | protected function getResultText($res, $outputmode) { |
18 | 24 | global $smwgIQRunningNumber; |
19 | 25 | SMWOutputs::requireHeadItem(SMW_HEADER_SORTTABLE); |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_JSONlink.php |
— | — | @@ -30,6 +30,11 @@ |
31 | 31 | return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; |
32 | 32 | } |
33 | 33 | |
| 34 | + public function getName() { |
| 35 | + wfLoadExtensionMessages('SemanticMediaWiki'); |
| 36 | + return wfMsgForContent('smw_printername_json'); |
| 37 | + } |
| 38 | + |
34 | 39 | protected function getResultText($res, $outputmode) { |
35 | 40 | global $smwgIQRunningNumber, $wgSitename, $wgServer, $wgScriptPath; |
36 | 41 | $result = ''; |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Embedded.php |
— | — | @@ -36,6 +36,11 @@ |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
| 40 | + public function getName() { |
| 41 | + wfLoadExtensionMessages('SemanticMediaWiki'); |
| 42 | + return wfMsgForContent('smw_printername_embedded'); |
| 43 | + } |
| 44 | + |
40 | 45 | protected function getResultText($res,$outputmode) { |
41 | 46 | global $wgParser; |
42 | 47 | // No page should embed itself, find out who we are: |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_CSV.php |
— | — | @@ -35,6 +35,11 @@ |
36 | 36 | return ($context==SMWQueryProcessor::SPECIAL_PAGE)?SMWQuery::MODE_INSTANCES:SMWQuery::MODE_NONE; |
37 | 37 | } |
38 | 38 | |
| 39 | + public function getName() { |
| 40 | + wfLoadExtensionMessages('SemanticMediaWiki'); |
| 41 | + return wfMsgForContent('smw_printername_csv'); |
| 42 | + } |
| 43 | + |
39 | 44 | protected function getResultText($res, $outputmode) { |
40 | 45 | $result = ''; |
41 | 46 | if ($outputmode == SMW_OUTPUT_FILE) { // make CSV file |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Template.php |
— | — | @@ -33,6 +33,11 @@ |
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
| 37 | + public function getName() { |
| 38 | + wfLoadExtensionMessages('SemanticMediaWiki'); |
| 39 | + return wfMsgForContent('smw_printername_template'); |
| 40 | + } |
| 41 | + |
37 | 42 | protected function getResultText($res, $outputmode) { |
38 | 43 | // print all result rows |
39 | 44 | if ($this->m_template == false) { |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php |
— | — | @@ -39,6 +39,21 @@ |
40 | 40 | // Link to JSON feeds |
41 | 41 | 'smw_json_link' => 'JSON', |
42 | 42 | |
| 43 | + // Names for result formats: |
| 44 | + 'smw_printername_auto' => 'Automatic', |
| 45 | + 'smw_printername_count' => 'Count results', |
| 46 | + 'smw_printername_csv' => 'CSV export', |
| 47 | + 'smw_printername_debug' => 'Debug query (for experts)', |
| 48 | + 'smw_printername_embedded' => 'Embed page contents', |
| 49 | + 'smw_printername_json' => 'JSON export', |
| 50 | + 'smw_printername_list' => 'List', |
| 51 | + 'smw_printername_ol' => 'Enumeration', |
| 52 | + 'smw_printername_ul' => 'Itemization', |
| 53 | + 'smw_printername_rss' => 'RSS export', |
| 54 | + 'smw_printername_table' => 'Table', |
| 55 | + 'smw_printername_broadtable' => 'Broad table', |
| 56 | + 'smw_printername_template' => 'Template', |
| 57 | + |
43 | 58 | // Messages and strings for inline queries |
44 | 59 | 'smw_iq_disabled' => "Semantic queries have been disabled for this wiki.", |
45 | 60 | 'smw_iq_moreresults' => '… further results', |