Adrian Lang has uploaded a new change for review.
https://gerrit.wikimedia.org/r/188356
Change subject: Add WikibaseView skeleton
......................................................................
Add WikibaseView skeleton
Change-Id: Ibbeed0a72d593d4a8cb583badc38a95d8c320e80
---
M Wikibase.composer.php
A view/README.md
A view/WikibaseView.php
A view/init.mw.php
A view/resources.php
A view/resources.test.php
A view/resources/namespace.js
A view/resources/resources.php
A view/tests/qunit/resources.php
9 files changed, 135 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/56/188356/1
diff --git a/Wikibase.composer.php b/Wikibase.composer.php
index c5b1b66..04461d5 100644
--- a/Wikibase.composer.php
+++ b/Wikibase.composer.php
@@ -14,4 +14,11 @@
if ( !array_key_exists( 'wgEnableWikibaseClient', $GLOBALS ) ||
$GLOBALS['wgEnableWikibaseClient'] ) {
require_once __DIR__ . '/client/WikibaseClient.php';
-}
\ No newline at end of file
+}
+
+if (
+ !array_key_exists( 'wgEnableWikibaseClient', $GLOBALS ) ||
$GLOBALS['wgEnableWikibaseClient'] ||
+ !array_key_exists( 'wgEnableWikibaseRepo', $GLOBALS ) ||
$GLOBALS['wgEnableWikibaseRepo']
+) {
+ require_once __DIR__ . '/view/WikibaseView.php';
+}
diff --git a/view/README.md b/view/README.md
new file mode 100644
index 0000000..ea37982
--- /dev/null
+++ b/view/README.md
@@ -0,0 +1,9 @@
+# Wikibase View
+
+**Wikibase View** is the component responsible for the HTML-based frontend to
a [Wikibase](http://wikiba.se/) repository.
+
+## Release notes
+
+### 0.1 (dev)
+
+Initial release.
diff --git a/view/WikibaseView.php b/view/WikibaseView.php
new file mode 100644
index 0000000..f12461d
--- /dev/null
+++ b/view/WikibaseView.php
@@ -0,0 +1,18 @@
+<?php
+
+if ( !defined( 'WIKIBASE_VIEW_VERSION' ) ) {
+
+ define( 'WIKIBASE_VIEW_VERSION', '0.1-dev' );
+
+ // Include the composer autoloader if it is present.
+ if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
+ include_once __DIR__ . '/vendor/autoload.php';
+ }
+
+ if ( defined( 'MEDIAWIKI' ) ) {
+ call_user_func( function() {
+ require_once __DIR__ . '/init.mw.php';
+ } );
+ }
+
+}
diff --git a/view/init.mw.php b/view/init.mw.php
new file mode 100644
index 0000000..eb2554a
--- /dev/null
+++ b/view/init.mw.php
@@ -0,0 +1,20 @@
+<?php
+
+if ( !defined( 'MEDIAWIKI' ) ) {
+ die( 'Not an entry point.' );
+}
+
+$GLOBALS['wgExtensionCredits']['wikibase'][] = array(
+ 'path' => __FILE__,
+ 'name' => 'Wikibase View',
+ 'version' => WIKIBASE_VIEW_VERSION,
+ 'author' => array(
+ '[http://www.snater.com H. Snater]',
+ ),
+ 'url' =>
'https://git.wikimedia.org/summary/mediawiki%2Fextensions%2FWikibaseView',
+ 'description' => 'Wikibase View',
+ 'license-name' => 'GPL-2.0+'
+);
+
+include 'resources.php';
+include 'resources.test.php';
diff --git a/view/resources.php b/view/resources.php
new file mode 100644
index 0000000..3f66461
--- /dev/null
+++ b/view/resources.php
@@ -0,0 +1,14 @@
+<?php
+
+/**
+ * @license GNU GPL v2+
+ * @author Adrian Heine < [email protected] >
+ */
+return call_user_func( function() {
+ global $wgResourceModules;
+
+ $wgResourceModules = array_merge(
+ $wgResourceModules,
+ include __DIR__ . '/resources/resources.php'
+ );
+} );
diff --git a/view/resources.test.php b/view/resources.test.php
new file mode 100644
index 0000000..134de07
--- /dev/null
+++ b/view/resources.test.php
@@ -0,0 +1,15 @@
+<?php
+
+/**
+ * @license GNU GPL v2+
+ * @author Adrian Heine < [email protected] >
+ */
+global $wgHooks;
+$wgHooks['ResourceLoaderTestModules'][] = function( array &$testModules,
\ResourceLoader &$resourceLoader ) {
+ $testModules['qunit'] = array_merge(
+ $testModules['qunit'],
+ include 'tests/qunit/resources.php'
+ );
+
+ return true;
+};
diff --git a/view/resources/namespace.js b/view/resources/namespace.js
new file mode 100644
index 0000000..4192c33
--- /dev/null
+++ b/view/resources/namespace.js
@@ -0,0 +1,5 @@
+( function( wb ) {
+ 'use strict';
+
+ wb.view = wb.view || {};
+} ( wikibase ) );
diff --git a/view/resources/resources.php b/view/resources/resources.php
new file mode 100644
index 0000000..b47358d
--- /dev/null
+++ b/view/resources/resources.php
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * @license GNU GPL v2+
+ * @author Adrian Heine < [email protected] >
+ */
+return call_user_func( function() {
+ preg_match( '+' . preg_quote( DIRECTORY_SEPARATOR ) .
'(?:vendor|extensions)'
+ . preg_quote( DIRECTORY_SEPARATOR ) . '.*+', __DIR__,
$remoteExtPath );
+
+ $moduleTemplate = array(
+ 'localBasePath' => __DIR__,
+ 'remoteExtPath' => '..' . $remoteExtPath[0]
+ );
+
+ $modules = array(
+ 'wikibase.view.__namespace' => $moduleTemplate + array(
+ 'scripts' => array(
+ 'namespace.js'
+ ),
+ ),
+ );
+
+ return $modules;
+} );
diff --git a/view/tests/qunit/resources.php b/view/tests/qunit/resources.php
new file mode 100644
index 0000000..e06c6c8
--- /dev/null
+++ b/view/tests/qunit/resources.php
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * @license GNU GPL v2+
+ * @author Adrian Heine < [email protected] >
+ */
+return call_user_func( function() {
+ $remoteExtPathParts = explode(
+ DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR,
__DIR__, 2
+ );
+ $moduleBase = array(
+ 'localBasePath' => __DIR__,
+ 'remoteExtPath' => $remoteExtPathParts[1],
+ );
+
+ $modules = array(
+
+ );
+
+ return $modules;
+} );
--
To view, visit https://gerrit.wikimedia.org/r/188356
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibbeed0a72d593d4a8cb583badc38a95d8c320e80
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Adrian Lang <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits