* (bug 9769) Provide "watch this page" toggle on protection form
authorRob Church <robchurch@users.mediawiki.org>
Tue, 5 Jun 2007 02:18:49 +0000 (02:18 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Tue, 5 Jun 2007 02:18:49 +0000 (02:18 +0000)
* Clean up protection form a little
* Change default text for "protectcomment", "protectexpiry", "unprotectcomment" and "protect-cascade" messages

RELEASE-NOTES
includes/ProtectionForm.php
languages/messages/MessagesEn.php

index e16b89e..40b3ab3 100644 (file)
@@ -57,6 +57,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 9898) Allow viewing all namespaces in Special:Newpages
 * (bug 10139) Introduce 'EditSectionLink' and 'EditSectionLinkForOther' hooks;
   see docs/hooks.txt for details
+* (bug 9769) Provide "watch this page" toggle on protection form
 
 == Bugfixes since 1.10 ==
 
index 788b565..02aa421 100644 (file)
@@ -188,6 +188,13 @@ class ProtectionForm {
                if( !$ok ) {
                        throw new FatalError( "Unknown error at restriction save time." );
                }
+               
+               if( $wgRequest->getCheck( 'mwProtectWatch' ) ) {
+                       $this->mArticle->doWatch();
+               } elseif( $this->mTitle->userIsWatching() ) {
+                       $this->mArticle->doUnwatch();
+               }
+               
                return $ok;
        }
 
@@ -232,14 +239,16 @@ class ProtectionForm {
                $out .= "</tbody>\n";
                $out .= "</table>\n";
 
-               global $wgEnableCascadingProtection;
-
-               if ($wgEnableCascadingProtection)
-                       $out .= $this->buildCascadeInput();
-
                $out .= "<table>\n";
                $out .= "<tbody>\n";
 
+               global $wgEnableCascadingProtection;
+               if( $wgEnableCascadingProtection )
+                       $out .= '<tr><td></td><td>' . $this->buildCascadeInput() . "</td></tr>\n";
+
+               if( !$this->disabled )
+                       $out .= '<tr><td></td><td>' . $this->buildWatchInput() . "</td></tr>\n";
+
                $out .= $this->buildExpiryInput();
 
                if( !$this->disabled ) {
@@ -311,7 +320,7 @@ class ProtectionForm {
        function buildExpiryInput() {
                $id = 'mwProtect-expiry';
 
-               $ci = "<tr> <td align=\"right\">";
+               $ci = "<tr><td align=\"right\">";
                $ci .= wfElement( 'label', array (
                                'id' => "$id-label",
                                'for' => $id ),
@@ -326,6 +335,16 @@ class ProtectionForm {
 
                return $ci;
        }
+       
+       function buildWatchInput() {
+               global $wgUser;
+               return Xml::checkLabel(
+                       wfMsg( 'watchthis' ),
+                       'mwProtectWatch',
+                       'mwProtectWatch',
+                       $this->mTitle->userIsWatching() || $wgUser->getOption( 'watchdefault' )
+               );
+       }
 
        function buildSubmit() {
                return wfElement( 'input', array(
index d7cf94d..250dff4 100644 (file)
@@ -1842,14 +1842,14 @@ Please hit "back" and reload the page you came from, then try again.',
 'confirmprotecttext' => 'Do you really want to protect this page?',
 'confirmprotect' => 'Confirm protection',
 'protectmoveonly' => 'Protect from moves only',
-'protectcomment' => 'Reason for protecting',
-'protectexpiry' => 'Expiry',
+'protectcomment' => 'Comment:',
+'protectexpiry' => 'Expires:',
 'protect_expiry_invalid'       => 'Expiry time is invalid.',
 'protect_expiry_old'   => 'Expiry time is in the past.',
 'unprotectsub' =>"(Unprotecting \"$1\")",
 'confirmunprotecttext' => 'Do you really want to unprotect this page?',
 'confirmunprotect' => 'Confirm unprotection',
-'unprotectcomment' => 'Reason for unprotecting',
+'unprotectcomment' => 'Comment:',
 'protect-unchain' => 'Unlock move permissions',
 'protect-text' => 'You may view and change the protection level here for the page <strong>$1</strong>.',
 'protect-locked-blocked' => 'You cannot change protection levels while blocked. Here are the
@@ -1864,7 +1864,7 @@ Here are the current settings for the page <strong>$1</strong>:',
 'protect-level-sysop' => 'Sysops only',
 'protect-summary-cascade' => 'cascading',
 'protect-expiring' => 'expires $1 (UTC)',
-'protect-cascade' => 'Cascading protection - protect any pages included in this page.',
+'protect-cascade' => 'Protect pages included in this page',
 'restriction-type' => 'Permission:',
 'restriction-level' => 'Restriction level:',
 'minimum-size' => 'Min size',