r52361 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52360‎ | r52361 | r52362 >
Date:16:49, 24 June 2009
Author:brion
Status:ok
Tags:
Comment:
Prepping for site default overrides of copyright/TOS statements for Wikimedia
sites with updated CC-BY-SA license... Messages now available in
WikimediaMessages extension for localization:
* wikimedia-copyright - page footer
* wikimedia-copyrightwarning - edit page, above summary/save button
* wikimedia-editpage-tos-summary - edit page, below summary/save button & above edittools

Initial English defaults are taken from
http://meta.wikimedia.org/wiki/Licensing_update/Implementation

Ariel's search for other copyright-related messages looks fairly clean,
so we should be good here for now as $wgRightsText/$wgRightsUrl are
already updated.

Messages are overridden using new hooks, which can also be used to switch the
messages based on title or namespace -- this may be desirable for sites such
as mediawiki.org which keep some namespaces PD etc.

Use of the overridden messages by WikimediaMessages is switched in when
$wgRightsUrl is set to 'http://creativecommons.org/licenses/by-sa/3.0/'
Modified paths:
  • /trunk/extensions/WikimediaMessages/WikimediaMessages.i18n.php (modified) (history)
  • /trunk/extensions/WikimediaMessages/WikimediaMessages.php (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -654,6 +654,16 @@
655655 &$checks: Array of edit checks like "watch this page"/"minor edit"
656656 &$tabindex: HTML tabindex of the last edit check/button
657657
 658+'EditPageCopyrightWarning': Allow for site and per-namespace customization of contribution/copyright notice.
 659+$title: title of page being edited
 660+&$msg: localization message name, overridable. Default is either 'copyrightwarning' or 'copyrightwarning2'
 661+
 662+'EditPageTosSummary': Give a chance for site and per-namespace customizations
 663+of terms of service summary link that might exist separately from the copyright
 664+notice.
 665+$title: title of page being edited
 666+&$msg: localization message name, overridable. Default is 'editpage-tos-summary'
 667+
658668 'EditSectionLink': Do not use, use DoEditSectionLink instead.
659669 $skin: Skin rendering the UI
660670 $title: Title being linked to
@@ -1224,6 +1234,12 @@
12251235 &$bar: Sidebar contents
12261236 Modify $bar to add or modify sidebar portlets.
12271237
 1238+'SkinCopyrightFooter': Allow for site and per-namespace customization of copyright notice.
 1239+$title: displayed page title
 1240+$type: 'normal' or 'history' for old/diff views
 1241+&$msg: overridable message; usually 'copyright' or 'history_copyright'. This message must be in HTML format, not wikitext!
 1242+&$link: overridable HTML link to be passed into the message as $1
 1243+
12281244 'SkinSubPageSubtitle': At the beginning of Skin::subPageSubtitle()
12291245 $skin: Skin object
12301246 &$subpages: Subpage links HTML
Index: trunk/phase3/includes/EditPage.php
@@ -1317,6 +1317,8 @@
13181318 $copywarnMsg = array( 'copyrightwarning2',
13191319 '[[' . wfMsgForContent( 'copyrightpage' ) . ']]' );
13201320 }
 1321+ // Allow for site and per-namespace customization of contribution/copyright notice.
 1322+ wfRunHooks( 'EditPageCopyrightWarning', array( $this->mTitle, &$copywarnMsg ) );
13211323
13221324 if ( $wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage ) {
13231325 # prepare toolbar for edit buttons
@@ -1547,6 +1549,7 @@
15481550 $token = htmlspecialchars( $wgUser->editToken() );
15491551 $wgOut->addHTML( "\n<input type='hidden' value=\"$token\" name=\"wpEditToken\" />\n" );
15501552
 1553+ $this->showTosSummary();
15511554 $this->showEditTools();
15521555
15531556 $wgOut->addHTML( <<<END
@@ -1695,6 +1698,24 @@
16961699 '"' . $liveAction . '"' . ")";
16971700 }
16981701
 1702+ protected function showTosSummary() {
 1703+ $msg = 'editpage-tos-summary';
 1704+ // Give a chance for site and per-namespace customizations of
 1705+ // terms of service summary link that might exist separately
 1706+ // from the copyright notice.
 1707+ //
 1708+ // This will display between the save button and the edit tools,
 1709+ // so should remain short!
 1710+ wfRunHooks( 'EditPageTosSummary', array( $this->mTitle, &$msg ) );
 1711+ $text = wfMsgForContent( $msg );
 1712+ if( $text != '-' ) {
 1713+ global $wgOut;
 1714+ $wgOut->addHTML( '<div class="mw-tos-summary">' );
 1715+ $wgOut->addWikiMsgArray( $msg, array(), array( 'content' ) );
 1716+ $wgOut->addHTML( '</div>' );
 1717+ }
 1718+ }
 1719+
16991720 protected function showEditTools() {
17001721 global $wgOut;
17011722 $wgOut->addHTML( '<div class="mw-editTools">' );
Index: trunk/phase3/includes/Skin.php
@@ -1436,6 +1436,9 @@
14371437 # Give up now
14381438 return $out;
14391439 }
 1440+ // Allow for site and per-namespace customization of copyright notice.
 1441+ wfRunHooks( 'SkinCopyrightFooter', array( $wgArticle->getTitle(), $type, &$msg, &$link ) );
 1442+
14401443 $out .= wfMsgForContent( $msg, $link );
14411444 return $out;
14421445 }
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1183,6 +1183,7 @@
11841184 If you do not want your writing to be edited mercilessly, then do not submit it here.<br />
11851185 You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see $1 for details).
11861186 '''Do not submit copyrighted work without permission!'''",
 1187+'editpage-tos-summary' => '-',
11871188 'longpagewarning' => "'''Warning:''' This page is $1 kilobytes long;
11881189 some browsers may have problems editing pages approaching or longer than 32kb.
11891190 Please consider breaking the page into smaller sections.",
Index: trunk/extensions/WikimediaMessages/WikimediaMessages.i18n.php
@@ -101,6 +101,12 @@
102102
103103 # The name for the common shared repo 'shared'
104104 'shared-repo-name-shared' => 'Wikimedia Commons', # only translate this message to other languages if you have to change it
 105+
 106+ # Copyright fun!
 107+ 'wikimedia-copyright' => 'Text is available under the <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution/Share-Alike License</a>; additional terms may apply. See <a href="http://wikimediafoundation.org/wiki/Terms_of_Use">Terms of Use</a> for details.',
 108+ 'wikimedia-copyrightwarning' => 'By saving, you agree to irrevocably release your contribution under the [http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution/Share-Alike License 3.0] and the [http://www.gnu.org/copyleft/fdl.html GFDL]. You agree to be credited by re-users, at minimum, through a hyperlink or URL to the article you are contributing to. See the [http://wikimediafoundation.org/wiki/Terms_of_Use Terms of Use] for details.',
 109+ 'wikimedia-editpage-tos-summary' => 'If you do not want your writing to be edited and redistributed at will, then do not submit it here. If you did not write this yourself, it must be available under terms consistent with the [http://wikimediafoundation.org/wiki/Terms_of_Use Terms of Use], and you agree to follow any relevant licensing requirements.',
 110+
105111 );
106112
107113 /** Message documentation (Message documentation)
Index: trunk/extensions/WikimediaMessages/WikimediaMessages.php
@@ -24,5 +24,30 @@
2525 include_once ( $dir .'WikimediaGrammarForms.php' );
2626
2727 function wfSetupWikimediaMessages() {
 28+ global $wgRightsUrl, $wgHooks;
2829 wfLoadExtensionMessages('WikimediaMessages');
 30+ if( $wgRightsUrl == 'http://creativecommons.org/licenses/by-sa/3.0/' ) {
 31+ // Override with Wikimedia's site-specific copyright message defaults
 32+ // with the CC/GFDL semi-dual license fun!
 33+ $wgHooks['SkinCopyrightFooter'][] = 'efWikimediaSkinCopyrightFooter';
 34+ $wgHooks['EditPageCopyrightWarning'][] = 'efWikimediaEditPageCopyrightWarning';
 35+ $wgHooks['EditPageTosSummary'][] = 'efWikimediaEditPageTosSummary';
 36+ }
2937 }
 38+
 39+function efWikimediaEditPageCopyrightWarning( $title, &$msg ) {
 40+ $msg = 'wikimedia-copyrightwarning';
 41+ return true;
 42+}
 43+
 44+function efWikimediaSkinCopyrightFooter( $title, $type, &$msg, &$link ) {
 45+ if( $type != 'history' ) {
 46+ $msg = 'wikimedia-copyright';
 47+ }
 48+ return true;
 49+}
 50+
 51+function efWikimediaEditPageTosSummary( $title, &$msg ) {
 52+ $msg = 'wikimedia-editpage-tos-summary';
 53+ return true;
 54+}
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r52362Follow-up r52361: Add new message to maintenance file and set it to ignore fo...raymond17:02, 24 June 2009

Status & tagging log