* you can also return an array of message name and its parameters
*/
$errorMsg = '';
- if ( !wfRunHooks( 'ProtectionForm::save', array( $this->mArticle, &$errorMsg, $reasonstr ) ) ) {
+ if ( !Hooks::run( 'ProtectionForm::save', array( $this->mArticle, &$errorMsg, $reasonstr ) ) ) {
if ( $errorMsg == '' ) {
$errorMsg = array( 'hookaborted' );
}
$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 .
"</td></tr>";
}
# Give extensions a chance to add items to the form
- wfRunHooks( 'ProtectionForm::buildForm', array( $this->mArticle, &$out ) );
+ Hooks::run( 'ProtectionForm::buildForm', array( $this->mArticle, &$out ) );
$out .= Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' );
$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
*
$out->addHTML( Xml::element( 'h2', null, $protectLogPage->getName()->text() ) );
LogEventsList::showLogExtract( $out, 'protect', $this->mTitle );
# Let extensions add other relevant log extracts
- wfRunHooks( 'ProtectionForm::showLogExtract', array( $this->mArticle, $out ) );
+ Hooks::run( 'ProtectionForm::showLogExtract', array( $this->mArticle, $out ) );
}
}