r46286 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46285‎ | r46286 | r46287 >
Date:21:06, 26 January 2009
Author:aaron
Status:ok
Tags:
Comment:
JS fixes
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
@@ -108,6 +108,20 @@
109109 } else {
110110 $form = wfMsgExt( 'stabilization-text', array('parse'), $this->page->getPrefixedText() );
111111 }
 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+ );
112126 # Borrow some protection messages for dropdowns
113127 $reasonDropDown = Xml::listDropDown( 'wpReasonSelection',
114128 wfMsgForContent( 'protect-dropdown' ),
@@ -166,7 +180,6 @@
167181 Xml::openElement( 'table' );
168182 # Add expiry dropdown
169183 if( $showProtectOptions && $this->isAllowed ) {
170 - $js = "if(this.value != 'othertime') document.getElementById('mwStabilize-expiry').value=this.value;";
171184 $form .= "
172185 <tr>
173186 <td class='mw-label'>" .
@@ -177,7 +190,7 @@
178191 array(
179192 'id' => "mwExpirySelection",
180193 'name' => "wpExpirySelection",
181 - 'onchange' => $js
 194+ 'onchange' => "updateStabilizationDropdowns()"
182195 ) + $this->disabledAttrib,
183196 $expiryFormOptions ) .
184197 "</td>

Status & tagging log