Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php |
— | — | @@ -108,6 +108,20 @@ |
109 | 109 | } else { |
110 | 110 | $form = wfMsgExt( 'stabilization-text', array('parse'), $this->page->getPrefixedText() ); |
111 | 111 | } |
| 112 | + # Add some script |
| 113 | + $wgOut->addScript( |
| 114 | + "<script type=\"text/javascript\"> |
| 115 | + function updateStabilizationDropdowns() { |
| 116 | + val = document.getElementById('mwExpirySelection').value; |
| 117 | + if( val == 'existing' ) |
| 118 | + document.getElementById('mwStabilize-expiry').value = ".Xml::encodeJsVar($this->expiry)."; |
| 119 | + else if( val == 'othertime' ) |
| 120 | + document.getElementById('mwStabilize-expiry').value = ''; |
| 121 | + else |
| 122 | + document.getElementById('mwStabilize-expiry').value = val; |
| 123 | + } |
| 124 | + </script>" |
| 125 | + ); |
112 | 126 | # Borrow some protection messages for dropdowns |
113 | 127 | $reasonDropDown = Xml::listDropDown( 'wpReasonSelection', |
114 | 128 | wfMsgForContent( 'protect-dropdown' ), |
— | — | @@ -166,7 +180,6 @@ |
167 | 181 | Xml::openElement( 'table' ); |
168 | 182 | # Add expiry dropdown |
169 | 183 | if( $showProtectOptions && $this->isAllowed ) { |
170 | | - $js = "if(this.value != 'othertime') document.getElementById('mwStabilize-expiry').value=this.value;"; |
171 | 184 | $form .= " |
172 | 185 | <tr> |
173 | 186 | <td class='mw-label'>" . |
— | — | @@ -177,7 +190,7 @@ |
178 | 191 | array( |
179 | 192 | 'id' => "mwExpirySelection", |
180 | 193 | 'name' => "wpExpirySelection", |
181 | | - 'onchange' => $js |
| 194 | + 'onchange' => "updateStabilizationDropdowns()" |
182 | 195 | ) + $this->disabledAttrib, |
183 | 196 | $expiryFormOptions ) . |
184 | 197 | "</td> |