r82937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82936‎ | r82937 | r82938 >
Date:15:55, 28 February 2011
Author:yaron
Status:deferred
Tags:
Comment:
Improved parsing when 'RunQuery' is embedded; some small improvements to HTML printout and comments
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_RunQuery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_RunQuery.php
@@ -56,10 +56,11 @@
5757 $raw = $wgRequest->getBool( 'raw', false );
5858 }
5959 $form_submitted = ( $run_query );
60 - if ( $raw )
 60+ if ( $raw ) {
6161 $wgOut->setArticleBodyOnly( true );
62 - // if user already made some action, ignore the edited
63 - // page and just get data from the query string
 62+ }
 63+ // If user already made some action, ignore the edited
 64+ // page and just get data from the query string.
6465 if ( !$embedded && $wgRequest->getVal( 'query' ) == 'true' ) {
6566 $edit_content = null;
6667 $is_text_source = false;
@@ -114,19 +115,21 @@
115116 $action = htmlspecialchars( SpecialPage::getTitleFor( "RunQuery", $form_name )->getLocalURL() );
116117 $text .= <<<END
117118 <form id="sfForm" name="createbox" action="$action" method="post" class="createbox">
118 - <input type="hidden" name="query" value="true" />
119119
120120 END;
 121+ $text .= "\t" . Xml::hidden( 'query', 'true' ) . "\n";
121122 $text .= $form_text;
122123 }
123124 if ( $embedded ) {
124125 $text = "<div class='runQueryEmbedded'>$text</div>";
125126 }
126127
 128+ // Armor against doBlockLevels()
 129+ $text = preg_replace( '/^ +/m', '', $text );
127130 // Now write everything to the screen.
128131 $wgOut->addHTML( $text );
129132 SFUtils::addJavascriptAndCSS( $embedded ? $wgParser : null );
130 - $script = ' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n";
 133+ $script = "\t\t" . '<script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n";
131134 if ( $embedded ) {
132135 $wgParser->getOutput()->addHeadItem( $script );
133136 } else {