Yurik has uploaded a new change for review. https://gerrit.wikimedia.org/r/325732
Change subject: Override license messages for edit ...................................................................... Override license messages for edit * Add store->license config string field to specify default content license * Add jsonconfig-license-edit-CC0-1.0 message Bug: T152553 Change-Id: Ife272fbdd4b67a040f8c7753e82f4d461129fa70 --- M extension.json M i18n/en.json M i18n/qqq.json M includes/JCSingleton.php 4 files changed, 28 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/JsonConfig refs/changes/32/325732/1 diff --git a/extension.json b/extension.json index 292610b..38a5ef3 100644 --- a/extension.json +++ b/extension.json @@ -112,6 +112,9 @@ "EditFilterMergedContent": [ "JsonConfig\\JCSingleton::onEditFilterMergedContent" ], + "EditPageCopyrightWarning": [ + "JsonConfig\\JCSingleton::onEditPageCopyrightWarning" + ], "MovePageIsValidMove": [ "JsonConfig\\JCSingleton::onMovePageIsValidMove" ], diff --git a/i18n/en.json b/i18n/en.json index e4e452f..521ae5d 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -42,6 +42,7 @@ "jsonconfig-license": "Data available under $1", "jsonconfig-license-or-later": "$1, or (at your option) any later version", "jsonconfig-license-CC0-1.0": "Creative Commons Zero", + "jsonconfig-license-edit-CC0-1.0": "By saving changes, you agree to the [https://wikimediafoundation.org/wiki/Terms_of_Use Terms of Use], and you irrevocably agree to release your contribution to the public domain under [https://creativecommons.org/publicdomain/zero/1.0/ CC0].", "jsonconfig-license-url-CC0-1.0": "https://creativecommons.org/publicdomain/zero/1.0/", "right-jsonconfig-flush": "Manipulate JsonConfig via API", "apihelp-jsonconfig-description": "Allows direct access to JsonConfig subsystem.", diff --git a/i18n/qqq.json b/i18n/qqq.json index c6aea8e..f8da2b5 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -50,6 +50,7 @@ "jsonconfig-license": "Shows license text prefix before giving the specific license.\n\nParameters:\n* $1 - * {{msg-mw|jsonconfig-license-or-later}} or {{msg-mw|jsonconfig-license-CC0-1.0}} or other similar license messages", "jsonconfig-license-or-later": "In case the data can be used with any future versions of a license, this string will be used instead of 'jsonconfig-license-*' message.\n\nParameters:\n* $1 - license name, as defined in the {{msg-mw|jsonconfig-license-CC0-1.0}} and similar messages", "jsonconfig-license-CC0-1.0": "Name of the license", + "jsonconfig-license-edit-CC0-1.0": "Wiki markup of the message to show instead of {{msg-mw|Wikimedia-copyrightwarning}}", "jsonconfig-license-url-CC0-1.0": "URL to the license description, localized if available", "right-jsonconfig-flush": "{{doc-right|jsonconfig-flush}}", "apihelp-jsonconfig-description": "{{doc-apihelp-description|jsonconfig}}", diff --git a/includes/JCSingleton.php b/includes/JCSingleton.php index 555b1fc..1b4efec 100644 --- a/includes/JCSingleton.php +++ b/includes/JCSingleton.php @@ -165,6 +165,7 @@ self::getConfVal( $store, 'notifyUrl', '' ); self::getConfVal( $store, 'notifyUsername', '' ); self::getConfVal( $store, 'notifyPassword', '' ); + self::getConfVal( $store, 'license', false ); } // Too lazy to write proper error messages for all parameters. @@ -667,6 +668,28 @@ } /** + * Override with per-page specific edit message + * + * @param Title $title + * @param string[] $msg + * + * @return bool + */ + public static function onEditPageCopyrightWarning( $title, &$msg ) { + + if ( self::jsonConfigIsStorage() ) { + $jct = self::parseTitle( $title ); + if ( $jct && $jct->getConfig()->store && $jct->getConfig()->store->license ) { + $code = $jct->getConfig()->store->license; + $code = substr( $code, -1 ) === '+' ? substr( $code, 0, - 1 ) : $code; + $msg = [ 'jsonconfig-license-edit-' . $code ]; + return false; // Do not allow any other hook handler to override this + } + } + return true; + } + + /** * Adds CSS for pretty-printing configuration on NS_CONFIG pages. * @param \OutputPage &$out * @param \Skin &$skin -- To view, visit https://gerrit.wikimedia.org/r/325732 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ife272fbdd4b67a040f8c7753e82f4d461129fa70 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/JsonConfig Gerrit-Branch: master Gerrit-Owner: Yurik <yu...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits