jenkins-bot has submitted this change and it was merged. Change subject: Counteract mw.ext.* files being removed in sub-components ......................................................................
Counteract mw.ext.* files being removed in sub-components Change-Id: Ifc781f83c5f57f1f206acb7a28962e7ba2210b62 --- M composer.json M lib/resources/Resources.php M lib/resources/experts/resources.php A lib/resources/experts/wikibase.experts.js D lib/resources/experts/wikibase.experts.register.js A lib/resources/formatters/resources.php A lib/resources/formatters/wikibase.formatters.js D lib/resources/formatters/wikibase.formatters.register.js M lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js A lib/resources/parsers/resources.php A lib/resources/parsers/wikibase.parsers.js D lib/resources/parsers/wikibase.parsers.register.js 12 files changed, 333 insertions(+), 236 deletions(-) Approvals: WikidataJenkins: Verified Adrian Lang: Looks good to me, approved jenkins-bot: Verified diff --git a/composer.json b/composer.json index f85cbce..3701457 100644 --- a/composer.json +++ b/composer.json @@ -32,8 +32,8 @@ "data-values/validators": "~0.1.0", "data-values/data-types": "~0.2.0", "data-values/serialization": "~1.0", - "data-values/javascript": "~0.4.0", - "data-values/value-view": "~0.4.2", + "data-values/javascript": "~0.5.0", + "data-values/value-view": "~0.5.0", "wikibase/data-model": "~0.7.2", "diff/diff": "~0.9.0", "wikibase/easyrdf_lite": "~0.8.1" diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php index a386b3e..a6de1b0 100644 --- a/lib/resources/Resources.php +++ b/lib/resources/Resources.php @@ -58,120 +58,6 @@ ) ), - 'wikibase.parsers.api' => $moduleTemplate + array( - 'scripts' => array( - 'parsers/wikibase.parsers.api.js', - ), - 'dependencies' => array( - 'wikibase.RepoApi', - 'wikibase', - ), - ), - - 'wikibase.ApiBasedValueParser' => $moduleTemplate + array( - 'scripts' => array( - 'parsers/ApiBasedValueParser.js', - ), - 'dependencies' => array( - 'util.inherit', - 'valueParsers.ValueParser', - 'wikibase.parsers.api', - ), - ), - - 'wikibase.EntityIdParser' => $moduleTemplate + array( - 'scripts' => array( - 'parsers/EntityIdParser.js', - ), - 'dependencies' => array( - 'util.inherit', - 'valueParsers.ValueParser', - 'wikibase', - 'wikibase.datamodel', - ), - ), - - 'wikibase.GlobeCoordinateParser' => $moduleTemplate + array( - 'scripts' => array( - 'parsers/GlobeCoordinateParser.js', - ), - 'dependencies' => array( - 'util.inherit', - 'wikibase.ApiBasedValueParser', - ), - ), - - 'wikibase.TimeParser' => $moduleTemplate + array( - 'scripts' => array( - 'parsers/TimeParser.js', - ), - 'dependencies' => array( - 'util.inherit', - 'wikibase.ApiBasedValueParser', - ), - ), - - 'wikibase.QuantityParser' => $moduleTemplate + array( - 'scripts' => array( - 'parsers/QuantityParser.js', - ), - 'dependencies' => array( - 'util.inherit', - 'wikibase.ApiBasedValueParser', - ), - ), - - 'wikibase.parsers' => $moduleTemplate + array( - 'scripts' => array( - 'parsers/wikibase.parsers.register.js', - ), - 'dependencies' => array( - 'dataValues.values', - 'mw.ext.valueParsers', - 'wikibase.datamodel', - 'wikibase.EntityIdParser', - 'wikibase.GlobeCoordinateParser', - 'wikibase.QuantityParser', - 'wikibase.TimeParser', - ), - ), - - 'wikibase.formatters.api' => $moduleTemplate + array( - 'scripts' => array( - 'formatters/wikibase.formatters.api.js', - ), - 'dependencies' => array( - 'wikibase.RepoApi', - 'wikibase', - 'wikibase.dataTypes' - ), - ), - - 'wikibase.ApiBasedValueFormatter' => $moduleTemplate + array( - 'scripts' => array( - 'formatters/ApiBasedValueFormatter.js', - ), - 'dependencies' => array( - 'mediawiki.api', - 'util.inherit', - 'valueFormatters.ValueFormatter', - 'wikibase.formatters.api', - ), - ), - - 'wikibase.formatters' => $moduleTemplate + array( - 'scripts' => array( - 'formatters/wikibase.formatters.register.js', - ), - 'dependencies' => array( - 'dataValues.values', - 'mw.ext.valueFormatters', - 'wikibase.ApiBasedValueFormatter', - 'wikibase.datamodel', - 'wikibase.dataTypes', - ), - ), - 'wikibase.dataTypes' => $moduleTemplate + array( 'scripts' => array( 'wikibase.dataTypes/wikibase.dataTypes.js', @@ -699,7 +585,7 @@ 'mediawiki.legacy.shared', 'jquery.ui.position', 'jquery.ui.TemplatedWidget', - 'mw.ext.valueView', + 'jquery.valueview', 'wikibase.formatters', 'wikibase.parsers', 'wikibase.experts', @@ -937,7 +823,9 @@ $modules = array_merge( $modules, - include( __DIR__ . '/experts/resources.php' ) + include( __DIR__ . '/experts/resources.php' ), + include( __DIR__ . '/formatters/resources.php' ), + include( __DIR__ . '/parsers/resources.php' ) ); if ( defined( 'ULS_VERSION' ) ) { diff --git a/lib/resources/experts/resources.php b/lib/resources/experts/resources.php index f03d950..262e04f 100644 --- a/lib/resources/experts/resources.php +++ b/lib/resources/experts/resources.php @@ -19,11 +19,17 @@ 'wikibase.experts' => $moduleTemplate + array( 'scripts' => array( - 'wikibase.experts.register.js', + 'wikibase.experts.js', ), 'dependencies' => array( + 'dataValues.values', + 'jquery.valueview.ExpertStore', 'jquery.valueview.experts.CommonsMediaType', - 'mw.ext.valueView', + 'jquery.valueview.experts.GlobeCoordinateInput', + 'jquery.valueview.experts.StringValue', + 'jquery.valueview.experts.TimeInput', + 'jquery.valueview.experts.UnsupportedValue', + 'wikibase', 'wikibase.dataTypes', 'wikibase.datamodel', 'wikibase.experts.EntityIdInput', diff --git a/lib/resources/experts/wikibase.experts.js b/lib/resources/experts/wikibase.experts.js new file mode 100644 index 0000000..7468328 --- /dev/null +++ b/lib/resources/experts/wikibase.experts.js @@ -0,0 +1,56 @@ +/** + * @licence GNU GPL v2+ + * @author H. Snater < mediaw...@snater.com > + */ +wikibase.experts = ( function( wb, dataTypeStore, vv, dv ) { + 'use strict'; + + var expertStore = new vv.ExpertStore( vv.experts.UnsupportedValue ); + + expertStore.registerDataValueExpert( + wb.experts.EntityIdInput, + wb.EntityId.TYPE + ); + + expertStore.registerDataValueExpert( + vv.experts.GlobeCoordinateInput, + dv.GlobeCoordinateValue.TYPE + ); + + expertStore.registerDataValueExpert( + vv.experts.StringValue, + dv.QuantityValue.TYPE + ); + + expertStore.registerDataValueExpert( + vv.experts.StringValue, + dv.StringValue.TYPE + ); + + expertStore.registerDataValueExpert( + vv.experts.TimeInput, + dv.TimeValue.TYPE + ); + + // Register experts for data types defined in Wikibase. Since those data types are defined by a + // setting, it needs to be checked whether they are actually defined. + + var commonsMediaType = dataTypeStore.getDataType( 'commonsMedia' ); + if( commonsMediaType ) { + expertStore.registerDataTypeExpert( + vv.experts.CommonsMediaType, + commonsMediaType.getId() + ); + } + + var urlType = dataTypeStore.getDataType( 'url' ); + if( urlType ) { + expertStore.registerDataTypeExpert( + vv.experts.StringValue, + urlType.getId() + ); + } + + return expertStore; + +}( wikibase, wikibase.dataTypes, jQuery.valueview, dataValues ) ); diff --git a/lib/resources/experts/wikibase.experts.register.js b/lib/resources/experts/wikibase.experts.register.js deleted file mode 100644 index 5591c19..0000000 --- a/lib/resources/experts/wikibase.experts.register.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @licence GNU GPL v2+ - * @author H. Snater < mediaw...@snater.com > - */ -( function( mw, wb, dataTypeStore, vv ) { - 'use strict'; - - mw.ext.valueView.expertProvider.registerDataValueExpert( - wb.experts.EntityIdInput, - wb.EntityId.TYPE - ); - - // Register experts for data types defined in Wikibase. Since those data types are defined by a - // setting, it needs to be checked whether they are actually defined. - - var commonsMediaType = dataTypeStore.getDataType( 'commonsMedia' ); - if( commonsMediaType ) { - mw.ext.valueView.expertProvider.registerDataTypeExpert( - vv.experts.CommonsMediaType, - commonsMediaType.getId() - ); - } - - var urlType = dataTypeStore.getDataType( 'url' ); - if( urlType ) { - mw.ext.valueView.expertProvider.registerDataTypeExpert( - vv.experts.StringValue, - urlType.getId() - ); - } - -}( mediaWiki, wikibase, wikibase.dataTypes, jQuery.valueview ) ); diff --git a/lib/resources/formatters/resources.php b/lib/resources/formatters/resources.php new file mode 100644 index 0000000..824434b --- /dev/null +++ b/lib/resources/formatters/resources.php @@ -0,0 +1,59 @@ +<?php +/** + * @licence GNU GPL v2+ + * @author H. Snater < mediaw...@snater.com > + * + * @codeCoverageIgnoreStart + */ +return call_user_func( function() { + + $remoteExtPathParts = explode( + DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2 + ); + $moduleTemplate = array( + 'localBasePath' => __DIR__, + 'remoteExtPath' => $remoteExtPathParts[1], + ); + + return array( + + 'wikibase.formatters.api' => $moduleTemplate + array( + 'scripts' => array( + 'wikibase.formatters.api.js', + ), + 'dependencies' => array( + 'wikibase', + 'wikibase.RepoApi', + 'wikibase.dataTypes' + ), + ), + + 'wikibase.ApiBasedValueFormatter' => $moduleTemplate + array( + 'scripts' => array( + 'ApiBasedValueFormatter.js', + ), + 'dependencies' => array( + 'mediawiki.api', + 'util.inherit', + 'valueFormatters.ValueFormatter', + 'wikibase.formatters.api', + ), + ), + + 'wikibase.formatters' => $moduleTemplate + array( + 'scripts' => array( + 'wikibase.formatters.js', + ), + 'dependencies' => array( + 'dataValues.values', + 'valueFormatters.formatters', + 'valueFormatters.ValueFormatterStore', + 'wikibase.ApiBasedValueFormatter', + 'wikibase.datamodel', + 'wikibase.dataTypes', + ), + ), + + ); + +} ); diff --git a/lib/resources/formatters/wikibase.formatters.js b/lib/resources/formatters/wikibase.formatters.js new file mode 100644 index 0000000..1b2e3df --- /dev/null +++ b/lib/resources/formatters/wikibase.formatters.js @@ -0,0 +1,55 @@ +/** + * @licence GNU GPL v2+ + * @author H. Snater < mediaw...@snater.com > + */ +wikibase.formatters = wikibase.formatters || {}; + +wikibase.formatters.store = ( function( wb, vf, dv, dataTypeStore ) { + 'use strict'; + + var formatterStore = new vf.ValueFormatterStore( vf.NullFormatter ); + + formatterStore.registerDataValueFormatter( + wb.formatters.ApiBasedValueFormatter, + wb.EntityId.TYPE + ); + + formatterStore.registerDataValueFormatter( + wb.formatters.ApiBasedValueFormatter, + dv.GlobeCoordinateValue.TYPE + ); + + formatterStore.registerDataValueFormatter( + wb.formatters.ApiBasedValueFormatter, + dv.QuantityValue.TYPE + ); + + formatterStore.registerDataValueFormatter( + wb.formatters.ApiBasedValueFormatter, + dv.StringValue.TYPE + ); + + formatterStore.registerDataValueFormatter( + wb.formatters.ApiBasedValueFormatter, + dv.TimeValue.TYPE + ); + + var commonsMediaType = dataTypeStore.getDataType( 'commonsMedia' ); + if( commonsMediaType ) { + formatterStore.registerDataTypeFormatter( + wb.formatters.ApiBasedValueFormatter, + commonsMediaType.getId() + ); + } + + var urlType = dataTypeStore.getDataType( 'url' ); + if( urlType ) { + formatterStore.registerDataTypeFormatter( + wb.formatters.ApiBasedValueFormatter, + urlType.getId() + ); + } + + return formatterStore; + +}( wikibase, valueFormatters, dataValues, wikibase.dataTypes ) ); diff --git a/lib/resources/formatters/wikibase.formatters.register.js b/lib/resources/formatters/wikibase.formatters.register.js deleted file mode 100644 index c008789..0000000 --- a/lib/resources/formatters/wikibase.formatters.register.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @licence GNU GPL v2+ - * @author H. Snater < mediaw...@snater.com > - */ -( function( mw, wb, dv, dataTypeStore ) { - 'use strict'; - - // Register Wikibase specific formatters: - - mw.ext.valueFormatters.valueFormatterProvider.registerDataValueFormatter( - wb.formatters.ApiBasedValueFormatter, - wb.EntityId.TYPE - ); - - mw.ext.valueFormatters.valueFormatterProvider.registerDataValueFormatter( - wb.formatters.ApiBasedValueFormatter, - dv.GlobeCoordinateValue.TYPE - ); - - mw.ext.valueFormatters.valueFormatterProvider.registerDataValueFormatter( - wb.formatters.ApiBasedValueFormatter, - dv.QuantityValue.TYPE - ); - - mw.ext.valueFormatters.valueFormatterProvider.registerDataValueFormatter( - wb.formatters.ApiBasedValueFormatter, - dv.StringValue.TYPE - ); - - mw.ext.valueFormatters.valueFormatterProvider.registerDataValueFormatter( - wb.formatters.ApiBasedValueFormatter, - dv.TimeValue.TYPE - ); - - var commonsMediaType = dataTypeStore.getDataType( 'commonsMedia' ); - if( commonsMediaType ) { - mw.ext.valueFormatters.valueFormatterProvider.registerDataTypeFormatter( - wb.formatters.ApiBasedValueFormatter, - commonsMediaType.getId() - ); - } - - var urlType = dataTypeStore.getDataType( 'url' ); - if( urlType ) { - mw.ext.valueFormatters.valueFormatterProvider.registerDataTypeFormatter( - wb.formatters.ApiBasedValueFormatter, - urlType.getId() - ); - } - -}( mediaWiki, wikibase, dataValues, wikibase.dataTypes ) ); diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js b/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js index 65bf22e..70f3d53 100644 --- a/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js +++ b/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js @@ -2,7 +2,7 @@ * @licence GNU GPL v2+ * @author Daniel Werner < daniel.wer...@wikimedia.de > */ -( function( mw, wb, $ ) { +( function( mw, wb, $, expertStore, formatterStore, parserStore ) { 'use strict'; var MODULE = $.wikibase.snakview.variations, @@ -311,7 +311,13 @@ return false; // no valueview created! } - var valueViewOptions = { value: dataValue }; + var valueViewOptions = { + expertStore: expertStore, + formatterStore: formatterStore, + parserStore: parserStore, + value: dataValue + }; + if( dataType ) { valueViewOptions.dataTypeId = dataType.getId(); valueViewOptions.dataValueType = dataType.getDataValueType(); @@ -350,4 +356,4 @@ } } ); -}( mediaWiki, wikibase, jQuery ) ); +}( mediaWiki, wikibase, jQuery, wikibase.experts, wikibase.formatters.store, wikibase.parsers.store ) ); diff --git a/lib/resources/parsers/resources.php b/lib/resources/parsers/resources.php new file mode 100644 index 0000000..f7fc98f --- /dev/null +++ b/lib/resources/parsers/resources.php @@ -0,0 +1,101 @@ +<?php +/** + * @licence GNU GPL v2+ + * @author H. Snater < mediaw...@snater.com > + * + * @codeCoverageIgnoreStart + */ +return call_user_func( function() { + + $remoteExtPathParts = explode( + DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR, __DIR__, 2 + ); + $moduleTemplate = array( + 'localBasePath' => __DIR__, + 'remoteExtPath' => $remoteExtPathParts[1], + ); + + return array( + + 'wikibase.parsers.api' => $moduleTemplate + array( + 'scripts' => array( + 'wikibase.parsers.api.js', + ), + 'dependencies' => array( + 'wikibase', + 'wikibase.RepoApi' + ), + ), + + 'wikibase.ApiBasedValueParser' => $moduleTemplate + array( + 'scripts' => array( + 'ApiBasedValueParser.js', + ), + 'dependencies' => array( + 'util.inherit', + 'valueParsers.ValueParser', + 'wikibase.parsers.api', + ), + ), + + 'wikibase.EntityIdParser' => $moduleTemplate + array( + 'scripts' => array( + 'EntityIdParser.js', + ), + 'dependencies' => array( + 'util.inherit', + 'valueParsers.ValueParser', + 'wikibase', + 'wikibase.datamodel', + ), + ), + + 'wikibase.GlobeCoordinateParser' => $moduleTemplate + array( + 'scripts' => array( + 'GlobeCoordinateParser.js', + ), + 'dependencies' => array( + 'util.inherit', + 'wikibase.ApiBasedValueParser', + ), + ), + + 'wikibase.QuantityParser' => $moduleTemplate + array( + 'scripts' => array( + 'QuantityParser.js', + ), + 'dependencies' => array( + 'util.inherit', + 'wikibase.ApiBasedValueParser', + ), + ), + + 'wikibase.TimeParser' => $moduleTemplate + array( + 'scripts' => array( + 'TimeParser.js', + ), + 'dependencies' => array( + 'util.inherit', + 'wikibase.ApiBasedValueParser', + ), + ), + + 'wikibase.parsers' => $moduleTemplate + array( + 'scripts' => array( + 'wikibase.parsers.js', + ), + 'dependencies' => array( + 'dataValues.values', + 'valueParsers.parsers', + 'valueParsers.ValueParserStore', + 'wikibase.datamodel', + 'wikibase.EntityIdParser', + 'wikibase.GlobeCoordinateParser', + 'wikibase.QuantityParser', + 'wikibase.TimeParser', + ), + ), + + ); + +} ); diff --git a/lib/resources/parsers/wikibase.parsers.js b/lib/resources/parsers/wikibase.parsers.js new file mode 100644 index 0000000..f7e177b --- /dev/null +++ b/lib/resources/parsers/wikibase.parsers.js @@ -0,0 +1,39 @@ +/** + * @licence GNU GPL v2+ + * @author H. Snater < mediaw...@snater.com > + */ +wikibase.parsers = wikibase.parsers || {}; + +wikibase.parsers.store = ( function( wb, vp, dv ) { + 'use strict'; + + var parserStore = new vp.ValueParserStore( vp.NullParser ); + + parserStore.registerDataValueParser( + wb.EntityIdParser, + wb.EntityId.TYPE + ); + + parserStore.registerDataValueParser( + wb.GlobeCoordinateParser, + dv.GlobeCoordinateValue.TYPE + ); + + parserStore.registerDataValueParser( + wb.QuantityParser, + dv.QuantityValue.TYPE + ); + + parserStore.registerDataValueParser( + vp.StringParser, + dv.StringValue.TYPE + ); + + parserStore.registerDataValueParser( + wb.TimeParser, + dv.TimeValue.TYPE + ); + + return parserStore; + +}( wikibase, valueParsers, dataValues ) ); diff --git a/lib/resources/parsers/wikibase.parsers.register.js b/lib/resources/parsers/wikibase.parsers.register.js deleted file mode 100644 index 2e0ba8f..0000000 --- a/lib/resources/parsers/wikibase.parsers.register.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @licence GNU GPL v2+ - * @author H. Snater < mediaw...@snater.com > - */ -( function( mw, wb, dv ) { - 'use strict'; - - // Register Wikibase specific parsers: - - mw.ext.valueParsers.valueParserProvider.registerDataValueParser( - wb.EntityIdParser, - wb.EntityId.TYPE - ); - - mw.ext.valueParsers.valueParserProvider.registerDataValueParser( - wb.GlobeCoordinateParser, - dv.GlobeCoordinateValue.TYPE - ); - - mw.ext.valueParsers.valueParserProvider.registerDataValueParser( - wb.TimeParser, - dv.TimeValue.TYPE - ); - - mw.ext.valueParsers.valueParserProvider.registerDataValueParser( - wb.QuantityParser, - dv.QuantityValue.TYPE - ); - -}( mediaWiki, wikibase, dataValues ) ); -- To view, visit https://gerrit.wikimedia.org/r/118968 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifc781f83c5f57f1f206acb7a28962e7ba2210b62 Gerrit-PatchSet: 11 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Henning Snater <henning.sna...@wikimedia.de> Gerrit-Reviewer: Adrian Lang <adrian.l...@wikimedia.de> Gerrit-Reviewer: Henning Snater <henning.sna...@wikimedia.de> Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de> Gerrit-Reviewer: WikidataJenkins <wikidata-servi...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits