Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php |
— | — | @@ -58,22 +58,22 @@ |
59 | 59 | # Reason |
60 | 60 | $this->reason = $wgRequest->getVal( 'wpReason' ); |
61 | 61 | $this->reasonSelection = $wgRequest->getText( 'wpReasonSelection' ); |
| 62 | + $this->expiry = $wgRequest->getText( 'mwStabilize-expiry' ); |
| 63 | + $this->expirySelection = $wgRequest->getVal( 'wpExpirySelection' ); |
62 | 64 | # Get visiblity settings... |
63 | 65 | $this->config = FlaggedRevs::getPageVisibilitySettings( $this->page, true ); |
64 | 66 | $this->select = $this->config['select']; |
65 | 67 | $this->override = $this->config['override']; |
66 | 68 | # Make user readable date for GET requests |
67 | | - $this->expiry = $this->config['expiry'] !== 'infinity' ? |
| 69 | + $this->oldExpiry = $this->config['expiry'] !== 'infinity' ? |
68 | 70 | wfTimestamp( TS_RFC2822, $this->config['expiry'] ) : 'infinite'; |
69 | | - # Handle submissions |
| 71 | + # Handle submission data |
70 | 72 | if( $wgRequest->wasPosted() ) { |
71 | 73 | $this->select = $wgRequest->getInt( 'wpStableconfig-select' ); |
72 | 74 | $this->override = intval( $wgRequest->getBool( 'wpStableconfig-override' ) ); |
73 | 75 | // 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; |
78 | 78 | // Custom reason takes precedence |
79 | 79 | $this->reason = strlen($this->reason) ? $this->reason : $this->reasonSelection; |
80 | 80 | // Validate precedence setting |
— | — | @@ -114,12 +114,12 @@ |
115 | 115 | function updateStabilizationDropdowns() { |
116 | 116 | val = document.getElementById('mwExpirySelection').value; |
117 | 117 | if( val == 'existing' ) |
118 | | - document.getElementById('mwStabilize-expiry').value = ".Xml::encodeJsVar($this->expiry)."; |
| 118 | + document.getElementById('mwStabilize-expiry').value = ".Xml::encodeJsVar($this->oldExpiry)."; |
119 | 119 | else if( val == 'othertime' ) |
120 | 120 | document.getElementById('mwStabilize-expiry').value = ''; |
121 | 121 | else |
122 | 122 | document.getElementById('mwStabilize-expiry').value = val; |
123 | | - } |
| 123 | + } |
124 | 124 | </script>" |
125 | 125 | ); |
126 | 126 | # Borrow some protection messages for dropdowns |
— | — | @@ -188,25 +188,26 @@ |
189 | 189 | <td class='mw-input'>" . |
190 | 190 | Xml::tags( 'select', |
191 | 191 | array( |
192 | | - 'id' => "mwExpirySelection", |
193 | | - 'name' => "wpExpirySelection", |
194 | | - 'onchange' => "updateStabilizationDropdowns()" |
| 192 | + 'id' => 'mwExpirySelection', |
| 193 | + 'name' => 'wpExpirySelection', |
| 194 | + 'onchange' => 'updateStabilizationDropdowns()', |
195 | 195 | ) + $this->disabledAttrib, |
196 | 196 | $expiryFormOptions ) . |
197 | 197 | "</td> |
198 | 198 | </tr>"; |
199 | 199 | } |
200 | 200 | # 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>'; |
211 | 212 | # Add comment input and submit button |
212 | 213 | if( $this->isAllowed ) { |
213 | 214 | $watchLabel = wfMsgExt( 'watchthis', array('parseinline') ); |