Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | * @todo: using processXXXBox() methods here goes against the general architecture. |
52 | 52 | */ |
53 | 53 | public function execute( $p ) { |
54 | | - global $wgOut, $wgRequest, $smwgQEnabled; |
| 54 | + global $wgOut, $wgRequest, $smwgQEnabled, $wgFeedClasses; |
55 | 55 | |
56 | 56 | $this->setHeaders(); |
57 | 57 | |
— | — | @@ -83,6 +83,16 @@ |
84 | 84 | // or no query has been set |
85 | 85 | $this->uiCore = SMWQueryUIHelper::makeForInfoLink( $p ); |
86 | 86 | } |
| 87 | + // adding rss feed of results to the page head |
| 88 | + if(($this->uiCore->getQueryString()!=='') |
| 89 | + and ($this->isSyndicated()) |
| 90 | + and (method_exists($wgOut, 'addFeedlink')) //remove this line after MW 1.5 is no longer supported by SMW |
| 91 | + and (array_key_exists('rss', $wgFeedClasses))){ |
| 92 | + $res=$this->uiCore->getResultObject(); |
| 93 | + $href=$res->getQueryLink()->getURl().'/format%3Drss/limit%3D'. $this->uiCore->getLimit(); |
| 94 | + $wgOut->addFeedLink('rss', $href); |
| 95 | + } |
| 96 | + |
87 | 97 | $this->makepage( $p ); |
88 | 98 | } |
89 | 99 | } |
— | — | @@ -91,6 +101,15 @@ |
92 | 102 | } |
93 | 103 | |
94 | 104 | /** |
| 105 | + * To enable/disable syndicated feeds of results to appear in the UI header |
| 106 | + * |
| 107 | + * @return boolean |
| 108 | + */ |
| 109 | + public function isSyndicated(){ |
| 110 | + return true; |
| 111 | + } |
| 112 | + |
| 113 | + /** |
95 | 114 | * The main entrypoint for your UI. Call the various methods of SMWQueryUI |
96 | 115 | * and SMWQueryUIHelper to build ui elements and to process them. |
97 | 116 | */ |
— | — | @@ -736,7 +755,6 @@ |
737 | 756 | $default_format = $defaultformat; |
738 | 757 | } |
739 | 758 | |
740 | | - $result = ''; |
741 | 759 | $printer = SMWQueryProcessor::getResultPrinter( $default_format, SMWQueryProcessor::SPECIAL_PAGE ); |
742 | 760 | $url = $this->getTitle()->getLocalURL( "showformatoptions=' + this.value + '" ); |
743 | 761 | |
— | — | @@ -746,7 +764,7 @@ |
747 | 765 | } |
748 | 766 | } |
749 | 767 | |
750 | | - $result .= "\n<p>" . wfMsg( 'smw_ask_format_as' ) . "\n" . |
| 768 | + $result = "\n<p>" . wfMsg( 'smw_ask_format_as' ) . "\n" . |
751 | 769 | '<select id="formatSelector" name="p[format]" onChange="JavaScript:updateOtherOptions(\'' . $url . '\')">' . "\n" . |
752 | 770 | '<option value="' . $default_format . '">' . $printer->getName() . |
753 | 771 | ' (' . wfMsg( 'smw_ask_defaultformat' ) . ')</option>' . "\n"; |