X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FProtectionForm.php;h=b6ba918d4db95e62129a60503dbdd3291563d5d4;hp=69b64dd62bd5915295af258782d63127d0014d68;hb=6ae9367cddf8565c948f4d9458b07bb688f2ddc2;hpb=a77c09c03baf8ee1dd7527db4c20c5be2cd2c298 diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 69b64dd62b..b6ba918d4d 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -384,7 +384,16 @@ class ProtectionForm { "mwProtect-$action-expires" ); - $expiryFormOptions = ''; + $expiryFormOptions = new XmlSelect( + "wpProtectExpirySelection-$action", + "mwProtectExpirySelection-$action", + $this->mExpirySelection[$action] + ); + $expiryFormOptions->setAttribute( 'tabindex', '2' ); + if ( $this->disabled ) { + $expiryFormOptions->setAttribute( 'disabled', 'disabled' ); + } + if ( $this->mExistingExpiry[$action] ) { if ( $this->mExistingExpiry[$action] == 'infinity' ) { $existingExpiryMessage = $context->msg( 'protect-existing-expiry-infinity' ); @@ -392,31 +401,27 @@ class ProtectionForm { $timestamp = $lang->userTimeAndDate( $this->mExistingExpiry[$action], $user ); $d = $lang->userDate( $this->mExistingExpiry[$action], $user ); $t = $lang->userTime( $this->mExistingExpiry[$action], $user ); - $existingExpiryMessage = $context->msg( 'protect-existing-expiry', $timestamp, $d, $t ); + $existingExpiryMessage = $context->msg( + 'protect-existing-expiry', + $timestamp, + $d, + $t + ); } - $expiryFormOptions .= - Xml::option( - $existingExpiryMessage->text(), - 'existing', - $this->mExpirySelection[$action] == 'existing' - ) . "\n"; + $expiryFormOptions->addOption( $existingExpiryMessage->text(), 'existing' ); } - $expiryFormOptions .= Xml::option( + $expiryFormOptions->addOption( $context->msg( 'protect-othertime-op' )->text(), - "othertime" - ) . "\n"; + 'othertime' + ); foreach ( explode( ',', $scExpiryOptions ) as $option ) { if ( strpos( $option, ":" ) === false ) { $show = $value = $option; } else { list( $show, $value ) = explode( ":", $option ); } - $expiryFormOptions .= Xml::option( - $show, - htmlspecialchars( $value ), - $this->mExpirySelection[$action] === $value - ) . "\n"; + $expiryFormOptions->addOption( $show, htmlspecialchars( $value ) ); } # Add expiry dropdown if ( $showProtectOptions && !$this->disabled ) { @@ -426,12 +431,7 @@ class ProtectionForm { {$mProtectexpiry} " . - Xml::tags( 'select', - array( - 'id' => "mwProtectExpirySelection-$action", - 'name' => "wpProtectExpirySelection-$action", - 'tabindex' => '2' ) + $this->disabledAttrib, - $expiryFormOptions ) . + $expiryFormOptions->getHTML() . " "; } @@ -541,7 +541,7 @@ class ProtectionForm { $out .= Xml::closeElement( 'fieldset' ); if ( $user->isAllowed( 'editinterface' ) ) { - $link = Linker::link( + $link = Linker::linkKnown( $context->msg( 'protect-dropdown' )->inContentLanguage()->getTitle(), $context->msg( 'protect-edit-reasonlist' )->escaped(), array(), @@ -576,18 +576,18 @@ class ProtectionForm { ); $id = 'mwProtect-level-' . $action; - $attribs = array( - 'id' => $id, - 'name' => $id, - 'size' => count( $levels ), - ) + $this->disabledAttrib; - $out = Xml::openElement( 'select', $attribs ); + $select = new XmlSelect( $id, $id, $selected ); + $select->setAttribute( 'size', count( $levels ) ); + if ( $this->disabled ) { + $select->setAttribute( 'disabled', 'disabled' ); + } + foreach ( $levels as $key ) { - $out .= Xml::option( $this->getOptionLabel( $key ), $key, $key == $selected ); + $select->addOption( $this->getOptionLabel( $key ), $key ); } - $out .= Xml::closeElement( 'select' ); - return $out; + + return $select->getHTML(); } /**