Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.inc |
— | — | @@ -448,6 +448,21 @@ |
449 | 449 | return $additional_template_text; |
450 | 450 | } |
451 | 451 | |
| 452 | + /** |
| 453 | + * Helper function, for versions of MediaWiki that don't have |
| 454 | + * Xml::expandAttributes (i.e., before 1.13) |
| 455 | + */ |
| 456 | + static function expandAttributes( $attribs ) { |
| 457 | + if ( method_exists( 'Xml', 'expandAttributes' ) ) { |
| 458 | + return Xml::expandAttributes( $attribs ); |
| 459 | + } else { |
| 460 | + $out = ''; |
| 461 | + foreach( $attribs as $name => $val ) |
| 462 | + $out .= " {$name}=\"" . Sanitizer::encodeAttribute( $val ) . '"'; |
| 463 | + return $out; |
| 464 | + } |
| 465 | + } |
| 466 | + |
452 | 467 | static function summaryInputHTML($is_disabled, $label = null, $attr = array()) { |
453 | 468 | global $sfgTabIndex; |
454 | 469 | |
— | — | @@ -455,7 +470,7 @@ |
456 | 471 | if ($label == null) |
457 | 472 | $label = wfMsg('summary'); |
458 | 473 | $disabled_text = ($is_disabled) ? " disabled" : ""; |
459 | | - $attr = Xml::expandAttributes($attr); |
| 474 | + $attr = self::expandAttributes($attr); |
460 | 475 | $text =<<<END |
461 | 476 | <span id='wpSummaryLabel'><label for='wpSummary'>$label</label></span> |
462 | 477 | <input tabindex="$sfgTabIndex" type='text' value="" name='wpSummary' id='wpSummary' maxlength='200' size='60'$disabled_text$attr/> |
— | — | @@ -473,7 +488,7 @@ |
474 | 489 | $label = wfMsgExt('minoredit', array('parseinline')); |
475 | 490 | $accesskey = wfMsg('accesskey-minoredit'); |
476 | 491 | $tooltip = wfMsg('tooltip-minoredit'); |
477 | | - $attr = Xml::expandAttributes($attr); |
| 492 | + $attr = self::expandAttributes($attr); |
478 | 493 | $text =<<<END |
479 | 494 | <input tabindex="$sfgTabIndex" type="checkbox" value="1" name="wpMinoredit" accesskey="$accesskey" id="wpMinoredit"$disabled_text$attr/> |
480 | 495 | <label for="wpMinoredit" title="$tooltip">$label</label> |
— | — | @@ -504,7 +519,7 @@ |
505 | 520 | $label = wfMsgExt('watchthis', array('parseinline')); |
506 | 521 | $accesskey = htmlspecialchars(wfMsg('accesskey-watch')); |
507 | 522 | $tooltip = htmlspecialchars(wfMsg('tooltip-watch')); |
508 | | - $attr = Xml::expandAttributes($attr); |
| 523 | + $attr = self::expandAttributes($attr); |
509 | 524 | $text =<<<END |
510 | 525 | <input tabindex="$sfgTabIndex" type="checkbox" name="wpWatchthis" accesskey="$accesskey" id='wpWatchthis'$checked_text$disabled_text$attr/> |
511 | 526 | <label for="wpWatchthis" title="$tooltip">$label</label> |
— | — | @@ -525,7 +540,6 @@ |
526 | 541 | global $sfgTabIndex; |
527 | 542 | |
528 | 543 | $sfgTabIndex++; |
529 | | - $disabled_text = ($is_disabled) ? "disabled" : ""; |
530 | 544 | if ($label == null) |
531 | 545 | $label = wfMsg('savearticle'); |
532 | 546 | $temp = $attr + array( |
— | — | @@ -536,8 +550,10 @@ |
537 | 551 | 'value' => $label, |
538 | 552 | 'accesskey' => wfMsg('accesskey-save'), |
539 | 553 | 'title' => wfMsg('tooltip-save'), |
540 | | - $disabled_text => '', |
541 | 554 | ); |
| 555 | + if ( $is_disabled ) { |
| 556 | + $temp['disabled'] = ''; |
| 557 | + } |
542 | 558 | return self::buttonHTML($temp); |
543 | 559 | } |
544 | 560 | |
— | — | @@ -545,7 +561,6 @@ |
546 | 562 | global $sfgTabIndex; |
547 | 563 | |
548 | 564 | $sfgTabIndex++; |
549 | | - $disabled_text = ($is_disabled) ? "disabled" : ""; |
550 | 565 | if ($label == null) |
551 | 566 | $label = wfMsg('showpreview'); |
552 | 567 | $temp = $attr + array( |
— | — | @@ -556,8 +571,10 @@ |
557 | 572 | 'value' => $label, |
558 | 573 | 'accesskey' => wfMsg('accesskey-preview'), |
559 | 574 | 'title' => wfMsg('tooltip-preview'), |
560 | | - $disabled_text => '', |
561 | 575 | ); |
| 576 | + if ( $is_disabled ) { |
| 577 | + $temp['disabled'] = ''; |
| 578 | + } |
562 | 579 | return self::buttonHTML($temp); |
563 | 580 | } |
564 | 581 | |
— | — | @@ -565,7 +582,6 @@ |
566 | 583 | global $sfgTabIndex; |
567 | 584 | |
568 | 585 | $sfgTabIndex++; |
569 | | - $disabled_text = ($is_disabled) ? "disabled" : ""; |
570 | 586 | if ($label == null) |
571 | 587 | $label = wfMsg('showdiff'); |
572 | 588 | $temp = $attr + array( |
— | — | @@ -576,8 +592,10 @@ |
577 | 593 | 'value' => $label, |
578 | 594 | 'accesskey' => wfMsg('accesskey-diff'), |
579 | 595 | 'title' => wfMsg('tooltip-diff'), |
580 | | - $disabled_text => '', |
581 | 596 | ); |
| 597 | + if ( $is_disabled ) { |
| 598 | + $temp['disabled'] = ''; |
| 599 | + } |
582 | 600 | return self::buttonHTML($temp); |
583 | 601 | } |
584 | 602 | |
— | — | @@ -605,7 +623,6 @@ |
606 | 624 | global $sfgTabIndex; |
607 | 625 | |
608 | 626 | $sfgTabIndex++; |
609 | | - $disabled_text = ($is_disabled) ? "disabled" : ""; |
610 | 627 | if ($label == null) |
611 | 628 | $label = wfMsg('runquery'); |
612 | 629 | return self::buttonHTML($attr + array( |