r82134 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82133‎ | r82134 | r82135 >
Date:20:10, 14 February 2011
Author:yaron
Status:ok
Tags:
Comment:
Simplied and improved Ajax call for setting the additional format parameters; also removed the unnecessary "jQuery.noConflict()" call
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php
@@ -321,16 +321,11 @@
322322 // Javascript code for the dynamic parts of the page
323323 $javascript_text = <<<END
324324 <script type="text/javascript">
325 -jQuery.noConflict();
326 -function xmlhttpPost(strURL) {
327 - jQuery.ajax({ url: strURL, data: getquerystring(), context: document.body, success: function(data){
328 - document.getElementById("other_options").innerHTML = data;
 325+function updateOtherOptions(strURL) {
 326+ jQuery.ajax({ url: strURL, context: document.body, success: function(data){
 327+ jQuery("#other_options").html(data);
329328 }});
330329 }
331 -function getquerystring() {
332 - var format_selector = document.getElementById('formatSelector');
333 - return format_selector.value;
334 -}
335330
336331 // code for handling adding and removing the "sort" inputs
337332 var num_elements = {$this->m_num_sort_values};
@@ -558,7 +553,7 @@
559554 }
560555
561556 $result .= "<br /><br />\n<p>" . wfMsg( 'smw_ask_format_as' ) . ' <input type="hidden" name="eq" value="yes"/>' . "\n" .
562 - '<select id="formatSelector" name="p[format]" onChange="JavaScript:xmlhttpPost(\'' . $url . '\')">' . "\n" .
 557+ '<select id="formatSelector" name="p[format]" onChange="JavaScript:updateOtherOptions(\'' . $url . '\')">' . "\n" .
563558 ' <option value="broadtable"' . ( $this->m_params['format'] == 'broadtable' ? ' selected' : '' ) . '>' .
564559 $printer->getName() . ' (' . wfMsg( 'smw_ask_defaultformat' ) . ')</option>' . "\n";
565560

Status & tagging log