r46383 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46382‎ | r46383 | r46384 >
Date:20:50, 27 January 2009
Author:aaron
Status:ok
Tags:
Comment:
Various form tweaks and cleanup
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
@@ -58,22 +58,22 @@
5959 # Reason
6060 $this->reason = $wgRequest->getVal( 'wpReason' );
6161 $this->reasonSelection = $wgRequest->getText( 'wpReasonSelection' );
 62+ $this->expiry = $wgRequest->getText( 'mwStabilize-expiry' );
 63+ $this->expirySelection = $wgRequest->getVal( 'wpExpirySelection' );
6264 # Get visiblity settings...
6365 $this->config = FlaggedRevs::getPageVisibilitySettings( $this->page, true );
6466 $this->select = $this->config['select'];
6567 $this->override = $this->config['override'];
6668 # Make user readable date for GET requests
67 - $this->expiry = $this->config['expiry'] !== 'infinity' ?
 69+ $this->oldExpiry = $this->config['expiry'] !== 'infinity' ?
6870 wfTimestamp( TS_RFC2822, $this->config['expiry'] ) : 'infinite';
69 - # Handle submissions
 71+ # Handle submission data
7072 if( $wgRequest->wasPosted() ) {
7173 $this->select = $wgRequest->getInt( 'wpStableconfig-select' );
7274 $this->override = intval( $wgRequest->getBool( 'wpStableconfig-override' ) );
7375 // Custom expiry takes precedence
74 - $this->expiry = $wgRequest->getText( 'mwStabilize-expiry' );
75 - if( strlen($this->expiry) == 0 ) {
76 - $this->expiry = $wgRequest->getVal( 'wpExpirySelection' );
77 - }
 76+ $this->expiry = strlen($this->expiry) ? $this->expiry : $this->expirySelection;
 77+ if( $this->expiry == 'existing' ) $this->expiry = $this->oldExpiry;
7878 // Custom reason takes precedence
7979 $this->reason = strlen($this->reason) ? $this->reason : $this->reasonSelection;
8080 // Validate precedence setting
@@ -114,12 +114,12 @@
115115 function updateStabilizationDropdowns() {
116116 val = document.getElementById('mwExpirySelection').value;
117117 if( val == 'existing' )
118 - document.getElementById('mwStabilize-expiry').value = ".Xml::encodeJsVar($this->expiry).";
 118+ document.getElementById('mwStabilize-expiry').value = ".Xml::encodeJsVar($this->oldExpiry).";
119119 else if( val == 'othertime' )
120120 document.getElementById('mwStabilize-expiry').value = '';
121121 else
122122 document.getElementById('mwStabilize-expiry').value = val;
123 - }
 123+ }
124124 </script>"
125125 );
126126 # Borrow some protection messages for dropdowns
@@ -188,25 +188,26 @@
189189 <td class='mw-input'>" .
190190 Xml::tags( 'select',
191191 array(
192 - 'id' => "mwExpirySelection",
193 - 'name' => "wpExpirySelection",
194 - 'onchange' => "updateStabilizationDropdowns()"
 192+ 'id' => 'mwExpirySelection',
 193+ 'name' => 'wpExpirySelection',
 194+ 'onchange' => 'updateStabilizationDropdowns()',
195195 ) + $this->disabledAttrib,
196196 $expiryFormOptions ) .
197197 "</td>
198198 </tr>";
199199 }
200200 # Add custom expiry field
201 - $attribs = array( 'id' => "mwStabilize-expiry" ) + $this->disabledAttrib;
202 - $form .= "
203 - <tr>
204 - <td class='mw-label'>" .
205 - Xml::label( wfMsg('stabilization-othertime'), 'mwStabilize-expiry' ) .
206 - '</td>
207 - <td class="mw-input">' .
208 - Xml::input( "mwStabilize-expiry", 50, $this->expiry, $attribs ) .
209 - '</td>
210 - </tr>';
 201+ $attribs = array( 'id' => "mwStabilize-expiry",
 202+ 'onkeyup' => 'updateStabilizationDropdowns()' ) + $this->disabledAttrib;
 203+ $form .= "
 204+ <tr>
 205+ <td class='mw-label'>" .
 206+ Xml::label( wfMsg('stabilization-othertime'), 'mwStabilize-expiry' ) .
 207+ '</td>
 208+ <td class="mw-input">' .
 209+ Xml::input( "mwStabilize-expiry", 50, $this->expiry ? $this->expiry : $this->oldExpiry, $attribs ) .
 210+ '</td>
 211+ </tr>';
211212 # Add comment input and submit button
212213 if( $this->isAllowed ) {
213214 $watchLabel = wfMsgExt( 'watchthis', array('parseinline') );

Status & tagging log