Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php |
— | — | @@ -2027,45 +2027,47 @@ |
2028 | 2028 | */ |
2029 | 2029 | public function execute() { |
2030 | 2030 | $errors = array(); |
2031 | | - $query = SMWQueryProcessor::createQuery( $this->queryString, $this->parameters, |
2032 | | - SMWQueryProcessor::SPECIAL_PAGE , $this->parameters['format'], $this->printOuts ); |
2033 | | - $res = smwfGetStore()->getQueryResult( $query ); |
2034 | | - $this->queryResult = $res; |
| 2031 | + if ( $this->queryString != '' ) { |
| 2032 | + $query = SMWQueryProcessor::createQuery( $this->queryString, $this->parameters, |
| 2033 | + SMWQueryProcessor::SPECIAL_PAGE , $this->parameters['format'], $this->printOuts ); |
| 2034 | + $res = smwfGetStore()->getQueryResult( $query ); |
| 2035 | + $this->queryResult = $res; |
2035 | 2036 | |
2036 | | - $errors = array_merge( $errors, $res->getErrors() ); |
2037 | | - if ( !empty( $errors ) ) { |
2038 | | - $this->errorsOccured = true; |
2039 | | - $this->errors = array_merge( $errors, $this->errors ); |
2040 | | - } |
| 2037 | + $errors = array_merge( $errors, $res->getErrors() ); |
| 2038 | + if ( !empty( $errors ) ) { |
| 2039 | + $this->errorsOccured = true; |
| 2040 | + $this->errors = array_merge( $errors, $this->errors ); |
| 2041 | + } |
2041 | 2042 | |
2042 | | - // BEGIN: Try to be smart for rss/ical if no description/title is given and we have a concept query |
2043 | | - if ( $this->parameters['format'] == 'rss' ) { |
2044 | | - $descKey = 'rssdescription'; |
2045 | | - $titleKey = 'rsstitle'; |
2046 | | - } elseif ( $this->parameters['format'] == 'icalendar' ) { |
2047 | | - $descKey = 'icalendardescription'; |
2048 | | - $titleKey = 'icalendartitle'; |
2049 | | - } else { |
2050 | | - $descKey = false; |
2051 | | - } |
| 2043 | + // BEGIN: Try to be smart for rss/ical if no description/title is given and we have a concept query |
| 2044 | + if ( $this->parameters['format'] == 'rss' ) { |
| 2045 | + $descKey = 'rssdescription'; |
| 2046 | + $titleKey = 'rsstitle'; |
| 2047 | + } elseif ( $this->parameters['format'] == 'icalendar' ) { |
| 2048 | + $descKey = 'icalendardescription'; |
| 2049 | + $titleKey = 'icalendartitle'; |
| 2050 | + } else { |
| 2051 | + $descKey = false; |
| 2052 | + } |
2052 | 2053 | |
2053 | | - if ( $descKey && ( $query->getDescription() instanceof SMWConceptDescription ) && |
2054 | | - ( !isset( $this->parameters[$descKey] ) || !isset( $this->parameters[$titleKey] ) ) ) { |
2055 | | - $concept = $query->getDescription()->getConcept(); |
| 2054 | + if ( $descKey && ( $query->getDescription() instanceof SMWConceptDescription ) && |
| 2055 | + ( !isset( $this->parameters[$descKey] ) || !isset( $this->parameters[$titleKey] ) ) ) { |
| 2056 | + $concept = $query->getDescription()->getConcept(); |
2056 | 2057 | |
2057 | | - if ( !isset( $this->parameters[$titleKey] ) ) { |
2058 | | - $this->parameters[$titleKey] = $concept->getText(); |
2059 | | - } |
| 2058 | + if ( !isset( $this->parameters[$titleKey] ) ) { |
| 2059 | + $this->parameters[$titleKey] = $concept->getText(); |
| 2060 | + } |
2060 | 2061 | |
2061 | | - if ( !isset( $this->parameters[$descKey] ) ) { |
2062 | | - // / @bug The current SMWStore will never return SMWConceptValue (an SMWDataValue) here; it might return SMWDIConcept (an SMWDataItem) |
2063 | | - $dv = end( smwfGetStore()->getPropertyValues( SMWWikiPageValue::makePageFromTitle( $concept ), new SMWDIProperty( '_CONC' ) ) ); |
2064 | | - if ( $dv instanceof SMWConceptValue ) { |
2065 | | - $this->parameters[$descKey] = $dv->getDocu(); |
| 2062 | + if ( !isset( $this->parameters[$descKey] ) ) { |
| 2063 | + // / @bug The current SMWStore will never return SMWConceptValue (an SMWDataValue) here; it might return SMWDIConcept (an SMWDataItem) |
| 2064 | + $dv = end( smwfGetStore()->getPropertyValues( SMWWikiPageValue::makePageFromTitle( $concept ), new SMWDIProperty( '_CONC' ) ) ); |
| 2065 | + if ( $dv instanceof SMWConceptValue ) { |
| 2066 | + $this->parameters[$descKey] = $dv->getDocu(); |
| 2067 | + } |
2066 | 2068 | } |
2067 | 2069 | } |
| 2070 | + // END: Try to be smart for rss/ical if no description/title is given and we have a concept query |
2068 | 2071 | } |
2069 | | - // END: Try to be smart for rss/ical if no description/title is given and we have a concept query |
2070 | 2072 | } |
2071 | 2073 | |
2072 | 2074 | /** |
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php |
— | — | @@ -101,8 +101,7 @@ |
102 | 102 | protected function makeResults() { |
103 | 103 | global $wgOut, $smwgScriptPath; |
104 | 104 | $this->enableJQuery(); |
105 | | - $result=''; |
106 | | - //$result .= '<div class="smwqcerrors">' . $this->getErrorsHtml() . '</div>'; |
| 105 | + $result = '<div class="smwqcerrors">' . $this->getErrorsHtml() . '</div>'; |
107 | 106 | $specTitle = $this->getTitle(); |
108 | 107 | $formatBox = $this->getFormatSelectBoxSep( 'broadtable' ); |
109 | 108 | $result .= Html::openElement( 'form', array( 'name' => 'qc', 'action' => $specTitle->escapeLocalURL(), 'method' => 'get' ) ) . "\n" . |