Page MenuHomePhabricator

ProtectionForm.php.patch

Authored By
bzimport
Nov 21 2014, 9:53 PM
Size
2 KB
Referenced Files
None
Subscribers
None

ProtectionForm.php.patch

Index: includes/ProtectionForm.php
===================================================================
--- includes/ProtectionForm.php (revision 30606)
+++ includes/ProtectionForm.php (working copy)
@@ -67,7 +67,7 @@
if( $wgRequest->wasPosted() ) {
$this->mReason = $wgRequest->getText( 'mwProtect-reason' );
$this->mCascade = $wgRequest->getBool( 'mwProtect-cascade' );
- $this->mExpiry = $wgRequest->getText( 'mwProtect-expiry' );
+ $this->mExpiry = ($wgRequest->getText( 'mwProtect-expiry' ) == 'other' ? $wgRequest->getText( 'mwProtect-expiry' ) : $wgRequest->getText( 'wpProtectExpiry') );
foreach( $this->mApplicableTypes as $action ) {
$val = $wgRequest->getVal( "mwProtect-level-$action" );
@@ -161,6 +161,10 @@
if ( strlen( $this->mExpiry ) == 0 ) {
$this->mExpiry = 'infinite';
}
+
+ if ( $this->mExpiry == 'other' ) {
+ $this->mExpiry = 'infinite';
+ }
if ( $this->mExpiry == 'infinite' || $this->mExpiry == 'indefinite' ) {
$expiry = Block::infinity();
@@ -337,9 +341,25 @@
}
function buildExpiryInput() {
+ $scProtectExpiryOptions = wfMsgForContent( 'ipboptions' ); # Uses same dates as the block form
$attribs = array( 'id' => 'expires' ) + $this->disabledAttrib;
- return '<tr>'
- . '<td><label for="expires">' . wfMsgExt( 'protectexpiry', array( 'parseinline' ) ) . '</label></td>'
+ $protectExpiryFormOptions = "<option value=\"other\">" . wfMsgHtml( 'ipbotheroption' ) . "</option>"; # Add message
+ foreach (explode(',', $scProtectExpiryOptions) as $option) {
+ if ( strpos($option, ":") === false ) $option = "$option:$option";
+ list($show, $value) = explode(":", $option);
+ $show = htmlspecialchars($show);
+ $value = htmlspecialchars($value);
+ $selected = "";
+ $protectExpiryFormOptions .= "<option value=\"$value\">$show</option>";
+ }
+
+ return '<tr><td><label for="expires">' . wfMsgExt( 'protectexpiry', array( 'parseinline' ) ) . '</label></td>'
+ . '<td><select tabindex="2" id="wpProtectExpiry" name="wpProtectExpiry" onchange="considerChangingExpiryFocus()">'
+ . $protectExpiryFormOptions
+ . '</select></td>'
+ . '</tr>'
+ . '<tr id="mwProtectother">'
+ . '<td><label for="other">' . wfMsgExt( 'ipbother', array( 'parseinline' ) ) . '</label></td>' # Uses same message as the block form
. '<td>' . Xml::input( 'mwProtect-expiry', 60, $this->mExpiry, $attribs ) . '</td>'
. '</tr>';
}

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3758
Default Alt Text
ProtectionForm.php.patch (2 KB)

Event Timeline