r79097 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79096‎ | r79097 | r79098 >
Date:01:59, 28 December 2010
Author:yaron
Status:deferred
Tags:
Comment:
Improved some display of HTML and user messages; plus formatting improvements
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_FormEdit.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_RunQuery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_FormEdit.php
@@ -66,7 +66,7 @@
6767 // get contents of form and target page - if there's only one,
6868 // it might be a target with only alternate forms
6969 if ( $form_name == '' ) {
70 - $wgOut->addHTML( "<p class='error'>" . wfMsg( 'sf_formedit_badurl' ) . '</p>' );
 70+ $wgOut->addHTML( Xml::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_formedit_badurl' ) ) );
7171 return;
7272 } elseif ( $target_name == '' ) {
7373 // parse the form to see if it has a 'page name' value set
@@ -83,7 +83,7 @@
8484 $page_name_formula = substr( $page_name_formula, 0, $pos );
8585 }
8686 } elseif ( count( $alt_forms ) == 0 ) {
87 - $wgOut->addWikiText( "<p class='error'>" . wfMsg( 'sf_formedit_badurl' ) . '</p>' );
 87+ $wgOut->addHTML( Xml::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_formedit_badurl' ) ) );
8888 return;
8989 }
9090 }
@@ -117,17 +117,18 @@
118118
119119 if ( ! $form_title || ! $form_title->exists() ) {
120120 if ( $form_name == '' ) {
121 - $text = '<p class="error">' . wfMsg( 'sf_formedit_badurl' ) . "</p>\n";
 121+ $text = Xml::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_formedit_badurl' ) ) . "\n";
122122 } else {
123123 if ( count( $alt_forms ) > 0 ) {
124124 $text .= '<div class="infoMessage">' . wfMsg( 'sf_formedit_altformsonly' ) . ' ';
125125 $text .= self::printAltFormsList( $alt_forms, $form_name );
126126 $text .= "</div>\n";
127 - } else
128 - $text = '<p class="error">' . wfMsg( 'sf_formstart_badform', SFUtils::linkText( SF_NS_FORM, $form_name ) ) . ".</p>\n";
 127+ } else {
 128+ $text = Xml::tags( 'p', array( 'class' => 'error' ), wfMsg( 'sf_formstart_badform', SFUtils::linkText( SF_NS_FORM, $form_name ) ) ) . "\n";
 129+ }
129130 }
130131 } elseif ( $target_name == '' && $page_name_formula == '' ) {
131 - $text = '<p class="error">' . wfMsg( 'sf_formedit_badurl' ) . "</p>\n";
 132+ $text = Xml::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_formedit_badurl' ) ) . "\n";
132133 } else {
133134 $form_article = new Article( $form_title );
134135 $form_definition = $form_article->getContent();
Index: trunk/extensions/SemanticForms/specials/SF_RunQuery.php
@@ -33,9 +33,8 @@
3434 $form_title = Title::makeTitleSafe( SF_NS_FORM, $form_name );
3535
3636 if ( ! $form_title || ! $form_title->exists() ) {
37 - $javascript_text = "";
3837 if ( $form_name == '' ) {
39 - $text = '<p class="error">' . wfMsg( 'sf_runquery_badurl' ) . "</p>\n";
 38+ $text = Xml::element( 'p', array( 'class' => 'error' ), wfMsg( 'sf_runquery_badurl' ) ) . "\n";
4039 } else {
4140 $text = '<p class="error">Error: No form page was found at ' . SFUtils::linkText( SF_NS_FORM, $form_name ) . ".</p>\n";
4241 }
@@ -120,12 +119,13 @@
121120 END;
122121 $text .= $form_text;
123122 }
124 - if ( $embedded )
 123+ if ( $embedded ) {
125124 $text = "<div class='runQueryEmbedded'>$text</div>";
 125+ }
126126
127127 // Now write everything to the screen.
128128 $wgOut->addHTML( $text );
129 - SFUtils::addJavascriptAndCSS( $embedded ? $wgParser:null );
 129+ SFUtils::addJavascriptAndCSS( $embedded ? $wgParser : null );
130130 $script = ' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n";
131131 if ( $embedded ) {
132132 $wgParser->getOutput()->addHeadItem( $script );

Status & tagging log