$output->addJsConfigVars( 'wgCascadeableLevels', $cascadingRestrictionLevels );
$out .= Xml::openElement( 'form', array( 'method' => 'post',
'action' => $this->mTitle->getLocalURL( 'action=protect' ),
- 'id' => 'mw-Protect-Form', 'onsubmit' => 'ProtectionForm.enableUnchainedInputs(true)' ) );
+ 'id' => 'mw-Protect-Form' ) );
}
$out .= Xml::openElement( 'fieldset' ) .
);
$expiryFormOptions = '';
- if ( $this->mExistingExpiry[$action] && $this->mExistingExpiry[$action] != 'infinity' ) {
- $timestamp = $lang->timeanddate( $this->mExistingExpiry[$action], true );
- $d = $lang->date( $this->mExistingExpiry[$action], true );
- $t = $lang->time( $this->mExistingExpiry[$action], true );
+ if ( $this->mExistingExpiry[$action] ) {
+ if ( $this->mExistingExpiry[$action] == 'infinity' ) {
+ $existingExpiryMessage = wfMessage( 'protect-existing-expiry-infinity' );
+ } else {
+ $timestamp = $lang->timeanddate( $this->mExistingExpiry[$action], true );
+ $d = $lang->date( $this->mExistingExpiry[$action], true );
+ $t = $lang->time( $this->mExistingExpiry[$action], true );
+ $existingExpiryMessage = wfMessage( 'protect-existing-expiry', $timestamp, $d, $t );
+ }
$expiryFormOptions .=
Xml::option(
- wfMessage( 'protect-existing-expiry', $timestamp, $d, $t )->text(),
+ $existingExpiryMessage->text(),
'existing',
$this->mExpirySelection[$action] == 'existing'
) . "\n";
array(
'id' => "mwProtectExpirySelection-$action",
'name' => "wpProtectExpirySelection-$action",
- 'onchange' => "ProtectionForm.updateExpiryList(this)",
'tabindex' => '2' ) + $this->disabledAttrib,
$expiryFormOptions ) .
"</td>
</tr></table>";
}
# Add custom expiry field
- $attribs = array( 'id' => "mwProtect-$action-expires",
- 'onkeyup' => 'ProtectionForm.updateExpiry(this)',
- 'onchange' => 'ProtectionForm.updateExpiry(this)' ) + $this->disabledAttrib;
+ $attribs = array( 'id' => "mwProtect-$action-expires" ) + $this->disabledAttrib;
$out .= "<table><tr>
<td class='mw-label'>" .
$mProtectother .
$user->getEditToken( array( 'protect', $this->mTitle->getPrefixedDBkey() ) )
);
$out .= Xml::closeElement( 'form' );
- $output->addScript( $this->buildCleanupScript() );
}
return $out;
'id' => $id,
'name' => $id,
'size' => count( $levels ),
- 'onchange' => 'ProtectionForm.updateLevels(this)',
- ) + $this->disabledAttrib;
+ ) + $this->disabledAttrib;
$out = Xml::openElement( 'select', $attribs );
foreach ( $levels as $key ) {
}
}
- function buildCleanupScript() {
- $options = array(
- 'tableId' => 'mwProtectSet',
- 'labelText' => wfMessage( 'protect-unchain-permissions' )->plain(),
- 'numTypes' => count( $this->mApplicableTypes ),
- 'existingMatch' => count( array_unique( $this->mExistingExpiry ) ) === 1,
- );
-
- $script = Xml::encodeJsCall( 'ProtectionForm.init', array( $options ) );
-
- return Html::inlineScript( ResourceLoader::makeLoaderConditionalScript( $script ) );
- }
-
/**
* Show protection long extracts for this page
*