Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | elseif ($i == 0) |
157 | 157 | $inFormName = $value; |
158 | 158 | elseif ($i == 1) |
159 | | - $inFormSize = $value; |
| 159 | + $inSize = $value; |
160 | 160 | elseif ($i == 2) |
161 | 161 | $inLinkStr = $value; |
162 | 162 | elseif ($i == 3) |
— | — | @@ -219,7 +219,7 @@ |
220 | 220 | if ($param_name == 'form') |
221 | 221 | $inFormName = $value; |
222 | 222 | elseif ($param_name == 'size') |
223 | | - $inFormSize = $value; |
| 223 | + $inSize = $value; |
224 | 224 | elseif ($param_name == 'default value') |
225 | 225 | $inValue = $value; |
226 | 226 | elseif ($param_name == 'button text') |
— | — | @@ -236,7 +236,7 @@ |
237 | 237 | elseif ($i == 0) |
238 | 238 | $inFormName = $value; |
239 | 239 | elseif ($i == 1) |
240 | | - $inFormSize = $value; |
| 240 | + $inSize = $value; |
241 | 241 | elseif ($i == 2) |
242 | 242 | $inValue = $value; |
243 | 243 | elseif ($i == 3) |
— | — | @@ -282,10 +282,16 @@ |
283 | 283 | |
284 | 284 | END; |
285 | 285 | } else { |
| 286 | + // if there's autocompletion, we need to place it in |
| 287 | + // a table so that the autocompletion <div> won't lead |
| 288 | + // to the button being on a separate line (this can |
| 289 | + // probably be done just with CSS instead, but I don't |
| 290 | + // know how) |
286 | 291 | $str = <<<END |
287 | 292 | <form name="createbox" action="$ap_url" method="get"> |
288 | | - <p><input type="text" name="page_name" id="input_$input_num" size="$inSize" value="$inValue" class="autocompleteInput createboxInput" /> |
289 | | - <div class="page_name_auto_complete" id="div_$input_num"></div> |
| 293 | + <table><tr><td><input type="text" name="page_name" id="input_$input_num" size="$inSize" value="$inValue" class="autocompleteInput createboxInput" /> |
| 294 | + <div class="page_name_auto_complete" id="div_$input_num"></div> |
| 295 | + </td> |
290 | 296 | |
291 | 297 | END; |
292 | 298 | } |
— | — | @@ -299,6 +305,7 @@ |
300 | 306 | $str .= SFUtils::formDropdownHTML(); |
301 | 307 | } else { |
302 | 308 | $str .= ' <input type="hidden" name="form" value="' . $inFormName . '">' . "\n"; |
| 309 | + $str .= ' <input type="hidden" name="form2" value="' . $inFormName . '">' . "\n"; |
303 | 310 | } |
304 | 311 | // recreate the passed-in query string as a set of hidden variables |
305 | 312 | $query_components = explode('&', $inQueryStr); |
— | — | @@ -306,16 +313,25 @@ |
307 | 314 | $subcomponents = explode('=', $component, 2); |
308 | 315 | $key = (isset($subcomponents[0])) ? $subcomponents[0] : ''; |
309 | 316 | $val = (isset($subcomponents[1])) ? $subcomponents[1] : ''; |
310 | | - $str .= ' <input type="hidden" name="' . $key . '" value="' . $val . '">' . "\n"; |
| 317 | + if (! empty($key)) |
| 318 | + $str .= ' <input type="hidden" name="' . $key . '" value="' . $val . '">' . "\n"; |
311 | 319 | } |
312 | 320 | wfLoadExtensionMessages('SemanticForms'); |
313 | 321 | $button_str = ($inButtonStr != '') ? $inButtonStr : wfMsg('addoreditdata'); |
314 | | - $str .= <<<END |
| 322 | + if (empty($inAutocompletionSource)) { |
| 323 | + $str .= <<<END |
315 | 324 | <input type="submit" value="$button_str"></p> |
316 | 325 | </form> |
317 | 326 | |
318 | 327 | END; |
| 328 | + } else { |
| 329 | + $str .= <<<END |
| 330 | + <td><input type="submit" value="$button_str"></td></tr></table> |
| 331 | + </form> |
319 | 332 | |
| 333 | +END; |
| 334 | + } |
| 335 | + |
320 | 336 | // hack to remove newline from beginning of output, thanks to |
321 | 337 | // http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_MediaWiki_Parser_Function |
322 | 338 | return $parser->insertStripItem($str, $parser->mStripState); |