(bug 2577) when [[MediaWiki:Ipboptions]] contains "-", do not show any block options,
authorRiver Tarnell <kateturner@users.mediawiki.org>
Tue, 28 Jun 2005 17:02:13 +0000 (17:02 +0000)
committerRiver Tarnell <kateturner@users.mediawiki.org>
Tue, 28 Jun 2005 17:02:13 +0000 (17:02 +0000)
so it looks like the old block form.

includes/SpecialBlockip.php

index 2545be1..ea0cd04 100644 (file)
@@ -42,8 +42,8 @@ class IPBlockForm {
                global $wgRequest;
                $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip' ) );
                $this->BlockReason = $wgRequest->getText( 'wpBlockReason' );
-               $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry' );
-               $this->BlockOther = $wgRequest->getVal( 'wpBlockOther' );
+               $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') );
+               $this->BlockOther = $wgRequest->getVal( 'wpBlockOther', '' );
        }
        
        function showForm( $err ) {
@@ -74,9 +74,13 @@ class IPBlockForm {
                $scBlockAddress = htmlspecialchars( $this->BlockAddress );
                $scBlockExpiry = htmlspecialchars( $this->BlockExpiry );
                $scBlockReason = htmlspecialchars( $this->BlockReason );
-               $scBlockOtherTime = htmlspecialchars( $this->BlockOtherTime );
+               $scBlockOtherTime = htmlspecialchars( $this->BlockOther );
                $scBlockExpiryOptions = htmlspecialchars( wfMsg( 'ipboptions' ) );
 
+               $showblockoptions = $scBlockExpiryOptions != '-';
+               if (!$showblockoptions)
+                       $mIpbother = $mIpbexpiry;
+
                $blockExpiryFormOptions = "<option value=\"other\">$mIpbothertime</option>";
                foreach (explode(',', $scBlockExpiryOptions) as $option) {
                        $selected = "";
@@ -96,13 +100,18 @@ class IPBlockForm {
                                <input tabindex='1' type='text' size='20' name=\"wpBlockAddress\" value=\"{$scBlockAddress}\" />
                        </td>
                </tr>
-               <tr>
+               <tr>");
+               if ($showblockoptions) {
+                       $wgOut->addHTML("
                        <td align=\"right\">{$mIpbexpiry}:</td>
                        <td align=\"left\">
                                <select tabindex='2' name=\"wpBlockExpiry\">
                                        $blockExpiryFormOptions
                                </select>
                        </td>
+                       ");
+               }
+               $wgOut->addHTML("
                </tr>
                <tr>
                        <td align=\"right\">{$mIpbother}:</td>
@@ -166,9 +175,14 @@ class IPBlockForm {
                }
 
                $expirestr = $this->BlockExpiry;
-               if (strlen($expirestr) == 0 || $expirestr == wfMsg('ipbotheroption'))
+               if ($expirestr == wfMsg('ipbotheroption'))
                        $expirestr = $this->BlockOther;
 
+               if (strlen($expirestr) == 0) {
+                       $this->showForm( wfMsg( 'ipb_expiry_invalid' ) );
+                       return;
+               }
+
                if ( $expirestr == 'infinite' || $expirestr == 'indefinite' ) {
                        $expiry = '';
                } else {