Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4193
ProtectionForm.php.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 9:53 PM
2014-11-21 21:53:19 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
ProtectionForm.php.patch
View Options
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
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3758
Default Alt Text
ProtectionForm.php.patch (2 KB)
Attached To
Mode
T12188: Provide combo box containing protection expiration suggestions (as on Special:Blockip) to protection form
Attached
Detach File
Event Timeline
Log In to Comment