Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php |
— | — | @@ -157,8 +157,7 @@ |
158 | 158 | } |
159 | 159 | $this->m_params['limit'] = min($this->m_params['limit'], $smwgQMaxInlineLimit); |
160 | 160 | |
161 | | - $this->m_editquery = ( $wgRequest->getVal( 'eq' ) != '' ) || ('' == $this->m_querystring ); |
162 | | -$this->m_editquery = true; |
| 161 | + $this->m_editquery = ( $wgRequest->getVal( 'eq' ) == 'yes' ) || ('' == $this->m_querystring ); |
163 | 162 | } |
164 | 163 | |
165 | 164 | protected function makeHTMLResult() { |
— | — | @@ -289,8 +288,20 @@ |
290 | 289 | } |
291 | 290 | $printer = SMWQueryProcessor::getResultPrinter($this->m_params['format'], SMWQueryProcessor::SPECIAL_PAGE); |
292 | 291 | $result_mime = $printer->getMimeType($res); |
| 292 | + global $wgRequest; |
| 293 | + $hidequery = $wgRequest->getVal( 'eq' ) == 'no'; |
| 294 | + // if it's an export format (like CSV, JSON, etc.), |
| 295 | + // don't actually export the data if 'eq' is set to |
| 296 | + // either 'yes' or 'no' in the query string - just |
| 297 | + // show the link instead |
| 298 | + if ($this->m_editquery || $hidequery) |
| 299 | + $result_mime = false; |
293 | 300 | if ($result_mime == false) { |
294 | 301 | if ( $res->getCount() > 0 ) { |
| 302 | + if ($this->m_editquery) |
| 303 | + $urltail .= '&eq=yes'; |
| 304 | + if ($hidequery) |
| 305 | + $urltail .= '&eq=no'; |
295 | 306 | $navigation = $this->getNavigationBar($res, $urltail); |
296 | 307 | $result .= '<div style="text-align: center;">' . "\n" . $navigation . "\n</div>\n"; |
297 | 308 | $query_result = $printer->getResult($res, $this->m_params,SMW_OUTPUT_HTML); |
— | — | @@ -399,16 +410,18 @@ |
400 | 411 | $result .= '<fieldset><legend>' . wfMsg('smw_ask_otheroptions') . "</legend>\n"; |
401 | 412 | $result .= "<div id=\"other_options\">" . self::showFormatOptions($this->m_params['format'], $this->m_params) . "</div>"; |
402 | 413 | $result .= "</fieldset>\n"; |
| 414 | + $urltail = str_replace('&eq=yes', '', $urltail) . '&eq=no'; |
403 | 415 | |
404 | 416 | $result .= '<br /><input type="submit" value="' . wfMsg('smw_ask_submit') . '"/>' . |
405 | 417 | '<input type="hidden" name="eq" value="yes"/>' . |
406 | | - ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail)) . '" rel="nofollow">' . wfMsg('smw_ask_hidequery') . '</a> ' . |
| 418 | + ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask', $urltail)) . '" rel="nofollow">' . wfMsg('smw_ask_hidequery') . '</a> ' . |
407 | 419 | SMWAskPage::$pipeseparator .' '.SMWAskPage::getEmbedToggle() . |
408 | 420 | SMWAskPage::$pipeseparator . |
409 | 421 | ' <a href="' . htmlspecialchars(wfMsg('smw_ask_doculink')) . '">' . wfMsg('smw_ask_help') . '</a>' . |
410 | 422 | "\n</form>"; |
411 | 423 | } else { // if $this->m_editquery == false |
412 | | - $result .= '<p><a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail . '&eq=yes')) . '" rel="nofollow">' . wfMsg('smw_ask_editquery') . '</a> '. |
| 424 | + $urltail = str_replace('&eq=no', '', $urltail) . '&eq=yes'; |
| 425 | + $result .= '<p><a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask', $urltail)) . '" rel="nofollow">' . wfMsg('smw_ask_editquery') . '</a> '. |
413 | 426 | SMWAskPage::$pipeseparator.' '.SMWAskPage::getEmbedToggle().'</p>'; |
414 | 427 | '<input type="hidden" name="eq" value="yes"/>' . |
415 | 428 | ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail)) . '" rel="nofollow">' . wfMsg('smw_ask_hidequery') . '</a> ' . |