[MediaWiki-commits] [Gerrit] Convert unadapted links to plain text while publishing - change (mediawiki...ContentTranslation)

2015-06-19 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Convert unadapted links to plain text while publishing
..

Convert unadapted links to plain text while publishing

Ideally, we will require a validator and cleaner from each tool
module before publishing. It is a bit architecture work we have to
do in near future. For now, this is done in a simple way.

Testplan:
Translate LaTeX from en to=es. Click on first section, note the
unadapted links in translation. They will be in gray color. Publish.
The published article should not have them as links. They should be
plain text.

Change-Id: Ib530fd95c7934f422a6b5850cd06fd861a9987cb
---
M modules/publish/ext.cx.publish.js
M modules/tools/ext.cx.tools.link.js
2 files changed, 6 insertions(+), 0 deletions(-)


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index d1bafb9..ec7a31e 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -334,6 +334,11 @@
return $( this ).html();
} );
 
+   // All unadapted links are unwrapped.
+   $section.find( '.cx-target-link-unadapted' 
).replaceWith( function () {
+   return $( this ).html();
+   } );
+
// Remove empty sections
if ( !$.trim( $section.text() ) ) {
$section.remove();
diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index 6d6e96c..5754b2f 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -688,6 +688,7 @@
};
 
CXTargetLink.prototype.markUnAdapted = function () {
+   // All these unadapted links will be converted to plain text 
while publishing.
this.$link.addClass( 'cx-target-link-unadapted' );
};
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib530fd95c7934f422a6b5850cd06fd861a9987cb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Don't hide the contribution menu on right click - change (mediawiki...ContentTranslation)

2015-06-18 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Don't hide the contribution menu on right click
..

Don't hide the contribution menu on right click

Bug: T102940
Change-Id: I5e0df047eebe12f3453335bc9bdfd0910049a888
---
M modules/widgets/callout/ext.cx.callout.js
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/10/219310/1

diff --git a/modules/widgets/callout/ext.cx.callout.js 
b/modules/widgets/callout/ext.cx.callout.js
index 495bcbb..698c0e2 100644
--- a/modules/widgets/callout/ext.cx.callout.js
+++ b/modules/widgets/callout/ext.cx.callout.js
@@ -215,7 +215,12 @@
// On mouse enter of siblings, hide.
self.$element.siblings().one( 'mouseenter', 
$.proxy( self.hide, self ) );
self.$dialog.one( 'mouseleave', $.proxy( 
self.hide, self ) );
-   $( document ).one( 'click', $.proxy( self.hide, 
self ) );
+   $( document ).one( 'mousedown', function ( e ) {
+   if ( e.which === 1 ) {
+   // Left click
+   self.hide();
+   }
+   } );
} );
}
if ( this.options.trigger === 'click' ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e0df047eebe12f3453335bc9bdfd0910049a888
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] CXStats: Avoid graph overflowing the page margin - change (mediawiki...ContentTranslation)

2015-06-18 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: CXStats: Avoid graph overflowing the page margin
..

CXStats: Avoid graph overflowing the page margin

Change-Id: I4085f9afe4cbcee1a6f57900d3e9684174aebf7b
---
M modules/stats/ext.cx.stats.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/09/219309/1

diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 12d93ed..ea25254 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -34,7 +34,7 @@
this.$highlights = $( 'div' ).addClass( 'cx-stats-highlights' 
);
this.$graph = $( 'canvas' ).attr( {
id: 'cxtrend',
-   width: this.$container.width() - 100, // Leave a 100px 
margin at right
+   width: this.$container.width() - 200, // Leave a 200px 
margin buffer to avoid overflow
height: 400
} );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4085f9afe4cbcee1a6f57900d3e9684174aebf7b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Congratulate translator on 10th, 100th translation milestones - change (mediawiki...ContentTranslation)

2015-06-16 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Congratulate translator on 10th, 100th translation milestones
..

Congratulate translator on 10th, 100th translation milestones

Uses echo notifications

Bug: T99071
Change-Id: I2b51986bba6904ac43f630f602fba7a27cda75a8
---
M ContentTranslation.hooks.php
M api/ApiContentTranslationPublish.php
M i18n/en.json
M i18n/qqq.json
M includes/Notification.php
5 files changed, 75 insertions(+), 7 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/21/218821/1

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 3dc12f7..1dff85f 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -253,6 +253,24 @@
'icon' = 'cx',
);
 
+   $notifications['cx-tenth-translation'] = array(
+   'category' = 'cx',
+   'group' = 'positive',
+   'formatter-class' = 'EchoBasicFormatter',
+   'title-message' = 'cx-notification-tenth-translation',
+   'email-subject-message' = 
'cx-notification-tenth-translation-email-subject',
+   'icon' = 'cx',
+   );
+
+   $notifications['cx-hundredth-translation'] = array(
+   'category' = 'cx',
+   'group' = 'positive',
+   'formatter-class' = 'EchoBasicFormatter',
+   'title-message' = 
'cx-notification-hundredth-translation',
+   'email-subject-message' = 
'cx-notification-hundredth-translation-email-subject',
+   'icon' = 'cx',
+   );
+
$icons['cx'] = array(
'path' = 
'ContentTranslation/images/cx-notification-green.svg',
);
@@ -268,6 +286,8 @@
public static function onEchoGetDefaultNotifiedUsers( $event, $users ) 
{
switch ( $event-getType() ) {
case 'cx-first-translation':
+   case 'cx-tenth-translation':
+   case 'cx-hundredth-translation':
$extra = $event-getExtra();
if ( !isset( $extra['recipient'] ) ) {
break;
diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index 740ddc6..85f8c55 100755
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -215,11 +215,7 @@
}
$this-saveTranslationHistory( $params );
// Notify user about milestones
-   $translator = new ContentTranslation\Translator( $user 
);
-   if ( $translator-getTranslationsCount() === 1 ) {
-   
ContentTranslation\Notification::firstTranslation( $user );
-   }
-   // TODO: Add other milestones
+   $this-notifyTranslator();
} else {
$result = array(
'result' = 'error',
@@ -230,6 +226,26 @@
$this-getResult()-addValue( null, $this-getModuleName(), 
$result );
}
 
+   /**
+* Notify user about milestones.
+*/
+   public function notifyTranslator() {
+   $user = $this-getUser();
+   $translator = new ContentTranslation\Translator( $user );
+   $translationCount = $translator-getTranslationsCount();
+   switch ( $translationCount ) {
+   case 1 :
+   
ContentTranslation\Notification::firstTranslation( $user );
+   break;
+   case 10 :
+   
ContentTranslation\Notification::tenthTranslation( $user );
+   break;
+   case 100 :
+   
ContentTranslation\Notification::hundredthTranslation( $user );
+   break;
+   }
+   }
+
public function saveAsDraft() {
$params = $this-extractRequestParams();
$this-saveTranslationHistory( $params );
diff --git a/i18n/en.json b/i18n/en.json
index 04fa1d8..6a90ba0 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -201,5 +201,9 @@
echo-category-title-cx: Translations,
echo-pref-tooltip-cx: Notify me about my translations created using 
Content Translation tool,
cx-notification-first-translation: Congratulations for your first 
translation! Find more pages to translate at [[Special:MyContributions|your 
contributions page]].,
-   

[MediaWiki-commits] [Gerrit] Migrate to JSON configuration based extension registration - change (mediawiki...ContentTranslation)

2015-06-16 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Migrate to JSON configuration based extension registration
..

Migrate to JSON configuration based extension registration

Remove ContentTranslation.php, Autoload.php and Resources.php

Bug: T92492
Change-Id: I7bb6249b1555e2159c2932eaa9a4d96e067c80ee
---
D Autoload.php
D ContentTranslation.php
D Resources.php
M extension.json
4 files changed, 264 insertions(+), 1,255 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/00/218600/1

diff --git a/Autoload.php b/Autoload.php
deleted file mode 100644
index 9c7c5e6..000
--- a/Autoload.php
+++ /dev/null
@@ -1,32 +0,0 @@
-?php
-/**
- * Autoload definitions.
- *
- * @file
- * @copyright See AUTHORS.txt
- * @license GPL-2.0+
- */
-
-global $wgAutoloadClasses;
-$dir = __DIR__;
-
-$wgAutoloadClasses += array(
-   'ApiContentTranslationConfiguration' = 
$dir/api/ApiContentTranslationConfiguration.php,
-   'ApiContentTranslationPublish' = 
$dir/api/ApiContentTranslationPublish.php,
-   'ApiContentTranslationDelete' = 
$dir/api/ApiContentTranslationDelete.php,
-   'ApiQueryContentTranslation' = 
$dir/api/ApiQueryContentTranslation.php,
-   'ApiQueryContentTranslationStats' = 
$dir/api/ApiQueryContentTranslationStats.php,
-   'ApiQueryContentTranslationLanguageTrend' 
=$dir/api/ApiQueryContentTranslationLanguageTrend.php,
-   'ApiQueryPublishedTranslations' = 
$dir/api/ApiQueryPublishedTranslations.php,
-   'ContentTranslationHooks' = $dir/ContentTranslation.hooks.php,
-   'ContentTranslation\Database' = $dir/includes/Database.php,
-   'ContentTranslation\Draft' = $dir/includes/Draft.php,
-   'ContentTranslation\GlobalUser' = $dir/includes/GlobalUser.php,
-   'ContentTranslation\Notification' = $dir/includes/Notification.php,
-   'ContentTranslation\SiteMapper' = $dir/includes/SiteMapper.php,
-   'ContentTranslation\Stats' = $dir/includes/Stats.php,
-   'ContentTranslation\Translation' = $dir/includes/Translation.php,
-   'ContentTranslation\Translator' = $dir/includes/Translator.php,
-   'SpecialContentTranslation' = 
$dir/specials/SpecialContentTranslation.php,
-   'SpecialContentTranslationStats' = 
$dir/specials/SpecialContentTranslationStats.php,
-);
diff --git a/ContentTranslation.php b/ContentTranslation.php
deleted file mode 100644
index 9c757ed..000
--- a/ContentTranslation.php
+++ /dev/null
@@ -1,173 +0,0 @@
-?php
-/**
- * ContentTranslation extension
- * A tool that allows editors to translate pages from one language
- * to another with the help of machine translation and other translation tools
- *
- * @file
- * @ingroup Extensions
- * @copyright See AUTHORS.txt
- * @license GPL-2.0+
- */
-
-/**
- * Version number used in extension credits and in other places where needed.
- */
-define( 'CONTENTTRANSLATION_VERSION', '1.0.0+20150401' );
-
-/**
- * Extension credits properties.
- */
-$wgExtensionCredits['specialpage'][] = array(
-   'path' = __FILE__,
-   'name' = 'ContentTranslation',
-   'version' = CONTENTTRANSLATION_VERSION,
-   'author' = array(
-   'Amir Aharoni',
-   'David Chan',
-   'Kartik Mistry',
-   'Joel Sahleen',
-   'Niklas Laxström',
-   'Pau Giner',
-   'Runa Bhattacharjee',
-   'Santhosh Thottingal',
-   'Siebrand Mazeland',
-   'Sucheta Ghoshal',
-   ),
-   'descriptionmsg' = 'cx-desc',
-   'url' = 'https://www.mediawiki.org/wiki/Extension:ContentTranslation',
-   'license-name' = 'GPL-2.0+',
-);
-
-$dir = __DIR__;
-
-require_once $dir/Resources.php;
-require_once $dir/Autoload.php;
-
-$GLOBALS['wgMessagesDirs']['ContentTranslation'] = $dir/i18n;
-
-$GLOBALS['wgExtensionMessagesFiles']['ContentTranslationAlias'] =
-   $dir/ContentTranslation.alias.php;
-
-// Special pages
-$GLOBALS['wgSpecialPages']['ContentTranslation'] = 'SpecialContentTranslation';
-$GLOBALS['wgSpecialPages']['ContentTranslationStats'] = 
'SpecialContentTranslationStats';
-
-// API modules
-$GLOBALS['wgAPIModules']['cxconfiguration'] = 
'ApiContentTranslationConfiguration';
-$GLOBALS['wgAPIModules']['cxpublish'] = 'ApiContentTranslationPublish';
-$GLOBALS['wgAPIModules']['cxdelete'] = 'ApiContentTranslationDelete';
-$GLOBALS['wgAPIListModules']['contenttranslation'] = 
'ApiQueryContentTranslation';
-$GLOBALS['wgAPIListModules']['contenttranslationstats'] = 
'ApiQueryContentTranslationStats';
-$GLOBALS['wgAPIListModules']['contenttranslationlangtrend'] =
-   'ApiQueryContentTranslationLanguageTrend';
-$GLOBALS['wgAPIListModules']['cxpublishedtranslations' ]= 
'ApiQueryPublishedTranslations';
-// Hooks
-$GLOBALS['wgHooks']['BeforePageDisplay'][] = 
'ContentTranslationHooks::addModules';

[MediaWiki-commits] [Gerrit] Fix: Link adapation does not happen when language code and d... - change (mediawiki...ContentTranslation)

2015-06-10 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix: Link adapation does not happen when language code and 
domain differs
..

Fix: Link adapation does not happen when language code and domain differs

Testplan:
Translate:
Special:ContentTranslationpage=LaTeXfrom=simpleto=bho
Without this patch, user will see all links in translation
template as missing. With this patch, links will be adapated
to bh.

Bug: T99888
Change-Id: I2d5021c27f8b03563ef5a16723bed3ea83d0e701
---
M modules/base/ext.cx.sitemapper.js
M modules/tools/ext.cx.tools.link.js
2 files changed, 31 insertions(+), 21 deletions(-)


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

diff --git a/modules/base/ext.cx.sitemapper.js 
b/modules/base/ext.cx.sitemapper.js
index 6d7aa72..aec45af 100644
--- a/modules/base/ext.cx.sitemapper.js
+++ b/modules/base/ext.cx.sitemapper.js
@@ -11,21 +11,6 @@
 ( function ( $, mw ) {
'use strict';
 
-   // Some wikis have domain names that do not match the content language.
-   // See: wgLanguageCode in 
operations/mediawiki-config/wmf-config/InitialiseSettings.php
-   // NOTE: Keep list of mapping in sync with includes/SiteMapper.php
-   var languageToWikiDomainMapping = {
-   bho: 'bh',
-   'crh-latn': 'crh',
-   gsw: 'als',
-   sgs: 'bat-smg',
-   'be-tarask': 'be-x-old',
-   vro: 'fiu-vro',
-   rup: 'roa-rup',
-   lzh: 'zh-classical',
-   nan: 'zh-min-nan',
-   yue: 'zh-yue'
-   };
 
/**
 * Handles providing urls to different wikis.
@@ -35,6 +20,30 @@
this.config = siteconfig;
};
 
+
+   /**
+* Some wikis have domain names that do not match the content language.
+* See: wgLanguageCode in 
operations/mediawiki-config/wmf-config/InitialiseSettings.php
+* NOTE: Keep list of mapping in sync with includes/SiteMapper.php
+* @param {string} language Language code
+*/
+   mw.cx.SiteMapper.prototype.getWikiDomainCode = function ( language ) {
+   var languageToWikiDomainMapping = {
+   bho: 'bh',
+   'crh-latn': 'crh',
+   gsw: 'als',
+   sgs: 'bat-smg',
+   'be-tarask': 'be-x-old',
+   vro: 'fiu-vro',
+   rup: 'roa-rup',
+   lzh: 'zh-classical',
+   nan: 'zh-min-nan',
+   yue: 'zh-yue'
+   };
+
+   return languageToWikiDomainMapping[ language ] || language;
+   };
+
/**
 * Get the API for a remote wiki.
 *
@@ -42,10 +51,10 @@
 * @return {mediawiki.Api}
 */
mw.cx.SiteMapper.prototype.getApi = function ( language ) {
-   var url;
+   var url, domain;
 
-   language = languageToWikiDomainMapping[ language ] || language;
-   url = this.config.api.replace( '$1', language );
+   domain = this.getWikiDomainCode( language );
+   url = this.config.api.replace( '$1', domain );
return new mw.Api( {
ajax: {
url: url
@@ -63,15 +72,16 @@
 */
mw.cx.SiteMapper.prototype.getPageUrl = function ( language, title, 
params ) {
var base = this.config.view,
+   domain,
extra = '';
 
-   language = languageToWikiDomainMapping[ language ] || language;
+   domain = this.getWikiDomainCode( language );
if ( params  !$.isEmptyObject( params ) ) {
base = this.config.action || this.config.view;
extra = ( base.indexOf( '?' ) !== -1 ? '' : '?' ) + 
$.param( params );
}
 
-   return base.replace( '$1', language ).replace( '$2', title ) + 
extra;
+   return base.replace( '$1', domain ).replace( '$2', title ) + 
extra;
};
 
/**
diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index db689a3..3d6c90a 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -77,7 +77,7 @@
titles: titles.join( '|' ),
prop: 'langlinks',
lllimit: titles.length, // TODO: Default is 10 and max 
is 500. Do we need more than 500?
-   lllang: language,
+   lllang: mw.cx.siteMapper.getWikiDomainCode( language ),
redirects: true,
format: 'json'
}, {

-- 
To view, visit 

[MediaWiki-commits] [Gerrit] Avoid using same error message for save and publish - change (mediawiki...ContentTranslation)

2015-06-10 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Avoid using same error message for save and publish
..

Avoid using same error message for save and publish

Change-Id: Id7af6406c5ebf734e02840bc4bad73009be0ebbe
---
M Resources.php
M i18n/en.json
M i18n/qqq.json
M modules/draft/ext.cx.draft.js
4 files changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/Resources.php b/Resources.php
index 6213de7..c352f32 100644
--- a/Resources.php
+++ b/Resources.php
@@ -519,6 +519,7 @@
'messages' = array(
'cx-save-draft-saving',
'cx-save-draft-save-success',
+   'cx-save-draft-error',
'cx-save-draft-tooltip',
),
 ) + $resourcePaths;
diff --git a/i18n/en.json b/i18n/en.json
index db1e395..4eca65d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -138,6 +138,7 @@
cx-save-draft-save-success: Saved {{PLURAL:$1|a minute ago|$1 
minutes ago|0=just now}},
cx-save-draft-saving: Saving...,
cx-save-draft-tooltip: Translation drafts are saved automatically,
+   cx-save-draft-error: An error occurred while saving the page.,
cx-contributions-new-contributions: New contribution,
cx-contributions-new-article: New page,
cx-contributions-translation: Translation,
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 4c96746..7d0398d 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -142,6 +142,7 @@
cx-save-draft-save-success: \Saved\ refers to a draft of a 
translated page that was saved recently.,
cx-save-draft-saving: Label of button to save the translation as 
draft while saving is in progress\n{{Identical|Saving}},
cx-save-draft-tooltip: Tooltip text shown for the save status 
indicator text in the header of [[Special:ContentTranslation]].\n\nParameters: 
\n* $1 - the number of minutes ago the translation was saved.,
+   cx-save-draft-error: Error message shown if saving page draft 
failed.,
cx-contributions-new-contributions: Header text shown in 
[[Special:Contributions]],
cx-contributions-new-article: Button label tooltip\n{{Identical|New 
page}},
cx-contributions-translation: Button label tooltip,
diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index a3689b9..4fbdbf3 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -222,7 +222,7 @@
checkAndsave();
}, 5 * 60 * 1000 );
} ).fail( function () {
-   mw.hook( 'mw.cx.error' ).fire( mw.msg( 
'cx-publish-page-error' ) );
+   mw.hook( 'mw.cx.error' ).fire( mw.msg( 
'cx-save-draft-error' ) );
} );
};
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7af6406c5ebf734e02840bc4bad73009be0ebbe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Avoid save error when translation started with empty content - change (mediawiki...ContentTranslation)

2015-06-10 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Avoid save error when translation started with empty content
..

Avoid save error when translation started with empty content

If the language directions are different the translation template is
blank, but it will trigger a translation change event and in turn a
save event. Do a check for empty content before firing api.

Change-Id: I131bf12549ea02998c03eba48f7facafd9cf5139
---
M modules/draft/ext.cx.draft.js
1 file changed, 11 insertions(+), 0 deletions(-)


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

diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index 4fbdbf3..3add12c 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -206,6 +206,17 @@
progress: JSON.stringify( mw.cx.getProgress() )
};
 
+   if ( !params.html ) {
+   // No content to save. But dont let the save initiator 
wait infinitely.
+   mw.hook( 'mw.cx.translation.saved' ).fire(
+   mw.cx.sourceLanguage,
+   mw.cx.targetLanguage,
+   mw.cx.sourceTitle,
+   targetTitle
+   );
+
+   return;
+   }
apiParams = $.extend( {}, params, {
action: 'cxpublish'
} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I131bf12549ea02998c03eba48f7facafd9cf5139
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Avoid bars overlapping or breaking the row - change (mediawiki...ContentTranslation)

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

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

Change subject: Avoid bars overlapping or breaking the row
..

Avoid bars overlapping or breaking the row

Bug: T101815
Change-Id: I5dd44aa2d1c6486e896cb353e49c41e296449152
---
M modules/stats/styles/ext.cx.stats.less
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/35/216935/1

diff --git a/modules/stats/styles/ext.cx.stats.less 
b/modules/stats/styles/ext.cx.stats.less
index 95813c1..1275b1e 100644
--- a/modules/stats/styles/ext.cx.stats.less
+++ b/modules/stats/styles/ext.cx.stats.less
@@ -115,6 +115,7 @@
height: 20px;
padding: 0;
margin: 0;
+   box-sizing: border-box;
background-color: #347bff;
border-right: 1px solid @gray;
font-size: small;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5dd44aa2d1c6486e896cb353e49c41e296449152
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix JS error while accessing Special:CXStats as anon user - change (mediawiki...ContentTranslation)

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

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

Change subject: Fix JS error while accessing Special:CXStats as anon user
..

Fix JS error while accessing Special:CXStats as anon user

Added missing RL module.

Bug: T101813
Change-Id: I847c0dca9a1594a02e8c7e9f22a947dae855eb62
---
M Resources.php
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index 4aa09dd..9a67a42 100644
--- a/Resources.php
+++ b/Resources.php
@@ -704,6 +704,7 @@
'chart.js',
'jquery.uls.data',
'ext.cx.widgets.spinner',
+   'ext.cx.widgets.callout',
),
'messages' = array(
'cx-stats-table-source-target',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I847c0dca9a1594a02e8c7e9f22a947dae855eb62
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Bind link handlers to source links even if target section is... - change (mediawiki...ContentTranslation)

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

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

Change subject: Bind link handlers to source links even if target section is 
empty
..

Bind link handlers to source links even if target section is empty

If target section has not links, llink handlers were not added to
links in source section. This is problematic.

Make sure all source and target links are with link handlers.

Change-Id: I052e22c04f93c0ca9ab9824ae12641d8f43d0b1f
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/48/216948/1

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index 79485bc..b44c0a3 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -280,7 +280,7 @@
selection = mw.cx.selection.get();
$link = $( 'a' )
.addClass( 'cx-target-link' )
-   .text( selection.toString() )
+   .text( selection.toString() || this.title )
.attr( {
title: this.title,
href: this.title,
@@ -870,8 +870,10 @@
 */
function adaptLinks( $section ) {
var $links,
+   $sourceSection,
sourceLinkTargets = [];
 
+   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
$links = $section.find( 'a[rel=mw:WikiLink]' );
 
if ( !$section.data( 'cx-draft' ) ) {
@@ -885,6 +887,10 @@
.done( function () {
$links.cxTargetLink();
} );
+   $sourceSection.find( 'a[rel=mw:WikiLink]' ).each( function () 
{
+   $( this ).cxSourceLink();
+   } );
+
}
 
mw.cx.tools.link = LinkCard;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I052e22c04f93c0ca9ab9824ae12641d8f43d0b1f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Special:CXStats: Add link to tagfilter page in targetwikis. - change (mediawiki...ContentTranslation)

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

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

Change subject: Special:CXStats: Add link to tagfilter page in targetwikis.
..

Special:CXStats: Add link to tagfilter page in targetwikis.

The total translation count is a link to
lang.wikipedia.org/wiki/Special:RecentChanges?tagfilter=contenttranslation

Change-Id: Iff8084e39f04ffa12c92ebee6d0c23359aae4aad
---
M modules/stats/ext.cx.stats.js
1 file changed, 18 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/43/216943/1

diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index f06d75a..e524fd0 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -237,6 +237,7 @@
CXStats.prototype.drawTranslationsChart = function ( direction, status, 
property ) {
var $chart, $bar, translations, $translations, model, i, j, 
$rows = [],
$callout,
+   $total,
$row, width, max = 0,
$tail, tailWidth = 0,
tail,
@@ -318,6 +319,22 @@
content: $callout
} );
 
+   $total = $( 'span' )
+   .addClass( 'cx-stats-chart__total' )
+   .text( fmt( model[ i ][ property ] ) );
+
+   if ( direction === 'to' ) {
+   $total = $( 'a' )
+   .addClass( 'cx-stats-chart__total' )
+   .attr( 'href', 
mw.cx.siteMapper.getPageUrl(
+   model[ i ].language, 
'Special:RecentChanges', { tagfilter: 'contenttranslation' }
+   ) )
+   .text( fmt( model[ i ][ property ] ) );
+   } else {
+   $total = $( 'span' )
+   .addClass( 'cx-stats-chart__total' )
+   .text( fmt( model[ i ][ property ] ) );
+   }
$row.append(
$( 'span' )
.addClass( 'cx-stats-chart__langcode' )
@@ -325,9 +342,7 @@
$( 'span' )
.addClass( 'cx-stats-chart__autonym' )
.text( $.uls.data.getAutonym( model[ i 
].language ) ),
-   $( 'span' )
-   .addClass( 'cx-stats-chart__total' )
-   .text( fmt( model[ i ][ property ] ) ),
+   $total,
$translations
);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff8084e39f04ffa12c92ebee6d0c23359aae4aad
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Support gallery translations - change (mediawiki...ContentTranslation)

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

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

Change subject: Support gallery translations
..

Support gallery translations

Adapt the galleries in source article to target article.
Copy the images and translate(if MT present). Editing gallery text
won't be allowed at present.

Testplan:
Translate Radimlja article from English to Spanish.
Special:ContentTranslationpage=Radimljafrom=ento=estargettitle=Radimlja
Just click on the gallery in the page. You should see gallery copied to 
translation
and the gallery captions translated using Apertium.
Publish the article and you should see the following wikitext in the published 
page.

== Galería ==
gallery
File:Radmilja 1.jpg|Radimlja
File:Radmilja 2.jpg|Señal en la entrada a Radimlja
File:Radmilja 3.jpg|Radimlja, stecak necrópolis
/gallery

Bug: T96159
Change-Id: I5f1768c336a46a5534af1f90688d530b97f04e00
---
M Resources.php
A modules/tools/ext.cx.tools.gallery.js
2 files changed, 59 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/10/216910/1

diff --git a/Resources.php b/Resources.php
index 4aa09dd..51b4f71 100644
--- a/Resources.php
+++ b/Resources.php
@@ -296,6 +296,7 @@
'ext.cx.progressbar',
'ext.cx.tools.dictionary',
'ext.cx.tools.formatter',
+   'ext.cx.tools.gallery',
'ext.cx.tools.images',
'ext.cx.tools.instructions',
'ext.cx.tools.link',
@@ -470,6 +471,12 @@
),
 ) + $resourcePaths;
 
+$wgResourceModules['ext.cx.tools.gallery'] = array(
+   'scripts' = array(
+   'tools/ext.cx.tools.gallery.js',
+   ),
+) + $resourcePaths;
+
 $wgResourceModules['ext.cx.tools.categories'] = array(
'scripts' = array(
'tools/ext.cx.tools.categories.js',
diff --git a/modules/tools/ext.cx.tools.gallery.js 
b/modules/tools/ext.cx.tools.gallery.js
new file mode 100644
index 000..a5699e1
--- /dev/null
+++ b/modules/tools/ext.cx.tools.gallery.js
@@ -0,0 +1,52 @@
+/**
+ * ContentTranslation Tools
+ * A tool that allows editors to translate pages from one language
+ * to another with the help of machine translation and other translation tools
+ *
+ * @file
+ * @ingroup Extensions
+ * @copyright See AUTHORS.txt
+ * @license GPL-2.0+
+ */
+( function ( $, mw ) {
+   'use strict';
+
+   function adaptGallery( $section ) {
+   var i, $sourceSection, galleryData, galleryWikiMarkup = '',
+   imageItems, caption, imageIndex = 0;
+
+   if ( !$section.is( '[typeof*=mw:Extension/gallery]' ) ) {
+   return;
+   }
+   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
+   galleryData = $sourceSection.data( 'mw' );
+   // Copy the translated gallery image captions to the data-mw
+   // so that parsoid can create the gallery tag with image 
items.
+   galleryWikiMarkup = galleryData.body.extsrc;
+   imageItems = galleryWikiMarkup.split( '\n' );
+   for ( i = 0; i  imageItems.length; i++ ) {
+   if ( imageItems[ i ].trim() ) {
+   // FIXME: Copying plain text of gallery text 
will definitely lose the html
+   // mark up in translation. What we need is 
Wikitext of the translated HTML.
+   // That require a restbase api call.
+   caption = $section.find( '.gallerytext' ).eq( 
imageIndex ).text().trim();
+   imageItems[ i ] = [ imageItems[ i ].split( '|' 
)[ 0 ], caption ].join( '|' );
+   imageIndex++;
+   }
+   }
+
+   galleryData.body.extsrc = imageItems.join( '\n' );
+   // Copy the data-mw to target section.
+   $section.attr( 'data-mw', JSON.stringify( galleryData ) );
+   // Ultimately, this should make parsoid generate the following 
Wikitext in published page
+   // gallery
+   // File:Radmilja 1.jpg|Radimlja
+   // File:Radmilja 2.jpg|Señal en la entrada a Radimlja
+   // File:Radmilja 3.jpg|Radimlja, stecak necrópolis
+   // /gallery
+   }
+
+   $( function () {
+   mw.hook( 'mw.cx.translation.postMT' ).add( adaptGallery );
+   } );
+}( jQuery, mediaWiki ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f1768c336a46a5534af1f90688d530b97f04e00
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

[MediaWiki-commits] [Gerrit] Callout widget: Improve the hover behavior - change (mediawiki...ContentTranslation)

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

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

Change subject: Callout widget: Improve the hover behavior
..

Callout widget: Improve the hover behavior

Avoid showing multiple callouts if the trigger is 'hover'.
Also hide the callout, if mouse entered in siblings of triggers,
if present.

For contribution menu, this improves a user experience. Now moving
mouse over contribution list to logout link, horizontally does not
cause the contribution menu hide. With this patch it will hide.

For stats page, we can improve the custom hover handler because
the widget will make sure only one callout is shown. While fixing
that, fixed a small bug that the menu is coming only when tail for
bars(bar with ...) is present.

Change-Id: Iadadf68023eaa7aa8506e9076d80847eef64296c
---
M modules/campaigns/ext.cx.campaigns.contributionsmenu.js
M modules/stats/ext.cx.stats.js
M modules/widgets/callout/ext.cx.callout.js
3 files changed, 12 insertions(+), 12 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/15/216615/1

diff --git a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js 
b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
index 33ef2fe..d58a4a6 100644
--- a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
+++ b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
@@ -65,7 +65,7 @@
$myContributions, $myTranslations, $myUploads,
$menu, callout;
 
-   $trigger = $( '#pt-mycontris a' );
+   $trigger = $( '#pt-mycontris' );
 
$myContributions = $( 'li' )
.addClass( 'cx-campaign-contributions' )
diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 6ef6b2e..553b533 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -310,19 +310,15 @@
.text( '…' )
.css( 'width', tailWidth + '%' );
$translations.append( $tail );
-   /*jslint loopfunc: true */
-   $tail.callout( {
-   trigger: 'manual',
-   direction: 
$.fn.callout.autoDirection( '0' ),
-   content: $callout
-   } ).on( 'mouseenter', function () {
-   $( this ).callout( 'show' );
-   } )
-   .on( 'mouseleave', function () {
-   $( this ).callout( 'hide' );
-   } );
}
 
+   /*jslint loopfunc: true */
+   $translations.find( '.cx-stats-chart__bar' 
).last().callout( {
+   trigger: 'hover',
+   direction: $.fn.callout.autoDirection( '0' ),
+   content: $callout
+   } );
+
$row.append(
$( 'span' )
.addClass( 'cx-stats-chart__langcode' )
diff --git a/modules/widgets/callout/ext.cx.callout.js 
b/modules/widgets/callout/ext.cx.callout.js
index 9508dd0..1469abd 100644
--- a/modules/widgets/callout/ext.cx.callout.js
+++ b/modules/widgets/callout/ext.cx.callout.js
@@ -209,7 +209,11 @@
 
if ( this.options.trigger === 'hover' ) {
this.$element.on( 'mouseenter', function () {
+   // Hide all other cx-callouts
+   $( '.cx-callout' ).hide();
self.show();
+   // On mouse enter of siblings, hide.
+   self.$element.siblings().one( 'mouseenter', 
$.proxy( self.hide, self ) );
self.$dialog.one( 'mouseleave', $.proxy( 
self.hide, self ) );
$( document ).one( 'click', $.proxy( self.hide, 
self ) );
} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadadf68023eaa7aa8506e9076d80847eef64296c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Published translations API: Correct the condition - change (mediawiki...ContentTranslation)

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

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

Change subject: Published translations API: Correct the condition
..

Published translations API: Correct the condition

The api was using translation status as the only condition.
This will exclude translations once published and now in draft.

Used the same condition used for identifying published translation.

Change-Id: I86c4fede42acc1550044d7d91a4c0cbc42ad6bf4
---
M includes/Translation.php
1 file changed, 7 insertions(+), 1 deletion(-)


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

diff --git a/includes/Translation.php b/includes/Translation.php
index c7ba517..ff2486e 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -322,7 +322,13 @@
 */
public static function getAllPublishedTranslations( $from, $to, $limit, 
$offset ) {
$dbr = Database::getConnection( DB_SLAVE );
-   $conditions = array( 'translation_status' = 'published' );
+   $conditions = array( $dbr-makeList(
+   array(
+   'translation_status' = 'published',
+   'translation_target_url IS NOT NULL',
+   ),
+   LIST_OR
+   ) );
 
if ( $from ) {
$conditions['translation_source_language'] = $from;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I86c4fede42acc1550044d7d91a4c0cbc42ad6bf4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix js error in the CX contribution menu when VE is triggered - change (mediawiki...ContentTranslation)

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

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

Change subject: Fix js error in the CX contribution menu when VE is triggered
..

Fix js error in the CX contribution menu when VE is triggered

The $dialog of callout instance of trigger is null till callout
is shown. If the callout was not shown before VE trigger, accessing
$dialog can create js error.

Bug: T101421
Change-Id: I2ae3dc93ba76d9ca816d64d811a00cacd193373c
---
M modules/campaigns/ext.cx.campaigns.contributionsmenu.js
1 file changed, 10 insertions(+), 13 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/23/216623/1

diff --git a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js 
b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
index 33ef2fe..c4c889b 100644
--- a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
+++ b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
@@ -60,12 +60,9 @@
return $item;
}
 
-   function showInvitation() {
-   var $trigger,
-   $myContributions, $myTranslations, $myUploads,
+   function attachMenu( $trigger ) {
+   var $myContributions, $myTranslations, $myUploads,
$menu, callout;
-
-   $trigger = $( '#pt-mycontris a' );
 
$myContributions = $( 'li' )
.addClass( 'cx-campaign-contributions' )
@@ -110,18 +107,18 @@
}
 
$( function () {
-   var blacklist = mw.config.get( 
'wgContentTranslationBrowserBlacklist' );
+   var $trigger, blacklist = mw.config.get( 
'wgContentTranslationBrowserBlacklist' );
 
if ( !$.client.test( blacklist, null, true ) ) {
-   showInvitation();
+   $trigger = $( '#pt-mycontris' );
 
-   // Show it after creating a new article using VE
+   attachMenu( $trigger );
+
+   // Change the menu when creating a new article using VE
mw.hook( 've.activationComplete' ).add( function () {
-   var $trigger;
-
-   $trigger = $( '#pt-mycontris a' );
-   $trigger.data( 'callout' ).$dialog.find( 
'li.cx-campaign-translations' )
-   .replaceWith( getTranslationsItem() );
+   // Rebuild menu.
+   $trigger.removeData( 'callout' );
+   attachMenu( $trigger );
} );
}
} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ae3dc93ba76d9ca816d64d811a00cacd193373c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix JSCS errors - change (mediawiki...ContentTranslation)

2015-06-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix JSCS errors
..

Fix JSCS errors

Change-Id: I90a0447331df082b4aaff05540ae2ead6678ecad
---
M modules/stats/ext.cx.stats.js
M modules/tools/ext.cx.tools.reference.js
M modules/widgets/callout/ext.cx.callout.js
3 files changed, 31 insertions(+), 31 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/11/216611/1

diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 8a8ddcd..6ef6b2e 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -166,7 +166,7 @@
{
title: mw.msg( 
'cx-stats-draft-target-source' ),
content: this.drawTranslationsChart( 
'to', 'draft', 'count' )
-   },
+   },
{
title: mw.msg( 
'cx-stats-draft-source-target' ),
content: this.drawTranslationsChart( 
'from', 'draft', 'count' )
@@ -386,7 +386,7 @@
data: $.map( 
this.totalTranslationTrend, function ( data ) {
return data.count;
} )
-   },
+   },
{
label: mw.message(
'cx-trend-translations-to',
@@ -397,8 +397,8 @@
data: $.map( 
this.languageTranslatonTrend, function ( data ) {
return data.count;
} )
-   }
-   ]
+   }
+   ]
};
 
/*global Chart:false */
@@ -430,7 +430,6 @@
this.sourceTargetModel[ status ][ sourceLanguage 
].push( record );
this.targetSourceModel[ status ][ targetLanguage 
].push( record );
}
-
 
for ( status in this.sourceTargetModel ) {
tempModel = this.sourceTargetModel[ status ];
diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index f31b21f..6411f99 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -93,7 +93,7 @@
referenceId = $reference.prop( 'id' );
targetReferenceId = 'cx' + referenceId;
$reference.attr( {
-   'id': targetReferenceId,
+   id: targetReferenceId,
'data-sourceid': referenceId
} );
mw.cx.selection.pasteHTML( $reference[ 0 ].outerHTML );
diff --git a/modules/widgets/callout/ext.cx.callout.js 
b/modules/widgets/callout/ext.cx.callout.js
index 757747c..9508dd0 100644
--- a/modules/widgets/callout/ext.cx.callout.js
+++ b/modules/widgets/callout/ext.cx.callout.js
@@ -293,38 +293,39 @@
$this = $( this );
 
leftFlips = {
-   '1': '11',
-   '2': '10',
-   '3': '9',
-   '4': '8',
-   '5': '7'
+   1: '11',
+   2: '10',
+   3: '9',
+   4: '8',
+   5: '7'
};
rightFlips = {
-   '11': '1',
-   '10': '2',
-   '9': '3',
-   '8': '4',
-   '7': '5'
+   11: '1',
+   10: '2',
+   9: '3',
+   8: '4',
+   7: '5'
};
topFlips = {
-   '3': '2',
-   '4': '2',
-   '5': '1',
-   '6': '0',
-   '7': '11',
-   '8': '10',
-   '9': '10'
+   3: '2',
+   4: '2',
+   5: '1',
+   6: '0',
+   7: '11',
+

[MediaWiki-commits] [Gerrit] Avoid cx-segment spans appearing in published content - change (mediawiki...ContentTranslation)

2015-06-05 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Avoid cx-segment spans appearing in published content
..

Avoid cx-segment spans appearing in published content

Testplan:

Start translating a paragraph. After the source content
copied to target paragraph, delete the last sentence of
that paragraph using backspace.
Inspect the paragraph and we will see that even though the
content was removed, the wrapper span still exist as empty
span in the paragraph. Now publish. Without this patch,
the published content will have that empty span. With this
patch you should not see the empty span in the published
content.

For unknown reason to me, the replaceWith function with
the cloned content does not remove all .cx-segment spans.
With the above testplan, the empty span.cx-segment did not
get removed. So I am reducing the scope of .find and
.replaceWith to section levels and I see it working.

Bug: T96234
Change-Id: I962c6ae8e6993e597c71a8c283868554fdb546d1
---
M modules/publish/ext.cx.publish.js
1 file changed, 4 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/67/216067/1

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index b05e9dd..362a658 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -314,11 +314,6 @@
 * @return {string} processed html
 */
CXPublish.prototype.prepareTranslationForPublish = function ( $content 
) {
-   // Remove the wrapper tags that are added to the highlighting 
segments
-   $content.find( '.cx-segment' ).replaceWith( function () {
-   return $( this ).html();
-   } );
-
// Remove unnecessary elements
$content.find( 'link, title, .placeholder' ).remove();
 
@@ -333,7 +328,10 @@
if ( $section.is( 'h1, h2, h3, h4, h5, h6' ) ) {
$section.find( 'br' ).remove();
}
-
+   // Remove the wrapper tags that are added to the 
highlighting segments
+   $section.find( '.cx-segment' ).replaceWith( function () 
{
+   return $( this ).html();
+   } );
// Remove empty sections
if ( !$.trim( $section.text() ) ) {
$section.remove();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I962c6ae8e6993e597c71a8c283868554fdb546d1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Show login page if the URL has campaign parameter for anon u... - change (mediawiki...ContentTranslation)

2015-06-04 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Show login page if the URL has campaign parameter for anon users
..

Show login page if the URL has campaign parameter for anon users

For non-logged-in users show login page instead of nosuchspecialpage
if the URL has campaign parameter.
After login the user should be taken to Special:CX again with all query 
parameters.

This is important for campaigns like email campaigns.
When user click the user may not be logged in.
Showing nosuchspecialpage is a bad idea in that case.

Bug: T101489
Change-Id: I600af89c91e14e45e58dcb17fa98d3cdda09122b
---
M specials/SpecialContentTranslation.php
1 file changed, 8 insertions(+), 0 deletions(-)


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

diff --git a/specials/SpecialContentTranslation.php 
b/specials/SpecialContentTranslation.php
index b818d05..1fdb2a5 100644
--- a/specials/SpecialContentTranslation.php
+++ b/specials/SpecialContentTranslation.php
@@ -87,6 +87,14 @@
// User has a token. Enabled cx for the user in 
this wiki.
$this-enableCXBetaFeature();
} else {
+   if ( $campaign ) {
+   // Show login page if the URL has 
campaign parameter
+   $out-showPermissionsErrorPage(
+   array( array( 
'badaccess-groups' ) ),
+   'edit'
+   );
+   return;
+   }
$out-showErrorPage( 'nosuchspecialpage', 
'nospecialpagetext' );
return;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I600af89c91e14e45e58dcb17fa98d3cdda09122b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] WIP: Notify user on first translation - change (mediawiki...ContentTranslation)

2015-05-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: WIP: Notify user on first translation
..

WIP: Notify user on first translation

TODO: Draft a proper message and summary, identify the milestone

Bug: T99071
Change-Id: Ib51c895ddfbd8325bde429bf5f793ba1adc2a8ff
---
M Autoload.php
M ContentTranslation.hooks.php
M ContentTranslation.php
M api/ApiContentTranslationPublish.php
M i18n/en.json
A includes/Notification.php
6 files changed, 85 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/79/213779/1

diff --git a/Autoload.php b/Autoload.php
index abec7cd..9c7c5e6 100644
--- a/Autoload.php
+++ b/Autoload.php
@@ -22,6 +22,7 @@
'ContentTranslation\Database' = $dir/includes/Database.php,
'ContentTranslation\Draft' = $dir/includes/Draft.php,
'ContentTranslation\GlobalUser' = $dir/includes/GlobalUser.php,
+   'ContentTranslation\Notification' = $dir/includes/Notification.php,
'ContentTranslation\SiteMapper' = $dir/includes/SiteMapper.php,
'ContentTranslation\Stats' = $dir/includes/Stats.php,
'ContentTranslation\Translation' = $dir/includes/Translation.php,
diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 6d509c1..2b519a7 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -230,6 +230,56 @@
}
 
/**
+   * Add notification events to Echo
+   *
+   * @param $notifications array of Echo notifications
+   * @param $notificationCategories array of Echo notification categories
+   * @param $icons array of icon details
+   * @return bool
+   */
+   public static function onBeforeCreateEchoEvent( $notifications, 
$notificationCategories, $icons ) {
+   $notificationCategories['cx'] = array(
+   'priority' = 3,
+   'tooltip' = 'echo-pref-tooltip-cx',
+   );
+
+   $notifications['cx-first-translation'] = array(
+   'primary-link' = array( 'message' = 'cx', 
'destination' = 'Special:CX' ),
+   'category' = 'cx',
+   'group' = 'positive',
+   'formatter-class' = 'EchoBasicFormatter',
+   'title-message' = 'cx-notification-first-translation',
+   'email-subject-message' = 
'cx-notification-first-translation-email-subject',
+   // TODO: We need an icon
+   'icon' = 'Gratitude.png',
+   );
+
+   return true;
+   }
+
+   /**
+   * Add user to be notified on echo event
+   * @param $event EchoEvent
+   * @param $users array
+   * @return bool
+   */
+   public static function onEchoGetDefaultNotifiedUsers( $event, $users ) 
{
+   switch ( $event-getType() ) {
+   case 'cx-first-translation':
+   $extra = $event-getExtra();
+   if ( !$extra || !isset( $extra['recipient'] ) ) 
{
+   break;
+   }
+   $recipientId = $extra['recipient'];
+   $recipient = User::newFromId( $recipientId );
+   $users[$recipientId] = $recipient;
+   break;
+   }
+
+   return true;
+   }
+
+   /**
 * Hook: ResourceLoaderTestModules
 */
public static function onResourceLoaderTestModules( array $modules ) {
diff --git a/ContentTranslation.php b/ContentTranslation.php
index 5ebda08..9c757ed 100644
--- a/ContentTranslation.php
+++ b/ContentTranslation.php
@@ -76,9 +76,11 @@
'ContentTranslationHooks::newArticleCampaign';
 $GLOBALS['wgHooks']['ResourceLoaderTestModules'][] =
'ContentTranslationHooks::onResourceLoaderTestModules';
-
+$GLOBALS['wgHooks']['BeforeCreateEchoEvent'][] = 
'ContentTranslationHooks::onBeforeCreateEchoEvent';
+$GLOBALS['wgHooks']['EchoGetDefaultNotifiedUsers'][] =
+   'ContentTranslationHooks::onEchoGetDefaultNotifiedUsers';
 // Globals for this extension
-
+$GLOBALS['wgDefaultUserOptions']['echo-subscriptions-web-cx'] = true;
 $GLOBALS['wgContentTranslationExperimentalFeatures'] = false;
 $GLOBALS['wgContentTranslationParsoid'] = array(
'url' = 'http://parsoid-lb.eqiad.wikimedia.org/',
diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index c87cade..eea522d 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -209,6 +209,9 @@
$result['newrevid'] = intval( 
$saveresult['edit']['newrevid'] );
}

[MediaWiki-commits] [Gerrit] Make it possible to adapt references manually to an empty pa... - change (mediawiki...ContentTranslation)

2015-05-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Make it possible to adapt references manually to an empty 
paragraph
..

Make it possible to adapt references manually to an empty paragraph

Bug: T99507, T85714
Change-Id: Id3f70219af6a6f5e3641c1df65eb5d292e4e1646
---
M Resources.php
M i18n/en.json
M i18n/qqq.json
M modules/tools/ext.cx.tools.reference.js
M modules/tools/styles/ext.cx.tools.reference.less
5 files changed, 66 insertions(+), 4 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index 0602e6a..b5c127f 100644
--- a/Resources.php
+++ b/Resources.php
@@ -448,6 +448,7 @@
),
'messages' = array(
'cx-tools-reference-title',
+   'cx-tools-reference-add',
'cx-tools-reference-remove',
),
'dependencies' = array(
diff --git a/i18n/en.json b/i18n/en.json
index 6a7dc43..1ab7ca7 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -71,6 +71,7 @@
cx-stats-title: Content Translation statistics,
cx-stats-unknown: unknown,
cx-tools-reference-title: Reference,
+   cx-tools-reference-add: Add reference,
cx-tools-reference-remove: Remove reference,
cx-tools-link-instruction-shortcut: Shift + click any link to open,
cx-tools-link-hover-tooltip: Click to open,
diff --git a/i18n/qqq.json b/i18n/qqq.json
index cca01f3..6bd6737 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -79,6 +79,7 @@
cx-stats-title: The title for the Special:ContentTranslationStats 
special page.,
cx-stats-unknown: Text when the source or target language is 
unknown. An adjective that describes the language.\n{{Identical|Unknown}},
cx-tools-reference-title: Title of Reference (footnote) tool card on 
Special:ContentTranslation.\n{{Identical|Reference}},
+   cx-tools-reference-add: Text shown in the reference tool card. 
Clicking on it add the reference in the cursor position.,
cx-tools-reference-remove: Text shown in the reference tool card. 
Clicking on it removes the reference in the context.,
cx-tools-link-instruction-shortcut: Text explaining the shortcut for 
opening a link. Appears in the link tool card.,
cx-tools-link-hover-tooltip: Tooltip text shown when the mouse is 
over the link with shift or control key is pressed.,
diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index b604753..211cfc4 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -18,6 +18,7 @@
function ReferenceCard() {
this.$card = null;
this.$removeReference = null;
+   this.$addReference = null;
this.$reference = null;
}
 
@@ -30,6 +31,9 @@
 
this.$card = $( 'div' )
.addClass( 'card reference' );
+   this.$addReference = $( 'div' )
+   .addClass( 'card__add-reference' )
+   .text( mw.msg( 'cx-tools-reference-add' ) );
this.$removeReference = $( 'div' )
.addClass( 'card__remove-reference' )
.text( mw.msg( 'cx-tools-reference-remove' ) );
@@ -49,7 +53,7 @@
$referenceInfo.append( $( 'div' )
.addClass( 'card__reference-content' ) );
 
-   $referenceInfo.append( this.$removeReference );
+   $referenceInfo.append( this.$addReference, 
this.$removeReference );
this.$card.append( $referenceInfo );
this.listen();
return this.$card;
@@ -71,6 +75,32 @@
this.$reference.remove();
this.stop();
}
+   };
+
+   /**
+* Add the reference to the cursor position in translation
+*/
+   ReferenceCard.prototype.addReference = function () {
+   var $reference, referenceId, targetReferenceId;
+
+   mw.cx.selection.restore( 'translation' );
+   $reference = this.$reference.clone();
+   referenceId = $reference.prop( 'id' );
+   targetReferenceId = 'cx' + referenceId;
+   $reference.attr( {
+   'id': targetReferenceId,
+   'data-sourceid': referenceId
+   } );
+   mw.cx.selection.pasteHTML( $reference[ 0 ].outerHTML );
+   // Adapt references.
+   this.adaptReference( targetReferenceId );
+   // Click handler for references.
+   $( document.getElementById( targetReferenceId ) )
+   .on( 'click', referenceClickHandler )
+   // Mark it readonly
+   

[MediaWiki-commits] [Gerrit] CXStats: Remove redundant condition - change (mediawiki...ContentTranslation)

2015-05-25 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: CXStats: Remove redundant condition
..

CXStats: Remove redundant condition

Change-Id: Ib8b50299c3c2b91ab77997a8febb190ec81123cb
Followup: I0365d1366fcf5c62193f878c1e73435d9b4c0b98
---
M modules/stats/ext.cx.stats.js
1 file changed, 7 insertions(+), 9 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/22/213522/1

diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 1e1e2c9..4abe376 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -274,16 +274,14 @@
}
 
if ( !mw.user.isAnon()  mw.user.options.get( 'cx' ) !== '1' ) 
{
-   if ( !mw.user.isAnon() ) {
-   cxLink = mw.util.getUrl( 
'Special:ContentTranslation', {
-   campaign: 'cxstats',
-   targettitle: mw.config.get( 
'wgPageName' ),
-   to: mw.config.get( 'wgContentLanguage' )
-   } );
+   cxLink = mw.util.getUrl( 'Special:ContentTranslation', {
+   campaign: 'cxstats',
+   targettitle: mw.config.get( 'wgPageName' ),
+   to: mw.config.get( 'wgContentLanguage' )
+   } );
 
-   $( '.cx-header__bar' ).hide();
-   mw.hook( 'mw.cx.error' ).fire( mw.message( 
'cx-stats-try-contenttranslation', cxLink ) );
-   }
+   $( '.cx-header__bar' ).hide();
+   mw.hook( 'mw.cx.error' ).fire( mw.message( 
'cx-stats-try-contenttranslation', cxLink ) );
} else {
$header.find( '.cx-header__translation-center a' 
).text( mw.msg( 'cx-header-new-translation' ) );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib8b50299c3c2b91ab77997a8febb190ec81123cb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Language pairs of different direction and without MT: No def... - change (mediawiki...ContentTranslation)

2015-05-25 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Language pairs of different direction and without MT: No 
default translation
..

Language pairs of different direction and without MT: No default translation

Bug: T99832
Change-Id: Ib7699a388b92890fd7113272a7b36356112d1e2b
---
M modules/tools/ext.cx.tools.mt.js
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/31/213531/1

diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 69321e5..29e69c1 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -43,6 +43,14 @@
 
if ( $.isEmptyObject( MTControlCard.providers ) 
) {
MTControlCard.provider = noMT;
+   // For languages with different 
directionality,
+   // provide disable MT as default 
option. It gives
+   // an empty editor to translator.
+   if ( $.uls.data.getDir( 
mw.cx.sourceLanguage ) !==
+   $.uls.data.getDir( 
mw.cx.targetLanguage )
+   ) {
+   MTControlCard.provider = 
disableMT;
+   }
} else {
// TODO Consider user preferences
MTControlCard.provider = 
MTControlCard.providers[ 0 ];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib7699a388b92890fd7113272a7b36356112d1e2b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Publish preprocessing: Remove the empty br tags inserted by ... - change (mediawiki...ContentTranslation)

2015-05-22 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Publish preprocessing: Remove the empty br tags inserted by 
Firefox
..

Publish preprocessing: Remove the empty br tags inserted by Firefox

Bug: T99851
Change-Id: Ia91f2f2fbe42a2a329df0874357147653859fe7c
---
M modules/publish/ext.cx.publish.js
1 file changed, 6 insertions(+), 1 deletion(-)


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index c4bc447..cf2e5f4 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -302,7 +302,12 @@
return $( this ).html();
} );
$content.find( 'link, title' ).remove();
-
+   // Firefox inserts br type=_moz in Content ediables while 
clearing the content
+   // to keep the height and caret. 
https://bugzilla.mozilla.org/show_bug.cgi?id=414223
+   // Remove them.
+   if ( navigator.userAgent.toLowerCase().indexOf( 'firefox' )  
-1 ) {
+   $content.find( 'br[type=_moz]' ).remove();
+   }
// Remove placeholder sections
$content.find( '.placeholder' ).remove();
// Remove empty sections.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia91f2f2fbe42a2a329df0874357147653859fe7c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Campaigns are only for logged in users - change (mediawiki...ContentTranslation)

2015-05-22 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Campaigns are only for logged in users
..

Campaigns are only for logged in users

Change-Id: I0365d1366fcf5c62193f878c1e73435d9b4c0b98
---
M modules/stats/ext.cx.stats.js
M specials/SpecialContentTranslation.php
2 files changed, 18 insertions(+), 8 deletions(-)


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

diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 234ea4f..1e1e2c9 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -269,15 +269,21 @@
);
$header.cxHeader( mw.cx.siteMapper );
 
-   if ( mw.user.options.get( 'cx' ) !== '1' ) {
-   cxLink = mw.util.getUrl( 'Special:ContentTranslation', {
-   campaign: 'cxstats',
-   targettitle: mw.config.get( 'wgPageName' ),
-   to: mw.config.get( 'wgContentLanguage' )
-   } );
-
+   if ( mw.user.isAnon() ) {
$( '.cx-header__bar' ).hide();
-   mw.hook( 'mw.cx.error' ).fire( mw.message( 
'cx-stats-try-contenttranslation', cxLink ) );
+   }
+
+   if ( !mw.user.isAnon()  mw.user.options.get( 'cx' ) !== '1' ) 
{
+   if ( !mw.user.isAnon() ) {
+   cxLink = mw.util.getUrl( 
'Special:ContentTranslation', {
+   campaign: 'cxstats',
+   targettitle: mw.config.get( 
'wgPageName' ),
+   to: mw.config.get( 'wgContentLanguage' )
+   } );
+
+   $( '.cx-header__bar' ).hide();
+   mw.hook( 'mw.cx.error' ).fire( mw.message( 
'cx-stats-try-contenttranslation', cxLink ) );
+   }
} else {
$header.find( '.cx-header__translation-center a' 
).text( mw.msg( 'cx-header-new-translation' ) );
}
diff --git a/specials/SpecialContentTranslation.php 
b/specials/SpecialContentTranslation.php
index 5163566..c65850a 100644
--- a/specials/SpecialContentTranslation.php
+++ b/specials/SpecialContentTranslation.php
@@ -36,6 +36,10 @@
public function isValidCampaign( $campaign ) {
global $wgContentTranslationCampaigns;
 
+   if (  $this-getUser()-isAnon() ) {
+   // Campigns are only for logged in users.
+   return false;
+   }
return $campaign !== null  in_array( $campaign, 
$wgContentTranslationCampaigns );
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0365d1366fcf5c62193f878c1e73435d9b4c0b98
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Add anon user check to ApiQueryContentTranslation - change (mediawiki...ContentTranslation)

2015-05-22 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Add anon user check to ApiQueryContentTranslation
..

Add anon user check to ApiQueryContentTranslation

Change-Id: I49bce93f91ce1bdceafd0148b462a7076b81b382
---
M api/ApiQueryContentTranslation.php
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/78/212778/1

diff --git a/api/ApiQueryContentTranslation.php 
b/api/ApiQueryContentTranslation.php
index 799f449..55bb5d0 100644
--- a/api/ApiQueryContentTranslation.php
+++ b/api/ApiQueryContentTranslation.php
@@ -35,6 +35,10 @@
$result = $this-getResult();
$user = $this-getUser();
 
+   if ( $user-isAnon() ) {
+   $this-dieUsage( 'To view your translations, you must 
log in', 'notloggedin' );
+   }
+
if ( $params['sourcetitle']  $params['from']  $params['to'] 
) {
return $this-find(
$params['sourcetitle'],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I49bce93f91ce1bdceafd0148b462a7076b81b382
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Source selector: Relax the validations on source title - change (mediawiki...ContentTranslation)

2015-05-21 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Source selector: Relax the validations on source title
..

Source selector: Relax the validations on source title

Since we have a pageselector, and it works on prefix search,
validating title on every input event does not make sense.
Most of the time we might be doing a validation on the prefix.
Showing error message everytime the pageselector is open is not good.

Following changes are made:
* Enable the translate button as soon as the user type something as
  a gesture of invitation.
* Make sure the validations are done when you press the translate button
  even if we missed to validate in any previous events.
* Do not do validations when user type something on source title input.
  User will most likely select something from pageselector, which is a
  valid title for sure.
* If the user did not select anything from page selector, but typed some
  random title, the translate button press will catch it. Or the validation
  for target title will include the validation for this wrong source title.

In effect, less frequent validations and therefore less number of API hits for
source title. Showing lot of errors or warnings are not good while we trust the
user to select a meaningful source title. Ultimately the translate button will
capture anything missed to validate.

Change-Id: I3725e6493de63c1b06e429ce9832601aa680cbff
---
M modules/source/ext.cx.source.selector.js
1 file changed, 13 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/48/212748/1

diff --git a/modules/source/ext.cx.source.selector.js 
b/modules/source/ext.cx.source.selector.js
index 8c0f3e9..a53a02c 100644
--- a/modules/source/ext.cx.source.selector.js
+++ b/modules/source/ext.cx.source.selector.js
@@ -231,7 +231,7 @@
 
// Don't let the target be the same as source
sourceLanguage = this.getSourceLanguage();
-   targetLanguageCodes = jQuery.grep( this.targetLanguages, 
function( language ) {
+   targetLanguageCodes = jQuery.grep( this.targetLanguages, 
function ( language ) {
return language !== sourceLanguage;
} );
 
@@ -259,14 +259,19 @@
 * Listen for events.
 */
CXSourceSelector.prototype.listen = function () {
+   var self = this;
// Open or close the dialog when clicking the link.
// The dialog will be unitialized until the first click.
this.$trigger.click( $.proxy( this.show, this ) );
 
-   // Source title input or target title input, input or search 
(check)
-   this.$dialog.on(
-   'input blur',
-   '.cx-sourceselector-dialog__title',
+   this.$sourceTitleInput.on( 'input', function () {
+   self.$translateFromButton.prop( 'disabled', false );
+   // Hide any previous errors.
+   self.$messageBar.hide();
+   } );
+
+   // Target title input (check)
+   this.$targetTitleInput.on( 'input blur',
$.debounce( 600, false, $.proxy( this.check, this ) )
);
 
@@ -708,8 +713,9 @@
 * Does nothing if source page does not exist.
 */
CXSourceSelector.prototype.startPageInCX = function () {
-   var targetTitle, originalSourceTitle, sourceLanguage, 
targetLanguage, siteMapper;
+   var targetTitle, originalSourceTitle, sourceLanguage, 
targetLanguage, siteMapper, selector;
 
+   selector = this;
siteMapper = this.siteMapper;
sourceLanguage = this.getSourceLanguage();
targetLanguage = this.getTargetLanguage();
@@ -721,6 +727,7 @@
originalSourceTitle
).done( function ( sourceTitle ) {
if ( sourceTitle === false ) {
+   selector.showSourceTitleError( sourceLanguage );
return;
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3725e6493de63c1b06e429ce9832601aa680cbff
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] cxserver should use valid language codes - change (mediawiki...cxserver)

2015-05-20 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: cxserver should use valid language codes
..

cxserver should use valid language codes

To avoid all confusions, do not mix up valid MW content language codes and
language codes in the Wiki domains.

For example, bho is a valid content language while bh is not. bh is
used in the domain of bh.wikipedia.org

cxserver should never use language codes in the domain names.

Change-Id: I687e66967b0762b0decaec92261818748c43ce86
---
M config.defaults.js
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/01/212501/1

diff --git a/config.defaults.js b/config.defaults.js
index c281be0..3700355 100644
--- a/config.defaults.js
+++ b/config.defaults.js
@@ -23,8 +23,8 @@
cert: null,
// Service registry
registry: {
-   source: [ 'aa', 'ab', 'ace', 'af', 'ak', 'als', 'am', 'ang', 
'an', 'arc', 'ar', 'arz', 'ast', 'as', 'av', 'ay', 'az', 'bar', 'bat-smg', 
'ba', 'bcl', 'be-x-old', 'be', 'bg', 'bh', 'bi', 'bjn', 'bm', 'bn', 'bo', 
'bpy', 'br', 'bs', 'bug', 'bxr', 'ca', 'cbk-zam', 'cdo', 'ceb', 'ce', 'cho', 
'chr', 'ch', 'chy', 'ckb', 'co', 'crh', 'cr', 'csb', 'cs', 'cu', 'cv', 'cy', 
'da', 'de', 'diq', 'dsb', 'dv', 'dz', 'ee', 'el', 'eml', 'en', 'eo', 'es', 
'et', 'eu', 'ext', 'fa', 'ff', 'fiu-vro', 'fi', 'fj', 'fo', 'frp', 'frr', 'fr', 
'fur', 'fy', 'gag', 'gan', 'ga', 'gd', 'glk', 'gl', 'gn', 'got', 'gu', 'gv', 
'hak', 'ha', 'haw', 'he', 'hif', 'hi', 'ho', 'hr', 'hsb', 'ht', 'hu', 'hy', 
'hz', 'ia', 'id', 'ie', 'ig', 'ii', 'ik', 'ilo', 'io', 'is', 'it', 'iu', 'ja', 
'jbo', 'jv', 'kaa', 'kab', 'ka', 'kbd', 'kg', 'ki', 'kj', 'kk', 'kl', 'km', 
'kn', 'koi', 'ko', 'krc', 'kr', 'ksh', 'ks', 'ku', 'kv', 'kw', 'ky', 'lad', 
'la', 'lbe', 'lb', 'lez', 'lg', 'lij', 'li', 'lmo', 'ln', 'lo', 'ltg', 'lt', 
'lv', 'mai', 'map-bms', 'mdf', 'mg', 'mhr', 'mh', 'min', 'mi', 'mk', 'ml', 
'mn', 'mo', 'mrj', 'mr', 'ms', 'mt', 'mus', 'mwl', 'myv', 'my', 'mzn', 'nah', 
'nap', 'na', 'nds-nl', 'nds', 'ne', 'new', 'ng', 'nl', 'nn', 'nov', 'no', 
'nrm', 'nso', 'nv', 'ny', 'oc', 'om', 'or', 'os', 'pag', 'pam', 'pap', 'pa', 
'pcd', 'pdc', 'pfl', 'pih', 'pi', 'pl', 'pms', 'pnb', 'pnt', 'ps', 'pt', 'qu', 
'rm', 'rmy', 'rn', 'roa-rup', 'roa-tara', 'ro', 'rue', 'ru', 'rw', 'sah', 'sa', 
'scn', 'sco', 'sc', 'sd', 'se', 'sg', 'sh', 'simple', 'si', 'sk', 'sl', 'sm', 
'sn', 'so', 'sq', 'srn', 'sr', 'ss', 'stq', 'st', 'su', 'sv', 'sw', 'szl', 
'ta', 'tet', 'te', 'tg', 'th', 'ti', 'tk', 'tl', 'tn', 'to', 'tpi', 'tr', 'ts', 
'tt', 'tum', 'tw', 'tyv', 'ty', 'udm', 'ug', 'uk', 'ur', 'uz', 'vec', 'vep', 
've', 'vi', 'vls', 'vo', 'war', 'wa', 'wo', 'wuu', 'xal', 'xh', 'xmf', 'yi', 
'yo', 'za', 'zea', 'zh-classical', 'zh-min-nan', 'zh-yue', 'zh', 'zu' ],
-   target: [ 'aa', 'ab', 'ace', 'af', 'ak', 'als', 'am', 'ang', 
'an', 'arc', 'ar', 'arz', 'ast', 'as', 'av', 'ay', 'az', 'bar', 'bat-smg', 
'ba', 'bcl', 'be-x-old', 'be', 'bg', 'bh', 'bi', 'bjn', 'bm', 'bn', 'bo', 
'bpy', 'br', 'bs', 'bug', 'bxr', 'ca', 'cbk-zam', 'cdo', 'ceb', 'ce', 'cho', 
'chr', 'ch', 'chy', 'ckb', 'co', 'crh', 'cr', 'csb', 'cs', 'cu', 'cv', 'cy', 
'da', 'de', 'diq', 'dsb', 'dv', 'dz', 'ee', 'el', 'eml', 'en', 'eo', 'es', 
'et', 'eu', 'ext', 'fa', 'ff', 'fiu-vro', 'fi', 'fj', 'fo', 'frp', 'frr', 'fr', 
'fur', 'fy', 'gag', 'gan', 'ga', 'gd', 'glk', 'gl', 'gn', 'got', 'gu', 'gv', 
'hak', 'ha', 'haw', 'he', 'hif', 'hi', 'ho', 'hr', 'hsb', 'ht', 'hu', 'hy', 
'hz', 'ia', 'id', 'ie', 'ig', 'ii', 'ik', 'ilo', 'io', 'is', 'it', 'iu', 'ja', 
'jbo', 'jv', 'kaa', 'kab', 'ka', 'kbd', 'kg', 'ki', 'kj', 'kk', 'kl', 'km', 
'kn', 'koi', 'ko', 'krc', 'kr', 'ksh', 'ks', 'ku', 'kv', 'kw', 'ky', 'lad', 
'la', 'lbe', 'lb', 'lez', 'lg', 'lij', 'li', 'lmo', 'ln', 'lo', 'ltg', 'lt', 
'lv', 'mai', 'map-bms', 'mdf', 'mg', 'mhr', 'mh', 'min', 'mi', 'mk', 'ml', 
'mn', 'mo', 'mrj', 'mr', 'ms', 'mt', 'mus', 'mwl', 'myv', 'my', 'mzn', 'nah', 
'nap', 'na', 'nds-nl', 'nds', 'ne', 'new', 'ng', 'nl', 'nn', 'nov', 'no', 
'nrm', 'nso', 'nv', 'ny', 'oc', 'om', 'or', 'os', 'pag', 'pam', 'pap', 'pa', 
'pcd', 'pdc', 'pfl', 'pih', 'pi', 'pl', 'pms', 'pnb', 'pnt', 'ps', 'pt', 'qu', 
'rm', 'rmy', 'rn', 'roa-rup', 'roa-tara', 'ro', 'rue', 'ru', 'rw', 'sah', 'sa', 
'scn', 'sco', 'sc', 'sd', 'se', 'sg', 'sh', 'simple', 'si', 'sk', 'sl', 'sm', 
'sn', 'so', 'sq', 'srn', 'sr', 'ss', 'stq', 'st', 'su', 'sv', 'sw', 'szl', 
'ta', 'tet', 'te', 'tg', 'th', 'ti', 'tk', 'tl', 'tn', 'to', 'tpi', 'tr', 'ts', 
'tt', 'tum', 'tw', 'tyv', 'ty', 'udm', 'ug', 'uk', 'ur', 'uz', 'vec', 'vep', 
've', 'vi', 'vls', 'vo', 'war', 'wa', 'wo', 'wuu', 'xal', 'xh', 'xmf', 'yi', 
'yo', 'za', 'zea', 'zh-classical', 'zh-min-nan', 'zh-yue', 'zh', 'zu' ],
+   source: [ 'aa', 'ab', 'ace', 'af', 'ak', 'als', 'am', 'ang', 
'an', 'arc', 'ar', 'arz', 'ast', 'as', 'av', 

[MediaWiki-commits] [Gerrit] Update contributions menu to use latest callout widget - change (mediawiki...ContentTranslation)

2015-05-15 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Update contributions menu to use latest callout widget
..

Update contributions menu to use latest callout widget

Change-Id: Ia5856bd4f657469a4ac6ca4a3b6b622354206751
---
M modules/campaigns/ext.cx.campaigns.contributionsmenu.js
1 file changed, 7 insertions(+), 21 deletions(-)


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

diff --git a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js 
b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
index 051477f..7921414 100644
--- a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
+++ b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
@@ -89,36 +89,22 @@
.append( $myContributions, $myTranslations, $myUploads 
);
 
$trigger.callout( {
-   trigger: 'manual',
+   trigger: 'hover',
classes: 'cx-campaign-contributionsmenu',
-   gravity: $.fn.callout.autoNEW,
+   direction: $.fn.callout.autoDirection( '1' ),
content: $menu
} );
 
callout = $trigger.data( 'callout' );
 
-   function hide() {
-   callout.hide();
-   }
-
-   function show() {
-   callout.show();
-   callout.$dialog.one( 'mouseleave', hide );
-   $( document ).one( 'click', hide );
-   // Not measuring the shown menu events because the 
trigger is 'hover'
-   // and there will be a lot of them.
-   // But it can be easily tracked if somebody uses it to 
reach CX.
-   }
-
-   function ctaShow() {
+   mw.hook( 'mw.cx.betafeature.enabled' ).add( function () {
// Show after a few milliseconds to get all position 
calculation correct
-   setTimeout( show, 500 );
+   setTimeout( function () {
+   callout.show();
+   }, 500 );
mw.hook( 'mw.cx.cta.shown' ).fire( campaign );
-   }
+   } );
 
-   $trigger.on( 'mouseover', show );
-
-   mw.hook( 'mw.cx.betafeature.enabled' ).add( ctaShow );
}
 
$( function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia5856bd4f657469a4ac6ca4a3b6b622354206751
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Callout widget: Fix a change lost in rebase - change (mediawiki...ContentTranslation)

2015-05-15 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Callout widget: Fix a change lost in rebase
..

Callout widget: Fix a change lost in rebase

Change-Id: I759fccb4195d44c845a33c4a4adc0e2d941d9121
---
M modules/widgets/callout/ext.cx.callout.js
1 file changed, 48 insertions(+), 24 deletions(-)


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

diff --git a/modules/widgets/callout/ext.cx.callout.js 
b/modules/widgets/callout/ext.cx.callout.js
index 78b91d2..757747c 100644
--- a/modules/widgets/callout/ext.cx.callout.js
+++ b/modules/widgets/callout/ext.cx.callout.js
@@ -1,9 +1,7 @@
 /**
  * A Callout dialog widget with jQuery.
  * Copyright (c) 2015 Santhosh Thottingal santhosh.thottin...@gmail.com
- * released under the MIT license MIT License.
- *
- * Borrows positioning concepts from Tipsy by Jason Frame
+ * released under the MIT license.
  */
 ( function ( $ ) {
'use strict';
@@ -17,6 +15,39 @@
 
/**
 * Callout class
+*
+* @param {HTMLElement} element The trigger element to which callout 
attaches.
+* @param {Object} options Options object
+* @param {String|Function} options.direction Direction of callout.
+* Imagine the callout is along with the direction of a clock 
handle with the tip at top of
+* the handle.
+* 11  12  1
+* 
+* 10 || 2
+* 9  |.   | 3
+* 8  || 4
+* 7  6   5
+* Possible directions are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12.
+* Direction 12 is same as position 0.
+* It is also possible to give a preferred direction using 
$.fn.callout.autoDirection
+* Example: $.fn.callout.autoDirection( '0' )
+* This will make the callout below the trigger with its tip 
pointing upwards
+**
+* __/\__
+* | |
+* ___
+* This will make the callout left of the trigger with its tip 
pointing 3'O clock direction
+* Example: $.fn.callout.autoDirection( '0' )
+*  __
+*  | |
+*  |   *
+*  |_|
+* Auto direction will change direction if screen space is not 
available.
+* @param {Number} options.offset Offset of the dialog from the trigger
+* @param {Number} options.opacity Opacity of callout
+* @param {String} options.trigger Trigger: available options: hover, 
click,
+* and auto(show automatically without any trigger).
+* Any other value will assume the client of this libary will take 
care of show/hide
 */
function Callout( element, options ) {
this.$element = $( element );
@@ -38,10 +69,6 @@
 
$dialog = this.dialog();
$dialog.find( '.cx-callout-content' ).empty().append( content );
-   $dialog[ 0 ].className = 'cx-callout'; // reset classname in 
case of dynamic type
-   if ( this.options.classes ) {
-   $dialog.addClass( this.options.classes );
-   }
$dialog.remove().css( {
top: 0,
left: 0,
@@ -80,11 +107,15 @@
} );
 
$dialog = this.dialog();
-   direction = $.isFunction( this.options.direction ) ? 
this.options.direction.call( this.$element[ 0 ] ) : this.options.direction;
+   direction = $.isFunction( this.options.direction ) ?
+   this.options.direction.call( this.$element[ 0 ] ) :
+   this.options.direction;
// Attach css classes before checking height/width so they
// can be applied.
$dialog.removeClass().addClass( 'cx-callout cx-callout-' + 
direction );
-
+   if ( this.options.classes ) {
+   $dialog.addClass( this.options.classes );
+   }
actualWidth = $dialog[ 0 ].offsetWidth;
actualHeight = $dialog[ 0 ].offsetHeight;
switch ( direction ) {
@@ -179,9 +210,8 @@
if ( this.options.trigger === 'hover' ) {
this.$element.on( 'mouseenter', function () {
self.show();
-   } );
-   this.$element.on( 'mouseleave', function () {
-   self.hide();
+   self.$dialog.one( 'mouseleave', $.proxy( 
self.hide, self ) );
+   $( document ).one( 'click', $.proxy( self.hide, 
self ) );
} );
}
  

[MediaWiki-commits] [Gerrit] RESTBase URL: Use different placeholder name for title and lang - change (mediawiki...cxserver)

2015-05-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: RESTBase URL: Use different placeholder name for title and lang
..

RESTBase URL: Use different placeholder name for title and lang

Placeholders like $title can potentially cause conflicts with
puppet variables. So using @title, @lang

Follow up: https://gerrit.wikimedia.org/r/#/c/207039/

Bug: T92359
Change-Id: I3f8a939b44370606015668c29bb5fa1eb015f18c
---
M config.defaults.js
M pageloader/PageLoader.js
2 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/79/209679/1

diff --git a/config.defaults.js b/config.defaults.js
index 911a480..5b2fdce 100644
--- a/config.defaults.js
+++ b/config.defaults.js
@@ -10,7 +10,7 @@
allowCORS: '*',
// Parsoid API URL
'parsoid.api': 'http://parsoid-lb.eqiad.wikimedia.org',
-   'restbase.url': 
'https://$lang.wikipedia.org/api/rest_v1/page/html/$title',
+   'restbase.url': 
'https://@lang.wikipedia.org/api/rest_v1/page/html/@title',
// Apertium web API URL
'mt.apertium.api': 'http://apertium.wmflabs.org',
'mt.yandex.api': 'https://translate.yandex.net',
diff --git a/pageloader/PageLoader.js b/pageloader/PageLoader.js
index 2f985ed..890d9d3 100644
--- a/pageloader/PageLoader.js
+++ b/pageloader/PageLoader.js
@@ -50,8 +50,8 @@
 
if ( conf( 'restbase.url' ) ) {
url = conf( 'restbase.url' )
-   .replace( '$lang', this.sourceLanguage )
-   .replace( '$title', encodeURIComponent( this.page ) );
+   .replace( '@lang', this.sourceLanguage )
+   .replace( '@title', encodeURIComponent( this.page ) );
} else {
url = conf( 'parsoid.api' ) + '/' + this.sourceLanguage + 
'wiki/' +
encodeURIComponent( this.page );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f8a939b44370606015668c29bb5fa1eb015f18c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP] Use bunyan logging so that we can log to logstash by g... - change (mediawiki...cxserver)

2015-05-06 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: [WIP] Use bunyan logging so that we can log to logstash by 
gelf-stream
..

[WIP] Use bunyan logging so that we can log to logstash by gelf-stream

Change-Id: If4cea7fe90d72dedd6420fb0a6d8721b4b7598c3
---
M config.defaults.js
M package.json
M routes/v1.js
M utils/Logger.js
4 files changed, 45 insertions(+), 38 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/77/209177/1

diff --git a/config.defaults.js b/config.defaults.js
index 7655532..5656b54 100644
--- a/config.defaults.js
+++ b/config.defaults.js
@@ -4,8 +4,21 @@
// CX Server port
port: 8080,
proxy: null,
-   // Log directory
-   logDir: 'log',
+   logging: {
+   name: 'cxserver',
+   streams: [
+   {
+   //Use gelf-stream - logstash
+   type: 'gelf',
+   host: 'logstash1003.eqiad.wmnet',
+   port: 12201,
+   },
+   {
+   level: 'debug',
+   stream: process.stdout // log INFO and above to 
stdout
+   }
+   ]
+   },
// Accept requests from the given domains. * for all domains.
allowCORS: '*',
// Parsoid API URL
diff --git a/package.json b/package.json
index 9fa4737..fe2b285 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,11 @@
sax: 0.6.0,
winston: *,
html-entities: 1.0.10,
-   yargs: ~1.3.1
+   yargs: ~1.3.1,
+   bluebird: ~2.2.2,
+   bunyan: ^1.3.3,
+   extend: ^1.3.0,
+   gelf-stream: ^0.2.4
},
devDependencies: {
assert: 1.1.1,
diff --git a/routes/v1.js b/routes/v1.js
index 5429c37..f782c7b 100644
--- a/routes/v1.js
+++ b/routes/v1.js
@@ -11,20 +11,18 @@
PageLoader = require( __dirname + 
'/../pageloader/PageLoader.js' ).PageLoader,
pageloader = new PageLoader( title, sourceLanguage );
 
-   logger.profile( 'Fetch page' );
pageloader.load().then(
function ( response ) {
var segmenter, segmentedContent;
try {
-   logger.profile( 'Fetch page', {
+   logger.debug( 'Fetch page', {
title: title,
sourceLanguage: sourceLanguage
} );
-   logger.profile( 'Segment page' );
segmenter = new CXSegmenter( response.body, 
sourceLanguage );
segmenter.segment();
segmentedContent = 
segmenter.getSegmentedContent();
-   logger.profile( 'Segment page', {
+   logger.debug( 'Segment page', {
title: title,
sourceLanguage: sourceLanguage
} );
@@ -104,7 +102,6 @@
sourceHtmlChunks.push( '/div' );
sourceHtml = sourceHtmlChunks.join( '' );
 
-   logger.profile( 'MT' );
mtClient.translate( from, to, sourceHtml ).then(
function ( data ) {
// Prevent XSS by sending json with
@@ -119,7 +116,7 @@
.replace( //g, '\\u003E' );
res.type( 'application/json' );
res.send( json );
-   logger.profile( 'MT', {
+   logger.debug( 'MT', {
from: from,
to: to
} );
@@ -151,11 +148,10 @@
dictClients = require( __dirname + '/../dictionary/' );
dictClient = dictClients[ provider ];
 
-   logger.profile( 'Dictionary lookup' );
dictClient.getTranslations( word, from, to ).then(
function ( data ) {
res.send( data );
-   logger.profile( 'Dictionary lookup', {
+   logger.debug( 'Dictionary lookup', {
word: word,
from: from,
to: to
diff --git a/utils/Logger.js b/utils/Logger.js
index 3a9b9c9..decf1c7 100644
--- a/utils/Logger.js
+++ b/utils/Logger.js
@@ -1,34 +1,28 @@
-var winston = require( 'winston' ),
-   fs = require( 'fs' ),
+var bunyan = 

[MediaWiki-commits] [Gerrit] Prevent Alt+S being consumed by CX - change (mediawiki...ContentTranslation)

2015-05-05 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Prevent Alt+S being consumed by CX
..

Prevent Alt+S being consumed by CX

See 
https://medium.com/medium-eng/the-curious-case-of-disappearing-polish-s-fa398313d4df
Also removed redundant e.preventDefault since
the handler is already returning false

Change-Id: I5b5571f8a5c3e5101583cf56837f8f7c4f4722da
---
M modules/draft/ext.cx.draft.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index bd23623..a3689b9 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -77,8 +77,8 @@
 
// Save when CTRL+S is pressed.
$( document ).on( 'keydown', function ( e ) {
-   if ( e.ctrlKey  e.which === 83 ) {
-   e.preventDefault();
+   // See 
https://medium.com/medium-eng/the-curious-case-of-disappearing-polish-s-fa398313d4df
+   if ( ( e.metaKey || e.ctrlKey  !e.altKey )  e.which 
=== 83 ) {
checkAndsave();
return false;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b5571f8a5c3e5101583cf56837f8f7c4f4722da
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Chrome does not show list formatting tools - change (mediawiki...ContentTranslation)

2015-05-03 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Chrome does not show list formatting tools
..

Chrome does not show list formatting tools

Regression from https://gerrit.wikimedia.org/r/#/c/207421/

Bug: T97965
Change-Id: I83348fd9db9d3a8b81bf35d76e34fdac7fb105be
---
M modules/tools/ext.cx.tools.formatter.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.formatter.js 
b/modules/tools/ext.cx.tools.formatter.js
index 404277d..11531fb 100644
--- a/modules/tools/ext.cx.tools.formatter.js
+++ b/modules/tools/ext.cx.tools.formatter.js
@@ -40,7 +40,7 @@
unorderedlist: this.$card.find( 
'.card__format--unorderedlist' )
};
 
-   if ( window.chrome ) {
+   if ( !window.chrome ) {
// Following controls work only in Chrome.
this.$buttons.orderedlist.hide();
this.$buttons.unorderedlist.hide();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83348fd9db9d3a8b81bf35d76e34fdac7fb105be
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Change the color of interlanguage entry points to grey - change (mediawiki...ContentTranslation)

2015-04-30 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Change the color of interlanguage entry points to grey
..

Change the color of interlanguage entry points to grey

Also rename the module from ext.cx.redlink to
ext.cx.interlanguagelink

Bug: T96547
Change-Id: I00580f56c2ada58896658cde434188f6ca9bb2aa
---
M ContentTranslation.hooks.php
M Resources.php
R modules/entrypoint/ext.cx.interlanguagelink.js
R modules/entrypoint/styles/ext.cx.interlanguagelink.less
4 files changed, 10 insertions(+), 10 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/43/207743/1

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index ab6237a..7b042c7 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -56,7 +56,7 @@
if ( $title-inNamespace( NS_MAIN ) 
$title-exists()
) {
-   $out-addModules( 'ext.cx.redlink' );
+   $out-addModules( 'ext.cx.interlanguagelink' );
}
 
// Add a hover menu for the contributions link in personal 
toolbar
diff --git a/Resources.php b/Resources.php
index 906f6a7..b49f6dc 100644
--- a/Resources.php
+++ b/Resources.php
@@ -556,9 +556,9 @@
),
 ) + $resourcePaths;
 
-$wgResourceModules['ext.cx.redlink'] = array(
-   'scripts' = 'entrypoint/ext.cx.redlink.js',
-   'styles' = 'entrypoint/styles/ext.cx.redlink.less',
+$wgResourceModules['ext.cx.interlanguagelink'] = array(
+   'scripts' = 'entrypoint/ext.cx.interlanguagelink.js',
+   'styles' = 'entrypoint/styles/ext.cx.interlanguagelink.less',
'messages' = array(
'cx-entrypoint-title',
),
diff --git a/modules/entrypoint/ext.cx.redlink.js 
b/modules/entrypoint/ext.cx.interlanguagelink.js
similarity index 94%
rename from modules/entrypoint/ext.cx.redlink.js
rename to modules/entrypoint/ext.cx.interlanguagelink.js
index d2a652b..64a2a86 100644
--- a/modules/entrypoint/ext.cx.redlink.js
+++ b/modules/entrypoint/ext.cx.interlanguagelink.js
@@ -11,7 +11,7 @@
 ( function ( $, mw ) {
'use strict';
 
-   var campaign = 'redinterlanguagelink';
+   var campaign = 'interlanguagelink';
/**
 * Get the list of target languages that should be suggested
 * to the current user:
@@ -100,7 +100,7 @@
return $( 'li.interlanguage-link.interwiki-' + code ).length 
=== 1;
}
 
-   function createRedInterlanguageItem( code ) {
+   function createCXInterlanguageItem( code ) {
var $link, $item, autonym;
 
// Optimization: if it's just the user language,
@@ -134,7 +134,7 @@
return $item;
}
 
-   function prepareRedInterLanguageLinks( availableTargetLanguages ) {
+   function prepareCXInterLanguageLinks( availableTargetLanguages ) {
var $newItem, $pLangList, dependencies, 
suggestedTargetLanguages;
 
suggestedTargetLanguages = getSuggestedTargetLanguages( 
availableTargetLanguages );
@@ -160,7 +160,7 @@
$pLangList = $( '#p-lang ul' );
$.each( suggestedTargetLanguages, function ( i, code ) {
if ( !pageInLanguageExists( code ) ) {
-   $newItem = createRedInterlanguageItem( 
code );
+   $newItem = createCXInterlanguageItem( 
code );
$pLangList.prepend( $newItem );
$newItem.cxEntryPoint( {
targetLanguage: code,
@@ -174,7 +174,7 @@
 
$( function () {
getAvailableTargetLanguages().then( function ( 
availableTargetLanguages ) {
-   prepareRedInterLanguageLinks( availableTargetLanguages 
);
+   prepareCXInterLanguageLinks( availableTargetLanguages );
} );
} );
 }( jQuery, mediaWiki ) );
diff --git a/modules/entrypoint/styles/ext.cx.redlink.less 
b/modules/entrypoint/styles/ext.cx.interlanguagelink.less
similarity index 89%
rename from modules/entrypoint/styles/ext.cx.redlink.less
rename to modules/entrypoint/styles/ext.cx.interlanguagelink.less
index 0d78924..593736d 100644
--- a/modules/entrypoint/styles/ext.cx.redlink.less
+++ b/modules/entrypoint/styles/ext.cx.interlanguagelink.less
@@ -1,4 +1,4 @@
 /* Very specific selector to override core's nav bar link style */
 div#mw-panel div.portal div.body ul li.cx-new-interlanguage-link a.new {
-   color: #BA;
+   color: #777;
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: 

[MediaWiki-commits] [Gerrit] Enable formatting toolbar for non-Chrome browsers - change (mediawiki...ContentTranslation)

2015-04-29 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Enable formatting toolbar for non-Chrome browsers
..

Enable formatting toolbar for non-Chrome browsers

* Hide the list tools - they dont work sensibly outside chrome
* Avoid animating the formatting toolbar
* Remove the 'beta' url param hack
* Avoid js error while executing document.queryCommandState by
  checking document.queryCommandEnabled

Change-Id: I66a5dd675abe588209eaa1487c30d7664313ab3a
---
M modules/tools/ext.cx.tools.formatter.js
M modules/tools/styles/ext.cx.tools.formatter.less
2 files changed, 16 insertions(+), 14 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/21/207421/1

diff --git a/modules/tools/ext.cx.tools.formatter.js 
b/modules/tools/ext.cx.tools.formatter.js
index 2e2cd4a..e3722b9 100644
--- a/modules/tools/ext.cx.tools.formatter.js
+++ b/modules/tools/ext.cx.tools.formatter.js
@@ -39,18 +39,29 @@
orderedlist: this.$card.find( 
'.card__format--orderedlist' ),
unorderedlist: this.$card.find( 
'.card__format--unorderedlist' )
};
+
+   if ( window.chrome ) {
+   // Following controls work only in Chrome.
+   this.$buttons.orderedlist.hide();
+   this.$buttons.unorderedlist.hide();
+   }
+
this.$card.hide();
};
+
+   function getState( command ) {
+   return document.queryCommandEnabled( command )  
document.queryCommandState( command );
+   }
 
/**
 * Show the card.
 */
FormatTool.prototype.show = function () {
// Highlight the buttons based on the current state of the 
selection
-   this.$buttons.bold.toggleClass( 'highlight', 
document.queryCommandState( 'bold' ) );
-   this.$buttons.italic.toggleClass( 'highlight', 
document.queryCommandState( 'italic' ) );
-   this.$buttons.orderedlist.toggleClass( 'highlight', 
document.queryCommandState( 'insertOrderedList' ) );
-   this.$buttons.unorderedlist.toggleClass( 'highlight', 
document.queryCommandState( 'insertUnorderedList' ) );
+   this.$buttons.bold.toggleClass( 'highlight', getState( 'bold' ) 
);
+   this.$buttons.italic.toggleClass( 'highlight', getState( 
'italic' ) );
+   this.$buttons.orderedlist.toggleClass( 'highlight', getState( 
'insertOrderedList' ) );
+   this.$buttons.unorderedlist.toggleClass( 'highlight', getState( 
'insertUnorderedList' ) );
this.$card.show();
this.onShow();
};
@@ -182,14 +193,7 @@
// Capture the selection
mw.cx.selection.save( 'format', mw.cx.selection.get() );
this.listen();
-
-   // Format tool is shown only in Chrome. It is show in other 
browsers
-   // if URL hash contains beta
-   if ( window.chrome || location.hash.match( /beta/ ) ) {
-   this.show();
-   } else {
-   this.stop();
-   }
+   this.show();
};
 
FormatTool.prototype.stop = function () {
diff --git a/modules/tools/styles/ext.cx.tools.formatter.less 
b/modules/tools/styles/ext.cx.tools.formatter.less
index d47d886..e71e609 100644
--- a/modules/tools/styles/ext.cx.tools.formatter.less
+++ b/modules/tools/styles/ext.cx.tools.formatter.less
@@ -1,8 +1,6 @@
 @import mediawiki.mixins;
 
 .card__format {
-   animation-name: card-show-animation;
-   animation-duration: 0.5s;
position: relative;
min-height: 30px;
padding: 5px;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66a5dd675abe588209eaa1487c30d7664313ab3a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Refactor the drafts module and fix a bug about saving empty ... - change (mediawiki...ContentTranslation)

2015-04-29 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Refactor the drafts module and fix a bug about saving empty 
content
..

Refactor the drafts module and fix a bug about saving empty content

Introduced getContent method.

Bug: T97505
Change-Id: I70ae6c63440df47ff92480e7178e89b067581dcc
---
M modules/draft/ext.cx.draft.js
1 file changed, 30 insertions(+), 29 deletions(-)


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

diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index fe2e8f6..6b82dbc 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -34,18 +34,41 @@
};
 
/**
+* Get the content to save. Clean up the content by removing
+* all unwanted classes and placeholders.
+* @return {String} HTML to save
+*/
+   ContentTranslationDraft.prototype.getContent = function () {
+   var $content;
+
+   $content = $( '.cx-column--translation .cx-column__content' 
).clone();
+   // Remove empty sections.
+   $content
+   .filter( function () {
+   return !$.trim( $( this ).text() )  $( this 
).children().length;
+   } )
+   .remove();
+   // Remove placeholder sections
+   $content.find( '.placeholder' ).remove();
+   // Remove all highlighting before saving
+   $content
+   .find( '.cx-highlight, .cx-highlight--blue, 
.cx-highlight--lightblue' )
+   .removeClass( 'cx-highlight cx-highlight--blue 
cx-highlight--lightblue' );
+
+   return $content.html();
+   };
+
+   /**
 * Event bindings
 */
ContentTranslationDraft.prototype.listen = function () {
-   var save;
-
-   save = function ( weights ) {
+   function save( weights ) {
if ( weights  weights.any === 0 || !mw.cx.dirty ) {
return;
}
 
mw.hook( 'mw.cx.translation.save' ).fire();
-   };
+   }
 
mw.hook( 'mw.cx.translation.save' ).add( $.proxy( this.save, 
this ) );
// Save the draft on progress events, but not in all progress
@@ -56,7 +79,7 @@
$( document ).on( 'keydown', function ( e ) {
if ( e.ctrlKey  e.which === 83 ) {
e.preventDefault();
-   mw.hook( 'mw.cx.translation.save' ).fire();
+   save();
return false;
}
} );
@@ -164,21 +187,20 @@
 * Save the translation
 */
ContentTranslationDraft.prototype.save = function () {
-   var draftContent, targetTitle, params, apiParams,
+   var targetTitle, params, apiParams,
api = new mw.Api();
 
if ( this.disabled ) {
return;
}
targetTitle = $( '.cx-column--translation  h2' ).text();
-   draftContent = $( '.cx-column--translation .cx-column__content' 
).clone();
clearInterval( timer );
params = {
from: mw.cx.sourceLanguage,
to: mw.cx.targetLanguage,
sourcetitle: mw.cx.sourceTitle,
title: targetTitle,
-   html: prepareTranslationForSave( draftContent ),
+   html: this.getContent(),
status: 'draft',
sourcerevision: mw.cx.sourceRevision,
progress: JSON.stringify( mw.cx.getProgress() )
@@ -203,27 +225,6 @@
mw.hook( 'mw.cx.error' ).fire( mw.msg( 
'cx-publish-page-error' ) );
} );
};
-
-   /**
-* Prepare the translated content for publishing by removing
-* unwanted parts.
-* @return {string} processed html
-*/
-   function prepareTranslationForSave( $content ) {
-   // Remove empty sections.
-   $content
-   .filter( function () {
-   return !$.trim( $( this ).text() )  $( this 
).children().length;
-   } )
-   .remove();
-   // Remove placeholder sections
-   $content.find( '.placeholder' ).remove();
-   // Remove all highlighting before saving
-   $content
-   .find( '.cx-highlight, .cx-highlight--blue, 
.cx-highlight--lightblue' )
- 

[MediaWiki-commits] [Gerrit] Fix JSCS errors - change (mediawiki...ContentTranslation)

2015-04-29 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix JSCS errors
..

Fix JSCS errors

Change-Id: I5b08fedffc453fe901bd2e174fa0523529568c37
---
M modules/entrypoint/ext.cx.contributions.js
M modules/entrypoint/ext.cx.redlink.js
M modules/eventlogging/ext.cx.eventlogging.js
3 files changed, 3 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/94/207394/1

diff --git a/modules/entrypoint/ext.cx.contributions.js 
b/modules/entrypoint/ext.cx.contributions.js
index 52c6717..ff022df 100644
--- a/modules/entrypoint/ext.cx.contributions.js
+++ b/modules/entrypoint/ext.cx.contributions.js
@@ -78,7 +78,7 @@
campaign: entrypointName
} ),
tooltip: mw.msg( 
'cx-contributions-translation-tooltip' )
-   },
+   }
];
};
 
diff --git a/modules/entrypoint/ext.cx.redlink.js 
b/modules/entrypoint/ext.cx.redlink.js
index a165fc3..d2a652b 100644
--- a/modules/entrypoint/ext.cx.redlink.js
+++ b/modules/entrypoint/ext.cx.redlink.js
@@ -39,7 +39,7 @@
// with normalized counterparts
specialCodes = {
// Suggest both varieties of Norwegian when requesting 
macro Norwegian
-   'no': [ 'nb', 'nn' ]
+   no: [ 'nb', 'nn' ]
};
 
for ( specialCode in specialCodes ) {
diff --git a/modules/eventlogging/ext.cx.eventlogging.js 
b/modules/eventlogging/ext.cx.eventlogging.js
index 5accd61..056c08c 100644
--- a/modules/eventlogging/ext.cx.eventlogging.js
+++ b/modules/eventlogging/ext.cx.eventlogging.js
@@ -34,7 +34,6 @@
mw.hook( 'mw.cx.cta.reject' ).add( $.proxy( 
this.ctaReject, this ) );
},
 
-
/**
 * Log creation of translated page.
 * @param {string} contentLanguage source language
@@ -145,7 +144,7 @@
sourceLanguage: sourceLanguage,
targetLanguage: targetLanguage,
sourceTitle: sourceTitle,
-   targetTitle: targetTitle,
+   targetTitle: targetTitle
} );
},
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b08fedffc453fe901bd2e174fa0523529568c37
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Update jquery.ime to v0.1.0+20150429 - change (mediawiki...UniversalLanguageSelector)

2015-04-29 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Update jquery.ime to v0.1.0+20150429
..

Update jquery.ime to v0.1.0+20150429

Bug: T88279
Change-Id: I89642bedd7b4bd7bebe45bc2ff3265f060adf6b1
---
M lib/jquery.ime/jquery.ime.js
M lib/jquery.ime/rules/bo/bo-ewts.js
2 files changed, 15 insertions(+), 4 deletions(-)


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

diff --git a/lib/jquery.ime/jquery.ime.js b/lib/jquery.ime/jquery.ime.js
index 5894b84..33a363e 100644
--- a/lib/jquery.ime/jquery.ime.js
+++ b/lib/jquery.ime/jquery.ime.js
@@ -1,4 +1,4 @@
-/*! jquery.ime - v0.1.0+20150106
+/*! jquery.ime - v0.1.0+20150429
 * https://github.com/wikimedia/jquery.ime
 * Copyright (c) 2015 Santhosh Thottingal; Licensed GPL, MIT */
 ( function ( $ ) {
@@ -535,6 +535,7 @@
end: end
} );
 
+   rangy.init();
selection = rangy.getSelection();
range = selection.getRangeAt( 0 );
 
@@ -599,7 +600,10 @@
end = 0,
foundStart = false,
foundEnd = false,
-   sel = rangy.getSelection();
+   sel;
+
+   rangy.init();
+   sel = rangy.getSelection();
 
function traverseTextNodes( node, range ) {
var i, childNodesCount;
@@ -2039,6 +2043,13 @@
name: 'ఇన్\u200dస్క్రిప్ట్ 2',
source: 'rules/te/te-inscript2.js'
},
+   'te-apple': {
+   name: 'ఆపిల్',
+   source: 'rules/te/te-apple.js'
+   },'te-modular': {
+   name: 'మాడ్యులర్',
+   source: 'rules/te/te-modular.js'
+   },
'te-transliteration': {
name: 'లిప్యంతరీకరణ',
source: 'rules/te/te-transliteration.js'
@@ -2456,7 +2467,7 @@
},
'te': {
autonym: 'తెలుగు',
-   inputmethods: [ 'te-transliteration', 'te-inscript', 
'te-inscript2' ]
+   inputmethods: [ 'te-transliteration', 'te-inscript', 
'te-inscript2', 'te-apple', 'te-modular' ]
},
'th': {
autonym: 'ไทย',
diff --git a/lib/jquery.ime/rules/bo/bo-ewts.js 
b/lib/jquery.ime/rules/bo/bo-ewts.js
index d390dac..094b335 100644
--- a/lib/jquery.ime/rules/bo/bo-ewts.js
+++ b/lib/jquery.ime/rules/bo/bo-ewts.js
@@ -57,7 +57,7 @@
 ['ལc', 'l', 'ལྕ'],
 ['ལj', 'l', 'ལྗ'],
 ['ལt', 'l', 'ལྟ'],
-['ལd', 'l', 'སྡ'],
+['ལd', 'l', 'ལྡ'],
 ['ལp', 'l', 'ལྤ'],
 ['ལb', 'l', 'ལྦ'],
 ['ལh', 'l', 'ལྷ'],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I89642bedd7b4bd7bebe45bc2ff3265f060adf6b1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] If URL contains any of titles or languages, fill and show so... - change (mediawiki...ContentTranslation)

2015-04-28 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: If URL contains any of titles or languages, fill and show 
source selector
..

If URL contains any of titles or languages, fill and show source selector

Currently we do that only when all parameters are present in URL

Bug: T91930
Change-Id: Ieba713cb716710177fc0efc4d024d78e4f36
---
M modules/source/ext.cx.source.selector.js
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/59/207059/1

diff --git a/modules/source/ext.cx.source.selector.js 
b/modules/source/ext.cx.source.selector.js
index 3525068..d928bfa 100644
--- a/modules/source/ext.cx.source.selector.js
+++ b/modules/source/ext.cx.source.selector.js
@@ -100,10 +100,10 @@
this.$targetTitleInput.val( this.options.targetTitle 
).trigger( 'input' );
}
 
-   // If all the values are already present,
+   // If any of the values are already present,
// show the dialog and initiate a validation.
-   if ( this.options.sourceLanguage  this.options.targetLanguage 

-   this.options.sourceTitle  this.options.targetTitle
+   if ( this.options.sourceLanguage || this.options.targetLanguage 
||
+   this.options.sourceTitle || this.options.targetTitle
) {
this.show();
this.check();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieba713cb716710177fc0efc4d024d78e4f36
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Set the CX token expiry to 1 hour - change (mediawiki...ContentTranslation)

2015-04-28 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Set the CX token expiry to 1 hour
..

Set the CX token expiry to 1 hour

5 mins expiry is a big annoyance for development/debugging. Every
5 minutes I need to go back and read the license agreement.
Increasing it to 1 hour is helpful

Change-Id: I3a2ba32dfe03d8dc4fad3eba303e62b437163271
---
M modules/base/ext.cx.sitemapper.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/85/207385/1

diff --git a/modules/base/ext.cx.sitemapper.js 
b/modules/base/ext.cx.sitemapper.js
index 0bb403f..8deaff8 100644
--- a/modules/base/ext.cx.sitemapper.js
+++ b/modules/base/ext.cx.sitemapper.js
@@ -164,7 +164,7 @@
path: mw.config.get( 'wgCookiePath' ),
// Use Domain cookie. Example: domain=.wikipedia.org
domain: domain,
-   expires: new Date( now.getTime() + ( 5 * 60 * 1000 ) ) 
// 5 mins from now.
+   expires: new Date( now.getTime() + ( 3600 * 1000 ) ) // 
1 hour from now.
};
 
// At this point, the translator saw the license agreement.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3a2ba32dfe03d8dc4fad3eba303e62b437163271
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Use Wikimedia REST API for accessing page data in Content Tr... - change (mediawiki...cxserver)

2015-04-28 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Use Wikimedia REST API for accessing page data in Content 
Translation
..

Use Wikimedia REST API for accessing page data in Content Translation

Bug: T92359
Change-Id: I85f5bf4005075326791c87cdadbaeac07316e03c
---
M config.defaults.js
M pageloader/PageLoader.js
2 files changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/39/207039/1

diff --git a/config.defaults.js b/config.defaults.js
index bb1b583..d84e6a7 100644
--- a/config.defaults.js
+++ b/config.defaults.js
@@ -10,6 +10,7 @@
allowCORS: '*',
// Parsoid API URL
'parsoid.api': 'http://parsoid-lb.eqiad.wikimedia.org',
+   'restbase.url': 
'https://rest.wikimedia.org/$lang.wikipedia.org/v1/page/html/$title',
// Apertium web API URL
'mt.apertium.api': 'http://apertium.wmflabs.org',
'mt.yandex.api': 'https://translate.yandex.net',
diff --git a/pageloader/PageLoader.js b/pageloader/PageLoader.js
index 49a9ac2..a31ca9f 100644
--- a/pageloader/PageLoader.js
+++ b/pageloader/PageLoader.js
@@ -28,9 +28,16 @@
var url,
deferred = Q.defer();
 
-   url = conf( 'parsoid.api' ) + '/' + this.sourceLanguage + 'wiki/' +
-   encodeURIComponent( this.page ) + '?body=1';
-
+   if ( conf( 'restbase.url' ) ) {
+   url = conf( 'restbase.url' )
+   .replace( '$lang', this.sourceLanguage )
+   .replace( '$title', encodeURIComponent( this.page ) );
+   // Restbase does not support body only retrieval of content
+   // See https://phabricator.wikimedia.org/T97395
+   } else {
+   url = conf( 'parsoid.api' ) + '/' + this.sourceLanguage + 
'wiki/' +
+   encodeURIComponent( this.page ) + '?body=1';
+   }
request( url,
function ( error, response, body ) {
if ( error ) {
@@ -44,6 +51,8 @@
 
deferred.resolve( {
body: response.body,
+   // Restbase does not give revision id, so 
following value will be undefined
+   // https://phabricator.wikimedia.org/T97393
revision: response.headers[ 
'content-revision-id' ]
} );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I85f5bf4005075326791c87cdadbaeac07316e03c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Make sure CX know the revision id - change (mediawiki...ContentTranslation)

2015-04-28 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Make sure CX know the revision id
..

Make sure CX know the revision id

This is to start supporting RESTBase page fetch(T92359)
till T97393 is fixed.

Bug: T97393
Change-Id: Ib15c15ff656212bbf1032d1f30d591c83d2997a8
---
M modules/source/ext.cx.source.js
1 file changed, 9 insertions(+), 0 deletions(-)


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

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index b767d61..b2d54a0 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -137,11 +137,20 @@
};
 
ContentTranslationSource.prototype.load = function ( content ) {
+   var revision;
+
this.$content.html( content.segmentedContent );
 
// @todo figure out what should be done here
this.$content.find( 'base' ).detach();
 
+   if ( !mw.cx.sourceRevision ) {
+   // Make sure we know the revision id.
+   // Restbase cannot give the revision id of the page we 
requested.
+   // TODO: Remove once 
https://phabricator.wikimedia.org/T97393 resolved.
+   revision = $( 'link[rel=dc:replaces]' ).attr( 
'resource' );
+   mw.cx.sourceRevision = revision  revision.split( '/' 
)[ 1 ];
+   }
mw.hook( 'mw.cx.source.ready' ).fire();
};
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib15c15ff656212bbf1032d1f30d591c83d2997a8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Special:CXStats - use same full screen layout of Special:CX - change (mediawiki...ContentTranslation)

2015-04-24 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Special:CXStats - use same full screen layout of Special:CX
..

Special:CXStats - use same full screen layout of Special:CX

Also add a campaign(id: cxstats) to enable CX beta feature for those
who did not enable it already.

All campaigns are with eventlogging tooling

Change-Id: Ic7eb77b36eb07e98bb10b5d5e883125a7802a1f4
---
M ContentTranslation.php
M Resources.php
M i18n/en.json
M i18n/qqq.json
M modules/stats/ext.cx.stats.js
M modules/stats/styles/ext.cx.stats.less
M specials/SpecialContentTranslationStats.php
7 files changed, 69 insertions(+), 10 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/73/206373/1

diff --git a/ContentTranslation.php b/ContentTranslation.php
index 149c0a3..9687023 100644
--- a/ContentTranslation.php
+++ b/ContentTranslation.php
@@ -146,8 +146,8 @@
  */
 $GLOBALS['wgContentTranslationTargetNamespace'] = 'Main';
 
-// List of campaigns enabled. Available campaigns: 'newarticle'
-$GLOBALS['wgContentTranslationCampaigns'] = array();
+// List of campaigns enabled. Available campaigns: 'newarticle', 'cxstats'
+$GLOBALS['wgContentTranslationCampaigns'] = array('cxstats');
 
 /*
  * Whether the Magnus tool to find missing articles to be enabled or not.
diff --git a/Resources.php b/Resources.php
index 906f6a7..268d835 100644
--- a/Resources.php
+++ b/Resources.php
@@ -686,6 +686,7 @@
'cx-stats-published-translators-title',
'cx-trend-all-translations',
'cx-trend-translations-to',
+   'cx-stats-try-contenttranslation',
)
 ) + $resourcePaths;
 
diff --git a/i18n/en.json b/i18n/en.json
index c4ac923..b2edbe8 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -173,5 +173,6 @@
cx-campaign-contributionsmenu-mytranslations: Translations,
cx-campaign-contributionsmenu-myuploads: Uploaded media,
cx-trend-all-translations: All translations,
-   cx-trend-translations-to: Translations to $1 language
+   cx-trend-translations-to: Translations to $1 language,
+   cx-stats-try-contenttranslation: Content Translation is a tool to 
create new pages by translating from other languages. [$1 Try Content 
Translation]
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index d07b425..499f9b4 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -177,5 +177,6 @@
cx-campaign-contributionsmenu-mytranslations: Menu item for menu 
shown while hovering the contributions link in personal toolbar. Points to the 
Content Translation dashboard\n{{Identical|Translation}},
cx-campaign-contributionsmenu-myuploads: Menu item for menu shown 
while hovering the contributions link in personal toolbar. Points to the 
Special:MyUploads in commons,
cx-trend-all-translations: Label shown in the legend section Content 
translation trends(graph visualization),
-   cx-trend-translations-to: Label shown in the legend section Content 
translation trends(graph visualization)\n$1 - language name
+   cx-trend-translations-to: Label shown in the legend section Content 
translation trends(graph visualization)\n$1 - language name,
+   cx-stats-try-contenttranslation: A message shown in 
[[Special:CXStats]] for users not enabled Content Translation . \n$1 - link to 
enable Content Translation beta featue and go to Content Translation dashboard
 }
diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index e9e7121..be6675b 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -257,8 +257,28 @@
}
 
$( function () {
-   var $canvas, ctx,
-   $container = $( '#bodyContent' );
+   var $canvas, ctx, cxLink,
+   $header = $( 'div' ).addClass( 'cx-widget__header' ),
+   $container = $( 'div' ).addClass( 
'cx-stats-container' );
+
+   // Set the global siteMapper for code which we cannot inject it
+   mw.cx.siteMapper = new mw.cx.SiteMapper( mw.config.get( 
'wgContentTranslationSiteTemplates' ) );
+   $( 'body' ).append(
+   $( 'div' ).addClass( 'cx-widget' )
+   .append( $header, $container )
+   );
+   $header.cxHeader( mw.cx.siteMapper );
+
+   if ( mw.user.options.get( 'cx' ) !== '1' ) {
+   cxLink = mw.util.getUrl( 'Special:ContentTranslation', {
+   campaign: 'cxstats',
+   targettitle: mw.config.get( 'wgPageName' ),
+   to: mw.config.get( 'wgContentLanguage' )
+   } );
+
+   $( '.cx-header__bar' ).hide();
+   mw.hook( 'mw.cx.error' ).fire( mw.message( 

[MediaWiki-commits] [Gerrit] CXStats: Reduce the cellpadding to compact the table - change (mediawiki...ContentTranslation)

2015-04-23 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: CXStats: Reduce the cellpadding to compact the table
..

CXStats: Reduce the cellpadding to compact the table

The stats table is getting bigger. Trying to reduce its size

Change-Id: I3b258ee814b6b95b89359707b6a648577a2c7667
---
M modules/stats/styles/ext.cx.stats.less
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/stats/styles/ext.cx.stats.less 
b/modules/stats/styles/ext.cx.stats.less
index 654fe0d..99e818c 100644
--- a/modules/stats/styles/ext.cx.stats.less
+++ b/modules/stats/styles/ext.cx.stats.less
@@ -3,7 +3,7 @@
border: 1px solid black;
tr, td {
font-size: smaller;
-   padding: 5px;
+   padding: 2px;
border: 1px solid #ddd;
text-align: center;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3b258ee814b6b95b89359707b6a648577a2c7667
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Avoid page scroll when reference list added automatically - change (mediawiki...ContentTranslation)

2015-04-23 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Avoid page scroll when reference list added automatically
..

Avoid page scroll when reference list added automatically

Avoid setting focus to that section added automatically

Bug: T96575
Change-Id: I2a648c8cf448e09d1102bf60681b5eecd339c700
---
M modules/tools/ext.cx.tools.reference.js
M modules/translation/ext.cx.translation.js
2 files changed, 15 insertions(+), 14 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index 2b6c631..b604753 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -132,7 +132,7 @@
// Reference list not the section, it 
is wrapped inside.
$parentSection = 
$referenceList.parent();
}
-   mw.hook( 'mw.cx.translation.add' ).fire( 
$parentSection.attr( 'id' ), 'click' );
+   mw.hook( 'mw.cx.translation.add' ).fire( 
$parentSection.attr( 'id' ), 'reference' );
} );
}
};
diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index b76b0b3..d57edd4 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -166,7 +166,7 @@
 * @param {jQuery} $section
 */
ContentTranslationEditor.prototype.postProcessMT = function ( $section 
) {
-   var selection, $sourceSection;
+   var $sourceSection;
 
if ( !$section || !$section.length ) {
// Empty references in some articles cause this.
@@ -195,15 +195,6 @@
} else {
$section.cxEditor();
}
-
-   // Set the focus on the new section.
-   // Rely on browser behavior for setting the cursor position.
-   // Will generally go to the beginning of the section.
-   $section[ 0 ].focus();
-
-   // Capture and save the new selection and cursor position
-   selection = mw.cx.selection.get();
-   mw.cx.selection.save( 'translation', selection );
 
// Search for text that was selected using the mouse.
// Delay it to run every 250 ms so it won't fire all the time 
while typing.
@@ -238,7 +229,7 @@
sourceId,
origin
) {
-   var $sourceSection, $section, $clone;
+   var $sourceSection, $section, $clone, selection;
 
$sourceSection = mw.cx.getSourceSection( sourceId );
$section = mw.cx.getTranslationSection( sourceId );
@@ -284,6 +275,16 @@
$section = mw.cx.getTranslationSection( sourceId );
mw.hook( 'mw.cx.translation.postMT' ).fire( $section );
}
+   // Set the focus on the new section.
+   // Rely on browser behavior for setting the cursor position.
+   // Will generally go to the beginning of the section.
+   if ( origin !== 'reference' ) {
+   // Do not focus reference. Page will scroll.
+   $section.focus();
+   // Capture and save the new selection and cursor 
position
+   selection = mw.cx.selection.get();
+   mw.cx.selection.save( 'translation', selection );
+   }
};
 
/**
@@ -324,7 +325,7 @@
 * Fill in the preceding parent heading, if not yet filled
 * @param {string} sectionId Source section Id
 */
-   ContentTranslationEditor.prototype.addSectionHeader = function ( 
sectionId ) {
+   ContentTranslationEditor.prototype.addSectionHeader = function ( 
sectionId, origin ) {
var $currentSection, $previousSection;
 
$currentSection = mw.cx.getTranslationSection( sectionId );
@@ -337,7 +338,7 @@
$currentSection.data( 'cx-section-type' )
)
) {
-   mw.hook( 'mw.cx.translation.add' ).fire( 
$previousSection.data( 'source' ), 'click' );
+   mw.hook( 'mw.cx.translation.add' ).fire( 
$previousSection.data( 'source' ), origin );
}
};
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a648c8cf448e09d1102bf60681b5eecd339c700
Gerrit-PatchSet: 1
Gerrit-Project: 

[MediaWiki-commits] [Gerrit] Make sure references templates not getting removed from source - change (mediawiki...ContentTranslation)

2015-04-16 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Make sure references templates not getting removed from source
..

Make sure references templates not getting removed from source

Test translating Dong_Qichang from fr to some other language where we
do not have a template configuration

Bug: T96239
Change-Id: I0afd066c9449484aacdc07e1d21a740341db9706
---
M modules/source/ext.cx.source.filter.js
1 file changed, 21 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/87/204487/1

diff --git a/modules/source/ext.cx.source.filter.js 
b/modules/source/ext.cx.source.filter.js
index fe5940c..d5661a0 100644
--- a/modules/source/ext.cx.source.filter.js
+++ b/modules/source/ext.cx.source.filter.js
@@ -41,6 +41,20 @@
}
 
/**
+* Check if the template is references
+* @param {jQuery} $template
+* @return {boolean} Whether the template is references or not.
+*/
+   function isReferences( $template ) {
+   if ( $template.is( '[typeof*=mw:Extension/references]' ) ||
+   $template.find( '[typeof*=mw:Extension/references]' 
).length ) {
+   return true;
+   }
+
+   return false;
+   }
+
+   /**
 * Simple check for inline templates.
 * @param {jQuery} $template
 * @return {boolean} Whether the template is inline or not.
@@ -122,6 +136,13 @@
 
if ( isInlineTemplate( $template ) ) {
mw.log( '[CX] Keeping inline template: ' + 
templateName );
+   return;
+   }
+   // Even if the template configuration has not 
whitelisted the references
+   // template, we must keep it to get the references in 
published article
+   // working. So try to identify references template and 
keep it.
+   if ( isReferences( $template ) ) {
+   mw.log( '[CX] Keeping references template: ' + 
templateName );
} else {
mw.log( '[CX] Removing template: ' + 
templateName );
sourceFilter.removeTemplate( $template );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0afd066c9449484aacdc07e1d21a740341db9706
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Avoid a js error in postMT handler of translations module - change (mediawiki...ContentTranslation)

2015-04-16 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Avoid a js error in postMT handler of translations module
..

Avoid a js error in postMT handler of translations module

Change-Id: I3c9a946419f06a71c33232cfce84041ac25f17e4
---
M modules/translation/ext.cx.translation.js
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/00/204500/1

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 67d71a8..b76b0b3 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -166,9 +166,16 @@
 * @param {jQuery} $section
 */
ContentTranslationEditor.prototype.postProcessMT = function ( $section 
) {
-   var selection,
-   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
+   var selection, $sourceSection;
 
+   if ( !$section || !$section.length ) {
+   // Empty references in some articles cause this.
+   // Example: See Notes section in
+   // 
https://fr.wikipedia.org/w/index.php?title=Dong_Qichangoldid=100845438
+   return;
+   }
+
+   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
mw.hook( 'mw.cx.translation.change' ).fire( $section );
mw.hook( 'mw.cx.translation.focus' ).fire( $section );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c9a946419f06a71c33232cfce84041ac25f17e4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix: Undefined variable: parserParams - change (mediawiki...ContentTranslation)

2015-04-16 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix: Undefined variable: parserParams
..

Fix: Undefined variable: parserParams

Bug: T96276
Change-Id: Ie0ccaca4d3637a03930a4d7ac44ec5398f4933b0
---
M api/ApiContentTranslationPublish.php
1 file changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index 70a8367..c87cade 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -67,7 +67,6 @@
'transform/html/to/wikitext/' . urlencode( 
$title-getPrefixedDBkey() ),
array(
'html' = $html,
-   'oldid' = $parserParams['oldid'],
)
);
if ( $wikitext === false ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie0ccaca4d3637a03930a4d7ac44ec5398f4933b0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix a js error when publishing fails because of unknown reasons - change (mediawiki...ContentTranslation)

2015-04-14 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix a js error when publishing fails because of unknown reasons
..

Fix a js error when publishing fails because of unknown reasons

Change-Id: I2c635fa9b581a9bb3db11ebc2ca2dd986d34bdac
---
M modules/publish/ext.cx.publish.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 42e9508..dc76dd4 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -63,7 +63,7 @@
} );
}
// Any other failure
-   self.fail( 'cxpublish', '[CX] Unexpected error 
while publishing: ' + response.cxpublish );
+   self.onFail( 'cxpublish', '[CX] Unexpected 
error while publishing: ' + response.cxpublish );
} ).fail( function ( code, details ) {
self.onFail( code, details );
} ).always( function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c635fa9b581a9bb3db11ebc2ca2dd986d34bdac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Update contributions menu to use latest callout widget - change (mediawiki...ContentTranslation)

2015-04-13 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Update contributions menu to use latest callout widget
..

Update contributions menu to use latest callout widget

Change-Id: I2da5e4b0afcd9079f328d2143cb4ad2afbc862a1
---
M modules/campaigns/ext.cx.campaigns.contributionsmenu.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js 
b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
index 9489fa8..281c2ec 100644
--- a/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
+++ b/modules/campaigns/ext.cx.campaigns.contributionsmenu.js
@@ -54,7 +54,7 @@
$trigger.callout( {
trigger: 'manual',
classes: 'cx-campaign-contributionsmenu',
-   gravity: $.fn.callout.autoNEW,
+   direction: $.fn.callout.autoDirection( '1' ),
content: $menu
} );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2da5e4b0afcd9079f328d2143cb4ad2afbc862a1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Add simple English as source and target language - change (mediawiki...cxserver)

2015-04-09 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Add simple English as source and target language
..

Add simple English as source and target language

Use Apertium for this just like English

Bug: T95538
Change-Id: I5b1ef7e9fbd0cad514f890df93c16ca572e2c40e
---
M config.defaults.js
M mt/Apertium.languagenames.json
2 files changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/26/203026/1

diff --git a/config.defaults.js b/config.defaults.js
index b3a9e59..ff5e2be 100644
--- a/config.defaults.js
+++ b/config.defaults.js
@@ -22,8 +22,8 @@
cert: null,
// Service registry
registry: {
-   source: [ 'af', 'an', 'ar', 'az', 'bg', 'bs', 'ca', 'cr', 'cy', 
'en', 'eo', 'es', 'fr', 'gl', 'gu', 'hi', 'hr', 'id', 'ja', 'kk', 'km', 'kn', 
'ky', 'kz', 'min', 'mk', 'ms', 'mt', 'nl', 'no', 'nn', 'oc', 'pa', 'pl', 'pt', 
'ru', 'sh', 'sl', 'tr', 'tt', 'uk', 'ur', 'uz', 'vi', 'xh', 'zh' ],
-   target: [ 'af', 'an', 'ar', 'az', 'bg', 'bs', 'ca', 'cr', 'cy', 
'eo', 'es', 'fr', 'gl', 'gu', 'hi', 'hr', 'id', 'ja', 'kk', 'km', 'kn', 'ky', 
'kz', 'min', 'mk', 'ms', 'mt', 'nl', 'no', 'nn', 'oc', 'pa', 'pl', 'pt', 'ru', 
'sh', 'sl', 'tt', 'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'zh' ],
+   source: [ 'af', 'an', 'ar', 'az', 'bg', 'bs', 'ca', 'cr', 'cy', 
'en', 'eo', 'es', 'fr', 'gl', 'gu', 'hi', 'hr', 'id', 'ja', 'kk', 'km', 'kn', 
'ky', 'kz', 'min', 'mk', 'ms', 'mt', 'nl', 'no', 'nn', 'oc', 'pa', 'pl', 'pt', 
'ru', 'sh', 'simple', 'sl', 'tr', 'tt', 'uk', 'ur', 'uz', 'vi', 'xh', 'zh' ],
+   target: [ 'af', 'an', 'ar', 'az', 'bg', 'bs', 'ca', 'cr', 'cy', 
'eo', 'es', 'fr', 'gl', 'gu', 'hi', 'hr', 'id', 'ja', 'kk', 'km', 'kn', 'ky', 
'kz', 'min', 'mk', 'ms', 'mt', 'nl', 'no', 'nn', 'oc', 'pa', 'pl', 'pt', 'ru', 
'sh', 'simple', 'sl', 'tt', 'tr', 'uk', 'ur', 'uz', 'vi', 'xh', 'zh' ],
mt: {
Apertium: {
af: [ 'nl' ],
@@ -53,6 +53,7 @@
pt: [ 'ca', 'es', 'gl' ],
ro: [ 'es' ],
sh: [ 'mk', 'sl' ],
+   simple: [ 'bs', 'ca', 'cr', 'eo', 'es', 'gl', 
'hr', 'sh', 'sr' ],
sl: [ 'bs', 'cr', 'hr', 'sh', 'sr' ],
sv: [ 'da', 'is' ],
tt: [ 'kk' ],
diff --git a/mt/Apertium.languagenames.json b/mt/Apertium.languagenames.json
index a233ef1..8da56c9 100644
--- a/mt/Apertium.languagenames.json
+++ b/mt/Apertium.languagenames.json
@@ -32,6 +32,7 @@
pt: por,
ro: ron,
sh: hbs,
+   simple: eng,
sl: slv,
sr: hbs_SR,
sv: swe,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b1ef7e9fbd0cad514f890df93c16ca572e2c40e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Use ParsoidVirtualRESTService for HTML to Wikitext transform... - change (mediawiki...ContentTranslation)

2015-04-09 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Use ParsoidVirtualRESTService for HTML to Wikitext 
transformation
..

Use ParsoidVirtualRESTService for HTML to Wikitext transformation

Change-Id: I4b0c4c078efc9fdc98863c22cb72945b67b72733
---
M api/ApiContentTranslationPublish.php
1 file changed, 46 insertions(+), 20 deletions(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index c0158cd..b62b2d0 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -18,36 +18,62 @@
 class ApiContentTranslationPublish extends ApiBase {
 
/**
+* @var VirtualRESTServiceClient
+*/
+   protected $serviceClient;
+
+   public function __construct( ApiMain $main, $name ) {
+   global $wgContentTranslationParsoid;
+   parent::__construct( $main, $name );
+   $this-serviceClient = new VirtualRESTServiceClient( new 
MultiHttpClient( array() ) );
+   $parsoidConfig = $wgContentTranslationParsoid;
+   $this-serviceClient-mount( '/parsoid/', new 
ParsoidVirtualRESTService( array(
+   'URL' = $parsoidConfig['url'],
+   'prefix' = $parsoidConfig['prefix'],
+   'timeout' = $parsoidConfig['timeout'],
+   ) ) );
+   }
+
+   private function requestParsoid( $method, $path, $params ) {
+   $request = array(
+   'method' = $method,
+   'url' = '/parsoid/local/v1/' . $path
+   );
+   if ( $method === 'GET' ) {
+   $request['query'] = $params;
+   } else {
+   $request['body'] = $params;
+   }
+   $response = $this-serviceClient-run( $request );
+   if ( $response['code'] === 200  $response['error'] ===  ) {
+   return $response['body'];
+   } elseif ( $response['error'] !== '' ) {
+   $this-dieUsage( 'parsoidserver-http-error: ' . 
$response['code'], $response['error'] );
+   } else { // error null, code not 200
+   $this-dieUsage( 'parsoidserver-http: HTTP ' . 
$response['code'], $response['error'] );
+   }
+   }
+
+   /**
 * Converts html to wikitext
 *
 * @param Title $title
 * @param string $html
-* @return Status
-* @throw MWException
+* @return string Wiki text
 */
protected function convertHtmlToWikitext( Title $title, $html ) {
-   global $wgContentTranslationParsoid;
-
-   $conf = $wgContentTranslationParsoid;
-   $page = urlencode( $title-getPrefixedDBkey() );
-
-   $req = MWHttpRequest::factory(
-   {$conf['url']}/{$conf['prefix']}/$page,
+   $wikitext = $this-requestParsoid(
+   'POST',
+   'transform/html/to/wikitext/' . urlencode( 
$title-getPrefixedDBkey() ),
array(
-   'method' = 'POST',
-   'postData' = array(
-   'content' = $html,
-   ),
-   'timeout' = $conf['timeout'],
+   'html' = $html,
+   'oldid' = $parserParams['oldid'],
)
);
-
-   $status = $req-execute();
-   if ( !$status-isOK() ) {
-   throw new MWException( $status );
+   if ( $wikitext === false ) {
+   $this-dieUsage( 'Error contacting the Parsoid server', 
'parsoidserver' );
}
-
-   return $req-getContent();
+   return $wikitext;
}
 
protected function saveWikitext( $title, $wikitext, $params ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b0c4c078efc9fdc98863c22cb72945b67b72733
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Remove highlighting classes before saving the translation - change (mediawiki...ContentTranslation)

2015-04-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Remove highlighting classes before saving the translation
..

Remove highlighting classes before saving the translation

Bug: T95394
Change-Id: I03104c14c6cbf86f30e1086d163213ee1fced01a
---
M modules/draft/ext.cx.draft.js
1 file changed, 4 insertions(+), 0 deletions(-)


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

diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index bb749ae..fe2e8f6 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -218,6 +218,10 @@
.remove();
// Remove placeholder sections
$content.find( '.placeholder' ).remove();
+   // Remove all highlighting before saving
+   $content
+   .find( '.cx-highlight, .cx-highlight--blue, 
.cx-highlight--lightblue' )
+   .removeClass( 'cx-highlight cx-highlight--blue 
cx-highlight--lightblue' );
return $content.html();
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03104c14c6cbf86f30e1086d163213ee1fced01a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] When parsoid fails, throw exception with status - change (mediawiki...ContentTranslation)

2015-04-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: When parsoid fails, throw exception with status
..

When parsoid fails, throw exception with status

$req-getContent() does not have anything. So having that in
exception is useless

Change-Id: I2507840c32f853cf15100fe42f899675e2f149ed
---
M api/ApiContentTranslationPublish.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/95/202995/1

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index ae481a4..c0158cd 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -44,7 +44,7 @@
 
$status = $req-execute();
if ( !$status-isOK() ) {
-   throw new MWException( $req-getContent() );
+   throw new MWException( $status );
}
 
return $req-getContent();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2507840c32f853cf15100fe42f899675e2f149ed
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Log publishing errors to eventlogging for future analysis an... - change (mediawiki...ContentTranslation)

2015-04-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Log publishing errors to eventlogging for future analysis and 
fix
..

Log publishing errors to eventlogging for future analysis and fix

Uses Schema:ContentTranslationError
https://meta.wikimedia.org/wiki/Schema:ContentTranslationError

Change-Id: I0c6e8b99ac7e6e02a15bd1bdd57d2b321dcd49d2
---
M ContentTranslation.hooks.php
M modules/eventlogging/ext.cx.eventlogging.js
M modules/publish/ext.cx.publish.js
3 files changed, 16 insertions(+), 2 deletions(-)


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

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 268239a..d2bb80d 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -112,6 +112,7 @@
public static function addEventLogging( array $schemas ) {
$schemas['ContentTranslation'] = 11628043;
$schemas['ContentTranslationCTA'] = 11616099;
+   $schemas['ContentTranslationError'] = 11767097;
}
 
/**
diff --git a/modules/eventlogging/ext.cx.eventlogging.js 
b/modules/eventlogging/ext.cx.eventlogging.js
index c4c7e1b..09c7bf7 100644
--- a/modules/eventlogging/ext.cx.eventlogging.js
+++ b/modules/eventlogging/ext.cx.eventlogging.js
@@ -61,8 +61,9 @@
 * @param {string} targetLanguage Target language code
 * @param {string} sourceTitle Source title
 * @param {string} targetTitle Target title
+* @param {string} trace Error trace
 */
-   publishFailed: function ( sourceLanguage, targetLanguage, 
sourceTitle, targetTitle ) {
+   publishFailed: function ( sourceLanguage, targetLanguage, 
sourceTitle, targetTitle, trace ) {
mw.track( 'event.ContentTranslation', {
version: 1,
token: mw.user.id(),
@@ -73,6 +74,17 @@
sourceTitle: sourceTitle,
targetTitle: targetTitle
} );
+   mw.track( 'event.ContentTranslationError', {
+   version: 1,
+   token: mw.user.id(),
+   session: mw.user.sessionId(),
+   context: 'publish-failure',
+   sourceLanguage: sourceLanguage,
+   targetLanguage: targetLanguage,
+   sourceTitle: sourceTitle,
+   targetTitle: targetTitle,
+   trace: trace
+   } );
},
 
/**
diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 233ffa2..42e9508 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -283,7 +283,8 @@
mw.cx.sourceLanguage,
mw.cx.targetLanguage,
mw.cx.sourceTitle,
-   this.targetTitle
+   this.targetTitle,
+   JSON.stringify( details )
);
mw.hook( 'mw.cx.error' ).fire( mw.msg( 'cx-publish-page-error' 
) );
mw.log( '[CX] Error while publishing:', code, trace );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c6e8b99ac7e6e02a15bd1bdd57d2b321dcd49d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Avoid a js error at mw.cx.getSourceSection when id is null - change (mediawiki...ContentTranslation)

2015-04-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Avoid a js error at mw.cx.getSourceSection when id is null
..

Avoid a js error at mw.cx.getSourceSection when id is null

Bug: T95151
Change-Id: Idb828031e750333c835444294b9f50f8b0229b0e
---
M modules/util/ext.cx.util.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/27/202327/1

diff --git a/modules/util/ext.cx.util.js b/modules/util/ext.cx.util.js
index 506aac5..cfd04e0 100644
--- a/modules/util/ext.cx.util.js
+++ b/modules/util/ext.cx.util.js
@@ -39,7 +39,7 @@
 
mw.cx.getSourceSection = function ( id ) {
// Sanity check, id should be either a number or prefixed with 
cx
-   if ( isNaN( id )  id.indexOf( 'cx' ) !== 0 ) {
+   if ( !id || isNaN( id )  id.indexOf( 'cx' ) !== 0 ) {
return $( [] );
} else {
return $( document.getElementById( id ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb828031e750333c835444294b9f50f8b0229b0e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Move the highlighting related styles to a separate LESS file - change (mediawiki...ContentTranslation)

2015-04-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Move the highlighting related styles to a separate LESS file
..

Move the highlighting related styles to a separate LESS file

It was duplicated in source and translation modules

Change-Id: I2692ce19d6c55b12d90edac464514167bf64010d
---
M modules/source/styles/ext.cx.source.less
M modules/translation/styles/ext.cx.translation.less
A modules/widgets/common/ext.cx.highlight.less
3 files changed, 26 insertions(+), 50 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/73/202673/1

diff --git a/modules/source/styles/ext.cx.source.less 
b/modules/source/styles/ext.cx.source.less
index 551bb62..7207a96 100644
--- a/modules/source/styles/ext.cx.source.less
+++ b/modules/source/styles/ext.cx.source.less
@@ -1,8 +1,5 @@
 @import ../../widgets/common/ext.cx.common;
-
-@text-highlight-color: #FEFCE0;
-@link-highlight-color: #BDD4FF;
-@connected-link-highlight-color: #D9E6FF;
+@import ../../widgets/common/ext.cx.highlight;
 
 .cx-column--source {
.cx-column__language-label,
@@ -19,27 +16,6 @@
 
.cx-column__sub-heading__view-page {
.mw-ui-two-thirds;
-   }
-
-   .cx-highlight {
-   background-color: @text-highlight-color;
-   box-shadow: 0px 0px 0 2px @text-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
-   }
-
-   .cx-highlight--blue {
-   background-color: @link-highlight-color;
-   box-shadow: 0px 0px 0 2px @link-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
-   }
-
-   .cx-highlight--lightblue {
-   background-color: @connected-link-highlight-color;
-   box-shadow: 0px 0px 0 2px @connected-link-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
}
 }
 
diff --git a/modules/translation/styles/ext.cx.translation.less 
b/modules/translation/styles/ext.cx.translation.less
index 35c2417..6c77190 100644
--- a/modules/translation/styles/ext.cx.translation.less
+++ b/modules/translation/styles/ext.cx.translation.less
@@ -1,8 +1,5 @@
 @import ../../widgets/common/ext.cx.common;
-
-@text-highlight-color: #FEFCE0;
-@link-highlight-color: #BDD4FF;
-@connected-link-highlight-color: #D9E6FF;
+@import ../../widgets/common/ext.cx.highlight;
 
 .cx-column--translation {
[contenteditable] {
@@ -11,27 +8,6 @@
 
[data-editable=false] {
 background-image: repeating-linear-gradient(135deg,#eee,#eee 
5px,#ddd 5px,#ddd 10px);
-   }
-
-   .cx-highlight {
-   background-color: @text-highlight-color;
-   box-shadow: 0px 0px 0 2px @text-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
-   }
-
-   .cx-highlight--blue {
-   background-color: @link-highlight-color;
-   box-shadow: 0px 0px 0 2px @link-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
-   }
-
-   .cx-highlight--lightblue {
-   background-color: @connected-link-highlight-color;
-   box-shadow: 0px 0px 0 2px @connected-link-highlight-color;
-   border-radius: 2px;
-   transition: all 0.25s;
}
 }
 
diff --git a/modules/widgets/common/ext.cx.highlight.less 
b/modules/widgets/common/ext.cx.highlight.less
new file mode 100644
index 000..f339809
--- /dev/null
+++ b/modules/widgets/common/ext.cx.highlight.less
@@ -0,0 +1,24 @@
+@text-highlight-color: #FEFCE0;
+@link-highlight-color: #BDD4FF;
+@connected-link-highlight-color: #D9E6FF;
+
+.cx-highlight {
+   background-color: @text-highlight-color;
+   box-shadow: 0px 0px 0 2px @text-highlight-color;
+   border-radius: 2px;
+   transition: all 0.25s;
+}
+
+.cx-highlight--blue {
+   background-color: @link-highlight-color;
+   box-shadow: 0px 0px 0 2px @link-highlight-color;
+   border-radius: 2px;
+   transition: all 0.25s;
+}
+
+.cx-highlight--lightblue {
+   background-color: @connected-link-highlight-color;
+   box-shadow: 0px 0px 0 2px @connected-link-highlight-color;
+   border-radius: 2px;
+   transition: all 0.25s;
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2692ce19d6c55b12d90edac464514167bf64010d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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

[MediaWiki-commits] [Gerrit] Remove unwanted link highlight code from translation module - change (mediawiki...ContentTranslation)

2015-04-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Remove unwanted link highlight code from translation module
..

Remove unwanted link highlight code from translation module

The links are highlighted using blue colors and not with yellow.
The highlighting code is present in links module. This is old code
left in translation module

Change-Id: I4d78b6a62f8e2b962d35fcd5ffc07979dcd89b53
---
M modules/translation/ext.cx.translation.js
1 file changed, 0 insertions(+), 6 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index e64f469..00d1f9f 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -137,12 +137,6 @@
}
} );
 
-   // Highlight corresponding links in source and translation 
columns
-   this.$container.on( 'mouseenter mouseleave', 'a', function () {
-   $( '[data-linkid=' + $( this ).data( 'linkid' ) + ']' 
)
-   .toggleClass( 'cx-highlight' );
-   } );
-
// Highlight segment pairs
this.$container.on( 'mouseenter mouseleave', '.cx-segment', 
function () {
var $segment = $( this ),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d78b6a62f8e2b962d35fcd5ffc07979dcd89b53
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Load style for Style Parsoid output along with source RL module - change (mediawiki...ContentTranslation)

2015-04-07 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Load style for Style Parsoid output along with source RL module
..

Load style for Style Parsoid output along with source RL module

This allows us to just fetch the HTML body of source article instead
of loading the full HTML with unnecessary data for CX.

Other than this style, CX internally applies some style modification
to fit the content in CX UI. For example, tables styles. We can club
all these content styles to a single ext.cx.content.style RL module
in future. Now those style modifications are not properly organized.

Also see I1d5c1e0764f67

Change-Id: I3068ba6f108f11024f2811360734ebe02d2ce461
---
M Resources.php
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index 61b2af2..fc8428e 100644
--- a/Resources.php
+++ b/Resources.php
@@ -187,6 +187,7 @@
'mediawiki.jqueryMsg',
'mediawiki.util',
'ext.cx.widgets.spinner',
+   'mediawiki.skinning.content.parsoid',
),
'messages' = array(
'cx-source-view-page',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3068ba6f108f11024f2811360734ebe02d2ce461
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Warn users when leaving while a save is in progress - change (mediawiki...ContentTranslation)

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

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

Change subject: Warn users when leaving while a save is in progress
..

Warn users when leaving while a save is in progress

Bug: T94567
Change-Id: I774c944bda0e61e7e74bf694e80a573ff6cb5942
---
M modules/translation/ext.cx.translation.progress.js
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/89/201689/1

diff --git a/modules/translation/ext.cx.translation.progress.js 
b/modules/translation/ext.cx.translation.progress.js
index 88701da..7fe2c07 100644
--- a/modules/translation/ext.cx.translation.progress.js
+++ b/modules/translation/ext.cx.translation.progress.js
@@ -157,9 +157,12 @@
if ( mw.config.get( 'wgContentTranslationDatabase' ) 
!== null ) {
if ( mw.cx.dirty ) {
mw.hook( 'mw.cx.translation.save' 
).fire();
+   // If we leave the page immediately the 
above save may not happen.
+   // So, stay or leave?
+   return mw.msg( 
'cx-warning-unsaved-translation' );
+   } else {
+   return;
}
-
-   return;
}
 
weights = getTranslationWeights( 
getSectionsWithContent() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I774c944bda0e61e7e74bf694e80a573ff6cb5942
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix undefined 'cx' error - change (mediawiki...ContentTranslation)

2015-04-02 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix undefined 'cx' error
..

Fix undefined 'cx' error

Bug: T94898
Change-Id: I893c2083f795a4785424429b3b191ae76cc388be
---
M ContentTranslation.hooks.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/64/201664/1

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 6563f41..d02b880 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -199,7 +199,8 @@
$out = RequestContext::getMain()-getOutput();
 
if (
-   $saveOptions['cx'] 
+   isset( $saveOptions['cx'] ) 
+   $saveOptions['cx'] === '1' 
!isset( $saveOptions['cx-know'] ) 
!$out-getTitle()-isSpecial( 'ContentTranslation' )
) {
@@ -209,6 +210,7 @@
// This make sure the auto-open contribution menu shown 
exactly once.
// and it is not in Special:CX
$saveOptions['cx-know'] = true;
+
}
 
return true;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I893c2083f795a4785424429b3b191ae76cc388be
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Quick popover menu when hovering the contributions link - change (mediawiki...ContentTranslation)

2015-03-31 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Quick popover menu when hovering the contributions link
..

Quick popover menu when hovering the contributions link

Communicate that users can create new contributions (especially translations)
in a quick way.

When users hover the contributions link, show a popover with access
to different contribution areas:
- User contributions links to the contributions page
- Uploaded media links to My Uploads from Commons.
- Translations links to the Content Translation Dashboard

The popover menu will be shown open initially right after the user
enabled the content translation beta feature
(to help announce where to translate from).

Bug: T92938
Change-Id: I47ec9d602c1af918b26522f35d716f98ea3fe432
---
M ContentTranslation.hooks.php
M ContentTranslation.php
M Resources.php
M i18n/en.json
M i18n/qqq.json
A modules/campaigns/styles/images/blue-beta.png
A modules/campaigns/styles/images/blue-beta.svg
A modules/campaigns/styles/images/translation.png
A modules/campaigns/styles/images/translation.svg
A modules/campaigns/styles/images/userAvatar.png
A modules/campaigns/styles/images/userAvatar.svg
A modules/campaigns/styles/images/wikimediaCommons.png
A modules/campaigns/styles/images/wikimediaCommons.svg
13 files changed, 63 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/42/200842/1

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 991bd46..ccb756f 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -63,6 +63,9 @@
$out-addModules( 'ext.cx.redlink' );
}
 
+   // Add a hover menu for contributions link in personal tool bar
+   $out-addModules( 'ext.cx.campaigns.contributionsmenu' );
+
// The current guided tours are only for the user namespace,
// so load the module only there.
// In the future there may be guided tours in other namespaces,
@@ -184,6 +187,19 @@
}
 
/**
+* Hook: User::UserSaveOptions
+*/
+   public static function onSaveOptions( $user, $saveOptions ) {
+   if ( $saveOptions['cx'] ) {
+   RequestContext::getMain()-getOutput()-addModules(
+   array( 'ext.cx.betafeature.init', 
'ext.cx.campaigns.contributionsmenu' )
+   );
+   }
+
+   return true;
+   }
+
+   /**
 * Hook: ResourceLoaderTestModules
 */
public static function onResourceLoaderTestModules( array $modules ) {
diff --git a/ContentTranslation.php b/ContentTranslation.php
index 72644ae..c39e77d 100644
--- a/ContentTranslation.php
+++ b/ContentTranslation.php
@@ -71,6 +71,7 @@
'ContentTranslationHooks::addNewContributionButton';
 $GLOBALS['wgHooks']['ListDefinedTags'][] = 
'ContentTranslationHooks::registerTags';
 $GLOBALS['wgHooks']['ChangeTagsListActive'][] = 
'ContentTranslationHooks::registerTags';
+$GLOBALS['wgHooks']['UserSaveOptions'][] =  
'ContentTranslationHooks::onSaveOptions';
 $GLOBALS['wgHooks']['EditPage::showEditForm:initial'][] =
'ContentTranslationHooks::newArticleCampign';
 $GLOBALS['wgHooks']['ResourceLoaderTestModules'][] =
diff --git a/Resources.php b/Resources.php
index 73df65c..cddb627 100644
--- a/Resources.php
+++ b/Resources.php
@@ -725,6 +725,32 @@
)
 ) + $resourcePaths;
 
+$wgResourceModules['ext.cx.betafeature.init'] = array(
+   'scripts' = array(
+   'campaigns/ext.cx.betafeature.init.js',
+   ),
+) + $resourcePaths;
+
+$wgResourceModules['ext.cx.campaigns.contributionsmenu'] = array(
+   'scripts' = array(
+   'campaigns/ext.cx.campaigns.contributionsmenu.js',
+   ),
+   'styles' = array(
+   'campaigns/styles/ext.cx.campaigns.contributionsmenu.less',
+   ),
+   'dependencies' = array(
+   'mediawiki.ui.button',
+   'jquery.client',
+   'mediawiki.util',
+   'ext.cx.widgets.callout',
+   ),
+   'messages' = array(
+   'cx-campaign-contributionsmenu-mycontributions',
+   'cx-campaign-contributionsmenu-mytranslations',
+   'cx-campaign-contributionsmenu-myuploads',
+   )
+) + $resourcePaths;
+
 $wgResourceModules['ext.cx.widgets.overlay'] = array(
'scripts' = array(
'widgets/overlay/ext.cx.overlay.js',
diff --git a/i18n/en.json b/i18n/en.json
index aba65c9..e8923a6 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -165,6 +165,9 @@
cx-campaign-newarticle-notice: Now you can also create new content 
by btranslating/b! Do you want to try the Content Translation beta tool?,
cx-campaign-no-thanks: No, thanks,

[MediaWiki-commits] [Gerrit] Stats: Move the graph under published translations section - change (mediawiki...ContentTranslation)

2015-03-31 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Stats: Move the graph under published translations section
..

Stats: Move the graph under published translations section

Change-Id: Ie2c5606d5543b814807a75cc67a9a7ee9c9f3fc4
---
M modules/stats/ext.cx.stats.js
1 file changed, 9 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/98/201098/1

diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 09b685d..723deec 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -219,11 +219,19 @@
var $canvas, ctx, cxTrendGraph,
$container = $( '#bodyContent' );
 
+   $canvas = $( 'canvas' ).attr( {
+   id: 'cxtrend',
+   width: $container.width(),
+   height: 400
+   } );
+
+   $container.append(
+   $( 'h2' ).text( mw.msg( 
'cx-stats-published-translations-title' ) ),
+   $( 'div' ).addClass( 'cx-stats-trend' ).append( 
$canvas ) );
mw.cx.siteMapper = new mw.cx.SiteMapper( mw.config.get( 
'wgContentTranslationSiteTemplates' ) );
 
getCXStats().then( function ( data ) {
$container.append(
-   $( 'h2' ).text( mw.msg( 
'cx-stats-published-translations-title' ) ),
prepareTranslationsTable( 
data.query.contenttranslationstats, 'published' ),
$( 'h2' ).text( mw.msg( 
'cx-stats-draft-translations-title' ) ),
prepareTranslationsTable( 
data.query.contenttranslationstats, 'draft' ),
@@ -232,13 +240,6 @@
);
} );
 
-   $canvas = $( 'canvas' ).attr( {
-   id: 'cxtrend',
-   width: $container.width(),
-   height: 400
-   } );
-
-   $container.append( $( 'div' ).addClass( 'cx-stats-trend' 
).append( $canvas ) );
ctx = $canvas[ 0 ].getContext( '2d' );
 
// TODO: Add a language selector to choose any language

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie2c5606d5543b814807a75cc67a9a7ee9c9f3fc4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Improve automatic adding of reference list - change (mediawiki...ContentTranslation)

2015-03-31 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Improve automatic adding of reference list
..

Improve automatic adding of reference list

* Handle the case of multiple reference lists in the page.
  For example, Notes and References
Example: enwiki:Hydrogen

* The reference list itself may not be the CX translation section
  if wrapped inside a section tag like divs

Example: enwiki:Emily+Warren+Roebling has reference list as section
while enwiki:Hydrogen has it wrapped

Change-Id: I807ba3510a76b7c186a1738f0b78d3cdd8eaa7e2
---
M modules/tools/ext.cx.tools.reference.js
1 file changed, 20 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/05/201105/1

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index 13b34fc..3360de5 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -109,18 +109,32 @@
};
 
/**
-* Add the reference list, usually at the end of translation
+* Add the reference list(s), usually at the end of translation
 */
ReferenceCard.prototype.addReferenceList = function () {
-   var $referenceList;
+   var $referenceLists, $parentSection;
 
-   $referenceList = $( '[typeof*=mw:Extension/references]' );
+   // There can be multiple reference lists grouped for notes and 
references
+   // For example see enwiki:Hydrogen
+   $referenceLists = $( '[typeof*=mw:Extension/references]' );
 
-   if ( $referenceList.length === 1 ) {
-   // Only one reference list - means the target reference 
list not added yet.
-   mw.hook( 'mw.cx.translation.add' ).fire( 
$referenceList.parent().attr( 'id' ), 'click' );
+   if ( !$( '.cx-column--translation 
[typeof*=mw:Extension/references]' ).length ) {
+   // Target reference list not added yet.
+   $referenceLists.each( function ( key, referenceList ) {
+   var $referenceList = $( referenceList );
+
+   if ( $referenceList.parent().is( 
'.cx-column__content' ) ) {
+   // Reference list is the section,
+   $parentSection = $referenceList;
+   } else {
+   // Reference list not the section, it 
is wrapped inside.
+   $parentSection = 
$referenceList.parent();
+   }
+   mw.hook( 'mw.cx.translation.add' ).fire( 
$parentSection.attr( 'id' ), 'click' );
+   } );
}
};
+
/**
 * Start presenting the reference card
 * @param {string} referenceId The reference element Identifier.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I807ba3510a76b7c186a1738f0b78d3cdd8eaa7e2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Parsoid: Fetch the body HTML intead of full document - change (mediawiki...cxserver)

2015-03-31 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Parsoid: Fetch the body HTML intead of full document
..

Parsoid: Fetch the body HTML intead of full document

Uses body api argument.

Change-Id: I1d5c1e0764f67215802430f2fcd76c5790e4
---
M pageloader/PageLoader.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/95/201095/1

diff --git a/pageloader/PageLoader.js b/pageloader/PageLoader.js
index 76171de..e5ed9e3 100644
--- a/pageloader/PageLoader.js
+++ b/pageloader/PageLoader.js
@@ -28,7 +28,7 @@
var deferred = Q.defer();
 
request(
-   conf( 'parsoid.api' ) + '/' + this.sourceLanguage + 'wiki/' + 
this.page,
+   conf( 'parsoid.api' ) + '/' + this.sourceLanguage + 'wiki/' + 
this.page + '?body=0',
function ( error, response, body ) {
if ( error ) {
deferred.reject( new Error( error ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d5c1e0764f67215802430f2fcd76c5790e4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] CXStats: Make the graph labels week end dates instead of sta... - change (mediawiki...ContentTranslation)

2015-03-30 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: CXStats: Make the graph labels week end dates instead of start 
dates
..

CXStats: Make the graph labels week end dates instead of start dates

Change-Id: Idefd37083d2dd6161f6b309a082c096bdd9d26ff
---
M includes/Translation.php
1 file changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/includes/Translation.php b/includes/Translation.php
index bb12a52..7055709 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -255,9 +255,9 @@
foreach ( $rows as $row ) {
$result[] = array(
'date' = $interval === 'week' ?
-   // Week start date
-   date( 'Y-m-d', strtotime( $row-date . 
' - ' .
-   date( 'w', strtotime( 
$row-date ) ) . ' days' ) ) :
+   // Week end date
+   date( 'Y-m-d', strtotime( $row-date . 
' + ' .
+   ( 6 - date( 'w', strtotime( 
$row-date ) ) ) . ' days' ) ) :
date( 'Y-m', strtotime( $row-date ) ),
'count' = $row-translatons_count,
);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idefd37083d2dd6161f6b309a082c096bdd9d26ff
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Update the version - change (mediawiki...ContentTranslation)

2015-03-30 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Update the version
..

Update the version

-to tomorrow :)

Change-Id: I6386236f7a4a5e262b85a1b1a120cd67199c364d
---
M ContentTranslation.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/ContentTranslation.php b/ContentTranslation.php
index 97a0647..72644ae 100644
--- a/ContentTranslation.php
+++ b/ContentTranslation.php
@@ -13,7 +13,7 @@
 /**
  * Version number used in extension credits and in other places where needed.
  */
-define( 'CONTENTTRANSLATION_VERSION', '1.0.0+20150127' );
+define( 'CONTENTTRANSLATION_VERSION', '1.0.0+20150401' );
 
 /**
  * Extension credits properties.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6386236f7a4a5e262b85a1b1a120cd67199c364d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Revert Update inputs to use mw-ui styles - change (mediawiki...UniversalLanguageSelector)

2015-03-29 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Revert Update inputs to use mw-ui styles
..

Revert Update inputs to use mw-ui styles

This reverts commit 30d26a4fd2a239f8874f1983972a266246b79548.

The style update is incomplete and make the dialog styles broken.
Following problems are noticed:
- Large font sizes
- Buttons missing colors(green, blue, red)
- Language name buttons breaking to two lines
- Unnecessary button.css not removed

Change-Id: I35c1eb2db5ead8ca75dc2724997d789c83c69b6d
---
M Resources.php
M resources/css/ext.uls.inputsettings.css
M resources/js/ext.uls.displaysettings.js
M resources/js/ext.uls.inputsettings.js
M resources/js/ext.uls.languagesettings.js
5 files changed, 32 insertions(+), 33 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index a2298a5..4e0a8cf 100644
--- a/Resources.php
+++ b/Resources.php
@@ -34,7 +34,6 @@
'ext.uls.mediawiki',
'ext.uls.webfonts',
'mediawiki.api.parse',
-   'mediawiki.ui.checkbox',
),
 ) + $resourcePaths;
 
@@ -102,7 +101,6 @@
'ext.uls.languagesettings',
'ext.uls.mediawiki',
'jquery.ime',
-   'mediawiki.ui.radio',
),
 ) + $resourcePaths;
 
@@ -131,6 +129,7 @@
'scripts' = 'resources/js/ext.uls.languagesettings.js',
'styles' = 'resources/css/ext.uls.languagesettings.css',
'dependencies' = array(
+   'ext.uls.buttons',
'ext.uls.messages',
'ext.uls.preferences',
// The grid styles are used here,
@@ -255,7 +254,6 @@
'jquery.i18n',
'jquery.uls.data',
'jquery.uls.grid',
-   'mediawiki.ui.input',
),
 ) + $resourcePaths;
 
diff --git a/resources/css/ext.uls.inputsettings.css 
b/resources/css/ext.uls.inputsettings.css
index bb9484c..1065807 100644
--- a/resources/css/ext.uls.inputsettings.css
+++ b/resources/css/ext.uls.inputsettings.css
@@ -12,7 +12,7 @@
 }
 
 .imelabel {
-   display: inline;
+   display: block;
padding-bottom: 10px;
font-size: 10pt;
line-height: 16pt;
@@ -22,6 +22,10 @@
padding-left: 5px;
 }
 
+.imelabel input {
+   float: left;
+}
+
 .uls-ime-menu-settings-item {
background-color: #f0f0f0;
border-radius: 0 0 5px 5px;
diff --git a/resources/js/ext.uls.displaysettings.js 
b/resources/js/ext.uls.displaysettings.js
index 4a06124..3d90e05 100644
--- a/resources/js/ext.uls.displaysettings.js
+++ b/resources/js/ext.uls.displaysettings.js
@@ -23,9 +23,9 @@
 
+ 'div class=row' // Tab switcher buttons
+ 'div class=twelve columns 
uls-display-settings-tab-switcher'
-   + 'div class=uls-button-group mw-ui-button-group'
-   + 'button id=uls-display-settings-language-tab 
class=mw-ui-button mw-ui-checked 
data-i18n=ext-uls-display-settings-language-tab/button'
-   + 'button id=uls-display-settings-fonts-tab 
class=mw-ui-button data-i18n=ext-uls-display-settings-fonts-tab/button'
+   + 'div class=uls-button-group'
+   + 'button id=uls-display-settings-language-tab class=button 
down data-i18n=ext-uls-display-settings-language-tab/button'
+   + 'button id=uls-display-settings-fonts-tab class=button 
data-i18n=ext-uls-display-settings-fonts-tab/button'
+ '/div'
+ '/div'
+ '/div'
@@ -79,9 +79,9 @@
 
// Webfonts enabling checkbox with label
+ 'div class=row'
-   + 'div class=eleven columns mw-ui-checkbox'
+   + 'div class=eleven columns'
+   + 'label class=checkbox'
+ 'input type=checkbox id=webfonts-enable-checkbox /'
-   + 'label class=checkbox for=webfonts-enable-checkbox'
+ 'strong 
data-i18n=ext-uls-webfonts-settings-title/strong '
+ 'span data-i18n=ext-uls-webfonts-settings-info/span '
+ 'a target=_blank 
href=https://www.mediawiki.org/wiki/Universal_Language_Selector/WebFonts; 
data-i18n=ext-uls-webfonts-settings-info-link/a'
@@ -242,8 +242,8 @@
return function () {
displaySettings.markDirty();
displaySettings.uiLanguage = 
button.data( 'language' ) || displaySettings.uiLanguage;
-   $( 'div.uls-ui-languages 
button.mw-ui-button' ).removeClass( 'mw-ui-checked' );
-   button.addClass( 'mw-ui-checked' );
+   $( 'div.uls-ui-languages button.button' 

[MediaWiki-commits] [Gerrit] Improve contributions page entry point by adding 3 ways to c... - change (mediawiki...ContentTranslation)

2015-03-27 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Improve contributions page entry point by adding 3 ways to 
contribute
..

Improve contributions page entry point by adding 3 ways to contribute

Bug: T92939
Change-Id: If6670eb05106516637221a24f0a64e084f27626b
---
M Resources.php
M i18n/en.json
M i18n/qqq.json
M modules/entrypoint/ext.cx.contributions.js
D modules/entrypoint/images/dropdown.svg
A modules/entrypoint/images/editarticle.png
A modules/entrypoint/images/editarticle.svg
A modules/entrypoint/images/translation.png
A modules/entrypoint/images/translation.svg
A modules/entrypoint/images/upload.png
A modules/entrypoint/images/upload.svg
M modules/entrypoint/styles/ext.cx.contributions.less
12 files changed, 105 insertions(+), 94 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/20/200120/1

diff --git a/Resources.php b/Resources.php
index 4304ade..8028cb0 100644
--- a/Resources.php
+++ b/Resources.php
@@ -26,9 +26,12 @@
'mediawiki.ui.button',
),
'messages' = array(
-   'cx-contributions',
+   'cx-contributions-new-article',
'cx-contributions-translation',
-   'cx-contributions-media',
+   'cx-contributions-upload',
+   'cx-contributions-new-article-tooltip',
+   'cx-contributions-translation-tooltip',
+   'cx-contributions-upload-tooltip',
),
 ) + $resourcePaths;
 
diff --git a/i18n/en.json b/i18n/en.json
index aba65c9..d64a71f 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -132,9 +132,12 @@
cx-save-draft-save-success: Saved {{PLURAL:$1|a minute ago|$1 
minutes ago|0=just now}},
cx-save-draft-saving: Saving...,
cx-save-draft-tooltip: Translation drafts are saved automatically,
-   cx-contributions: New contribution,
+   cx-contributions-new-article: Start a draft,
cx-contributions-translation: Translation,
-   cx-contributions-media: Upload media file,
+   cx-contributions-upload: Upload media,
+   cx-contributions-new-article-tooltip: Start writing a new article 
for wikipedia,
+   cx-contributions-translation-tooltip: Translate existing articles,
+   cx-contributions-upload-tooltip: Upload pictures, audio and video to 
use in articles,
cx-publishing-dialog-message: The page $1 already exists. The 
current content will be replaced by your translation. Do you want to publish 
anyway?,
cx-publishing-dialog-keep-button: Keep both versions,
cx-publishing-dialog-publish-anyway-button: Publish anyway,
diff --git a/i18n/qqq.json b/i18n/qqq.json
index a546ece..08d5839 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -139,9 +139,12 @@
cx-save-draft-save-success: \Saved\ refers to a draft of a 
translated page that was saved recently.,
cx-save-draft-saving: Label of button to save the translation as 
draft while saving is in progress\n{{Identical|Saving}},
cx-save-draft-tooltip: Tooltip text shown for the save status 
indicator text in the header of [[Special:ContentTranslation]].\n\nParameters: 
\n* $1 - the number of minutes ago the translation was saved.,
-   cx-contributions: Text of a button which opens a dropdown,
-   cx-contributions-translation: Dropdown 
item\n{{Identical|Translation}},
-   cx-contributions-media: Dropdown item,
+   cx-contributions-new-article: Button label,
+   cx-contributions-translation: Button label,
+   cx-contributions-upload: Button label,
+   cx-contributions-new-article: Button label tooltip,
+   cx-contributions-translation: Button label tooltip,
+   cx-contributions-upload: Button label tooltip,
cx-publishing-dialog-message: Message that shows in the publishing 
options dialog when there is an existing page with the same title already 
published.\n\nParameters:\n* $1 - The link to the existing page with just the 
title as text.,
cx-publishing-dialog-keep-button: Button label for publishing 
options dialog. Clicking button preserves both the existing translation and the 
new translation.,
cx-publishing-dialog-publish-anyway-button: Button label for 
publishing options dialog. Clicking button overwrites the existing translation 
with the new translation.,
diff --git a/modules/entrypoint/ext.cx.contributions.js 
b/modules/entrypoint/ext.cx.contributions.js
index cbb42ff..786033c 100644
--- a/modules/entrypoint/ext.cx.contributions.js
+++ b/modules/entrypoint/ext.cx.contributions.js
@@ -11,13 +11,10 @@
/**
 * @class
 */
-   function CXContributions( element, options ) {
+   function CXContributions( element ) {
this.$element = $( element );
-   this.options = $.extend( {}, $.fn.cxContributions.defaults, 
options );
+   

[MediaWiki-commits] [Gerrit] Templates: Remove compount content blocks from several trans... - change (mediawiki...ContentTranslation)

2015-03-27 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Templates: Remove compount content blocks from several 
transclusions
..

Templates: Remove compount content blocks from several transclusions

An example: The infobox at enwiki:California
At present, we cannot provide edit support to them.
So remove it from source.

Also see
See 
http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Transclusion_content

Change-Id: I9a98379bc8bf365cb996a64e48de423d29a0721a
---
M modules/source/ext.cx.source.filter.js
1 file changed, 11 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/26/200126/1

diff --git a/modules/source/ext.cx.source.filter.js 
b/modules/source/ext.cx.source.filter.js
index d0bdecc..a0056ff 100644
--- a/modules/source/ext.cx.source.filter.js
+++ b/modules/source/ext.cx.source.filter.js
@@ -81,14 +81,20 @@
 
mwData = $template.data( 'mw' );
 
-   if ( !mwData || mwData.parts.length  1 ) {
-   // Either the template is missing mw data or 
having multiple parts.
-   // At present, we cannot handle them.
+   if ( !mwData ) {
+   mw.log( '[CX] Skipping template!' );
+   return;
+   }
+
+   if ( mwData.parts.length  1 ) {
+   // This is compound content blocks that include 
output from several transclusions
+   // At present, we cannot provide edit support 
to them.
+   // See 
http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Transclusion_content
// An example:
// {{Version |o |1.1}}{{efn-ua |Due to an 
incident ...ref name=releases /}}
// in enwiki:Debian, Timeline table.
-   mw.log( '[CX] Skipping template!' );
-
+   mw.log( '[CX] Removing multi part template' );
+   sourceFilter.removeTemplate( $template );
return;
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a98379bc8bf365cb996a64e48de423d29a0721a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Use update callout widget for the new article campaign dialog - change (mediawiki...ContentTranslation)

2015-03-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Use update callout widget for the new article campaign dialog
..

Use update callout widget for the new article campaign dialog

Change-Id: I6458f120c9cf5e7fdeb0f9c310665ffee5dacd12
---
M modules/campaigns/ext.cx.campaigns.newarticle.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/47/199847/1

diff --git a/modules/campaigns/ext.cx.campaigns.newarticle.js 
b/modules/campaigns/ext.cx.campaigns.newarticle.js
index f729371..cdc7056 100644
--- a/modules/campaigns/ext.cx.campaigns.newarticle.js
+++ b/modules/campaigns/ext.cx.campaigns.newarticle.js
@@ -36,7 +36,7 @@
 
$trigger.callout( {
trigger: 'auto',
-   gravity: $.fn.callout.autoNEW,
+   direction: $.fn.callout.autoDirection( '1' ),
content: $banner
} );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6458f120c9cf5e7fdeb0f9c310665ffee5dacd12
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix the small font size issue in monobook skin - change (mediawiki...ContentTranslation)

2015-03-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix the small font size issue in monobook skin
..

Fix the small font size issue in monobook skin

Avoid font size inheritance from skin for CX widgets

Bug: T93180
Change-Id: Ic96def4aa352c2cc50850256fc09151febf00ea6
---
M modules/dashboard/styles/ext.cx.dashboard.less
M modules/translationview/styles/ext.cx.translationview.less
2 files changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/dashboard/styles/ext.cx.dashboard.less 
b/modules/dashboard/styles/ext.cx.dashboard.less
index 0325962..8e1c51b 100644
--- a/modules/dashboard/styles/ext.cx.dashboard.less
+++ b/modules/dashboard/styles/ext.cx.dashboard.less
@@ -45,6 +45,7 @@
color: @gray-darker;
background: white;
padding-bottom: 50px;
+   font-size: medium;
 }
 
 // Do not display the header bar containing the link to dashboard in dashboard 
page.
diff --git a/modules/translationview/styles/ext.cx.translationview.less 
b/modules/translationview/styles/ext.cx.translationview.less
index 41ff5cb..ff642b4 100644
--- a/modules/translationview/styles/ext.cx.translationview.less
+++ b/modules/translationview/styles/ext.cx.translationview.less
@@ -25,6 +25,7 @@
color: @gray-darker;
background: white;
padding-bottom: 50px;
+   font-size: medium;
 }
 
 .cx-widget__header {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic96def4aa352c2cc50850256fc09151febf00ea6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Introduce common widget style LESS file - change (mediawiki...ContentTranslation)

2015-03-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Introduce common widget style LESS file
..

Introduce common widget style LESS file

* Add widgets/common/ext.cx.common.less as the top level common
  styling for CX
* Abstract the Grid system in it

This is part of common UI widgets refactoring.

Change-Id: I51dfe65f1f23f56845c0ea3051ba6152bf61c80b
---
M modules/base/styles/ext.cx.feedback.less
M modules/dashboard/styles/ext.cx.dashboard.less
M modules/dashboard/styles/ext.cx.magnuslink.less
M modules/dashboard/styles/ext.cx.translationlist.less
M modules/entrypoint/styles/ext.cx.entrypoint.less
M modules/entrypoint/styles/ext.cx.redlink.less
M modules/header/styles/ext.cx.header.less
M modules/publish/styles/ext.cx.publish.dialog.less
M modules/publish/styles/ext.cx.publish.less
M modules/source/styles/ext.cx.source.less
M modules/source/styles/ext.cx.source.selector.less
M modules/stats/styles/ext.cx.stats.less
M modules/tools/styles/ext.cx.progressbar.less
M modules/tools/styles/ext.cx.tools.card.less
M modules/tools/styles/ext.cx.tools.categories.less
M modules/tools/styles/ext.cx.tools.dictionary.less
M modules/tools/styles/ext.cx.tools.formatter.less
M modules/tools/styles/ext.cx.tools.instructions.less
M modules/tools/styles/ext.cx.tools.less
M modules/tools/styles/ext.cx.tools.link.less
M modules/tools/styles/ext.cx.tools.manager.less
M modules/tools/styles/ext.cx.tools.mt.less
M modules/tools/styles/ext.cx.tools.mtabuse.less
M modules/tools/styles/ext.cx.tools.reference.less
M modules/translation/styles/ext.cx.translation.conflict.less
M modules/translation/styles/ext.cx.translation.less
M modules/translationview/styles/ext.cx.translationview.less
R modules/widgets/common/grid/agora-grid.less
R modules/widgets/common/grid/grid-core.less
R modules/widgets/common/grid/grid-responsive.less
R modules/widgets/common/grid/grid-settings.less
31 files changed, 29 insertions(+), 64 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/60/199860/1

diff --git a/modules/base/styles/ext.cx.feedback.less 
b/modules/base/styles/ext.cx.feedback.less
index c54bf9e..ca3d46c 100644
--- a/modules/base/styles/ext.cx.feedback.less
+++ b/modules/base/styles/ext.cx.feedback.less
@@ -1,4 +1,4 @@
-@import ../../base/styles/grid/agora-grid;
+@import ../../widgets/common/ext.cx.common;
 @import mediawiki.mixins;
 
 .cx-feedback {
diff --git a/modules/dashboard/styles/ext.cx.dashboard.less 
b/modules/dashboard/styles/ext.cx.dashboard.less
index 8e1c51b..070511d 100644
--- a/modules/dashboard/styles/ext.cx.dashboard.less
+++ b/modules/dashboard/styles/ext.cx.dashboard.less
@@ -1,11 +1,4 @@
-@import ../../base/styles/grid/agora-grid;
-@import mediawiki.mixins;
-
-@gray-darker: #252525;
-@gray-dark: #565656;
-@gray: #C9C9C9;
-@gray-light: #f0f0f0;
-@gray-lighter: #fbfbfb;
+@import ../../widgets/common/ext.cx.common;
 
 h2 {
color: @gray-darker;
@@ -38,14 +31,6 @@
.cx-feedback {
right: 10px;
}
-}
-
-.cx-widget {
-   .mw-ui-grid;
-   color: @gray-darker;
-   background: white;
-   padding-bottom: 50px;
-   font-size: medium;
 }
 
 // Do not display the header bar containing the link to dashboard in dashboard 
page.
diff --git a/modules/dashboard/styles/ext.cx.magnuslink.less 
b/modules/dashboard/styles/ext.cx.magnuslink.less
index f521641..78dc0b5 100644
--- a/modules/dashboard/styles/ext.cx.magnuslink.less
+++ b/modules/dashboard/styles/ext.cx.magnuslink.less
@@ -1,5 +1,4 @@
-@import ../../base/styles/grid/agora-grid;
-@import mediawiki.mixins;
+@import ../../widgets/common/ext.cx.common;
 
 .cx-magnus-link {
.mw-ui-item;
diff --git a/modules/dashboard/styles/ext.cx.translationlist.less 
b/modules/dashboard/styles/ext.cx.translationlist.less
index 5683834..b07ec04 100644
--- a/modules/dashboard/styles/ext.cx.translationlist.less
+++ b/modules/dashboard/styles/ext.cx.translationlist.less
@@ -1,4 +1,4 @@
-@import ../../base/styles/grid/agora-grid;
+@import ../../widgets/common/ext.cx.common;
 @import mediawiki.mixins;
 
 .cx-translationlist {
diff --git a/modules/entrypoint/styles/ext.cx.entrypoint.less 
b/modules/entrypoint/styles/ext.cx.entrypoint.less
index 8b5aae9..c2cfdad 100644
--- a/modules/entrypoint/styles/ext.cx.entrypoint.less
+++ b/modules/entrypoint/styles/ext.cx.entrypoint.less
@@ -1,4 +1,4 @@
-@import ../../base/styles/grid/agora-grid;
+@import ../../widgets/common/ext.cx.common;
 @import mediawiki.mixins;
 
 .cx-entrypoint-dialog {
@@ -80,4 +80,4 @@
font-size: 12px;
color: #777;
border-top: 1px solid #f5f5f5;
-}
\ No newline at end of file
+}
diff --git a/modules/entrypoint/styles/ext.cx.redlink.less 
b/modules/entrypoint/styles/ext.cx.redlink.less
index 932cae3..0d78924 100644
--- a/modules/entrypoint/styles/ext.cx.redlink.less
+++ 

[MediaWiki-commits] [Gerrit] Make spinner as a widget module - change (mediawiki...ContentTranslation)

2015-03-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Make spinner as a widget module
..

Make spinner as a widget module

Change-Id: Id984cfd455ffa8ad2ae47a816983f88f13de82d2
---
M Resources.php
R modules/widgets/spinner/ext.cx.spinner.less
2 files changed, 8 insertions(+), 2 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index 1c959bb..7b4e7a2 100644
--- a/Resources.php
+++ b/Resources.php
@@ -173,7 +173,6 @@
),
'styles' = array(
'source/styles/ext.cx.source.less',
-   'base/styles/ext.cx.spinner.less',
),
'dependencies' = array(
'ext.cx.util',
@@ -183,6 +182,7 @@
'mediawiki.api',
'mediawiki.jqueryMsg',
'mediawiki.util',
+   'ext.cx.widgets.spinner',
),
'messages' = array(
'cx-source-view-page',
@@ -272,7 +272,6 @@
),
'styles' = array(
'tools/styles/ext.cx.tools.less',
-   'base/styles/ext.cx.spinner.less',
),
'dependencies' = array(
'ext.cx.feedback',
@@ -291,6 +290,7 @@
'ext.cx.util.selection',
'jquery.uls.data',
'mediawiki.jqueryMsg',
+   'ext.cx.widgets.spinner',
),
 ) + $resourcePaths;
 
@@ -721,6 +721,12 @@
),
 ) + $resourcePaths;
 
+$wgResourceModules['ext.cx.widgets.spinner'] = array(
+   'styles' = array(
+   'widgets/spinner/ext.cx.spinner.less',
+   ),
+) + $resourcePaths;
+
 $wgResourceModules['ext.cx.widgets.callout'] = array(
'scripts' = array(
'widgets/callout/ext.cx.callout.js',
diff --git a/modules/base/styles/ext.cx.spinner.less 
b/modules/widgets/spinner/ext.cx.spinner.less
similarity index 100%
rename from modules/base/styles/ext.cx.spinner.less
rename to modules/widgets/spinner/ext.cx.spinner.less

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id984cfd455ffa8ad2ae47a816983f88f13de82d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Refactor the feedback tool as a widget module - change (mediawiki...ContentTranslation)

2015-03-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Refactor the feedback tool as a widget module
..

Refactor the feedback tool as a widget module

Change-Id: I7d64dd5e76eb3bf92b6331f4a0e384fe3cb8b556
---
M Resources.php
R modules/widgets/feedback/ext.cx.feedback.js
R modules/widgets/feedback/images/horn.png
R modules/widgets/feedback/images/horn.svg
R modules/widgets/feedback/styles/ext.cx.feedback.less
5 files changed, 2 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/65/199865/1

diff --git a/Resources.php b/Resources.php
index 7b4e7a2..56a5a1f 100644
--- a/Resources.php
+++ b/Resources.php
@@ -53,10 +53,10 @@
'ext.cx.model',
),
'scripts' = array(
-   'base/ext.cx.feedback.js',
+   'widgets/feedback/ext.cx.feedback.js',
),
'styles' = array(
-   'base/styles/ext.cx.feedback.less',
+   'widgets/feedback/styles/ext.cx.feedback.less',
),
'messages' = array(
'cx-feedback-link',
diff --git a/modules/base/ext.cx.feedback.js 
b/modules/widgets/feedback/ext.cx.feedback.js
similarity index 100%
rename from modules/base/ext.cx.feedback.js
rename to modules/widgets/feedback/ext.cx.feedback.js
diff --git a/modules/base/images/horn.png 
b/modules/widgets/feedback/images/horn.png
similarity index 100%
rename from modules/base/images/horn.png
rename to modules/widgets/feedback/images/horn.png
Binary files differ
diff --git a/modules/base/images/horn.svg 
b/modules/widgets/feedback/images/horn.svg
similarity index 100%
rename from modules/base/images/horn.svg
rename to modules/widgets/feedback/images/horn.svg
diff --git a/modules/base/styles/ext.cx.feedback.less 
b/modules/widgets/feedback/styles/ext.cx.feedback.less
similarity index 87%
rename from modules/base/styles/ext.cx.feedback.less
rename to modules/widgets/feedback/styles/ext.cx.feedback.less
index ca3d46c..4c54298 100644
--- a/modules/base/styles/ext.cx.feedback.less
+++ b/modules/widgets/feedback/styles/ext.cx.feedback.less
@@ -1,4 +1,3 @@
-@import ../../widgets/common/ext.cx.common;
 @import mediawiki.mixins;
 
 .cx-feedback {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7d64dd5e76eb3bf92b6331f4a0e384fe3cb8b556
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Move progressbar to widgets - change (mediawiki...ContentTranslation)

2015-03-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Move progressbar to widgets
..

Move progressbar to widgets

Change-Id: Id50ac227a4cc909c85673dc8d7d05cc4478d58c5
---
M Resources.php
R modules/widgets/progressbar/ext.cx.progressbar.js
R modules/widgets/progressbar/ext.cx.progressbar.less
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/11/200111/1

diff --git a/Resources.php b/Resources.php
index 1c959bb..7297639 100644
--- a/Resources.php
+++ b/Resources.php
@@ -464,9 +464,9 @@
 ) + $resourcePaths;
 
 $wgResourceModules['ext.cx.progressbar'] = array(
-   'scripts' = 'tools/ext.cx.progressbar.js',
+   'scripts' = 'widgets/progressbar/ext.cx.progressbar.js',
'styles' = array(
-   'tools/styles/ext.cx.progressbar.less',
+   'widgets/progressbar/ext.cx.progressbar.less',
),
'messages' = array(
'cx-header-progressbar-text',
diff --git a/modules/tools/ext.cx.progressbar.js 
b/modules/widgets/progressbar/ext.cx.progressbar.js
similarity index 100%
rename from modules/tools/ext.cx.progressbar.js
rename to modules/widgets/progressbar/ext.cx.progressbar.js
diff --git a/modules/tools/styles/ext.cx.progressbar.less 
b/modules/widgets/progressbar/ext.cx.progressbar.less
similarity index 92%
rename from modules/tools/styles/ext.cx.progressbar.less
rename to modules/widgets/progressbar/ext.cx.progressbar.less
index f5f84de..ba7e0b4 100644
--- a/modules/tools/styles/ext.cx.progressbar.less
+++ b/modules/widgets/progressbar/ext.cx.progressbar.less
@@ -1,4 +1,4 @@
-@import ../../widgets/common/ext.cx.common;
+@import ../common/ext.cx.common;
 
 .cx-header__progressbar {
.mw-ui-one-whole;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id50ac227a4cc909c85673dc8d7d05cc4478d58c5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Stats: Add missing 'jquery.uls.data' module - change (mediawiki...ContentTranslation)

2015-03-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Stats: Add missing 'jquery.uls.data' module
..

Stats: Add missing 'jquery.uls.data' module

Change-Id: If71303e10b1f22a60e18abe98758615ec0a3e853
---
M Resources.php
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/Resources.php b/Resources.php
index d070102..4304ade 100644
--- a/Resources.php
+++ b/Resources.php
@@ -668,7 +668,8 @@
'dependencies' = array(
'ext.cx.sitemapper',
'ext.cx.util',
-   'chart.js'
+   'chart.js',
+   'jquery.uls.data'
),
'messages' = array(
'cx-stats-table-source-target',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If71303e10b1f22a60e18abe98758615ec0a3e853
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Remove the User namespace vs Main namespace publishing summary - change (mediawiki...ContentTranslation)

2015-03-25 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Remove the User namespace vs Main namespace publishing summary
..

Remove the User namespace vs Main namespace publishing summary

All publishing is at Main namespace now

Change-Id: Icbf858b92d0aaa267d5990f7f1f408cc564e4106
---
M specials/SpecialContentTranslationStats.php
1 file changed, 0 insertions(+), 26 deletions(-)


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

diff --git a/specials/SpecialContentTranslationStats.php 
b/specials/SpecialContentTranslationStats.php
index 33f9274..1a91115 100644
--- a/specials/SpecialContentTranslationStats.php
+++ b/specials/SpecialContentTranslationStats.php
@@ -28,32 +28,6 @@
 
// @TODO better to return title = stats iterator
$stats = ContentTranslation\Stats::getStats();
-   $out-addHtml( $this-getPagesSummary( $stats ) );
$out-addModules( 'ext.cx.stats' );
-   }
-
-   private function getPagesSummary( $pages ) {
-   $total = $main = 0;
-
-   foreach ( $pages as $row ) {
-   $title = Title::newFromRow( $row );
-
-   $total++;
-   if ( $title-inNamespace( NS_MAIN ) ) {
-   $main++;
-   }
-   }
-
-   if ( $total  0 ) {
-   $percentage = round( $main / $total * 100 );
-   } else {
-   $percentage = 0;
-   }
-
-   $summary = wfMessage( 'cx-stats-summary' )
-   -numParams( $main, $total, $percentage )
-   -parse();
-
-   return $summary;
}
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbf858b92d0aaa267d5990f7f1f408cc564e4106
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix javascript error in inputsettings module - change (mediawiki...UniversalLanguageSelector)

2015-03-23 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix javascript error in inputsettings module
..

Fix javascript error in inputsettings module

Change-Id: I77262c98a4a2efb91785b19bc1c306e3f2f16954
Followup: Id186ece6513f154
---
M resources/js/ext.uls.inputsettings.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/resources/js/ext.uls.inputsettings.js 
b/resources/js/ext.uls.inputsettings.js
index d37fd28..cd61fda 100644
--- a/resources/js/ext.uls.inputsettings.js
+++ b/resources/js/ext.uls.inputsettings.js
@@ -167,7 +167,7 @@
return $();
}
 
-   $imeHolder = $( 'div' ).class( 'mw-ui-radio' );
+   $imeHolder = $( 'div' ).addClass( 'mw-ui-radio' );
 
$imeLabel = $( 'label' ).attr( {
'for': imeId,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I77262c98a4a2efb91785b19bc1c306e3f2f16954
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Add missing RL dependency ext.uls.init to test module ext.ul... - change (mediawiki...UniversalLanguageSelector)

2015-03-23 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Add missing RL dependency ext.uls.init to test module 
ext.uls.tests
..

Add missing RL dependency ext.uls.init to test module ext.uls.tests

Bug: T93510
Change-Id: Ie1280c8b442be70d4b6f53bf85a5f9b7fdc29dbc
---
M UniversalLanguageSelector.hooks.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/UniversalLanguageSelector.hooks.php 
b/UniversalLanguageSelector.hooks.php
index 213c13c..e368e3e 100644
--- a/UniversalLanguageSelector.hooks.php
+++ b/UniversalLanguageSelector.hooks.php
@@ -108,7 +108,7 @@
public static function addTestModules( array $testModules, 
ResourceLoader $resourceLoader ) {
$testModules['qunit']['ext.uls.tests'] = array(
'scripts' = array( 'tests/qunit/ext.uls.tests.js' ),
-   'dependencies' = array( 'jquery.uls', 
'ext.uls.preferences' ),
+   'dependencies' = array( 'jquery.uls', 'ext.uls.init', 
'ext.uls.preferences' ),
'localBasePath' = __DIR__,
'remoteExtPath' = 'UniversalLanguageSelector',
);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1280c8b442be70d4b6f53bf85a5f9b7fdc29dbc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Generate hreflang tags in head of article pages - change (mediawiki/core)

2015-03-23 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Generate hreflang tags in head of article pages
..

Generate hreflang tags in head of article pages

Improved version of Stu's proof of concept
BUg: T93213

Change-Id: I30a6af657a11bf822736d667a82b21e813f0db4e
---
M includes/OutputPage.php
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/96/198696/1

diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 5ad33fa..b54e079 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -3515,6 +3515,19 @@
) );
}
 
+   # Generate hreflang tags
+   $languageLinks = $this-getLanguageLinks();
+   if ( count( $languageLinks )  1 ) {
+   foreach ( $languageLinks as $languageLinkText ) {
+   $languageLinkTitle = Title::newFromText( 
$languageLinkText );
+   $tags[] = Html::element( 'link', array(
+   'rel' = 'alternate',
+   'hreflang' = 
$languageLinkTitle-getInterwiki(),
+   'href' = 
$languageLinkTitle-getFullURL()
+   ) );
+   }
+   };
+
return $tags;
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I30a6af657a11bf822736d667a82b21e813f0db4e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Stats: Remove wrong group by from stats query - change (mediawiki...ContentTranslation)

2015-03-20 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Stats: Remove wrong group by from stats query
..

Stats: Remove wrong group by from stats query

This was causing duplicated records for a language pair on result
causing the wrong display and sum in Special:CXStats page

Change-Id: If8ad38d185de7fb075cc4761a8a1b41c1bed4357
---
M includes/Translation.php
1 file changed, 0 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/87/198187/1

diff --git a/includes/Translation.php b/includes/Translation.php
index 780d228..96d3849 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -139,7 +139,6 @@
'GROUP BY' = array(
'translation_source_language',
'translation_target_language',
-   'translation_status'
),
)
);
@@ -180,7 +179,6 @@
'GROUP BY' = array(
'translation_source_language',
'translation_target_language',
-   'translation_status'
),
)
);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If8ad38d185de7fb075cc4761a8a1b41c1bed4357
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Add eventlogging to measure entry point effectiveness - change (mediawiki...ContentTranslation)

2015-03-18 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Add eventlogging to measure entry point effectiveness
..

Add eventlogging to measure entry point effectiveness

Schema: https://meta.wikimedia.org/wiki/Schema:ContentTranslationCTA
Integrated to red interlanguage link and new article by translation campaigns

Uses session id to log 3 actions by the entry points:
- An entry point is shown to user - red interlanguage link dialog, or new
  article-by-translation campaign dialog
- User accept it
- User reject it

After this stage, translation can happen. Publishing may happen.
Those steps will be measured in follow up commits using different schema

Bug: T90529, T88569
Change-Id: I3b1d54f879ba49542b4bda9585aa02f994ba2ac3
---
M ContentTranslation.hooks.php
M modules/base/ext.cx.sitemapper.js
M modules/campaigns/ext.cx.campaigns.newarticle.js
M modules/dashboard/ext.cx.dashboard.js
M modules/entrypoint/ext.cx.entrypoint.js
M modules/entrypoint/ext.cx.redlink.js
M modules/eventlogging/ext.cx.eventlogging.js
7 files changed, 67 insertions(+), 23 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/89/197489/1

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index fbf12da..1fbe673 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -106,6 +106,7 @@
 */
public static function addEventLogging( array $schemas ) {
$schemas['ContentTranslation'] = 7146627;
+   $schemas['ContentTranslationCTA'] = 11616099;
}
 
/**
diff --git a/modules/base/ext.cx.sitemapper.js 
b/modules/base/ext.cx.sitemapper.js
index 605b3ed..8558b8b 100644
--- a/modules/base/ext.cx.sitemapper.js
+++ b/modules/base/ext.cx.sitemapper.js
@@ -109,12 +109,14 @@
 * @param {string} targetTitle
 * @param {string} sourceLanguage
 * @param {string} targetLanguage
+* @param {string} [campaign]
 */
mw.cx.SiteMapper.prototype.getCXUrl = function (
sourceTitle,
targetTitle,
sourceLanguage,
-   targetLanguage
+   targetLanguage,
+   campaign
) {
var cxPage, uri, queryParams;
 
@@ -123,9 +125,12 @@
page: sourceTitle,
from: sourceLanguage,
to: targetLanguage,
-   targettitle: targetTitle
+   targettitle: targetTitle,
};
 
+   if ( campaign ) {
+   queryParams.campaign = campaign;
+   }
if ( mw.config.get( 'wgContentTranslationTranslateInTarget' ) ) 
{
uri = new mw.Uri( this.getPageUrl( targetLanguage, 
cxPage ) );
$.extend( uri.query, queryParams );
diff --git a/modules/campaigns/ext.cx.campaigns.newarticle.js 
b/modules/campaigns/ext.cx.campaigns.newarticle.js
index 78c1862..b85e954 100644
--- a/modules/campaigns/ext.cx.campaigns.newarticle.js
+++ b/modules/campaigns/ext.cx.campaigns.newarticle.js
@@ -56,10 +56,16 @@
path: '/'
}
);
+   // Campaign or call to action was rejected by the user.
+   mw.hook( 'mw.cx.cta.reject' ).fire( campaign );
} );
$tryCX.on( 'click', function () {
location.href = cxLink;
+   // We need to log this using eventlogging, but since we 
are navigating away
+   // we cannot do it reliably here(See 
https://phabricator.wikimedia.org/T44815).
+   // We will do it at server side
} );
+   mw.hook( 'mw.cx.cta.shown' ).fire( campaign );
}
 
$( function () {
diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index 0ef91a8..9a5c831 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -72,6 +72,9 @@
sourceSelectorOptions.sourceTitle = query.page;
sourceSelectorOptions.targetTitle = query.targettitle;
this.$newTranslationButton.cxSourceSelector( 
sourceSelectorOptions );
+   if ( query.campaign ) {
+   mw.hook( 'mw.cx.cta.accept' ).fire( query.campaign, 
query.from, query.to );
+   }
};
 
$.fn.cxDashboard = function ( siteMapper, options ) {
diff --git a/modules/entrypoint/ext.cx.entrypoint.js 
b/modules/entrypoint/ext.cx.entrypoint.js
index 14920f3..19d07f6 100644
--- a/modules/entrypoint/ext.cx.entrypoint.js
+++ b/modules/entrypoint/ext.cx.entrypoint.js
@@ -108,6 +108,7 @@

[MediaWiki-commits] [Gerrit] Eventlogging for various actions on translation - change (mediawiki...ContentTranslation)

2015-03-18 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Eventlogging for various actions on translation
..

Eventlogging for various actions on translation

Schema:  https://meta.wikimedia.org/wiki/Schema:ContentTranslation

Bug: T90529, T88569
Change-Id: I81cab64c07a4d9f474165f96c4686918e08491f0
---
M ContentTranslation.hooks.php
M modules/dashboard/ext.cx.translationlist.js
M modules/draft/ext.cx.draft.js
M modules/eventlogging/ext.cx.eventlogging.js
4 files changed, 71 insertions(+), 7 deletions(-)


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

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 1fbe673..42d3e11 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -105,7 +105,7 @@
 * Hook: EventLoggingRegisterSchemas
 */
public static function addEventLogging( array $schemas ) {
-   $schemas['ContentTranslation'] = 7146627;
+   $schemas['ContentTranslation'] = 11618043;
$schemas['ContentTranslationCTA'] = 11616099;
}
 
diff --git a/modules/dashboard/ext.cx.translationlist.js 
b/modules/dashboard/ext.cx.translationlist.js
index cf639d2..2e8f1c7 100644
--- a/modules/dashboard/ext.cx.translationlist.js
+++ b/modules/dashboard/ext.cx.translationlist.js
@@ -161,7 +161,9 @@
.addClass( 'image' );
$progressbar = $( 'div' )
.addClass( 'progressbar' )
-   .cxProgressBar( { weights: progress } );
+   .cxProgressBar( {
+   weights: progress
+   } );
$imageBlock.append( $image, $progressbar );
this.showTitleImage( translation );
 
@@ -313,6 +315,7 @@
.then( function ( response ) {
if ( response.cxdelete.result 
=== 'success' ) {

translationList.markTranslationAsDeleted( translation );
+   mw.hook( 
'mw.cx.translation.deleted' ).fire();
}
} );
} );
diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index f2c54d3..4f8cc6c 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -153,6 +153,7 @@
$section.attr( 'data-cx-draft', true );
mw.hook( 'mw.cx.translation.postMT' ).fire( $section );
}
+   mw.hook( 'mw.cx.translation.restored' ).fire();
};
 
/**
diff --git a/modules/eventlogging/ext.cx.eventlogging.js 
b/modules/eventlogging/ext.cx.eventlogging.js
index 1bec68f..13e7b30 100644
--- a/modules/eventlogging/ext.cx.eventlogging.js
+++ b/modules/eventlogging/ext.cx.eventlogging.js
@@ -23,7 +23,8 @@
 */
listen: function () {
// Register handlers for event logging triggers
-   mw.hook( 'mw.cx.translation.published' ).add( $.proxy( 
this.translatedPageCreated, this ) );
+   mw.hook( 'mw.cx.translation.published' ).add( $.proxy( 
this.published, this ) );
+   mw.hook( 'mw.cx.translation.saved' ).add( $.proxy( 
this.saved, this ) );
mw.hook( 'mw.cx.cta.shown' ).add( $.proxy( 
this.ctaShown, this ) );
mw.hook( 'mw.cx.cta.accept' ).add( $.proxy( 
this.ctaAccept, this ) );
mw.hook( 'mw.cx.cta.reject' ).add( $.proxy( 
this.ctaReject, this ) );
@@ -34,16 +35,75 @@
 * @param {string} contentLanguage source language
 * @param {string} targetLanguage Target language code
 */
-   translatedPageCreated: function ( contentLanguage, 
targetLanguage ) {
+   translated: function ( action, sourceLanguage, targetLanguage, 
sourceTitle, targetTitle ) {
mw.track( 'event.ContentTranslation', {
version: 1,
token: mw.user.id(),
-   action: 'create-translated-page',
-   contentLanguage: contentLanguage,
-   targetLanguage: targetLanguage
+   session: mw.user.sessionId(),
+   action: 'publish',
+   sourceLanguage: sourceLanguage,
+   targetLanguage: targetLanguage,
+   sourceTitle: 

[MediaWiki-commits] [Gerrit] References: Fix javascript error by infinite recursion - change (mediawiki...ContentTranslation)

2015-03-17 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: References: Fix javascript error by infinite recursion
..

References: Fix javascript error by infinite recursion

Bug: T92936
Change-Id: I8de0e7758fb06aae1d4e47ad4697fca82ea50e5d
---
M modules/tools/ext.cx.tools.reference.js
1 file changed, 8 insertions(+), 11 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/86/197286/1

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index d9a23ae..13b34fc 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -189,7 +189,7 @@
 * @return {Object|null}
 */
ReferenceCard.prototype.getReferenceData = function ( referenceId ) {
-   var $sourceReference, i, mwData, $referenceSiblings;
+   var $sourceReference, i, mwData, $sibling, $referenceSiblings, 
id;
 
$sourceReference = $( document.getElementById( referenceId ) );
if ( !$sourceReference.is( '[typeof*=mw:Extension/ref]' ) ) {
@@ -197,19 +197,16 @@
return null;
}
 
-   mwData = $sourceReference.data( 'mw' );
-   if ( mwData  mwData.body ) {
-   return mwData;
-   }
-
$referenceSiblings = $( '[typeof*=mw:Extension/references]' )
.find( 'a[href=#' + referenceId + ']' )
-   .siblings();
+   .siblings()
+   .addBack(); // Including self
+
for ( i = 0; i  $referenceSiblings.length; i++ ) {
-   mwData = this.getReferenceData(
-   $( $referenceSiblings[ i ] ).attr( 'href' 
).replace( '#', '' )
-   );
-   if ( mwData ) {
+   id = $( $referenceSiblings[ i ] ).attr( 'href' 
).replace( '#', '' );
+   $sibling = $( document.getElementById( id ) );
+   mwData = $sibling.data( 'mw' );
+   if ( mwData  mwData.body ) {
return mwData;
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8de0e7758fb06aae1d4e47ad4697fca82ea50e5d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Use the callout widget for 'new article from translation' ca... - change (mediawiki...ContentTranslation)

2015-03-16 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Use the callout widget for 'new article from translation' 
campaign
..

Use the callout widget for 'new article from translation' campaign

Change-Id: Id659fe186cf26ae95c9366da4a87287b2a78837c
---
M Resources.php
M modules/campaigns/ext.cx.campaigns.newarticle.js
M modules/campaigns/styles/ext.cx.campaigns.newarticle.less
3 files changed, 13 insertions(+), 59 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index 278c562..6101509 100644
--- a/Resources.php
+++ b/Resources.php
@@ -690,6 +690,7 @@
'jquery.client',
'mediawiki.util',
'jquery.throttle-debounce',
+   'ext.cx.widgets.callout',
),
'messages' = array(
'cx-campaign-newarticle-notice',
diff --git a/modules/campaigns/ext.cx.campaigns.newarticle.js 
b/modules/campaigns/ext.cx.campaigns.newarticle.js
index 78c1862..af94ac3 100644
--- a/modules/campaigns/ext.cx.campaigns.newarticle.js
+++ b/modules/campaigns/ext.cx.campaigns.newarticle.js
@@ -8,11 +8,12 @@
 ( function ( $, mw ) {
'use strict';
 
-   function showInvitation() {
-   var $base, $banner, campaign, cxLink, $cancel, $tryCX;
+   var campaign = 'newarticle';
 
-   campaign = 'newarticle';
-   $base = $( '#pt-betafeatures' );
+   function showInvitation() {
+   var $banner, $trigger, cxLink, $cancel, $tryCX;
+
+   $trigger = $( '#pt-betafeatures' );
cxLink = mw.util.getUrl( 'Special:ContentTranslation', {
campaign: campaign,
targettitle: mw.config.get( 'wgPageName' ),
@@ -26,30 +27,21 @@
$banner = $( 'div' )
.addClass( 'cx-campaign-newarticle' )
.append(
-   $( 'div' ).addClass( 
'cx-campaign-newarticle__caret' ),
$( 'div' ).addClass( 
'cx-campaign-newarticle__logo' ),
$( 'div' ).addClass( 
'cx-campaign-newarticle__message' ).html(
mw.message( 
'cx-campaign-newarticle-notice' ).parse()
),
$( 'div' ).addClass( 
'cx-campaign-newarticle__actions' ).append( $cancel, $tryCX )
-   )
-   .hide();
-   $( 'body' ).append( $banner );
+   );
 
-   function position() {
-   // Animation complete. Otherwise the position 
calculation is wrong
-   $banner.css( {
-   left: $base.offset().left - 350
-   } )
-   .find( '.cx-campaign-newarticle__caret' ).css( {
-   left: $base.offset().left - 
$banner.offset().left
-   } );
-   }
+   $trigger.callout( {
+   trigger: 'auto',
+   gravity: $.fn.callout.autoNEW,
+   content: $banner
+   } );
 
-   $banner.show( 'fast', position );
-   $( window ).resize( $.debounce( 250, position ) );
$cancel.on( 'click', function () {
-   $banner.remove();
+   $trigger.callout( 'hide' );
$.cookie(
'cx_campaign_' + campaign + '_hide', 1, {
expires: 30,
diff --git a/modules/campaigns/styles/ext.cx.campaigns.newarticle.less 
b/modules/campaigns/styles/ext.cx.campaigns.newarticle.less
index 4b34b73..e559fc1 100644
--- a/modules/campaigns/styles/ext.cx.campaigns.newarticle.less
+++ b/modules/campaigns/styles/ext.cx.campaigns.newarticle.less
@@ -1,47 +1,8 @@
-@import ../../base/styles/grid/agora-grid;
 @import mediawiki.mixins;
 
 .cx-campaign-newarticle {
-   .mw-ui-grid;
-   .mw-ui-one-third;
color: #333;
-   position: absolute;
-   overflow: visible;
-   top: 50px;
-   min-width: 400px;
-   padding: 20px;
background: white;
-   border: 1px solid #ccc;
-   border-bottom-width: 3px;
-   border-radius: 3px;
-   box-shadow: 0 5px 10px rgba(0,0,0,0.2);
-   max-width: 500px;
-
-   __caret {
-   position: absolute;
-   top: 0;
-   }
-
-   __caret::after {
-   border-bottom: 12px solid white;
-   border-left: 12px solid transparent;
-   border-right: 12px solid transparent;
-   content: ;
-   display: inline-block;
-  

[MediaWiki-commits] [Gerrit] Use the callout widget for entrypoint dialog - change (mediawiki...ContentTranslation)

2015-03-16 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Use the callout widget for entrypoint dialog
..

Use the callout widget for entrypoint dialog

Change-Id: I76ec184655dbb706e172ff2082034b1eff12a1a5
---
M Resources.php
M modules/entrypoint/ext.cx.entrypoint.js
M modules/entrypoint/styles/ext.cx.entrypoint.less
3 files changed, 26 insertions(+), 86 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/00/197000/1

diff --git a/Resources.php b/Resources.php
index 6101509..9fb5901 100644
--- a/Resources.php
+++ b/Resources.php
@@ -565,6 +565,7 @@
'jquery.uls.data',
'mediawiki.Uri',
'mediawiki.jqueryMsg',
+   'ext.cx.widgets.callout',
),
 ) + $resourcePaths;
 
diff --git a/modules/entrypoint/ext.cx.entrypoint.js 
b/modules/entrypoint/ext.cx.entrypoint.js
index 14920f3..114ae13 100644
--- a/modules/entrypoint/ext.cx.entrypoint.js
+++ b/modules/entrypoint/ext.cx.entrypoint.js
@@ -34,6 +34,7 @@
 * Initialize the plugin.
 */
CXEntryPoint.prototype.init = function () {
+   this.renderDialog();
this.listen();
};
 
@@ -41,57 +42,29 @@
 * Listen for events.
 */
CXEntryPoint.prototype.listen = function () {
-   var entryPoint = this;
+   var self = this;
 
-   // Hide the dialog when clicking outside it
-   $( 'html' ).click( function () {
-   entryPoint.hide();
-   } );
-
-   // Open or close the dialog when clicking the link.
-   // The dialog will be unitialized until the first click.
-   this.$trigger.click( function ( e ) {
-   e.preventDefault();
+   this.$trigger.on( 'click', function ( e ) {
e.stopPropagation();
-
-   // jquery.uls.data is needed for autonyms
-   mw.loader.using( 'jquery.uls.data', function () {
-   if ( !entryPoint.$dialog ) {
-   entryPoint.renderDialog();
-   entryPoint.listenForDialog();
-   }
-
-   entryPoint.toggle();
-   } );
+   e.preventDefault();
+   self.toggle();
} );
-   };
-
-   /**
-* Listen for events in the CX entry point dialog.
-*/
-   CXEntryPoint.prototype.listenForDialog = function () {
-   var entryPoint = this;
 
this.$actionScratch.click( function () {
var title, url;
 
-   title = entryPoint.$titleInput.val() || mw.config.get( 
'wgTitle' );
-   url = entryPoint.siteMapper.getPageUrl( 
entryPoint.options.targetLanguage, title );
+   title = self.$titleInput.val() || mw.config.get( 
'wgTitle' );
+   url = self.siteMapper.getPageUrl( 
self.options.targetLanguage, title );
location.href = url;
} );
 
this.$actionTranslate.click( $.proxy( this.startPageInCX, this 
) );
 
-   this.$dialog.click( function ( e ) {
-   e.stopPropagation();
+   this.$closeIcon.click( function () {
+   self.hide();
} );
-
-   this.$closeIcon.click( $.proxy( this.hide, this ) );
};
 
-   /**
-* Show or Hide the CX entry point dialog based on current state
-*/
CXEntryPoint.prototype.toggle = function () {
if ( this.shown ) {
this.hide();
@@ -99,46 +72,20 @@
this.show();
}
};
-
/**
 * Show the entry point dialog
 */
CXEntryPoint.prototype.show = function () {
-   this.$dialog.show();
+   this.$trigger.callout( 'show' );
this.shown = true;
-   this.position();
this.$titleInput.focus();
};
 
/**
-* Position the entry point dialog.
-*/
-   CXEntryPoint.prototype.position = function () {
-   var dialogTop, dialogLeft,
-   dir = $( 'html' ).prop( 'dir' );
-
-   // The default is to place the dialog near the element that 
triggers it
-   dialogTop = this.options.top || this.$trigger.offset().top;
-   dialogLeft = this.options.left || this.$trigger.offset().left;
-
-   if ( dir === 'rtl' ) {
-   dialogLeft = dialogLeft - this.$dialog.width();
-   }
-
-   

[MediaWiki-commits] [Gerrit] Introduce a simple overlay widget to help code reuse - change (mediawiki...ContentTranslation)

2015-03-13 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Introduce a simple overlay widget to help code reuse
..

Introduce a simple overlay widget to help code reuse

Change-Id: Icdcb0861a4479f780c7a5056863578341de070fc
---
M Resources.php
M modules/dashboard/ext.cx.translationlist.js
M modules/dashboard/styles/ext.cx.translationlist.less
M modules/source/ext.cx.source.selector.js
M modules/source/styles/ext.cx.source.selector.less
A modules/widgets/overlay/ext.cx.overlay.js
A modules/widgets/overlay/ext.cx.overlay.less
7 files changed, 51 insertions(+), 25 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index 9dc6284..09a56db 100644
--- a/Resources.php
+++ b/Resources.php
@@ -192,6 +192,7 @@
'ext.uls.mediawiki',
'jquery.uls.compact',
'mediawiki.ui.button',
+   'ext.cx.widgets.overlay',
),
'messages' = array(
'cx-sourceselector-dialog-new-translation',
@@ -603,6 +604,7 @@
'ext.cx.progressbar',
'ext.cx.util',
'jquery.uls.data',
+   'ext.cx.widgets.overlay',
),
'messages' = array(
'cx-translation-filter-all-translations',
@@ -696,6 +698,15 @@
)
 ) + $resourcePaths;
 
+$wgResourceModules['ext.cx.widgets.overlay'] = array(
+   'scripts' = array(
+   'widgets/overlay/ext.cx.overlay.js',
+   ),
+   'styles' = array(
+   'widgets/overlay/ext.cx.overlay.less',
+   ),
+) + $resourcePaths;
+
 $wgHooks['ResourceLoaderTestModules'][] = function ( array $modules ) {
$resourcePaths = array(
'localBasePath' = __DIR__,
diff --git a/modules/dashboard/ext.cx.translationlist.js 
b/modules/dashboard/ext.cx.translationlist.js
index cf639d2..ad8b75d 100644
--- a/modules/dashboard/ext.cx.translationlist.js
+++ b/modules/dashboard/ext.cx.translationlist.js
@@ -161,7 +161,9 @@
.addClass( 'image' );
$progressbar = $( 'div' )
.addClass( 'progressbar' )
-   .cxProgressBar( { weights: progress } );
+   .cxProgressBar( {
+   weights: progress
+   } );
$imageBlock.append( $image, $progressbar );
this.showTitleImage( translation );
 
@@ -330,8 +332,7 @@
deferred = $.Deferred();
 
if ( !this.$overlay ) {
-   this.$overlay = $( 'div' )
-   .addClass( 'cx-overlay' );
+   this.$overlay = mw.cx.widgets.overlay();
$( 'body' ).append( this.$overlay );
}
 
diff --git a/modules/dashboard/styles/ext.cx.translationlist.less 
b/modules/dashboard/styles/ext.cx.translationlist.less
index eee6212..5683834 100644
--- a/modules/dashboard/styles/ext.cx.translationlist.less
+++ b/modules/dashboard/styles/ext.cx.translationlist.less
@@ -196,13 +196,3 @@
}
}
 }
-
-.cx-overlay {
-   position: fixed;
-   top: 0;
-   left: 0;
-   height: 100%;
-   width: 100%;
-   background-color: #FFF;
-   opacity: 0.5;
-}
diff --git a/modules/source/ext.cx.source.selector.js 
b/modules/source/ext.cx.source.selector.js
index 3fed346..3525068 100644
--- a/modules/source/ext.cx.source.selector.js
+++ b/modules/source/ext.cx.source.selector.js
@@ -626,8 +626,7 @@
} );
 
if ( !this.$overlay ) {
-   this.$overlay = $( 'div' )
-   .addClass( 'cx-sourceselector-dialog__overlay' 
);
+   this.$overlay = mw.cx.widgets.overlay();
$( 'body' ).append( this.$overlay );
}
 
diff --git a/modules/source/styles/ext.cx.source.selector.less 
b/modules/source/styles/ext.cx.source.selector.less
index eb2059c..ff02a0e 100644
--- a/modules/source/styles/ext.cx.source.selector.less
+++ b/modules/source/styles/ext.cx.source.selector.less
@@ -116,16 +116,6 @@
}
 }
 
-.cx-sourceselector-dialog__overlay {
-   position: fixed;
-   top: 0;
-   left: 0;
-   height: 100%;
-   width: 100%;
-   background-color: #FFF;
-   opacity: 0.5;
-}
-
 .cx-sourceselector-dialog__license {
.mw-ui-item;
.mw-ui-one-whole;
diff --git a/modules/widgets/overlay/ext.cx.overlay.js 
b/modules/widgets/overlay/ext.cx.overlay.js
new file mode 100644
index 000..b206ab5
--- /dev/null
+++ b/modules/widgets/overlay/ext.cx.overlay.js
@@ -0,0 +1,26 @@
+/**
+ * ContentTranslation Tools
+ * A tool that allows editors to 

[MediaWiki-commits] [Gerrit] [WIP] A generic callout widget - change (mediawiki...ContentTranslation)

2015-03-13 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: [WIP] A generic callout widget
..

[WIP] A generic callout widget

Change-Id: I0c6bc6b24b2ca903733bed2a4955741d46dc9ea6
---
A modules/widgets/callout/ext.cx.callout.css
A modules/widgets/callout/ext.cx.callout.js
2 files changed, 476 insertions(+), 0 deletions(-)


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

diff --git a/modules/widgets/callout/ext.cx.callout.css 
b/modules/widgets/callout/ext.cx.callout.css
new file mode 100644
index 000..6d5efe4
--- /dev/null
+++ b/modules/widgets/callout/ext.cx.callout.css
@@ -0,0 +1,209 @@
+.cx-callout {
+   color: #333;
+   position: absolute;
+   overflow: visible;
+   padding: 20px;
+   background: white;
+   border: 1px solid #ccc;
+   border-bottom-width: 3px;
+   border-radius: 3px;
+   max-width: 500px;
+z-index: 10;
+cursor: default;
+}
+
+.cx-callout-w::after, .cx-callout-w::before {
+   right: 100%;
+   top: 50%;
+   border: solid transparent;
+   content:  ;
+   height: 0;
+   width: 0;
+   position: absolute;
+   pointer-events: none;
+}
+
+.cx-callout-w::after {
+   border-color: transparent;
+   border-right-color: #fff;
+   border-width: 12px;
+   margin-top: -12px;
+}
+.cx-callout-w::before {
+   border-color: transparent;
+   border-right-color: #ccc;
+   border-width: 13px;
+   margin-top: -13px;
+}
+
+
+.cx-callout-e:after, .cx-callout-e:before {
+   left: 100%;
+   top: 50%;
+   border: solid transparent;
+   content:  ;
+   height: 0;
+   width: 0;
+   position: absolute;
+   pointer-events: none;
+}
+
+.cx-callout-e:after {
+   border-color: transparent;
+   border-left-color: #fff;
+   border-width: 12px;
+   margin-top: -12px;
+}
+.cx-callout-e:before {
+   border-color: transparent;
+   border-left-color: #ccc;
+   border-width: 13px;
+   margin-top: -13px;
+}
+
+
+.cx-callout-n:after, .cx-callout-n:before {
+   bottom: 100%;
+   left: 50%;
+   border: solid transparent;
+   content:  ;
+   height: 0;
+   width: 0;
+   position: absolute;
+   pointer-events: none;
+}
+
+.cx-callout-n:after {
+   border-color: transparent;
+   border-bottom-color: #fff;
+   border-width: 12px;
+   margin-left: -12px;
+}
+.cx-callout-n:before {
+   border-color: transparent;
+   border-bottom-color: #ccc;
+   border-width: 13px;
+   margin-left: -13px;
+}
+
+.cx-callout-nw:after, .cx-callout-nw:before {
+   bottom: 100%;
+   left: 25%;
+   border: solid transparent;
+   content:  ;
+   height: 0;
+   width: 0;
+   position: absolute;
+   pointer-events: none;
+}
+
+.cx-callout-nw:after {
+   border-color: transparent;
+   border-bottom-color: #fff;
+   border-width: 12px;
+   margin-left: -12px;
+}
+
+.cx-callout-nw:before {
+   border-color: transparent;
+   border-bottom-color: #ccc;
+   border-width: 13px;
+   margin-left: -13px;
+}
+
+.cx-callout-ne:after, .cx-callout-ne:before {
+   bottom: 100%;
+   left: 75%;
+   border: solid transparent;
+   content:  ;
+   height: 0;
+   width: 0;
+   position: absolute;
+   pointer-events: none;
+}
+
+.cx-callout-ne:after {
+   border-color: transparent;
+   border-bottom-color: #fff;
+   border-width: 12px;
+   margin-left: -12px;
+}
+.cx-callout-ne:before {
+   border-color: transparent;
+   border-bottom-color: #ccc;
+   border-width: 13px;
+   margin-left: -13px;
+}
+
+.cx-callout-s:after, .cx-callout-s:before {
+   top: 100%;
+   left: 50%;
+   border: solid transparent;
+   content:  ;
+   height: 0;
+   width: 0;
+   position: absolute;
+   pointer-events: none;
+}
+
+.cx-callout-s:after {
+   border-color: transparent;
+   border-top-color: #fff;
+   border-width: 12px;
+   margin-left: -12px;
+}
+.cx-callout-s:before {
+   border-color: transparent;
+   border-top-color: #ccc;
+   border-width: 13px;
+   margin-left: -13px;
+}
+
+.cx-callout-sw:after, .cx-callout-sw:before {
+   top: 100%;
+   left: 25%;
+   border: solid transparent;
+   content:  ;
+   height: 0;
+   width: 0;
+   position: absolute;
+   pointer-events: none;
+}
+
+.cx-callout-sw:after {
+   border-color: transparent;
+   border-top-color: #fff;
+   border-width: 12px;
+   margin-left: -12px;
+}
+.cx-callout-sw:before {
+   border-color: transparent;
+   border-top-color: #ccc;
+   border-width: 13px;
+   margin-left: -13px;
+}
+
+.cx-callout-se:after, .cx-callout-se:before {
+   top: 100%;
+   left: 75%;

[MediaWiki-commits] [Gerrit] Stats: If target_url exists, count translation as published - change (mediawiki...ContentTranslation)

2015-03-11 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Stats: If target_url exists, count translation as published
..

Stats: If target_url exists, count translation as published

If the translation is with draft status and has a target_url it
was published atleast once.

Bug: T92363
Change-Id: Ie2670dc2c99fe1f8fe873aa1d4d4398c012f746f
---
M includes/Translation.php
1 file changed, 52 insertions(+), 1 deletion(-)


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

diff --git a/includes/Translation.php b/includes/Translation.php
index 96ba825..86ade4a 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -105,7 +105,20 @@
);
}
 
+   /**
+* Get the stats for all translations in draft or published status
+*/
public static function getStats() {
+   return array_merge( Translation::getDraftStats(), 
Translation::getPublishedStats() );
+   }
+
+   /**
+* Get the stats for all translations in draft status and not having
+* any published URL.
+* If the translation is with draft status and has a target_url it
+* was published atleast once.
+*/
+   public static function getDraftStats() {
$dbr = Database::getConnection( DB_SLAVE );
$rows = $dbr-select(
'cx_translations',
@@ -116,7 +129,45 @@
'COUNT(*) AS count',
'COUNT(DISTINCT translation_started_by) AS 
translators',
),
-   '',
+   array(
+   translation_status = 'draft',
+   translation_target_url IS NULL
+   ),
+   __METHOD__,
+   array(
+   'GROUP BY' = array(
+   'translation_source_language',
+   'translation_target_language',
+   'translation_status'
+   ),
+   )
+   );
+
+   $result = array();
+   foreach ( $rows as $row ) {
+   $result[] = (array) $row;
+   }
+
+   return $result;
+   }
+
+   /**
+* Get the stats for all translations in published status or having
+* a published URL.
+* If the translation has a target_url it was published atleast once.
+*/
+   public static function getPublishedStats() {
+   $dbr = Database::getConnection( DB_SLAVE );
+   $rows = $dbr-select(
+   'cx_translations',
+   array(
+   'translation_source_language as sourceLanguage',
+   'translation_target_language as targetLanguage',
+   'published' as status,
+   'COUNT(*) AS count',
+   'COUNT(DISTINCT translation_started_by) AS 
translators',
+   ),
+   array( translation_status = 'published' OR 
translation_target_url IS NOT NULL ),
__METHOD__,
array(
'GROUP BY' = array(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie2670dc2c99fe1f8fe873aa1d4d4398c012f746f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Database: Make the target_url nullable for cx_translations t... - change (mediawiki...ContentTranslation)

2015-03-11 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Database: Make the target_url nullable for cx_translations table
..

Database: Make the target_url nullable for cx_translations table

Following alter query need to be executed

ALTER TABLE cx_translations
MODIFY translation_target_url text binary default null

Change-Id: I4b92ca30f92b0bd10241018bc1ce7221c13be3ee
Followup: I4cd9aa09bcac
Bug: T91365
---
M sql/contenttranslation.sql
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/sql/contenttranslation.sql b/sql/contenttranslation.sql
index 9e9bbb4..73fce44 100644
--- a/sql/contenttranslation.sql
+++ b/sql/contenttranslation.sql
@@ -21,7 +21,7 @@
 -- source of the page as full canonical url -- 
https://www.mediawiki.org/wiki/Help:CxIsPage
 translation_source_url text binary not null,
 -- link to the draft/published target
-translation_target_url text binary not null,
+translation_target_url text binary default null,
 -- Status of translation - Draft or published status.
 -- There is no final status. A published translation can be draft again to 
update again
 translation_status enum('draft', 'published') default null,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b92ca30f92b0bd10241018bc1ce7221c13be3ee
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Database: Set targetURL only when status is published - change (mediawiki...ContentTranslation)

2015-03-10 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Database: Set targetURL only when status is published
..

Database: Set targetURL only when status is published

Currently we update translation record in CX database for save and
publish actions. For both, we update the translation URL.
But translation URL update should happen only when publishing happens.
Otherwise, we just calculate a URL and add to record, a URL that
does not exist.

Changed the upsert query to save the translation to separate
insert and update queries.

Bug: T91365
Change-Id: I4cd9aa09bcac5318e3ee93e32abe1bf2d49be331
---
M api/ApiContentTranslationPublish.php
M includes/Translation.php
2 files changed, 54 insertions(+), 17 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/05/195505/1

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index 7cdc517..ae481a4 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -222,8 +222,7 @@
);
$targetURL = ContentTranslation\SiteMapper::getPageURL( 
$params['to'], $targetTitle );
}
-
-   $translation = new ContentTranslation\Translation( array(
+   $translation = array(
'sourceTitle' = $params['sourcetitle'],
'targetTitle' = $params['title'],
'sourceLanguage' = $params['from'],
@@ -231,15 +230,19 @@
'sourceURL' = 
ContentTranslation\SiteMapper::getPageURL(
$params['from'], $params['sourcetitle']
),
-   'targetURL' = $targetURL,
'status' = $params['status'],
'progress' = $params['progress'],
-   // XXX Do not overwrite startedTranslator when we have 
draft save feature.
+   // XXX Do not overwrite startedTranslator when we have 
collaborative editing!
'startedTranslator' = $translator-getGlobalUserId(),
'lastUpdatedTranslator' = 
$translator-getGlobalUserId(),
-   ) );
-   $translation-save();
-   $translationId = $translation-getTranslationId();
+   );
+   // Save targetURL only when the status is published.
+   if ( $params['status'] === 'published' ) {
+   $translation['targetURL'] = $targetURL;
+   };
+   $cxtranslation = new ContentTranslation\Translation( 
$translation );
+   $cxtranslation-save();
+   $translationId = $cxtranslation-getTranslationId();
$translator-addTranslation(  $translationId );
if ( $params['status'] === 'draft' ) {
// Save the draft
diff --git a/includes/Translation.php b/includes/Translation.php
index 9cf1ca1..f2b4d07 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -9,7 +9,7 @@
$this-translation = $translation;
}
 
-   public function save() {
+   public function create() {
$dbw = Database::getConnection( DB_MASTER );
$values = array(
'translation_source_title' = 
$this-translation['sourceTitle'],
@@ -17,25 +17,59 @@
'translation_source_language' = 
$this-translation['sourceLanguage'],
'translation_target_language' = 
$this-translation['targetLanguage'],
'translation_source_url' = 
$this-translation['sourceURL'],
-   'translation_target_url' = 
$this-translation['targetURL'],
'translation_status' = $this-translation['status'],
-   // XXX do not overwrite when we have draft save 
feature.
-   'translation_start_timestamp' = $dbw-timestamp(),
'translation_last_updated_timestamp' = 
$dbw-timestamp(),
'translation_progress' = 
$this-translation['progress'],
-   'translation_started_by' = 
$this-translation['startedTranslator'],
'translation_last_update_by' = 
$this-translation['lastUpdatedTranslator'],
);
-   $dbw-upsert(
+   $values['translation_start_timestamp'] =  $dbw-timestamp();
+   $values['translation_started_by'] = 
$this-translation['startedTranslator'];
+   if ( $this-translation['status'] === 'published' ) {
+   $values['translation_target_url'] = 
$this-translation['targetURL'];
+   }
+   $dbw-insert(
'cx_translations',
-   

[MediaWiki-commits] [Gerrit] Use string '1' to enable the beta feature - change (mediawiki...ContentTranslation)

2015-03-10 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Use string '1' to enable the beta feature
..

Use string '1' to enable the beta feature

BetaFeatures use '1' to enable the extension. Use the same in CX too

Change-Id: I0d3351d2ebfb2c396ed017d6770b5d4e93591430
---
M specials/SpecialContentTranslation.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/38/195538/1

diff --git a/specials/SpecialContentTranslation.php 
b/specials/SpecialContentTranslation.php
index 79f522c..892936d 100644
--- a/specials/SpecialContentTranslation.php
+++ b/specials/SpecialContentTranslation.php
@@ -28,7 +28,7 @@
public function enableCXBetaFeature() {
$user = $this-getUser();
$out = $this-getOutput();
-   $user-setOption( 'cx', 1 );
+   $user-setOption( 'cx', '1' );
$user-saveSettings();
$out-addModules( 'ext.cx.beta.notification' );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d3351d2ebfb2c396ed017d6770b5d4e93591430
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] References: Support data-mw.body.html method also - change (mediawiki...ContentTranslation)

2015-03-10 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: References: Support data-mw.body.html method also
..

References: Support data-mw.body.html method also

Support the old way of references genrated by parsoid.

Change-Id: I7714386a5cbafab880bfa9d655d3594bec53ac81
Followup: If0e23faeaf
Bug: T90776
---
M modules/tools/ext.cx.tools.reference.js
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/43/195543/1

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index 264b81c..d9a23ae 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -87,7 +87,8 @@
/**
 * Get the reference content for the given reference Id.
 * The content is taken from the reference list section , linked
-* by mw-data.body.id. See T88290
+* by mw-data.body.id. See T88290 and
+* 
https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Ref_and_References
 * @param {string} referenceId The reference element Identifier.
 * @return {string} The HTML content of the reference.
 */
@@ -98,6 +99,10 @@
if ( !reference || !reference.body ) {
return null;
}
+   // Support traditional reference handling by Parsoid
+   if ( reference.body.html ) {
+   return reference.body.html;
+   }
referenceContentElement = document.getElementById( 
reference.body.id );
 
return referenceContentElement  
referenceContentElement.outerHTML;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7714386a5cbafab880bfa9d655d3594bec53ac81
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Campaign: Add missing jquery.throttle-debounce RL module dep... - change (mediawiki...ContentTranslation)

2015-03-10 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Campaign: Add missing jquery.throttle-debounce RL module 
dependency
..

Campaign: Add missing jquery.throttle-debounce RL module dependency

Change-Id: Id640061a7e3cb95124c17430f56e28a7c2c01a5a
---
M Resources.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/46/195846/1

diff --git a/Resources.php b/Resources.php
index f9b7b7a..0e598ec 100644
--- a/Resources.php
+++ b/Resources.php
@@ -686,7 +686,7 @@
'dependencies' = array(
'mediawiki.ui.button',
'jquery.client',
-   'mediawiki.util',
+   'jquery.throttle-debounce',
),
'messages' = array(
'cx-campaign-newarticle-notice',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id640061a7e3cb95124c17430f56e28a7c2c01a5a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Souce selector: Let checkForTitle resolve false when title i... - change (mediawiki...ContentTranslation)

2015-03-08 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Souce selector: Let checkForTitle resolve false when title is 
empty
..

Souce selector: Let checkForTitle resolve false when title is empty

It was rejecting and the 'done' handler in check method was not called.

Bug: T91629
Change-Id: Ia0ad90d3ddd7d0cab984c183b9c381ca37bc44e9
---
M modules/source/ext.cx.source.selector.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/source/ext.cx.source.selector.js 
b/modules/source/ext.cx.source.selector.js
index a00948e..a12fda3 100644
--- a/modules/source/ext.cx.source.selector.js
+++ b/modules/source/ext.cx.source.selector.js
@@ -388,7 +388,7 @@
 
// Short circuit empty titles
if ( title === '' ) {
-   return $.Deferred().reject().promise();
+   return $.Deferred().resolve( false ).promise();
}
 
// Reject titles with pipe in the name, as it has special 
meaning in the api

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia0ad90d3ddd7d0cab984c183b9c381ca37bc44e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Correct the way section headers are added - change (mediawiki...ContentTranslation)

2015-03-06 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Correct the way section headers are added
..

Correct the way section headers are added

Use appropriate hook to trigger adding secton headers instead of
using click event.

While adding reference list using hook, the section header for
reference list was not getting added. Now it get added.

Change-Id: I69f58d109b22471ea3c83c0abcc12ebc449abffd
---
M modules/translation/ext.cx.translation.js
1 file changed, 23 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/38/194838/1

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 2be5fc2..e64f469 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -114,6 +114,7 @@
var cxTranslation = this;
 
mw.hook( 'mw.cx.translation.add' ).add( $.proxy( 
this.applyTranslationTemplate, this ) );
+   mw.hook( 'mw.cx.translation.add' ).add( $.proxy( 
this.addSectionHeader, this ) );
mw.hook( 'mw.cx.translation.postMT' ).add( $.proxy( 
this.postProcessMT, this ) );
mw.hook( 'mw.cx.source.loaded' ).add( function () {
// Delay adding placeholders. If we calculate the 
section
@@ -278,7 +279,7 @@
 * @param {string} tagName
 * @return {boolean}
 */
-   ContentTranslationEditor.isHeading = function ( tagName ) {
+   ContentTranslationEditor.prototype.isHeading = function ( tagName ) {
return /^H[1-6]$/i.test( tagName );
};
 
@@ -290,14 +291,14 @@
 * @param {string} current tagName
 * @return {boolean}
 */
-   ContentTranslationEditor.isParentHeading = function ( preceding, 
current ) {
+   ContentTranslationEditor.prototype.isParentHeading = function ( 
preceding, current ) {
// Any header goes if this is a non-heading
-   if ( !ContentTranslationEditor.isHeading( current ) ) {
-   return ContentTranslationEditor.isHeading( preceding );
+   if ( !this.isHeading( current ) ) {
+   return this.isHeading( preceding );
}
 
// Both are headings, check that the previous one is bigger
-   if ( ContentTranslationEditor.isHeading( preceding ) ) {
+   if ( this.isHeading( preceding ) ) {
return preceding  current;
}
 
@@ -305,30 +306,34 @@
return false;
};
 
-   function sectionClick() {
-   /*jshint validthis:true */
-   var sourceSectionId, $currentSection, $previousSection;
+   /**
+* Fill in the preceding parent heading, if not yet filled
+* @param {string} sectionId Source section Id
+*/
+   ContentTranslationEditor.prototype.addSectionHeader = function ( 
sectionId ) {
+   var $currentSection, $previousSection;
 
-   $currentSection = $( this );
+   $currentSection = mw.cx.getTranslationSection( sectionId );
$previousSection = $currentSection.prev();
-   sourceSectionId = $currentSection.data( 'source' );
-
-   // The equivalent section in source column
-   mw.cx.getSourceSection( sourceSectionId ).removeClass( 
'cx-highlight' );
-
-   // Fill in the preceding parent heading, if not yet filled
-   // TODO: This must be triggerd by 'mw.cx.translation.add' hook 
and not by
-   // a click to allow programmatically add sections and get 
consistent behavior
if (
$previousSection.is( '.placeholder' ) 
-   ContentTranslationEditor.isParentHeading(
+   this.isParentHeading(
$previousSection.data( 'cx-section-type' ),
$currentSection.data( 'cx-section-type' )
)
) {
mw.hook( 'mw.cx.translation.add' ).fire( 
$previousSection.data( 'source' ), 'click' );
}
+   };
 
+   function sectionClick() {
+   var sourceSectionId,
+   /*jshint validthis:true */
+   $currentSection = $( this );
+
+   sourceSectionId = $currentSection.data( 'source' );
+   // The equivalent section in source column
+   mw.cx.getSourceSection( sourceSectionId ).removeClass( 
'cx-highlight' );
mw.hook( 'mw.cx.translation.add' ).fire( sourceSectionId, 
'click' );
}
 

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

[MediaWiki-commits] [Gerrit] Source selector: Show common languages in the language selector - change (mediawiki...ContentTranslation)

2015-03-06 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Source selector: Show common languages in the language selector
..

Source selector: Show common languages in the language selector

Change-Id: Ieb8b525b7c4ad167dc24d7e6451bb1d05d2249d1
---
M modules/source/ext.cx.source.selector.js
1 file changed, 10 insertions(+), 0 deletions(-)


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

diff --git a/modules/source/ext.cx.source.selector.js 
b/modules/source/ext.cx.source.selector.js
index 6515729..a00948e 100644
--- a/modules/source/ext.cx.source.selector.js
+++ b/modules/source/ext.cx.source.selector.js
@@ -228,6 +228,11 @@
onReady: function () {
this.$menu.addClass( targetUlsClass );
},
+   quickList: function () {
+   return mw.uls.getFrequentLanguageList().filter( 
function ( n ) {
+   return 
cxSourceSelector.targetLanguages.indexOf( n ) !== -1;
+   } );
+   },
compact: true
} );
};
@@ -808,6 +813,11 @@
onReady: function () {
this.$menu.addClass( 
'cx-sourceselector-uls-source' );
},
+   quickList: function () {
+   return mw.uls.getFrequentLanguageList().filter( 
function ( n ) {
+   return 
cxSourceSelector.sourceLanguages.indexOf( n ) !== -1;
+   } );
+   },
compact: true
} );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieb8b525b7c4ad167dc24d7e6451bb1d05d2249d1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


[MediaWiki-commits] [Gerrit] Red interlanguage entrypoint: Remove the condition to load j... - change (mediawiki...ContentTranslation)

2015-03-06 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Red interlanguage entrypoint: Remove the condition to load 
jquery.uls.data
..

Red interlanguage entrypoint: Remove the condition to load jquery.uls.data

Now it is not just user interface language we use for red interlanguage
entry point. The existing condition is invalid.

Change-Id: I857a23ea79c7228c8ca8e21363f9dc90934df2ba
---
M modules/entrypoint/ext.cx.redlink.js
1 file changed, 1 insertion(+), 8 deletions(-)


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

diff --git a/modules/entrypoint/ext.cx.redlink.js 
b/modules/entrypoint/ext.cx.redlink.js
index 1af94e0..1f1026d 100644
--- a/modules/entrypoint/ext.cx.redlink.js
+++ b/modules/entrypoint/ext.cx.redlink.js
@@ -121,14 +121,7 @@
return;
}
 
-   dependencies = [ 'ext.cx.entrypoint' ];
-   if ( !( suggestedTargetLanguages.length === 1 
-   suggestedTargetLanguages[ 0 ] === mw.config.get( 
'wgUserLanguage' )
-   ) ) {
-   // Optimization: load jquery.uls.data
-   // only if we need more than the autonym of the user 
language
-   dependencies.push( 'jquery.uls.data' );
-   }
+   dependencies = [ 'ext.cx.entrypoint', 'jquery.uls.data' ];
 
mw.loader.using( dependencies, function () {
var cxEntryPointDialogLeft,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I857a23ea79c7228c8ca8e21363f9dc90934df2ba
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh santhosh.thottin...@gmail.com

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


<    2   3   4   5   6   7   8   9   10   11   >