r88017 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88016‎ | r88017 | r88018 >
Date:20:14, 13 May 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
bugfixes: headitems were missing in forms, SF JS crashed when no showOnSelect was used, RunQuery crashed when no ParserOutput was available
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SemanticForms.js (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_RunQuery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_RunQuery.php
@@ -130,7 +130,9 @@
131131 $wgParser->getOutput()->addHeadItem( $script );
132132 } else {
133133 $wgOut->addScript( $script );
134 - $wgOut->addParserOutputNoText( $wgParser->getOutput() );
 134+ if ($wgParser->getOutput()) {
 135+ $wgOut->addParserOutputNoText( $wgParser->getOutput() );
 136+ }
135137 }
136138
137139 // Finally, set the page title - for MW <= 1.16, this has to be
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -253,10 +253,12 @@
254254 * only a page formula exists).
255255 */
256256 function formHTML( $form_def, $form_submitted, $source_is_page, $form_id = null, $existing_page_content = null, $page_name = null, $page_name_formula = null, $is_query = false, $embedded = false ) {
257 - global $wgRequest, $wgUser;
 257+ global $wgRequest, $wgUser, $wgOut;
258258 global $sfgTabIndex; // used to represent the current tab index in the form
259259 global $sfgFieldNum; // used for setting various HTML IDs
260260
 261+ wfProfileIn( __METHOD__ );
 262+
261263 // initialize some variables
262264 $sfgTabIndex = 1;
263265 $sfgFieldNum = 1;
@@ -1417,7 +1419,11 @@
14181420 if ( $form_submitted ) {
14191421 $javascript_text = '';
14201422 }
1421 -
 1423+
 1424+ $wgOut -> addParserOutputNoText( $parser->getOutput() );
 1425+
 1426+ wfProfileOut( __METHOD__ );
 1427+
14221428 return array( $form_text, $javascript_text, $data_text, $form_page_title, $generated_page_name );
14231429 }
14241430
Index: trunk/extensions/SemanticForms/libs/SemanticForms.js
@@ -355,10 +355,12 @@
356356 var showOnSelectVals = sfgShowOnSelect[this.attr("id")];
357357 var instanceWrapperDiv = null;
358358 }
359 - for ( var i = 0; i < showOnSelectVals.length; i++ ) {
360 - var options = showOnSelectVals[i][0];
361 - var div_id = showOnSelectVals[i][1];
362 - showDivIfSelected(options, div_id, inputVal, instanceWrapperDiv);
 359+ if ( showOnSelectVals !== undefined ) {
 360+ for ( var i = 0; i < showOnSelectVals.length; i++ ) {
 361+ var options = showOnSelectVals[i][0];
 362+ var div_id = showOnSelectVals[i][1];
 363+ showDivIfSelected(options, div_id, inputVal, instanceWrapperDiv);
 364+ }
363365 }
364366 }
365367

Follow-up revisions

RevisionCommit summaryAuthorDate
r88657Follow-up to r88017 - added JS check for another showOnSelect code sectionyaron17:48, 23 May 2011