Adding signature preview on Special:Preferences and introducing help text for signatu...
authorTobias <churchofemacs@users.mediawiki.org>
Wed, 5 Aug 2009 14:45:21 +0000 (14:45 +0000)
committerTobias <churchofemacs@users.mediawiki.org>
Wed, 5 Aug 2009 14:45:21 +0000 (14:45 +0000)
RELEASE-NOTES
includes/Preferences.php
languages/messages/MessagesEn.php

index 0dbb7f5..3d03cc4 100644 (file)
@@ -187,6 +187,7 @@ this. Was used when mwEmbed was going to be an extension.
   but before Mediawiki::performRequestForTitle()
 * wgMainPageTitle variable now available to JavaScript code to identify the main
   page link, so it doesn't have to be extracted from the link URLs.
+* (bug 16836) Display preview of signature in user preferences and describe its use
 
 === Bug fixes in 1.16 ===
 
index a8e967c..19e1c80 100644 (file)
@@ -291,7 +291,22 @@ class Preferences {
                                        );
                }
 
-               global $wgMaxSigChars;
+               global $wgMaxSigChars, $wgParser;
+
+               // show a preview of the old signature first
+               $oldsigtext = $wgParser->preSaveTransform( "~~~", new Title , $user, new ParserOptions );
+               $oldsig = $wgParser->parse( $oldsigtext, new Title , new ParserOptions );
+               $m = array(); // remove <p> created by the parser (looks better without <p>)
+               if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $oldsig->mText, $m ) ) $oldsig->mText = $m[1];
+               
+               $defaultPreferences['oldsig'] =
+                       array(
+                                       'type' => 'info',
+                                       'raw' => true,
+                                       'label-message' => 'tog-oldsig',
+                                       'default' => $oldsig->mText,
+                                       'section' => 'personal/signature',
+                       );
                $defaultPreferences['nickname'] =
                                array(
                                        'type' => $wgAuth->allowPropChange( 'nickname' ) ? 'text' : 'info',
@@ -306,9 +321,10 @@ class Preferences {
                                array(
                                        'type' => 'toggle',
                                        'label-message' => 'tog-fancysig',
+                                       'help-message' => 'prefs-help-signature', // show general help about signature at the bottom of the section
                                        'section' => 'personal/signature'
                                );
-
+                               
                ## Email stuff
                
                global $wgEnableEmail;
index 29f3369..532807e 100644 (file)
@@ -636,6 +636,7 @@ XHTML id names.
 'tog-enotifminoredits'        => 'E-mail me also for minor edits of pages',
 'tog-enotifrevealaddr'        => 'Reveal my e-mail address in notification e-mails',
 'tog-shownumberswatching'     => 'Show the number of watching users',
+'tog-oldsig'                 => 'Preview of existing signature: ',
 'tog-fancysig'                => 'Treat signature as wikitext (without an automatic link)',
 'tog-externaleditor'          => 'Use external editor by default (for experts only, needs special settings on your computer)',
 'tog-externaldiff'            => 'Use external diff by default (for experts only, needs special settings on your computer)',
@@ -1778,7 +1779,8 @@ This cannot be undone.',
 'yourrealname'                  => 'Real name:',
 'yourlanguage'                  => 'Language:',
 'yourvariant'                   => 'Variant:', # only translate this message to other languages if you have to change it
-'yournick'                      => 'Signature:',
+'yournick'                      => 'New signature:',
+'prefs-help-signature'          => 'Comments on talk pages should be signed with "~~~~" which will be converted into your signature and a timestamp.',
 'badsig'                        => 'Invalid raw signature.
 Check HTML tags.',
 'badsiglength'                  => 'Your signature is too long.