Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.inc |
— | — | @@ -449,62 +449,65 @@ |
450 | 450 | return $additional_template_text; |
451 | 451 | } |
452 | 452 | |
453 | | - static function summaryInputHTML($is_disabled, $label = null) { |
| 453 | + static function summaryInputHTML($is_disabled, $label = null, $attr = array()) { |
454 | 454 | global $sfgTabIndex; |
455 | 455 | |
456 | 456 | $sfgTabIndex++; |
457 | 457 | if ($label == null) |
458 | 458 | $label = wfMsg('summary'); |
459 | | - $disabled_text = ($is_disabled) ? "disabled" : ""; |
| 459 | + $disabled_text = ($is_disabled) ? " disabled" : ""; |
| 460 | + $attr = Xml::expandAttributes($attr); |
460 | 461 | $text =<<<END |
461 | 462 | <span id='wpSummaryLabel'><label for='wpSummary'>$label</label></span> |
462 | | - <input tabindex="$sfgTabIndex" type='text' value="" name='wpSummary' id='wpSummary' maxlength='200' size='60' $disabled_text/> |
| 463 | + <input tabindex="$sfgTabIndex" type='text' value="" name='wpSummary' id='wpSummary' maxlength='200' size='60'$disabled_text$attr/> |
463 | 464 | |
464 | 465 | END; |
465 | 466 | return $text; |
466 | 467 | } |
467 | 468 | |
468 | | - static function minorEditInputHTML($is_disabled, $label = null) { |
| 469 | + static function minorEditInputHTML($is_disabled, $label = null, $attr = array()) { |
469 | 470 | global $sfgTabIndex; |
470 | 471 | |
471 | 472 | $sfgTabIndex++; |
472 | | - $disabled_text = ($is_disabled) ? "disabled" : ""; |
| 473 | + $disabled_text = ($is_disabled) ? " disabled" : ""; |
473 | 474 | if ($label == null) |
474 | 475 | $label = wfMsgExt('minoredit', array('parseinline')); |
475 | 476 | $accesskey = wfMsg('accesskey-minoredit'); |
476 | 477 | $tooltip = wfMsg('tooltip-minoredit'); |
| 478 | + $attr = Xml::expandAttributes($attr); |
477 | 479 | $text =<<<END |
478 | | - <input tabindex="$sfgTabIndex" type="checkbox" value="1" name="wpMinoredit" accesskey="$accesskey" id="wpMinoredit" $disabled_text/> |
| 480 | + <input tabindex="$sfgTabIndex" type="checkbox" value="1" name="wpMinoredit" accesskey="$accesskey" id="wpMinoredit"$disabled_text$attr/> |
479 | 481 | <label for="wpMinoredit" title="$tooltip">$label</label> |
480 | 482 | |
481 | 483 | END; |
482 | 484 | return $text; |
483 | 485 | } |
484 | 486 | |
485 | | - static function watchInputHTML($is_disabled, $label = null) { |
| 487 | + static function watchInputHTML($is_disabled, $label = null, $attr = array()) { |
486 | 488 | global $sfgTabIndex, $wgUser, $wgTitle; |
487 | 489 | |
488 | 490 | $sfgTabIndex++; |
489 | 491 | $checked_text = ""; |
490 | | - $disabled_text = ($is_disabled) ? "disabled" : ""; |
| 492 | + $disabled_text = ($is_disabled) ? " disabled" : ""; |
491 | 493 | // figure out if the checkbox should be checked - |
492 | 494 | // this code borrowed from /includes/EditPage.php |
493 | 495 | if ($wgUser->getOption('watchdefault')) { |
494 | 496 | # Watch all edits |
495 | | - $checked_text = "checked"; |
| 497 | + $checked_text = " checked"; |
496 | 498 | } elseif ($wgUser->getOption('watchcreations') && !$wgTitle->exists() ) { |
497 | 499 | # Watch creations |
498 | | - $checked_text = "checked"; |
| 500 | + $checked_text = " checked"; |
499 | 501 | } elseif ($wgTitle->userIsWatching()) { |
500 | 502 | # Already watched |
501 | | - $checked_text = "checked"; |
| 503 | + $checked_text = " checked"; |
502 | 504 | } |
503 | 505 | if ($label == null) |
504 | 506 | $label = wfMsgExt('watchthis', array('parseinline')); |
505 | 507 | $accesskey = htmlspecialchars(wfMsg('accesskey-watch')); |
506 | 508 | $tooltip = htmlspecialchars(wfMsg('tooltip-watch')); |
| 509 | + $attr = Xml::expandAttributes($attr); |
507 | 510 | $text =<<<END |
508 | | - <input tabindex="$sfgTabIndex" type="checkbox" name="wpWatchthis" accesskey="$accesskey" id='wpWatchthis' $checked_text $disabled_text/> |
| 511 | + <input tabindex="$sfgTabIndex" type="checkbox" name="wpWatchthis" accesskey="$accesskey" id='wpWatchthis'$checked_text$disabled_text$attr/> |
509 | 512 | <label for="wpWatchthis" title="$tooltip">$label</label> |
510 | 513 | |
511 | 514 | END; |
— | — | @@ -520,7 +523,7 @@ |
521 | 524 | return " $button_html\n"; |
522 | 525 | } |
523 | 526 | |
524 | | - static function saveButtonHTML($is_disabled, $label = null) { |
| 527 | + static function saveButtonHTML($is_disabled, $label = null, $attr = array()) { |
525 | 528 | global $sfgTabIndex; |
526 | 529 | |
527 | 530 | $sfgTabIndex++; |
— | — | @@ -536,11 +539,11 @@ |
537 | 540 | 'accesskey' => wfMsg('accesskey-save'), |
538 | 541 | 'title' => wfMsg('tooltip-save'), |
539 | 542 | $disabled_text => '', |
540 | | - ); |
| 543 | + ) + $attr; |
541 | 544 | return self::buttonHTML($temp); |
542 | 545 | } |
543 | 546 | |
544 | | - static function showPreviewButtonHTML($is_disabled, $label = null) { |
| 547 | + static function showPreviewButtonHTML($is_disabled, $label = null, $attr = array()) { |
545 | 548 | global $sfgTabIndex; |
546 | 549 | |
547 | 550 | $sfgTabIndex++; |
— | — | @@ -556,11 +559,11 @@ |
557 | 560 | 'accesskey' => wfMsg('accesskey-preview'), |
558 | 561 | 'title' => wfMsg('tooltip-preview'), |
559 | 562 | $disabled_text => '', |
560 | | - ); |
| 563 | + ) + $attr; |
561 | 564 | return self::buttonHTML($temp); |
562 | 565 | } |
563 | 566 | |
564 | | - static function showChangesButtonHTML($is_disabled, $label = null) { |
| 567 | + static function showChangesButtonHTML($is_disabled, $label = null, $attr = array()) { |
565 | 568 | global $sfgTabIndex; |
566 | 569 | |
567 | 570 | $sfgTabIndex++; |
— | — | @@ -576,11 +579,11 @@ |
577 | 580 | 'accesskey' => wfMsg('accesskey-diff'), |
578 | 581 | 'title' => wfMsg('tooltip-diff'), |
579 | 582 | $disabled_text => '', |
580 | | - ); |
| 583 | + ) + $attr; |
581 | 584 | return self::buttonHTML($temp); |
582 | 585 | } |
583 | 586 | |
584 | | - static function cancelLinkHTML($is_disabled, $label = null) { |
| 587 | + static function cancelLinkHTML($is_disabled, $label = null, $attr = array()) { |
585 | 588 | global $wgUser, $wgTitle; |
586 | 589 | |
587 | 590 | $sk = $wgUser->getSkin(); |
— | — | @@ -606,7 +609,7 @@ |
607 | 610 | return $text; |
608 | 611 | } |
609 | 612 | |
610 | | - static function runQueryButtonHTML($is_disabled = false, $label = null) { |
| 613 | + static function runQueryButtonHTML($is_disabled = false, $label = null, $attr = array()) { |
611 | 614 | // is_disabled is currently ignored |
612 | 615 | global $sfgTabIndex; |
613 | 616 | |
— | — | @@ -621,7 +624,7 @@ |
622 | 625 | 'tabindex' => $sfgTabIndex, |
623 | 626 | 'value' => $label, |
624 | 627 | 'title' => $label, |
625 | | - )); |
| 628 | + ) + $attr); |
626 | 629 | } |
627 | 630 | |
628 | 631 | // Much of this function is based on MediaWiki's EditPage::showEditForm() |
Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.inc |
— | — | @@ -331,8 +331,7 @@ |
332 | 332 | $size = "35"; |
333 | 333 | |
334 | 334 | $text =<<<END |
335 | | - <input tabindex="$sfgTabIndex" id="$input_id" name="$input_name" type="text" |
336 | | - value="" size="$size" class="$className" |
| 335 | + <input tabindex="$sfgTabIndex" id="$input_id" name="$input_name" type="text" value="" size="$size" class="$className" |
337 | 336 | END; |
338 | 337 | if ($is_disabled) |
339 | 338 | $text .= " disabled"; |
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc |
— | — | @@ -935,6 +935,7 @@ |
936 | 936 | // handle all the possible values |
937 | 937 | $input_name = $tag_components[1]; |
938 | 938 | $input_label = null; |
| 939 | + $attr = array(); |
939 | 940 | |
940 | 941 | // if it's a query, ignore all standard inputs except run query |
941 | 942 | if (($is_query && $input_name != 'run query') || (!$is_query && $input_name == 'run query')) { |
— | — | @@ -953,8 +954,14 @@ |
954 | 955 | $free_text_components[] = 'edittools'; |
955 | 956 | } |
956 | 957 | } elseif (count($sub_components) == 2) { |
957 | | - if ($sub_components[0] == 'label') { |
| 958 | + switch($sub_components[0]) { |
| 959 | + case 'label': |
958 | 960 | $input_label = $sub_components[1]; |
| 961 | + break; |
| 962 | + case 'class': |
| 963 | + case 'style': |
| 964 | + $attr[$sub_components[0]] = $sub_components[1]; |
| 965 | + break; |
959 | 966 | } |
960 | 967 | // free text input needs more handling than the rest |
961 | 968 | if ($input_name == 'free text' || $input_name == '<freetext>') { |
— | — | @@ -965,21 +972,21 @@ |
966 | 973 | } |
967 | 974 | } |
968 | 975 | if ($input_name == 'summary') { |
969 | | - $new_text = SFFormUtils::summaryInputHTML($form_is_disabled, $input_label); |
| 976 | + $new_text = SFFormUtils::summaryInputHTML($form_is_disabled, $input_label, $attr); |
970 | 977 | } elseif ($input_name == 'minor edit') { |
971 | | - $new_text = SFFormUtils::minorEditInputHTML($form_is_disabled, $input_label); |
| 978 | + $new_text = SFFormUtils::minorEditInputHTML($form_is_disabled, $input_label, $attr); |
972 | 979 | } elseif ($input_name == 'watch') { |
973 | | - $new_text = SFFormUtils::watchInputHTML($form_is_disabled, $input_label); |
| 980 | + $new_text = SFFormUtils::watchInputHTML($form_is_disabled, $input_label, $attr); |
974 | 981 | } elseif ($input_name == 'save') { |
975 | | - $new_text = SFFormUtils::saveButtonHTML($form_is_disabled, $input_label); |
| 982 | + $new_text = SFFormUtils::saveButtonHTML($form_is_disabled, $input_label, $attr); |
976 | 983 | } elseif ($input_name == 'preview') { |
977 | | - $new_text = SFFormUtils::showPreviewButtonHTML($form_is_disabled, $input_label); |
| 984 | + $new_text = SFFormUtils::showPreviewButtonHTML($form_is_disabled, $input_label, $attr); |
978 | 985 | } elseif ($input_name == 'changes') { |
979 | | - $new_text = SFFormUtils::showChangesButtonHTML($form_is_disabled, $input_label); |
| 986 | + $new_text = SFFormUtils::showChangesButtonHTML($form_is_disabled, $input_label, $attr); |
980 | 987 | } elseif ($input_name == 'cancel') { |
981 | | - $new_text = SFFormUtils::cancelLinkHTML($form_is_disabled, $input_label); |
| 988 | + $new_text = SFFormUtils::cancelLinkHTML($form_is_disabled, $input_label, $attr); |
982 | 989 | } elseif ($input_name == 'run query') { |
983 | | - $new_text = SFFormUtils::runQueryButtonHTML($form_is_disabled, $input_label); |
| 990 | + $new_text = SFFormUtils::runQueryButtonHTML($form_is_disabled, $input_label, $attr); |
984 | 991 | } |
985 | 992 | $section = substr_replace($section, $new_text, $brackets_loc, $brackets_end_loc + 3 - $brackets_loc); |
986 | 993 | // ===================================================== |