From a6d37a81d5f07633e1b30aef9c9b286c6c4f0b7e Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 5 Aug 2009 14:45:21 +0000 Subject: [PATCH] Adding signature preview on Special:Preferences and introducing help text for signature. (bug 16836) --- RELEASE-NOTES | 1 + includes/Preferences.php | 20 ++++++++++++++++++-- languages/messages/MessagesEn.php | 4 +++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0dbb7f5389..3d03cc49ca 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/Preferences.php b/includes/Preferences.php index a8e967c6d8..19e1c80670 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -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

created by the parser (looks better without

) + if( preg_match( '/^

(.*)\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; diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 29f3369f8e..532807efc0 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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. -- 2.20.1