Remove unnecessary conditional
[lhc/web/wiklou.git] / includes / ProtectionForm.php
index c8b1f90..8508831 100644 (file)
@@ -97,7 +97,7 @@ class ProtectionForm {
                                // Expiry selected from list
                                $this->mExpiry[$action] = '';
                                $this->mExpirySelection[$action] = $requestExpirySelection;
-                       } elseif ( $existingExpiry == 'infinite' ) {
+                       } elseif ( $existingExpiry == 'infinity' ) {
                                // Existing expiry is infinite, use "infinite" in drop-down
                                $this->mExpiry[$action] = '';
                                $this->mExpirySelection[$action] = 'infinite';
@@ -311,10 +311,11 @@ class ProtectionForm {
                        if( wfEmptyMsg( 'restriction-' . $action, $msg ) ) {
                                $msg = $action;
                        }
-                       $label = Xml::element( 'label', array( 'for' => "mwProtect-level-$action" ), $msg );
-                       $out .= "<tr><td><table>" .
-                               "<tr><th>$label</th><th></th></tr>" .
-                               "<tr><td>" . $this->buildSelector( $action, $selected ) . "</td><td>";
+                       $out .= "<tr><td>".
+                       Xml::openElement( 'fieldset' ) .
+                       Xml::element( 'legend', null, $msg ) .
+                       Xml::openElement( 'table', array( 'id' => "mw-protect-table-$action" ) ) .
+                               "<tr><td>" . $this->buildSelector( $action, $selected ) . "</td></tr><tr><td>";
 
                        $reasonDropDown = Xml::listDropDown( 'wpProtectReasonSelection',
                                wfMsgForContent( 'protect-dropdown' ),
@@ -374,10 +375,13 @@ class ProtectionForm {
                                                $mProtectother .
                                        '</td>
                                        <td class="mw-input">' .
-                                               Xml::input( "mwProtect-expiry-$action", 60, $this->mExpiry[$action], $attribs ) .
+                                               Xml::input( "mwProtect-expiry-$action", 50, $this->mExpiry[$action], $attribs ) .
                                        '</td>
                                </tr></table>';
-                       $out .= "</td></tr></table></td></tr>";
+                       $out .= "</td></tr>" .
+                       Xml::closeElement( 'table' ) .
+                       Xml::closeElement( 'fieldset' ) .
+                       "</td></tr>";
                }
 
                $out .= Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' );
@@ -436,6 +440,12 @@ class ProtectionForm {
                }
                $out .= Xml::closeElement( 'fieldset' );
 
+               if ( $wgUser->isAllowed( 'editinterface' ) ) {
+                       $linkTitle = Title::makeTitleSafe( NS_MEDIAWIKI, 'protect-dropdown' );
+                       $link = $wgUser->getSkin()->Link ( $linkTitle, wfMsgHtml( 'protect-edit-reasonlist' ) );
+                       $out .= '<p class="mw-protect-editreasons">' . $link . '</p>';
+               }
+
                if ( !$this->disabled ) {
                        $out .= Xml::closeElement( 'form' ) .
                                $this->buildCleanupScript();
@@ -513,7 +523,7 @@ class ProtectionForm {
                }
                $script .= "[" . implode(',',$CascadeableLevels) . "];\n";
                $options = (object)array(
-                       'tableId' => 'mw-protect-table2',
+                       'tableId' => 'mw-protect-table-move',
                        'labelText' => wfMsg( 'protect-unchain' ),
                        'numTypes' => count($this->mApplicableTypes),
                        'existingMatch' => 1 == count( array_unique( $this->mExistingExpiry ) ),