r94765 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94764‎ | r94765 | r94766 >
Date:14:54, 17 August 2011
Author:devayon
Status:deferred
Tags:
Comment:
show error messages at the top of QC
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
@@ -136,6 +136,19 @@
137137 }
138138
139139 /**
 140+ * A function which shows errors as formatted Html
 141+ */
 142+ protected function getErrorsHtml() {
 143+ $result = Html::openElement( 'ul' );
 144+ $errors = $this->uiCore->getErrors();
 145+ foreach ( $errors as $error ) {
 146+ $result .= '<span class="smwwarning"><li>' . $error . '</li></span>';
 147+ }
 148+ $result .= '</ul>';
 149+ return $result;
 150+ }
 151+
 152+ /**
140153 * A helper function to enable JQuery
141154 *
142155 * @global OutputPage $wgOut
@@ -813,7 +826,7 @@
814827 $propertyFormatHtml = Xml::inputLabelSep( 'Format:', '', 'd-prop-format', 'd-prop-format' );// todo i18n
815828 $propertyLimitHtml = Xml::inputLabelSep( 'Limit:', 'd-prop-limit', 'd-prop-limit' ); // todo i18n
816829 $propertyDialogBox = Xml::openElement( 'div', array( 'id' => 'prop-dialog', 'title' => wfMsg( 'smw_prp_options' ), 'class' => 'smwpropdialog' ) ) .
817 - '<table>' .
 830+ '<table align="center">' .
818831 '<tr><td>' . $propertyHtml[0] . '</td><td>' . $propertyHtml[1] . '</td></tr>' .
819832 '<tr><td>' . $propertyLabelHtml[0] . '</td><td>' . $propertyLabelHtml[1] . '</td></tr>' .
820833 '<tr><td>' . $propertyLimitHtml[0] . '</td><td>' . $propertyLimitHtml[1] . '</td></tr>' .
@@ -827,7 +840,7 @@
828841 $categoryYesHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dcatyes' ), '', 'd-category-yes', 'd-category-yes' );
829842 $categoryNoHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dcatno' ), '', 'd-category-no', 'd-category-no' );
830843 $categoryDialogBox = Xml::openElement( 'div', array( 'id' => 'cat-dialog', 'title' => wfMsg( 'smw_qui_catopts' ), 'class' => 'smwcatdialog' ) ) .
831 - '<table>' .
 844+ '<table align="center">' .
832845 '<tr><td>' . $categoryHtml[0] . '</td><td>' . $categoryHtml[1] . '</td></tr>' .
833846 '<tr><td>' . $categoryLabelHtml[0] . '</td><td>' . $categoryLabelHtml[1] . '</td></tr>' .
834847 '<tr><td>' . $categoryYesHtml[0] . '</td><td>' . $categoryYesHtml[1] . '</td></tr>' .
@@ -1092,6 +1105,8 @@
10931106 autoOpen: false,
10941107 modal: true,
10951108 resizable: true,
 1109+ minHeight: 200,
 1110+ minWidth: 400,
10961111 buttons: {
10971112 "{$okMsg}": function(){
10981113 id=jQuery(this).dialog.id;
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php
@@ -101,12 +101,11 @@
102102 protected function makeResults() {
103103 global $wgOut, $smwgScriptPath;
104104 $this->enableJQuery();
105 - $result = "";
 105+ $result = '<div class="smwqcerrors">' . $this->getErrorsHtml() . '</div>';
106106 $specTitle = $this->getTitle();
107107 $formatBox = $this->getFormatSelectBoxSep( 'broadtable' );
108 - $result .= '<form name="ask" action="' . $specTitle->escapeLocalURL() . '" method="get">' . "\n" .
109 - '<input type="hidden" name="title" value="' . $specTitle->getPrefixedText() . '"/>';
110 - $result .= '<br/>';
 108+ $result .= Html::openElement( 'form', array( 'name' => 'qc', 'action' => $specTitle->escapeLocalURL(), 'method' => 'get' ) ) . "\n" .
 109+ Html::hidden( 'title', $specTitle->getPrefixedText() );
111110 $result .= wfMsg( 'smw_qc_query_help' );
112111 // Main query and format options
113112 $result .= $this->getQueryFormBox();
@@ -115,7 +114,8 @@
116115 // additional options
117116 // START: show|hide additional options
118117 $result .= '<div class="smwqcformatas"><strong>' . wfMsg( 'smw_ask_format_as' ) . '</strong>';
119 - $result .= $formatBox[0] . '<span id="show_additional_options" style="display:inline;"><a href="#addtional" rel="nofollow" onclick="' .
 118+ $result .= $formatBox[0] . '<span id="show_additional_options" style="display:inline;">' .
 119+ '<a href="#addtional" rel="nofollow" onclick="' .
120120 "jQuery('#additional_options').show('blind');" .
121121 "document.getElementById('show_additional_options').style.display='none';" .
122122 "document.getElementById('hide_additional_options').style.display='inline';" . '">' .
@@ -139,15 +139,30 @@
140140 } else {
141141 $offset = '';
142142 }
 143+ if ( array_key_exists( 'intro', $params ) ) {
 144+ $intro = $params['intro'];
 145+ } else {
 146+ $intro = '';
 147+ }
 148+ if ( array_key_exists( 'outro', $params ) ) {
 149+ $outro = $params['outro'];
 150+ } else {
 151+ $outro = '';
 152+ }
 153+ if ( array_key_exists( 'default', $params ) ) {
 154+ $default = $params['default'];
 155+ } else {
 156+ $default = '';
 157+ }
143158 $result .= '<fieldset><legend>' . wfMsg( 'smw_ask_otheroptions' ) . "</legend>\n" .
144159 Html::rawElement( 'div', array( 'style' => 'width: 30%; padding: 5px; float: left;' ),
145 - 'Intro: <input name="p[intro]" size="32"/> <br/>' . wfMsg( 'smw_paramdesc_intro' )
 160+ 'Intro: <input name="p[intro]" value="' . $intro . '"size="32"/> <br/>' . wfMsg( 'smw_paramdesc_intro' )
146161 ) .
147162 Html::rawElement( 'div', array( 'style' => 'width: 30%; padding: 5px; float: left;' ),
148 - 'Outro: <input name="p[outro]" size="32"/> <br/>' . wfMsg( 'smw_paramdesc_outro' )
 163+ 'Outro: <input name="p[outro]" value="' . $outro . '" size="32"/> <br/>' . wfMsg( 'smw_paramdesc_outro' )
149164 ) .
150165 Html::rawElement( 'div', array( 'style' => 'width: 30%; padding: 5px; float: left;' ),
151 - 'Default: <input name="p[default]" size="32"/> <br/>' . wfMsg( 'smw_paramdesc_default' )
 166+ 'Default: <input name="p[default]" value="' . $default . '" size="32"/> <br/>' . wfMsg( 'smw_paramdesc_default' )
152167 ) .
153168 Html::hidden( 'p[limit]', $limit ) .
154169 Html::hidden( 'p[offset]', $offset ) .
@@ -173,6 +188,7 @@
174189 jQuery(document).ready(function(){
175190 jQuery('#embed-code-dialog').dialog({
176191 autoOpen:false,
 192+ modal: true,
177193 buttons:{
178194 Ok: function(){
179195 jQuery(this).dialog("close");

Follow-up revisions

RevisionCommit summaryAuthorDate
r94767follow-up r94765: partial revertdevayon15:26, 17 August 2011
r94772follow-up: r94765 display errors on top of pagedevayon16:34, 17 August 2011