[MediaWiki-commits] [Gerrit] 3d2png/deploy[master]: Update 3d2png to 4aa1a76

2017-12-06 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/395729 )

Change subject: Update 3d2png to 4aa1a76
..


Update 3d2png to 4aa1a76

List of changes:
c4e432e Add instructions to build 3d2png-deploy in an obvious place
c0f673c Increase far plane
0f2cbcd Fix in response to new three-stl-loader version
xxx Update node module dependencies

Change-Id: Iccf7bae71bd27d8acca37cd9ad09dfbf6fd8db97
---
M node_modules/ajv/dist/ajv.bundle.js
M node_modules/ajv/dist/ajv.min.js
M node_modules/ajv/dist/ajv.min.js.map
M node_modules/ajv/dist/nodent.min.js
M node_modules/ajv/dist/regenerator.min.js
M node_modules/ajv/lib/ajv.js
M node_modules/ajv/package.json
M src
8 files changed, 18 insertions(+), 18 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved




-- 
To view, visit https://gerrit.wikimedia.org/r/395729
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iccf7bae71bd27d8acca37cd9ad09dfbf6fd8db97
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png/deploy
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Increase far plane

2017-12-05 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/394535 )

Change subject: Increase far plane
..


Increase far plane

Bug: T181761
Change-Id: I21599269618a7f8cbd488d6db1ab647e95c02fb6
---
M 3d2png.js
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved
  Cparle: Looks good to me, but someone else must approve



diff --git a/3d2png.js b/3d2png.js
index 66c999f..9b95635 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -19,7 +19,7 @@
// Create a WebGL context and ask it to keep its rendering buffer
this.gl = GL( this.width, this.height, { preserveDrawingBuffer: true } 
);
this.canvas = new Canvas( this.width, this.height );
-   this.camera = new THREE.PerspectiveCamera( 60, this.width / 
this.height, 1, 5000 );
+   this.camera = new THREE.PerspectiveCamera( 60, this.width / 
this.height, 1, 50 );
this.renderer = new THREE.WebGLRenderer( { canvas: this.canvas, 
context: this.gl, antialias: true, preserveDrawingBuffer: true } );
this.scene = new THREE.Scene();
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/394535
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I21599269618a7f8cbd488d6db1ab647e95c02fb6
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: Cparle 
Gerrit-Reviewer: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Fix in response to new three-stl-loader version

2017-12-05 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/394997 )

Change subject: Fix in response to new three-stl-loader version
..


Fix in response to new three-stl-loader version

In 1.0.6, STLLoader (again) changed how it should init:
https://github.com/enspiral-cherubi/three-stl-loader/commit/58233f71ddbc93ecb1cd47c33ff3edba67ba6a16

It used to be like this in <=1.0.4, then changed in 1.0.5
(see I3a25c4209eee09ebd1811831576786f71888df20), and now again
in 1.0.6.

Bug: T181992
Change-Id: Ia82f9ebf3a3b2294dbc644fff1beb0007fcd9a5a
---
M 3d2png.js
1 file changed, 3 insertions(+), 5 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved
  Cparle: Looks good to me, but someone else must approve



diff --git a/3d2png.js b/3d2png.js
index 66c999f..b816ad6 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -4,10 +4,8 @@
THREE = require( 'three' ),
GL = require( 'gl' ),
fs = require( 'fs' ),
-   yargs = require( 'yargs' );
-
-// Add THREE.STLLoader
-require( 'three-stl-loader' )( THREE );
+   yargs = require( 'yargs' ),
+   STLLoader = require( 'three-stl-loader' )( THREE );
 
 /**
  * Converts 3D files to PNG images
@@ -69,7 +67,7 @@
 ThreeDtoPNG.prototype.getLoader = function() {
// TODO XXX if more file formats are supported later, need a command 
line option
// to signify the expected format of the input file.
-   return new THREE.STLLoader();
+   return new STLLoader();
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/394997
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia82f9ebf3a3b2294dbc644fff1beb0007fcd9a5a
Gerrit-PatchSet: 2
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: Cparle 
Gerrit-Reviewer: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[wmf/1.31.0-wmf.10]: Work around inconsistent $.when resolving

2017-12-01 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394607 )

Change subject: Work around inconsistent $.when resolving
..

Work around inconsistent $.when resolving

If there's only 1 element in the array fed to $.when,
it would resolve with the arguments of that single element,
instead of a nested array (like we'd get when we pass multiple
items to $.when)

In the case of upload campaigns, we can have only 1 deed,
in which case the could would error/block because it assumes
a nested array of error/warning results.

Bug: T181737
Change-Id: Ie1515824acc8a46fcb7378cb07b2762f097eb766
(cherry picked from commit bca4e9d66ca1e0d656bcf37c620676413dde03b4)
---
M resources/controller/uw.controller.Deed.js
1 file changed, 14 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/07/394607/1

diff --git a/resources/controller/uw.controller.Deed.js 
b/resources/controller/uw.controller.Deed.js
index eb31b94..6c875f9 100644
--- a/resources/controller/uw.controller.Deed.js
+++ b/resources/controller/uw.controller.Deed.js
@@ -42,7 +42,7 @@
uw.controller.Deed.prototype.moveNext = function () {
var
deedController = this,
-   valid, fields;
+   valid, fields, validityPromises;
 
if ( !this.deedChooser ) {
uw.controller.Step.prototype.moveNext.call( this );
@@ -52,11 +52,21 @@
valid = this.deedChooser.valid();
if ( valid ) {
fields = this.deedChooser.deed.getFields();
-
-   $.when.apply( $, fields.map( function ( fieldLayout ) {
+   validityPromises = fields.map( function ( fieldLayout ) 
{
// Update any error/warning messages
return fieldLayout.checkValidity( true );
-   } ) ).then( function () {
+   } );
+   if ( validityPromises.length === 1 ) {
+   // validityPromises will hold all promises for 
all uploads;
+   // adding a bogus promise (no warnings & 
errors) to
+   // ensure $.when always resolves with an array 
of multiple
+   // results (if there's just 1, it would 
otherwise have just
+   // that one's arguments, instead of a 
multi-dimensional array
+   // of upload warnings & failures)
+   validityPromises.push( $.Deferred().resolve( 
[], [] ).promise() );
+   }
+
+   $.when.apply( $, validityPromises ).then( function () {
// `arguments` will be an array of all fields, 
with their warnings & errors
// e.g. `[[something], []], [[], [something]]` 
for 2 fields, where the first one has
// a warning and the last one an error

-- 
To view, visit https://gerrit.wikimedia.org/r/394607
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1515824acc8a46fcb7378cb07b2762f097eb766
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: wmf/1.31.0-wmf.10
Gerrit-Owner: MarkTraceur 
Gerrit-Reviewer: Matthias Mullie 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png/deploy[master]: Update 3d2png to 55c253d

2017-11-29 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/393730 )

Change subject: Update 3d2png to 55c253d
..


Update 3d2png to 55c253d

List of changes:
cd60120 Upgrade three.js & STLLoader
90df73a Improve camera rotation & initial position
55c253d Improve 3D display
xxx Update node module dependencies

Change-Id: Iebd20dbe2c9f6ae63e11f77cdbe4251b3520b908
---
A node_modules/.bin/node-pre-gyp
M node_modules/abbrev/LICENSE
M node_modules/abbrev/package.json
M node_modules/ajv/.tonic_example.js
M node_modules/ajv/dist/ajv.bundle.js
M node_modules/ajv/dist/ajv.min.js
M node_modules/ajv/dist/ajv.min.js.map
M node_modules/ajv/dist/nodent.min.js
M node_modules/ajv/dist/regenerator.min.js
A node_modules/ajv/lib/$data.js
M node_modules/ajv/lib/ajv.d.ts
M node_modules/ajv/lib/ajv.js
M node_modules/ajv/lib/compile/_rules.js
A node_modules/ajv/lib/compile/async.js
M node_modules/ajv/lib/compile/equal.js
A node_modules/ajv/lib/compile/error_classes.js
M node_modules/ajv/lib/compile/formats.js
M node_modules/ajv/lib/compile/index.js
M node_modules/ajv/lib/compile/resolve.js
M node_modules/ajv/lib/compile/rules.js
M node_modules/ajv/lib/compile/util.js
M node_modules/ajv/lib/dot/_limit.jst
M node_modules/ajv/lib/dot/anyOf.jst
A node_modules/ajv/lib/dot/const.jst
A node_modules/ajv/lib/dot/contains.jst
M node_modules/ajv/lib/dot/custom.jst
M node_modules/ajv/lib/dot/definitions.def
M node_modules/ajv/lib/dot/dependencies.jst
M node_modules/ajv/lib/dot/errors.def
M node_modules/ajv/lib/dot/format.jst
M node_modules/ajv/lib/dot/items.jst
M node_modules/ajv/lib/dot/missing.def
M node_modules/ajv/lib/dot/oneOf.jst
M node_modules/ajv/lib/dot/properties.jst
A node_modules/ajv/lib/dot/propertyNames.jst
M node_modules/ajv/lib/dot/ref.jst
M node_modules/ajv/lib/dot/required.jst
M node_modules/ajv/lib/dot/validate.jst
M node_modules/ajv/lib/dotjs/_limit.js
M node_modules/ajv/lib/dotjs/_limitItems.js
M node_modules/ajv/lib/dotjs/_limitLength.js
M node_modules/ajv/lib/dotjs/_limitProperties.js
M node_modules/ajv/lib/dotjs/allOf.js
M node_modules/ajv/lib/dotjs/anyOf.js
A node_modules/ajv/lib/dotjs/const.js
A node_modules/ajv/lib/dotjs/contains.js
M node_modules/ajv/lib/dotjs/custom.js
M node_modules/ajv/lib/dotjs/dependencies.js
M node_modules/ajv/lib/dotjs/enum.js
M node_modules/ajv/lib/dotjs/format.js
M node_modules/ajv/lib/dotjs/items.js
M node_modules/ajv/lib/dotjs/multipleOf.js
M node_modules/ajv/lib/dotjs/not.js
M node_modules/ajv/lib/dotjs/oneOf.js
M node_modules/ajv/lib/dotjs/pattern.js
M node_modules/ajv/lib/dotjs/properties.js
A node_modules/ajv/lib/dotjs/propertyNames.js
M node_modules/ajv/lib/dotjs/ref.js
M node_modules/ajv/lib/dotjs/required.js
M node_modules/ajv/lib/dotjs/uniqueItems.js
M node_modules/ajv/lib/dotjs/validate.js
M node_modules/ajv/lib/keyword.js
A node_modules/ajv/lib/patternGroups.js
A node_modules/ajv/lib/refs/$data.json
A node_modules/ajv/lib/refs/json-schema-draft-06.json
M node_modules/ajv/lib/refs/json-schema-v5.json
M node_modules/ajv/package.json
M node_modules/ajv/scripts/bundle.js
M node_modules/ajv/scripts/compile-dots.js
M node_modules/aproba/index.js
M node_modules/aproba/package.json
M node_modules/assert-plus/assert.js
M node_modules/assert-plus/package.json
A node_modules/async/all.js
A node_modules/async/allLimit.js
A node_modules/async/allSeries.js
A node_modules/async/any.js
A node_modules/async/anyLimit.js
A node_modules/async/anySeries.js
M node_modules/async/dist/async.js
M node_modules/async/dist/async.min.js
A node_modules/async/dist/async.min.map
A node_modules/async/find.js
A node_modules/async/findLimit.js
A node_modules/async/findSeries.js
A node_modules/async/foldl.js
A node_modules/async/foldr.js
A node_modules/async/forEach.js
A node_modules/async/forEachLimit.js
A node_modules/async/forEachOf.js
A node_modules/async/forEachOfLimit.js
A node_modules/async/forEachOfSeries.js
A node_modules/async/forEachSeries.js
M node_modules/async/index.js
A node_modules/async/inject.js
M node_modules/async/internal/queue.js
M node_modules/async/nextTick.js
M node_modules/async/package.json
M node_modules/async/retry.js
A node_modules/async/select.js
A node_modules/async/selectLimit.js
A node_modules/async/selectSeries.js
M node_modules/async/setImmediate.js
M node_modules/async/tryEach.js
A node_modules/async/wrapSync.js
M node_modules/aws-sign2/index.js
M node_modules/aws-sign2/package.json
M node_modules/aws4/package.json
M node_modules/boom/LICENSE
M node_modules/boom/lib/index.js
M node_modules/boom/package.json
M node_modules/canvas/build/Release/.deps/Release/obj.target/canvas.node.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/Canvas.o.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/CanvasGradient.o.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/CanvasPattern.o.d
M 
node_modules/canvas/build/Rel

[MediaWiki-commits] [Gerrit] 3d2png[master]: Add instructions to build 3d2png-deploy in an obvious place

2017-11-28 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/393728 )

Change subject: Add instructions to build 3d2png-deploy in an obvious place
..


Add instructions to build 3d2png-deploy in an obvious place

These instructions were copied over from the commit msg
of If4212483a31e38081345e58541e88ca440cd8eeb

Change-Id: Ib490c90eacde9b73f3bb113dbfa3602a47da1787
---
M README.md
1 file changed, 27 insertions(+), 1 deletion(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/README.md b/README.md
index c4a9568..d29b7e6 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,29 @@
 # 3d2png
 
-Simple thumbnail generator for AMF and STL files. It tries to pick a 
reasonable camera position based on the bounding box of the geometry.
+Simple thumbnail generator for AMF and STL files. It tries to pick a reasonable
+camera position based on the bounding box of the geometry.
+
+## How to build 3d2png-deploy
+
+The deploy repository needs to be built on a system as similar to the
+production hosts as possible. For this reason, we use the service-runner
+package, which spins up a Docker container based on the definition
+provided in the `deploy` stanza of package.json, installs the
+distribution packages needed, builds the node_modules directory and
+updates the source repo submodule.
+
+To that end, this commit adds the deployment definition to package.json
+and service-runner as a development dependency (which means it will not
+get installed into the deploy repository). There is also a minimal
+config.yaml file that is needed by service-runner in order to build the
+deploy repository.
+
+Note that in order for the build process to work you need Docker set up
+on the machine, as well as configure git to point to the location of the
+deploy repository:
+
+$ git config deploy.dir /full/path/to/deploy/repo
+
+The build process can then be initiated with
+
+$ npm run build-deploy

-- 
To view, visit https://gerrit.wikimedia.org/r/393728
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib490c90eacde9b73f3bb113dbfa3602a47da1787
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Improve 3D display

2017-11-21 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/391581 )

Change subject: Improve 3D display
..


Improve 3D display

Add a shadow-casting light to the side.

To be merged along with I8ca5bd13ed490d56cfa38834a37d2dca0bf248b5,
which updates shadows in Extension:3D

Bug: T178360
Change-Id: Ia1fa617ed220aaa6f891b6385cf41c245dc74263
---
M 3d2png.js
1 file changed, 23 insertions(+), 21 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/3d2png.js b/3d2png.js
index c2ef91a..66c999f 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -28,20 +28,26 @@
  * Sets up the Three environment (ambient light, camera, renderer)
  */
 ThreeDtoPNG.prototype.setupEnvironment = function() {
-   var ambient = new THREE.AmbientLight( 0x66 ),
-   dlight = new THREE.DirectionalLight( 0x99 ),
-   point = new THREE.PointLight( 0xff, 0.4 );
+   var light;
 
-   dlight.position.set( 0, 0, 1 );
-   dlight.castShadow = true;
+   this.renderer.setClearColor( 0x22 );
+   this.renderer.setSize( this.width, this.height, false );
+   this.renderer.shadowMap.enabled = true;
 
-   this.scene.add( ambient );
-   this.scene.add( dlight );
-   this.camera.add( point );
+   this.camera.up.set( 0, 0, 1 );
+   this.camera.add( new THREE.PointLight( 0xff, 0.3 ) );
+
+   this.scene.add( new THREE.AmbientLight( 0x66, 0.5 ) );
this.scene.add( this.camera );
 
-   this.renderer.setSize( this.width, this.height, false );
-   this.renderer.setClearColor( 0x22 );
+   light = new THREE.SpotLight( 0x99, 1 );
+   light.position.set( -100, 50, 25 );
+   light.castShadow = true;
+   light.shadow.mapSize.width = 4096;
+   light.shadow.mapSize.height = 4096;
+   this.camera.add( light );
+
+   this.render();
 };
 
 /**
@@ -50,7 +56,7 @@
  * @returns {THREE.Mesh} mesh
  */
 ThreeDtoPNG.prototype.outputToObject = function ( geometry ) {
-   var material = new THREE.MeshPhongMaterial( { color: 0xF8F9FA, shading: 
THREE.FlatShading } );
+   var material = new THREE.MeshPhongMaterial( { color: 0xc3bdae, 
shininess: 10, flatShading: true } );
 
return new THREE.Mesh( geometry, material );
 };
@@ -102,15 +108,14 @@
  */
 ThreeDtoPNG.prototype.addDataToScene = function( loader, data ) {
// Convert the input data into an array buffer
-   var arrayBuffer = new Uint8Array( data ).buffer;
-
-   // Parse the contents of the input buffer
-   output = loader.parse( arrayBuffer );
-
-   // Convert what the loader returns into an object we can add to the 
scene
-   object = this.outputToObject( output );
+   var arrayBuffer = new Uint8Array( data ).buffer,
+   // Parse the contents of the input buffer
+   output = loader.parse( arrayBuffer ),
+   // Convert what the loader returns into an object we can add to 
the scene
+   object = this.outputToObject( output );
 
object.castShadow = true;
+   object.receiveShadow = true;
 
// Position the camera relative to the object
// This allows us to look at the object from enough distance and from
@@ -120,11 +125,8 @@
// Add the object to the scene
this.scene.add( object );
 
-   this.camera.up.set( 0, 0, 1 );
-
// Point camera at the scene
this.camera.lookAt( this.scene.position );
-
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/391581
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia1fa617ed220aaa6f891b6385cf41c245dc74263
Gerrit-PatchSet: 2
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: Matthias Mullie 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Improve camera rotation & initial position

2017-11-20 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/391580 )

Change subject: Improve camera rotation & initial position
..


Improve camera rotation & initial position

To be merged along with Iff721b17c407785635cf4fbb02dbbdef340a34e8,
which updates rotation in Extension:3D

Bug: T179887
Change-Id: I99d681034ebeb5871a2ec0098d4896a46dadf8ab
---
M 3d2png.js
1 file changed, 18 insertions(+), 13 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/3d2png.js b/3d2png.js
index 6f13d6e..c2ef91a 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -70,23 +70,28 @@
  * Positions the camera relative to an object, at an angle
  * @param {THREE.Group|THREE.Mesh} object
  */
-ThreeDtoPNG.prototype.positionCamera = function( object ) {
+ThreeDtoPNG.prototype.center = function( object ) {
+   var radius;
+
if ( object.type == 'Group' ) {
-   this.positionCamera( object.children[0] );
+   this.center( object.children[ 0 ] );
} else if ( object.type == 'Mesh' ) {
object.geometry.center();
-   object.geometry.computeBoundingBox();
-   bbox = object.geometry.boundingBox;
+   object.geometry.computeBoundingSphere();
 
-   bbox_width = bbox.max.x - bbox.min.x;
-   bbox_height = bbox.max.z - bbox.min.z;
-   bbox_depth = bbox.max.y - bbox.min.y;
+   radius = object.geometry.boundingSphere.radius;
 
-   camerax = -bbox_width;
-   cameray = -bbox_depth;
-   cameraz = bbox_height;
-
-   this.camera.position.set( camerax, cameray, cameraz );
+   // `radius` is the edge of the object's sphere
+   // We want to position our camera outside of that sphere.
+   // We'll move `radius` (or more) in all directions (x, y, z), 
so that we're
+   // looking at the object somewhat diagonally, which should 
always show something
+   // useful (instead of possibly an uninteresting side or top...)
+   // The exact position of the camera was arbitrarily decided by 
what looked
+   // alright-ish for a few files I was testing with.
+   // sketchfab.com has this at ( 0, -distance, 0 )
+   // viewstl.com has this at ( 0, 0 distance )
+   // openjscad.org has this at ( 0, -distance, distance )
+   this.camera.position.set( radius * 1.5, -radius * 1.5, radius );
}
 };
 
@@ -110,7 +115,7 @@
// Position the camera relative to the object
// This allows us to look at the object from enough distance and from
// an angle
-   this.positionCamera( object );
+   this.center( object );
 
// Add the object to the scene
this.scene.add( object );

-- 
To view, visit https://gerrit.wikimedia.org/r/391580
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I99d681034ebeb5871a2ec0098d4896a46dadf8ab
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Upgrade three.js & STLLoader

2017-11-20 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/391573 )

Change subject: Upgrade three.js & STLLoader
..


Upgrade three.js & STLLoader

To be merged along with I71056fe8312015421db8097551fe57b887ac16eb,
which updates versions in Extension:3D

Change-Id: I4ac5276f4ab595636952edffe05d5f7fbfd228ad
---
M package.json
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/package.json b/package.json
index 3755392..ac24779 100644
--- a/package.json
+++ b/package.json
@@ -13,8 +13,8 @@
   "dependencies": {
 "canvas": "1.6.5",
 "gl": "4.0.3",
-"three": "0.85.2",
-"three-stl-loader": "1.0.5",
+"three": "0.88.0",
+"three-stl-loader": "1.0.6",
 "yargs": "8.0.2"
   },
   "devDependencies": {

-- 
To view, visit https://gerrit.wikimedia.org/r/391573
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4ac5276f4ab595636952edffe05d5f7fbfd228ad
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...WikibaseMediaInfo[master]: Replace default entity ID lookup for MediaInfo

2017-11-13 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391052 )

Change subject: Replace default entity ID lookup for MediaInfo
..

Replace default entity ID lookup for MediaInfo

Depends-On: I98721e31c9c43545995abf67d9a998761dd94417
Bug: T177022
Change-Id: I1c4f6fac09ec4245c3f50fcf02ccfb617e62771c
---
M extension.json
M src/Services/MediaInfoIdLookup.php
M src/WikibaseMediaInfoHooks.php
3 files changed, 44 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseMediaInfo 
refs/changes/52/391052/1

diff --git a/extension.json b/extension.json
index ccf7452..67fe45e 100644
--- a/extension.json
+++ b/extension.json
@@ -41,6 +41,9 @@
],
"ImagePageAfterImageLinks": [

"Wikibase\\MediaInfo\\WikibaseMediaInfoHooks::onImagePageAfterImageLinks"
+   ],
+   "GetEntityByTitleLookup": [
+   
"Wikibase\\MediaInfo\\WikibaseMediaInfoHooks::onGetEntityByTitleLookup"
]
},
"MessagesDirs": {
diff --git a/src/Services/MediaInfoIdLookup.php 
b/src/Services/MediaInfoIdLookup.php
index 91d93a3..964fbdb 100644
--- a/src/Services/MediaInfoIdLookup.php
+++ b/src/Services/MediaInfoIdLookup.php
@@ -2,10 +2,14 @@
 
 namespace Wikibase\MediaInfo\Services;
 
+use Title;
+use Wikibase\Repo\WikibaseRepo;
+use Wikibase\MediaInfo\DataModel\MediaInfo;
 use InvalidArgumentException;
 use MediaWiki\Linker\LinkTarget;
 use Wikibase\MediaInfo\DataModel\MediaInfoId;
 use Wikimedia\Assert\Assert;
+use Wikibase\Lib\Store\EntityByTitleLookup;
 
 /**
  * Lookup service for getting the MediaInfoId that corresponds to a LinkTarget.
@@ -13,7 +17,7 @@
  * @license GPL 2+
  * @author Daniel Kinzler
  */
-class MediaInfoIdLookup {
+class MediaInfoIdLookup implements EntityByTitleLookup {
 
/**
 * @var integer
@@ -32,6 +36,38 @@
}
 
/**
+* Fetch the entity ID for the file page.
+*
+* @param string $globalSiteId
+* @param string $pageTitle
+*
+* @return EntityId|null
+*/
+   public function getEntityIdForLink( $globalSiteId, $pageTitle ) {
+   // Ignore site, assume title is local...
+   $pageTitle = Title::newFromText( $pageTitle );
+
+   if ( !$pageTitle->inNamespace( NS_FILE ) ) {
+   return null;
+   }
+
+   $pageId = $pageTitle->getArticleID();
+
+   if ( !$pageId ) {
+   return null;
+   }
+
+   $wikibaseRepo = WikibaseRepo::getDefaultInstance();
+   $entityId = 
$wikibaseRepo->getEntityIdComposer()->composeEntityId(
+   '',
+   MediaInfo::ENTITY_TYPE,
+   $pageId
+   );
+
+   return $entityId;
+   }
+
+   /**
 * @param LinkTarget $title The page the MediaInfo object would be 
stored on.
 *
 * @return null|MediaInfoId The ID of the MediaInfo object that is (or 
could be) stored on
diff --git a/src/WikibaseMediaInfoHooks.php b/src/WikibaseMediaInfoHooks.php
index 18100fc..a788459 100644
--- a/src/WikibaseMediaInfoHooks.php
+++ b/src/WikibaseMediaInfoHooks.php
@@ -5,6 +5,7 @@
 use ImagePage;
 use MediaWiki\MediaWikiServices;
 use Wikibase\MediaInfo\DataModel\MediaInfo;
+use Wikibase\MediaInfo\Services\MediaInfoServices;
 use Wikibase\Repo\WikibaseRepo;
 
 /**
@@ -65,4 +66,7 @@
$html .= '' . $linkHtml . '';
}
 
+   public static function onGetEntityByTitleLookup( &$lookup ) {
+   $lookup = MediaInfoServices::getMediaInfoIdLookup();
+   }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/391052
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c4f6fac09ec4245c3f50fcf02ccfb617e62771c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseMediaInfo
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Add hook for injecting alternate entity ID lookup

2017-11-13 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391051 )

Change subject: Add hook for injecting alternate entity ID lookup
..

Add hook for injecting alternate entity ID lookup

Bug: T177022
Change-Id: I98721e31c9c43545995abf67d9a998761dd94417
---
M repo/includes/Store/Sql/SqlStore.php
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/51/391051/1

diff --git a/repo/includes/Store/Sql/SqlStore.php 
b/repo/includes/Store/Sql/SqlStore.php
index 2e8324c..74c4dbc 100644
--- a/repo/includes/Store/Sql/SqlStore.php
+++ b/repo/includes/Store/Sql/SqlStore.php
@@ -5,6 +5,7 @@
 use HashBagOStuff;
 use ObjectCache;
 use Revision;
+use Hooks;
 use Wikibase\DataAccess\WikibaseServices;
 use Wikibase\DataModel\Entity\EntityIdParser;
 use Wikibase\DataModel\Entity\Item;
@@ -316,7 +317,11 @@
 * @return EntityByTitleLookup
 */
public function getEntityByTitleLookup() {
-   return $this->newSiteLinkStore();
+   $lookup = $this->newSiteLinkStore();
+
+   Hooks::run( 'GetEntityByTitleLookup', [ &$lookup ] );
+
+   return $lookup;
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/391051
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98721e31c9c43545995abf67d9a998761dd94417
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: [WIP] Add hook for more entity lookups based on title

2017-10-26 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386693 )

Change subject: [WIP] Add hook for more entity lookups based on title
..

[WIP] Add hook for more entity lookups based on title

This may be a straw-man, but I didn't see any better place to do this lookup.

See https://gerrit.wikimedia.org/r/386692 for implementation of new hook.

Bug: T177022
Change-Id: I321eefc6cccaf6ff2dfcd853d296ddfc60ff0491
---
M lib/includes/Store/Sql/SiteLinkTable.php
1 file changed, 19 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/93/386693/1

diff --git a/lib/includes/Store/Sql/SiteLinkTable.php 
b/lib/includes/Store/Sql/SiteLinkTable.php
index 28f0830..53596f3 100644
--- a/lib/includes/Store/Sql/SiteLinkTable.php
+++ b/lib/includes/Store/Sql/SiteLinkTable.php
@@ -2,6 +2,7 @@
 
 namespace Wikibase\Lib\Store\Sql;
 
+use Hooks;
 use DBAccessBase;
 use MWException;
 use Wikibase\DataModel\Entity\EntityId;
@@ -351,7 +352,23 @@
 * @return EntityId|null
 */
public function getEntityIdForLink( $globalSiteId, $pageTitle ) {
-   return $this->getItemIdForLink( $globalSiteId, $pageTitle );
-   }
+   $results = [
+   'alternative' => [],
+   ];
 
+   $results['preferred'] = $this->getItemIdForLink( $globalSiteId, 
$pageTitle );
+
+
+   Hooks::run( 'GetEntityIdForLink', [ $globalSiteId, $pageTitle, 
&$results ] );
+
+   if ( $results['preferred'] === null && count( 
$results['alternative'] ) > 0 ) {
+   foreach ( $results['alternative'] as $altResult ) {
+   if ( $altResult !== null ) {
+   return $altResult;
+   }
+   }
+   }
+
+   return $results['preferred'];
+   }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/386693
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I321eefc6cccaf6ff2dfcd853d296ddfc60ff0491
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...WikibaseMediaInfo[master]: [WIP] Look up entity IDs based on title

2017-10-26 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386692 )

Change subject: [WIP] Look up entity IDs based on title
..

[WIP] Look up entity IDs based on title

WIP - not sure what the hook interface will look like in the end, but
this works currently.

Bug: T177022
Change-Id: Icd239d7321f678a714265ff2593b0b85a1f2
---
M extension.json
M src/WikibaseMediaInfoHooks.php
2 files changed, 39 insertions(+), 11 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseMediaInfo 
refs/changes/92/386692/1

diff --git a/extension.json b/extension.json
index ccf7452..1d454dd 100644
--- a/extension.json
+++ b/extension.json
@@ -41,6 +41,9 @@
],
"ImagePageAfterImageLinks": [

"Wikibase\\MediaInfo\\WikibaseMediaInfoHooks::onImagePageAfterImageLinks"
+   ],
+   "GetEntityIdForLink": [
+   
"Wikibase\\MediaInfo\\WikibaseMediaInfoHooks::onGetEntityIdForLink"
]
},
"MessagesDirs": {
diff --git a/src/WikibaseMediaInfoHooks.php b/src/WikibaseMediaInfoHooks.php
index 18100fc..890e160 100644
--- a/src/WikibaseMediaInfoHooks.php
+++ b/src/WikibaseMediaInfoHooks.php
@@ -2,6 +2,7 @@
 
 namespace Wikibase\MediaInfo;
 
+use Title;
 use ImagePage;
 use MediaWiki\MediaWikiServices;
 use Wikibase\MediaInfo\DataModel\MediaInfo;
@@ -14,6 +15,34 @@
  * @author Bene* < benestar.wikime...@gmail.com >
  */
 class WikibaseMediaInfoHooks {
+
+   /**
+* Helper function to get MediaInfo entity ID based on title
+*
+* @param Title $pageTitle
+*
+* @return EntityId|null
+*/
+   private static function getEntityIdForTitle( Title $pageTitle ) {
+   if ( !$pageTitle->inNamespace( NS_FILE ) ) {
+   return null;
+   }
+
+   $pageId = $pageTitle->getArticleID();
+
+   if ( !$pageId ) {
+   return;
+   }
+
+   $wikibaseRepo = WikibaseRepo::getDefaultInstance();
+   $entityId = 
$wikibaseRepo->getEntityIdComposer()->composeEntityId(
+   '',
+   MediaInfo::ENTITY_TYPE,
+   $pageId
+   );
+
+   return $entityId;
+   }
 
/**
 * Hook to register the MediaInfo entity namespaces for 
EntityNamespaceLookup.
@@ -47,22 +76,18 @@
 
public static function onImagePageAfterImageLinks( ImagePage $page, 
&$html ) {
$imgTitle = $page->getTitle();
-   $pageId = $imgTitle->getArticleID();
-
-   if ( !$pageId ) {
-   return;
-   }
-
+   $entityId = self::getEntityIdForTitle( $imgTitle );
$wikibaseRepo = WikibaseRepo::getDefaultInstance();
-   $entityId = 
$wikibaseRepo->getEntityIdComposer()->composeEntityId(
-   '',
-   MediaInfo::ENTITY_TYPE,
-   $pageId
-   );
$title = $wikibaseRepo->getEntityTitleLookup()->getTitleForId( 
$entityId );
$linkHtml = 
MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink( $title );
 
$html .= '' . $linkHtml . '';
}
 
+   public static function onGetEntityIdForLink( $siteId, $pageTitle, array 
&$results ) {
+   $imgTitle = Title::newFromText( $pageTitle );
+   $entityId = self::getEntityIdForTitle( $imgTitle );
+   $results['alternative'][] = $entityId;
+   return true;
+   }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/386692
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd239d7321f678a714265ff2593b0b85a1f2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseMediaInfo
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...WikibaseMediaInfo[master]: [WIP] Add lookup services for title <--> ID

2017-10-18 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384996 )

Change subject: [WIP] Add lookup services for title <--> ID
..

[WIP] Add lookup services for title <--> ID

Bug: T177022
Change-Id: I152b57de8c8076158ebad56b08833dd6f34db29c
---
M WikibaseMediaInfo.entitytypes.php
A src/DataAccess/MediaInfoIdLookup.php
A src/DataAccess/MediaInfoTitleLookup.php
3 files changed, 91 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseMediaInfo 
refs/changes/96/384996/1

diff --git a/WikibaseMediaInfo.entitytypes.php 
b/WikibaseMediaInfo.entitytypes.php
index bc918c7..f7f07f7 100644
--- a/WikibaseMediaInfo.entitytypes.php
+++ b/WikibaseMediaInfo.entitytypes.php
@@ -23,6 +23,8 @@
 use Wikibase\MediaInfo\Content\MediaInfoContent;
 use Wikibase\MediaInfo\Content\MediaInfoHandler;
 use Wikibase\MediaInfo\Content\MissingMediaInfoHandler;
+use Wikibase\MediaInfo\DataAccess\MediaInfoIdLookup;
+use Wikibase\MediaInfo\DataAccess\MediaInfoTitleLookup;
 use Wikibase\MediaInfo\DataModel\MediaInfo;
 use Wikibase\MediaInfo\DataModel\MediaInfoId;
 use Wikibase\MediaInfo\DataModel\Serialization\MediaInfoDeserializer;
@@ -140,5 +142,13 @@

$changeOpDeserializerFactory->getClaimsChangeOpDeserializer()
);
},
+
+   'id-lookup' => function () {
+   return new MediaInfoIdLookup();
+   },
+
+   'title-lookup' => function () {
+   return new MediaInfoTitleLookup();
+   },
]
 ];
diff --git a/src/DataAccess/MediaInfoIdLookup.php 
b/src/DataAccess/MediaInfoIdLookup.php
new file mode 100644
index 000..4590bf9
--- /dev/null
+++ b/src/DataAccess/MediaInfoIdLookup.php
@@ -0,0 +1,49 @@
+getEntityIdForTitle( $title );
+   if ( isset( $id ) ) {
+   $ids[ $title ] = $id;
+   }
+   }
+
+   return $ids;
+   }
+
+   /**
+* @see EntityIdLookup::getEntityIdForTitle
+*
+* @param Title $title
+*
+* @return EntityId|null
+*/
+   public function getEntityIdForTitle( Title $title ) {
+   $lookup = MediaInfoServices::getMediaInfoIdLookup();
+
+   return $lookup->getIdFromLinkTarget( $title );
+   }
+}
diff --git a/src/DataAccess/MediaInfoTitleLookup.php 
b/src/DataAccess/MediaInfoTitleLookup.php
new file mode 100644
index 000..2be6068
--- /dev/null
+++ b/src/DataAccess/MediaInfoTitleLookup.php
@@ -0,0 +1,32 @@
+getFilePage( $id );
+   }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/384996
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I152b57de8c8076158ebad56b08833dd6f34db29c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseMediaInfo
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...WikibaseMediaInfo[master]: Add wbgetmediainfo API module

2017-10-05 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382604 )

Change subject: Add wbgetmediainfo API module
..

Add wbgetmediainfo API module

This is basically a shortcut to wbgetentities that allows the
API user to get a MediaInfo entity without querying for the
MediaInfo ID (either by getting the page info and looking at
the page_id, or by querying the new page_props entry), and using
the file page title instead.

n.b. https://gerrit.wikimedia.org/r/382603 must be merged first.

Bug: T177022
Change-Id: I1db3b2f1ea303af99da86ea1635d4f623a9139e3
---
M extension.json
A src/Api/ApiGetMediaInfo.php
M src/WikibaseMediaInfoHooks.php
3 files changed, 173 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseMediaInfo 
refs/changes/04/382604/1

diff --git a/extension.json b/extension.json
index ccf7452..98e1789 100644
--- a/extension.json
+++ b/extension.json
@@ -13,6 +13,7 @@
"MediaInfoNamespace": 144,
"MediaInfoNamespaceTalk": 145
},
+   "callback": 
"Wikibase\\MediaInfo\\WikibaseMediaInfoHooks::onRegistration",
"namespaces": [
{
"id": 144,
diff --git a/src/Api/ApiGetMediaInfo.php b/src/Api/ApiGetMediaInfo.php
new file mode 100644
index 000..c65b655
--- /dev/null
+++ b/src/Api/ApiGetMediaInfo.php
@@ -0,0 +1,138 @@
+
+ */
+class ApiGetMediaInfo extends GetEntities {
+   /**
+* @param ApiMain $mainModule
+* @param string $moduleName
+* @param StringNormalizer $stringNormalizer
+* @param LanguageFallbackChainFactory $languageFallbackChainFactory
+* @param SiteLinkTargetProvider $siteLinkTargetProvider
+* @param EntityPrefetcher $entityPrefetcher
+* @param string[] $siteLinkGroups
+* @param ApiErrorReporter $errorReporter
+* @param ResultBuilder $resultBuilder
+* @param EntityRevisionLookup $entityRevisionLookup
+* @param EntityIdParser $idParser
+*
+* @see ApiBase::__construct
+*/
+   public function __construct(
+   ApiMain $mainModule,
+   $moduleName,
+   StringNormalizer $stringNormalizer,
+   LanguageFallbackChainFactory $languageFallbackChainFactory,
+   SiteLinkTargetProvider $siteLinkTargetProvider,
+   EntityPrefetcher $entityPrefetcher,
+   array $siteLinkGroups,
+   ApiErrorReporter $errorReporter,
+   ResultBuilder $resultBuilder,
+   EntityRevisionLookup $entityRevisionLookup,
+   EntityIdParser $idParser
+   ) {
+   parent::__construct(
+   $mainModule,
+   $moduleName,
+   $stringNormalizer,
+   $languageFallbackChainFactory,
+   $siteLinkTargetProvider,
+   $entityPrefetcher,
+   $siteLinkGroups,
+   $errorReporter,
+   $resultBuilder,
+   $entityRevisionLookup,
+   $idParser
+   );
+   }
+
+   /**
+* @see ApiBase::execute()
+*/
+   public function execute() {
+   $this->getMain()->setCacheMode( 'public' );
+
+   $wikibaseRepo = WikibaseRepo::getDefaultInstance();
+   $params = $this->extractRequestParams();
+
+   if ( !isset( $params['titles'] ) ) {
+   $this->errorReporter->dieWithError(
+   'mediainfo-api-no-titles',
+   'param-missing'
+   );
+   }
+
+   $params['sitefilter'] = null;
+
+   $resolveRedirects = $params['redirects'] === 'yes';
+
+   $titles = $params['titles'];
+
+   $entityIds = [];
+
+   foreach ( $titles as $title ) {
+   $titleObj = Title::newFromText( $title );
+   $pageId = $titleObj->getArticleID();
+   $entityId = 
$wikibaseRepo->getEntityIdComposer()->composeEntityId(
+   '',
+   MediaInfo::ENTITY_TYPE,
+   $pageId
+   );
+
+   $entityIds[] = $entityId;
+   }
+
+   $stats = 
MediaWikiServices::getInstance()->getStatsdDataFactory();
+   $stats->updateCount( 'wikibase.repo.api.getmediainfo.entities', 
count( $entityIds ) );
+
+   $entityRevisions = $this->getEntityRevisionsFromEntityIds( 
$entityIds, $resolveRedirects );
+
+   foreach ( $entityRevisions as $sourceEntityId => 
$entityRevision ) {
+   $this->handleEntity( $sourceEntityId, $ent

[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Make GetEntities API class extensible

2017-10-05 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382603 )

Change subject: Make GetEntities API class extensible
..

Make GetEntities API class extensible

To reduce code duplication, I've extended the GetEntities class in
the Wikibase repo extension for use in the MediaInfo extension, essentially
providing a shortcut to wbgetentities that uses file page titles
rather than entity IDs. These properties are the ones I needed to
use, they are now protected instead of private.

Bug: T177022
Change-Id: I515c8e21fe8e0aec8da8a637f8123093ac875493
---
M repo/includes/Api/GetEntities.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/03/382603/1

diff --git a/repo/includes/Api/GetEntities.php 
b/repo/includes/Api/GetEntities.php
index e6278ce..6d5b1fc 100644
--- a/repo/includes/Api/GetEntities.php
+++ b/repo/includes/Api/GetEntities.php
@@ -58,7 +58,7 @@
/**
 * @var ResultBuilder
 */
-   private $resultBuilder;
+   protected $resultBuilder;
 
/**
 * @var EntityRevisionLookup
@@ -241,7 +241,7 @@
 *
 * @return EntityRevision[]
 */
-   private function getEntityRevisionsFromEntityIds( array $entityIds, 
$resolveRedirects = false ) {
+   protected function getEntityRevisionsFromEntityIds( array $entityIds, 
$resolveRedirects = false ) {
$revisionArray = [];
 
$this->entityPrefetcher->prefetch( $entityIds );
@@ -289,7 +289,7 @@
 * @param EntityRevision|null $entityRevision
 * @param array $params
 */
-   private function handleEntity(
+   protected function handleEntity(
$sourceEntityId,
EntityRevision $entityRevision = null,
array $params = []

-- 
To view, visit https://gerrit.wikimedia.org/r/382603
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I515c8e21fe8e0aec8da8a637f8123093ac875493
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png/deploy[master]: Update 3d2png to fb88dc5

2017-09-05 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/375782 )

Change subject: Update 3d2png to fb88dc5
..


Update 3d2png to fb88dc5

List of changes:
9dd2806 Remove wireframes per design input
xxx Update node module dependencies

Change-Id: Ib2793de4c936d5162b7efe0775d5ef5ef144aeb1
---
M node_modules/canvas/build/Makefile
M node_modules/canvas/build/Release/.deps/Release/obj.target/canvas.node.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/Canvas.o.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/CanvasGradient.o.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/CanvasPattern.o.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/CanvasRenderingContext2d.o.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/FontFace.o.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/Image.o.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/ImageData.o.d
M 
node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/color.o.d
M node_modules/canvas/build/Release/.deps/Release/obj.target/canvas/src/init.o.d
M node_modules/canvas/build/Release/canvas.node
M node_modules/canvas/build/Release/obj.target/canvas.node
M node_modules/canvas/build/Release/obj.target/canvas/src/Image.o
M node_modules/canvas/build/Release/obj.target/canvas/src/init.o
M node_modules/canvas/build/canvas.target.mk
M node_modules/canvas/build/config.gypi
M node_modules/es5-ext/object/ensure-finite-number.js
M node_modules/es5-ext/package.json
M node_modules/expand-template/index.js
M node_modules/expand-template/package.json
M node_modules/expand-template/test.js
M node_modules/heapdump/build/Makefile
M 
node_modules/heapdump/build/Release/.deps/Release/obj.target/addon/src/heapdump.o.d
M node_modules/heapdump/build/addon.target.mk
M node_modules/heapdump/build/config.gypi
M node_modules/mime-db/db.json
M node_modules/mime-db/package.json
M node_modules/mime-types/package.json
M node_modules/nan/nan.h
M node_modules/nan/nan_converters.h
M node_modules/nan/nan_maybe_pre_43_inl.h
M node_modules/nan/package.json
M src
34 files changed, 650 insertions(+), 538 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/node_modules/canvas/build/Makefile 
b/node_modules/canvas/build/Makefile
index c3b5621..7abbb6a 100644
--- a/node_modules/canvas/build/Makefile
+++ b/node_modules/canvas/build/Makefile
@@ -313,8 +313,8 @@
 endif
 
 quiet_cmd_regen_makefile = ACTION Regenerating $@
-cmd_regen_makefile = cd $(srcdir); 
/usr/local/nvm/versions/node/v6.9.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py
 -fmake --ignore-environment "--toplevel-dir=." 
-I/opt/service/node_modules/canvas/build/config.gypi 
-I/usr/local/nvm/versions/node/v6.9.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
 -I/home/runuser/.node-gyp/6.9.1/include/node/common.gypi "--depth=." 
"-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" 
"-Dvisibility=default" "-Dnode_root_dir=/home/runuser/.node-gyp/6.9.1" 
"-Dnode_gyp_dir=/usr/local/nvm/versions/node/v6.9.1/lib/node_modules/npm/node_modules/node-gyp"
 "-Dnode_lib_file=node.lib" 
"-Dmodule_root_dir=/opt/service/node_modules/canvas" binding.gyp
-Makefile: 
$(srcdir)/../../../../home/runuser/.node-gyp/6.9.1/include/node/common.gypi 
$(srcdir)/../../../../usr/local/nvm/versions/node/v6.9.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
 $(srcdir)/build/config.gypi $(srcdir)/binding.gyp
+cmd_regen_makefile = cd $(srcdir); 
/usr/local/nvm/versions/node/v6.9.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py
 -fmake --ignore-environment "--toplevel-dir=." 
-I/opt/service/node_modules/canvas/build/config.gypi 
-I/usr/local/nvm/versions/node/v6.9.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
 -I/root/.node-gyp/6.9.1/include/node/common.gypi "--depth=." "-Goutput_dir=." 
"--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" 
"-Dnode_root_dir=/root/.node-gyp/6.9.1" 
"-Dnode_gyp_dir=/usr/local/nvm/versions/node/v6.9.1/lib/node_modules/npm/node_modules/node-gyp"
 "-Dnode_lib_file=node.lib" 
"-Dmodule_root_dir=/opt/service/node_modules/canvas" binding.gyp
+Makefile: 
$(srcdir)/../../../../usr/local/nvm/versions/node/v6.9.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi
 $(srcdir)/build/config.gypi $(srcdir)/binding.gyp 
$(srcdir)/../../../../root/.node-gyp/6.9.1/include/node/common.gypi
$(call do_cmd,regen_makefile)
 
 # "all" is a concatenation of the "all" targets from all the included
diff --git 
a/node_modules/canvas/build/Release/.deps/Release/obj.target/canvas.node.d 
b/node_modules/canvas/build/Release/.deps/Release/obj.target/canvas.node.d
index c3d30be..4406fcc 100644
--- a/node_modules/canvas/build/Release/.deps/Release/obj

[MediaWiki-commits] [Gerrit] 3d2png[master]: Remove wireframes per design input

2017-08-28 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/366890 )

Change subject: Remove wireframes per design input
..


Remove wireframes per design input

Change-Id: I7c94173f59e4dbab57da7bc0656e0a69ab72de4f
---
M 3d2png.js
1 file changed, 2 insertions(+), 6 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved
  Matthias Mullie: Looks good to me, but someone else must approve



diff --git a/3d2png.js b/3d2png.js
index da29b88..af0dd7c 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -50,13 +50,9 @@
  * @returns {THREE.Mesh} mesh
  */
 ThreeDtoPNG.prototype.outputToObject = function ( geometry ) {
-   var materials = [
-   new THREE.MeshPhongMaterial( { color: 0xF8F9FA, 
shading: THREE.FlatShading } ),
-   new THREE.MeshBasicMaterial( { color: 0xC8CCD1, 
shading: THREE.FlatShading, wireframe: true, transparent: true } )
-   ],
-   mesh = new THREE.SceneUtils.createMultiMaterialObject( 
geometry, materials );
+   var material = new THREE.MeshPhongMaterial( { color: 0xF8F9FA, shading: 
THREE.FlatShading } );
 
-   return mesh;
+   return new THREE.Mesh( geometry, material );
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/366890
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7c94173f59e4dbab57da7bc0656e0a69ab72de4f
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: Matthias Mullie 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png/deploy[master]: Update 3d2png to 5922ac9

2017-08-22 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373136 )

Change subject: Update 3d2png to 5922ac9
..


Update 3d2png to 5922ac9

List of changes:
xxx Update node module dependencies

Change-Id: I231e239491aa1fcf596dfe9774709a966e6744c3
---
M node_modules/ajv/dist/ajv.bundle.js
M node_modules/ajv/dist/ajv.min.js
M node_modules/ajv/dist/ajv.min.js.map
M node_modules/ajv/dist/nodent.min.js
M node_modules/ajv/dist/regenerator.min.js
M node_modules/ajv/lib/ajv.d.ts
M node_modules/ajv/lib/compile/formats.js
M node_modules/ajv/lib/dot/custom.jst
M node_modules/ajv/lib/dot/validate.jst
M node_modules/ajv/lib/dotjs/anyOf.js
M node_modules/ajv/lib/dotjs/constant.js
M node_modules/ajv/lib/dotjs/custom.js
M node_modules/ajv/lib/dotjs/dependencies.js
M node_modules/ajv/lib/dotjs/enum.js
M node_modules/ajv/lib/dotjs/format.js
M node_modules/ajv/lib/dotjs/items.js
M node_modules/ajv/lib/dotjs/multipleOf.js
M node_modules/ajv/lib/dotjs/not.js
M node_modules/ajv/lib/dotjs/oneOf.js
M node_modules/ajv/lib/dotjs/pattern.js
M node_modules/ajv/lib/dotjs/patternRequired.js
M node_modules/ajv/lib/dotjs/properties.js
M node_modules/ajv/lib/dotjs/ref.js
M node_modules/ajv/lib/dotjs/required.js
M node_modules/ajv/lib/dotjs/switch.js
M node_modules/ajv/lib/dotjs/uniqueItems.js
M node_modules/ajv/lib/dotjs/validate.js
M node_modules/ajv/package.json
M node_modules/ajv/scripts/compile-dots.js
M node_modules/ajv/scripts/travis-gh-pages
M node_modules/aproba/index.js
M node_modules/aproba/package.json
D node_modules/are-we-there-yet/.npmignore
A node_modules/are-we-there-yet/CHANGES.md~
M node_modules/are-we-there-yet/node_modules/readable-stream/.travis.yml
A node_modules/are-we-there-yet/node_modules/readable-stream/duplex-browser.js
M node_modules/are-we-there-yet/node_modules/readable-stream/duplex.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_duplex.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_passthrough.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_readable.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_transform.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_writable.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/internal/streams/BufferList.js
A 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/internal/streams/destroy.js
A 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/internal/streams/stream-browser.js
A 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/internal/streams/stream.js
M node_modules/are-we-there-yet/node_modules/readable-stream/package.json
M node_modules/are-we-there-yet/node_modules/readable-stream/passthrough.js
A node_modules/are-we-there-yet/node_modules/readable-stream/readable-browser.js
M node_modules/are-we-there-yet/node_modules/readable-stream/readable.js
M node_modules/are-we-there-yet/node_modules/readable-stream/transform.js
A node_modules/are-we-there-yet/node_modules/readable-stream/writable-browser.js
M node_modules/are-we-there-yet/node_modules/readable-stream/writable.js
A node_modules/are-we-there-yet/node_modules/string_decoder/.npmignore
A node_modules/are-we-there-yet/node_modules/string_decoder/LICENSE
A 
node_modules/are-we-there-yet/node_modules/string_decoder/lib/string_decoder.js
A node_modules/are-we-there-yet/node_modules/string_decoder/package.json
M node_modules/are-we-there-yet/package.json
D node_modules/are-we-there-yet/test/lib/test-event.js
D node_modules/are-we-there-yet/test/tracker.js
D node_modules/are-we-there-yet/test/trackergroup.js
D node_modules/are-we-there-yet/test/trackerstream.js
M node_modules/async/apply.js
M node_modules/async/applyEach.js
M node_modules/async/applyEachSeries.js
M node_modules/async/asyncify.js
M node_modules/async/auto.js
M node_modules/async/autoInject.js
M node_modules/async/cargo.js
M node_modules/async/compose.js
M node_modules/async/concat.js
A node_modules/async/concatLimit.js
M node_modules/async/concatSeries.js
M node_modules/async/constant.js
M node_modules/async/detect.js
M node_modules/async/detectLimit.js
M node_modules/async/detectSeries.js
M node_modules/async/dir.js
M node_modules/async/dist/async.js
M node_modules/async/dist/async.min.js
M node_modules/async/doDuring.js
M node_modules/async/doUntil.js
M node_modules/async/doWhilst.js
M node_modules/async/during.js
M node_modules/async/each.js
M node_modules/async/eachLimit.js
M node_modules/async/eachOf.js
M node_modules/async/eachOfLimit.js
M node_modules/async/eachOfSeries.js
M node_modules/async/eachSeries.js
M node_modules/async/ensureAsync.js
M node_modules/async/every.js
M node_modules/async/everyLimit.js
M node_modules/async/everySeries.js
M node_modules/async/forever.js
M node_modules/async/groupBy.js
M node_modules/async/groupByLimit.js
M no

[MediaWiki-commits] [Gerrit] 3d2png/deploy[master]: Update 3d2png to 5922ac9

2017-08-22 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/373136 )

Change subject: Update 3d2png to 5922ac9
..

Update 3d2png to 5922ac9

List of changes:
xxx Update node module dependencies

Change-Id: I231e239491aa1fcf596dfe9774709a966e6744c3
---
M node_modules/ajv/dist/ajv.bundle.js
M node_modules/ajv/dist/ajv.min.js
M node_modules/ajv/dist/ajv.min.js.map
M node_modules/ajv/dist/nodent.min.js
M node_modules/ajv/dist/regenerator.min.js
M node_modules/ajv/lib/ajv.d.ts
M node_modules/ajv/lib/compile/formats.js
M node_modules/ajv/lib/dot/custom.jst
M node_modules/ajv/lib/dot/validate.jst
M node_modules/ajv/lib/dotjs/anyOf.js
M node_modules/ajv/lib/dotjs/constant.js
M node_modules/ajv/lib/dotjs/custom.js
M node_modules/ajv/lib/dotjs/dependencies.js
M node_modules/ajv/lib/dotjs/enum.js
M node_modules/ajv/lib/dotjs/format.js
M node_modules/ajv/lib/dotjs/items.js
M node_modules/ajv/lib/dotjs/multipleOf.js
M node_modules/ajv/lib/dotjs/not.js
M node_modules/ajv/lib/dotjs/oneOf.js
M node_modules/ajv/lib/dotjs/pattern.js
M node_modules/ajv/lib/dotjs/patternRequired.js
M node_modules/ajv/lib/dotjs/properties.js
M node_modules/ajv/lib/dotjs/ref.js
M node_modules/ajv/lib/dotjs/required.js
M node_modules/ajv/lib/dotjs/switch.js
M node_modules/ajv/lib/dotjs/uniqueItems.js
M node_modules/ajv/lib/dotjs/validate.js
M node_modules/ajv/package.json
M node_modules/ajv/scripts/compile-dots.js
M node_modules/ajv/scripts/travis-gh-pages
M node_modules/aproba/index.js
M node_modules/aproba/package.json
D node_modules/are-we-there-yet/.npmignore
A node_modules/are-we-there-yet/CHANGES.md~
M node_modules/are-we-there-yet/node_modules/readable-stream/.travis.yml
A node_modules/are-we-there-yet/node_modules/readable-stream/duplex-browser.js
M node_modules/are-we-there-yet/node_modules/readable-stream/duplex.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_duplex.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_passthrough.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_readable.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_transform.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_writable.js
M 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/internal/streams/BufferList.js
A 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/internal/streams/destroy.js
A 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/internal/streams/stream-browser.js
A 
node_modules/are-we-there-yet/node_modules/readable-stream/lib/internal/streams/stream.js
M node_modules/are-we-there-yet/node_modules/readable-stream/package.json
M node_modules/are-we-there-yet/node_modules/readable-stream/passthrough.js
A node_modules/are-we-there-yet/node_modules/readable-stream/readable-browser.js
M node_modules/are-we-there-yet/node_modules/readable-stream/readable.js
M node_modules/are-we-there-yet/node_modules/readable-stream/transform.js
A node_modules/are-we-there-yet/node_modules/readable-stream/writable-browser.js
M node_modules/are-we-there-yet/node_modules/readable-stream/writable.js
A node_modules/are-we-there-yet/node_modules/string_decoder/.npmignore
A node_modules/are-we-there-yet/node_modules/string_decoder/LICENSE
A 
node_modules/are-we-there-yet/node_modules/string_decoder/lib/string_decoder.js
A node_modules/are-we-there-yet/node_modules/string_decoder/package.json
M node_modules/are-we-there-yet/package.json
D node_modules/are-we-there-yet/test/lib/test-event.js
D node_modules/are-we-there-yet/test/tracker.js
D node_modules/are-we-there-yet/test/trackergroup.js
D node_modules/are-we-there-yet/test/trackerstream.js
M node_modules/async/apply.js
M node_modules/async/applyEach.js
M node_modules/async/applyEachSeries.js
M node_modules/async/asyncify.js
M node_modules/async/auto.js
M node_modules/async/autoInject.js
M node_modules/async/cargo.js
M node_modules/async/compose.js
M node_modules/async/concat.js
A node_modules/async/concatLimit.js
M node_modules/async/concatSeries.js
M node_modules/async/constant.js
M node_modules/async/detect.js
M node_modules/async/detectLimit.js
M node_modules/async/detectSeries.js
M node_modules/async/dir.js
M node_modules/async/dist/async.js
M node_modules/async/dist/async.min.js
M node_modules/async/doDuring.js
M node_modules/async/doUntil.js
M node_modules/async/doWhilst.js
M node_modules/async/during.js
M node_modules/async/each.js
M node_modules/async/eachLimit.js
M node_modules/async/eachOf.js
M node_modules/async/eachOfLimit.js
M node_modules/async/eachOfSeries.js
M node_modules/async/eachSeries.js
M node_modules/async/ensureAsync.js
M node_modules/async/every.js
M node_modules/async/everyLimit.js
M node_modules/async/everySeries.js
M node_modules/async/forever.js
M node_modules/async/groupBy.js
M node_modules/async/groupByLimit.js
M node_modul

[MediaWiki-commits] [Gerrit] 3d2png/deploy[master]: Update submodule - point to current 3d2png master

2017-08-22 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373129 )

Change subject: Update submodule - point to current 3d2png master
..


Update submodule - point to current 3d2png master

Change-Id: Ia3a0b33301076d2f548d65628fd8e6679ab880d3
---
M src
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/src b/src
index 537ef47..5922ac9 16
--- a/src
+++ b/src
@@ -1 +1 @@
-Subproject commit 537ef47360fa5e06a586ebd9b5058afd31e1da45
+Subproject commit 5922ac9904f839ee8be35a08d8428c474824a782

-- 
To view, visit https://gerrit.wikimedia.org/r/373129
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia3a0b33301076d2f548d65628fd8e6679ab880d3
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png/deploy
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Skip extension check of input file

2017-08-09 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/370680 )

Change subject: Skip extension check of input file
..


Skip extension check of input file

This is necessary for Thumbor support, since the temporary file for
STL input has no extension.

Change-Id: Iae903c78f8532f16d5d0e39131c0f007fd0577dd
---
M 3d2png.js
1 file changed, 4 insertions(+), 6 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved
  Gilles: Looks good to me, but someone else must approve



diff --git a/3d2png.js b/3d2png.js
index da29b88..d63a488 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -64,12 +64,10 @@
  * @param {string} filePath Full path to the file
  * @returns {THREE.Loader} File loader
  */
-ThreeDtoPNG.prototype.getLoader = function( filePath ) {
-   if ( filePath.toLowerCase().endsWith( '.stl' ) ) {
-   return new THREE.STLLoader();
-   }
-
-   throw 'Unexpected model file extension, only STL is supported';
+ThreeDtoPNG.prototype.getLoader = function() {
+   // TODO XXX if more file formats are supported later, need a command 
line option
+   // to signify the expected format of the input file.
+   return new THREE.STLLoader();
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/370680
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iae903c78f8532f16d5d0e39131c0f007fd0577dd
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 
Gerrit-Reviewer: Gilles 
Gerrit-Reviewer: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Skip extension check of input file

2017-08-08 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/370680 )

Change subject: Skip extension check of input file
..

Skip extension check of input file

This is necessary for Thumbor support, since the temporary file for
STL input has no extension.

Change-Id: Iae903c78f8532f16d5d0e39131c0f007fd0577dd
---
M 3d2png.js
1 file changed, 4 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/3d2png refs/changes/80/370680/1

diff --git a/3d2png.js b/3d2png.js
index da29b88..d63a488 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -64,12 +64,10 @@
  * @param {string} filePath Full path to the file
  * @returns {THREE.Loader} File loader
  */
-ThreeDtoPNG.prototype.getLoader = function( filePath ) {
-   if ( filePath.toLowerCase().endsWith( '.stl' ) ) {
-   return new THREE.STLLoader();
-   }
-
-   throw 'Unexpected model file extension, only STL is supported';
+ThreeDtoPNG.prototype.getLoader = function() {
+   // TODO XXX if more file formats are supported later, need a command 
line option
+   // to signify the expected format of the input file.
+   return new THREE.STLLoader();
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/370680
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae903c78f8532f16d5d0e39131c0f007fd0577dd
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki/vagrant[master]: [WIP] Add STL support to Thumbor

2017-07-27 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/368242 )

Change subject: [WIP] Add STL support to Thumbor
..

[WIP] Add STL support to Thumbor

Needs a thumbor plugin change, and some more work.

Change-Id: Ief373d3b4018f16d13a0893a7933c417083ffe2a
---
M puppet/modules/role/manifests/thumbor.pp
M puppet/modules/thumbor/templates/20-thumbor-wikimedia.conf.erb
2 files changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant 
refs/changes/42/368242/1

diff --git a/puppet/modules/role/manifests/thumbor.pp 
b/puppet/modules/role/manifests/thumbor.pp
index 2018992..d748024 100644
--- a/puppet/modules/role/manifests/thumbor.pp
+++ b/puppet/modules/role/manifests/thumbor.pp
@@ -60,6 +60,7 @@
 'tiff',
 'tif',
 'webp',
+'stl',
 ],
 },
 }
diff --git a/puppet/modules/thumbor/templates/20-thumbor-wikimedia.conf.erb 
b/puppet/modules/thumbor/templates/20-thumbor-wikimedia.conf.erb
index 88ab086..6cacd42 100644
--- a/puppet/modules/thumbor/templates/20-thumbor-wikimedia.conf.erb
+++ b/puppet/modules/thumbor/templates/20-thumbor-wikimedia.conf.erb
@@ -30,6 +30,10 @@
 
 CONVERT_PATH = '/usr/bin/convert'
 
+XVFB_RUN_PATH = '/usr/bin/xvfb-run'
+
+PATH_3D2PNG = '/var/3d2png/3d2png.js'
+
 SWIFT_HOST = 'http://127.0.0.1:<%= scope['::swift::port'] %>'
 SWIFT_API_PATH = '/v1/AUTH_<%= scope['::swift::project'] %>'
 SWIFT_AUTH_PATH = '/auth/v1.0'

-- 
To view, visit https://gerrit.wikimedia.org/r/368242
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief373d3b4018f16d13a0893a7933c417083ffe2a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Remove wireframes per design input

2017-07-21 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366890 )

Change subject: Remove wireframes per design input
..

Remove wireframes per design input

Change-Id: I7c94173f59e4dbab57da7bc0656e0a69ab72de4f
---
M 3d2png.js
1 file changed, 2 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/3d2png refs/changes/90/366890/1

diff --git a/3d2png.js b/3d2png.js
index da29b88..af0dd7c 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -50,13 +50,9 @@
  * @returns {THREE.Mesh} mesh
  */
 ThreeDtoPNG.prototype.outputToObject = function ( geometry ) {
-   var materials = [
-   new THREE.MeshPhongMaterial( { color: 0xF8F9FA, 
shading: THREE.FlatShading } ),
-   new THREE.MeshBasicMaterial( { color: 0xC8CCD1, 
shading: THREE.FlatShading, wireframe: true, transparent: true } )
-   ],
-   mesh = new THREE.SceneUtils.createMultiMaterialObject( 
geometry, materials );
+   var material = new THREE.MeshPhongMaterial( { color: 0xF8F9FA, shading: 
THREE.FlatShading } );
 
-   return mesh;
+   return new THREE.Mesh( geometry, material );
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/366890
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c94173f59e4dbab57da7bc0656e0a69ab72de4f
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...3D[master]: Removing wireframe per design input

2017-07-21 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366889 )

Change subject: Removing wireframe per design input
..

Removing wireframe per design input

Change-Id: I0a74774e1496de35b15e113b2ae18cfc33992303
---
M modules/mmv.3d.js
1 file changed, 2 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/3D 
refs/changes/89/366889/1

diff --git a/modules/mmv.3d.js b/modules/mmv.3d.js
index c910d95..4d2e0ec 100644
--- a/modules/mmv.3d.js
+++ b/modules/mmv.3d.js
@@ -86,12 +86,9 @@
};
 
TD.geometryToObject = function ( geometry ) {
-   var materials = [
-   new THREE.MeshPhongMaterial( { color: 0xF8F9FA, 
shading: THREE.FlatShading } ),
-   new THREE.MeshBasicMaterial( { color: 0xC8CCD1, 
shading: THREE.FlatShading, wireframe: true, transparent: true } )
-   ];
+   var material = new THREE.MeshPhongMaterial( { color: 0xF8F9FA, 
shading: THREE.FlatShading } );
 
-   return THREE.SceneUtils.createMultiMaterialObject( geometry, 
materials );
+   return new THREE.Mesh( geometry, material );
};
 
TD.loadFile = function ( extension, url ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/366889
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a74774e1496de35b15e113b2ae18cfc33992303
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/3D
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Change the rendering materials

2017-07-20 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/365661 )

Change subject: Change the rendering materials
..


Change the rendering materials

* Lighting now includes a directional light
* Lighting overall reduced significantly
* Color changed
* Background color changed

Bug: T167748
Change-Id: I211920c91ca4a78c2d80885da88031087cdb6ae5
---
M 3d2png.js
1 file changed, 14 insertions(+), 4 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved
  Matthias Mullie: Looks good to me, but someone else must approve



diff --git a/3d2png.js b/3d2png.js
index 62941aa..da29b88 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -28,15 +28,20 @@
  * Sets up the Three environment (ambient light, camera, renderer)
  */
 ThreeDtoPNG.prototype.setupEnvironment = function() {
-   var ambient = new THREE.AmbientLight( 0x99 ),
+   var ambient = new THREE.AmbientLight( 0x66 ),
+   dlight = new THREE.DirectionalLight( 0x99 ),
point = new THREE.PointLight( 0xff, 0.4 );
 
-   this.scene.add( ambient );
+   dlight.position.set( 0, 0, 1 );
+   dlight.castShadow = true;
 
+   this.scene.add( ambient );
+   this.scene.add( dlight );
this.camera.add( point );
this.scene.add( this.camera );
 
this.renderer.setSize( this.width, this.height, false );
+   this.renderer.setClearColor( 0x22 );
 };
 
 /**
@@ -45,8 +50,11 @@
  * @returns {THREE.Mesh} mesh
  */
 ThreeDtoPNG.prototype.outputToObject = function ( geometry ) {
-   var material = new THREE.MeshPhongMaterial( { color: 0xff, shading: 
THREE.FlatShading } ),
-   mesh = new THREE.Mesh( geometry, material );
+   var materials = [
+   new THREE.MeshPhongMaterial( { color: 0xF8F9FA, 
shading: THREE.FlatShading } ),
+   new THREE.MeshBasicMaterial( { color: 0xC8CCD1, 
shading: THREE.FlatShading, wireframe: true, transparent: true } )
+   ],
+   mesh = new THREE.SceneUtils.createMultiMaterialObject( 
geometry, materials );
 
return mesh;
 };
@@ -103,6 +111,8 @@
// Convert what the loader returns into an object we can add to the 
scene
object = this.outputToObject( output );
 
+   object.castShadow = true;
+
// Position the camera relative to the object
// This allows us to look at the object from enough distance and from
// an angle

-- 
To view, visit https://gerrit.wikimedia.org/r/365661
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I211920c91ca4a78c2d80885da88031087cdb6ae5
Gerrit-PatchSet: 3
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: Matthias Mullie 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Fiddle with lighting to make shapes clearer

2017-07-17 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365661 )

Change subject: Fiddle with lighting to make shapes clearer
..

Fiddle with lighting to make shapes clearer

Change-Id: I211920c91ca4a78c2d80885da88031087cdb6ae5
---
M 3d2png.js
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/3d2png refs/changes/61/365661/1

diff --git a/3d2png.js b/3d2png.js
index 62941aa..6435957 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -28,11 +28,12 @@
  * Sets up the Three environment (ambient light, camera, renderer)
  */
 ThreeDtoPNG.prototype.setupEnvironment = function() {
-   var ambient = new THREE.AmbientLight( 0x99 ),
+   var ambient = new THREE.AmbientLight( 0x66 ),
+   dlight = new THREE.DirectionalLight( 0x99 ),
point = new THREE.PointLight( 0xff, 0.4 );
 
this.scene.add( ambient );
-
+   this.schene.add( dlight );
this.camera.add( point );
this.scene.add( this.camera );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/365661
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I211920c91ca4a78c2d80885da88031087cdb6ae5
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...3D[master]: Fiddle with the lighting to make shapes clearer

2017-07-17 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365660 )

Change subject: Fiddle with the lighting to make shapes clearer
..

Fiddle with the lighting to make shapes clearer

Change-Id: I4a5794ca037e3d86405c3cdcd0a3d02232818ad7
---
M modules/mmv.3d.js
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/3D 
refs/changes/60/365660/1

diff --git a/modules/mmv.3d.js b/modules/mmv.3d.js
index 6a891f6..2fd7809 100644
--- a/modules/mmv.3d.js
+++ b/modules/mmv.3d.js
@@ -31,7 +31,10 @@
TD.createScene = function () {
var threed = this,
dimensions = this.dimensionsFunc(),
-   ambient = new THREE.AmbientLight( 0x99 );
+   ambient = new THREE.AmbientLight( 0x66 ),
+   dlight = new THREE.DirectionalLight( 0x99 );
+
+   dlight.position.set( 0, 0, 1 );
 
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera( 60, 
dimensions.ratio, 1, 5000 );
@@ -41,6 +44,7 @@
this.camera.add( new THREE.PointLight( 0xff, 0.4 ) );
 
this.scene.add( ambient );
+   this.scene.add( dlight );
this.scene.add( this.camera );
 
this.renderer = new THREE.WebGLRenderer();
@@ -81,7 +85,6 @@
 
TD.geometryToObject = function ( geometry ) {
var material = new THREE.MeshPhongMaterial( { color: 0xff, 
shading: THREE.FlatShading } );
-
return new THREE.Mesh( geometry, material );
};
 

-- 
To view, visit https://gerrit.wikimedia.org/r/365660
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a5794ca037e3d86405c3cdcd0a3d02232818ad7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/3D
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add (hacky) check for webm audio files

2017-07-10 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364256 )

Change subject: Add (hacky) check for webm audio files
..

Add (hacky) check for webm audio files

If there is no video track in a webm file, it's supposed to be audio/webm,
but since we assume every webm file is video/webm, that's never worked.
This should slightly improve searching for audio files.

Bug: T156135
Change-Id: Iac749233e87b3622ff416ad503aedef3df0d0f1d
---
M includes/libs/mime/MimeAnalyzer.php
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/56/364256/1

diff --git a/includes/libs/mime/MimeAnalyzer.php 
b/includes/libs/mime/MimeAnalyzer.php
index 0083e4b..0326a74 100644
--- a/includes/libs/mime/MimeAnalyzer.php
+++ b/includes/libs/mime/MimeAnalyzer.php
@@ -709,8 +709,16 @@
$this->logger->info( __METHOD__ . ": 
recognized file as video/x-matroska\n" );
return "video/x-matroska";
} elseif ( strncmp( $data, "webm", 4 ) == 0 ) {
-   $this->logger->info( __METHOD__ . ": 
recognized file as video/webm\n" );
-   return "video/webm";
+   // XXX HACK look for a video track, if 
we don't find it, this is an audio file
+   $videotrack = strpos( $head, "\x86\x85" 
);
+
+   if ( $videotrack ) {
+   $this->logger->info( __METHOD__ 
. ": recognized file as video/webm\n" );
+   return "video/webm";
+   }
+
+   $this->logger->info( __METHOD__ . ": 
recognized file as audio/webm\n" );
+   return "audio/webm";
}
}
$this->logger->info( __METHOD__ . ": unknown EBML 
file\n" );

-- 
To view, visit https://gerrit.wikimedia.org/r/364256
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac749233e87b3622ff416ad503aedef3df0d0f1d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: 'node-uuid' is deprecated, replace it with 'uuid'

2017-06-26 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/361424 )

Change subject: 'node-uuid' is deprecated, replace it with 'uuid'
..


'node-uuid' is deprecated, replace it with 'uuid'

Change-Id: I414590e92b35544f2a8164220052043ac01c0439
---
M package.json
M test.js
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved
  Matthias Mullie: Looks good to me, but someone else must approve



diff --git a/package.json b/package.json
index 4a79c3a..635489f 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
   "devDependencies": {
 "image-ms-ssim": "latest",
 "mocha": "latest",
-"node-uuid": "latest",
+"uuid": "latest",
 "pngjs": "latest",
 "service-runner": "latest"
   },
diff --git a/test.js b/test.js
index a9ab6e3..bd9a8d0 100644
--- a/test.js
+++ b/test.js
@@ -5,7 +5,7 @@
msssim = require( 'image-ms-ssim' ),
fs = require( 'fs' ),
PNG = require( 'pngjs' ).PNG,
-   uuid = require( 'node-uuid' ),
+   uuid = require( 'uuid' ),
filename = uuid.v4() + '.png',
images = [];
 

-- 
To view, visit https://gerrit.wikimedia.org/r/361424
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I414590e92b35544f2a8164220052043ac01c0439
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: Hashar 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: Matthias Mullie 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Build requires libgif-dev

2017-06-26 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/361423 )

Change subject: Build requires libgif-dev
..


Build requires libgif-dev

On Debian stretch when building 'canvas' depends on libgif-dev:

In file included from ../src/CanvasPattern.cc:9:0:
../src/Image.h:19:21: fatal error: gif_lib.h: No such file or directory
 #include 
 ^
compilation terminated.
canvas.target.mk:122: recipe for target
'Release/obj.target/canvas/src/CanvasPattern.o' failed

Change-Id: Icbd4575d09e0c64098687fb1d273154d16608672
---
M package.json
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved
  Matthias Mullie: Looks good to me, but someone else must approve



diff --git a/package.json b/package.json
index a778ad4..4a79c3a 100644
--- a/package.json
+++ b/package.json
@@ -42,6 +42,7 @@
 "libcairo2-dev",
 "libjpeg-dev",
 "libxi-dev",
+"libgif-dev",
 "libglu1-mesa-dev",
 "libglew-dev",
 "libpng12-dev"

-- 
To view, visit https://gerrit.wikimedia.org/r/361423
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icbd4575d09e0c64098687fb1d273154d16608672
Gerrit-PatchSet: 1
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: Hashar 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: Matthias Mullie 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Fix in response to new three-stl-loader version

2017-06-26 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/358905 )

Change subject: Fix in response to new three-stl-loader version
..


Fix in response to new three-stl-loader version

In 1.0.5, three-stl-loader will no longer export an
STLLoader object, but it will add it to THREE.

See 
https://github.com/enspiral-cherubi/three-stl-loader/commit/144cedb5ceb7422f79295c101b3e35abeff2c76c

Meanwhile also set fixed dependency versions.

Change-Id: I3a25c4209eee09ebd1811831576786f71888df20
---
M 3d2png.js
M package.json
2 files changed, 9 insertions(+), 8 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/3d2png.js b/3d2png.js
index 1d99f4d..6cebb2a 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -3,10 +3,11 @@
 var Canvas = require( 'canvas' ),
THREE = require( 'three' ),
GL = require( 'gl' ),
-   ThreeSTLLoader = require( 'three-stl-loader' ),
-   STLLoader = ThreeSTLLoader( THREE ),
fs = require( 'fs' ),
yargs = require( 'yargs' );
+
+// Add THREE.STLLoader
+require( 'three-stl-loader' )( THREE );
 
 /**
  * Converts 3D files to PNG images
@@ -57,7 +58,7 @@
  */
 ThreeDtoPNG.prototype.getLoader = function( filePath ) {
if ( filePath.toLowerCase().endsWith( '.stl' ) ) {
-   return new STLLoader();
+   return new THREE.STLLoader();
}
 
throw 'Unexpected model file extension, only STL is supported';
diff --git a/package.json b/package.json
index a778ad4..d3d3814 100644
--- a/package.json
+++ b/package.json
@@ -11,11 +11,11 @@
   ],
   "name": "3d2png",
   "dependencies": {
-"canvas": "latest",
-"gl": "latest",
-"three": "latest",
-"three-stl-loader": "latest",
-"yargs": "latest"
+"canvas": "1.6.5",
+"gl": "4.0.3",
+"three": "0.85.2",
+"three-stl-loader": "1.0.5",
+"yargs": "8.0.2"
   },
   "devDependencies": {
 "image-ms-ssim": "latest",

-- 
To view, visit https://gerrit.wikimedia.org/r/358905
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3a25c4209eee09ebd1811831576786f71888df20
Gerrit-PatchSet: 2
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: Matthias Mullie 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] 3d2png[master]: Fix reflected 3d thumbs

2017-06-20 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/357201 )

Change subject: Fix reflected 3d thumbs
..


Fix reflected 3d thumbs

Bug: T164563
Change-Id: I4bc019afe25a3d7f1ea23c12bb08ec25f7e47eb7
---
M 3d2png.js
1 file changed, 24 insertions(+), 2 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/3d2png.js b/3d2png.js
index 1d99f4d..5f84f48 100755
--- a/3d2png.js
+++ b/3d2png.js
@@ -110,8 +110,7 @@
// Add the object to the scene
this.scene.add( object );
 
-   // Flip the camera's up, otherwise it's upside down
-   this.camera.up.set( 0, 0, -1 );
+   this.camera.up.set( 0, 0, 1 );
 
// Point camera at the scene
this.camera.lookAt( this.scene.position );
@@ -145,11 +144,34 @@
imgData.data.set( pixels );
ctx.putImageData( imgData, 0, 0 );
 
+   // gl.readPixels starts reading left-bottom instead of left-top,
+   // so everything will be flipped & we need to un-flip the image
+   outputCanvas = this.flip( outputCanvas );
+
// Open a read stream from the canvas
return outputCanvas.pngStream();
 };
 
 /**
+ * Flips canvas over Y axis
+ * @param {Canvas} canvas
+ * @returns {Canvas}
+ */
+ThreeDtoPNG.prototype.flip = function( canvas ) {
+   var flipped = new Canvas( this.width, this.height ),
+   ctx = flipped.getContext( '2d' );
+
+   ctx.globalCompositeOperation = 'copy';
+   ctx.scale( 1, -1 );
+   ctx.translate( 0, -imgData.height );
+   ctx.drawImage( canvas, 0, 0 );
+   ctx.setTransform( 1, 0, 0, 1, 0, 0 );
+   ctx.globalCompositeOperation = 'source-over';
+
+   return ctx.canvas;
+};
+
+/**
  * Converts a 3D model file into a PNG image
  * @param {string} sourcePath Full path to the source 3D model file
  * @param {string} destinationPath Full path to the destination PNG file

-- 
To view, visit https://gerrit.wikimedia.org/r/357201
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4bc019afe25a3d7f1ea23c12bb08ec25f7e47eb7
Gerrit-PatchSet: 2
Gerrit-Project: 3d2png
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie 
Gerrit-Reviewer: Gilles 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: Matthias Mullie 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...3D[master]: Consolidate licenses, add COPYING

2017-05-31 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/356446 )

Change subject: Consolidate licenses, add COPYING
..

Consolidate licenses, add COPYING

Bug: T157409
Change-Id: Ieed3e9625bfc580f4322cc717fb1f16e5e08757b
---
A COPYING
M extension.json
2 files changed, 341 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/3D 
refs/changes/46/356446/1

diff --git a/COPYING b/COPYING
new file mode 100644
index 000..d159169
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer 

[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[master]: Add our EventLogging schemas to test module's dependencies

2017-05-01 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/351019 )

Change subject: Add our EventLogging schemas to test module's dependencies
..


Add our EventLogging schemas to test module's dependencies

They are normally lazy-loaded, which was causing issues with
tests failing intermittently due to "Pending AJAX requests".

Bug: T164028
Change-Id: Ifc12294fc1e9d18e5ee0e9c425e55683e4f328f5
---
M UploadWizardHooks.php
1 file changed, 14 insertions(+), 3 deletions(-)

Approvals:
  MarkTraceur: Verified
  Matthias Mullie: Looks good to me, approved



diff --git a/UploadWizardHooks.php b/UploadWizardHooks.php
index d611e45..c96d055 100644
--- a/UploadWizardHooks.php
+++ b/UploadWizardHooks.php
@@ -158,6 +158,19 @@
array &$testModules,
ResourceLoader &$resourceLoader
) {
+   $dependencies = [ 'ext.uploadWizard' ];
+
+   // Add our EventLogging schemas (normally lazy-loaded) to 
dependencies to avoid issues with
+   // tests failing intermittently due to "Pending AJAX requests".
+   $dependencies[] = 'ext.eventLogging';
+   $schemas = array_keys( 
ExtensionRegistry::getInstance()->getAttribute( 'EventLoggingSchemas' ) );
+   $ourSchemas = array_filter( $schemas, function ( $schema ) {
+   return substr( $schema, 0, 12 ) === 'UploadWizard';
+   } );
+   foreach ( $ourSchemas as $schema ) {
+   $dependencies[] = "schema.$schema";
+   }
+
$testModules['qunit']['ext.uploadWizard.unit.tests'] = [
'scripts' => [

'tests/qunit/controller/uw.controller.Deed.test.js',
@@ -175,9 +188,7 @@
'tests/qunit/uw.TitleDetailsWidget.test.js',
'tests/qunit/mw.fileApi.test.js',
],
-   'dependencies' => [
-   'ext.uploadWizard',
-   ],
+   'dependencies' => $dependencies,
'localBasePath' => __DIR__,
'remoteExtPath' => 'UploadWizard',
];

-- 
To view, visit https://gerrit.wikimedia.org/r/351019
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc12294fc1e9d18e5ee0e9c425e55683e4f328f5
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: Matthias Mullie 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[master]: Update FormDataTransport tests for jQuery 3

2017-05-01 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/350871 )

Change subject: Update FormDataTransport tests for jQuery 3
..


Update FormDataTransport tests for jQuery 3

Bug: T164028
Change-Id: I40d94e8c19a49caf0a716875da7085fe71630c2f
---
M tests/qunit/transports/mw.FormDataTransport.test.js
1 file changed, 75 insertions(+), 38 deletions(-)

Approvals:
  Bartosz DziewoƄski: Looks good to me, approved
  MarkTraceur: Verified



diff --git a/tests/qunit/transports/mw.FormDataTransport.test.js 
b/tests/qunit/transports/mw.FormDataTransport.test.js
index bb2ab28..c47ea83 100644
--- a/tests/qunit/transports/mw.FormDataTransport.test.js
+++ b/tests/qunit/transports/mw.FormDataTransport.test.js
@@ -130,59 +130,96 @@
transport.abort();
} );
 
-   QUnit.test( 'checkStatus', 8, function ( assert ) {
-   var transport = createTransport( 10, new mw.Api() ),
-   usstub = this.sandbox.stub(),
+   // test invalid server response (in missing 'stage' param)
+   QUnit.test( 'checkStatus invalid API response', 1, function ( assert ) {
+   var done = assert.async(),
+   transport = createTransport( 10, new mw.Api() ),
tstub = this.sandbox.stub(),
poststub = this.sandbox.stub( transport.api, 'post' ),
-   postd, postd2;
+   postd = $.Deferred();
+
+   // prepare a bogus invalid API result
+   poststub.returns( postd.promise() );
+   postd.resolve( { upload: { result: 'Poll' } } );
+
+   // call tstub upon checkStatus failure, and verify it got 
called correctly
+   transport.checkStatus().fail( tstub, function () {
+   assert.ok( tstub.calledWith( 'server-error', { error: {
+   code: 'server-error',
+   html: mw.message( 'apierror-unknownerror' 
).parse()
+   } } ) );
+   done();
+   } );
+   } );
+
+   // test retry after server responds upload is still incomplete
+   QUnit.test( 'checkStatus retry', 2, function ( assert ) {
+   var transport = createTransport( 10, new mw.Api() ),
+   usstub = this.sandbox.stub(),
+   poststub = this.sandbox.stub( transport.api, 'post' ),
+   postd = $.Deferred(),
+   postd2 = $.Deferred();
 
transport.on( 'update-stage', usstub );
 
-   postd = $.Deferred();
-   poststub.returns( postd.promise() );
-   transport.checkStatus().fail( tstub );
-   transport.firstPoll = 0;
-   postd.resolve( { upload: { result: 'Poll' } } );
-   assert.ok( tstub.calledWith( 'server-error', { error: {
-   code: 'server-error',
-   html: mw.message( 'apierror-unknownerror' ).parse()
-   } } ) );
-
-   postd = $.Deferred();
-   postd2 = $.Deferred();
-   poststub.reset();
+   // prepare a first API call that responds with 'Poll' (upload
+   // concatenation is not yet complete) followed by a second call 
that
+   // marks the upload successful
poststub
.onFirstCall().returns( postd.promise() )
.onSecondCall().returns( postd2.promise() );
-   tstub.reset();
-   transport.checkStatus();
-   postd.resolve( { upload: { result: 'Poll', stage: 'test' } } );
-   assert.ok( !tstub.called );
-   assert.ok( usstub.calledWith( 'test' ) );
+
+   // resolve 3 API calls, where server first responds upload is 
not yet
+   // assembled, and second says it's published
+   postd.resolve( { upload: { result: 'Poll', stage: 'queued' } } 
);
postd2.resolve( { upload: { result: 'Success' } } );
-   assert.ok( poststub.calledTwice );
-   poststub.resetBehavior();
 
-   postd = $.Deferred();
-   poststub.reset();
+   // confirm that, once second API call was successful, status 
resolves,
+   // 2 API calls have gone out & the failed call updates stage 
accordingly
+   return transport.checkStatus().done( function () {
+   assert.ok( poststub.calledTwice );
+   assert.ok( usstub.firstCall.calledWith( 'queued' ) );
+   } );
+   } );
+
+   QUnit.test( 'checkStatus success', 2, function ( assert ) {
+   var transport = createTransport( 10, new mw.Api() ),
+   tstub = this.sandbox.stub(),
+  

[MediaWiki-commits] [Gerrit] operations/puppet[production]: Add 3d2png deploy repo to image scalers

2017-03-29 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/345377 )

Change subject: Add 3d2png deploy repo to image scalers
..

Add 3d2png deploy repo to image scalers

Bug: T160185
Change-Id: Ib48d47bb0afef51ad710a0578427eb43d46b6b10
---
M hieradata/role/common/deployment/server.yaml
M hieradata/role/common/mediawiki/imagescaler.yaml
2 files changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/77/345377/1

diff --git a/hieradata/role/common/deployment/server.yaml 
b/hieradata/role/common/deployment/server.yaml
index 9a5df2d..c349015 100644
--- a/hieradata/role/common/deployment/server.yaml
+++ b/hieradata/role/common/deployment/server.yaml
@@ -67,6 +67,7 @@
 # by the scap::server class.  Each source listed here
 # will be cloned on the scap deploy server.
 scap::sources:
+  3d2png/deploy: {}
   analytics/refinery:
 repository: analytics/refinery
 scap_repository: analytics/refinery/scap
diff --git a/hieradata/role/common/mediawiki/imagescaler.yaml 
b/hieradata/role/common/mediawiki/imagescaler.yaml
index 201ab70..190d27b 100644
--- a/hieradata/role/common/mediawiki/imagescaler.yaml
+++ b/hieradata/role/common/mediawiki/imagescaler.yaml
@@ -13,3 +13,6 @@
   light_process_count: "10"
 apache::mpm::mpm: worker
 role::mediawiki::webserver::tls: true
+scap::target: { '3d2png/deploy':
+  deploy_user => 'mwdeploy',
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/345377
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib48d47bb0afef51ad710a0578427eb43d46b6b10
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Enable 3d extension on beta

2017-03-06 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/341332 )

Change subject: Enable 3d extension on beta
..

Enable 3d extension on beta

Deploying this to test thumbnailing and load in a prod-like environment,
and in view of a deployment to production sometime in the next month.

Bug: T159717
Change-Id: Iebff96f0e29e3dd82b46f7dd218af6aa8fda3db0
---
M wmf-config/CommonSettings-labs.php
M wmf-config/InitialiseSettings-labs.php
M wmf-config/extension-list-labs
3 files changed, 25 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/32/341332/1

diff --git a/wmf-config/CommonSettings-labs.php 
b/wmf-config/CommonSettings-labs.php
index c6f2507..a5ec03e 100644
--- a/wmf-config/CommonSettings-labs.php
+++ b/wmf-config/CommonSettings-labs.php
@@ -365,4 +365,16 @@
 
 wfLoadExtension( 'Dashiki' );
 
+if ( $wmgUse3d ) {
+   wfLoadExtension( '3d' );
+   // Add 3d file type
+   $wgFileExtensions[] = 'stl';
+   $wgTrustedMediaFiles[] = 'application/sla';
+
+   // Add 3d media viewer extension
+   if ( isset( $wgMediaViewerExtensions ) {
+   $wgMediaViewerExtensions['stl'] = 'mmv.3d';
+   }
+}
+
 } # end safeguard
diff --git a/wmf-config/InitialiseSettings-labs.php 
b/wmf-config/InitialiseSettings-labs.php
index 5ef6973..25500d7 100644
--- a/wmf-config/InitialiseSettings-labs.php
+++ b/wmf-config/InitialiseSettings-labs.php
@@ -582,5 +582,17 @@
'wgPopupsAPIUseRESTBase' => [
'default' => true,
],
+
+   'wmgUse3d' => [
+   'default' => true,
+   ],
+
+   'wg3dProcessor' => [
+   'default' => '/var/3d2png/3d2png.js',
+   ],
+
+   'wg3dProcessEnviron' => [
+   'default' => [ 'DISPLAY' => ':99' ],
+   ],
];
 } # wmflLabsSettings()
diff --git a/wmf-config/extension-list-labs b/wmf-config/extension-list-labs
index 08eb962..c1de9b6 100644
--- a/wmf-config/extension-list-labs
+++ b/wmf-config/extension-list-labs
@@ -1,3 +1,4 @@
+$IP/extensions/3d/extension.json
 $IP/extensions/Dashiki/extension.json
 $IP/extensions/EmailAuth/extension.json
 $IP/extensions/InterwikiSorting/extension.json

-- 
To view, visit https://gerrit.wikimedia.org/r/341332
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iebff96f0e29e3dd82b46f7dd218af6aa8fda3db0
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...3D[master]: extension.json: Express dependency on MediaViewer

2017-03-01 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/340517 )

Change subject: extension.json: Express dependency on MediaViewer
..


extension.json: Express dependency on MediaViewer

Change-Id: Ia8d029aa7dece1022f0f68b9a780f479a7f966ff
---
M extension.json
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/extension.json b/extension.json
index b9ff0a1..2ccbb8f 100644
--- a/extension.json
+++ b/extension.json
@@ -8,6 +8,12 @@
 "namemsg": "3d",
 "descriptionmsg": "3d-desc",
 "license-name": "MIT",
+"requires": {
+  "MediaWiki": ">= 1.29.0",
+  "extensions": {
+"MultimediaViewer": "*"
+  }
+},
 "type": "other",
 "manifest_version": 1,
 "MessagesDirs": {

-- 
To view, visit https://gerrit.wikimedia.org/r/340517
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia8d029aa7dece1022f0f68b9a780f479a7f966ff
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/3D
Gerrit-Branch: master
Gerrit-Owner: Jforrester 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...3D[master]: Remove, ignore composer.lock

2017-03-01 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/340516 )

Change subject: Remove, ignore composer.lock
..

Remove, ignore composer.lock

Change-Id: I0bf834377306c4b5cabb8d17da5ac90dfc81a894
---
M .gitignore
D composer.lock
2 files changed, 1 insertion(+), 174 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/3D 
refs/changes/16/340516/1

diff --git a/.gitignore b/.gitignore
index 7dc1376..cb92fea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 /node_modules/
 
 /vendor/
+composer.lock
diff --git a/composer.lock b/composer.lock
deleted file mode 100644
index d2a9a57..000
--- a/composer.lock
+++ /dev/null
@@ -1,174 +0,0 @@
-{
-"_readme": [
-"This file locks the dependencies of your project to a known state",
-"Read more about it at 
https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file";,
-"This file is @generated automatically"
-],
-"hash": "f9517d53e0c0024936d2b9ce92c740bb",
-"content-hash": "db62be4b67f9a695b82f88b24223049d",
-"packages": [],
-"packages-dev": [
-{
-"name": "jakub-onderka/php-parallel-lint",
-"version": "v0.9",
-"source": {
-"type": "git",
-"url": "https://github.com/JakubOnderka/PHP-Parallel-Lint.git";,
-"reference": "1b693fb455201cacf595163c92bfb1adfa2158d8"
-},
-"dist": {
-"type": "zip",
-"url": 
"https://api.github.com/repos/JakubOnderka/PHP-Parallel-Lint/zipball/1b693fb455201cacf595163c92bfb1adfa2158d8";,
-"reference": "1b693fb455201cacf595163c92bfb1adfa2158d8",
-"shasum": ""
-},
-"require": {
-"php": ">=5.3.3"
-},
-"require-dev": {
-"jakub-onderka/php-console-highlighter": "~0.3",
-"nette/tester": "~1.3"
-},
-"suggest": {
-"jakub-onderka/php-console-highlighter": "Highlight syntax in 
code snippet"
-},
-"bin": [
-"parallel-lint"
-],
-"type": "library",
-"autoload": {
-"classmap": [
-"./"
-]
-},
-"notification-url": "https://packagist.org/downloads/";,
-"license": [
-"BSD"
-],
-"authors": [
-{
-"name": "Jakub Onderka",
-"email": "jakub.onde...@gmail.com"
-}
-],
-"description": "This tool check syntax of PHP files about 20x 
faster than serial check.",
-"homepage": "https://github.com/JakubOnderka/PHP-Parallel-Lint";,
-"time": "2015-06-16 10:17:07"
-},
-{
-"name": "mediawiki/mediawiki-codesniffer",
-"version": "v0.4.0",
-"source": {
-"type": "git",
-"url": 
"https://github.com/wikimedia/mediawiki-tools-codesniffer.git";,
-"reference": "0104c7063441e179ee0a6598e0a028223bf480dd"
-},
-"dist": {
-"type": "zip",
-"url": 
"https://api.github.com/repos/wikimedia/mediawiki-tools-codesniffer/zipball/0104c7063441e179ee0a6598e0a028223bf480dd";,
-"reference": "0104c7063441e179ee0a6598e0a028223bf480dd",
-"shasum": ""
-},
-"require": {
-"squizlabs/php_codesniffer": "2.3.4"
-},
-"require-dev": {
-"jakub-onderka/php-parallel-lint": "0.9.*",
-"phpunit/phpunit": "~4.1.0"
-},
-"type": "library",
-"notification-url": "https://packagist.org/downloads/";,
-"license": [
-"GPL-2.0+"
-],
-"description": "MediaWiki CodeSniffer Standards",
-"homepage": 
"https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP";,
-"keywords": [
-"codesniffer",
-"mediawiki"
-],
-"time": "2015-09-26 21:34:16"
-},
-{
-"name": "squizlabs/php_codesniffer",
-"version": "2.3.4",
-"source": {
-"type": "git",
-"url": "https://github.com/squizlabs/PHP_CodeSniffer.git";,
-"reference": "11a2545c44a5915f883e2e5ec12e14ed345e3ab2"
-},
-"dist": {
-"type": "zip",
-"url": 
"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/11a2545c44a5915f883e2e5ec12e14ed345e3ab2";,
-"reference": "11a2545c44a5915f883e2e5ec12e14ed345e3ab2",
-"shasum": ""
-},
- 

[MediaWiki-commits] [Gerrit] mediawiki...3D[master]: build: add phpcbf phpcs.xml / ignore 'invalid' global names

2017-03-01 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/340342 )

Change subject: build: add phpcbf phpcs.xml / ignore 'invalid' global names
..


build: add phpcbf phpcs.xml / ignore 'invalid' global names

Add a phpcs.xml file to have 'compoer test' to run with the proper files
filter and coding style.

MediaWiki style run complains about $wg3d.. global variables not being
CamelCased. Ignore them for now using @codingStandardsIgnoreStart.

Add 'composer fix' to run phpcbf easily.

Signed-off-by: Antoine Musso 
Change-Id: Ia0aeeab9663dad5a46a36d85cb06a789fc924c4b
---
M ThreeDHandler.php
M composer.json
A phpcs.xml
3 files changed, 14 insertions(+), 1 deletion(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/ThreeDHandler.php b/ThreeDHandler.php
index 7676111..09644a7 100644
--- a/ThreeDHandler.php
+++ b/ThreeDHandler.php
@@ -70,7 +70,9 @@
 * @return 
MediaTransformError|MediaTransformOutput|ThumbnailImage|TransformParameterError
 */
function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
+   // @codingStandardsIgnoreStart
global $wg3dProcessor, $wg3dProcessEnviron;
+   // @codingStandardsIgnoreEnd
 
// Impose an aspect ratio
$params['height'] = round( $params['width'] / ( 640 / 480 ) );
diff --git a/composer.json b/composer.json
index b246675..eea3cb7 100644
--- a/composer.json
+++ b/composer.json
@@ -7,6 +7,9 @@
"test": [
"parallel-lint . --exclude vendor",
"phpcs -p -s"
+   ],
+   "fix": [
+   "phpcbf"
]
}
-}
\ No newline at end of file
+}
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 000..d81a292
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,8 @@
+
+
+   
+   .
+   
+   
+   vendor
+

-- 
To view, visit https://gerrit.wikimedia.org/r/340342
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia0aeeab9663dad5a46a36d85cb06a789fc924c4b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/3D
Gerrit-Branch: master
Gerrit-Owner: Jforrester 
Gerrit-Reviewer: Hashar 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...3D[master]: build: Prepare for voting CI

2017-02-28 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/340333 )

Change subject: build: Prepare for voting CI
..


build: Prepare for voting CI

Change-Id: I3b2f9a80e087af6896e0d2573ff98a771ca54032
---
M modules/mmv.3d.js
M package.json
2 files changed, 7 insertions(+), 2 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/modules/mmv.3d.js b/modules/mmv.3d.js
index b1e8bf7..df75a7e 100644
--- a/modules/mmv.3d.js
+++ b/modules/mmv.3d.js
@@ -145,7 +145,7 @@
this.camera.updateProjectionMatrix();
this.renderer.setSize( dimensions.width, dimensions.height );
this.render( this.renderer, this.scene, this.camera );
-   }
+   };
 
TD.load = function ( extension, url ) {
var threed = this;
diff --git a/package.json b/package.json
index 6ede32d..b15adc7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,11 @@
 {
   "name": "3d",
   "version": "0.0.1",
+  "private": true,
+  "description": "Build tools for the 3D MediaWiki extension.",
+  "scripts": {
+"test": "grunt test"
+  },
   "devDependencies": {
 "grunt": "0.4.5",
 "grunt-cli": "0.1.13",
@@ -9,4 +14,4 @@
 "grunt-jscs": "2.1.0",
 "grunt-jsonlint": "1.0.4"
   }
-}
\ No newline at end of file
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/340333
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3b2f9a80e087af6896e0d2573ff98a771ca54032
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/3D
Gerrit-Branch: master
Gerrit-Owner: Jforrester 
Gerrit-Reviewer: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add 3D filetype for STL, AMF files

2017-02-07 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/336454 )

Change subject: Add 3D filetype for STL, AMF files
..

Add 3D filetype for STL, AMF files

Other filetypes use the text/plain MIME type, so we'll have to do something
else to support them.

Bug: T157348
Change-Id: Id78a504302fa664b353a4c45bdc5d99f95a0180a
---
M includes/installer/MysqlUpdater.php
M includes/libs/mime/defines.php
M includes/libs/mime/mime.info
M includes/libs/mime/mime.types
M maintenance/tables.sql
5 files changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/54/336454/1

diff --git a/includes/installer/MysqlUpdater.php 
b/includes/installer/MysqlUpdater.php
index d95222c..0e7fbd6 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -294,6 +294,7 @@
 
// 1.29
[ 'addField', 'externallinks', 'el_index_60', 
'patch-externallinks-el_index_60.sql' ],
+   [ 'modifyField', 'image', 'img_media_type', 
'patch-add-3d.sql' ],
];
}
 
diff --git a/includes/libs/mime/defines.php b/includes/libs/mime/defines.php
index ae0b5f8..da09448e 100644
--- a/includes/libs/mime/defines.php
+++ b/includes/libs/mime/defines.php
@@ -43,4 +43,6 @@
 define( 'MEDIATYPE_EXECUTABLE', 'EXECUTABLE' );
 // archive file (zip, tar, etc)
 define( 'MEDIATYPE_ARCHIVE', 'ARCHIVE' );
+// 3D file types (stl, amf)
+define( 'MEDIATYPE_3D', '3D' );
 /**@}*/
diff --git a/includes/libs/mime/mime.info b/includes/libs/mime/mime.info
index 5edd889..25aa6d3 100644
--- a/includes/libs/mime/mime.info
+++ b/includes/libs/mime/mime.info
@@ -118,3 +118,6 @@
 chemical/x-mdl-rxnfile [DRAWING]
 chemical/x-mdl-rdfile  [DRAWING]
 chemical/x-mdl-rgfile  [DRAWING]
+
+application/sla[3D]
+application/x-amf  [3D]
diff --git a/includes/libs/mime/mime.types b/includes/libs/mime/mime.types
index f1cd59d..2f6a24d 100644
--- a/includes/libs/mime/mime.types
+++ b/includes/libs/mime/mime.types
@@ -10,6 +10,7 @@
 application/pdf pdf
 application/postscript ai eps ps
 application/rdf+xml rdf
+application/sla stl
 application/smil smi smil
 application/srgs gram
 application/srgs+xml grxml
@@ -21,6 +22,7 @@
 application/vnd.wap.wmlscriptc wmlsc
 application/voicexml+xml vxml
 application/x-7z-compressed 7z
+application/x-amf amf
 application/x-bcpio bcpio
 application/x-bzip bz
 application/x-bzip2 bz2
diff --git a/maintenance/tables.sql b/maintenance/tables.sql
index 2b6ea03..2310484 100644
--- a/maintenance/tables.sql
+++ b/maintenance/tables.sql
@@ -865,7 +865,7 @@
   img_bits int NOT NULL default 0,
 
   -- Media type as defined by the MEDIATYPE_xxx constants
-  img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", 
"MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
+  img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", 
"MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE", "3D") default NULL,
 
   -- major part of a MIME media type as defined by IANA
   -- see https://www.iana.org/assignments/media-types/

-- 
To view, visit https://gerrit.wikimedia.org/r/336454
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id78a504302fa664b353a4c45bdc5d99f95a0180a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[master]: [WIP] Load details divs on scroll

2016-12-14 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/327233 )

Change subject: [WIP] Load details divs on scroll
..

[WIP] Load details divs on scroll

Speeds up the loading of details step significantly when there are many
uploads.

Still TODO: Force-load (or slowly async load?) or store copied metadata
somehow for non-loaded details objects.

Bug: T153210
Change-Id: Ie178d8b7ec3c622d05b5648747d20deaf568f1e1
---
M resources/controller/uw.controller.Details.js
M resources/mw.UploadWizardDetails.js
2 files changed, 225 insertions(+), 202 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/33/327233/1

diff --git a/resources/controller/uw.controller.Details.js 
b/resources/controller/uw.controller.Details.js
index c64bede..9e99669 100644
--- a/resources/controller/uw.controller.Details.js
+++ b/resources/controller/uw.controller.Details.js
@@ -139,7 +139,6 @@
 */
uw.controller.Details.prototype.createDetails = function ( upload ) {
upload.details = new mw.UploadWizardDetails( upload, $( 
'#mwe-upwiz-macro-files' ) );
-   upload.details.populate();
upload.details.attach();
};
 
diff --git a/resources/mw.UploadWizardDetails.js 
b/resources/mw.UploadWizardDetails.js
index 262808a..fc68178 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -10,11 +10,6 @@
 * @param {jQuery} containerDiv The `div` to put the interface into
 */
mw.UploadWizardDetails = function ( upload, containerDiv ) {
-   var
-   descriptionRequired, uri,
-   $moreDetailsWrapperDiv, $moreDetailsDiv,
-   details = this;
-
this.upload = upload;
this.containerDiv = containerDiv;
this.api = upload.api;
@@ -22,208 +17,219 @@
this.mainFields = [];
 
this.div = $( '' );
-
-   this.thumbnailDiv = $( '' );
-
-   this.dataDiv = $( '' );
-
-   // descriptions
-   // Description is not required if a campaign provides 
alternative wikitext fields,
-   // which are assumed to function like a description
-   descriptionRequired = !(
-   mw.UploadWizard.config.fields &&
-   mw.UploadWizard.config.fields.length &&
-   mw.UploadWizard.config.fields[ 0 ].wikitext
-   );
-   this.descriptionsDetails = new uw.DescriptionsDetailsWidget( {
-   required: descriptionRequired
-   } );
-   this.descriptionsDetailsField = new uw.FieldLayout( 
this.descriptionsDetails, {
-   label: mw.message( 'mwe-upwiz-desc' ).text(),
-   help: mw.message( 'mwe-upwiz-tooltip-description' 
).text(),
-   required: descriptionRequired
-   } );
-   this.mainFields.push( this.descriptionsDetailsField );
-
-   this.titleDetails = new uw.TitleDetailsWidget( {
-   // Normalize file extension, e.g. 'JPEG' to 'jpg'
-   extension: mw.Title.normalizeExtension( 
this.upload.title.getExtension() )
-   } );
-   this.titleDetailsField = new uw.FieldLayout( this.titleDetails, 
{
-   label: mw.message( 'mwe-upwiz-title' ).text(),
-   help: mw.message( 'mwe-upwiz-tooltip-title' ).text(),
-   required: true
-   } );
-   this.mainFields.push( this.titleDetailsField );
-
-   this.deedChooserDetails = new uw.DeedChooserDetailsWidget();
-   this.deedChooserDetailsField = new uw.FieldLayout( 
this.deedChooserDetails, {
-   label: mw.message( 'mwe-upwiz-copyright-info' ).text(),
-   required: true
-   } );
-   this.deedChooserDetailsField.toggle( false ); // See 
useCustomDeedChooser()
-   this.mainFields.push( this.deedChooserDetailsField );
-
-   this.categoriesDetails = new uw.CategoriesDetailsWidget();
-   this.categoriesDetailsField = new uw.FieldLayout( 
this.categoriesDetails, {
-   label: mw.message( 'mwe-upwiz-categories' ).text(),
-   help: new OO.ui.HtmlSnippet(
-   mw.message( 'mwe-upwiz-tooltip-categories', $( 
'' ).attr( {
-   target: '_blank',
-   href: 
'https://commons.wikimedia.org/wiki/Commons:Categories'
-   } ) ).parse()
-   )
-   } );
-   this.mainFields.push( this.categoriesDetailsField );
-
-

[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[master]: Sanitize Firefogg errors so filepaths don't leak

2016-12-06 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/325590

Change subject: Sanitize Firefogg errors so filepaths don't leak
..

Sanitize Firefogg errors so filepaths don't leak

Bug: T136851
Change-Id: Ic31cff75e63281eeb0bccc9b005a31ef29fbfdd5
---
M resources/transports/mw.FirefoggTransport.js
1 file changed, 31 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/90/325590/1

diff --git a/resources/transports/mw.FirefoggTransport.js 
b/resources/transports/mw.FirefoggTransport.js
index 8b53f61..e8d43e8 100644
--- a/resources/transports/mw.FirefoggTransport.js
+++ b/resources/transports/mw.FirefoggTransport.js
@@ -20,7 +20,8 @@
 * @return {jQuery.Promise}
 */
mw.FirefoggTransport.prototype.upload = function () {
-   var fileToUpload = this.fileToUpload,
+   var filteredError,
+   fileToUpload = this.fileToUpload,
deferred = $.Deferred();
 
// Encode or passthrough Firefogg before upload
@@ -30,25 +31,36 @@
 
deferred.notify( 'encoding' );
 
-   this.fogg.encode( JSON.stringify( this.getEncodeSettings() ),
-   function ( result, file ) {
-   result = JSON.parse( result );
-   if ( result.progress === 1 ) {
-   // encoding done
-   deferred.resolve( file );
-   } else {
-   // encoding failed
-   deferred.reject( {
-   error: {
-   code: 'firefogg',
-   info: 'Encoding failed'
-   }
-   } );
+   try {
+   this.fogg.encode( JSON.stringify( 
this.getEncodeSettings() ),
+   function ( result, file ) {
+   result = JSON.parse( result );
+   if ( result.progress === 1 ) {
+   // encoding done
+   deferred.resolve( file );
+   } else {
+   // encoding failed
+   deferred.reject( {
+   error: {
+   code: 
'firefogg',
+   info: 'Encoding 
failed'
+   }
+   } );
+   }
+   }, function ( progress ) {
+   deferred.notify( JSON.parse( progress ) 
);
}
-   }, function ( progress ) {
-   deferred.notify( JSON.parse( progress ) );
-   }
-   );
+   );
+   } catch ( e ) {
+   // File paths sometimes leak here, because ffmpeg is 
called by Firefogg
+   filteredError = e.toString()
+   // UNIX-y error message if ffmpeg is not a 
valid binary, sanitize
+   .replace( /File '[^']*'/, 'File \'...\'' )
+   // Windows-y error message if ffmpeg is not 
found, sanitize
+   .replace( /Could not launch subprocess 
'[^']*'/, 'Could not launch subprocess \'...\'' );
+
+   throw new Error( filteredError );
+   }
 
return deferred.promise();
};

-- 
To view, visit https://gerrit.wikimedia.org/r/325590
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic31cff75e63281eeb0bccc9b005a31ef29fbfdd5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[master]: Remove ES3/IE8 hackaround for reserved word

2016-12-06 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/325584

Change subject: Remove ES3/IE8 hackaround for reserved word
..

Remove ES3/IE8 hackaround for reserved word

Bug: T123220
Change-Id: I0be64532793afc449fbfab0914a6ec5262c2f0a1
---
M resources/ui/uw.ui.Wizard.js
1 file changed, 2 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/84/325584/1

diff --git a/resources/ui/uw.ui.Wizard.js b/resources/ui/uw.ui.Wizard.js
index f9e1205..5337de1 100644
--- a/resources/ui/uw.ui.Wizard.js
+++ b/resources/ui/uw.ui.Wizard.js
@@ -96,14 +96,11 @@
if ( typeof configAltUploadForm === 'object' ) {
userLanguage = mw.config.get( 'wgUserLanguage' );
 
-   // Not using .default for ES3 support (IE8)
-   // jscs: disable requireDotNotation
if ( configAltUploadForm[ userLanguage ] ) {
altUploadForm = configAltUploadForm[ 
userLanguage ];
-   } else if ( configAltUploadForm[ 'default' ] ) {
-   altUploadForm = configAltUploadForm[ 'default' 
];
+   } else if ( configAltUploadForm.default ) {
+   altUploadForm = configAltUploadForm.default;
}
-   // jscs: enable requireDotNotation
} else {
altUploadForm = configAltUploadForm;
}

-- 
To view, visit https://gerrit.wikimedia.org/r/325584
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0be64532793afc449fbfab0914a6ec5262c2f0a1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] labs...grrrit[master]: Remove hacks, fix logging

2016-11-27 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/323712

Change subject: Remove hacks, fix logging
..

Remove hacks, fix logging

Seriously tired of these hacky things getting in the way.

Change-Id: Ia35ad4e2325dafd8bdffc570abb29d63aafbd2d5
---
M src/relay.js
1 file changed, 66 insertions(+), 53 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/grrrit 
refs/changes/12/323712/1

diff --git a/src/relay.js b/src/relay.js
index 38997d8..be77a5d 100644
--- a/src/relay.js
+++ b/src/relay.js
@@ -10,8 +10,10 @@
 yaml = require('js-yaml'),
 logging = require('winston'),
 ssh2 = require('ssh2'),
-handle,
+ircUp = false,
+sshUp = false,
 sshConn = null,
+savedTo,
 // Sane? defaults
 config_defaults = {
 nick: 'grrrit',
@@ -27,41 +29,60 @@
 logging.error(message);
 }
 
+function bothConnected() {
+if ( sshUp && ircUp && savedTo !== undefined ) {
+ircClient.say( savedTo, "Successfully connected to IRC and SSH." );
+savedTo = undefined;
+}
+}
+
+function sshConnected( listener ) {
+sshUp = true;
+
+logging.info('Connected to Gerrit via SSH; requesting stream-events');
+sshConn.exec('gerrit stream-events', function(err, stream) {
+if (err) {
+logging.error(err);
+// TODO won't this log it twice?
+throw err;
+}
+logging.info('Connected to event stream!');
+stream.on('data', function(data) {
+listener(err, JSON.parse(data));
+});
+});
+
+bothConnected();
+}
+
+function ircConnected( to ) {
+ircUp = true;
+savedTo = to;
+
+logging.info( 'Connected to IRC.' );
+
+bothConnected();
+}
+
 function subscribeToGerritStream(host, port, username, keypath, listener) {
 logging.info('Connecting to gerrit..');
 
 sshConn = ssh2.Client();
 sshConn.on('ready', function() {
-logging.info('Connected; requesting stream-events');
-sshConn.exec('gerrit stream-events', function(err, stream) {
-if (err) {
-logging.error(err);
-throw err;
-}
-logging.info('Connected to event stream!');
-stream.on('data', function(data) {
-listener(err, JSON.parse(data));
-});
-});
+sshConnected( listener );
 }).on('error', function(err) {
-console.log('Client error: ' + err);
+sshUp = false;
+logging.error('Client error: ' + err);
 }).on('close', function() {
-console.log('Client disconnected');
-
-logging.info('re-connecting to irc.');
-
-handle = setInterval(startRelay, 1);
-
-logging.info('re-connected to irc.');
-
-console.log('Client re-connected');
+sshUp = false;
+logging.info('SSH connection to Gerrit closed, reconnecting');
+startRelay();
 }).connect({
 host: host,
 port: port,
 username: username,
 privateKey: require('fs').readFileSync(keypath),
 });
-clearInterval(handle);
 }
 
 var allChannels = _.keys(config.channels);
@@ -156,8 +177,9 @@
 logging.info("Joined channel " + channel);
 }
 if(joinedChannels.length === allChannels.length) {
+ircConnected();
 ircClient.removeListener('join', waitForChannelJoins);
-logging.info("Joined " + joinedChannels.length + " channels. Starting 
relay");
+logging.info("Joined " + joinedChannels.length + " channels. 
Connecting to Gerrit via SSH.");
 startRelay();
 }
 }
@@ -171,15 +193,14 @@
 
 if (text.indexOf(ircClient.nick + ': ' + 'restart') === 0) {
 if (from_trusted) {
-console.log(from + ' => ' + to  + ' ' + text);
+logging.debug(from + ' => ' + to  + ' ' + text);
 
 if (sshConn) {
 sshConn.end();
-logging.info('re-connecting to gerrit..');
-ircClient.say(to, "Ended SSH connection to Gerrit.");
-} else {
-ircClient.say(to, "No SSH connection to Gerrit.");
+logging.info('Disconnected SSH connection to Gerrit.');
 }
+
+ircClient.say(to, "Ended SSH connection to Gerrit.");
 } else {
 ircClient.say(to, "Permission is denied.");
 }
@@ -187,24 +208,19 @@
 
 if (text.indexOf(ircClient.nick + ': ' + 'force-restart') === 0) {
 if (from_trusted) {
-console.log(from + ' => ' + to  + ' ' + text);
-
-ircClient.say(to, "Re-connecting to Gerrit and IRC.");
-
-logging.info('Disconnecting from IRC.');
-
-ircClient.send('QUIT', "quit");
+  

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Allow empty href in SVGs

2016-10-31 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/318916

Change subject: Allow empty href in SVGs
..

Allow empty href in SVGs

bawolff is right, this shouldn't harm anything.

Bug: T149549
Change-Id: I377efdee7478940154ef5ec921bd0c8f7ec0c110
---
M includes/upload/UploadBase.php
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/16/318916/1

diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php
index 3422632..6ea27a3 100644
--- a/includes/upload/UploadBase.php
+++ b/includes/upload/UploadBase.php
@@ -1510,8 +1510,9 @@
&& strpos( $value, 'data:' ) !== 0
&& strpos( $value, '#' ) !== 0
) {
-   if ( !( $strippedElement === 'a'
-   && preg_match( '!^https?://!i', $value 
) )
+   if ( $value !== '' &&
+   !( $strippedElement === 'a'
+   && preg_match( '!^https?://!i', 
$value ) )
) {
wfDebug( __METHOD__ . ": Found href 
attribute <$strippedElement "
. "'$attrib'='$value' in 
uploaded file.\n" );

-- 
To view, visit https://gerrit.wikimedia.org/r/318916
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I377efdee7478940154ef5ec921bd0c8f7ec0c110
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Fix minor problems found in security review

2016-10-27 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/318308

Change subject: Fix minor problems found in security review
..

Fix minor problems found in security review

Bug: T146174
Change-Id: I6a6500332efc0b842e57c64154687306585960b3
---
M ApiFileAnnotations.php
M FileAnnotations.hooks.php
M FileAnnotations.php
M extension.json
4 files changed, 49 insertions(+), 28 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/08/318308/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index a70a9f2..10ac313 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -20,8 +20,8 @@
  * @file
  * @ingroup Api
  *
- * @copyright 2015 Mark Holmquist
- * @license GNU General Public License version 2.0
+ * @copyright 2015 Mark Holmquist and others; see AUTHORS.txt
+ * @license GNU General Public License version 2.0; see LICENSE.txt
  */
 use MediaWiki\MediaWikiServices;
 
@@ -164,7 +164,8 @@
protected function renderWikipediaAnnotation( $wpMatches ) {
$articleName = $wpMatches[2];
$language = $wpMatches[1];
-   $safeAsOf = $this->getSafeCacheAsOfForUser( 'enwiki' );
+   // Maybe assumes the input is valid...
+   $safeAsOf = $this->getSafeCacheAsOfForUser( $language . 'wiki' 
);
 
$cache = ObjectCache::getMainWANInstance();
$cacheKey = $cache->makeKey( 'fileannotations', 
'wikipediapage', $language, $articleName );
@@ -413,26 +414,36 @@
$pages = $imageApiData['query']['pages'];
$imageLink = null;
 
-   $page = $pages[0];
-   // There's only one page. Add HTML here.
-   $info = $page['imageinfo'][0];
-   return
-   '' .
-   '' .
-   '' .
-   '' .
-   '';
+   if ( $pages[0] ) {
+   $page = $pages[0];
+   // There's only one page. Add HTML here.
+   $info = $page['imageinfo'][0];
+   return
+   '' .
+   '' .
+   '' .
+   '' .
+   '';
+   }
+
+   // Oops, there's no image. Bail.
+   return '';
}
 
protected function parseAnnotation( $text, $faTitle, Parser $parser, 
$popts ) {
$presult = $parser->parse( $text, $faTitle, $popts );
-   $parsed = $presult->mText;
+   $parsed = $presult->getText();
 
-   // Check to see if we can return a special display for this 
annotation.
-   // We can't just the $text against the regexes, since the link 
might be generated from a
-   // wikitext link like [[commons:Foo]] or a template.
-   $dom = new DOMDocument();
-   $dom->loadXML( '' . $presult->mText . '' );
+   try {
+   // Check to see if we can return a special display for 
this annotation.
+   // We can't just the $text against the regexes, since 
the link might be generated from a
+   // wikitext link like [[commons:Foo]] or a template.
+   $dom = new DOMDocument();
+   $dom->loadXML( '' . $presult->mText . '' );
+   } catch ( e ) {
+   // Don't muck around, just load an empty dom
+   $dom->loadXML( '' );
+   }
 
$xpath = new DOMXPath( $dom );
// If the output is just a single link `` wrapped in a 
single paragraph ``, optionally
@@ -447,7 +458,7 @@
 
$commonsMatches = [];
$commonsCategoryMatch = preg_match(
-   
'%^https?://commons.wikimedia.org.*(Category:.*)%',
+   
'%^https?://commons.wikimedia.org/(?:wiki/|w/index.php\?.*title=)(Category:.*)%',
$href,
$commonsMatches
);
diff --git a/FileAnnotations.hooks.php b/FileAnnotations.hooks.php
index b5aa666..b4f4e1a 100644
--- a/FileAnnotations.hooks.php
+++ b/FileAnnotations.hooks.php
@@ -40,13 +40,22 @@
'fileannotations-tab'
);
 
-   $links['namespaces']['annotations'] = [
-   'class' => '',
-   'text' => $tabMessage->text(),
-   'href' => $sktemplate->makeArticleUrlDetails(
-   $fatitle->getFullText

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Disable external entities in XML processing

2016-10-24 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/317493

Change subject: Disable external entities in XML processing
..

Disable external entities in XML processing

https://www.mediawiki.org/wiki/XML_External_Entity_Processing

Bug: T146174
Change-Id: Icabc298bbf4997c1faf076d9ab9b3a91f89f3589
---
M ApiFileAnnotations.php
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/93/317493/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index a70a9f2..38555c5 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -432,7 +432,9 @@
// We can't just the $text against the regexes, since the link 
might be generated from a
// wikitext link like [[commons:Foo]] or a template.
$dom = new DOMDocument();
+   $oldValue = libxml_disable_entity_loader( true );
$dom->loadXML( '' . $presult->mText . '' );
+   libxml_disable_entity_loader( $oldValue );
 
$xpath = new DOMXPath( $dom );
// If the output is just a single link `` wrapped in a 
single paragraph ``, optionally

-- 
To view, visit https://gerrit.wikimedia.org/r/317493
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icabc298bbf4997c1faf076d9ab9b3a91f89f3589
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Restrict language codes for Wikipedia annotations

2016-10-24 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/317491

Change subject: Restrict language codes for Wikipedia annotations
..

Restrict language codes for Wikipedia annotations

Bug: T146174
Change-Id: Ie4213745cf6f264a8f9ad8bda866891c65031459
---
M ApiFileAnnotations.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/91/317491/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index 6ba8f2f..e3b1559 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -398,7 +398,7 @@
 
$wpMatches = [];
$wpArticleMatch = preg_match(
-   '%^(https?://.*.wikipedia.org)/wiki/(.*)%',
+   
'%^(https?://[a-zA-Z\-]+.wikipedia.org)/wiki/(.*)%',
$href,
$wpMatches
);

-- 
To view, visit https://gerrit.wikimedia.org/r/317491
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4213745cf6f264a8f9ad8bda866891c65031459
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[master]: Fix a weird ghost "or" for non-Flickr users

2016-10-14 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/315974

Change subject: Fix a weird ghost "or" for non-Flickr users
..

Fix a weird ghost "or" for non-Flickr users

Just a confusing UI element that got included for non-upload_by_url users,
missed in the tests because I usually have that option turned on...

Change-Id: I05fa7f6dccf4031b18c3dd14cee7c69b7309d5bd
---
M resources/ui/steps/uw.ui.Upload.js
1 file changed, 35 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/74/315974/1

diff --git a/resources/ui/steps/uw.ui.Upload.js 
b/resources/ui/steps/uw.ui.Upload.js
index a9706c7..ae6489c 100644
--- a/resources/ui/steps/uw.ui.Upload.js
+++ b/resources/ui/steps/uw.ui.Upload.js
@@ -34,38 +34,14 @@
'file'
);
 
-   this.$uploadCenterDivide = $( '' )
-   .attr( 'id', 'mwe-upwiz-upload-ctr-divide' )
-   .text( mw.message( 'mwe-upwiz-add-flickr-or' ).text() );
-
-   this.$flickrAddFileContainer = $( '' )
-   .attr( 'id', 'mwe-upwiz-upload-ctrl-flickr-container' )
-   .append( this.$uploadCenterDivide );
-
this.$addFileContainer = $( '' )
.attr( 'id', 'mwe-upwiz-add-file-container' )
-   .addClass( 'mwe-upwiz-add-files-0' )
-   .append( this.$flickrAddFileContainer );
+   .addClass( 'mwe-upwiz-add-files-0' );
 
this.$uploadCtrl = $( '' )
.attr( 'id', 'mwe-upwiz-upload-ctrls' )
.addClass( 'mwe-upwiz-file ui-helper-clearfix' )
.append( this.$addFileContainer );
-
-   this.$flickrSelectList = $( '' )
-   .attr( 'id', 'mwe-upwiz-flickr-select-list' );
-
-   this.$flickrSelectListContainer = $( '' )
-   .attr( 'id', 'mwe-upwiz-flickr-select-list-container' )
-   .addClass( 'ui-corner-all' )
-   .append(
-   $( '' )
-   .text( mw.message(
-   'mwe-upwiz-multi-file-select2',
-   config.maxUploads
-   ) ),
-   this.$flickrSelectList
-   );
 
this.addFile = new OO.ui.ButtonWidget( {
id: 'mwe-upwiz-add-file',
@@ -73,9 +49,16 @@
flags: [ 'constructive', 'primary' ]
} );
 
-   this.$addFileContainer.prepend( this.addFile.$element );
+   this.$addFileContainer.append( this.addFile.$element );
 
if ( this.isFlickrImportEnabled() ) {
+   this.$flickrAddFileContainer = $( '' )
+   .attr( 'id', 
'mwe-upwiz-upload-ctrl-flickr-container' );
+
+   this.$uploadCenterDivide = $( '' )
+   .attr( 'id', 'mwe-upwiz-upload-ctr-divide' )
+   .text( mw.message( 'mwe-upwiz-add-flickr-or' 
).text() );
+
this.addFlickrFile = new OO.ui.ButtonWidget( {
id: 'mwe-upwiz-add-flickr-file',
label: mw.message( 'mwe-upwiz-add-file-flickr' 
).text(),
@@ -84,7 +67,28 @@
upload.emit( 'flickr-ui-init' );
} );
 
-   this.$flickrAddFileContainer.append( 
this.addFlickrFile.$element );
+   this.$flickrAddFileContainer.append(
+   this.$uploadCenterDivide,
+   this.addFlickrFile.$element
+   );
+
+   this.$addFileContainer
+   .append( this.$flickrAddFileContainer );
+
+   this.$flickrSelectList = $( '' )
+   .attr( 'id', 'mwe-upwiz-flickr-select-list' );
+
+   this.$flickrSelectListContainer = $( '' )
+   .attr( 'id', 
'mwe-upwiz-flickr-select-list-container' )
+   .addClass( 'ui-corner-all' )
+   .append(
+   $( '' )
+   .text( mw.message(
+   
'mwe-upwiz-multi-file-select2',
+   config.maxUploads
+   ) ),
+   this.$flickrSelectList
+   );
 
  

[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[master]: Add parsererror message and debug line

2016-09-23 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312532

Change subject: Add parsererror message and debug line
..

Add parsererror message and debug line

Let's tell the user what actually happened, and get them some useful information
for bug reports when they open the developer console.

Bug: T146473
Change-Id: I74326d05f490be652b8c5805ced04a2935a1008f
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M resources/mw.UploadWizardUploadInterface.js
M resources/transports/mw.FormDataTransport.js
5 files changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/32/312532/1

diff --git a/extension.json b/extension.json
index 5532fc3..f46df3c 100644
--- a/extension.json
+++ b/extension.json
@@ -306,6 +306,7 @@
"api-error-abusefilter-warning",
"api-error-abusefilter-disallowed",
"api-error-spamblacklist",
+   "api-error-parsererror",
"mwe-upwiz-api-warning-was-deleted",
"mwe-upwiz-api-warning-exists",

"mwe-upwiz-tutorial-error-localized-file-missing",
diff --git a/i18n/en.json b/i18n/en.json
index b3e3143..787d10f 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -20,6 +20,7 @@
"api-error-abusefilter-warning": "This action has been automatically 
identified as harmful ([$1 more info]).\nUnconstructive edits will be quickly 
reverted,\nand egregious or repeated unconstructive editing will result in your 
account or IP address being blocked.",
"api-error-abusefilter-disallowed": "This action has been automatically 
identified as harmful, and therefore disallowed ([$1 more info]).",
"api-error-spamblacklist": "The text you wanted to save was blocked by 
the spam filter.\nThis is probably caused by a link to a blacklisted external 
site.",
+   "api-error-parsererror": "The server responded with an invalid JSON 
document.",
"mwe-upwiz-unavailable": "Your browser is not compatible with 
UploadWizard or has JavaScript turned off, so we are showing you a simple 
upload form. ([https://www.mediawiki.org/wiki/UploadWizard#Compatibility View 
compatibility requirements].)",
"mwe-upwiz-extension-disabled": "This page has been disabled due to 
temporary technical problems. In the meantime try the standard upload form.",
"mwe-upwiz-step-tutorial": "Learn",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 66ae06b..3b81229 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -44,6 +44,7 @@
"api-error-abusefilter-warning": "API error message that can be used 
for client side localisation of API errors. This is a shorter version of 
{{msg-mw|abusefilter-warning}} that is specific to file uploads. Parameters:\n* 
$1 - link that displays a more complete error information when clicked",
"api-error-abusefilter-disallowed": "API error message that can be used 
for client side localisation of API errors. This is a shorter version of 
{{msg-mw|abusefilter-disallowed}} that is specific to file uploads. 
Parameters:\n* $1 - link that displays a more complete error information when 
clicked",
"api-error-spamblacklist": "API error message that can be used for 
client side localisation of API errors. This is a shorter version of 
{{msg-mw|spamprotectiontext}} that is specific to file uploads.",
+   "api-error-parsererror": "Error message for when, for an unknown 
reason, the server sent the client an invalid response.",
"mwe-upwiz-unavailable": "Shown if the user visits Special:UploadWizard 
using a browser that can't display the wizard due to JavaScript being disabled 
or lack of support for modern features.",
"mwe-upwiz-extension-disabled": "Shown if the UploadWizard page has 
been disabled.",
"mwe-upwiz-step-tutorial": "{| align=\"right\"\n| 
[[file:commons-uw-L524.png|Initial \"{{MediaWiki:mwe-upwiz-step-file/en}}\" 
page|thumb|right]]\n| [[file:commons-uw-L521.png|Beginning of 
\"{{MediaWiki:mwe-upwiz-step-tutorial/en}}\" page|thumb|right]]\n| 
[[file:commons-uw-L522.png|Center of 
\"{{MediaWiki:mwe-upwiz-step-tutorial/en}}\" page|thumb|right]]\n| 
[[file:commons-uw-L523.png|End of \"{{MediaWiki:mwe-upwiz-step-tutorial/en}}\" 
page|thumb|right]]\n|} This is a short greyed or bolded label, in the top bar 
of all pages of the [[:mw:Extension:UploadWizard|MediaWiki Upload Wizard]].",
diff --git a/resources/mw.UploadWizardUploadInterface.js 
b/resources/mw.UploadWizardUploadInterface.js
index 5c2f0e2..bb7575d 100644
--- a/resources/mw.UploadWizardUploadInterface.js
+++ b/resources/mw.UploadWizardUploadInterface.js
@@ -187,7 +187,8 @@
'unknown-warning',
'abusefilter-disallowed',
  

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Fix silly mistakes in refactors

2016-09-22 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312319

Change subject: Fix silly mistakes in refactors
..

Fix silly mistakes in refactors

Change-Id: I96a05066248527503da6c6519054710d0a4ab623
---
M resources/src/FileAnnotation.js
M resources/src/FileAnnotationEditor.js
2 files changed, 4 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/19/312319/1

diff --git a/resources/src/FileAnnotation.js b/resources/src/FileAnnotation.js
index 790495f..1d823c2 100644
--- a/resources/src/FileAnnotation.js
+++ b/resources/src/FileAnnotation.js
@@ -45,7 +45,7 @@
 
this.editing = config.editing;
 
-   if ( this.text && this.parsed ) {
+   if ( this.text !== undefined && this.parsed !== undefined ) {
this.$annotation = $( '' )
.addClass( 'file-annotation' )
.append( this.parsed );
diff --git a/resources/src/FileAnnotationEditor.js 
b/resources/src/FileAnnotationEditor.js
index 4a161dd..d4308ce 100644
--- a/resources/src/FileAnnotationEditor.js
+++ b/resources/src/FileAnnotationEditor.js
@@ -33,7 +33,9 @@
// For a new annotation, the box is the container.
$contain = $box;
 
-   config.$container.append( $box );
+   if ( config.$container ) {
+   config.$container.append( $box );
+   }
}
 
this.$box = $box;

-- 
To view, visit https://gerrit.wikimedia.org/r/312319
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96a05066248527503da6c6519054710d0a4ab623
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Make annotations popups, move them around

2016-09-22 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312281

Change subject: Make annotations popups, move them around
..

Make annotations popups, move them around

Bug: T145458
Change-Id: I75ade5ffebc29a1380011be1b6d1ff005a637fbe
---
M resources/src/FileAnnotation.js
M resources/src/FileAnnotator.less
2 files changed, 82 insertions(+), 55 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/81/312281/1

diff --git a/resources/src/FileAnnotation.js b/resources/src/FileAnnotation.js
index 790495f..af993b3 100644
--- a/resources/src/FileAnnotation.js
+++ b/resources/src/FileAnnotation.js
@@ -13,6 +13,8 @@
 * @cfg {boolean} editing Whether editing is enabled.
 */
function FileAnnotation( config ) {
+   var annotation = this;
+
OO.EventEmitter.call( this );
 
this.api = config.api;
@@ -54,11 +56,11 @@
.msg( 'fileannotations-commons-see-more' );
 
this.$contain = $( '' )
+   .append( this.$annotation )
.addClass( 'annotation-container' );
 
this.$box = $( '' )
.addClass( 'annotation-box' )
-   .append( this.$contain )
.css( {
top: this.adjustedY,
left: this.adjustedX,
@@ -66,12 +68,46 @@
height: this.adjustedHeight
} );
 
-   this.$contain.css( {
-   top: this.adjustedHeight - 10,
-   left: this.adjustedWidth - 10
+   this.$contentBody = $( '#mw-content-text' );
+
+   this.popup = new OO.ui.PopupWidget( {
+   $container: this.$contentBody,
+   $content: this.$contain,
+   padded: true,
+   width: 550,
+   anchor: false,
+   classes: [ 'annotation-popup' ]
} );
 
-   this.$contain.append( this.$annotation );
+   this.$box.hover( function ( e ) {
+   // Hover start, toggle on and align.
+   var x = e.clientX,
+   $body = $( 'body' ),
+   sw = $body.width();
+
+   if ( x < ( sw / 2 ) ) {
+   // We're on the left half of the 
screen, push the annotation to the right.
+   annotation.popup.$element.css( {
+   left: annotation.adjustedWidth
+   } );
+
+   annotation.popup.setAlignment( 
'force-right' );
+   } else {
+   // We're on the right half of the 
screen, push the annotation to the left.
+   annotation.popup.$element.css( {
+   left: -annotation.adjustedWidth 
- annotation.$contain.width
+   } );
+
+   annotation.popup.setAlignment( 
'force-left' );
+   }
+
+   annotation.popup.toggle( true );
+   }, function () {
+   // Hover end, toggle off
+   annotation.popup.toggle( false );
+   } );
+
+   this.$box.append( this.popup.$element );
 
if ( config.editing ) {
this.addEditInterface();
diff --git a/resources/src/FileAnnotator.less b/resources/src/FileAnnotator.less
index 1eefa36..6f816b7 100644
--- a/resources/src/FileAnnotator.less
+++ b/resources/src/FileAnnotator.less
@@ -14,66 +14,57 @@
position: absolute;
border: 1px solid yellow;
 
-   .annotation-container {
-   display: none;
-   border: 1px solid grey;
-   background-color: white;
-   position: absolute;
-   padding: 2px;
-   z-index: 1;
+   .file-annotation {
+   .commons-category-annotation {
+   padding: 5px;
+   text-align: center;
 
-   .file-annotation {
- 

[MediaWiki-commits] [Gerrit] oojs/ui[master]: [WIP] Add 'orientation' config to PopupWidget

2016-09-21 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312128

Change subject: [WIP] Add 'orientation' config to PopupWidget
..

[WIP] Add 'orientation' config to PopupWidget

Puts the chevron on the bottom of the popup if 'orientation' is 'down'.

WIP because the popup is still below the origin...I don't know the best way
and I'm hoping to shop for someone who can help.

Change-Id: Iede5e0fd57580d976e62cf0e03d95851492e914c
---
M demos/pages/widgets.js
M src/themes/apex/widgets.less
M src/themes/mediawiki/widgets.less
M src/widgets/PopupWidget.js
4 files changed, 83 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/28/312128/1

diff --git a/demos/pages/widgets.js b/demos/pages/widgets.js
index 538de63..6b2a568 100644
--- a/demos/pages/widgets.js
+++ b/demos/pages/widgets.js
@@ -1741,6 +1741,24 @@
label: 'More 
information',
$content: $( 'Extra 
information here.' ),
padded: true,
+   align: 'force-left',
+   orientation: 'down'
+   }
+   } ),
+   {
+   label: 'PopupButtonWidget 
(frameless, with popup head, align: force-left, orientation: down)\u200E',
+   align: 'top'
+   }
+   ),
+   new OO.ui.FieldLayout(
+   new OO.ui.PopupButtonWidget( {
+   icon: 'info',
+   framed: false,
+   popup: {
+   head: true,
+   label: 'More 
information',
+   $content: $( 'Extra 
information here.' ),
+   padded: true,
align: 'force-right'
}
} ),
diff --git a/src/themes/apex/widgets.less b/src/themes/apex/widgets.less
index f9f875b..aeabad9 100644
--- a/src/themes/apex/widgets.less
+++ b/src/themes/apex/widgets.less
@@ -839,6 +839,20 @@
border-bottom-color: #fff;
border-width: @anchor-size;
}
+
+   .oo-ui-popupWidget-anchor-down {
+   transform: rotate( 180deg );
+   top: initial;
+   bottom: 0;
+
+   &:after {
+   top: -@anchor-size + 1px;
+   }
+
+   &:before {
+   top: -@anchor-size - 1px;
+   }
+   }
}
 
&-transitioning .oo-ui-popupWidget-popup {
diff --git a/src/themes/mediawiki/widgets.less 
b/src/themes/mediawiki/widgets.less
index 8d1009f..16a4cf2 100644
--- a/src/themes/mediawiki/widgets.less
+++ b/src/themes/mediawiki/widgets.less
@@ -1299,6 +1299,20 @@
border-bottom-color: @border-color-disabled-filled;
border-width: @anchor-size;
}
+
+   .oo-ui-popupWidget-anchor-down {
+   transform: rotate( 180deg );
+   top: initial;
+   bottom: 0;
+
+   &:after {
+   top: -@anchor-size + 1px;
+   }
+
+   &:before {
+   top: -@anchor-size - 1px;
+   }
+   }
}
 
&-transitioning .oo-ui-popupWidget-popup {
diff --git a/src/widgets/PopupWidget.js b/src/widgets/PopupWidget.js
index 332d3e6..a0fb3b8 100644
--- a/src/widgets/PopupWidget.js
+++ b/src/widgets/PopupWidget.js
@@ -34,6 +34,9 @@
  *  in the given language, which means it will flip to the correct positioning 
in right-to-left languages.
  *  Using 'forward' will also result in a logical alignment where the body of 
the popup leans towards the end of the
  *  sentence in the given language.
+ * @cfg {string} [orientation='up'] Orientation of the anchor: `up` or `down`. 
This is the direction the anchor will
+ *  point from the popup - `down` will put the anchor at the bottom of the 
popup. Note: You need to position the
+ *  popup to be above its container.
  * @cfg {jQuery} [

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: mw.api.upload: Suppress default API call timeout

2016-09-21 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged.

Change subject: mw.api.upload: Suppress default API call timeout
..


mw.api.upload: Suppress default API call timeout

mw.Api sets a default timeout of 30 seconds, meaning that if the
request takes more than that, it will be aborted. This is reasonable
in most cases, but file uploads can easily take longer than that.

Bug: T117545
Change-Id: I086108421d229c60f5e9d5c9edb70150d875dcb0
---
M resources/src/mediawiki/api/upload.js
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  MarkTraceur: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/src/mediawiki/api/upload.js 
b/resources/src/mediawiki/api/upload.js
index c2da10e..8169449 100644
--- a/resources/src/mediawiki/api/upload.js
+++ b/resources/src/mediawiki/api/upload.js
@@ -283,6 +283,8 @@
this[ this.needToken() ? 'postWithEditToken' : 'post' 
]( data, {
// Use FormData (if we got here, we know that 
it's available)
contentType: 'multipart/form-data',
+   // No timeout (default from mw.Api is 30 
seconds)
+   timeout: 0,
// Provide upload progress notifications
xhr: function () {
var xhr = $.ajaxSettings.xhr();

-- 
To view, visit https://gerrit.wikimedia.org/r/310595
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I086108421d229c60f5e9d5c9edb70150d875dcb0
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski 
Gerrit-Reviewer: Jack Phoenix 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: MarkTraceur 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Move towards a more consistent display

2016-09-20 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311740

Change subject: Move towards a more consistent display
..

Move towards a more consistent display

Each type now pretty much follows the same pattern and looks similar.

Change-Id: Ia6236a0e6b25509359c42d43dfdd629df6619a4b
---
M ApiFileAnnotations.php
M resources/src/FileAnnotator.less
2 files changed, 19 insertions(+), 7 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/40/311740/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index fe090a5..8686e20 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -317,9 +317,6 @@
}
 
$html = '';
-   if ( !is_null( $imageHtml ) ) {
-   $html .= $imageHtml;
-   }
if ( !is_null( $label ) || !is_null( 
$description ) ) {
$html .= '';
if ( !is_null( $label ) ) {
@@ -328,7 +325,13 @@
if ( !is_null( $description ) ) {
$html .= $description;
}
+   $html .= '';
}
+   if ( !is_null( $imageHtml ) ) {
+   $html .= $imageHtml;
+   }
+
+   $html .= '';
 
$setOpts['staleTTL'] = self::MAX_CACHE_TTL;
if ( self::maybePurge( $safeAsOf, $oldValue, 
$html, $cache, $cacheKey ) ) {
diff --git a/resources/src/FileAnnotator.less b/resources/src/FileAnnotator.less
index 1eefa36..60dd71f 100644
--- a/resources/src/FileAnnotator.less
+++ b/resources/src/FileAnnotator.less
@@ -23,8 +23,15 @@
z-index: 1;
 
.file-annotation {
+   padding: 5px;
+   width: 560px;
+
+   * {
+   margin-right: auto;
+   margin-left: auto;
+   }
+
.commons-category-annotation {
-   padding: 5px;
text-align: center;
 
.category-members {
@@ -46,8 +53,7 @@
}
 
.wikipedia-article-annotation {
-   width: 510px;
-   padding: 5px;
+   width: 550px;
 
> p {
width: 250px;
@@ -64,15 +70,18 @@
}
 
.wikidata-entity-annotation {
-   width: 200px;
+   width: 550px;
 
.text-content {
+   width: 250px;
padding: 5px;
+   display: inline-block;
}
 
.wikidata-image {
width: 200px;
text-align: center;
+   display: inline-block;
}
}
}

-- 
To view, visit https://gerrit.wikimedia.org/r/311740
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6236a0e6b25509359c42d43dfdd629df6619a4b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Do useful things for other image types

2016-09-20 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311737

Change subject: Do useful things for other image types
..

Do useful things for other image types

Wikidata items sometimes don't have P18 (image), but have P41 (flag image) or
some other representative image.

So, we now have a list of preferences, starting with P18, all the way down to
P15 (route map), and we also check all other properties pointing to a 
representative
image as determined by the following WDQS query:

select ?prop where{?prop wdt:P31 wd:Q26940804.}

This means that e.g. Q155 (Brazil), which has a flag image, looks nice.

Bug: T146118
Change-Id: I251c1aeaddbeb53d0937067cd9afe931d5b613e2
---
M ApiFileAnnotations.php
1 file changed, 66 insertions(+), 10 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/37/311737/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index fe090a5..35e8e2e 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -29,6 +29,8 @@
const MIN_CACHE_TTL = WANObjectCache::TTL_MINUTE;
const MAX_CACHE_TTL = WANObjectCache::TTL_DAY;
 
+   const LONG_CACHE_TTL = WANObjectCache::TTL_MONTH;
+
public function __construct( $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'fa' );
}
@@ -230,6 +232,51 @@
);
}
 
+   protected function getWikidataImageProps() {
+   $cache = ObjectCache::getMainWANInstance();
+   $cacheKey = $cache->makeKey( 'fileannotations', 
'wikidataimageprops' );
+
+   return $cache->getWithSetCallback(
+   $cacheKey,
+   self::LONG_CACHE_TTL,
+   function ( $oldValue, &$ttl, array &$setOpts, $oldAsOf )
+   use ( $cache ) {
+   $client = new MultiHttpClient( [] );
+
+   $response = $client->run( [
+   'method' => 'GET',
+   'url' => 
'https://query.wikidata.org/sparql',
+   'query' => [
+   'format' => 'json',
+   'query' => 'select ?prop 
where{?prop wdt:P31 wd:Q26940804.}',
+   ],
+   ] );
+
+   if ( $response['code'] == 200 ) {
+   $propsData = json_decode( 
$response['body'], true );
+   $props = 
$propsData['results']['bindings'];
+   $propArr = [];
+
+   foreach ( $props as $prop ) {
+   $uri = $prop['prop']['value'];
+   $propMatches = [];
+   $propMatch = preg_match(
+   '%P\d+%',
+   $uri,
+   $propMatches
+   );
+   $propArr[] = $propMatches[0];
+   }
+
+   return $propArr;
+   }
+
+   $ttl = $cache::TTL_UNCACHEABLE;
+   return [];
+   }
+   );
+   }
+
protected function renderWikidataAnnotation( $wdMatches ) {
$entityId = $wdMatches[2];
$currentLang = $this->getLanguage()->getCode();
@@ -273,17 +320,26 @@
 
$imageHtml = null;
 
-   foreach ( $claims as $claimid => $claim ) {
-   switch ( $claimid ) {
-   case 'P18':
-   // Main image. Fetch 
imageinfo and render.
-   $imageHtml = 
$this->renderWdImage(
-   
$claim[0]['mainsnak']['datavalue']['value']
-   );
-   break;
+   $imageProps = $this->getWikidataImageProps();
 
-   default:
-   continue;
+   $imagePropPreference = array_merge( [
+   'P18', // image
+   

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Pull a bunch of code into separate classes

2016-09-19 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311616

Change subject: Pull a bunch of code into separate classes
..

Pull a bunch of code into separate classes

This was necessary to make error messages make any kind of sense. Hopefully 
nobody
wanted to base code on the previous HEAD, because this basically breaks any
possibility for rebasing.

Change-Id: Iebd437708e5fcfc6c1bb125b2c5825af3f9e3556
---
M extension.json
A resources/src/FileAnnotation.js
A resources/src/FileAnnotationEditor.js
M resources/src/FileAnnotator.js
4 files changed, 509 insertions(+), 139 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/16/311616/1

diff --git a/extension.json b/extension.json
index 0e703bf..96cba07 100644
--- a/extension.json
+++ b/extension.json
@@ -56,6 +56,7 @@
"resources/src/FileAnnotator.less"
],
"dependencies": [
+   "ext.fileannotations.FileAnnotation",
"mediawiki.Title",
"jquery.ui.draggable",
"jquery.ui.resizable",
@@ -69,6 +70,29 @@
"fileannotations-delete",
"fileannotations-commons-see-more"
]
+   },
+   "ext.fileannotations.FileAnnotation": {
+   "scripts": [
+   "resources/src/FileAnnotation.js"
+   ],
+   "styles": [
+   ],
+   "dependencies": [
+   "ext.fileannotations.FileAnnotationEditor",
+   "oojs-ui"
+   ]
+   },
+   "ext.fileannotations.FileAnnotationEditor": {
+   "scripts": [
+   "resources/src/FileAnnotationEditor.js"
+   ],
+   "styles": [
+   ],
+   "dependencies": [
+   "jquery.ui.draggable",
+   "jquery.ui.resizable",
+   "oojs-ui"
+   ]
}
},
"ResourceFileModulePaths": {
diff --git a/resources/src/FileAnnotation.js b/resources/src/FileAnnotation.js
new file mode 100644
index 000..76efa96
--- /dev/null
+++ b/resources/src/FileAnnotation.js
@@ -0,0 +1,254 @@
+( function ( mw, $, OO ) {
+   /**
+* Single annotation's interface.
+*
+* @class mw.FileAnnotation
+* @mixins OO.EventEmitter
+* @constructor
+* @param {Object} config
+* @cfg {Object} annotation Information including x, y, width, height, 
index, etc.
+* @cfg {Object} file Information including title, sizes, etc.
+* @cfg {Object} display Information about the current display of the 
file - height, width.
+* @cfg {jQuery} $container If this is a new annotation, this is where 
the edit interface is put.
+* @cfg {boolean} editing Whether editing is enabled.
+*/
+   function FileAnnotation( config ) {
+   OO.EventEmitter.call( this );
+
+   this.api = config.api;
+
+   this.index = config.annotation.index;
+
+   this.x = config.annotation.x;
+   this.y = config.annotation.y;
+   this.width = config.annotation.width;
+   this.height = config.annotation.height;
+
+   this.text = config.annotation.text;
+   this.parsed = config.annotation.parsed;
+
+   this.fileTitle = config.file.title;
+   this.annotationsTitle = mw.Title.newFromText( 'File 
annotations:' + this.fileTitle.getMain() );
+   this.fileWidth = config.file.width;
+   this.fileHeight = config.file.height;
+
+   this.displayWidth = config.display.width;
+   this.displayHeight = config.display.height;
+
+   this.adjustRatioX = this.displayWidth / this.fileWidth;
+   this.adjustRatioY = this.displayHeight / this.fileHeight;
+
+   this.adjustedX = this.x * this.adjustRatioX;
+   this.adjustedY = this.y * this.adjustRatioY;
+   this.adjustedWidth = this.width * this.adjustRatioX;
+   this.adjustedHeight = this.height * this.adjustRatioY;
+
+   this.editing = config.editing;
+
+   if ( this.text && this.parsed ) {
+   this.$annotation = $( '' )
+   .addClass( 'file-annotation' )
+   .append( this.parsed );
+
+   this.$annotation.find( '.commons-category-ann

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Move bulk of code to single-class file

2016-09-19 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311445

Change subject: Move bulk of code to single-class file
..

Move bulk of code to single-class file

Bug: T145450
Change-Id: I816bd9fccf3250dfa23201a9a65b9117b476c7f0
---
M extension.json
A resources/src/FileAnnotator.js
R resources/src/FileAnnotator.less
M resources/src/fileannotations.js
4 files changed, 573 insertions(+), 563 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/45/311445/1

diff --git a/extension.json b/extension.json
index c194117..73622cd 100644
--- a/extension.json
+++ b/extension.json
@@ -43,8 +43,17 @@
"scripts": [
"resources/src/fileannotations.js"
],
+   "dependencies": [
+   "mediawiki.Title",
+   "ext.fileannotations.FileAnnotator"
+   ]
+   },
+   "ext.fileannotations.FileAnnotator": {
+   "scripts": [
+   "resources/src/FileAnnotator.js"
+   ],
"styles": [
-   "resources/src/fileannotations.less"
+   "resources/src/FileAnnotator.less"
],
"dependencies": [
"mediawiki.Title",
diff --git a/resources/src/FileAnnotator.js b/resources/src/FileAnnotator.js
new file mode 100644
index 000..f9c731c
--- /dev/null
+++ b/resources/src/FileAnnotator.js
@@ -0,0 +1,561 @@
+( function ( $, mw, OO ) {
+   /**
+* Class for rendering, editing, creating and deleting annotations on a 
file.
+*
+* @class mw.FileAnnotator
+* @constructor
+* @param {Object} config
+* @cfg {jQuery} $container The link that encloses the image.
+* @cfg {mw.Title} title Title of the file.
+* @cfg {boolean} [editing] Whether to enable editing annotations.
+*/
+   function FileAnnotator( config ) {
+   var $annotationInfo, createButton,
+   annotator = this;
+
+   this.api = new mw.Api();
+
+   this.$fileLink = config.$infoContainer;
+   this.fileTitle = config.title;
+   this.$img = this.$fileLink.find( 'img' );
+   this.editing = !!config.editing;
+
+   $annotationInfo = $( '' )
+   .addClass( 'fileannotation-info' );
+
+   this.$fileLink.after( $annotationInfo );
+
+   this.$container = $( '' )
+   .addClass( 'annotation-wrapper' );
+
+   this.$container.css( {
+   top: 0,
+   left: 0,
+   width: this.$img.width(),
+   height: this.$img.height()
+   } );
+
+   config.$container.css( {
+   position: 'relative'
+   } );
+
+   config.$container.append( this.$container );
+
+   this.annotationsTitle = mw.Title.newFromText( 'File 
Annotations:' + this.fileTitle.getMain() );
+
+   this.getAndRenderAnnotations().then( function () {
+   var $body = $( 'body' );
+
+   if ( $body.hasClass( 'mw-mobile-mode' ) ) {
+   annotator.whenInView( function () {
+   annotator.flashAnnotations();
+   } );
+   } else {
+   annotator.displayAnnotationsUntilHover();
+   }
+   } );
+
+   if ( this.editing ) {
+   this.getAnnotationsHTML().then( function ( data ) {
+   var page = data.query.pages[ 0 ],
+   imageInfo = page.imageinfo[ 0 ],
+   fullw = imageInfo.width,
+   fullh = imageInfo.height,
+   imgw = annotator.$img.width(),
+   imgh = annotator.$img.height(),
+   adjustRatioX = imgw / fullw,
+   adjustRatioY = imgh / fullh;
+
+   // Make it possible to create new annotations 
graphically.
+   createButton = new OO.ui.ButtonWidget( {
+   label: mw.message( 
'fileannotations-create' ).text(),
+   icon: 'add',
+   flags: [ 'constructive' ]
+   } );
+
+  

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Put the annotations in a container, not body

2016-09-15 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/310881

Change subject: Put the annotations in a container, not body
..

Put the annotations in a container, not body

Kind of wonky when the container is a thumbnail, but that's probably fine
for now.

Bug: T145453
Change-Id: Iefc514eb5d9ea70b28a738018a89a4c29fb24ec2
---
M resources/src/fileannotations.js
1 file changed, 21 insertions(+), 9 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/81/310881/1

diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index 1fb0ec4..7d00897 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -20,7 +20,7 @@
 
this.api = new mw.Api();
 
-   this.$fileLink = config.$container;
+   this.$fileLink = config.$infoContainer;
this.fileTitle = config.title;
this.$img = this.$fileLink.find( 'img' );
this.editing = !!config.editing;
@@ -33,16 +33,18 @@
this.$container = $( '' )
.addClass( 'annotation-wrapper' );
 
-   offset = this.$img.offset();
-
this.$container.css( {
-   top: offset.top,
-   left: offset.left,
+   top: 0,
+   left: 0,
width: this.$img.width(),
height: this.$img.height()
} );
 
-   $( 'body' ).append( this.$container );
+   config.$container.css( {
+   position: 'relative'
+   } );
+
+   config.$container.append( this.$container );
 
this.annotationsTitle = mw.Title.newFromText( 
'File_Annotations:' + this.fileTitle.getMain() );
 
@@ -538,7 +540,8 @@
// This is a file page, so just dump the main image into the
// annotator class, with editing and a notification below the 
image.
pageAnnotator = new FileAnnotator( {
-   $container: $fileLink,
+   $container: $( '#file' ),
+   $infoContainer: $fileLink,
title: pageTitle,
editing: true
} );
@@ -550,10 +553,19 @@
$div.find( 'a.image' ).each( function () {
var thumbAnnotator,
$link = $( this ),
-   $img = $link.find( 'img' );
+   $img = $link.find( 'img' ),
+   $container = $( '' )
+   .addClass( 
'fileannotations-standin-container' )
+   .css( {
+   display: 'inline-block'
+   } );
+
+   $link.after( $container );
+   $container.append( $link );
 
thumbAnnotator = new FileAnnotator( {
-   $container: $link,
+   $container: $container,
+   $infoContainer: $link,
title: mw.Title.newFromImg( $img ),
editing: false
} );

-- 
To view, visit https://gerrit.wikimedia.org/r/310881
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefc514eb5d9ea70b28a738018a89a4c29fb24ec2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Only put add annotations button after file link

2016-09-15 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/310853

Change subject: Only put add annotations button after file link
..

Only put add annotations button after file link

Other resolutions links weren't part of my first tests, so they hijacked
the info div and messed with their own max-width.

Bug: T144996
Change-Id: If6dee2908f8fa02f10aab36bbdc1c69049e834a2
---
M resources/src/fileannotations.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/53/310853/1

diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index 1fb0ec4..c2090a9 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -2,7 +2,7 @@
var pageAnnotator,
pageTitle = mw.Title.newFromText( mw.config.get( 'wgPageName' ) 
),
isFilePage = pageTitle.getNamespaceId() === 6,
-   $fileLink = $( '#file a' );
+   $fileLink = $( '#file > a' );
 
/**
 * Class for rendering, editing, creating and deleting annotations on a 
file.

-- 
To view, visit https://gerrit.wikimedia.org/r/310853
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If6dee2908f8fa02f10aab36bbdc1c69049e834a2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Use formatversion=2 for all API calls

2016-09-13 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/310355

Change subject: Use formatversion=2 for all API calls
..

Use formatversion=2 for all API calls

Bug: T145454
Change-Id: I45d0e54ad27273adad7abf6fb8a8cbb73d6997ad
---
M ApiFileAnnotations.php
M resources/src/fileannotations.js
2 files changed, 12 insertions(+), 9 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/55/310355/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index c21f397..d4397a1 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -109,6 +109,7 @@
'iiprop' => 'url',
'iiurlwidth' => 100,
'iiurlheight' => 100,
+   'formatversion' => 2,
'format' => 'json',
],
] );
@@ -125,7 +126,7 @@
$imagesHtml = '';
 
$href = null;
-   foreach ( $pages as $id => $page ) {
+   foreach ( $pages as $page ) {
$info = $page['imageinfo'][0];
$href = $info['descriptionurl'];
$src = $info['thumburl'];
@@ -186,6 +187,7 @@
'piprop' => 'thumbnail|name',
'pithumbsize' => 250,
'exsentences' => 4,
+   'formatversion' => 2,
'format' => 'json',
],
] );
@@ -251,6 +253,7 @@
'ids' => $entityId,
'languages' => 'en|' . 
$currentLang,
'props' => 
'labels|descriptions|claims',
+   'formatversion' => 2,
'format' => 'json',
],
] );
@@ -353,6 +356,7 @@
'iiprop' => 'url',
'iiurlwidth' => 200,
'iiurlheight' => 200,
+   'formatversion' => 2,
'format' => 'json',
]
] );
diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index 1fb0ec4..9e1f479 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -60,8 +60,7 @@
 
if ( this.editing ) {
this.getAnnotationsHTML().then( function ( data ) {
-   var pageId = data.query.pageids[ 0 ],
-   page = data.query.pages[ pageId ],
+   var page = data.query.pages[ 0 ],
imageInfo = page.imageinfo[ 0 ],
fullw = imageInfo.width,
fullh = imageInfo.height,
@@ -146,13 +145,13 @@
action: 'query',
prop: 'revisions',
rvprop: 'content',
-   indexpageids: true,
+   formatversion: 2,
+   format: 'json',
titles: this.annotationsTitle.getPrefixedDb()
} ).then( function ( data ) {
var rv, text, annotations,
pages = data.query.pages,
-   pageid = data.query.pageids[ 0 ],
-   page = pages[ pageid ],
+   page = pages[ 0 ],
revisions = page.revisions;
 
if ( revisions ) {
@@ -196,7 +195,8 @@
if ( this.annotationsCache === undefined ) {
this.annotationsCache = this.api.get( {
action: 'query',
-   indexpageids: true,
+   formatversion: 2,
+   format: 'json',
prop: [ 'fileannotations', 'imageinfo' ],
titles: this.fileTitle.getPrefixedDb(),
faparse: true,
@@ -482,8 +482,7 @@
return this.getAnnotationsHTML( this.fileTi

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Normalize i18n message keys

2016-09-13 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/310353

Change subject: Normalize i18n message keys
..

Normalize i18n message keys

Bug: T142069
Change-Id: I1dde11a9bd90d841eeab4f9db879ea0f35e92ec0
---
M extension.json
M i18n/en.json
M i18n/qqq.json
3 files changed, 18 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/53/310353/1

diff --git a/extension.json b/extension.json
index dbde3c7..2dcf1b7 100644
--- a/extension.json
+++ b/extension.json
@@ -57,12 +57,12 @@
],
 
"messages": [
-   "fileannotation-create",
-   "file-has-annotations",
-   "save-fileannotation",
-   "cancel-fileannotation",
-   "edit-fileannotation",
-   "delete-fileannotation"
+   "fileannotations-create",
+   "fileannotations-file-has-annotations",
+   "fileannotations-save",
+   "fileannotations-cancel",
+   "fileannotations-edit",
+   "fileannotations-delete"
]
}
},
diff --git a/i18n/en.json b/i18n/en.json
index 9b7a627..8fc49a7 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -3,13 +3,13 @@
"authors": []
},
"fileannotations-desc": "Displays and edits annotations on file pages.",
-   "file-has-annotations": "There are annotations on this file. Mouse over 
the image to view them.",
+   "fileannotations-file-has-annotations": "There are annotations on this 
file. Mouse over the image to view them.",
"fileannotations-tab": "Annotations",
-   "fileannotation-create": "Add file annotation",
-   "save-fileannotation": "Save",
-   "cancel-fileannotation": "Cancel",
-   "edit-fileannotation": "Edit",
-   "delete-fileannotation": "Delete",
+   "fileannotations-create": "Add file annotation",
+   "fileannotations-save": "Save",
+   "fileannotations-cancel": "Cancel",
+   "fileannotations-edit": "Edit",
+   "fileannotations-delete": "Delete",
 
"fileannotations-go-to-filepage": "It is recommended that you view and 
edit file annotations on [[:$1|the file page]], where they are available in a 
visual format.",
 
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 4dedd17..82bd8aa 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -3,12 +3,12 @@
"authors": []
},
"fileannotations-desc": "Description of the FileAnnotations extension.",
-   "file-has-annotations": "Note on file page indicating the file has 
annotations.",
+   "fileannotations-file-has-annotations": "Note on file page indicating 
the file has annotations.",
"fileannotations-tab": "Text for a tab that links to the file 
annotations page from the file page.",
-   "fileannotation-create": "Text of a button to create a new annotation 
on a file.",
-   "save-fileannotation": "Text of a button to save a new or edited 
annotation.",
-   "cancel-fileannotation": "Text of a button that cancels creating or 
editing an annotation.",
-   "edit-fileannotation": "Text of a button to begin editing an 
annotation.",
-   "delete-fileannotation": "Text of a button to delete an annotation.",
+   "fileannotations-create": "Text of a button to create a new annotation 
on a file.",
+   "fileannotations-save": "Text of a button to save a new or edited 
annotation.",
+   "fileannotations-cancel": "Text of a button that cancels creating or 
editing an annotation.",
+   "fileannotations-edit": "Text of a button to begin editing an 
annotation.",
+   "fileannotations-delete": "Text of a button to delete an annotation.",
"fileannotations-go-to-filepage": "Appears on the file annotations page 
to encourage users to go to the file page to interact with the content. $1 is 
the file page title, including namespace, suitable for inclusion in a wikilink. 
The message will be parsed. Remember to put a colon (:) in front of the file 
page title, or the message will put the whole image into the page."
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/310353
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1dde11a9bd90d841eeab4f9db879ea0f35e92ec0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] integration/config[master]: Add EL to FileAnnotations dependencies

2016-09-13 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/310339

Change subject: Add EL to FileAnnotations dependencies
..

Add EL to FileAnnotations dependencies

Change-Id: I9562ba719e5b73cb0552f547885b458df33e841c
---
M zuul/parameter_functions.py
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/integration/config 
refs/changes/39/310339/1

diff --git a/zuul/parameter_functions.py b/zuul/parameter_functions.py
index 56ac83a..c360056 100644
--- a/zuul/parameter_functions.py
+++ b/zuul/parameter_functions.py
@@ -97,6 +97,7 @@
 'Disambiguator': ['VisualEditor'],
 'DonationInterface': ['ContributionTracking'],
 'EducationProgram': ['cldr', 'WikiEditor'],
+'FileAnnotations': ['EventLogging'],
 'FlaggedRevs': ['Scribunto'],
 'GettingStarted': ['CentralAuth', 'EventLogging', 'GuidedTour'],
 'Graph': ['CodeEditor', 'JsonConfig', 'VisualEditor'],

-- 
To view, visit https://gerrit.wikimedia.org/r/310339
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9562ba719e5b73cb0552f547885b458df33e841c
Gerrit-PatchSet: 1
Gerrit-Project: integration/config
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Move "see more images" to i18n

2016-09-13 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/310337

Change subject: Move "see more images" to i18n
..

Move "see more images" to i18n

Bug: T145448
Change-Id: I7a544dfc424df0ef9b62982450cf2b9a69a0b8a1
---
M ApiFileAnnotations.php
M extension.json
M i18n/en.json
M i18n/qqq.json
M resources/src/fileannotations.js
5 files changed, 9 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/37/310337/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index 73dafbd..c21f397 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -138,9 +138,8 @@
 
$imagesHtml .= '';
 
-   // @FIXME: i18n!
$seeMoreHtml = $pages
-   ? '' . 'See 
more images' . ''
+   ? ''
: '';
 
$html =
diff --git a/extension.json b/extension.json
index dbde3c7..93aa6a6 100644
--- a/extension.json
+++ b/extension.json
@@ -62,7 +62,8 @@
"save-fileannotation",
"cancel-fileannotation",
"edit-fileannotation",
-   "delete-fileannotation"
+   "delete-fileannotation",
+   "fileannotations-commons-see-more"
]
}
},
diff --git a/i18n/en.json b/i18n/en.json
index 9b7a627..63b3194 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -11,6 +11,8 @@
"edit-fileannotation": "Edit",
"delete-fileannotation": "Delete",
 
+   "fileannotations-commons-see-more": "See more images",
+
"fileannotations-go-to-filepage": "It is recommended that you view and 
edit file annotations on [[:$1|the file page]], where they are available in a 
visual format.",
 
"apihelp-query+fileannotations-description": "Fetch wikitext and 
optionally HTML for annotations on a file on the wiki.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 4dedd17..af7289f 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -10,5 +10,6 @@
"cancel-fileannotation": "Text of a button that cancels creating or 
editing an annotation.",
"edit-fileannotation": "Text of a button to begin editing an 
annotation.",
"delete-fileannotation": "Text of a button to delete an annotation.",
+   "fileannotations-commons-see-more": "Shown on an annotation that is a 
Commons category, allows the user to go to the category page to see more 
images.",
"fileannotations-go-to-filepage": "Appears on the file annotations page 
to encourage users to go to the file page to interact with the content. $1 is 
the file page title, including namespace, suitable for inclusion in a wikilink. 
The message will be parsed. Remember to put a colon (:) in front of the file 
page title, or the message will put the whole image into the page."
 }
diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index 5597b16..1fb0ec4 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -386,6 +386,9 @@
$annotation
);
 
+   $( '.commons-category-annotation .commons-see-more' )
+   .msg( 'fileannotations-commons-see-more' );
+
if ( this.editing ) {
editButton = new OO.ui.ButtonWidget( {
label: mw.message( 'edit-fileannotation' 
).text(),

-- 
To view, visit https://gerrit.wikimedia.org/r/310337
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7a544dfc424df0ef9b62982450cf2b9a69a0b8a1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Use MultiHttpClient, not file_get_contents

2016-09-08 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/309362

Change subject: Use MultiHttpClient, not file_get_contents
..

Use MultiHttpClient, not file_get_contents

This is what happens when a JS programmer tries to work on PHP code

Change-Id: I7d401757641f0a4e580daa866d6d07fe2318d63a
---
M ApiFileAnnotations.php
1 file changed, 65 insertions(+), 45 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/62/309362/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index 8559b49..6ef578b 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -94,21 +94,26 @@
$key,
self::CACHE_TTL,
function ( $oldValue, &$ttl, array &$setOpts ) use ( 
$categoryName ) {
-   $imagesApiDataStr = file_get_contents(
-   
'https://commons.wikimedia.org/w/api.php' .
-   '?action=query' .
-   '&prop=imageinfo' .
-   '&generator=categorymembers' .
-   '&gcmtype=file' .
-   '&gcmtitle=' . urlencode( $categoryName 
) .
-   '&gcmlimit=5' .
-   '&iiprop=url' .
-   '&iiurlwidth=100' .
-   '&iiurlheight=100' .
-   '&format=json'
-   );
+   $client = new MultiHttpClient( [] );
 
-   $imagesApiData = json_decode( 
$imagesApiDataStr, true );
+   $response = $client->run( [
+   'method' => 'GET',
+   'url' => 
'https://commons.wikimedia.org/w/api.php',
+   'query' => [
+   'action' => 'query',
+   'prop' => 'imageinfo',
+   'generator' => 
'categorymembers',
+   'gcmtype' => 'file',
+   'gcmtitle' => $categoryName,
+   'gcmlimit' => 5,
+   'iiprop' => 'url',
+   'iiurlwidth' => 100,
+   'iiurlheight' => 100,
+   'format' => 'json',
+   ],
+   ] );
+
+   $imagesApiData = json_decode( 
$response['body'], true );
 
$pages = $imagesApiData['query']['pages'];
 
@@ -149,18 +154,23 @@
$key,
self::CACHE_TTL,
function ( $oldValue, &$ttl, array &$setOpts ) use ( 
$articleName, $language ) {
-   $articleApiDataStr = file_get_contents(
-   $language .
-   '/w/api.php?action=query' .
-   '&titles=' . urlencode( $articleName ) .
-   '&prop=pageimages|extracts' .
-   '&piprop=thumbnail|name' .
-   '&pithumbsize=250' .
-   '&exsentences=4' .
-   '&format=json'
-   );
+   $client = new MultiHttpClient( [] );
 
-   $articleApiData = json_decode( 
$articleApiDataStr, true );
+   $response = $client->run( [
+   'method' => 'GET',
+   'url' => $language . '/w/api.php',
+   'query' => [
+   'action' => 'query',
+   'titles' => $articleName,
+   'prop' => 'pageimages|extracts',
+   'piprop' => 'thumbnail|name',
+   'pithumbsize' => 250,
+   'exsentences' => 4,
+   'format' => 'json',
+   ],
+   ] );
+
+   $articleApiData = json_decode( 
$resp

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Cache, cache, everywhere a cache

2016-09-06 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/308775

Change subject: Cache, cache, everywhere a cache
..

Cache, cache, everywhere a cache

Cache API requests and rendering for WD, WP, and Commons annotations,
because fetching data from those sites is not super efficient.

Only caching for five minutes currently, to avoid making it totally
impossible to get updated data in a timely manner. Thoughts?

Change-Id: Ic319afc11e5befdab26542616cda85b52ff61512
---
M ApiFileAnnotations.php
1 file changed, 177 insertions(+), 129 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/75/308775/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index 5ac4e4f..2af9c53 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -25,6 +25,12 @@
  */
 
 class ApiFileAnnotations extends ApiQueryBase {
+   // 5 minutes - long enough to avoid crashing the servers with a lot
+   // of repeated requests for the same data, but not long enough so it's
+   // hard to update information quickly. Cache not invalidated by changes
+   // to Wikidata, Wikipedia, or Commons.
+   const CACHE_TTL = 300;
+
public function __construct( $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'fa' );
}
@@ -81,169 +87,211 @@
protected function renderCommonsAnnotation( $commonsMatches, 
$commonsCategoryMatch ) {
$categoryName = $commonsMatches[1];
 
-   $imagesApiDataStr = file_get_contents(
-   'https://commons.wikimedia.org/w/api.php' .
-   '?action=query' .
-   '&prop=imageinfo' .
-   '&generator=categorymembers' .
-   '&gcmtype=file' .
-   '&gcmtitle=' . urlencode( $categoryName ) .
-   '&gcmlimit=5' .
-   '&iiprop=url' .
-   '&iiurlwidth=100' .
-   '&iiurlheight=100' .
-   '&format=json'
-   );
+   $key = wfMemcKey( 'fileannotations', 'commonscategory', 
$categoryName );
+   $cache = wfGetCache( CACHE_ANYTHING );
+   $parsed = $cache->get( $key );
 
-   $imagesApiData = json_decode( $imagesApiDataStr, true );
+   if ( $parsed === false ) {
+   $imagesApiDataStr = file_get_contents(
+   'https://commons.wikimedia.org/w/api.php' .
+   '?action=query' .
+   '&prop=imageinfo' .
+   '&generator=categorymembers' .
+   '&gcmtype=file' .
+   '&gcmtitle=' . urlencode( $categoryName ) .
+   '&gcmlimit=5' .
+   '&iiprop=url' .
+   '&iiurlwidth=100' .
+   '&iiurlheight=100' .
+   '&format=json'
+   );
 
-   $pages = $imagesApiData['query']['pages'];
+   $imagesApiData = json_decode( $imagesApiDataStr, true );
 
-   $imagesHtml = '';
+   $pages = $imagesApiData['query']['pages'];
 
-   foreach ( $pages as $id => $page ) {
-   $info = $page['imageinfo'][0];
-   $href = $info['descriptionurl'];
-   $src = $info['thumburl'];
+   $imagesHtml = '';
 
-   $imagesHtml .=
-   '' .
-   '' .
-   '';
+   foreach ( $pages as $id => $page ) {
+   $info = $page['imageinfo'][0];
+   $href = $info['descriptionurl'];
+   $src = $info['thumburl'];
+
+   $imagesHtml .=
+   '' .
+   '' .
+   '';
+   }
+
+   $imagesHtml .= '';
+
+   $parsed =
+   '' .
+   $imagesHtml .
+   '' .
+   'See more images' .
+   '' .
+   '';
+
+   $cache->set(
+   $key,
+   $parsed,
+   self::CACHE_TTL
+   );
}
 
-   $imagesHtml .= '';
-
-   return
-

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Quick code style improvements

2016-09-01 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/308076

Change subject: Quick code style improvements
..

Quick code style improvements

I sorta threw everything into one function, this is a little nicer
to read and work with.

Change-Id: If682d809ceaffa5b638a8d7e4f3714b78fd07347
---
M ApiFileAnnotations.php
1 file changed, 297 insertions(+), 220 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/76/308076/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index 8fb4e35..5ac4e4f 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -47,9 +47,6 @@
$title
);
 
-   $parser = new Parser();
-   $popts = ParserOptions::newFromUser( 
$this->getUser() );
-
$page = WikiPage::factory( $faTitle );
$content = $page->getContent();
if ( !empty( $content ) ) {
@@ -59,227 +56,20 @@
$annotations = $data->annotations;
}
 
+   $parser = new Parser();
+   $popts = ParserOptions::newFromUser( 
$this->getUser() );
+
$annotationsData = [];
 
if ( !empty( $annotations ) ) {
foreach ( $annotations as $annotation ) 
{
-   $text = $annotation->content;
-   $annotationData = [
-   'text' => $text
-   ];
-
-   foreach ( $annotation as $key 
=> $val ) {
-   if ( $key === 'content' 
) {
-   continue;
-   }
-
-   $annotationData[$key] = 
$val;
-   }
-
-   if ( $shouldParse ) {
-   $presult = 
$parser->parse( $text, $faTitle, $popts );
-   
$annotationData['parsed'] = $presult->mText;
-
-   // Check to see if we 
can return a special display for this annotation.
-   $dom = new 
DOMDocument();
-   $domFragment = 
$dom->createDocumentFragment();
-   
$domFragment->appendXml( $presult->mText );
-
-   // The first element 
will always be a paragraph. Get its first child.
-   $possibleLink = 
$domFragment->firstChild->firstChild;
-
-   // Check if it's a link 
element.
-   if ( 
$possibleLink->nodeType === XML_ELEMENT_NODE && $possibleLink->nodeName === 'a' 
) {
-   // Find out if 
the link is something we care about.
-   $href = 
$possibleLink->attributes->getNamedItem( 'href' )->value;
-
-   $commonsMatches 
= [];
-   
$commonsCategoryMatch = preg_match(
-   
'%^https?://commons.wikimedia.org.*(Category:.*)%',
-   $href,
-   
$commonsMatches
-   );
-
-   $wpMatches = [];
-   $wpArticleMatch 
= preg_match(
-   
'%^(https?://.*.wikipedia.org)/wiki/(.*)%',
-   $href,
-   
$wpMatches
-   );
-
-   $wdMatches = [];
-

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Style better than a toddler with crayons

2016-08-31 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/307802

Change subject: Style better than a toddler with crayons
..

Style better than a toddler with crayons

I excused my lack of styling by saying I would do it later, well,
this should bring us closer to the mockups for the most part.

Change-Id: I8120cfb8ee505526ea84effd5bfa10807c1098c2
---
M ApiFileAnnotations.php
M resources/src/fileannotations.less
2 files changed, 66 insertions(+), 38 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/02/307802/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index 6fd5e54..8fb4e35 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -174,7 +174,7 @@

$annotationData['parsed'] =

'' .

$page['extract'] .
-   
'' .
+   
'' .

'';
+
+   foreach 
( $claims as $claimid => $claim ) {
+   
switch ( $claimid ) {
+   
case 'P18':
+   
// Main image. Fetch imageinfo and render.
+   
$imageApiDataStr = file_get_contents(
+   
'https://commons.wikimedia.org/w/api.php' .
+   
'?action=query&prop=imageinfo' .
+   
'&titles=File:' . urlencode( 
$claim[0]['mainsnak']['datavalue']['value'] ) .
+   
'&iiprop=url&iiurlwidth=200' .
+   
'&iiurlheight=200&format=json'
+   
);
+
+   
$imageApiData = json_decode( $imageApiDataStr, true );
+
+   
$pages = $imageApiData['query']['pages'];
+
+   
$annotationData['parsed'] .= '';
+
+   
foreach ( $pages as $id => $page ) {
+   
// There's only one page. Add HTML here.
+   
$info = $page['imageinfo'][0];
+   
$annotationData['parsed'] .=
+   
'' .
+   
'' .
+   
'';
+   
break;
+   
}
+
+   
$annotationData['parsed'] .= '';
+
+   
default:
+   
continue;
+   
}
+   }
+
+   

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Fetch data from Wikidata (and Commons)

2016-08-30 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/307566

Change subject: Fetch data from Wikidata (and Commons)
..

Fetch data from Wikidata (and Commons)

This is just a framework, style commits are coming next.

Change-Id: I5c99ec7145a202e0d4feb961e9378266ca046ce4
---
M ApiFileAnnotations.php
1 file changed, 93 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/66/307566/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index 99ffe10..1cd92da 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -107,6 +107,13 @@

$wpMatches
);
 
+   $wdMatches = [];
+   $wdEntityMatch 
= preg_match(
+   
'%https?://(www\.)?wikidata.org/.*(Q\d+)%',
+   $href,
+   
$wdMatches
+   );
+
if ( 
$commonsCategoryMatch === 1 ) {

$categoryName = $commonsMatches[1];
 
@@ -179,6 +186,92 @@

'';
}
}
+
+   if ( 
$wdEntityMatch === 1 ) {
+   
$entityId = $wdMatches[2];
+   
$currentLang = $this->getLanguage()->getCode();
+
+   
$entityApiDataStr = file_get_contents(
+   
'https://www.wikidata.org/w/api.php' .
+   
'?action=wbgetentities' .
+   
'&ids=' . $entityId .
+   
'&languages=en|' . $currentLang .
+   
'&props=labels|descriptions|claims' .
+   
'&format=json'
+   );
+
+   
$entityApiData = json_decode( $entityApiDataStr, true );
+
+   $entity 
= $entityApiData['entities'][$entityId];
+
+   $labels 
= $entity['labels'];
+   
$descriptions = $entity['descriptions'];
+   $claims 
= $entity['claims'];
+
+   
$annotationData['parsed'] = '';
+   if ( 
isset( $labels[$currentLang] ) ) {
+   
$annotationData['parsed'] .=
+   
'' .
+   
$labels[$currentLang]['value'] .
+   
'';
+   } 
elseif ( isset( $labels['en'] ) ) {
+   
// Blatantly strange fallback, but we don't want to have
+   
// no label...hopefully this works for 99% of things.
+   
$annotationData['parsed'] .=
+   
'' .
+   
$labels['en']['value'] .
+ 

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Add rendering for Wikipedia articles

2016-08-19 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/305740

Change subject: Add rendering for Wikipedia articles
..

Add rendering for Wikipedia articles

Needs some style love that can come later.

Change-Id: Id7f66b412becd98567e45b3576804771f5a7a3a0
---
M ApiFileAnnotations.php
M resources/src/fileannotations.less
2 files changed, 52 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/40/305740/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index ffbe666..99ffe10 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -100,6 +100,13 @@

$commonsMatches
);
 
+   $wpMatches = [];
+   $wpArticleMatch 
= preg_match(
+   
'%^(https?://.*.wikipedia.org)/wiki/(.*)%',
+   $href,
+   
$wpMatches
+   );
+
if ( 
$commonsCategoryMatch === 1 ) {

$categoryName = $commonsMatches[1];
 
@@ -136,6 +143,42 @@

'' .

'';
}
+   
+   if ( 
$wpArticleMatch === 1 ) {
+   
$articleName = $wpMatches[2];
+
+   
$articleApiDataStr = file_get_contents(
+   
$wpMatches[1] .
+   
'/w/api.php?action=query' .
+   
'&titles=' . urlencode( $articleName ) .
+   
'&prop=pageimages|extracts' .
+   
'&piprop=thumbnail|name' .
+   
'&pithumbsize=250' .
+   
'&exsentences=4' .
+   
'&format=json'
+   );
+
+   
$articleApiData = json_decode( $articleApiDataStr, true );
+
+   $pages 
= $articleApiData['query']['pages'];
+
+   foreach 
( $pages as $id => $page ) {
+   
// There's only one page, so just do it here
+   
$annotationData['parsed'] =
+   
'' .
+   
$page['extract'] .
+   
'' .
+   
'' .
+   
'' .
+   
'';
+   }
+   }
}
}
$annotationsData[] = 
$annotationData;
diff --git a/resources/src/fileannotations.less 
b/resources/src/fileannotations.less
index fce61cd..ebba43a 100644
--- a/resources/src/fileannotations.less
+++ b/resources/src/fileannotations.less
@@ -33,6 +33,15 @@

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Add special rendering for Commons categories

2016-08-19 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/305690

Change subject: Add special rendering for Commons categories
..

Add special rendering for Commons categories

Still not the prettiest things in the world, but they work!

Change-Id: If9e32838482e6672afe14b46e48f8d7ca749222a
---
M ApiFileAnnotations.php
M resources/src/fileannotations.less
2 files changed, 65 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/90/305690/1

diff --git a/ApiFileAnnotations.php b/ApiFileAnnotations.php
index 0c1eaa6..a9c99c7 100644
--- a/ApiFileAnnotations.php
+++ b/ApiFileAnnotations.php
@@ -79,6 +79,52 @@
if ( $shouldParse ) {
$presult = 
$parser->parse( $text, $faTitle, $popts );

$annotationData['parsed'] = $presult->mText;
+
+   // Check to see if we 
can return a special display for this annotation.
+   $dom = new 
DOMDocument();
+   $domFragment = 
$dom->createDocumentFragment();
+   
$domFragment->appendXml( $presult->mText );
+
+   // The first element 
will always be a paragraph. Get its first child.
+   $possibleLink = 
$domFragment->firstChild->firstChild;
+
+   // Check if it's a link 
element.
+   if ( 
$possibleLink->nodeType === XML_ELEMENT_NODE && $possibleLink->nodeName === 'a' 
) {
+   // Find out if 
the link is something we care about.
+   $href = 
$possibleLink->attributes->getNamedItem( 'href' )->value;
+
+   $commonsMatches 
= array();
+   
$commonsCategoryMatch = preg_match( 
'%^https?://commons.wikimedia.org.*(Category:.*)%', $href, $commonsMatches );
+
+   if ( 
$commonsCategoryMatch === 1 ) {
+   
$categoryName = $commonsMatches[1];
+
+   
$imagesApiDataStr = file_get_contents( 
'https://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&generator=categorymembers&gcmtype=file&gcmtitle='
 . urlencode( $categoryName ) . 
'&gcmlimit=5&iiprop=url&iiurlwidth=100&format=json' );
+   
$imagesApiData = json_decode( $imagesApiDataStr, true );
+
+   $pages 
= $imagesApiData['query']['pages'];
+
+   
$imagesHtml = '';
+
+   foreach 
( $pages as $id => $page ) {
+   
$info = $page['imageinfo'][0];
+   
$imagesHtml .=
+   
'' .
+   
'' .
+   
'';
+   }
+
+   
$imagesHtml .= '';
+
+   
$annotationData['parsed'] =
+   
'' .
+   
$imagesHtml .
+   
'' .
+   
'See more images' .
+   
'' .
+   
'';
+   }
+   }
}
   

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Discoverability improvements

2016-08-18 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/305539

Change subject: Discoverability improvements
..

Discoverability improvements

Flash the annotations on mobile (currently useless, because MF won't load
this extension...)

Show the annotations until hovered over on desktop.

Change-Id: I81f944e1e9cbb1f0b15ce69d7680cf6e60078892
---
M resources/src/fileannotations.js
M resources/src/fileannotations.less
2 files changed, 73 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/39/305539/1

diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index 8266b91..b691c23 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -1,4 +1,4 @@
-( function ( $, mw ) {
+( function ( $, mw, OO ) {
var pageAnnotator,
pageTitle = mw.Title.newFromText( mw.config.get( 'wgPageName' ) 
),
isFilePage = pageTitle.getNamespaceId() === 6,
@@ -13,7 +13,6 @@
 * @cfg {jQuery} $container The link that encloses the image.
 * @cfg {mw.Title} title Title of the file.
 * @cfg {boolean} [editing] Whether to enable editing annotations.
-* @cfg {boolean} [alert] Whether to alert the user that there are 
annotations.
 */
function FileAnnotator( config ) {
var offset, $annotationInfo, createButton,
@@ -25,17 +24,11 @@
this.fileTitle = config.title;
this.$img = this.$fileLink.find( 'img' );
this.editing = !!config.editing;
-   this.alert = !!config.alert;
 
-   if ( this.alert ) {
-   $annotationInfo = $( '' )
-   .addClass( 'fileannotation-info' )
-   .append(
-   $( '' ).text( mw.message( 
'file-has-annotations' ).text() )
-   );
+   $annotationInfo = $( '' )
+   .addClass( 'fileannotation-info' );
 
-   this.$fileLink.after( $annotationInfo );
-   }
+   this.$fileLink.after( $annotationInfo );
 
this.$container = $( '' )
.addClass( 'annotation-wrapper' );
@@ -53,7 +46,17 @@
 
this.annotationsTitle = mw.Title.newFromText( 
'File_Annotations:' + this.fileTitle.getMain() );
 
-   this.getAndRenderAnnotations();
+   this.getAndRenderAnnotations().then( function () {
+   var $body = $( 'body' );
+
+   if ( $body.hasClass( 'mw-mobile-mode' ) ) {
+   annotator.whenInView( function () {
+   annotator.flashAnnotations();
+   } );
+   } else {
+   annotator.displayAnnotationsUntilHover();
+   }
+   } );
 
if ( this.editing ) {
this.getAnnotationsHTML().then( function ( data ) {
@@ -464,11 +467,13 @@
 
/**
 * Get the annotations, and render them on the image.
+*
+* @return {jQuery.Promise}
 */
FileAnnotator.prototype.getAndRenderAnnotations = function () {
var annotator = this;
 
-   this.getAnnotationsHTML( this.fileTitle )
+   return this.getAnnotationsHTML( this.fileTitle )
.then( function ( data ) {
var i,
pageId = data.query.pageids[ 0 ],
@@ -490,7 +495,31 @@
annotator.renderAnnotation( i, 
annotations[ i ], imageInfo, adjustRatioX, adjustRatioY )
);
}
+
+   return $.Deferred().resolve();
} );
+   };
+
+   FileAnnotator.prototype.displayAnnotationsUntilHover = function () {
+   var $container = this.$container;
+
+   $container.addClass( 'force-show-annotations' );
+
+   $container.one( 'mouseenter', function () {
+   // Once the user hovers over the image once, let the 
annotations disappear
+   $container.removeClass( 'force-show-annotations' );
+   } );
+   };
+
+   FileAnnotator.prototype.flashAnnotations = function () {
+   var $container = this.$container;
+   
+   $container.addClass( 'force-show-annotations' );
+
+   setTimeout( function () {
+   // Let the annotations disappear after five seconds.
+   $container.removeClass( 'force-show-annotations' );
+

[MediaWiki-commits] [Gerrit] mediawiki...UploadWizard[master]: Give up, put copy metadata widgets on every upload

2016-08-05 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/303180

Change subject: Give up, put copy metadata widgets on every upload
..

Give up, put copy metadata widgets on every upload

This is a bit of a cop-out, but it will let us do more interesting things
with the upload array because it decouples the upload order.

Bug: T90741
Change-Id: Iedc32f1b411fc983d738f1362285654b395cc7d6
---
M i18n/en.json
M i18n/qqq.json
M resources/controller/uw.controller.Details.js
3 files changed, 21 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/80/303180/1

diff --git a/i18n/en.json b/i18n/en.json
index 65a390b..e21bd61 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -123,7 +123,7 @@
"mwe-upwiz-source-thirdparty-accept": "OK",
"mwe-upwiz-source-custom": "Provide copyright information for each file 
individually on the next page.",
"mwe-upwiz-more-options": "Add location and more information 
",
-   "mwe-upwiz-copy-metadata": "Copy information to all uploads following 

",
+   "mwe-upwiz-copy-metadata": "Copy information to all other uploads 
",
"mwe-upwiz-copy-metadata-button": "Copy",
"mwe-upwiz-copy-metadata-button-undo": "Undo",
"mwe-upwiz-copied-metadata": "Copied!",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index d6ea2a9..6a4896c 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -147,7 +147,7 @@
"mwe-upwiz-source-thirdparty-accept": "{{Identical|OK}}",
"mwe-upwiz-source-custom": "Prompts the user for the copyright 
information for each file.",
"mwe-upwiz-more-options": "Text for a 'more options' toggle that opens 
more of a form so a user can make more detailed descriptions/add more 
properties for uploaded images.",
-   "mwe-upwiz-copy-metadata": "Toggler which expands/collapses a selection 
of checkboxes vertically which allow the user to selectively copy metadata from 
the first upload to other uploads.",
+   "mwe-upwiz-copy-metadata": "Toggler which expands/collapses a selection 
of checkboxes vertically which allow the user to selectively copy metadata from 
any upload to all other uploads.",
"mwe-upwiz-copy-metadata-button": "Label of the button which copies the 
selected metadata from the first upload to all other 
uploads.\n{{Identical|Copy}}",
"mwe-upwiz-copy-metadata-button-undo": "Label of the button which 
undoes the metadata copying operation, restoring previous 
values.\n{{Identical|Undo}}",
"mwe-upwiz-copied-metadata": "Message shown after successfully 
completing the metadata copying operation.\n{{Identical|Copy}}",
diff --git a/resources/controller/uw.controller.Details.js 
b/resources/controller/uw.controller.Details.js
index 3f962d6..7efbe56 100644
--- a/resources/controller/uw.controller.Details.js
+++ b/resources/controller/uw.controller.Details.js
@@ -43,6 +43,8 @@
count: this.config.maxSimultaneousConnections,
action: this.transitionOne.bind( this )
} );
+
+   this.copyMetadataWidgets = [];
};
 
OO.inheritClass( uw.controller.Details, uw.controller.Step );
@@ -53,7 +55,7 @@
 * @param {mw.UploadWizardUpload[]} uploads List of uploads being 
carried forward.
 */
uw.controller.Details.prototype.moveTo = function ( uploads ) {
-   var successes = 0;
+   var i, cmwidget, successes = 0;
 
$.each( uploads, function ( i, upload ) {
if ( upload && upload.state !== 'aborted' && 
upload.state !== 'error' ) {
@@ -80,12 +82,17 @@
 
// Show the widget allowing to copy selected metadata if 
there's more than one successful upload
if ( successes > 1 && this.config.copyMetadataFeature ) {
-   this.copyMetadataWidget = new uw.CopyMetadataWidget( {
-   copyFrom: uploads[ 0 ],
-   // Include the "source" upload in the targets 
too
-   copyTo: uploads
-   } );
-   $( uploads[ 0 ].details.div ).after( 
this.copyMetadataWidget.$element );
+   for ( i = 0; i < uploads.length; i++ ) {
+   cmwidget = new uw.CopyMetadataWidget( {
+   copyFrom: uploads[ i ],
+   // Include the "source" upload in the 
targets too
+   copyTo: uploads
+   } );
+
+   this.copyMetadataWidgets.push( cmwidget );
+
+   $( uploads[ i ].details.div ).after( 
cmwidget.$element );
+   }
}
 
uw.controller.Step.prototype.moveTo.call

[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Fix image links

2016-07-26 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/301134

Change subject: Fix image links
..

Fix image links

Now, images will be covered by a link, and the annotations will block
the link, but the container won't.

Basically, now clickthrough is supported again.

Bug: T140503
Change-Id: I552496887f627a94f1faf3c8cc593398bf07e8df
---
M resources/src/fileannotations.js
M resources/src/fileannotations.less
2 files changed, 15 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/34/301134/1

diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index 68b1857..91b9a10 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -1,7 +1,7 @@
 ( function ( $, mw ) {
var pageTitle = mw.Title.newFromText( mw.config.get( 'wgPageName' ) ),
isFilePage = pageTitle.getNamespaceId() === 6,
-   $fileLink = $( '#file' );
+   $fileLink = $( '#file a' );
 
/**
 * Class for rendering, editing, creating and deleting annotations on a 
file.
@@ -483,6 +483,12 @@
// Clear any existing annotations so we start 
fresh.
annotator.$container.empty();
 
+   annotator.$container.append(
+   $( '' )
+   .addClass( 'file-link-backup' )
+   .attr( 'href', 
annotator.$fileLink.attr( 'href' ) )
+   );
+
for ( i = 0; i < annotations.length; i++ ) {
annotator.$container.append(
annotator.renderAnnotation( i, 
annotations[ i ], imageInfo, adjustRatioX, adjustRatioY )
diff --git a/resources/src/fileannotations.less 
b/resources/src/fileannotations.less
index dba0884..87fab43 100644
--- a/resources/src/fileannotations.less
+++ b/resources/src/fileannotations.less
@@ -1,6 +1,14 @@
 .annotation-wrapper {
position: absolute;
 
+   a.file-link-backup {
+   position: absolute;
+   top: 0;
+   left: 0;
+   right: 0;
+   bottom: 0;
+   }
+
.annotation-box {
display: none;
position: absolute;

-- 
To view, visit https://gerrit.wikimedia.org/r/301134
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I552496887f627a94f1faf3c8cc593398bf07e8df
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...FileAnnotations[master]: Enable annotations when images in classed div

2016-07-25 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/300917

Change subject: Enable annotations when images in classed div
..

Enable annotations when images in classed div

Now you can surround your image with  to
turn on file annotations on a content page. Those interfaces have editing and
creation turned off, but we can turn them back on later with a little extra
work.

Change-Id: I43be44add1b65e0130e53cd9ab8ea305aa9408f6
---
M FileAnnotations.hooks.php
M resources/src/fileannotations.js
2 files changed, 177 insertions(+), 139 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/17/300917/1

diff --git a/FileAnnotations.hooks.php b/FileAnnotations.hooks.php
index 848fbcb..1717f72 100644
--- a/FileAnnotations.hooks.php
+++ b/FileAnnotations.hooks.php
@@ -31,9 +31,8 @@
}
 
public static function getModulesForFilePage( &$out, &$skin ) {
-   if ( $out->getTitle()->inNamespace( NS_FILE ) ) {
-   $out->addModules( [ 'fileannotations' ] );
-   }
+   // Dump it on every page.
+   $out->addModules( [ 'fileannotations' ] );
}
 
public static function addFileAnnotationsTab( SkinTemplate 
&$sktemplate, array &$links ) {
diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index 2c3cfd4..68b1857 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -8,26 +8,33 @@
 *
 * @class mw.FileAnnotator
 * @constructor
-* @param {jQuery} $fileLink Look for '#file' on the file page.
-* @param {mw.Title} fileTitle Title of the file.
+* @param {Object} config
+* @cfg {jQuery} $container The link that encloses the image.
+* @cfg {mw.Title} title Title of the file.
+* @cfg {boolean} [editing] Whether to enable editing annotations.
+* @cfg {boolean} [alert] Whether to alert the user that there are 
annotations.
 */
-   function FileAnnotator( $fileLink, fileTitle ) {
+   function FileAnnotator( config ) {
var offset, $annotationInfo, createButton,
annotator = this;
 
this.api = new mw.Api();
 
-   this.$fileLink = $fileLink;
-   this.fileTitle = fileTitle;
-   this.$img = $fileLink.find( 'img' );
+   this.$fileLink = config.$container;
+   this.fileTitle = config.title;
+   this.$img = this.$fileLink.find( 'img' );
+   this.editing = !!config.editing;
+   this.alert = !!config.alert;
 
-   $annotationInfo = $( '' )
-   .addClass( 'fileannotation-info' )
-   .append(
-   $( '' ).text( mw.message( 
'file-has-annotations' ).text() )
-   );
+   if ( this.alert ) {
+   $annotationInfo = $( '' )
+   .addClass( 'fileannotation-info' )
+   .append(
+   $( '' ).text( mw.message( 
'file-has-annotations' ).text() )
+   );
 
-   $fileLink.after( $annotationInfo );
+   this.$fileLink.after( $annotationInfo );
+   }
 
this.$container = $( '' )
.addClass( 'annotation-wrapper' );
@@ -43,81 +50,83 @@
 
$( 'body' ).append( this.$container );
 
-   this.annotationsTitle = mw.Title.newFromText( 
'File_Annotations:' + fileTitle.getMain() );
+   this.annotationsTitle = mw.Title.newFromText( 
'File_Annotations:' + this.fileTitle.getMain() );
 
this.getAndRenderAnnotations();
 
-   this.getAnnotationsHTML().then( function ( data ) {
-   var pageId = data.query.pageids[ 0 ],
-   page = data.query.pages[ pageId ],
-   imageInfo = page.imageinfo[ 0 ],
-   fullw = imageInfo.width,
-   fullh = imageInfo.height,
-   imgw = annotator.$img.width(),
-   imgh = annotator.$img.height(),
-   adjustRatioX = imgw / fullw,
-   adjustRatioY = imgh / fullh;
+   if ( this.editing ) {
+   this.getAnnotationsHTML().then( function ( data ) {
+   var pageId = data.query.pageids[ 0 ],
+   page = data.query.pages[ pageId ],
+   imageInfo = page.imageinfo[ 0 ],
+   fullw = imageInfo.width,
+  

[MediaWiki-commits] [Gerrit] Refactor into a class, make editing easier - change (mediawiki...FileAnnotations)

2016-07-21 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/300296

Change subject: Refactor into a class, make editing easier
..

Refactor into a class, make editing easier

This was largely so we didn't have two separate code paths for editing
annotations (creation/editing existing), and now it's finally set. This
should make extending this code much easier.

Change-Id: If1386afb2a14882b9e8fd15e328fcaff953b3421
---
M resources/src/fileannotations.js
M resources/src/fileannotations.less
2 files changed, 268 insertions(+), 203 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/96/300296/1

diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index c6d9c66..2c3cfd4 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -1,19 +1,137 @@
 ( function ( $, mw ) {
-   var createButton, $annotationsContainer, $mainImage,
-   annotationsCache, offset, $annotationInfo,
-   api = new mw.Api(),
-   pageTitle = mw.Title.newFromText( mw.config.get( 'wgPageName' ) 
),
-   annotationsTitle = mw.Title.newFromText( 'File_Annotations:' + 
pageTitle.getMain() ),
+   var pageTitle = mw.Title.newFromText( mw.config.get( 'wgPageName' ) ),
isFilePage = pageTitle.getNamespaceId() === 6,
$fileLink = $( '#file' );
 
-   function getAnnotationsJSON( pageTitle ) {
-   return api.get( {
+   /**
+* Class for rendering, editing, creating and deleting annotations on a 
file.
+*
+* @class mw.FileAnnotator
+* @constructor
+* @param {jQuery} $fileLink Look for '#file' on the file page.
+* @param {mw.Title} fileTitle Title of the file.
+*/
+   function FileAnnotator( $fileLink, fileTitle ) {
+   var offset, $annotationInfo, createButton,
+   annotator = this;
+
+   this.api = new mw.Api();
+
+   this.$fileLink = $fileLink;
+   this.fileTitle = fileTitle;
+   this.$img = $fileLink.find( 'img' );
+
+   $annotationInfo = $( '' )
+   .addClass( 'fileannotation-info' )
+   .append(
+   $( '' ).text( mw.message( 
'file-has-annotations' ).text() )
+   );
+
+   $fileLink.after( $annotationInfo );
+
+   this.$container = $( '' )
+   .addClass( 'annotation-wrapper' );
+
+   offset = this.$img.offset();
+
+   this.$container.css( {
+   top: offset.top,
+   left: offset.left,
+   width: this.$img.width(),
+   height: this.$img.height()
+   } );
+
+   $( 'body' ).append( this.$container );
+
+   this.annotationsTitle = mw.Title.newFromText( 
'File_Annotations:' + fileTitle.getMain() );
+
+   this.getAndRenderAnnotations();
+
+   this.getAnnotationsHTML().then( function ( data ) {
+   var pageId = data.query.pageids[ 0 ],
+   page = data.query.pages[ pageId ],
+   imageInfo = page.imageinfo[ 0 ],
+   fullw = imageInfo.width,
+   fullh = imageInfo.height,
+   imgw = annotator.$img.width(),
+   imgh = annotator.$img.height(),
+   adjustRatioX = imgw / fullw,
+   adjustRatioY = imgh / fullh;
+
+   // Make it possible to create new annotations 
graphically.
+   createButton = new OO.ui.ButtonWidget( {
+   label: mw.message( 'fileannotation-create' 
).text(),
+   icon: 'add',
+   flags: [ 'constructive' ]
+   } );
+
+   createButton.on( 'click', function () {
+   if ( annotator.$container.hasClass( 
'click-to-create' ) ) {
+   // Don't turn it on twice!
+   return;
+   }
+
+   // Turn on click-to-initiate...
+   annotator.$container
+   .addClass( 'click-to-create' );
+
+   annotator.$container
+   .one( 'click', function ( e ) {
+   // Add outline and edit 
interface
+   var x = e.offsetX,
+   

[MediaWiki-commits] [Gerrit] Add a link to the annotations page from file page - change (mediawiki...FileAnnotations)

2016-07-15 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/299204

Change subject: Add a link to the annotations page from file page
..

Add a link to the annotations page from file page

Bug: 140502
Change-Id: Ia042ef423e3352b549954ca057a1a4fa9f0f59fc
---
M FileAnnotations.hooks.php
M extension.json
M i18n/en.json
M i18n/qqq.json
4 files changed, 26 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/04/299204/1

diff --git a/FileAnnotations.hooks.php b/FileAnnotations.hooks.php
index fd6da57..44f401d 100644
--- a/FileAnnotations.hooks.php
+++ b/FileAnnotations.hooks.php
@@ -35,4 +35,26 @@
$out->addModules( array( 'fileannotations' ) );
}
}
+
+   public static function addFileAnnotationsTab( SkinTemplate 
&$sktemplate, array &$links ) {
+   $title = $sktemplate->getTitle();
+   if ( $title->inNamespace( NS_FILE ) ) {
+   $fatitle = Title::makeTitle(
+   NS_FILE_ANNOTATIONS,
+   $title->getDBkey()
+   );
+
+   $tabMessage = new Message(
+   'fileannotations-tab'
+   );
+
+   $links['namespaces']['annotations'] = [
+   'class' => '',
+   'text' => $tabMessage->text(),
+   'href' => $sktemplate->makeArticleUrlDetails(
+   $fatitle->getFullText()
+   )['href'],
+   ];
+   }
+   }
 }
diff --git a/extension.json b/extension.json
index 7c0c45e..dbde3c7 100644
--- a/extension.json
+++ b/extension.json
@@ -36,7 +36,8 @@
]
},
"Hooks": {
-   "BeforePageDisplay": 
"FileAnnotationsHooks::getModulesForFilePage"
+   "BeforePageDisplay": 
"FileAnnotationsHooks::getModulesForFilePage",
+   "SkinTemplateNavigation": 
"FileAnnotationsHooks::addFileAnnotationsTab"
},
"ResourceModules": {
"fileannotations": {
diff --git a/i18n/en.json b/i18n/en.json
index 65e07e0..9b2a0db 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -4,6 +4,7 @@
},
"fileannotations-desc": "Displays and edits annotations on file pages.",
"file-has-annotations": "There are annotations on this file. Mouse over 
the image to view them.",
+   "fileannotations-tab": "Annotations",
"fileannotation-create": "Add file annotation",
"save-fileannotation": "Save",
"cancel-fileannotation": "Cancel",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 14670e4..4dedd17 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -4,6 +4,7 @@
},
"fileannotations-desc": "Description of the FileAnnotations extension.",
"file-has-annotations": "Note on file page indicating the file has 
annotations.",
+   "fileannotations-tab": "Text for a tab that links to the file 
annotations page from the file page.",
"fileannotation-create": "Text of a button to create a new annotation 
on a file.",
"save-fileannotation": "Text of a button to save a new or edited 
annotation.",
"cancel-fileannotation": "Text of a button that cancels creating or 
editing an annotation.",

-- 
To view, visit https://gerrit.wikimedia.org/r/299204
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia042ef423e3352b549954ca057a1a4fa9f0f59fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix the link to the file page - change (mediawiki...FileAnnotations)

2016-07-15 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/299197

Change subject: Fix the link to the file page
..

Fix the link to the file page

A little hacky, maybe, but this seems like the "best" option.

Bug: T140500
Change-Id: I878b0fd691670da7a96b6a8e8bd02f1659eb4d1e
---
M i18n/en.json
M i18n/qqq.json
M includes/FileAnnotationsContent.php
3 files changed, 15 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/97/299197/1

diff --git a/i18n/en.json b/i18n/en.json
index 13a0153..65e07e0 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -8,5 +8,6 @@
"save-fileannotation": "Save",
"cancel-fileannotation": "Cancel",
"edit-fileannotation": "Edit",
-   "delete-fileannotation": "Delete"
+   "delete-fileannotation": "Delete",
+   "fileannotations-go-to-filepage": "It is recommended that you view and 
edit file annotations on [[:$1|the file page]], where they are available in a 
visual format."
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index c8cfe97..14670e4 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -8,5 +8,6 @@
"save-fileannotation": "Text of a button to save a new or edited 
annotation.",
"cancel-fileannotation": "Text of a button that cancels creating or 
editing an annotation.",
"edit-fileannotation": "Text of a button to begin editing an 
annotation.",
-   "delete-fileannotation": "Text of a button to delete an annotation."
+   "delete-fileannotation": "Text of a button to delete an annotation.",
+   "fileannotations-go-to-filepage": "Appears on the file annotations page 
to encourage users to go to the file page to interact with the content. $1 is 
the file page title, including namespace, suitable for inclusion in a wikilink. 
The message will be parsed. Remember to put a colon (:) in front of the file 
page title, or the message will put the whole image into the page."
 }
diff --git a/includes/FileAnnotationsContent.php 
b/includes/FileAnnotationsContent.php
index 76b3994..be8a52f 100644
--- a/includes/FileAnnotationsContent.php
+++ b/includes/FileAnnotationsContent.php
@@ -61,12 +61,19 @@
parent::fillParserOutput( $title, $revId, $options, 
$generateHtml, $output );
 
if ( $generateHtml && $this->isValid() ) {
+   $fileTitle = Title::makeTitle(
+   NS_FILE,
+   $title->getDBkey()
+   );
+
+   $fileMsg = new Message(
+   'fileannotations-go-to-filepage',
+   [ $fileTitle->getPrefixedDBkey() ]
+   );
+
$output->setText(
-   // TODO message-ify
'' .
-   'It is recommended that you view and 
edit these annotations on ' .
-   'the file page' .
-   ', where they are available in a visual 
format.' .
+   $fileMsg->parse() .
'' .
$output->getText()
);

-- 
To view, visit https://gerrit.wikimedia.org/r/299197
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I878b0fd691670da7a96b6a8e8bd02f1659eb4d1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] WIP: Create annotations on file page - change (mediawiki...FileAnnotations)

2016-06-17 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/294936

Change subject: WIP: Create annotations on file page
..

WIP: Create annotations on file page

Change-Id: I9c21f5ec890d6100cf722350248328844bd20574
---
M extension.json
M resources/src/fileannotations.js
M resources/src/fileannotations.less
3 files changed, 106 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/36/294936/1

diff --git a/extension.json b/extension.json
index a2fda22..b3e0421 100644
--- a/extension.json
+++ b/extension.json
@@ -34,7 +34,15 @@
],
 
"dependencies": [
-   "mediawiki.Title"
+   "mediawiki.Title",
+   "jquery.ui.draggable",
+   "jquery.ui.resizable",
+   "oojs-ui"
+   ],
+
+   "messages": [
+   "fileannotation-create",
+   "file-has-annotations"
]
}
},
diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index 919e78d..a4f9275 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -1,17 +1,38 @@
 ( function ( $, mw ) {
-   var api = new mw.Api(),
+   var createButton, imageInfo, $filePageAnnotationWrapper, $mainImage,
+   api = new mw.Api(),
pageTitle = mw.Title.newFromText( mw.config.get( 'wgPageName' ) 
),
-   isFilePage = pageTitle.getNamespaceId() === 6;
+   isFilePage = pageTitle.getNamespaceId() === 6,
+   $fileLink = $( '#file' );
+
+   if ( isFilePage ) {
+   $annotationInfo = $( '' )
+   .addClass( 'fileannotation-info' )
+   .append(
+   $( '' ).text( mw.message( 
'file-has-annotations' ).text() )
+   );
+
+   $fileLink.after( $annotationInfo );
+   }
 
$( '.annotated-file' ).each( function () {
var imgTitle, imageInfoPromise, offset, imgh, imgw,
+   thisIsMainFile = false,
$annotations = $( this ),
$annotationWrapper = $( '' ).addClass( 
'annotation-wrapper' ),
$img = $annotations.find( 'img' );
 
if ( !$img || $img.length < 1 && isFilePage ) {
// Assume we're annotating the file whose page we're on.
-   $img = $( '#file img' );
+   $img = $fileLink.find( 'img' );
+
+   // If we need to support annotation creation, we'll 
need this
+   // later.
+   $filePageAnnotationWrapper = $annotationWrapper;
+   $mainImage = $img;
+
+   // Indicate to later code that this is the main file.
+   thisIsMainFile = true;
}
 
if ( !$img || $img.length < 1 ) {
@@ -62,6 +83,11 @@
adjustedY = y * adjustRatioY,
adjustedHeight = height * adjustRatioY;
 
+   if ( thisIsMainFile ) {
+   // Cached imageinfo - only gets used if 
we're on a file page anyway
+   imageInfo = ii;
+   }
+
$annotationBox.css( {
top: adjustedY,
left: adjustedX,
@@ -80,4 +106,68 @@
} );
} );
} );
+
+   if ( isFilePage ) {
+   // Make it possible to create new annotations graphically.
+   createButton = new OO.ui.ButtonWidget( {
+   label: mw.message( 'fileannotation-create' ).text(),
+   icon: 'add',
+   flags: [ 'constructive' ]
+   } );
+
+   createButton.on( 'click', function () {
+   // Turn on click-to-initiate...
+   $filePageAnnotationWrapper
+   .addClass( 'click-to-create' );
+
+   $filePageAnnotationWrapper
+   .one( 'click', function ( e ) {
+   // Add outline and edit interface
+   var x = e.offsetX,
+   y = e.offsetY,
+   imgw = $mainImage.width(),
+   imgh = $mainImage.heig

[MediaWiki-commits] [Gerrit] Rename to match repository - change (mediawiki...FileAnnotations)

2016-06-13 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/294112

Change subject: Rename to match repository
..

Rename to match repository

I messed up the repository request, but I'm sure Gerrit admins
would prefer that I do this.

Change-Id: I1fd7f6ff9b5a7238393b91f22ab7b0e751891fb8
---
R FileAnnotations.hooks.php
R FileAnnotations.php
M extension.json
R resources/src/fileannotations.js
R resources/src/fileannotations.less
5 files changed, 23 insertions(+), 23 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/12/294112/1

diff --git a/FileAnnotator.hooks.php b/FileAnnotations.hooks.php
similarity index 87%
rename from FileAnnotator.hooks.php
rename to FileAnnotations.hooks.php
index 84f6f19..4ebe9bf 100644
--- a/FileAnnotator.hooks.php
+++ b/FileAnnotations.hooks.php
@@ -1,6 +1,6 @@
 getTitle()->inNamespace( NS_FILE ) ) {
-   $out->addModules( array( 'fileannotator' ) );
+   $out->addModules( array( 'fileannotations' ) );
}
}
 
public static function onParserSetup( Parser $parser ) {
-   $parser->setHook( 'annotation', 
'FileAnnotatorHooks::renderAnnotation' );
-   $parser->setHook( 'annotatedfile', 
'FileAnnotatorHooks::renderAnnotatedFile' );
+   $parser->setHook( 'annotation', 
'FileAnnotationsHooks::renderAnnotation' );
+   $parser->setHook( 'annotatedfile', 
'FileAnnotationsHooks::renderAnnotatedFile' );
return true;
}
 
diff --git a/FileAnnotator.php b/FileAnnotations.php
similarity index 79%
rename from FileAnnotator.php
rename to FileAnnotations.php
index 5ae7aad..1a54c68 100644
--- a/FileAnnotator.php
+++ b/FileAnnotations.php
@@ -13,9 +13,9 @@
  */
 
 if ( function_exists( 'wfLoadExtension' ) ) {
-   wfLoadExtension( 'FileAnnotator' );
+   wfLoadExtension( 'FileAnnotations' );
 
return true;
 }
 
-die( 'This version of the FileAnnotator extension requires MediaWiki 1.25+.' );
+die( 'This version of the FileAnnotations extension requires MediaWiki 1.25+.' 
);
diff --git a/extension.json b/extension.json
index a3b28a2..a2fda22 100644
--- a/extension.json
+++ b/extension.json
@@ -1,36 +1,36 @@
 {
-   "name": "FileAnnotator",
+   "name": "FileAnnotations",
"version": "0.0.1",
"author": [
"Mark Holmquist"
],
-   "url": "https://www.mediawiki.org/wiki/Extension:FileAnnotator";,
-   "descriptionmsg": "fileannotator-desc",
+   "url": "https://www.mediawiki.org/wiki/Extension:FileAnnotations";,
+   "descriptionmsg": "fileannotations-desc",
"license-name": "GPL-3.0",
"type": "other",
-   "callback": "FileAnnotatorHooks::onRegistration",
+   "callback": "FileAnnotationsHooks::onRegistration",
"APIModules": {
-   "fileannotator": {
-   "class": "ApiFileAnnotator"
+   "fileannotations": {
+   "class": "ApiFileAnnotations"
}
},
"MessagesDirs": {
-   "FileAnnotator": [
+   "FileAnnotations": [
"i18n"
]
},
"Hooks": {
-   "BeforePageDisplay": 
"FileAnnotatorHooks::getModulesForFilePage",
-   "ParserFirstCallInit": "FileAnnotatorHooks::onParserSetup"
+   "BeforePageDisplay": 
"FileAnnotationsHooks::getModulesForFilePage",
+   "ParserFirstCallInit": "FileAnnotationsHooks::onParserSetup"
},
"ResourceModules": {
-   "fileannotator": {
+   "fileannotations": {
"scripts": [
-   "resources/src/fileannotator.js"
+   "resources/src/fileannotations.js"
],
 
"styles": [
-   "resources/src/fileannotator.less"
+   "resources/src/fileannotations.less"
],
 
"dependencies": [
@@ -40,16 +40,16 @@
},
"ResourceFileModulePaths": {
"localBasePath": "",
-   "remoteExtPath": "FileAnnotator"
+   "remoteExtPath": "FileAnnotations"
},
"ExtensionFunctions": [
-   "FileAnnotatorHooks::onSetup"
+   "FileAnnotationsHooks::onSetup"
],
"AutoloadClasses": {
-   "FileAnnotatorHooks": "FileAnnotator.hooks.php"
+   "FileAnnotationsHooks": "FileAnnotations.hooks.php"
},
"ConfigRegistry": {
-   "fileannotator": "GlobalVarConfig::newInstance"
+   "fileannotations": "GlobalVarConfig::newInstance"
},
"manifest_version": 1
 }
diff --git a/resources/src/fileannotator.js b/re

[MediaWiki-commits] [Gerrit] Adding initial files. - change (mediawiki...FileAnnotations)

2016-06-09 Thread MarkTraceur (Code Review)
MarkTraceur has submitted this change and it was merged.

Change subject: Adding initial files.
..


Adding initial files.

Change-Id: Ida670547976e554381d1eb0196d90b005d0b2920
---
A ApiFileAnnotator.php
A COPYING
A FileAnnotator.hooks.php
A FileAnnotator.php
A extension.json
A resources/src/fileannotator.js
A resources/src/fileannotator.less
7 files changed, 657 insertions(+), 0 deletions(-)

Approvals:
  MarkTraceur: Verified; Looks good to me, approved



diff --git a/ApiFileAnnotator.php b/ApiFileAnnotator.php
new file mode 100644
index 000..a51bc43
--- /dev/null
+++ b/ApiFileAnnotator.php
@@ -0,0 +1,39 @@
+http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Api
+ *
+ * @copyright 2015 Mark Holmquist
+ * @license GNU General Public License version 2.0
+ */
+
+class ApiImageTweaks extends ApiBase {
+   public function __construct( $query, $moduleName ) {
+   parent::__construct( $query, $moduleName, 'fa' );
+   }
+
+   public function execute() {
+   }
+
+   public function getAllowedParams() {
+   return array(
+   );
+   }
+}
diff --git a/COPYING b/COPYING
new file mode 100644
index 000..d159169
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed a

[MediaWiki-commits] [Gerrit] Adding initial files. - change (mediawiki...FileAnnotations)

2016-06-08 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/293330

Change subject: Adding initial files.
..

Adding initial files.

Change-Id: Ida670547976e554381d1eb0196d90b005d0b2920
---
A ApiFileAnnotator.php
A COPYING
A FileAnnotator.hooks.php
A FileAnnotator.php
A extension.json
A resources/src/fileannotator.js
A resources/src/fileannotator.less
7 files changed, 657 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FileAnnotations 
refs/changes/30/293330/1

diff --git a/ApiFileAnnotator.php b/ApiFileAnnotator.php
new file mode 100644
index 000..a51bc43
--- /dev/null
+++ b/ApiFileAnnotator.php
@@ -0,0 +1,39 @@
+http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Api
+ *
+ * @copyright 2015 Mark Holmquist
+ * @license GNU General Public License version 2.0
+ */
+
+class ApiImageTweaks extends ApiBase {
+   public function __construct( $query, $moduleName ) {
+   parent::__construct( $query, $moduleName, 'fa' );
+   }
+
+   public function execute() {
+   }
+
+   public function getAllowedParams() {
+   return array(
+   );
+   }
+}
diff --git a/COPYING b/COPYING
new file mode 100644
index 000..d159169
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included w

[MediaWiki-commits] [Gerrit] Test for numeric input in location fields - change (mediawiki...UploadWizard)

2016-05-04 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/286896

Change subject: Test for numeric input in location fields
..

Test for numeric input in location fields

Bug: T134179
Change-Id: Ib38501c657589672007463d73c2a2c8a5c6768b9
---
M i18n/en.json
M resources/details/uw.LocationDetailsWidget.js
2 files changed, 10 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/96/286896/1

diff --git a/i18n/en.json b/i18n/en.json
index 1ce82dd..2a4886b 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -195,9 +195,9 @@
"mwe-upwiz-license-show-all": "Use a different license",
"mwe-upwiz-license-show-recommended": "Use the site's recommended 
license",
"mwe-upwiz-error-signature-blank": "You must sign with your username or 
real name in the appropriate field.",
-   "mwe-upwiz-error-latitude": "The latitude needs to be between -90 and 
90.",
-   "mwe-upwiz-error-longitude": "The longitude needs to be between -180 
and 180.",
-   "mwe-upwiz-error-altitude": "The altitude needs to be a number.",
+   "mwe-upwiz-error-latitude": "The latitude must be a number between -90 
and 90.",
+   "mwe-upwiz-error-longitude": "The longitude must be a number between 
-180 and 180.",
+   "mwe-upwiz-error-altitude": "The altitude must be a number.",
"mwe-upwiz-error-heading": "The heading must be a number between 0 and 
360.",
"mwe-upwiz-error-signature-too-long": "Your signature is too 
long.\nMake it shorter than $1 {{PLURAL:$1|character|characters}}.",
"mwe-upwiz-error-signature-too-short": "Your signature is too 
short.\nMake it longer than $1 {{PLURAL:$1|character|characters}}.",
diff --git a/resources/details/uw.LocationDetailsWidget.js 
b/resources/details/uw.LocationDetailsWidget.js
index b522030..ea7538a 100644
--- a/resources/details/uw.LocationDetailsWidget.js
+++ b/resources/details/uw.LocationDetailsWidget.js
@@ -51,17 +51,20 @@
var errors = [],
lat = this.latitudeInput.getValue(),
lon = this.longitudeInput.getValue(),
-   head = this.headingInput.getValue();
+   head = this.headingInput.getValue(),
+   latNum = parseInt( lat, 10 ),
+   lonNum = parseInt( lon, 10 ),
+   headNum = parseInt( head, 10 );
 
-   if ( lat > 90 || lat < -90 ) {
+   if ( lat !== '' && ( lat > 90 || lat < -90 || isNaN( latNum ) ) 
) {
errors.push( mw.message( 'mwe-upwiz-error-latitude' ) );
}
 
-   if ( lon > 180 || lon < -180 ) {
+   if ( lon !== '' && ( lon > 180 || lon < -180 || isNaN( lonNum ) 
) ) {
errors.push( mw.message( 'mwe-upwiz-error-longitude' ) 
);
}
 
-   if ( head > 360 || head < 0 ) {
+   if ( head !== '' && ( head > 360 || head < 0 || isNaN( headNum 
) ) ) {
errors.push( mw.message( 'mwe-upwiz-error-heading' ) );
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/286896
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib38501c657589672007463d73c2a2c8a5c6768b9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki.api.upload: Unbreak finishing stash uploads - change (mediawiki/core)

2016-04-21 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/284715

Change subject: mediawiki.api.upload: Unbreak finishing stash uploads
..

mediawiki.api.upload: Unbreak finishing stash uploads

The upload would complete successfully, but the upload
dialog would just hang for the user.

Follow-up to 11a2791668260211f1b82ec4954082533ff3adee.

Bug: T133295
Change-Id: I92724c6356d7dbf5c4cb87c05366bb7ed1ec8587
---
M resources/src/mediawiki/api/upload.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/15/284715/1

diff --git a/resources/src/mediawiki/api/upload.js 
b/resources/src/mediawiki/api/upload.js
index a6a0d8c..5297fb5 100644
--- a/resources/src/mediawiki/api/upload.js
+++ b/resources/src/mediawiki/api/upload.js
@@ -347,7 +347,7 @@
}
 
function finishUpload( moreData ) {
-   api.uploadFromStash( filekey, $.extend( data, 
moreData ) );
+   return api.uploadFromStash( filekey, $.extend( 
data, moreData ) );
}
 
return this.upload( file, { stash: true, filename: 
data.filename } ).then(

-- 
To view, visit https://gerrit.wikimedia.org/r/284715
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I92724c6356d7dbf5c4cb87c05366bb7ed1ec8587
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.21
Gerrit-Owner: MarkTraceur 
Gerrit-Reviewer: Bartosz DziewoƄski 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [WIP] Finish stash uploads with upload dialog - change (mediawiki/core)

2016-03-04 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/275010

Change subject: [WIP] Finish stash uploads with upload dialog
..

[WIP] Finish stash uploads with upload dialog

Change-Id: I2cdea08a29cd481eb7fe5cbd83b9e4b6941a6380
---
A resources/src/mediawiki.widgets/mw.widgets.StashedFileSelect.js
M resources/src/mediawiki/api/upload.js
M resources/src/mediawiki/mediawiki.Upload.BookletLayout.js
M resources/src/mediawiki/mediawiki.Upload.js
4 files changed, 219 insertions(+), 47 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/10/275010/1

diff --git a/resources/src/mediawiki.widgets/mw.widgets.StashedFileSelect.js 
b/resources/src/mediawiki.widgets/mw.widgets.StashedFileSelect.js
new file mode 100644
index 000..9a16740
--- /dev/null
+++ b/resources/src/mediawiki.widgets/mw.widgets.StashedFileSelect.js
@@ -0,0 +1,132 @@
+/*!
+ * MediaWiki Widgets - StashedFileSelect class.
+ *
+ * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+( function ( $, mw, OO ) {
+
+   /**
+* @class mw.widgets.StashedFileSelectWidget
+* @extends OO.ui.Widget
+* Accepts a stashed file and displays the information.
+* @constructor
+* @param {Object} config Configuration options
+* @cfg {string} filekey The filekey of the stashed file.
+* @cfg {Object} apiconfig API configuration to use for thumbnails.
+* @cfg {string} [placeholder] Placeholder text for empty field.
+* @cfg {number} [thumbnailSizeLimit=20] How many MB a file should be 
before we don't fetch a thumbnail.
+*/
+   mw.widgets.StashedFileSelectWidget = function 
MWWStashedFileSelectWidget( config ) {
+   config = $.extend( {
+   apiconfig: {},
+   placeholder: mw.message( 
'mediawiki-widgets-stashedFileSelectWidget-placeholder' ),
+   thumbnailSizeLimit: 20
+   }, config );
+
+   // Parent constructor
+   mw.widgets.StashedFileSelect.parent.call( this, config );
+
+   // Mixin constructors
+   OO.ui.mixin.IconElement.call( this, config );
+   OO.ui.mixin.LabelElement.call( this, config );
+
+   // Properties
+   this.$info = $( '' );
+   this.filekey = config.filekey;
+   this.thumbnailSizeLimit = config.thumbnailSizeLimit;
+   this.placeholder = config.placeholder;
+   this.$label.addClass( 
'mediawiki-widgets-stashedFileSelectWidget-label' );
+   this.$info
+   .addClass( 
'mediawiki-widgets-stashedFileSelectWidget-info' )
+   .append( this.$icon, this.$label );
+
+   this.$thumbnail = $( '' ).addClass( 
'mediawiki-widgets-stashedFileSelectWidget-thumbnail' );
+
+   this.$element
+   .addClass( 'mediawiki-widgets-stashedFileSelectWidget' )
+   .append( this.$info );
+
+   this.updateUI();
+   };
+
+   OO.inheritClass( mw.widgets.StashedFileSelectWidget, OO.ui.Widget );
+   OO.mixinClass( mw.widgets.StashedFileSelectWidget, 
OO.ui.mixin.IconElement );
+   OO.mixinClass( mw.widgets.StashedFileSelectWidget, 
OO.ui.mixin.LabelElement );
+
+   /**
+* Get the current filekey.
+* @return {string|null}
+*/
+   mw.widgets.StashedFileSelectWidget.prototype.getValue = function () {
+   return this.filekey;
+   };
+
+   /**
+* Set the filekey.
+* @param {string|null} filekey
+*/
+   mw.widgets.StashedFileSelectWidget.prototype.setValue = function ( 
filekey ) {
+   if ( filekey !== this.filekey ) {
+   this.filekey = filekey;
+   this.updateUI();
+   this.emit( 'change', this.filekey );
+   }
+   };
+
+   mw.widgets.StashedFileSelectWidget.prototype.updateUI = function () {
+   if ( this.filekey ) {
+   this.$element.removeClass( 
'mediawiki-widgets-stashedFileSelectWidget-empty' );
+   $label = $( [] );
+   $label = $label.add(
+   $( '' )
+   .addClass( 
'mediawiki-widgets-stashedFileSelectWidget-filekey' )
+   .text( this.filekey )
+   );
+
+   this.setLabel( $label );
+
+   this.pushPending();
+   this.loadAndGetImageUrl().done( function ( url ) {
+   this.$thumbnail.css( 'background-image', 'url( 
' + url + ' )' );
+   }.bind( this ) ).fail( function () {
+ 

[MediaWiki-commits] [Gerrit] Add itstash param to the imagetweaks API - change (mediawiki...ImageTweaks)

2016-02-22 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272506

Change subject: Add itstash param to the imagetweaks API
..

Add itstash param to the imagetweaks API

Change-Id: Iee08659f95468f752930ca3d48d459e34b885979
---
M ApiImageTweaks.php
1 file changed, 31 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ImageTweaks 
refs/changes/06/272506/1

diff --git a/ApiImageTweaks.php b/ApiImageTweaks.php
index 3f5fd01..cf6576c 100644
--- a/ApiImageTweaks.php
+++ b/ApiImageTweaks.php
@@ -40,29 +40,38 @@
$upload = new UploadFromLocalFile;
$upload->initializeFromParams( $params, $thumborURL );
$upload->fetchFile();
-   $status = $upload->performUpload( $params['comment'], 
$params['text'], false, $this->getUser() );
 
-   if ( !$status->isGood() ) {
-   $error = $status->getErrorsArray();
+   $result = array();
 
-   if ( count( $error ) == 1 && $error[0][0] == 'async' ) {
-   // The upload can not be performed right now, 
because the user
-   // requested so
-   $result = array(
-   'result' => 'Queued',
-   'statuskey' => $error[0][1],
-   );
+   if ( !$params['stash'] ) {
+   $status = $upload->performUpload( $params['comment'], 
$params['text'], false, $this->getUser() );
+
+   if ( !$status->isGood() ) {
+   $error = $status->getErrorsArray();
+   ApiResult::setIndexedTagName( $error, 'error' );
+   $this->dieUsage( 'An internal error occurred', 
'internal-error', 0, $error );
+   } else {
+   $file = $upload->getLocalFile();
+
+   $result[ 'result' ] = 'Success';
+   $result[ 'filename' ] = $file->getName();
}
-
-   ApiResult::setIndexedTagName( $error, 'error' );
-   $this->dieUsage( 'An internal error occurred', 
'internal-error', 0, $error );
} else {
-   $file = $upload->getLocalFile();
+   try {
+   $stashFile = $upload->stashFile( 
$this->getUser() );
 
-   $result = array(
-   'result' => 'Success',
-   'filename' => $file->getName(),
-   );
+   if ( !$stashFile ) {
+   throw new MWException( 'Invalid stashed 
file' );
+   }
+
+   $result[ 'result' ] = 'Stashed';
+   $result[ 'filekey' ] = $stashFile->getFileKey();
+   } catch ( Exception $e ) {
+   $className = get_class( $e );
+   $message = 'Stashing temporary file failed: ' . 
$className . ' ' . $e->getMessage();
+   wfDebug( __METHOD__ . ' ' . $message . "\n" );
+   throw new $className( $message );
+   }
}
 
$this->getResult()->addValue( null, $this->getModuleName(), 
$result );
@@ -89,6 +98,10 @@
'filters' => array(
ApiBase::PARAM_TYPE => 'string',
),
+
+   'stash' => array(
+   ApiBase::PARAM_TYPE => 'boolean',
+   ),
);
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/272506
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee08659f95468f752930ca3d48d459e34b885979
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ImageTweaks
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add dewiki to illustrations query config - change (analytics/limn-multimedia-data)

2016-02-03 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/268206

Change subject: Add dewiki to illustrations query config
..

Add dewiki to illustrations query config

Change-Id: I74826955502c07dde4c6edbb2430df3450d8c4a9
---
M multimedia/config.yaml
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-multimedia-data 
refs/changes/06/268206/1

diff --git a/multimedia/config.yaml b/multimedia/config.yaml
index 55cbd2a..4a8cd79 100644
--- a/multimedia/config.yaml
+++ b/multimedia/config.yaml
@@ -81,4 +81,4 @@
 timeboxed: true
 starts: 2015-01-01
 explode_by:
-wiki_db: enwiki
+wiki_db: enwiki, dewiki

-- 
To view, visit https://gerrit.wikimedia.org/r/268206
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74826955502c07dde4c6edbb2430df3450d8c4a9
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-multimedia-data
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add Blob to accepted types for uploads - change (mediawiki/core)

2016-02-02 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/267918

Change subject: Add Blob to accepted types for uploads
..

Add Blob to accepted types for uploads

From https://developer.mozilla.org/en-US/docs/Web/API/File :

A File object is specific kind of a Blob, and can be used in any
context that a Blob can. In particular, FileReader, URL.createObjectURL(),
createImageBitmap(), and XMLHttpRequest.send() accept both Blobs and Files.

Change-Id: I171f884fc4ada6180e5c605a44b27044fc03f26e
---
M resources/src/mediawiki/api/upload.js
M resources/src/mediawiki/mediawiki.Upload.js
2 files changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/18/267918/1

diff --git a/resources/src/mediawiki/api/upload.js 
b/resources/src/mediawiki/api/upload.js
index 3036237..47d80d6 100644
--- a/resources/src/mediawiki/api/upload.js
+++ b/resources/src/mediawiki/api/upload.js
@@ -116,7 +116,7 @@
 * - It is incompatible with uploads to a foreign wiki using 
mw.ForeignApi
 * - You must pass a HTMLInputElement and not a File for it to 
be possible
 *
-* @param {HTMLInputElement|File} file HTML input type=file 
element with a file already inside
+* @param {HTMLInputElement|File|Blob} file HTML input 
type=file element with a file already inside
 *  of it, or a File object.
 * @param {Object} data Other upload options, see action=upload 
API docs for more
 * @return {jQuery.Promise}
@@ -134,7 +134,8 @@
throw new Error( 'No file' );
}
 
-   canUseFormData = formDataAvailable() && file instanceof 
window.File;
+   // Blobs are allowed in formdata uploads, it turns out
+   canUseFormData = formDataAvailable() && ( file 
instanceof window.File || file instanceof window.Blob );
 
if ( !isFileInput && !canUseFormData ) {
throw new Error( 'Unsupported argument type 
passed to mw.Api.upload' );
diff --git a/resources/src/mediawiki/mediawiki.Upload.js 
b/resources/src/mediawiki/mediawiki.Upload.js
index 8a74ffc..c972f24 100644
--- a/resources/src/mediawiki/mediawiki.Upload.js
+++ b/resources/src/mediawiki/mediawiki.Upload.js
@@ -114,7 +114,7 @@
/**
 * Set the file to be uploaded.
 *
-* @param {HTMLInputElement|File} file
+* @param {HTMLInputElement|File|Blob} file
 */
UP.setFile = function ( file ) {
this.file = file;
@@ -159,7 +159,7 @@
/**
 * Get the file being uploaded.
 *
-* @return {HTMLInputElement|File}
+* @return {HTMLInputElement|File|Blob}
 */
UP.getFile = function () {
return this.file;

-- 
To view, visit https://gerrit.wikimedia.org/r/267918
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I171f884fc4ada6180e5c605a44b27044fc03f26e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add illustration queries for enwiki - change (analytics/limn-multimedia-data)

2016-02-01 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/267722

Change subject: Add illustration queries for enwiki
..

Add illustration queries for enwiki

Based on a script I have to run manually, but useful data.

Maybe we should wait to merge this until I've figured out how to
update the data automatically.

Change-Id: I0d91713422d8dbf4897ac4a39c6ba59fe1d3c3e1
---
M multimedia/config.yaml
1 file changed, 14 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-multimedia-data 
refs/changes/22/267722/1

diff --git a/multimedia/config.yaml b/multimedia/config.yaml
index 57def88..55cbd2a 100644
--- a/multimedia/config.yaml
+++ b/multimedia/config.yaml
@@ -68,3 +68,17 @@
 starts: 2015-09-01
 explode_by:
 wiki_db: commonswiki
+illustrated-pages:
+frequency: months
+granularity: months
+timeboxed: true
+starts: 2015-01-01
+explode_by:
+wiki_db: enwiki
+newly-illustrated-pages:
+frequency: months
+granularity: months
+timeboxed: true
+starts: 2015-01-01
+explode_by:
+wiki_db: enwiki

-- 
To view, visit https://gerrit.wikimedia.org/r/267722
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d91713422d8dbf4897ac4a39c6ba59fe1d3c3e1
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-multimedia-data
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add per-media-type queries for uploads - change (analytics/limn-multimedia-data)

2016-01-27 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266783

Change subject: Add per-media-type queries for uploads
..

Add per-media-type queries for uploads

Change-Id: If8011199874c26c5c0d60e52e27fda82cb18c290
---
A multimedia/audio-uploads.sql
M multimedia/config.yaml
A multimedia/image-uploads.sql
A multimedia/video-uploads.sql
4 files changed, 36 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-multimedia-data 
refs/changes/83/266783/1

diff --git a/multimedia/audio-uploads.sql b/multimedia/audio-uploads.sql
new file mode 100644
index 000..2227e2c
--- /dev/null
+++ b/multimedia/audio-uploads.sql
@@ -0,0 +1,6 @@
+select date('{from_timestamp}') as date,
+   count(*) as {wiki}
+   from {wiki}.image
+   where img_media_type = 'AUDIO' and
+   img_timestamp >= '{from_timestamp}' and
+   img_timestamp < '{to_timestamp}';
diff --git a/multimedia/config.yaml b/multimedia/config.yaml
index 14b6d4f..57def88 100644
--- a/multimedia/config.yaml
+++ b/multimedia/config.yaml
@@ -19,6 +19,24 @@
 timeboxed: true
 starts: 2004-01-01
 by_wiki: true
+image-uploads:
+frequency: months
+granularity: months
+timeboxed: true
+starts: 2004-01-01
+by_wiki: true
+audio-uploads:
+frequency: months
+granularity: months
+timeboxed: true
+starts: 2004-01-01
+by_wiki: true
+video-uploads:
+frequency: months
+granularity: months
+timeboxed: true
+starts: 2004-01-01
+by_wiki: true
 deletions:
 frequency: months
 granularity: months
diff --git a/multimedia/image-uploads.sql b/multimedia/image-uploads.sql
new file mode 100644
index 000..a851f26
--- /dev/null
+++ b/multimedia/image-uploads.sql
@@ -0,0 +1,6 @@
+select date('{from_timestamp}') as date,
+   count(*) as {wiki}
+   from {wiki}.image
+   where img_major_mime = 'image' and
+   img_timestamp >= '{from_timestamp}' and
+   img_timestamp < '{to_timestamp}';
diff --git a/multimedia/video-uploads.sql b/multimedia/video-uploads.sql
new file mode 100644
index 000..9353d8e
--- /dev/null
+++ b/multimedia/video-uploads.sql
@@ -0,0 +1,6 @@
+select date('{from_timestamp}') as date,
+   count(*) as {wiki}
+   from {wiki}.image
+   where img_media_type = 'VIDEO' and
+   img_timestamp >= '{from_timestamp}' and
+   img_timestamp < '{to_timestamp}';

-- 
To view, visit https://gerrit.wikimedia.org/r/266783
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If8011199874c26c5c0d60e52e27fda82cb18c290
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-multimedia-data
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Expand to run on all wikis - change (analytics/limn-multimedia-data)

2016-01-25 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266240

Change subject: Expand to run on all wikis
..

Expand to run on all wikis

Might as well expand our efforts here - most wikis allow uploads
locally, and the ones that don't won't take much time to run...

Change-Id: I6e69b6cb47ed922ca98b0863ce6b3a60f97134f6
---
M multimedia/config.yaml
1 file changed, 5 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-multimedia-data 
refs/changes/40/266240/1

diff --git a/multimedia/config.yaml b/multimedia/config.yaml
index 16ef955..9bfcb62 100644
--- a/multimedia/config.yaml
+++ b/multimedia/config.yaml
@@ -18,33 +18,28 @@
 granularity: months
 timeboxed: true
 starts: 2004-01-01
-explode_by:
-wiki_db: commonswiki, dewiki, enwiki
+by_wiki: true
 uploaders:
 frequency: months
 granularity: months
 timeboxed: true
 starts: 2004-01-01
-explode_by:
-wiki_db: commonswiki, dewiki, enwiki
+by_wiki: true
 new-uploaders:
 frequency: months
 granularity: months
 timeboxed: true
 starts: 2004-01-01
-explode_by:
-wiki_db: commonswiki, dewiki, enwiki
+by_wiki: true
 upload-wizard-uploads:
 frequency: months
 granularity: months
 timeboxed: true
 starts: 2010-01-01
-explode_by:
-wiki_db: commonswiki
+by_wiki: true
 cross-wiki-uploads:
 frequency: months
 granularity: months
 timeboxed: true
 starts: 2015-09-01
-explode_by:
-wiki_db: commonswiki
+by_wiki: true

-- 
To view, visit https://gerrit.wikimedia.org/r/266240
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e69b6cb47ed922ca98b0863ce6b3a60f97134f6
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-multimedia-data
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix cross-wiki upload script - change (analytics/limn-multimedia-data)

2016-01-25 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/266224

Change subject: Fix cross-wiki upload script
..

Fix cross-wiki upload script

The recentchanges table only goes back 30 days, which is why we didn't
have any useful historical data. MatmaRex set me straight, and pointed
me to the change_tag table, which is less stupid than tag_summary.

Change-Id: Ic6fe5ef178094c934621b84c498e120b08918bfb
---
M multimedia/cross-wiki-uploads.sql
1 file changed, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-multimedia-data 
refs/changes/24/266224/1

diff --git a/multimedia/cross-wiki-uploads.sql 
b/multimedia/cross-wiki-uploads.sql
index e30ce96..9fc49dd 100644
--- a/multimedia/cross-wiki-uploads.sql
+++ b/multimedia/cross-wiki-uploads.sql
@@ -1,8 +1,9 @@
 select date('{from_timestamp}') as date,
count(*) as {wiki_db}
-   from {wiki_db}.tag_summary
-   join {wiki_db}.recentchanges on
-   ts_rc_id = rc_id
-   where ts_tags="cross-wiki-upload" and
-   rc_timestamp >= '{from_timestamp}' and
-   rc_timestamp < '{to_timestamp}';
+   from {wiki_db}.change_tag
+   join {wiki_db}.logging on
+   ct_log_id = log_id
+   where ct_tag = "cross-wiki-upload" and
+   log_type = "upload" and
+   log_timestamp >= '{from_timestamp}' and
+   log_timestamp < '{to_timestamp}';

-- 
To view, visit https://gerrit.wikimedia.org/r/266224
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6fe5ef178094c934621b84c498e120b08918bfb
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-multimedia-data
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add deletions script - change (analytics/limn-multimedia-data)

2016-01-22 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/265757

Change subject: Add deletions script
..

Add deletions script

Change-Id: I3b81ca7f348948ac3c7601efdf0579314c3f466c
---
M multimedia/config.yaml
A multimedia/deletions.sql
2 files changed, 14 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-multimedia-data 
refs/changes/57/265757/1

diff --git a/multimedia/config.yaml b/multimedia/config.yaml
index 16ef955..5f6993f 100644
--- a/multimedia/config.yaml
+++ b/multimedia/config.yaml
@@ -20,6 +20,13 @@
 starts: 2004-01-01
 explode_by:
 wiki_db: commonswiki, dewiki, enwiki
+deletions:
+frequency: months
+granularity: months
+timeboxed: true
+starts: 2004-01-01
+explode_by:
+wiki_db: commonswiki, dewiki, enwiki
 uploaders:
 frequency: months
 granularity: months
diff --git a/multimedia/deletions.sql b/multimedia/deletions.sql
new file mode 100644
index 000..b81be23
--- /dev/null
+++ b/multimedia/deletions.sql
@@ -0,0 +1,7 @@
+select date('{from_timestamp}') as date,
+   count(*) as {wiki_db}
+   from {wiki_db}.logging
+   where log_type = 'delete' and
+   log_namespace = 6 and
+   log_timestamp >= '{from_timestamp}' and
+   log_timestamp < '{to_timestamp}';

-- 
To view, visit https://gerrit.wikimedia.org/r/265757
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b81ca7f348948ac3c7601efdf0579314c3f466c
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-multimedia-data
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add queries for per-tool uploads from UW and CWU - change (analytics/limn-multimedia-data)

2016-01-19 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/264996

Change subject: Add queries for per-tool uploads from UW and CWU
..

Add queries for per-tool uploads from UW and CWU

Bug: T111793
Change-Id: I1c2a872f818640e84a15952fb261acf6d90ba5ec
---
M multimedia/config.yaml
A multimedia/cross-wiki-uploads.sql
A multimedia/upload-wizard-uploads.sql
3 files changed, 28 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-multimedia-data 
refs/changes/96/264996/1

diff --git a/multimedia/config.yaml b/multimedia/config.yaml
index a6824b6..16ef955 100644
--- a/multimedia/config.yaml
+++ b/multimedia/config.yaml
@@ -34,3 +34,17 @@
 starts: 2004-01-01
 explode_by:
 wiki_db: commonswiki, dewiki, enwiki
+upload-wizard-uploads:
+frequency: months
+granularity: months
+timeboxed: true
+starts: 2010-01-01
+explode_by:
+wiki_db: commonswiki
+cross-wiki-uploads:
+frequency: months
+granularity: months
+timeboxed: true
+starts: 2015-09-01
+explode_by:
+wiki_db: commonswiki
diff --git a/multimedia/cross-wiki-uploads.sql 
b/multimedia/cross-wiki-uploads.sql
new file mode 100644
index 000..e30ce96
--- /dev/null
+++ b/multimedia/cross-wiki-uploads.sql
@@ -0,0 +1,8 @@
+select date('{from_timestamp}') as date,
+   count(*) as {wiki_db}
+   from {wiki_db}.tag_summary
+   join {wiki_db}.recentchanges on
+   ts_rc_id = rc_id
+   where ts_tags="cross-wiki-upload" and
+   rc_timestamp >= '{from_timestamp}' and
+   rc_timestamp < '{to_timestamp}';
diff --git a/multimedia/upload-wizard-uploads.sql 
b/multimedia/upload-wizard-uploads.sql
new file mode 100644
index 000..f7e4971
--- /dev/null
+++ b/multimedia/upload-wizard-uploads.sql
@@ -0,0 +1,6 @@
+select date('{from_timestamp}') as date,
+   count(*) as {wiki_db}
+   from {wiki_db}.categorylinks
+   where cl_to = 'Uploaded_with_UploadWizard' and
+   cl_timestamp >= '{from_timestamp}' and
+   cl_timestamp < '{to_timestamp}';

-- 
To view, visit https://gerrit.wikimedia.org/r/264996
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c2a872f818640e84a15952fb261acf6d90ba5ec
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-multimedia-data
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add files stolen from language - change (analytics/limn-multimedia-data)

2016-01-19 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/264977

Change subject: Add files stolen from language
..

Add files stolen from language

Also write our SQL queries

Change-Id: Ie140cfb9b85b3b6ef56aa4b56fc4147e2f2a2f7d
---
M multimedia/config.yaml
A multimedia/new-uploaders.sql
A multimedia/uploaders.sql
M multimedia/uploads.sql
A reportgenerator/base/ReportInterface.php
A reportgenerator/config/config.json
A reportgenerator/reports.php
A tox.ini
8 files changed, 104 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-multimedia-data 
refs/changes/77/264977/1

diff --git a/multimedia/config.yaml b/multimedia/config.yaml
index cf2fd53..b99c8f3 100644
--- a/multimedia/config.yaml
+++ b/multimedia/config.yaml
@@ -3,20 +3,34 @@
 host: "analytics-store.eqiad.wmnet"
 port: 3306
 creds_file: /a/.my.cnf.research
-db: enwiki # just a default, queries specify which db they need
+db: enwiki # just a default, queries already specify it
 
 defaults:
 db: mediawiki
 
-graphs: # legacy section, old generate.py script crashes without this
+graphs: # must be here, or else generate.py will crash
 
-reportupdater-output: "/a/limn-public-data/metrics/multimedia"
+reportupdater-output: /a/limn-public-data/metrics/multimedia-health
 
 reportupdater-reports:
 uploads:
-frequency: days
-granularity: days
+frequency: months
+granularity: months
 timeboxed: true
-starts: 2015-03-01
+starts: 2004-01-01
 explode_by:
-wiki_db: enwiki, commonswiki
+wiki_db: commonswiki, dewiki, enwiki
+uploaders:
+frequency: months
+granularity: months
+timeboxed: true
+starts: 2004-01-01
+explode_by:
+wiki_db: commonswiki, dewiki, enwiki
+new_uploaders:
+frequency: months
+granularity: months
+timeboxed: true
+starts: 2004-01-01
+explode_by:
+wiki_db: commonswiki, dewiki, enwiki
diff --git a/multimedia/new-uploaders.sql b/multimedia/new-uploaders.sql
new file mode 100644
index 000..835ab87
--- /dev/null
+++ b/multimedia/new-uploaders.sql
@@ -0,0 +1,15 @@
+select date('{from_timestamp}') as date,
+   count(i.img_user) as {wiki_db}
+   from (
+   select img_user,
+   min(img_timestamp) as timestamp
+   from {wiki_db}.image
+   group by img_user
+   ) firsts
+
+   join {wiki_db}.image i
+   on firsts.img_user = i.img_user
+   and firsts.timestamp = i.img_timestamp
+   
+   where i.img_timestamp >= '{from_timestamp}' and
+   i.img_timestamp < '{to_timestamp}';
diff --git a/multimedia/uploaders.sql b/multimedia/uploaders.sql
new file mode 100644
index 000..1c89def
--- /dev/null
+++ b/multimedia/uploaders.sql
@@ -0,0 +1,5 @@
+select date('{from_timestamp}') as date,
+   count(distinct img_user) as {wiki_db}
+   from {wiki_db}.image
+   where img_timestamp >= '{from_timestamp}' and
+   img_timestamp < '{to_timestamp}';
diff --git a/multimedia/uploads.sql b/multimedia/uploads.sql
index 64ce875..fa20180 100644
--- a/multimedia/uploads.sql
+++ b/multimedia/uploads.sql
@@ -1,7 +1,5 @@
--- TODO: implement this (... is not valid SQL :))
- select date('{from_timestamp}') as date,
-count(*) as {wiki_db}
-   from {wiki_db}
-  where ...
-... probably use from_timestamp and to_timestamp
-;
+select date('{from_timestamp}') as date,
+   count(*) as {wiki_db}
+   from {wiki_db}.image
+   where img_timestamp >= '{from_timestamp}' and
+   img_timestamp < '{to_timestamp}';
diff --git a/reportgenerator/base/ReportInterface.php 
b/reportgenerator/base/ReportInterface.php
new file mode 100644
index 000..8a50437
--- /dev/null
+++ b/reportgenerator/base/ReportInterface.php
@@ -0,0 +1,5 @@
+getRealPath();
+
+   // get the class name from the file name.
+   $class = substr(
+   $reportFile->getFilename(),
+   0,
+   strpos( $reportFile->getFilename(), '.' . 
$reportFile->getExtension() )
+   );
+   if ( !class_exists( $class ) ) {
+   throw new Exception( "Report class $class not defined", 
1 );
+   }
+   $report = new $class();
+   $output = $report->run( $config );
+   echo $output;
+   } else {
+   throw new Exception( "Could not load file $input", 1 );
+   }
+} catch ( Exception $e ) {
+   echo $e->getMessage()."\n";
+}
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 000..e9204d7
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,17 @@
+[tox]
+minversion = 1.6
+skipsdist = True
+envlist

[MediaWiki-commits] [Gerrit] Make the upload interface load faster - change (mediawiki...UploadWizard)

2016-01-13 Thread MarkTraceur (Code Review)
MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/263883

Change subject: Make the upload interface load faster
..

Make the upload interface load faster

...by making the details interface load slower.

I feel like the OOUI stuff is slowing us down a lot, but I don't
know if we can avoid that without significantly changing the workflow,
which admittedly, is something I want to do anyway...

Bug: T121901
Change-Id: If9fe6c28a84b97d41465b6f9cf6e1ea32b5b448d
---
M resources/mw.UploadWizard.js
M resources/mw.UploadWizardDetails.js
M resources/mw.UploadWizardUpload.js
3 files changed, 9 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/83/263883/1

diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index fc97084..f2fb2f8 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -284,8 +284,7 @@
 
upload.checkFile(
upload.ui.getFilename(),
-   files,
-   function () { 
upload.fileChangedOk(); }
+   files
);
 
uw.eventFlowLogger.logUploadEvent( 
'uploads-added', { quantity: files.length } );
diff --git a/resources/mw.UploadWizardDetails.js 
b/resources/mw.UploadWizardDetails.js
index d1284a3..82e0d1b 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -658,7 +658,7 @@
descriptions: [
{
// The language 
is probably wrong in many cases...
-   language: 
mw.config.get( 'wgContentLanguage' ),
+   language: 
uw.DescriptionDetailsWidget.static.getClosestAllowedLanguage( mw.config.get( 
'wgContentLanguage' ) ),
description: 
descText.trim()
}
]
diff --git a/resources/mw.UploadWizardUpload.js 
b/resources/mw.UploadWizardUpload.js
index 0527778..4361d45 100644
--- a/resources/mw.UploadWizardUpload.js
+++ b/resources/mw.UploadWizardUpload.js
@@ -62,8 +62,7 @@
} )
 
.on( 'upload-filled', function () {
-   upload.details = new mw.UploadWizardDetails( 
upload, $( '#mwe-upwiz-macro-files' ) );
-
+   upload.isFilled = true;
upload.emit( 'filled' );
} );
};
@@ -385,7 +384,6 @@
 *
 * @param {string} filename The filename
 * @param {Array} files Array of files, usually one; can be more for 
multi-file select.
-* @param {Function} fileNameOk Callback to use when ok, and upload 
object is ready
 */
mw.UploadWizardUpload.prototype.checkFile = function ( filename, files, 
fileNameOk ) {
var totalSize, duplicate, extension, toobig,
@@ -398,7 +396,7 @@
 
function finishCallback() {
if ( upload && upload.ui ) {
-   fileNameOk();
+   upload.fileChangedOk();
} else {
setTimeout( finishCallback, 200 );
}
@@ -1121,9 +1119,11 @@
};
 
mw.UploadWizardUpload.prototype.createDetails = function () {
-   this.details = new mw.UploadWizardDetails( this, $( 
'#mwe-upwiz-macro-files' ) );
-   this.details.populate();
-   this.details.attach();
+   if ( this.isFilled ) {
+   this.details = new mw.UploadWizardDetails( this, $( 
'#mwe-upwiz-macro-files' ) );
+   this.details.populate();
+   this.details.attach();
+   }
};
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/263883
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9fe6c28a84b97d41465b6f9cf6e1ea32b5b448d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


  1   2   3   4   5   6   7   8   9   10   >