Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php |
— | — | @@ -158,6 +158,27 @@ |
159 | 159 | $queryobj = SMWQueryProcessor::createQuery($this->m_querystring, $this->m_params, false, '', $this->m_printouts); |
160 | 160 | $queryobj->querymode = SMWQuery::MODE_INSTANCES; ///TODO: Somewhat hacky (just as the query mode computation in SMWQueryProcessor::createQuery!) |
161 | 161 | $res = smwfGetStore()->getQueryResult($queryobj); |
| 162 | + // try to be smart for rss/ical if no description/title is given and we have a concept query: |
| 163 | + if ($this->m_params['format'] == 'rss') { |
| 164 | + $desckey = 'rssdescription'; |
| 165 | + $titlekey = 'rsstitle'; |
| 166 | + } elseif ($this->m_params['format'] == 'icalendar') { |
| 167 | + $desckey = 'icalendardescription'; |
| 168 | + $titlekey = 'icalendartitle'; |
| 169 | + } else { $desckey = false; } |
| 170 | + if ( ($desckey) && ($queryobj->getDescription() instanceof SMWConceptDescription) && |
| 171 | + (!isset($this->m_params[$desckey]) || !isset($this->m_params[$titlekey])) ) { |
| 172 | + $concept = $queryobj->getDescription()->getConcept(); |
| 173 | + if ( !isset($this->m_params[$titlekey]) ) { |
| 174 | + $this->m_params[$titlekey] = $concept->getText(); |
| 175 | + } |
| 176 | + if ( !isset($this->m_params[$desckey]) ) { |
| 177 | + $dv = end(smwfGetStore()->getSpecialValues($concept, SMW_SP_CONCEPT_DESC)); |
| 178 | + if ($dv instanceof SMWConceptValue) { |
| 179 | + $this->m_params[$desckey] = $dv->getDocu(); |
| 180 | + } |
| 181 | + } |
| 182 | + } |
162 | 183 | $printer = SMWQueryProcessor::getResultPrinter($this->m_params['format'], SMWQueryProcessor::SPECIAL_PAGE, $res); |
163 | 184 | $result_mime = $printer->getMimeType($res); |
164 | 185 | if ($result_mime == false) { |