Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php |
— | — | @@ -136,6 +136,19 @@ |
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
| 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 | + /** |
140 | 153 | * A helper function to enable JQuery |
141 | 154 | * |
142 | 155 | * @global OutputPage $wgOut |
— | — | @@ -813,7 +826,7 @@ |
814 | 827 | $propertyFormatHtml = Xml::inputLabelSep( 'Format:', '', 'd-prop-format', 'd-prop-format' );// todo i18n |
815 | 828 | $propertyLimitHtml = Xml::inputLabelSep( 'Limit:', 'd-prop-limit', 'd-prop-limit' ); // todo i18n |
816 | 829 | $propertyDialogBox = Xml::openElement( 'div', array( 'id' => 'prop-dialog', 'title' => wfMsg( 'smw_prp_options' ), 'class' => 'smwpropdialog' ) ) . |
817 | | - '<table>' . |
| 830 | + '<table align="center">' . |
818 | 831 | '<tr><td>' . $propertyHtml[0] . '</td><td>' . $propertyHtml[1] . '</td></tr>' . |
819 | 832 | '<tr><td>' . $propertyLabelHtml[0] . '</td><td>' . $propertyLabelHtml[1] . '</td></tr>' . |
820 | 833 | '<tr><td>' . $propertyLimitHtml[0] . '</td><td>' . $propertyLimitHtml[1] . '</td></tr>' . |
— | — | @@ -827,7 +840,7 @@ |
828 | 841 | $categoryYesHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dcatyes' ), '', 'd-category-yes', 'd-category-yes' ); |
829 | 842 | $categoryNoHtml = Xml::inputLabelSep( wfMsg( 'smw_qui_dcatno' ), '', 'd-category-no', 'd-category-no' ); |
830 | 843 | $categoryDialogBox = Xml::openElement( 'div', array( 'id' => 'cat-dialog', 'title' => wfMsg( 'smw_qui_catopts' ), 'class' => 'smwcatdialog' ) ) . |
831 | | - '<table>' . |
| 844 | + '<table align="center">' . |
832 | 845 | '<tr><td>' . $categoryHtml[0] . '</td><td>' . $categoryHtml[1] . '</td></tr>' . |
833 | 846 | '<tr><td>' . $categoryLabelHtml[0] . '</td><td>' . $categoryLabelHtml[1] . '</td></tr>' . |
834 | 847 | '<tr><td>' . $categoryYesHtml[0] . '</td><td>' . $categoryYesHtml[1] . '</td></tr>' . |
— | — | @@ -1092,6 +1105,8 @@ |
1093 | 1106 | autoOpen: false, |
1094 | 1107 | modal: true, |
1095 | 1108 | resizable: true, |
| 1109 | + minHeight: 200, |
| 1110 | + minWidth: 400, |
1096 | 1111 | buttons: { |
1097 | 1112 | "{$okMsg}": function(){ |
1098 | 1113 | id=jQuery(this).dialog.id; |
Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialQueryCreator.php |
— | — | @@ -101,12 +101,11 @@ |
102 | 102 | protected function makeResults() { |
103 | 103 | global $wgOut, $smwgScriptPath; |
104 | 104 | $this->enableJQuery(); |
105 | | - $result = ""; |
| 105 | + $result = '<div class="smwqcerrors">' . $this->getErrorsHtml() . '</div>'; |
106 | 106 | $specTitle = $this->getTitle(); |
107 | 107 | $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() ); |
111 | 110 | $result .= wfMsg( 'smw_qc_query_help' ); |
112 | 111 | // Main query and format options |
113 | 112 | $result .= $this->getQueryFormBox(); |
— | — | @@ -115,7 +114,8 @@ |
116 | 115 | // additional options |
117 | 116 | // START: show|hide additional options |
118 | 117 | $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="' . |
120 | 120 | "jQuery('#additional_options').show('blind');" . |
121 | 121 | "document.getElementById('show_additional_options').style.display='none';" . |
122 | 122 | "document.getElementById('hide_additional_options').style.display='inline';" . '">' . |
— | — | @@ -139,15 +139,30 @@ |
140 | 140 | } else { |
141 | 141 | $offset = ''; |
142 | 142 | } |
| 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 | + } |
143 | 158 | $result .= '<fieldset><legend>' . wfMsg( 'smw_ask_otheroptions' ) . "</legend>\n" . |
144 | 159 | 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' ) |
146 | 161 | ) . |
147 | 162 | 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' ) |
149 | 164 | ) . |
150 | 165 | 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' ) |
152 | 167 | ) . |
153 | 168 | Html::hidden( 'p[limit]', $limit ) . |
154 | 169 | Html::hidden( 'p[offset]', $offset ) . |
— | — | @@ -173,6 +188,7 @@ |
174 | 189 | jQuery(document).ready(function(){ |
175 | 190 | jQuery('#embed-code-dialog').dialog({ |
176 | 191 | autoOpen:false, |
| 192 | + modal: true, |
177 | 193 | buttons:{ |
178 | 194 | Ok: function(){ |
179 | 195 | jQuery(this).dialog("close"); |