Prepping for site default overrides of copyright/TOS statements for Wikimedia
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 24 Jun 2009 16:49:28 +0000 (16:49 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 24 Jun 2009 16:49:28 +0000 (16:49 +0000)
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/'

docs/hooks.txt
includes/EditPage.php
includes/Skin.php
languages/messages/MessagesEn.php

index ada88d1..3981f11 100644 (file)
@@ -654,6 +654,16 @@ textarea in the edit form
 &$checks: Array of edit checks like "watch this page"/"minor edit"
 &$tabindex: HTML tabindex of the last edit check/button
 
+'EditPageCopyrightWarning': Allow for site and per-namespace customization of contribution/copyright notice.
+$title: title of page being edited
+&$msg: localization message name, overridable. Default is either 'copyrightwarning' or 'copyrightwarning2'
+
+'EditPageTosSummary':  Give a chance for site and per-namespace customizations
+of terms of service summary link that might exist separately from the copyright
+notice.
+$title: title of page being edited
+&$msg: localization message name, overridable. Default is 'editpage-tos-summary'
+
 'EditSectionLink': Do not use, use DoEditSectionLink instead.
 $skin: Skin rendering the UI
 $title: Title being linked to
@@ -1224,6 +1234,12 @@ $skin: Skin object
 &$bar: Sidebar contents
 Modify $bar to add or modify sidebar portlets.
 
+'SkinCopyrightFooter': Allow for site and per-namespace customization of copyright notice.
+$title: displayed page title
+$type: 'normal' or 'history' for old/diff views
+&$msg: overridable message; usually 'copyright' or 'history_copyright'. This message must be in HTML format, not wikitext!
+&$link: overridable HTML link to be passed into the message as $1
+
 'SkinSubPageSubtitle': At the beginning of Skin::subPageSubtitle()
 $skin: Skin object
 &$subpages: Subpage links HTML
index d3732b0..c6c272d 100644 (file)
@@ -1317,6 +1317,8 @@ class EditPage {
                        $copywarnMsg = array( 'copyrightwarning2',
                                '[[' . wfMsgForContent( 'copyrightpage' ) . ']]' );
                }
+               // Allow for site and per-namespace customization of contribution/copyright notice.
+               wfRunHooks( 'EditPageCopyrightWarning', array( $this->mTitle, &$copywarnMsg ) );
 
                if ( $wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage ) {
                        # prepare toolbar for edit buttons
@@ -1547,6 +1549,7 @@ END
                $token = htmlspecialchars( $wgUser->editToken() );
                $wgOut->addHTML( "\n<input type='hidden' value=\"$token\" name=\"wpEditToken\" />\n" );
 
+               $this->showTosSummary();
                $this->showEditTools();
 
                $wgOut->addHTML( <<<END
@@ -1695,6 +1698,24 @@ END
                        '"' . $liveAction . '"' . ")";
        }
 
+       protected function showTosSummary() {
+               $msg = 'editpage-tos-summary';
+               // Give a chance for site and per-namespace customizations of
+               // terms of service summary link that might exist separately
+               // from the copyright notice.
+               //
+               // This will display between the save button and the edit tools,
+               // so should remain short!
+               wfRunHooks( 'EditPageTosSummary', array( $this->mTitle, &$msg ) );
+               $text = wfMsgForContent( $msg );
+               if( $text != '-' ) {
+                       global $wgOut;
+                       $wgOut->addHTML( '<div class="mw-tos-summary">' );
+                       $wgOut->addWikiMsgArray( $msg, array(), array( 'content' ) );
+                       $wgOut->addHTML( '</div>' );
+               }
+       }
+       
        protected function showEditTools() {
                global $wgOut;
                $wgOut->addHTML( '<div class="mw-editTools">' );
index b2ccb66..3c5b252 100644 (file)
@@ -1436,6 +1436,9 @@ END;
                        # Give up now
                        return $out;
                }
+               // Allow for site and per-namespace customization of copyright notice.
+               wfRunHooks( 'SkinCopyrightFooter', array( $wgArticle->getTitle(), $type, &$msg, &$link ) );
+               
                $out .= wfMsgForContent( $msg, $link );
                return $out;
        }
index 927d553..98c17b9 100644 (file)
@@ -1183,6 +1183,7 @@ You are also promising us that you wrote this yourself, or copied it from a publ
 If you do not want your writing to be edited mercilessly, then do not submit it here.<br />
 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).
 '''Do not submit copyrighted work without permission!'''",
+'editpage-tos-summary'             => '-',
 'longpagewarning'                  => "'''Warning:''' This page is $1 kilobytes long;
 some browsers may have problems editing pages approaching or longer than 32kb.
 Please consider breaking the page into smaller sections.",