Merge "Don't try to verify XML well-formedness for partial SVG uploads"
[lhc/web/wiklou.git] / includes / ProtectionForm.php
index 4aa65d9..7bad8b5 100644 (file)
@@ -352,7 +352,7 @@ class ProtectionForm {
                        $output->addJsConfigVars( 'wgCascadeableLevels', $cascadingRestrictionLevels );
                        $out .= Xml::openElement( 'form', array( 'method' => 'post',
                                'action' => $this->mTitle->getLocalURL( 'action=protect' ),
-                               'id' => 'mw-Protect-Form', 'onsubmit' => 'ProtectionForm.enableUnchainedInputs(true)' ) );
+                               'id' => 'mw-Protect-Form' ) );
                }
 
                $out .= Xml::openElement( 'fieldset' ) .
@@ -384,13 +384,18 @@ class ProtectionForm {
                        );
 
                        $expiryFormOptions = '';
-                       if ( $this->mExistingExpiry[$action] && $this->mExistingExpiry[$action] != 'infinity' ) {
-                               $timestamp = $lang->timeanddate( $this->mExistingExpiry[$action], true );
-                               $d = $lang->date( $this->mExistingExpiry[$action], true );
-                               $t = $lang->time( $this->mExistingExpiry[$action], true );
+                       if ( $this->mExistingExpiry[$action] ) {
+                               if ( $this->mExistingExpiry[$action] == 'infinity' ) {
+                                       $existingExpiryMessage = wfMessage( 'protect-existing-expiry-infinity' );
+                               } else {
+                                       $timestamp = $lang->timeanddate( $this->mExistingExpiry[$action], true );
+                                       $d = $lang->date( $this->mExistingExpiry[$action], true );
+                                       $t = $lang->time( $this->mExistingExpiry[$action], true );
+                                       $existingExpiryMessage = wfMessage( 'protect-existing-expiry', $timestamp, $d, $t );
+                               }
                                $expiryFormOptions .=
                                        Xml::option(
-                                               wfMessage( 'protect-existing-expiry', $timestamp, $d, $t )->text(),
+                                               $existingExpiryMessage->text(),
                                                'existing',
                                                $this->mExpirySelection[$action] == 'existing'
                                        ) . "\n";
@@ -426,16 +431,13 @@ class ProtectionForm {
                                                                array(
                                                                        'id' => "mwProtectExpirySelection-$action",
                                                                        'name' => "wpProtectExpirySelection-$action",
-                                                                       'onchange' => "ProtectionForm.updateExpiryList(this)",
                                                                        'tabindex' => '2' ) + $this->disabledAttrib,
                                                                $expiryFormOptions ) .
                                                "</td>
                                        </tr></table>";
                        }
                        # Add custom expiry field
-                       $attribs = array( 'id' => "mwProtect-$action-expires",
-                               'onkeyup' => 'ProtectionForm.updateExpiry(this)',
-                               'onchange' => 'ProtectionForm.updateExpiry(this)' ) + $this->disabledAttrib;
+                       $attribs = array( 'id' => "mwProtect-$action-expires" ) + $this->disabledAttrib;
                        $out .= "<table><tr>
                                        <td class='mw-label'>" .
                                                $mProtectother .
@@ -556,7 +558,6 @@ class ProtectionForm {
                                $user->getEditToken( array( 'protect', $this->mTitle->getPrefixedDBkey() ) )
                        );
                        $out .= Xml::closeElement( 'form' );
-                       $output->addScript( $this->buildCleanupScript() );
                }
 
                return $out;
@@ -581,8 +582,7 @@ class ProtectionForm {
                        'id' => $id,
                        'name' => $id,
                        'size' => count( $levels ),
-                       'onchange' => 'ProtectionForm.updateLevels(this)',
-                       ) + $this->disabledAttrib;
+               ) + $this->disabledAttrib;
 
                $out = Xml::openElement( 'select', $attribs );
                foreach ( $levels as $key ) {
@@ -611,19 +611,6 @@ class ProtectionForm {
                }
        }
 
-       function buildCleanupScript() {
-               $options = array(
-                       'tableId' => 'mwProtectSet',
-                       'labelText' => wfMessage( 'protect-unchain-permissions' )->plain(),
-                       'numTypes' => count( $this->mApplicableTypes ),
-                       'existingMatch' => count( array_unique( $this->mExistingExpiry ) ) === 1,
-               );
-
-               $script = Xml::encodeJsCall( 'ProtectionForm.init', array( $options ) );
-
-               return Html::inlineScript( ResourceLoader::makeLoaderConditionalScript( $script ) );
-       }
-
        /**
         * Show protection long extracts for this page
         *