[MediaWiki-commits] [Gerrit] Refactor all column related styles - change (mediawiki...ContentTranslation)

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

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

Change subject: Refactor all column related styles
..

Refactor all column related styles

* Created ext.cx.column.less to have all common styles for columns
  shared for source or translation columns

Change-Id: I1447b4b3498339599d4983bb9373080c0f0b1eb7
---
M modules/source/styles/ext.cx.source.less
M modules/translationview/styles/ext.cx.translationview.less
A modules/widgets/common/ext.cx.column.less
3 files changed, 85 insertions(+), 89 deletions(-)


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

diff --git a/modules/source/styles/ext.cx.source.less 
b/modules/source/styles/ext.cx.source.less
index 9ffe796..4faa7fc 100644
--- a/modules/source/styles/ext.cx.source.less
+++ b/modules/source/styles/ext.cx.source.less
@@ -1,16 +1,5 @@
-@import "../../widgets/common/ext.cx.common";
+@import "../../widgets/common/ext.cx.column";
 @import "../../widgets/common/ext.cx.highlight";
-
-.cx-column--source {
-   .cx-column__language-label,
-   .cx-column__sub-heading__view-page {
-   .mw-ui-one-half;
-   padding: 0;
-   overflow: hidden;
-   text-overflow: ellipsis;
-   max-height: 3em;
-   }
-}
 
 .cx-column__loading-indicator {
margin-top: 100px;
@@ -19,5 +8,5 @@
 .cx-column__loading-indicator--text {
padding-top: 20px;
text-align: center;
-   color: #565656;
+   color: @gray-dark;
 }
diff --git a/modules/translationview/styles/ext.cx.translationview.less 
b/modules/translationview/styles/ext.cx.translationview.less
index b3df1c9..31a9642 100644
--- a/modules/translationview/styles/ext.cx.translationview.less
+++ b/modules/translationview/styles/ext.cx.translationview.less
@@ -1,43 +1,5 @@
 @import "../../widgets/common/ext.cx.common";
-
-h2 {
-   color: @gray-darker;
-}
-
-.cx-column__title {
-   font-size: 2.2em;
-   font-family: 'Linux Libertine', Georgia, Times, serif;
-   margin-bottom: 10px;
-}
-
-.cx-widget__columns {
-   margin-top: 100px;
-   min-height: 100vh;
-
-   &.disabled {
-   pointer-events: none;
-   opacity: 0.5;
-   }
-}
-
-.cx-column__language-label {
-   text-align: left;
-   color: @gray-dark;
-}
-
-.cx-column {
-   .mw-ui-item;
-   .mw-ui-one-third;
-   .mw-ui-gutter(3%);
-
-   .cx-column__content {
-   table,
-   figure,
-   figure[typeof*='mw:Image'] {
-   float: none;
-   }
-   }
-}
+@import "../../widgets/common/ext.cx.column";
 
 .cx-column--source,
 .cx-column--translation {
@@ -55,20 +17,6 @@
 
p {
margin: 1.5em 0;
-   }
-
-   .cx-column__sub-heading {
-   .mw-ui-item;
-   .mw-ui-one-whole;
-   padding: 5px 0;
-   line-height: 2;
-   }
-
-   .cx-column__content {
-   line-height: 1.5em;
-   clear: both;
-   word-wrap: break-word;
-   position: relative;
}
 }
 
@@ -101,27 +49,4 @@
border: 1px solid #cc;
padding: 10px;
margin: 2px 0;
-}
-
-.stick-to-side() {
-   position: fixed;
-   top: 0;
-   right: 0;
-}
-
-.stick-to-bottom() {
-   position: fixed;
-   top: auto;
-   bottom: 0;
-   left: 0;
-   box-shadow: 0 -3px 0 0 rgba(0, 0, 0, 0.05);
-   max-height: 20%;
-   min-height: 3em;
-   overflow-x: hidden;
-   overflow-y: auto;
-   transition: max-height 0.25s;
-
-   &:hover {
-   max-height: 50%;
-   }
 }
diff --git a/modules/widgets/common/ext.cx.column.less 
b/modules/widgets/common/ext.cx.column.less
new file mode 100644
index 000..e6e9460
--- /dev/null
+++ b/modules/widgets/common/ext.cx.column.less
@@ -0,0 +1,82 @@
+// Common styles for source or tanslation columns of translation view
+@import "ext.cx.common";
+
+.cx-widget__columns {
+   margin-top: 100px;
+   min-height: 100vh;
+
+   &.disabled {
+   pointer-events: none;
+   opacity: 0.5;
+   }
+}
+
+.cx-column {
+   .mw-ui-item;
+   .mw-ui-one-third;
+   .mw-ui-gutter(3%);
+}
+
+.cx-column__sub-heading {
+   .mw-ui-item;
+   .mw-ui-one-whole;
+   padding: 5px 0;
+   line-height: 2em;
+}
+
+.cx-column__content {
+   line-height: 1.5em;
+   clear: both;
+   word-wrap: break-word;
+   position: relative;
+
+   table,
+   figure,
+   figure[typeof*='mw:Image'] {
+   float: none;
+   }
+}
+
+.cx-column__language-label,
+.cx-column__sub-heading__view-page {
+   .mw-ui-one-half;
+   padding: 0;
+   overflow: hidden;
+   text-overflow: ellipsis;
+   max-height: 3em;
+}
+
+.cx-column__languag

[MediaWiki-commits] [Gerrit] Style adjustment for translation view column subheading - change (mediawiki...ContentTranslation)

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

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

Change subject: Style adjustment for translation view column subheading
..

Style adjustment for translation view column subheading

* The language label and 'view page' takes equal width now.
* Language label is left aligned to match the column left alignment

Bug: T97937
Change-Id: I92225f226f3a75d3798d09620cb5607f81b4a5f5
---
M modules/source/styles/ext.cx.source.less
M modules/translationview/styles/ext.cx.translationview.less
2 files changed, 3 insertions(+), 10 deletions(-)


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

diff --git a/modules/source/styles/ext.cx.source.less 
b/modules/source/styles/ext.cx.source.less
index 7207a96..9ffe796 100644
--- a/modules/source/styles/ext.cx.source.less
+++ b/modules/source/styles/ext.cx.source.less
@@ -4,18 +4,11 @@
 .cx-column--source {
.cx-column__language-label,
.cx-column__sub-heading__view-page {
-   .mw-ui-item;
+   .mw-ui-one-half;
+   padding: 0;
overflow: hidden;
text-overflow: ellipsis;
max-height: 3em;
-   }
-
-   .cx-column__language-label {
-   .mw-ui-one-third;
-   }
-
-   .cx-column__sub-heading__view-page {
-   .mw-ui-two-thirds;
}
 }
 
diff --git a/modules/translationview/styles/ext.cx.translationview.less 
b/modules/translationview/styles/ext.cx.translationview.less
index 9245d72..b3df1c9 100644
--- a/modules/translationview/styles/ext.cx.translationview.less
+++ b/modules/translationview/styles/ext.cx.translationview.less
@@ -60,7 +60,7 @@
.cx-column__sub-heading {
.mw-ui-item;
.mw-ui-one-whole;
-   padding-bottom: 5px;
+   padding: 5px 0;
line-height: 2;
}
 

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

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

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


[MediaWiki-commits] [Gerrit] Interlanguage link: Simplify the autonym identification - change (mediawiki...ContentTranslation)

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

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

Change subject: Interlanguage link: Simplify the autonym identification
..

Interlanguage link: Simplify the autonym identification

It is guaranteed that jquery.uls.data is loaded before
createCXInterlanguageItem is called. So we can safely use
$.uls.data.getAutonym() for getting the autonym.

Change-Id: I89e1ed2f1b642230234b750055f2ca01995b9ea4
---
M modules/entrypoint/ext.cx.interlanguagelink.js
1 file changed, 1 insertion(+), 8 deletions(-)


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

diff --git a/modules/entrypoint/ext.cx.interlanguagelink.js 
b/modules/entrypoint/ext.cx.interlanguagelink.js
index 166c81f..c585522 100644
--- a/modules/entrypoint/ext.cx.interlanguagelink.js
+++ b/modules/entrypoint/ext.cx.interlanguagelink.js
@@ -75,14 +75,7 @@
function createCXInterlanguageItem( code ) {
var from, $link, $item, autonym;
 
-   // Optimization: if it's just the user language,
-   // get the autonym from an available variable.
-   // Otherwise, get it from uls.data, which should be loaded by 
now.
-   if ( code === mw.config.get( 'wgUserLanguage' ) ) {
-   autonym = mw.config.get( 'wgULSCurrentAutonym' );
-   } else {
-   autonym = $.uls.data.getAutonym( code );
-   }
+   autonym = $.uls.data.getAutonym( code );
// TODO: This should be done more robustly.
// We can't use something like wgContentLanguage because this
// will fail for a wiki like simple.wikipedia.org, where

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

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

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


[MediaWiki-commits] [Gerrit] Interlanguage link: Avoid the requirement of jquery.uls.data... - change (mediawiki...ContentTranslation)

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

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

Change subject: Interlanguage link: Avoid the requirement of jquery.uls.data 
module on page load
..

Interlanguage link: Avoid the requirement of jquery.uls.data module on page load

This is an improved version of Ic1ad144b44 and does not require
jquery.uls.data before we see that we need to show a gray interlanguage link.

Bug: T113650
Change-Id: If8bae978308fbf472371393b0fe9b50bb5679012
---
M modules/entrypoint/ext.cx.interlanguagelink.js
1 file changed, 17 insertions(+), 7 deletions(-)


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

diff --git a/modules/entrypoint/ext.cx.interlanguagelink.js 
b/modules/entrypoint/ext.cx.interlanguagelink.js
index 2fcf858..166c81f 100644
--- a/modules/entrypoint/ext.cx.interlanguagelink.js
+++ b/modules/entrypoint/ext.cx.interlanguagelink.js
@@ -22,15 +22,23 @@
 * @return {string[]} target languages
 */
function getSuggestedTargetLanguages() {
-   var specialCode, specialCodes, specialCodeIndex,
+   var i, specialCode, specialCodes, specialCodeIndex,
uniquePossibleTargetLanguages,
+   acceptLanguages,
possibleTargetLanguages = [],
pageLanguage = mw.config.get( 'wgPageContentLanguage' );
 
possibleTargetLanguages.push( mw.config.get( 'wgUserLanguage' ) 
);
possibleTargetLanguages.push( mw.uls.getBrowserLanguage() );
 
-   $.merge( possibleTargetLanguages, 
mw.uls.getAcceptLanguageList() );
+   acceptLanguages = mw.uls.getAcceptLanguageList();
+   // Accept language codes can have country extensions like en-US.
+   // So remove them so that it is in mediawiki language code 
format.
+   for ( i = 0; i < acceptLanguages.length; i++ ) {
+   acceptLanguages[ i ] = acceptLanguages[ i ].split( '-' 
)[ 0 ];
+   }
+
+   $.merge( possibleTargetLanguages, acceptLanguages );
$.merge( possibleTargetLanguages, mw.uls.getPreviousLanguages() 
);
 
// Replace possibly non-standard, macro and duplicate language 
codes
@@ -51,9 +59,7 @@
uniquePossibleTargetLanguages = mw.cx.unique( 
possibleTargetLanguages );
 
return $.grep( uniquePossibleTargetLanguages, function ( 
language ) {
-   return language !== pageLanguage &&
-   // Known language for ULS
-   language !== $.uls.data.getAutonym( language );
+   return language !== pageLanguage;
} );
}
 
@@ -77,7 +83,6 @@
} else {
autonym = $.uls.data.getAutonym( code );
}
-
// TODO: This should be done more robustly.
// We can't use something like wgContentLanguage because this
// will fail for a wiki like simple.wikipedia.org, where
@@ -119,6 +124,8 @@
 
mw.hook( 'mw.cx.cta.shown' ).fire( campaign );
 
+   // We load the below modules only when required to show gray 
interlanguage links.
+   // It is important since gray interlanguage links appear in 
along with articles.
dependencies = [ 'ext.cx.entrypoint', 'jquery.uls.data' ];
 
mw.loader.using( dependencies, function () {
@@ -133,7 +140,10 @@
 
$pLangList = $( '#p-lang ul' );
$.each( suggestedTargetLanguages, function ( i, code ) {
-   if ( !pageInLanguageExists( code ) ) {
+   if ( !pageInLanguageExists( code ) &&
+   // Known language for ULS
+   code !== $.uls.data.getAutonym( code )
+   ) {
$newItem = createCXInterlanguageItem( 
code );
$pLangList.prepend( $newItem );
$newItem.cxEntryPoint( {

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

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

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


[MediaWiki-commits] [Gerrit] Dahsboard: Avoid the list jump when the translation filter b... - change (mediawiki...ContentTranslation)

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

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

Change subject: Dahsboard: Avoid the list jump when the translation filter 
becomes sticky
..

Dahsboard: Avoid the list jump when the translation filter becomes sticky

When the header(the filters and new translation button), it creates an empty
space under that(since it is floating now) and pull the list up. This causes
a jump in the scroll position of lists. To avoid this, whenever the header 
becomes
sticky, add a padding at the top for the container with height same as the 
stikcy
header to fill the gap. This prevents the list pulled up.

This fixes the jump for both translation list and suggestion list

Change-Id: Ib1e197311c58f953281292734e8d3aea437d745e
---
M modules/dashboard/styles/ext.cx.dashboard.less
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/modules/dashboard/styles/ext.cx.dashboard.less 
b/modules/dashboard/styles/ext.cx.dashboard.less
index 9600c90..fe35093 100644
--- a/modules/dashboard/styles/ext.cx.dashboard.less
+++ b/modules/dashboard/styles/ext.cx.dashboard.less
@@ -130,6 +130,10 @@
padding-left: 50px;
 }
 
+.cx-translationlist-container.sticky {
+   padding-top: 120px;
+}
+
 .translation-source-language-filter,
 .translation-target-language-filter {
background-color: #fff;
@@ -146,7 +150,6 @@
 
background-color: #f0f0f0;
padding: 0px;
-   margin-bottom: 20px;
 
.cx-filters {
.mw-ui-one-half;

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

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

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


[MediaWiki-commits] [Gerrit] CXStas: Club the cumulative and trend under tabs - change (mediawiki...ContentTranslation)

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

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

Change subject: CXStas: Club the cumulative and trend under tabs
..

CXStas: Club the cumulative and trend under tabs

Bug: T113335
Bug: T113356
Change-Id: I882c28294f35e5c0ec8e883ac6f328694a936808
---
M modules/stats/ext.cx.stats.js
1 file changed, 166 insertions(+), 104 deletions(-)


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

diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 39f09d9..867b8ce 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -32,79 +32,25 @@
$( '' ).addClass( 'bounce3' )
);
this.$highlights = $( '' ).addClass( 'cx-stats-highlights' 
);
-   this.$cumulativeGraph = $( '' ).attr( {
-   id: 'cxcumulative',
-   width: this.$container.width() - 200, // Leave a 200px 
margin buffer to avoid overflow
-   height: 400
-   } );
-
-   this.$languageCumulativeGraph = $( '' ).attr( {
-   id: 'cxlangcumulative',
-   width: this.$container.width() - 200, // Leave a 200px 
margin buffer to avoid overflow
-   height: 400
-   } );
-
-   this.$translatonTrendBarChart = $( '' ).attr( {
-   id: 'cxtrendchart',
-   width: this.$container.width() - 200, // Leave a 200px 
margin buffer to avoid overflow
-   height: 400
-   } );
-
-   this.$langTranslatonTrendBarChart = $( '' ).attr( {
-   id: 'cxlangtrendchart',
-   width: this.$container.width() - 200, // Leave a 200px 
margin buffer to avoid overflow
-   height: 400
-   } );
-
-   this.$container.append(
-   $spinner,
-   this.$highlights,
-   $( '' ).text( mw.msg( 
'cx-stats-all-translations-title' ) ),
-   $( '' )
-   .addClass( 'cx-stats-graph 
cx-stats-cumulative-total' )
-   .append( this.$cumulativeGraph ),
-   $( '' ).text( mw.message(
-   'cx-trend-translations-to',
-   $.uls.data.getAutonym( mw.config.get( 
'wgContentLanguage' ) )
-   ).escaped() ),
-   $( '' )
-   .addClass( 'cx-stats-graph 
cx-stats-cumulative-lang' )
-   .append( this.$languageCumulativeGraph ),
-   $( '' ).text( mw.msg( 
'cx-trend-published-translations-title' ) ),
-   $( '' )
-   .addClass( 'cx-stats-graph 
cx-stats-trend-total' )
-   .append( this.$translatonTrendBarChart ),
-   $( '' ).text( mw.message(
-   'cx-trend-translations-to-title',
-   $.uls.data.getAutonym( mw.config.get( 
'wgContentLanguage' ) )
-   ).escaped() ),
-   $( '' )
-   .addClass( 'cx-stats-graph cx-stats-trend-lang' 
)
-   .append( this.$langTranslatonTrendBarChart )
-   );
+   this.$container.append( $spinner, this.$highlights );
 
$.when(
this.getCXTrends(),
-   this.getCXTrends( mw.config.get( 'wgContentLanguage' ) )
-   ).done( function ( totalTrend, languageTrend ) {
+   this.getCXTrends( mw.config.get( 'wgContentLanguage' ) 
),
+   this.getCXStats()
+   ).done( function ( totalTrend, languageTrend, stats ) {
+   // Remove spinner
+   $spinner.remove();
+   // Do the maths
self.totalTranslationTrend = totalTrend.translations;
self.totalDraftTrend = totalTrend.drafts;
-
self.languageTranslationTrend = 
languageTrend.translations;
self.languageDraftTrend = languageTrend.drafts;
self.languageDeletionTrend = languageTrend.deletions;
+   self.transformJsonToModel( stats[ 0 
].query.contenttranslationstats );
+   // Now render them all
self.renderHighlights();
-   self.drawCumulativeGraph( 'count' );
-   self.drawLanguageCumulativeGraph( 'count' );
-   self.drawTranslationTrend();
-  

[MediaWiki-commits] [Gerrit] Do not call cxserver to display gray interwiki link - change (mediawiki...ContentTranslation)

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

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

Change subject: Do not call cxserver to display gray interwiki link
..

Do not call cxserver to display gray interwiki link

Adds a simple check to filter out language codes like
ml-IN, en-US etc coming from browser languages.
To make it future-proof, we just check if language code
is known to ULS

Re-reverts If0c329ad4094498b593df91521b28116f2804224
Bug: T110246

Change-Id: Ic1ad144b442b9f208d12466490545eee1c8a5083
---
M modules/entrypoint/ext.cx.interlanguagelink.js
1 file changed, 5 insertions(+), 41 deletions(-)


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

diff --git a/modules/entrypoint/ext.cx.interlanguagelink.js 
b/modules/entrypoint/ext.cx.interlanguagelink.js
index c92089f..2fcf858 100644
--- a/modules/entrypoint/ext.cx.interlanguagelink.js
+++ b/modules/entrypoint/ext.cx.interlanguagelink.js
@@ -19,11 +19,9 @@
 * - Accept-Language.
 * - Browser interface language.
 * This will probably include more languages in the future.
-* @param {String[]} availableTargetLanguages A list of target languages
-* that are supported by this instance.
 * @return {string[]} target languages
 */
-   function getSuggestedTargetLanguages( availableTargetLanguages ) {
+   function getSuggestedTargetLanguages() {
var specialCode, specialCodes, specialCodeIndex,
uniquePossibleTargetLanguages,
possibleTargetLanguages = [],
@@ -53,42 +51,10 @@
uniquePossibleTargetLanguages = mw.cx.unique( 
possibleTargetLanguages );
 
return $.grep( uniquePossibleTargetLanguages, function ( 
language ) {
-   return (
-   $.inArray( language, availableTargetLanguages ) 
> -1 &&
-   language !== pageLanguage
-   );
+   return language !== pageLanguage &&
+   // Known language for ULS
+   language !== $.uls.data.getAutonym( language );
} );
-   }
-
-   /**
-* Get the list of target languages that this instance of CX supports.
-* @return {jQuery.Promise}
-*/
-   function getAvailableTargetLanguages() {
-   var languagePairsAPIUrl, deferred;
-
-   // Optimization: creating the cxserver URL without sitemapper
-   // to avoid loading the sitemapper module just for this.
-   languagePairsAPIUrl =
-   mw.config.get( 'wgContentTranslationSiteTemplates' ).cx 
+ '/languagepairs';
-
-   deferred = $.Deferred();
-
-   $.get( languagePairsAPIUrl )
-   .done( function ( response ) {
-   deferred.resolve( response.target || [] );
-   } )
-   .fail( function ( response ) {
-   mw.log(
-   'Error getting language pairs from ' + 
languagePairsAPIUrl + ' . ' +
-   response.statusText + ' (' + 
response.status + '). ' +
-   response.responseText
-   );
-
-   deferred.reject();
-   } );
-
-   return deferred.promise();
}
 
/**
@@ -181,8 +147,6 @@
}
 
$( function () {
-   getAvailableTargetLanguages().then( function ( 
availableTargetLanguages ) {
-   prepareCXInterLanguageLinks( availableTargetLanguages );
-   } );
+   prepareCXInterLanguageLinks();
} );
 }( jQuery, mediaWiki ) );

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

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

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


[MediaWiki-commits] [Gerrit] Dashboard: Show empty list information when suggestions or t... - change (mediawiki...ContentTranslation)

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

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

Change subject: Dashboard: Show empty list information when suggestions or 
translations are empty
..

Dashboard: Show empty list information when suggestions or translations are 
empty

Change-Id: Ia9e730df296ae2d6857fe4953943ae8037bc8c3e
---
M modules/dashboard/ext.cx.suggestionlist.js
M modules/dashboard/ext.cx.translationlist.js
M modules/dashboard/styles/ext.cx.dashboard.less
3 files changed, 46 insertions(+), 24 deletions(-)


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

diff --git a/modules/dashboard/ext.cx.suggestionlist.js 
b/modules/dashboard/ext.cx.suggestionlist.js
index 03d0ae0..23845d9 100644
--- a/modules/dashboard/ext.cx.suggestionlist.js
+++ b/modules/dashboard/ext.cx.suggestionlist.js
@@ -94,6 +94,11 @@
return;
}
lists = suggestions.lists;
+   if ( !lists || !lists.length ) {
+   self.$emptySuggestionList.show();
+   } else {
+   self.$emptySuggestionList.hide();
+   }
self.lists = $.extend( self.lists, lists );
for ( listId in lists ) {
if ( lists.hasOwnProperty( listId ) ) {
@@ -160,27 +165,39 @@
CXSuggestionList.prototype.hide = function () {
this.active = false;
this.$suggestionList.hide();
+   this.$emptySuggestionList.hide();
};
 
-   CXSuggestionList.prototype.applyFilters = function ( filters ) {
-   var i, suggestion, visible, j, filterProp, filterValue, 
emptyList = true,
-   keys = Object.keys( filters );
+   /**
+* Match the suggestion with the current filter.
+* @param  {Object} suggestion
+* @return {Boolean}
+*/
+   CXSuggestionList.prototype.matchFilter = function ( suggestion ) {
+   var j, visible = true,
+   filterProp, filterValue,
+   keys = Object.keys( this.filters );
+
+   for ( j = 0; j < keys.length; j++ ) {
+   filterProp = keys[ j ];
+   filterValue = this.filters[ filterProp ];
+
+   if ( filterValue === null || filterValue === '' ) {
+   continue;
+   }
+   visible = visible && suggestion[ filterProp ] === 
filterValue;
+   }
+
+   return visible;
+   };
+
+   CXSuggestionList.prototype.applyFilters = function () {
+   var i, suggestion, visible, emptyList = true;
 
for ( i = 0; i < this.suggestions.length; i++ ) {
suggestion = this.suggestions[ i ];
 
-   visible = true;
-   for ( j = 0; j < keys.length; j++ ) {
-   filterProp = keys[ j ];
-   filterValue = filters[ filterProp ];
-
-   if ( filterValue === null || filterValue === '' 
) {
-   continue;
-   }
-
-   visible = visible && suggestion[ filterProp ] 
=== filterValue;
-   }
-
+   visible = this.matchFilter( suggestion );
if ( visible ) {
emptyList = false;
suggestion.$element.show();
@@ -188,10 +205,8 @@
suggestion.$element.hide();
}
}
-   if ( emptyList ) {
-   this.hasMore = true;
-   this.loadItems();
-   }
+   this.hasMore = true;
+   this.loadItems();
};
 
/**
@@ -274,7 +289,6 @@
 
for ( i = 0; i < suggestions.length; i++ ) {
suggestion = suggestions[ i ];
-   suggestion.id = 'suggestion' + i;
$suggestion = this.buildSuggestionItem( suggestion );
$suggestions.push( $suggestion );
}
@@ -367,7 +381,9 @@
suggestion.$element = $suggestion;
suggestion.$desc = $desc;
suggestion.$image = $image;
-
+   if ( !this.matchFilter( suggestion ) ) {
+   suggestion.$element.hide();
+   }
return $suggestion;
};
 
diff --git a/modules/dashboard/ext.cx.translationlist.js 
b/modules/dashboard/ext.cx.translationlist.js
index cbe4d02..3764974 100644
--- a/modules/dashboard/ext.

[MediaWiki-commits] [Gerrit] Dashboard: Use ULS for language selection - change (mediawiki...ContentTranslation)

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

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

Change subject: Dashboard: Use ULS for language selection
..

Dashboard: Use ULS for language selection

Bug: T112051
Change-Id: I5ee3bdb25d8716641d88550ee1f5e85c1e384b0d
---
M extension.json
M modules/dashboard/ext.cx.dashboard.js
M modules/dashboard/styles/ext.cx.dashboard.less
3 files changed, 71 insertions(+), 96 deletions(-)


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

diff --git a/extension.json b/extension.json
index f1ad542..f2d5f99 100644
--- a/extension.json
+++ b/extension.json
@@ -221,7 +221,8 @@
"ext.cx.translationlist",
"ext.cx.suggestionlist",
"mediawiki.Uri",
-   "mediawiki.ui.button"
+   "mediawiki.ui.button",
+   "ext.uls.mediawiki"
],
"messages": [
"cx-create-new-translation",
diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index 5e53115..6935e9a 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -50,36 +50,23 @@
};
 
/**
-* Populate the language filter
+* Set the language filter label
 *
-* @param {jQuery} $filter Source filter or target filter to fill
-* @param {String[]} languages Array of language codes
+* @param {jQuery} $filter Source filter or target filter
 * @param {String} selected Selected language code
 */
-   CXDashboard.prototype.populateLanguageFilter = function ( $filter, 
languages, selected ) {
-   var i, label, $options = [];
+   CXDashboard.prototype.setLanguageFilterLabel = function ( $filter, 
selected ) {
+   var label;
 
-   $filter.empty();
-
-   if ( $filter.is( '.translation-source-language-filter' ) ) {
+   if ( selected ) {
+   label = $.uls.data.getAutonym( selected );
+   } else if ( $filter.is( '.translation-source-language-filter' ) 
) {
label = mw.msg( 
'cx-translation-filter-from-any-language' );
} else {
label = mw.msg( 'cx-translation-filter-to-any-language' 
);
}
-   $options.push( $( '' )
-   .text( label )
-   .attr( 'value', '' )
-   );
 
-   for ( i = 0; i < languages.length; i++ ) {
-   $options.push( $( '' )
-   // Todo: use translated language name
-   .text( $.uls.data.getAutonym( languages[ i ] ) )
-   .prop( 'selected', selected === languages[ i ] )
-   .attr( 'value', languages[ i ] )
-   );
-   }
-   $filter.append( $options ).show();
+   $filter.text( label );
};
 
/**
@@ -201,22 +188,19 @@
.addClass( 'cx-filters' )
.append( $filterTabs );
 
-   this.$sourceLanguageFilter = $( '' ).addClass( 
'translation-source-language-filter' );
-   this.$targetLanguageFilter = $( '' ).addClass( 
'translation-target-language-filter' );
+   this.$sourceLanguageFilter = $( '' )
+   .addClass( 'translation-source-language-filter' );
+   this.$targetLanguageFilter = $( '' )
+   .addClass( 'translation-target-language-filter' );
+   this.setLanguageFilterLabel( this.$sourceLanguageFilter );
+   this.setLanguageFilterLabel( this.$targetLanguageFilter );
$sourceLanguageContainer = $( '' )
.addClass( 'translation-language-source-container' )
-   .append(
-   this.$sourceLanguageFilter,
-   $( '' )
-   .addClass( 'translation-language-select-arrow' )
-   );
+   .append( this.$sourceLanguageFilter );
 
$targetLanguageContainer = $( '' )
.addClass( 'translation-language-target-container' )
-   .append(
-   this.$targetLanguageFilter,
-   $( '' ).addClass( 
'translation-language-select-arrow' )
-   );
+   .append( this.$targetLanguageFilter );
 
this.$listHeader.append(
this.$filter,
@@ -239,10 +223,8 @@
$.each( this.lists

[MediaWiki-commits] [Gerrit] Fix internal API error when suggestion requested for empty l... - change (mediawiki...ContentTranslation)

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

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

Change subject: Fix internal API error when suggestion requested for empty 
language pair
..

Fix internal API error when suggestion requested for empty language pair

Bug: T113019

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


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

diff --git a/includes/Translation.php b/includes/Translation.php
index 43ef7d6..41be9ae 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -89,8 +89,11 @@
 * @return Translation|Translation[]|null Translation
 */
public static function find( $sourceLanguage, $targetLanguage, $titles 
) {
-   $dbr = Database::getConnection( DB_SLAVE );
+   if ( $titles === null || empty( $titles ) ) {
+   return null;
+   }
 
+   $dbr = Database::getConnection( DB_SLAVE );
$values = array(
'translation_source_language' => $sourceLanguage,
'translation_target_language' => $targetLanguage,

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

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

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


[MediaWiki-commits] [Gerrit] Optimize link_lightgray.svg - change (mediawiki...ContentTranslation)

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

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

Change subject: Optimize link_lightgray.svg
..

Optimize link_lightgray.svg

$ svgo link_lightgray.svg
3.638 KiB - 57.7% = 1.54 KiB

Change-Id: I2e4ced2b59ffba6f29e50df9c273f3ff9d601afc
---
M modules/tools/images/link_lightgray.svg
1 file changed, 1 insertion(+), 60 deletions(-)


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

diff --git a/modules/tools/images/link_lightgray.svg 
b/modules/tools/images/link_lightgray.svg
index c9bf712..526431f 100644
--- a/modules/tools/images/link_lightgray.svg
+++ b/modules/tools/images/link_lightgray.svg
@@ -1,61 +1,2 @@
 
-
-
-http://purl.org/dc/elements/1.1/";
-   xmlns:cc="http://creativecommons.org/ns#";
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
-   xmlns:svg="http://www.w3.org/2000/svg";
-   xmlns="http://www.w3.org/2000/svg";
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
-   version="1.1"
-   id="Layer_1"
-   x="0px"
-   y="0px"
-   viewBox="0 0 612 792"
-   enable-background="new 0 0 612 792"
-   xml:space="preserve"
-   inkscape:version="0.48.2 r9819"
-   width="100%"
-   height="100%"
-   sodipodi:docname="link_lightgray.svg"
-   
inkscape:export-filename="/Users/pau/repos/wikimedia/ContentTranslation/modules/tools/images/link_lightgray.png"
-   inkscape:export-xdpi="73.522728"
-   inkscape:export-ydpi="73.522728">image/svg+xmlhttp://purl.org/dc/dcmitype/StillImage"; 
/>
-   
-   
-
-
-
\ No newline at end of file
+http://www.w3.org/2000/svg"; viewBox="0 0 612 792" 
enable-background="new 0 0 612 792">

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

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

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


[MediaWiki-commits] [Gerrit] Fix the PNG image path for translationlist and suggestionlis... - change (mediawiki...ContentTranslation)

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

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

Change subject: Fix the PNG image path for translationlist and suggestionlist 
modules
..

Fix the PNG image path for translationlist and suggestionlist modules

Bug: T112968
Change-Id: I1ac3f7186f074c7cd2f70d2ae5f58624dc897012
---
M modules/dashboard/styles/ext.cx.lists.common.less
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/dashboard/styles/ext.cx.lists.common.less 
b/modules/dashboard/styles/ext.cx.lists.common.less
index 4790d29..8bdbf8a 100644
--- a/modules/dashboard/styles/ext.cx.lists.common.less
+++ b/modules/dashboard/styles/ext.cx.lists.common.less
@@ -87,7 +87,7 @@
width: 100px;
 
&:empty {
-   
.background-image-svg('../../tools/images/link_lightgray.svg', 
'../images/link_lightgray.png');
+   
.background-image-svg('../../tools/images/link_lightgray.svg', 
'../../tools/images/link_lightgray.png');
background-repeat: no-repeat;
background-color: #fbfbfb;
background-position: center center;

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

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

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


[MediaWiki-commits] [Gerrit] Suggestions: Allow selecting languages - change (mediawiki...ContentTranslation)

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

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

Change subject: Suggestions: Allow selecting languages
..

Suggestions: Allow selecting languages

The language list is populated by previous CX languages,
content, UI languages, English, ULS common languages.

Refactored the language selector a bit to use the selector between
translations and suggestions.

We also try to give some smart defaults. Previous CX language is
first try. If they dont exist, English is source language. Target
language will be content language, or source language, or one from
ULS common language, till it differs from source language.

At present, if use select same language for both source and target,
we just present 'Sorry no suggestions'. But it can be more smart
to save an API request.

The current UI is very simple , but this need to be converted
to ULS in next step

Bug: T112051
Change-Id: I59d59fbfafd733fc33e0706b86d2a551fd38bc5f
---
M modules/dashboard/ext.cx.dashboard.js
M modules/dashboard/ext.cx.suggestionlist.js
2 files changed, 127 insertions(+), 60 deletions(-)


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

diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index fd367b2..c043253 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -53,8 +53,9 @@
 *
 * @param {jQuery} $filter Source filter or target filter to fill
 * @param {String[]} languages Array of language codes
+* @param String selected Selected language code
 */
-   CXDashboard.prototype.populateLanguageFilter = function ( $filter, 
languages ) {
+   CXDashboard.prototype.populateLanguageFilter = function ( $filter, 
languages, selected ) {
var i, label;
 
$filter.empty();
@@ -74,6 +75,7 @@
$filter.append( $( '' )
// Todo: use translated language name
.text( $.uls.data.getAutonym( languages[ i ] ) )
+   .prop( 'selected', selected === languages[ i ] )
.attr( 'value', languages[ i ] )
);
}
@@ -242,6 +244,11 @@
this.$filter.click( '.cx-filter', function ( e ) {
var $filter = $( e.target );
 
+   if ( $filter.is( '.cx-filter--selected' ) ) {
+   // Do not do anything on click of already 
selected filter.
+   return;
+   }
+
self.$filter
.find( '.cx-filter--selected' )
.removeClass( 'cx-filter--selected' );
@@ -258,51 +265,15 @@
} );
 
this.$sourceLanguageFilter.on( 'change', function () {
-   var $selector,
-   code = $( this ).val();
+   var code = $( this ).val();
 
setFilter( 'sourceLanguage', code );
-
-   $selector = self.$sourceLanguageFilter
-   .siblings( 
'.translation-language-select-content' );
-
-   if ( code === '' ) {
-   $selector
-   .text( mw.msg( 
'cx-translation-filter-from-any-language' ) )
-   .removeProp( 'lang' )
-   .removeProp( 'dir' );
-   } else {
-   $selector
-   .text( $.uls.data.getAutonym( code ) )
-   .prop( {
-   lang: code,
-   dir: $.uls.data.getDir( code )
-   } );
-   }
} );
 
this.$targetLanguageFilter.on( 'change', function () {
-   var $selector,
-   code = $( this ).val();
+   var code = $( this ).val();
 
setFilter( 'targetLanguage', code );
-
-   $selector = self.$targetLanguageFilter
-   .siblings( 
'.translation-language-select-content' );
-
-   if ( code === '' ) {
-   $selector
-   .text( mw.msg( 
'cx-translation-filter-to-any-language' ) )
-   .removeProp( 'lang' )
-   .removeProp( 'dir' );
-   } else {
-   $selector
-   

[MediaWiki-commits] [Gerrit] Stats: Fix the color for points in deletion graph - change (mediawiki...ContentTranslation)

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

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

Change subject: Stats: Fix the color for points in deletion graph
..

Stats: Fix the color for points in deletion graph

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


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

diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 7c72029..681bb9f 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -541,10 +541,10 @@
{
label: mw.msg( 'cx-trend-deletions' ),
strokeColor: '#FF',
-   pointColor: 'FF',
+   pointColor: '#FF',
pointStrokeColor: '#fff',
pointHighlightFill: '#fff',
-   pointHighlightStroke: 'FF',
+   pointHighlightStroke: '#FF',
data: $.map( 
this.languageDeletionTrend, function ( data ) {
return data[ type ];
} )

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

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

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


[MediaWiki-commits] [Gerrit] Stats: Misc cleanup on getDeletionTrend method - change (mediawiki...ContentTranslation)

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

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

Change subject: Stats: Misc cleanup on getDeletionTrend method
..

Stats: Misc cleanup on getDeletionTrend method

Change-Id: I0cbf399c57a4a44b573d09dd0287d5b9aed11543
---
M includes/Translation.php
1 file changed, 5 insertions(+), 7 deletions(-)


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

diff --git a/includes/Translation.php b/includes/Translation.php
index 2384225..84100b1 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -221,16 +221,16 @@
'ct_tag' => 'contenttranslation',
'ar_rev_id = ct_rev_id'
);
-   $groupBy = null;
 
+   $options = null;
if ( $interval === 'week' ) {
-   $groupBy = array(
+   $options = array(
'GROUP BY' => array(
'YEARWEEK(ar_timestamp)',
),
);
} elseif ( $interval === 'month' ) {
-   $groupBy = array(
+   $options = array(
'GROUP BY' => array(
'YEAR(ar_timestamp), 
MONTH(ar_timestamp)',
),
@@ -242,10 +242,9 @@
array( 'ar_timestamp', 'count(ar_page_id) as count' ),
$conditions,
__METHOD__,
-   $groupBy
+   $options
);
 
-   $prev = 0;
$count = 0;
$result = array();
foreach ( $rows as $row ) {
@@ -253,9 +252,8 @@
$time = self::getResultTime( $row->ar_timestamp, 
$interval );
$result[$time] = array(
'count' => $count,
-   'delta' => $count - $prev,
+   'delta' => (int)$row->count,
);
-   $prev = $count;
}
 
return $result;

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

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

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


[MediaWiki-commits] [Gerrit] Stats: Optimize the query behind contenttranslationlangtrend... - change (mediawiki...ContentTranslation)

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

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

Change subject: Stats: Optimize the query behind contenttranslationlangtrend API
..

Stats: Optimize the query behind contenttranslationlangtrend API

Query simplified by avoiding subquery, single method of both
published and draft stats.

Bug: T111943
Change-Id: I1503d7bf0f677955c7e740cd0290e02f398a4edc
---
M api/ApiQueryContentTranslationLanguageTrend.php
M includes/Translation.php
2 files changed, 36 insertions(+), 114 deletions(-)


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

diff --git a/api/ApiQueryContentTranslationLanguageTrend.php 
b/api/ApiQueryContentTranslationLanguageTrend.php
index a790c47..2ade9f4 100644
--- a/api/ApiQueryContentTranslationLanguageTrend.php
+++ b/api/ApiQueryContentTranslationLanguageTrend.php
@@ -33,8 +33,8 @@
$interval = $params['interval'];
 
$data = array(
-   'translations' => Translation::getPublishTrend( 
$source, $target, $interval ),
-   'drafts' => Translation::getDraftTrend( $source, 
$target, $interval ),
+   'translations' => Translation::getTrendByStatus( 
$source, $target, 'published', $interval ),
+   'drafts' => Translation::getTrendByStatus( $source, 
$target, 'draft', $interval ),
);
 
if ( $target !== null ) {
diff --git a/includes/Translation.php b/includes/Translation.php
index 3a7ba17..95f6699 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -211,86 +211,6 @@
}
 
/**
-* Get time-wise cumulative number of drafts for given
-* language pairs, with given interval.
-* @param string $source Source language code
-* @param string $target Target language code
-* @param string $interval 'weekly' or 'monthly' trend
-* @return array
-*/
-   public static function getDraftTrend( $source, $target, $interval ) {
-   $dbr = Database::getConnection( DB_SLAVE );
-
-   $draftCondition = $dbr->makeList(
-   array(
-   'translation_status' => 'draft',
-   'translation_target_url IS NULL'
-   ),
-   LIST_AND
-   );
-
-   $conditions = array();
-   $conditions[] = $draftCondition;
-   if ( $source !== null ) {
-   $conditions['translation_source_language'] = $source;
-   }
-   if ( $target !== null ) {
-   $conditions['translation_target_language'] = $target;
-   }
-
-   $options = null;
-   if ( $interval === 'week' ) {
-$options = array(
-   'GROUP BY' => array(
-   
'YEARWEEK(translation_last_updated_timestamp)',
-   ),
-   );
-   } elseif ( $interval === 'month' ) {
-$options = array(
-   'GROUP BY' => array(
-   
'YEAR(translation_last_updated_timestamp), 
MONTH(translation_last_updated_timestamp)',
-   ),
-   );
-   }
-
-   $subQuery = $dbr->selectSQLText(
-   'cx_translations',
-   'count(*)',
-   $dbr->makeList( array(
-   'translation_last_updated_timestamp <= 
MAX(translations.translation_last_updated_timestamp)',
-   $dbr->makeList( $conditions, LIST_AND ),
-   ),
-   LIST_AND )
-   );
-
-   $rows = $dbr->select(
-   array( 'translations' => 'cx_translations' ),
-   array(
-   
"translations.translation_last_updated_timestamp AS date",
-   '(' . $subQuery . ') translatons_count',
-   ),
-   $dbr->makeList( $conditions, LIST_AND ),
-   __METHOD__,
-   $options
-   );
-
-   $prev = 0;
-   $result = array();
-   foreach ( $rows as $row ) {
-   $count = (int)$row->translatons_count;
-   $time = self::getResultTime( $row->date, $interval );
-   $result[$time] = array(
-   'count' => $count,
-   'delta' => $count - $prev,
-   );
-
-   $prev = $count;
-   }
-
-  

[MediaWiki-commits] [Gerrit] Suggestions: Make the whole suggestion item clickable - change (mediawiki...ContentTranslation)

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

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

Change subject: Suggestions: Make the whole suggestion item clickable
..

Suggestions: Make the whole suggestion item clickable

Bug: T106405
Change-Id: I63bd26febe92b529e57b6987b6b6d2262b447dfb
---
M modules/dashboard/ext.cx.suggestionlist.js
M modules/dashboard/styles/ext.cx.lists.common.less
M modules/dashboard/styles/ext.cx.translationlist.less
3 files changed, 8 insertions(+), 5 deletions(-)


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

diff --git a/modules/dashboard/ext.cx.suggestionlist.js 
b/modules/dashboard/ext.cx.suggestionlist.js
index df69afb..c046a25 100644
--- a/modules/dashboard/ext.cx.suggestionlist.js
+++ b/modules/dashboard/ext.cx.suggestionlist.js
@@ -194,6 +194,11 @@
target: '_blank',
title: mw.msg( 
'cx-suggestionlist-view-source-page' )
} )
+   .click( function ( e ) {
+   // Do not propagate to the parent suggestion 
item. Prevent opening
+   // source selector.
+   e.stopPropagation();
+   } )
.addClass( 'cx-slitem__languages__language 
cx-slitem__languages__language--source' )
.text( $.uls.data.getAutonym( suggestion.sourceLanguage 
) );
 
@@ -286,14 +291,14 @@
 * Event handlers
 */
CXSuggestionList.prototype.listen = function () {
-   this.$container.on( 'click', '.cx-suggestionlist 
.cx-slitem__translation-link', function () {
+   this.$container.on( 'click', '.cx-suggestionlist .cx-slitem', 
function () {
var cxSelector, suggestion;
 
cxSelector = $( this ).data( 'cxsourceselector' );
if ( cxSelector ) {
cxSelector.prefill();
} else {
-   suggestion = $( this ).data( 'suggestion' );
+   suggestion = $( this ).find( 
'.cx-slitem__translation-link' ).data( 'suggestion' );
$( this ).cxSourceSelector( {
sourceLanguage: 
suggestion.sourceLanguage,
targetLanguage: 
suggestion.targetLanguage,
diff --git a/modules/dashboard/styles/ext.cx.lists.common.less 
b/modules/dashboard/styles/ext.cx.lists.common.less
index cc83072..4790d29 100644
--- a/modules/dashboard/styles/ext.cx.lists.common.less
+++ b/modules/dashboard/styles/ext.cx.lists.common.less
@@ -4,7 +4,7 @@
padding: 12px;
background-color: #fff;
border-top: 1px solid #ddd;
-
+   cursor: pointer;
&:hover {
background-color: #eff3fb;
}
diff --git a/modules/dashboard/styles/ext.cx.translationlist.less 
b/modules/dashboard/styles/ext.cx.translationlist.less
index 1ea142c..7523b23 100644
--- a/modules/dashboard/styles/ext.cx.translationlist.less
+++ b/modules/dashboard/styles/ext.cx.translationlist.less
@@ -3,8 +3,6 @@
 @import "mediawiki.mixins";
 
 .cx-tlitem {
-   cursor: pointer;
-
&.cx-translation-deleted {
opacity: 0.5;
}

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

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

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


[MediaWiki-commits] [Gerrit] Suggestions: Fix the featured lable alignment error - change (mediawiki...ContentTranslation)

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

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

Change subject: Suggestions: Fix the featured lable alignment error
..

Suggestions: Fix the featured lable alignment error

The featured tag was a few pixels down compared to language labels

Bug: T106405
Change-Id: If4d8430c65aa8217a419cafc9264d58062ed5b22
---
M modules/dashboard/styles/ext.cx.suggestionlist.less
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/dashboard/styles/ext.cx.suggestionlist.less 
b/modules/dashboard/styles/ext.cx.suggestionlist.less
index b0ea346..5dcaf14 100644
--- a/modules/dashboard/styles/ext.cx.suggestionlist.less
+++ b/modules/dashboard/styles/ext.cx.suggestionlist.less
@@ -39,7 +39,7 @@
color: #00af89;
// This need to be in green backgound, but for now we have
// everything as featured.
-   padding: 2px;
+   padding: 0 2px;
border-radius: 1px;
font-size: small;
 }

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

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

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


[MediaWiki-commits] [Gerrit] Suggestions: Filter out ongoing translations and existing pages - change (mediawiki...ContentTranslation)

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

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

Change subject: Suggestions: Filter out ongoing translations and existing pages
..

Suggestions: Filter out ongoing translations and existing pages

If the suggested title already exist in target language wiki, remove
it from the suggestions table too.

Bug: T43
Change-Id: I94d9c20e5db19c07f60b51f262e5db6df541278f
---
M api/ApiQueryContentTranslationSuggestions.php
M includes/SuggestionListManager.php
M includes/Translation.php
3 files changed, 102 insertions(+), 6 deletions(-)


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

diff --git a/api/ApiQueryContentTranslationSuggestions.php 
b/api/ApiQueryContentTranslationSuggestions.php
index 1d066fb..cf32e19 100644
--- a/api/ApiQueryContentTranslationSuggestions.php
+++ b/api/ApiQueryContentTranslationSuggestions.php
@@ -8,7 +8,9 @@
  */
 
 use ContentTranslation\Translator;
+use ContentTranslation\Translation;
 use ContentTranslation\SuggestionListManager;
+use ContentTranslation\SiteMapper;
 
 /**
  * Api module for querying translation suggestions.
@@ -53,6 +55,11 @@
$data = $manager->getRelevantSuggestions( $translator, 
$params['from'], $params['to'] );
 
$lists = array();
+   $suggestions = $data['suggestions'];
+   // Filter out all ongoing translations
+   $suggestions = $this->filterSuggestionsByOngoingTranslations( 
$suggestions );
+   // Filter out all existing target titles
+   $suggestions = $this->filterSuggestionsByExistingTitles( 
$suggestions );
foreach ( $data['lists'] as $list ) {
$lists[$list->getId()] = array(
'displayName' => $list->getDisplayNameMessage( 
$this->getContext() )->text(),
@@ -60,7 +67,7 @@
'type' => $list->getType(),
'suggestions' => array(),
);
-   foreach ( $data['suggestions'] as $suggestion ) {
+   foreach ( $suggestions as $suggestion ) {

$lists[$suggestion->getListId()]['suggestions'][] = array(
'title' => 
$suggestion->getTitle()->getPrefixedText(),
'sourceLanguage' => 
$suggestion->getSourceLanguage(),
@@ -69,10 +76,78 @@
);
}
}
-
$result->addValue( array( 'query', $this->getModuleName() ), 
'lists', $lists );
}
 
+   public function filterSuggestionsByOngoingTranslations( array 
$suggestions ) {
+   $params = $this->extractRequestParams();
+   $sourceLanguage = $params['from'];
+   $targetLanguage = $params['to'];
+   $existingTranslationTitles = array();
+   foreach ( $suggestions as $suggestion ) {
+   $titles[] = $suggestion->getTitle()->getPrefixedText();
+   }
+   $translations = Translation::find( $sourceLanguage, 
$targetLanguage, $titles );
+   foreach ( $translations as $translation ) {
+   $existingTranslationTitles[] = 
$translation['sourceTitle'];
+   }
+   $suggestions = array_filter( $suggestions,
+   function( $suggestion ) use( $existingTranslationTitles 
) {
+   return !in_array(
+   
$suggestion->getTitle()->getPrefixedText(),
+   $existingTranslationTitles
+   );
+   }
+   );
+   return $suggestions;
+   }
+
+   public function filterSuggestionsByExistingTitles( array $suggestions ) 
{
+   $params = $this->extractRequestParams();
+   $titles = array();
+   $missingTitles = array();
+   $sourceLanguage = $params['from'];
+   $targetLanguage = $params['to'];
+   $domain = SiteMapper::getDomainCode( $sourceLanguage );
+   $existingTitles = array();
+   foreach ( $suggestions as $suggestion ) {
+   $titles[] = $suggestion->getTitle()->getPrefixedText();
+   }
+   $params = array(
+   'action' => 'query',
+   'format' => 'json',
+   'titles' => implode( '|', $titles ),
+   'prop' => 'langlinks',
+   'lllimit' => 10,
+   'lllang' => SiteMapper::getDomainCode( $targetLanguage 
),
+   'redirects' => true
+   );
+   $apiUrl = "https://$d

[MediaWiki-commits] [Gerrit] Stats: Weekly trends - change (mediawiki...ContentTranslation)

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

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

Change subject: Stats: Weekly trends
..

Stats: Weekly trends

While doing this, as per Pau's suggestion, I changed
the colors(again).
Translations: Blue, Draft: Gray, Deleted: Red

Bug: T105192
Change-Id: I8301bcd7e595e8144a43622a27503b8ed9494bbf
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M lib/chart.js/Chart.Core.js
M lib/chart.js/Chart.Line.js
M modules/stats/ext.cx.stats.js
M modules/stats/styles/ext.cx.stats.less
7 files changed, 406 insertions(+), 75 deletions(-)


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

diff --git a/extension.json b/extension.json
index c6d051f..76fc319 100644
--- a/extension.json
+++ b/extension.json
@@ -849,6 +849,8 @@
"cx-stats-local-published-number",
"cx-stats-local-published",
"cx-stats-grouping-title",
+   "cx-trend-published-translations-title",
+   "cx-trend-translations-to-title",
"percent"
]
},
@@ -857,7 +859,8 @@
"remoteExtPath": "ContentTranslation/lib",
"scripts": [
"chart.js/Chart.Core.js",
-   "chart.js/Chart.Line.js"
+   "chart.js/Chart.Line.js",
+   "chart.js/Chart.Bar.js"
]
},
"ext.cx.beta.notification": {
diff --git a/i18n/en.json b/i18n/en.json
index e355a1f..567159b 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -164,6 +164,8 @@
"cx-stats-local-published-number": "$1 in $2",
"cx-stats-local-published": "$1 ($3) in $2",
"cx-stats-grouping-title": "{{PLURAL:$1|$1 translation|$1 
translations}}",
+   "cx-trend-published-translations-title": "Translation trend",
+   "cx-trend-translations-to-title": "Translation trend to $1",
"cx-tools-missing-link-text": "{{GENDER:|Mark}} the page as missing to 
encourage its creation.",
"cx-tools-missing-link-tooltip": "Translate (in new window)",
"cx-tools-missing-link-title": "Missing link",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 44cb907..03d15c3 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -169,6 +169,8 @@
"cx-stats-local-published-number": "A message shown in 
[[Special:CXStats]] as highlights of CX analytics. $1 is a number, $2 is 
language name (autonym).",
"cx-stats-local-published": "A message shown in [[Special:CXStats]] as 
highlights of CX analytics. $1 is a number, $2 is language name (autonym), $3 
is percentage.",
"cx-stats-grouping-title": "Title text for language grouping based on 
number of translations. $1 is number of 
translations\n{{Identical|Translation}}",
+   "cx-trend-published-translations-title": "A message shown in 
[[Special:CXStats]]",
+   "cx-trend-translations-to-title": "Label shown in the legend section 
Content translation trends graph visualization.\n* $1 - language name",
"cx-tools-missing-link-text": "Message with instructions for marking 
links as missing",
"cx-tools-missing-link-tooltip": "Tooltip that shows when hovering over 
target link card link when working with missing links.\nClicking on link opens 
a new translation view for the missing link.",
"cx-tools-missing-link-title": "Title for target link card when card is 
used for working with missing links",
diff --git a/lib/chart.js/Chart.Core.js b/lib/chart.js/Chart.Core.js
old mode 100755
new mode 100644
index 5dccd2e..aa6c58d
--- a/lib/chart.js/Chart.Core.js
+++ b/lib/chart.js/Chart.Core.js
@@ -35,17 +35,17 @@
{
return 
document.defaultView.getComputedStyle(element).getPropertyValue(dimension);
}
-   }
+   };
 
-   var width = this.width = 
computeDimension(context.canvas,'Width');
-   var height = this.height = 
computeDimension(context.canvas,'Height');
+   var width = this.width = 
computeDimension(context.canvas,'Width') || context.canvas.width;
+   var height = this.height = 
computeDimension(context.canvas,'Height') || context.canvas.height;
 
// Firefox requires this to work correctly
context.canvas.width  = width;
context.canvas.height = height;
 
-   var width = this.width = context.canvas.width;
-   var height = this.height = context.canvas.height;
+   width = this.width = context.canvas.width;
+   height = this.height = context.canvas.height;
this.aspectRatio = this.wid

[MediaWiki-commits] [Gerrit] Stats: Generate personal tools before head element - change (mediawiki...ContentTranslation)

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

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

Change subject: Stats: Generate personal tools before head element
..

Stats: Generate personal tools before head element

Change-Id: Id604da146dcae601b19ee29536339f98c55f68fb
Followup: I5d024a42421423c5d0c5ebe2123ebdffa5e9c3b2
---
M specials/SpecialContentTranslationStats.php
1 file changed, 3 insertions(+), 4 deletions(-)


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

diff --git a/specials/SpecialContentTranslationStats.php 
b/specials/SpecialContentTranslationStats.php
index c1476fa..07b63fb 100644
--- a/specials/SpecialContentTranslationStats.php
+++ b/specials/SpecialContentTranslationStats.php
@@ -39,7 +39,9 @@
$out->addModules( $defaultSkinModules['legacy'] );
 
Hooks::run( 'BeforePageDisplay', array( &$out, &$skin ) );
-
+   $toolbarList = Html::rawElement( 'ul',
+   null,
+   $skin->getPersonalToolsList() );
$out->addHTML( $out->headElement( $skin ) );
$out->addHTML( Html::element(
'noscript',
@@ -47,9 +49,6 @@
$this->msg( 'cx-javascript' )->text()
) );
$out->addHtml( MWDebug::getDebugHTML( $this->getContext() ) );
-   $toolbarList = Html::rawElement( 'ul',
-   null,
-   $skin->getPersonalToolsList() );
$out->addHTML( Html::rawElement( 'div',
array( 'id' => 'p-personal' ),
$toolbarList ) );

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

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

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


[MediaWiki-commits] [Gerrit] WIP: Deletion count graph - change (mediawiki...ContentTranslation)

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

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

Change subject: WIP: Deletion count graph
..

WIP: Deletion count graph

Change-Id: I8581d07c00dac6228ba5cc8b465acf431a1163e3
---
M api/ApiQueryContentTranslationLanguageTrend.php
M includes/Translation.php
M modules/stats/ext.cx.stats.js
3 files changed, 81 insertions(+), 12 deletions(-)


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

diff --git a/api/ApiQueryContentTranslationLanguageTrend.php 
b/api/ApiQueryContentTranslationLanguageTrend.php
index db17780..3aff780 100644
--- a/api/ApiQueryContentTranslationLanguageTrend.php
+++ b/api/ApiQueryContentTranslationLanguageTrend.php
@@ -35,7 +35,8 @@
array(
'translations' =>

ContentTranslation\Translation::getPublishTrend( $source, $target, $interval ),
-   'drafts' => 
ContentTranslation\Translation::getDraftTrend( $source, $target, $interval )
+   'drafts' => 
ContentTranslation\Translation::getDraftTrend( $source, $target, $interval ),
+   'deletions' =>  
ContentTranslation\Translation::getDeletionTrend( $interval )
)
);
}
diff --git a/includes/Translation.php b/includes/Translation.php
index 59c4a2d..cae0cfc 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -291,6 +291,62 @@
}
 
/**
+* Get time-wise cumulative number of drafts for given
+* language pairs, with given interval.
+*/
+   public static function getDeletionTrend( $interval ) {
+   $dbr = wfGetDB( DB_SLAVE );
+
+   $conditions = array(
+   'ar_namespace' => 0,
+   'ct_tag' => 'contenttranslation',
+   'ar_rev_id = ct_rev_id'
+   );
+   $groupBy = null;
+
+   if ( $interval === 'week' ) {
+   $groupBy = array(
+   'GROUP BY' => array(
+   'YEARWEEK(ar_timestamp)',
+   ),
+   );
+   } elseif ( $interval === 'month' ) {
+   $groupBy = array(
+   'GROUP BY' => array(
+   'YEAR(ar_timestamp), 
MONTH(ar_timestamp)',
+   ),
+   );
+   }
+
+   $rows = $dbr->select(
+   array( 'change_tag', 'archive' ),
+   array( 'ar_timestamp', 'count(ar_page_id) as count' ),
+   $conditions,
+   __METHOD__,
+   $groupBy
+   );
+
+   $prev = 0;
+   $count = 0;
+   $result = array();
+   foreach ( $rows as $row ) {
+   $count += (int)$row->count;
+   $result[] = array(
+   'date' => $interval === 'week' ?
+   // Week end date
+   date( 'Y-m-d', strtotime( 
$row->ar_timestamp . ' + ' .
+   ( 6 - date( 'w', strtotime( 
$row->ar_timestamp ) ) ) . ' days' ) ) :
+   date( 'Y-m', strtotime( 
$row->ar_timestamp ) ),
+   'count' => $count,
+   'delta' => $count - $prev,
+   );
+   $prev = $count;
+   }
+
+   return $result;
+   }
+
+   /**
 * Get time-wise cumulative number of translations for given
 * language pairs, with given interval.
 */
diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index 769cba3..6b46e22 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -67,6 +67,7 @@
self.totalDraftTrend = mergeAndFill( 
self.totalTranslationTrend, totalTrend.drafts );
self.languageDraftTrend = mergeAndFill( 
self.languageTranslationTrend, languageTrend.drafts );
self.languageDraftTrend = mergeAndFill( 
self.totalDraftTrend, self.languageDraftTrend );
+   self.languageDeletionTrend = mergeAndFill( 
self.languageTranslationTrend, totalTrend.deletions );
self.renderHighlights();
self.drawCumulativeGraph( 'count' );
self.drawLanguageCumulativeGraph( 'count' );
@@ -499,6 +500,28 @@
} ),
datasets: [

[MediaWiki-commits] [Gerrit] Stats: Separate total and language graph, and show draft cou... - change (mediawiki...ContentTranslation)

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

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

Change subject: Stats: Separate total and language graph, and show draft count 
in graph
..

Stats: Separate total and language graph, and show draft count in graph

This is in preparation for showing deletion stats and weekly trend
graphs.

Showing both total and language specific stats is difficult to
understand because the difference is widening fast. So separated them.

ApiQueryContentTranslationLanguageTrend now return cumulative count
for translations in progress as well. Soon it should retun
cumulative deleted stats too.

Bug: T105192
Bug: T90538
Change-Id: Ifd4bd0e3a92ac022428edf3915552ea99142dbfb
---
M api/ApiQueryContentTranslationLanguageTrend.php
M includes/Translation.php
M modules/stats/ext.cx.stats.js
M modules/stats/styles/ext.cx.stats.less
4 files changed, 196 insertions(+), 47 deletions(-)


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

diff --git a/api/ApiQueryContentTranslationLanguageTrend.php 
b/api/ApiQueryContentTranslationLanguageTrend.php
index cd5bf33..e8b9e43 100644
--- a/api/ApiQueryContentTranslationLanguageTrend.php
+++ b/api/ApiQueryContentTranslationLanguageTrend.php
@@ -32,7 +32,10 @@
$result->addValue(
array( 'query' ),
'contenttranslationlangtrend',
-   ContentTranslation\Translation::getTrend( $source, 
$target, $interval )
+   array(
+   'translations' => 
ContentTranslation\Translation::getPublishTrend( $source, $target, $interval ),
+   'drafts' => 
ContentTranslation\Translation::getDraftTrend( $source, $target, $interval )
+   )
);
}
 
diff --git a/includes/Translation.php b/includes/Translation.php
index c0a7c98..59c4a2d 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -211,10 +211,90 @@
}
 
/**
+* Get time-wise cumulative number of drafts for given
+* language pairs, with given interval.
+*/
+   public static function getDraftTrend( $source, $target, $interval ) {
+   $dbr = Database::getConnection( DB_SLAVE );
+
+   $draftCondition = $dbr->makeList(
+   array(
+   'translation_status' => 'draft',
+   'translation_target_url IS NULL'
+   ),
+   LIST_AND
+   );
+
+   $groupBy = null;
+
+   if ( $interval === 'week' ) {
+   $groupBy = array(
+   'GROUP BY' => array(
+   
'YEARWEEK(translation_last_updated_timestamp)',
+   ),
+   );
+   } elseif ( $interval === 'month' ) {
+   $groupBy = array(
+   'GROUP BY' => array(
+   
'YEAR(translation_last_updated_timestamp), 
MONTH(translation_last_updated_timestamp)',
+   ),
+   );
+   }
+
+   $conditions = array( $draftCondition );
+
+   if ( $source !== null ) {
+   $conditions['translation_source_language'] = $source;
+   }
+
+   if ( $target !== null ) {
+   $conditions['translation_target_language'] = $target;
+   }
+
+   $rows = $dbr->select(
+   array( 'translations' => 'cx_translations' ),
+   array(
+   "DATE_FORMAT( 
translations.translation_last_updated_timestamp, '%Y-%m-%d' ) AS date",
+   '(' . $dbr->selectSQLText(
+   'cx_translations',
+   'count(*)',
+   $dbr->makeList( array(
+   
'translation_last_updated_timestamp <= 
MAX(translations.translation_last_updated_timestamp)',
+   $dbr->makeList( $conditions, 
LIST_AND ),
+   ),
+   LIST_AND )
+   ) . ') translatons_count',
+   ),
+   $dbr->makeList( $conditions, LIST_AND ),
+   __METHOD__,
+   $groupBy
+   );
+
+   $prev = 0;
+   $result = array();
+   foreach ( $rows as $row ) {
+   $count = (int)$row->translatons_count;
+   $result[] = array(
+   

[MediaWiki-commits] [Gerrit] Use the VirtualRESTService to configure CX - change (mediawiki...ContentTranslation)

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

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

Change subject: Use the VirtualRESTService to configure CX
..

Use the VirtualRESTService to configure CX

This allows CX to use either Parsoid or RESTBase via the VRS, and
to share its configuration with Visual Editor.

Bug: T111490
Change-Id: I33bc150fa302d9523df92e9e8a258a19b63847f5
---
M api/ApiContentTranslationPublish.php
M extension.json
2 files changed, 53 insertions(+), 8 deletions(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index 7728ebb..f5366fb 100755
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -24,15 +24,59 @@
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'],
-   ) ) );
+   $this->serviceClient->mount( '/parsoid/', $this->getVRSObject() 
);
+   }
+
+   /**
+* Creates the virtual REST service object to be used in CX's API 
calls. The
+* method determines whether to instantiate a ParsoidVirtualRESTService 
or a
+* RestbaseVirtualRESTService object based on configuration directives: 
if
+* $wgVirtualRestConfig['modules']['restbase'] is defined, RESTBase is 
chosen,
+* otherwise Parsoid is used (either by using the MW Core config, or the
+* VE-local one).
+*
+* @return VirtualRESTService the VirtualRESTService object to use
+*/
+   private function getVRSObject() {
+   // the params array to create the service object with
+   $params = array();
+   // the VRS class to use, defaults to Parsoid
+   $class = 'ParsoidVirtualRESTService';
+   $config = $this->getConfig();
+   // the global virtual rest service config object, if any
+   $vrs = $this->getConfig()->get( 'VirtualRestConfig' );
+   if ( isset( $vrs['modules'] ) && isset( 
$vrs['modules']['restbase'] ) ) {
+   // if restbase is available, use it
+   $params = $vrs['modules']['restbase'];
+   $class = 'RestbaseVirtualRESTService';
+   // remove once VE generates restbase paths
+   $params['parsoidCompat'] = true;
+   } elseif ( isset( $vrs['modules'] ) && isset( 
$vrs['modules']['parsoid'] ) ) {
+   // there's a global parsoid config, use it next
+   $params = $vrs['modules']['parsoid'];
+   } else {
+   // no global modules defined, fall back to old defaults
+   $params = array(
+   'URL' => $config->get( 
'ContentTranslationParsoid' )['url'],
+   'prefix' => $config->get( 
'ContentTranslationParsoid' )['prefix'],
+   'domain' => $config->get( 
'ContentTranslationParsoid' )['domain'],
+   'timeout' => $config->get( 
'ContentTranslationParsoid' )['timeout'],
+   );
+   }
+   // merge the global and service-specific params
+   if ( isset( $vrs['global'] ) ) {
+   $params = array_merge( $vrs['global'], $params );
+   }
+   // set up cookie forwarding
+   if ( $params['forwardCookies'] && !User::isEveryoneAllowed( 
'read' ) ) {
+   $params['forwardCookies'] = 
RequestContext::getMain()->getRequest()->getHeader( 'Cookie' );
+   } else {
+   $params['forwardCookies'] = false;
+   }
+   // create the VRS object and return it
+   return new $class( $params );
}
 
private function requestParsoid( $method, $path, $params ) {
diff --git a/extension.json b/extension.json
index b8910ae..a8e1a8e 100644
--- a/extension.json
+++ b/extension.json
@@ -101,7 +101,8 @@
"ContentTranslationParsoid": {
"url": "http://parsoid-lb.eqiad.wikimedia.org/";,
"timeout": 10,
-   "prefix": "enwiki"
+

[MediaWiki-commits] [Gerrit] Fix: References are adapted with same content - change (mediawiki...ContentTranslation)

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

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

Change subject: Fix: References are adapted with same content
..

Fix: References are adapted with same content

This was a regression from If9ab5a98ae49b379c01f57a38f0b08c4e3fad122
which started processing internal templates inside templates. Wrong
usuage of array.push caused the Bug T110007

Testplan:

Translate article Factorio from en to fr and publish - All references
must be adapted properly. Content should not be repeated for references.
And for If9ab5a98ae49b379c01f57a38f0b08c4e3fad122, translate
Amblydoras from en to es. Start adding sections from top
to bottom. You will see references section added. Try publishing it.
Publishing will pass. This is normal case. Now translate the same
again and start clicking sections from bottom to top. That means,
you are adding references list first and then section containing reference
later. Try publishing. You will get parsoid error. With this patch,
adding sections in any order will not result publishing error.

Bug: T110007
Change-Id: I044193de3e2815e084489a48817340138fd639e7
---
M modules/tools/ext.cx.tools.template.js
1 file changed, 8 insertions(+), 7 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.template.js 
b/modules/tools/ext.cx.tools.template.js
index 5833b21..4cda0b4 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -209,18 +209,19 @@
 * @param {jQuery} $section Content translation section
 */
function processTemplates( $section ) {
-   var templates = [];
+   var i, template, templates = [];
 
if ( $section.is( '[typeof*="mw:Transclusion"]' ) ) {
templates.push( $section );
}
-   templates.push( $section.find( '[typeof*="mw:Transclusion"]' ) 
);
-
-   $.each( templates, function () {
-   var template = new TemplateTool( this );
-
+   templates = templates.concat(
+   // Convert the internal templates to a js array
+   $.makeArray( $section.find( 
'[typeof*="mw:Transclusion"]' ) )
+   );
+   for ( i = 0; i < templates.length; i++ ) {
+   template = new TemplateTool( templates[ i ] );
template.process();
-   } );
+   }
}
 
if ( typeof QUnit !== undefined ) {

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

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

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


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

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

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

Change subject: Fix PHP errors
..

Fix PHP errors

* SiteMapper.php was throwing error about undefined $domain.
* manage-lists.php was throwing error about undefined $param

Change-Id: I7faf6185b5f4bf936e4525576757cc0a96b65353
---
M includes/SiteMapper.php
M scripts/manage-lists.php
2 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/includes/SiteMapper.php b/includes/SiteMapper.php
index f6d7a7b..0ed3801 100644
--- a/includes/SiteMapper.php
+++ b/includes/SiteMapper.php
@@ -15,7 +15,7 @@
return 
$wgContentTranslationDomainCodeMapping[$language];
}
 
-   return $domain;
+   return $language;
}
 
 
diff --git a/scripts/manage-lists.php b/scripts/manage-lists.php
index 074f4ea..e635793 100644
--- a/scripts/manage-lists.php
+++ b/scripts/manage-lists.php
@@ -123,8 +123,8 @@
if ( !isset( $data['continue'] ) || count( $pages ) > 
5000 ) {
break;
} else {
-   unset( $param['llcontinue'] );
-   unset( $param['gcmcontinue'] );
+   unset( $params['llcontinue'] );
+   unset( $params['gcmcontinue'] );
$params += $data['continue'];
}
}

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

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

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


[MediaWiki-commits] [Gerrit] Validate the references when restored from draft - change (mediawiki...ContentTranslation)

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

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

Change subject: Validate the references when restored from draft
..

Validate the references when restored from draft

If the references in source article changed, the references
in translation might point to invalid items in references list.
This can cause publishing error because of parsoid error.

For such dangling references in translation, remove them if they
point to invalid references in references list.

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


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

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index 2169885..56c21cb 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -296,6 +296,14 @@
.find( '.mw-reference-text' );
mwData.body.id = $referenceContent.prop( 'id' );
}
+   // Makre sure that the data-mw.body.id points to an element 
that exists. otherwise
+   // remove that reference. This happens when references in 
source article changed
+   // and the reference in draft translation no longer points to a 
valid reference.
+   // See T109574
+   if ( mwData.body.id && !document.getElementById( mwData.body.id 
) ) {
+   $targetReference.remove();
+   return;
+   }
$targetReference.attr( 'data-mw', JSON.stringify( mwData ) );
this.addReferenceList();
};

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

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

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


[MediaWiki-commits] [Gerrit] Refactor the dashboard and translationlist modules - change (mediawiki...ContentTranslation)

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

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

Change subject: Refactor the dashboard and translationlist modules
..

Refactor the dashboard and translationlist modules

Translation list module was handling the rendering and event
handlers of translation status filter and language selectors.
It was also rendering the new translation button.

This commit removes all the above features to the dashboard module.
Translation list is now just a widget to list the translations.

This change is to initiate the listing of suggestion initiated by
dashboard module and provide way for suggestion list to share the
language filters.

Functionality wise nothing changed.

Change-Id: I647c4b5348e59f3c5385a08907b1953da113952e
---
M extension.json
M modules/dashboard/ext.cx.dashboard.js
M modules/dashboard/ext.cx.translationlist.js
M modules/dashboard/styles/ext.cx.dashboard.less
M modules/dashboard/styles/ext.cx.translationlist.less
5 files changed, 418 insertions(+), 421 deletions(-)


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

diff --git a/extension.json b/extension.json
index 405ff73..7ddc679 100644
--- a/extension.json
+++ b/extension.json
@@ -192,6 +192,7 @@
"ext.cx.header",
"ext.cx.model",
"ext.cx.sitemapper",
+   "ext.cx.source.selector",
"ext.cx.translationlist",
"mediawiki.Uri",
"mediawiki.ui.button"
@@ -201,7 +202,13 @@
"cx-dashboard-sidebar-title",
"cx-dashboard-sidebar-information",
"cx-dashboard-sidebar-stats",
-   "cx-dashboard-sidebar-feedback"
+   "cx-dashboard-sidebar-feedback",
+   "cx-create-new-translation",
+   "cx-translation-filter-suggested-translations",
+   "cx-translation-filter-published-translations",
+   "cx-translation-filter-draft-translations",
+   "cx-translation-filter-from-any-language",
+   "cx-translation-filter-to-any-language"
]
},
"ext.cx.magnuslink": {
@@ -740,7 +747,6 @@
],
"dependencies": [
"ext.cx.progressbar",
-   "ext.cx.source.selector",
"ext.cx.util",
"ext.cx.widgets.overlay",
"jquery.uls.data",
@@ -748,12 +754,6 @@
],
"messages": [
"cx-dashboard-header",
-   "cx-create-new-translation",
-   "cx-translation-filter-suggested-translations",
-   "cx-translation-filter-published-translations",
-   "cx-translation-filter-draft-translations",
-   "cx-translation-filter-from-any-language",
-   "cx-translation-filter-to-any-language",
"cx-discard-translation",
"cx-translation-status-draft",
"cx-translation-status-deleted",
diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index 467da96..2583557 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -20,23 +20,95 @@
this.siteMapper = siteMapper;
this.$header = null;
this.$sidebar = null;
-   this.$translationList = null;
+   this.translationList = null;
+   this.$translationListContainer = null;
this.$newTranslationButton = null;
+   this.$filter = null;
+   this.$listHeader = null;
+   this.$sourceLanguageFilter = null;
+   this.$targetLanguageFilter = null;
+   this.$cta = null;
this.init();
}
 
CXDashboard.prototype.init = function () {
this.render();
-   this.initComponents();
+   this.initLists();
this.listen();
mw.hook( 'mw.cx.dashboard.ready' ).fire();
};
 
/**
+* Get all the translations of given user.
+*
+* @return {jQuery.Promise}
+*/
+   CXDashboard.prototype.getTranslations = function () {
+   var api = new mw.Api();
+
+

[MediaWiki-commits] [Gerrit] Revert "Temporarily disable notifications" - change (mediawiki...ContentTranslation)

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

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

Change subject: Revert "Temporarily disable notifications"
..

Revert "Temporarily disable notifications"

This reverts commit a64d657b26bb019b0c0c47c2d19cef42e721e253.
The fix for bug T109063 was deployed.

Bug: T108559
Change-Id: I62850352e897fd78baa3999b6b8297f3b4fe03a2
---
M api/ApiContentTranslationPublish.php
1 file changed, 1 insertion(+), 2 deletions(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index 23caae8..f991e11 100755
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -217,8 +217,7 @@
}
$this->saveTranslationHistory( $params );
// Notify user about milestones
-   // Temporary fix for T109063 and T108559
-   // $this->notifyTranslator();
+   $this->notifyTranslator();
} else {
$result = array(
'result' => 'error',

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

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

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


[MediaWiki-commits] [Gerrit] Temporarily disable notifications - change (mediawiki...ContentTranslation)

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

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

Change subject: Temporarily disable notifications
..

Temporarily disable notifications

Temporary fix for T109063 and T108559
till we figure out and fix the actual issue

Bug: T108559
Change-Id: Ia1b9697c8f4792f825d88416741ac148b61bf89b
---
M api/ApiContentTranslationPublish.php
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index f991e11..23caae8 100755
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -217,7 +217,8 @@
}
$this->saveTranslationHistory( $params );
// Notify user about milestones
-   $this->notifyTranslator();
+   // Temporary fix for T109063 and T108559
+   // $this->notifyTranslator();
} else {
$result = array(
'result' => 'error',

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

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

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


[MediaWiki-commits] [Gerrit] [WIP] Dashboard: Show translation suggestions - change (mediawiki...ContentTranslation)

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

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

Change subject: [WIP] Dashboard: Show translation suggestions
..

[WIP] Dashboard: Show translation suggestions

Change-Id: I503310492a7bac3f4072042bb1e64b9e2ed4891b
---
M extension.json
M modules/dashboard/ext.cx.dashboard.js
A modules/dashboard/ext.cx.suggestionlist.js
A modules/dashboard/styles/ext.cx.suggestionlist.less
4 files changed, 348 insertions(+), 5 deletions(-)


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

diff --git a/extension.json b/extension.json
index c1604cf..eabfd35 100644
--- a/extension.json
+++ b/extension.json
@@ -197,6 +197,7 @@
"ext.cx.sitemapper",
"ext.cx.source.selector",
"ext.cx.translationlist",
+   "ext.cx.suggestionlist",
"mediawiki.Uri",
"mediawiki.ui.button"
],
@@ -768,6 +769,18 @@
"cx-translationlist-empty-desc"
]
},
+   "ext.cx.suggestionlist": {
+   "scripts": [
+   "dashboard/ext.cx.suggestionlist.js"
+   ],
+   "styles": [
+   "dashboard/styles/ext.cx.suggestionlist.less"
+   ],
+   "dependencies": [
+   "ext.cx.util",
+   "jquery.uls.data"
+   ]
+   },
"ext.cx.translation.conflict": {
"scripts": [
"translation/ext.cx.translation.conflict.js"
diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index ac36202..91b2d67 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -39,6 +39,27 @@
};
 
/**
+* Get all the translation suggestion lists of given user.
+*
+* @return {jQuery.Promise}
+*/
+   CXDashboard.prototype.getSuggestionLists = function () {
+   var storedSourceLanguage, storedTargetLanguage, api = new 
mw.Api();
+   if ( window.localStorage ) {
+   storedTargetLanguage = localStorage.getItem( 
'cxTargetLanguage' );
+   storedSourceLanguage = localStorage.getItem( 
'cxSourceLanguage' );
+   }
+
+   return api.get( {
+   action: 'query',
+   list: 'contenttranslationlist',
+   from: storedSourceLanguage || 'en', // FIXME do 
something smart here
+   to: storedTargetLanguage || mw.config.get( 
'wgContentLanguage' ),
+   format: 'json'
+   } );
+   };
+
+   /**
 * Get all the translations of given user.
 *
 * @return {jQuery.Promise}
@@ -64,7 +85,11 @@
response.query.contenttranslation.translations
);
} );
-   // TODO: Get suggestions
+   this.getSuggestionLists().done( function ( response ) {
+   self.renderTranslationSuggestions(
+   
response.query.contenttranslationlist.lists.missingfeaturedarticles
+   );
+   } );
};
 
/**
@@ -84,6 +109,15 @@
);
}
};
+
+   /**
+* Populates various UI components with data in the given translation 
suggestions.
+*/
+   CXDashboard.prototype.renderTranslationSuggestions = function ( 
suggestions ) {
+   this.suggestionList = new mw.cx.CXSuggestionList( 
this.$translationListContainer, suggestions, this.siteMapper );
+   this.suggestionList.init();
+   };
+
/**
 * Populates various UI components with data in the given translations.
 */
@@ -213,11 +247,14 @@
.addClass( 'cx-statusfilter' )
.append(
$( '' )
-   .addClass( 'cx-status cx-status--draft 
cx-status--selected mw-ui-input' )
-   .text( mw.msg( 
'cx-translation-filter-draft-translations' ) ),
+   .addClass( 'cx-status 
cx-status--suggestions mw-ui-input' )
+   .text( 'Suggestions' ),
$( '' )
-   .addClass( 'cx-status cx-status--published 
mw-ui-input' )
-   .text( mw.msg( 
'cx-translation-filter

[MediaWiki-commits] [Gerrit] Refactor the dashboard and translationlist modules - change (mediawiki...ContentTranslation)

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

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

Change subject: Refactor the dashboard and translationlist modules
..

Refactor the dashboard and translationlist modules

Translation list module was handling the rendering and event
handlers of translation status filter and language selectors.
It was also rendering the new translation button.

This commit removes all the above features to the dashboard module.
Translation list is now just a widget to list the translations.

This change is to initiate the listing of suggestion initiated by
dashboard module and provide way for suggestion list to share the
language filters.

Functionality wise nothing changed.

Change-Id: Ie5bbcb3a01dfa0b136ad8fa000ca1f52a7a98878
---
M extension.json
M modules/dashboard/ext.cx.dashboard.js
M modules/dashboard/ext.cx.translationlist.js
M scripts/manage-lists.php
4 files changed, 269 insertions(+), 266 deletions(-)


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

diff --git a/extension.json b/extension.json
index abbb8d1..c1604cf 100644
--- a/extension.json
+++ b/extension.json
@@ -42,6 +42,7 @@
},
"APIListModules": {
"contenttranslation": "ApiQueryContentTranslation",
+   "contenttranslationlist": "ApiQueryContentTranslationList",
"contenttranslationstats": "ApiQueryContentTranslationStats",
"contenttranslationlangtrend": 
"ApiQueryContentTranslationLanguageTrend",
"cxpublishedtranslations": "ApiQueryPublishedTranslations"
@@ -59,6 +60,7 @@
"ApiContentTranslationPublish": 
"api/ApiContentTranslationPublish.php",
"ApiContentTranslationToken": 
"api/ApiContentTranslationToken.php",
"ApiQueryContentTranslation": 
"api/ApiQueryContentTranslation.php",
+   "ApiQueryContentTranslationList": 
"api/ApiQueryContentTranslationList.php",
"ApiQueryContentTranslationLanguageTrend": 
"api/ApiQueryContentTranslationLanguageTrend.php",
"ApiQueryContentTranslationStats": 
"api/ApiQueryContentTranslationStats.php",
"ApiQueryPublishedTranslations": 
"api/ApiQueryPublishedTranslations.php",
@@ -193,6 +195,7 @@
"ext.cx.header",
"ext.cx.model",
"ext.cx.sitemapper",
+   "ext.cx.source.selector",
"ext.cx.translationlist",
"mediawiki.Uri",
"mediawiki.ui.button"
@@ -202,7 +205,13 @@
"cx-dashboard-sidebar-title",
"cx-dashboard-sidebar-information",
"cx-dashboard-sidebar-stats",
-   "cx-dashboard-sidebar-feedback"
+   "cx-dashboard-sidebar-feedback",
+   "cx-create-new-translation",
+   "cx-translation-filter-suggested-translations",
+   "cx-translation-filter-published-translations",
+   "cx-translation-filter-draft-translations",
+   "cx-translation-filter-from-any-language",
+   "cx-translation-filter-to-any-language"
]
},
"ext.cx.magnuslink": {
@@ -741,7 +750,6 @@
],
"dependencies": [
"ext.cx.progressbar",
-   "ext.cx.source.selector",
"ext.cx.util",
"ext.cx.widgets.overlay",
"jquery.uls.data",
@@ -749,12 +757,6 @@
],
"messages": [
"cx-dashboard-header",
-   "cx-create-new-translation",
-   "cx-translation-filter-suggested-translations",
-   "cx-translation-filter-published-translations",
-   "cx-translation-filter-draft-translations",
-   "cx-translation-filter-from-any-language",
-   "cx-translation-filter-to-any-language",
"cx-discard-translation",
"cx-translation-status-draft",
"cx-translation-status-deleted",
diff --git a/modules/dashboard/ext.cx.dashboard.js 
b/modules/dashboard/ext.cx.dashboard.js
index 467da96..ac36202 100644
--- a/modules/dashboard/ext.cx.dashboard.js
+++ b/modules/dashboard/ext.cx.dashboard.js
@@ -20,23 +20,94 @@
this.si

[MediaWiki-commits] [Gerrit] Images: validate image id before adapting to prevent js error - change (mediawiki...ContentTranslation)

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

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

Change subject: Images: validate image id before adapting to prevent js error
..

Images: validate image id before adapting to prevent js error

Images not having an identifier can cause js error and can even
prevent any auto save happening further.

Testplan:
Translate enwiki:Amblydoras to es. Add the last section about
stub article. Console will show a js error and adding any other
secton after this won't trigger autosave. With this patch, there
should not be a js error and save should work as expected.

Change-Id: I18affd6927d391469db9e1c6445fa98a4f760f5c
---
M modules/tools/ext.cx.tools.images.js
1 file changed, 6 insertions(+), 2 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.images.js 
b/modules/tools/ext.cx.tools.images.js
index 08a7190..bb10b82 100644
--- a/modules/tools/ext.cx.tools.images.js
+++ b/modules/tools/ext.cx.tools.images.js
@@ -92,10 +92,14 @@
var targetLanguage = mw.cx.targetLanguage;
 
$section.find( 'img' ).each( function () {
-   var $sourceSection, $sourceImage, $image = $( this );
+   var imageId, $sourceSection, $sourceImage, $image = $( 
this );
 
+   imageId = $image.prop( 'id' );
+   if ( !imageId ) {
+   return;
+   }
$sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
-   $sourceImage = $sourceSection.find( '#' + $image.prop( 
'id' ) );
+   $sourceImage = $sourceSection.find( '#' + imageId );
$image.on( 'click', function ( event ) {
// Avoid opening images by clicking.
event.preventDefault();

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

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

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


[MediaWiki-commits] [Gerrit] Change the id of source title so that its prefix is same as ... - change (mediawiki...ContentTranslation)

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

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

Change subject: Change the id of source title so that its prefix is same as 
parsoid ids
..

Change the id of source title so that its prefix is same as parsoid ids

Recently we moved to parsoid generated Ids and our id validations
changed. But the id of source title did not change accordingly and
it broke the connection between source and target title elements

And then it caused breakage of dynamic alignment of titles

In this patch we keep the id prefix as mw.

Testplan:
Start a translation, In the target title, type some text that is so
long that it cause line break. Observe if the titles of source and
translation aligns dynamically.

Bug: T108524
Change-Id: I02a1af3f2b8d00cb54c099f4c91c335d736d69a0
---
M modules/source/ext.cx.source.js
M modules/translation/ext.cx.translation.js
2 files changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index d7efeea..d0b7d8f 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -107,7 +107,7 @@
 
this.$title = $( '' )
.attr( {
-   id: 'cx-source-title'
+   id: 'mwcx-source-title'
} )
.addClass( 'cx-column__title' )
.text( mw.cx.sourceTitle );
diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 41e5247..fcc2c13 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -59,7 +59,7 @@
 
$heading = $( '' )
.attr( {
-   'data-source': 'cx-source-title',
+   'data-source': 'mwcx-source-title',
contenteditable: true
} )
.addClass( 'cx-column__title' )

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

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

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


[MediaWiki-commits] [Gerrit] Templates: Do not skip adapting inner templates if parent is... - change (mediawiki...ContentTranslation)

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

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

Change subject: Templates: Do not skip adapting inner templates if parent is 
template
..

Templates: Do not skip adapting inner templates if parent is template

We were not adapting templates inside a template. Most of the cases
such complex template adaptation attempts will not succeed. But there
is a where this adaptation can succeed and required for references

This particular case was found while analysing the publishing error
for article Amblydoras from en to es.

Testplan:
Translate Amblydoras from en to es. Start adding sections from top
to bottom. You will see references section added. Try publishing it.
Publishing will pass. This is normal case. Now translate the same
again and start clicking sections from bottom to top. That means,
you are adding references list first and then section containing reference
later. Try publishing. You will get parsoid error. With this patch,
adding sections in any order will not result publishing error.

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


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

diff --git a/modules/tools/ext.cx.tools.template.js 
b/modules/tools/ext.cx.tools.template.js
index 1ac181b..5833b21 100644
--- a/modules/tools/ext.cx.tools.template.js
+++ b/modules/tools/ext.cx.tools.template.js
@@ -213,9 +213,9 @@
 
if ( $section.is( '[typeof*="mw:Transclusion"]' ) ) {
templates.push( $section );
-   } else {
-   templates = $section.find( 
'[typeof*="mw:Transclusion"]' );
}
+   templates.push( $section.find( '[typeof*="mw:Transclusion"]' ) 
);
+
$.each( templates, function () {
var template = new TemplateTool( this );
 

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

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

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


[MediaWiki-commits] [Gerrit] Use .attr() to set the resource attribute of image, while ad... - change (mediawiki...ContentTranslation)

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

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

Change subject: Use .attr() to set the resource attribute of image, while 
adapting
..

Use .attr() to set the resource attribute of image, while adapting

Bug: T108302
Change-Id: Ic427e91928d95502a71e089b58f4c1c1673766e0
---
M modules/tools/ext.cx.tools.images.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.images.js 
b/modules/tools/ext.cx.tools.images.js
index 10c597d..08a7190 100644
--- a/modules/tools/ext.cx.tools.images.js
+++ b/modules/tools/ext.cx.tools.images.js
@@ -113,7 +113,7 @@
if ( resource ) {
resource = resource.replace( 
/(\.\/)*(.+)(:)/g,
'$1' + 
translatedNamespace + '$3' );
-   $image.prop( {
+   $image.attr( {
resource: resource,
id: 'cx' + 
$sourceImage.prop( 'id' )
} );

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

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

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


[MediaWiki-commits] [Gerrit] Enable scrubWikitext=1 in HTML to Wikitext conversion using ... - change (mediawiki...ContentTranslation)

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

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

Change subject: Enable scrubWikitext=1 in HTML to Wikitext conversion using 
parsoid
..

Enable scrubWikitext=1 in HTML to Wikitext conversion using parsoid

This is flag to fix up HTML in ways that results in cleaner wikitext,
not worrying about clean round trip.
CX does not care about round trip since it creates articles, we can
try to generate optimal Wikitext as much as we can.

Change-Id: I0cb7df2f4e3992c468673072d8204ec047586c3a
---
M api/ApiContentTranslationPublish.php
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index 82f2801..f991e11 100755
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -68,6 +68,7 @@
'transform/html/to/wikitext/' . urlencode( 
$title->getPrefixedDBkey() ),
array(
'html' => $html,
+   'scrubWikitext' => 1,
)
);
if ( $wikitext === false ) {

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

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

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


[MediaWiki-commits] [Gerrit] Do not open the links in gallery image caption in same tab - change (mediawiki...ContentTranslation)

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

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

Change subject: Do not open the links in gallery image caption in same tab
..

Do not open the links in gallery image caption in same tab

Bug: T107853
Change-Id: I153ae179dc3cca808811bfd9c612569a316fa974
---
M modules/tools/ext.cx.tools.gallery.js
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.gallery.js 
b/modules/tools/ext.cx.tools.gallery.js
index 89fae3b..5408847 100644
--- a/modules/tools/ext.cx.tools.gallery.js
+++ b/modules/tools/ext.cx.tools.gallery.js
@@ -51,6 +51,8 @@
// 
// Make the images readonly. We can only adapt them. Not 
allowing edits.
$section.find( 'li' ).attr( 'contenteditable', false );
+   // And make the links open in new tab
+   $section.find( 'a' ).attr( 'target', '_blank' );
}
 
$( function () {

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

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

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


[MediaWiki-commits] [Gerrit] FIX: Not able to set cursor in previous sections - change (mediawiki...ContentTranslation)

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

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

Change subject: FIX: Not able to set cursor in previous sections
..

FIX: Not able to set cursor in previous sections

Regression from I3dc3fcbb574cb4c27dcee6d4d867f70e86264feb

Selection restore was happening in wrong place.

Bug: T107990
Change-Id: Id599538cc4b434aac0932d51a7f8d4f69a6d039a
---
M modules/tools/ext.cx.tools.mt.js
1 file changed, 2 insertions(+), 3 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 4aef582..705a382 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -390,9 +390,6 @@
}
// Set the main label
this.$providerSelectorTrigger.text( this.getProviderTitle( 
providerId ) );
-
-   // Restore the selection
-   mw.cx.selection.restore( 'translation' );
};
 
/*
@@ -426,6 +423,8 @@
this.$providersMenu.find( '.card__providers-menu-item' )
.on( 'click', function () {
self.selectProvider( $( this ).data( 'provider' 
) );
+   // Restore the selection
+   mw.cx.selection.restore( 'translation' );
} )
.on( 'mouseenter mouseleave', $.proxy( 
this.toggleSectionHighlight, this ) );
 

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

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

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


[MediaWiki-commits] [Gerrit] Avoid data-cx-draft and CX generated id leaking to published... - change (mediawiki...ContentTranslation)

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

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

Change subject: Avoid data-cx-draft and CX generated id leaking to published 
content
..

Avoid data-cx-draft and CX generated id leaking to published content

Change-Id: I41cedce11bb84b1d2916a35fab732dd549c7c4d4
Followup: I4d050330540567fbe0d5e0c36d0839fb14257d92
---
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/13/229313/1

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 407786b..cf11991 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -377,7 +377,12 @@
}
 
// Remove attributes added by CX
-   $section.removeAttr( 'data-cx-weight data-cx-state 
data-source data-seqid contenteditable' );
+   $section.removeAttr( 'data-cx-weight data-cx-state 
data-source data-seqid data-cx-draft contenteditable' );
+
+   // Remove identifiers added by CX
+   if ( $section.prop( 'id' ).indexOf( 'cx' ) === 0 ) {
+   $section.removeAttr( 'id' );
+   }
} );
 
return $content.html();

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

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

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


[MediaWiki-commits] [Gerrit] Wrong replaceWith causes all spans getting removed - change (mediawiki...ContentTranslation)

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

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

Change subject: Wrong replaceWith causes all spans getting removed
..

Wrong replaceWith causes all spans getting removed

Regression from Ia3b59646403dd7c92aedd68002011c135ed57578

replaceWith function not returning anything while the internal condition fails
causes the spans getting removed unconditionally.

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


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 3362c6e..0703cf0 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -367,10 +367,8 @@
// Browsers add spans with inline styles during free 
editing the content.
// For example, Chrome adds  on enter key press 
and copies current css styles to inline
// styles.
-   $section.find( 'span' ).replaceWith( function () {
-   if ( !!$( this ).attr( 'style' ) ) {
-   return $( this ).html();
-   }
+   $section.find( 'span[style]' ).replaceWith( function () 
{
+   return $( this ).html();
} );
 
// Remove empty sections

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

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

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


[MediaWiki-commits] [Gerrit] Remove CX generated attributes from content to publish - change (mediawiki...ContentTranslation)

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

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

Change subject: Remove CX generated attributes from content to publish
..

Remove CX generated attributes from content to publish

Never leak them to articles.

Testplan:
Translate article: ISO_3166-1 from en to any language. Add the
table in the source article and publish. You will see that the
wikitext of the table as

{| data-cx-weight="11017" data-cx-state="source" data-source="mweg"
class="wikitable sortable" data-seqid="162" id="cxmweg" contenteditable="true"

Which is bad. Now with this patch you should see:

{| class="wikitable sortable"

Change-Id: I4d050330540567fbe0d5e0c36d0839fb14257d92
---
M modules/publish/ext.cx.publish.js
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 3362c6e..058afd8 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -377,6 +377,9 @@
if ( !$.trim( $section.text() ) ) {
$section.remove();
}
+
+   // Remove attributes added by CX
+   $section.removeAttr( 'data-cx-weight data-cx-state 
data-source data-seqid id contenteditable' );
} );
 
return $content.html();

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

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

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


[MediaWiki-commits] [Gerrit] Align the sections based on integer value of section heights - change (mediawiki...ContentTranslation)

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

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

Change subject: Align the sections based on integer value of section heights
..

Align the sections based on integer value of section heights

Arabic wiki has local style override resulting a floating point line
height and font size. This causes our alignment algorithm comparing
floating point heighs and end up with aborting alignment after 10 attempts.

Integer conversion of heights should fix the issue.

Bug: T105938
Change-Id: Ie8384a1e32b5225fa05ee1a4f3d3fb8ae2338ff2
---
M modules/translation/ext.cx.translation.aligner.js
1 file changed, 6 insertions(+), 6 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.aligner.js 
b/modules/translation/ext.cx.translation.aligner.js
index 143beae..6393812 100644
--- a/modules/translation/ext.cx.translation.aligner.js
+++ b/modules/translation/ext.cx.translation.aligner.js
@@ -68,8 +68,8 @@
}
 
$sourceSection.css( 'min-height', '' );
-   sourceSectionHeight = $sourceSection.height();
-   sectionHeight = $section.height();
+   sourceSectionHeight = parseInt( $sourceSection.height(), 10 );
+   sectionHeight = parseInt( $section.height(), 10 );
 
if ( !sourceSectionHeight ) {
return this;
@@ -77,8 +77,8 @@
 
if ( sourceSectionHeight < sectionHeight ) {
$sourceSection.css( 'min-height', sectionHeight );
-   sourceSectionHeight = $sourceSection.height();
-   sectionHeight = $section.height();
+   sourceSectionHeight = parseInt( 
$sourceSection.height(), 10 );
+   sectionHeight = parseInt( $section.height(), 10 );
 
// Fun stuff - setting a calculated min-height will not 
guarantee
// equal height for all kinds of section pairs.
@@ -88,8 +88,8 @@
sectionHeight = sectionHeight + 10;
$sourceSection.css( 'min-height', sectionHeight 
);
$section.css( 'min-height', sectionHeight );
-   sectionHeight = $section.height();
-   sourceSectionHeight = $sourceSection.height();
+   sectionHeight = parseInt( $section.height(), 10 
);
+   sourceSectionHeight = parseInt( 
$sourceSection.height(), 10 );
 
if ( steps++ === 10 ) {
mw.track( 'Alignment attempt is not 
succeeding. Aborting.' );

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

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

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


[MediaWiki-commits] [Gerrit] Remove unwanted tags getting added to published content - change (mediawiki...ContentTranslation)

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

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

Change subject: Remove unwanted  tags getting added to published content
..

Remove unwanted  tags getting added to published content

While editing the content, especially when using enter key press
to break paragraph, and then doing backspace etc, span tags are
created. These spans get inline style attributes too. Clean up them
before publishing

Testplan:
Translate some article. In a paragraph, press enter and then backspace
to cancel the line break. You will notice a new span created and it will
have style attribute. Publish such a translation. There should not be
any spans in published wikitext.

Bug: T90724
Change-Id: Ia3b59646403dd7c92aedd68002011c135ed57578
---
M modules/publish/ext.cx.publish.js
1 file changed, 9 insertions(+), 0 deletions(-)


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 03a17e4..3362c6e 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -364,6 +364,15 @@
return $( this ).html();
} );
 
+   // Browsers add spans with inline styles during free 
editing the content.
+   // For example, Chrome adds  on enter key press 
and copies current css styles to inline
+   // styles.
+   $section.find( 'span' ).replaceWith( function () {
+   if ( !!$( this ).attr( 'style' ) ) {
+   return $( this ).html();
+   }
+   } );
+
// Remove empty sections
if ( !$.trim( $section.text() ) ) {
$section.remove();

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

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

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


[MediaWiki-commits] [Gerrit] Avoid highlight color of CX appearing in published articles - change (mediawiki...ContentTranslation)

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

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

Change subject: Avoid highlight color of CX appearing in published articles
..

Avoid highlight color of CX appearing in published articles

Chrome copies the background-color to inline style while it creates
new spans or divs with enter key presses.
To avoid that we are not using background-color and using just
background style property for cx-highlight class

Bug: T90724
Change-Id: I1640cf53bf399ff3574bfa7b0a758298e8c92b4d
---
M modules/widgets/common/ext.cx.highlight.less
1 file changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/modules/widgets/common/ext.cx.highlight.less 
b/modules/widgets/common/ext.cx.highlight.less
index f339809..94f3b05 100644
--- a/modules/widgets/common/ext.cx.highlight.less
+++ b/modules/widgets/common/ext.cx.highlight.less
@@ -3,7 +3,9 @@
 @connected-link-highlight-color: #D9E6FF;
 
 .cx-highlight {
-   background-color: @text-highlight-color;
+   // Chrome copies the background-color to inline style while it creates 
new spans or divs
+   // with enter key presses. To avoid that we are not using 
background-color
+   background: @text-highlight-color;
box-shadow: 0px 0px 0 2px @text-highlight-color;
border-radius: 2px;
transition: all 0.25s;

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

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

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


[MediaWiki-commits] [Gerrit] MT Card: Refactor the event listeners to listen method - change (mediawiki...ContentTranslation)

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

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

Change subject: MT Card: Refactor the event listeners to listen method
..

MT Card: Refactor the event listeners to listen method

Change-Id: I3dc3fcbb574cb4c27dcee6d4d867f70e86264feb
---
M modules/tools/ext.cx.tools.mt.js
1 file changed, 34 insertions(+), 25 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 9328215..fd8abf1 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -380,6 +380,9 @@
 
// Set the main label
this.$providerSelectorTrigger.text( this.getProviderTitle( 
providerId ) );
+
+   // Restore the selection
+   mw.cx.selection.restore( 'translation' );
};
 
/*
@@ -390,6 +393,8 @@
};
 
MTControlCard.prototype.listen = function () {
+   var self = this;
+
this.actions.$source
.on( 'click', $.proxy( this.useSource, this ) )
.on( 'mouseenter mouseleave', $.proxy( 
this.toggleSectionHighlight, this ) );
@@ -401,11 +406,29 @@
this.actions.$restore
.on( 'click', $.proxy( this.restoreTranslation, this ) )
.on( 'mouseenter mouseleave', $.proxy( 
this.toggleSectionHighlight, this ) );
+
+   this.$providerSelectorTrigger
+   .on( 'click', function ( e ) {
+   self.$providersMenu.toggle();
+   e.stopPropagation();
+   } );
+
+   this.$providersMenu.find( '.card__providers-menu-item' )
+   .on( 'click', function () {
+   self.selectProvider( $( this ).data( 'provider' 
) );
+   } )
+   .on( 'mouseenter mouseleave', $.proxy( 
this.toggleSectionHighlight, this ) );
+
+   // Hide the dropdown on clicking outside of it
+   $( 'html' ).on( 'click', function ( e ) {
+   if ( !e.isDefaultPrevented() ) {
+   self.$providersMenu.hide();
+   }
+   } );
};
 
MTControlCard.prototype.buildProvidersMenu = function () {
-   var provider,
-   cxMtCard = this;
+   var provider;
 
this.$providersMenu = $( '' )
.addClass( 'card__providers-menu' )
@@ -428,19 +451,7 @@
this.getProviderItem( disableMT )
);
 
-   this.$providerSelectorTrigger
-   .on( 'click', function ( e ) {
-   cxMtCard.$providersMenu.toggle();
-   e.stopPropagation();
-   } )
-   .after( this.$providersMenu );
-
-   // Hide the dropdown on clicking outside of it
-   $( 'html' ).on( 'click', function ( e ) {
-   if ( !e.isDefaultPrevented() ) {
-   cxMtCard.$providersMenu.hide();
-   }
-   } );
+   this.$providerSelectorTrigger.after( this.$providersMenu );
};
 
/**
@@ -463,19 +474,17 @@
 
/**
 * Get a menu item for the providers list.
-* @param {string} id Provider id.
+* @param {string} providerId Provider id.
 * @return {jQuery}
 */
-   MTControlCard.prototype.getProviderItem = function ( id ) {
-   var cxMtCard = this;
+   MTControlCard.prototype.getProviderItem = function ( providerId ) {
return $( '' )
-   .text( this.getProviderTitle( id ) )
-   .prop( 'id', providerIdPrefix + id )
-   .on( 'click', function () {
-   cxMtCard.selectProvider( id );
-   mw.cx.selection.restore( 'translation' );
-   } )
-   .on( 'mouseenter mouseleave', $.proxy( 
this.toggleSectionHighlight, this ) );
+   .text( this.getProviderTitle( providerId ) )
+   .addClass( 'card__providers-menu-item' )
+   .attr( {
+   id: providerIdPrefix + providerId,
+   'data-provider': providerId
+   } );
};
 
MTControlCard.prototype.start = function ( $section ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3dc

[MediaWiki-commits] [Gerrit] MT Card: Hightlight the section when hovering action buttons - change (mediawiki...ContentTranslation)

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

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

Change subject: MT Card: Hightlight the section when hovering action buttons
..

MT Card: Hightlight the section when hovering action buttons

This is to indicate that those actions affect that section, potentially
overwrites.

Bug: T106427
Change-Id: I3d33f579de491628ab713ff2378a930ac38dc72d
---
M modules/tools/ext.cx.tools.mt.js
1 file changed, 15 insertions(+), 4 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index b42e4d5..9328215 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -382,15 +382,25 @@
this.$providerSelectorTrigger.text( this.getProviderTitle( 
providerId ) );
};
 
+   /*
+* Toggle the section highlight.
+*/
+   MTControlCard.prototype.toggleSectionHighlight = function () {
+   this.$section.toggleClass( 'cx-highlight' );
+   };
+
MTControlCard.prototype.listen = function () {
this.actions.$source
-   .on( 'click', $.proxy( this.useSource, this ) );
+   .on( 'click', $.proxy( this.useSource, this ) )
+   .on( 'mouseenter mouseleave', $.proxy( 
this.toggleSectionHighlight, this ) );
 
this.actions.$clear
-   .on( 'click', $.proxy( this.clearTranslation, this ) );
+   .on( 'click', $.proxy( this.clearTranslation, this ) )
+   .on( 'mouseenter mouseleave', $.proxy( 
this.toggleSectionHighlight, this ) );
 
this.actions.$restore
-   .on( 'click', $.proxy( this.restoreTranslation, this ) 
);
+   .on( 'click', $.proxy( this.restoreTranslation, this ) )
+   .on( 'mouseenter mouseleave', $.proxy( 
this.toggleSectionHighlight, this ) );
};
 
MTControlCard.prototype.buildProvidersMenu = function () {
@@ -464,7 +474,8 @@
.on( 'click', function () {
cxMtCard.selectProvider( id );
mw.cx.selection.restore( 'translation' );
-   } );
+   } )
+   .on( 'mouseenter mouseleave', $.proxy( 
this.toggleSectionHighlight, this ) );
};
 
MTControlCard.prototype.start = function ( $section ) {

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

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

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


[MediaWiki-commits] [Gerrit] Show a warning when a section with manual changes getting ov... - change (mediawiki...ContentTranslation)

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

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

Change subject: Show a warning when a section with manual changes getting 
overwritten
..

Show a warning when a section with manual changes getting overwritten

Content will get overwritten when using the buttons or menus from
the MT card. Show a warning since it overwrites translators manual
changes. If translator confirm the action, proceed.

We are using a simple native confirmation dialog here for now.
This can be improved with a OOJS widget when we start using them.

Change-Id: Ieb1055a0f5d1bea009599f4879defd5665f261b6
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M modules/tools/ext.cx.tools.mt.js
4 files changed, 22 insertions(+), 8 deletions(-)


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

diff --git a/extension.json b/extension.json
index ea27279..5d5c23a 100644
--- a/extension.json
+++ b/extension.json
@@ -522,7 +522,8 @@
"cx-tools-mt-restore",
"cx-tools-mt-provider-title",
"cx-tools-mt-not-available",
-   "cx-tools-mt-dont-use"
+   "cx-tools-mt-dont-use",
+   "cx-tools-mt-section-overwrite-warning"
],
"dependencies": [
"ext.cx.model",
diff --git a/i18n/en.json b/i18n/en.json
index 142765b..c30e2a1 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -75,6 +75,7 @@
"cx-tools-mt-provider-title": "From $1",
"cx-tools-mt-not-available": "Not available for $1",
"cx-tools-mt-dont-use": "Don't use machine translation",
+   "cx-tools-mt-section-overwrite-warning": "Translation for this section 
will be overwritten.",
"cx-tools-categories-count-message": "{{PLURAL:$1|$1 category|$1 
categories|0=No categories}}",
"cx-stats-title": "Content Translation statistics",
"cx-stats-unknown": "unknown",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 520a025..d3e29e5 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -80,6 +80,7 @@
"cx-tools-mt-provider-title": "An item in a menu in the machine 
translation tool card on Special:ContentTranslation. The menu lists different 
available machine translation providers for this language.\n* $1 is the name of 
the provider, such as Apertium, Microsoft Translator, Google Translate, 
etc.\n{{Identical|From}}",
"cx-tools-mt-not-available": "An item in a menu in the machine 
translation tool card on Special:ContentTranslation. It's shown when there is 
no machine translation provider for that language. $1 is the name of the 
language.",
"cx-tools-mt-dont-use": "An item in a menu in the machine translation 
tool card on Special:ContentTranslation. Other items in same menu will use the 
message {{msg-mw|cx-tools-mt-from-provider}}. Selecting this item disables 
machine translation. It may be the default for some languages.",
+   "cx-tools-mt-section-overwrite-warning": "A warning message shown when 
the current section is about to be overwritten",
"cx-tools-categories-count-message": "Indicates the number of 
categories associated with the page.\n\nDisplayed at the top of source and 
translation columns in [[Special:ContentTranslation]].\n\nParameters:\n* $1 - 
number of categories\n{{Identical|Category}}",
"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}}",
diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index bb08f89..2663859 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -339,8 +339,12 @@
 */
MTControlCard.prototype.useSource = function () {
var sourceId = this.$section.data( 'source' );
-   // Use the source without machine translation
-   mw.hook( 'mw.cx.translation.add' ).fire( sourceId, 'source' );
+   if ( this.$section.attr( 'data-cx-state' ) === 'mt' ||
+   window.confirm( mw.msg( 
'cx-tools-mt-section-overwrite-warning' ) )
+   ) {
+   // Use the source without machine translation
+   mw.hook( 'mw.cx.translation.add' ).fire( sourceId, 
'source' );
+   }
};
 
/**
@@ -350,9 +354,13 @@
 */
MTControlCard.prototype.restoreTranslation = function () {
var sourceId = this.$section.data( 'source' );
-   // Use the source without machine translation
-   mw.hook( 'mw.cx.translation.add' ).fire( sourceId, 'restore' );
-   

[MediaWiki-commits] [Gerrit] Apply selected action on Translation card to the current par... - change (mediawiki...ContentTranslation)

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

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

Change subject: Apply selected action on Translation card to the current 
paragraph too
..

Apply selected action on Translation card to the current paragraph too

Testplan:
Translate a section. Change the translation provider choice using
the MT tool card. The choice should be applied to the current section.

If choice is an MT engine, the current section will have the machine
translation.
If choice is 'Use source', the current section will get copy of source
section.
If the choice is no machine translation, the section will be cleared.

There is a bug about what happens if the section has user's manual translation.
This commit does not change any behavior on that. It just overwrites it as we 
do now.

Bug: T78143
Change-Id: Ief487458de9743a10d99e441bcf06761e6db20ff
---
M modules/tools/ext.cx.tools.mt.js
1 file changed, 12 insertions(+), 2 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index b42e4d5..bb08f89 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -376,8 +376,18 @@
 
// Set the global engine
// TODO This should be saved in a preference or a cookie
-   MTControlCard.provider = providerId;
-
+   if ( MTControlCard.provider !== providerId ) {
+   MTControlCard.provider = providerId;
+   // Apply this choice to the current section.
+   if ( providerId === sourceMT ) {
+   this.useSource();
+   } else if ( providerId === disableMT ) {
+   this.clearTranslation();
+   } else {
+   // Must be an MT engine. Restore.
+   this.restoreTranslation();
+   }
+   }
// Set the main label
this.$providerSelectorTrigger.text( this.getProviderTitle( 
providerId ) );
};

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

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

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


[MediaWiki-commits] [Gerrit] Correct the jsdoc for $.fn.machineTranslate - change (mediawiki...ContentTranslation)

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

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

Change subject: Correct the jsdoc for $.fn.machineTranslate
..

Correct the jsdoc for $.fn.machineTranslate

Change-Id: I1d62339547f97e144e94f5657bc2cf7e2d70
---
M modules/tools/ext.cx.tools.mt.js
1 file changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 78fc16b..b42e4d5 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -230,7 +230,6 @@
 
/**
 * A plugin that performs machine translation on a section element.
-* @param {text} text
 * @return {jQuery}
 */
$.fn.machineTranslate = function () {

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

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

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


[MediaWiki-commits] [Gerrit] Add support for - change (mediawiki...ContentTranslation)

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

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

Change subject: Add support for 
..

Add support for 

Testplan:
Use enwiki Integral article for testing. The first equation in that
page has \int_a^b \! f(x)\,dx
and it should be transferred to target article without any issues.

Bug: T106715
Change-Id: I752b4c72581c599b8602c5ebd8e241ca10d92978
---
M modules/publish/ext.cx.publish.js
M modules/tools/ext.cx.tools.images.js
2 files changed, 11 insertions(+), 4 deletions(-)


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index 03a17e4..d4af0f5 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -365,7 +365,7 @@
} );
 
// Remove empty sections
-   if ( !$.trim( $section.text() ) ) {
+   if ( !$.trim( $section.text() && 
!$section.children().length ) ) {
$section.remove();
}
} );
diff --git a/modules/tools/ext.cx.tools.images.js 
b/modules/tools/ext.cx.tools.images.js
index 14286c9..10c597d 100644
--- a/modules/tools/ext.cx.tools.images.js
+++ b/modules/tools/ext.cx.tools.images.js
@@ -92,13 +92,17 @@
var targetLanguage = mw.cx.targetLanguage;
 
$section.find( 'img' ).each( function () {
-   var $image = $( this );
+   var $sourceSection, $sourceImage, $image = $( this );
 
+   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
+   $sourceImage = $sourceSection.find( '#' + $image.prop( 
'id' ) );
$image.on( 'click', function ( event ) {
// Avoid opening images by clicking.
event.preventDefault();
} );
-
+   // Copy data-mw if any from source image.
+   // Math extension, for example, carry the equation to 
render in its data-mw
+   $image.attr( 'data-mw', $sourceImage.attr( 'data-mw' ) 
);
getImageNamespaceTranslation( targetLanguage )
.done( function ( translatedNamespace ) {
var resource;
@@ -109,7 +113,10 @@
if ( resource ) {
resource = resource.replace( 
/(\.\/)*(.+)(:)/g,
'$1' + 
translatedNamespace + '$3' );
-   $image.attr( 'resource', 
resource );
+   $image.prop( {
+   resource: resource,
+   id: 'cx' + 
$sourceImage.prop( 'id' )
+   } );
// If the image has a parent 
link, correct its link target
$image.parents( 'a' ).attr( 
'href', resource );
}

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

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

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


[MediaWiki-commits] [Gerrit] Corrections for draft restore based on permanent ids - change (mediawiki...ContentTranslation)

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

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

Change subject: Corrections for draft restore based on permanent ids
..

Corrections for draft restore based on permanent ids

* The translation column may not be ready when draft module initilize
  this.$translation because draft module is loaded in parallel with source.
  This can cause, incorrect draft restore. Fixed that.

* Update the data-source attributes correctly in draft restore
  Icc5dff9ba5cf79c599021f2a633024a257b397fb missed to update the data-source
  attributes when sections are restored. This causes progress calculation
  going wrong.

* Updated the tests accordingly

Change-Id: I6406e43cbfef1c83f6f0de7b6fe9874a20f43d60
---
M modules/draft/ext.cx.draft.js
M tests/qunit/draft/ext.cx.draft.test.js
2 files changed, 52 insertions(+), 29 deletions(-)


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

diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index 9424f13..f5881fd 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -19,8 +19,8 @@
this.draftId = draftId;
this.$draft = null;
this.disabled = false;
-   this.$source = $( '.cx-column--source .cx-column__content' );
-   this.$translation = $( '.cx-column--translation 
.cx-column__content' );
+   this.$source = null;
+   this.$translation = null;
this.init();
this.listen();
}
@@ -44,6 +44,9 @@
ContentTranslationDraft.prototype.getContent = function () {
var $content;
 
+   if ( !this.$translation.length ) {
+   this.$translation = $( '.cx-column--translation 
.cx-column__content' );
+   }
$content = this.$translation.clone();
// Remove placeholder sections
$content.find( '.placeholder' ).remove();
@@ -169,11 +172,11 @@
 * @param {jQuery} $section Add it before/after this section.
 * @param {string} afterOrBefore Whether the orphan to be added after 
or before $section.
 */
-   function addOrphanTranslation( $translation, $section, afterOrBefore ) {
+   ContentTranslationDraft.prototype.addOrphanTranslation = function ( 
$translation, $section, afterOrBefore ) {
// Add a dummy source section
var $dummySourceSection = $( '<' + $translation.prop( 'tagName' 
) + '>' )
.css( 'height', 1 ) // Non-zero height to avoid it 
ignored by keepAlignment plugin.
-   .prop( 'id', $translation.data( 'source' ) );
+   .attr( 'id', $translation.data( 'source' ) );
 
if ( afterOrBefore === 'after' ) {
$( '#' + $section.data( 'source' ) ).after( 
$dummySourceSection );
@@ -184,26 +187,39 @@
}
// Annotate the section to indicate it was restored from draft
// so that certain adaptations can be skipped.
-   $translation.attr( 'data-cx-draft', true ).keepAlignment();
+   $translation.attr( {
+   'data-cx-draft': true,
+   'data-source': $dummySourceSection.prop( 'id' )
+   } ).keepAlignment();
mw.hook( 'mw.cx.translation.postMT' ).fire( $translation );
-   }
+   };
 
/**
 * Restore this draft to the appropriate placeholders
 */
ContentTranslationDraft.prototype.restore = function () {
-   var i, j, $draftSection, sectionId, $section,
+   var i, j, $draftSection, sectionId, $section, $sourceSection,
$placeholderSection, orphans = [],
$lastPlaceholder;
 
+   // We cannot populate this early because this ext.cx.draft 
modules may be loaded before
+   // source and target is ready.
+   if ( !this.$source.length ) {
+   this.$source = $( '.cx-column--source 
.cx-column__content' );
+   }
+   if ( !this.$translation.length ) {
+   this.$translation = $( '.cx-column--translation 
.cx-column__content' );
+   }
for ( i = 0; i < this.$draft.length; i++ ) {
$draftSection = $( this.$draft[ i ] );
sectionId = $draftSection.prop( 'id' );
$placeholderSection = this.$translation.find( '#' + 
sectionId );
+   $sourceSection = this.$source.find( '#' + 
$placeholderSection.data( 'source' ) );
if ( !$placeholderSection.length ) {
// Support old sections with sequential 
idendifiers
+ 

[MediaWiki-commits] [Gerrit] Improve reference adaptation to avoid parsoid errors - change (mediawiki...ContentTranslation)

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

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

Change subject: Improve reference adaptation to avoid parsoid errors
..

Improve reference adaptation to avoid parsoid errors

The current reference adaptation does not guarantee that the adapted
reference has valid data-mw attribute. Parsoid demands a valid id
in data-mw.body pointing to an item in references section. Not having
that cause parsoid errors during  HTML to wikitext conversion. It does not
cause parsoid to fail, but generated articles with errors as shown in
Bug T107252.

This patch improves and cleans up the parsoid adaptation process.
And it make sure a valid data-mw is present in the adapted reference.

Testplan:
Translate Vaporwave article from English to Spanish. Use MT for all
sections and publish. The published page should not have any errors about
references. Compare it with 
https://es.wikipedia.org/w/index.php?title=Vaporwave&oldid=84053572

Make sure reference card is working for all references and adding reference at
cursor position also works.
Repeat the test for translating Attack & Release article from en to es
and compare result with 
https://es.wikipedia.org/w/index.php?title=Attack_%26_Release&oldid=84052884

Bug: T107252
Change-Id: I0ab01b682a54ac3a96a52068740af85964e99807
---
M modules/tools/ext.cx.tools.reference.js
1 file changed, 43 insertions(+), 55 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index 901eb94..2169885 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -128,7 +128,7 @@
 * See https://phabricator.wikimedia.org/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.
+* @return {string|null} The HTML content of the reference.
 */
ReferenceCard.prototype.getReferenceContent = function ( referenceId ) {
var reference, referenceContentElement;
@@ -138,7 +138,7 @@
return null;
}
// Support traditional reference handling by Parsoid
-   if ( reference.body.html ) {
+   if ( reference.body && reference.body.html ) {
return reference.body.html;
}
 
@@ -226,28 +226,11 @@
/**
 * For the given reference id, get the reference data
 *
-* This is very easy in the cases one reference used only once in the 
page.
-* Such a reference link will have data-mw carrying the data.
-*
-* But when the same reference used in multiple places, this is tricky.
-* The page will have the following markup(example) at the end of page, 
saying all these 3
-* references are same. One of these links will have reference data. 
Not necessarily
-* first one. So we have to iterate through all these siblings and find 
which one has
-* reference data.
-*
-* Example from Antipasto article from eswiki:
-* 
-* ↑
-* 1.0
-* 1.1
-* 1.2
-* 
-* 
 * @param {string} referenceId
 * @return {Object|null}
 */
ReferenceCard.prototype.getReferenceData = function ( referenceId ) {
-   var $sourceReference, i, mwData, $sibling, $referenceSiblings, 
id;
+   var $sourceReference;
 
$sourceReference = $( document.getElementById( referenceId ) );
if ( !$sourceReference.is( '[typeof*="mw:Extension/ref"]' ) ) {
@@ -255,22 +238,7 @@
return null;
}
 
-   $referenceSiblings = $( '[typeof*="mw:Extension/references"]' )
-   .find( 'a[href="#' + referenceId + '"]' )
-   .siblings()
-   .addBack(); // Including self
-
-   for ( i = 0; i < $referenceSiblings.length; i++ ) {
-   id = $( $referenceSiblings[ i ] ).attr( 'href' 
).replace( '#', '' );
-   $sibling = $( document.getElementById( id ) );
-   mwData = $sibling.data( 'mw' );
-   if ( mwData && mwData.body ) {
-   return mwData;
-   }
-   }
-
-   // Did not see a case where we still not find reference data, 
but...
-   return null;
+   return $sourceReference.data( 'mw' );
};
 
/**
@@ -278,36 +246,56 @@
 * See 
https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Ref_and_References
  

[MediaWiki-commits] [Gerrit] Do not show the article selector unless all params passed in... - change (mediawiki...ContentTranslation)

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

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

Change subject: Do not show the article selector unless all params passed in URL
..

Do not show the article selector unless all params passed in URL

It seems showing this dialog even with partially fillted params(
for example, contribution menu entry point fills the target lang param)
creates confusion to users and they re-type title and end up in creating
a fresh translation that overwrites an in-progress translation

Bug: T104702
Change-Id: Iff73f4bedbb1038d70ca26e087550ddb64261220
---
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/43/227643/1

diff --git a/modules/source/ext.cx.source.selector.js 
b/modules/source/ext.cx.source.selector.js
index f32d532..74fc172 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 any of the values are already present,
+   // If all 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/227643
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

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

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


[MediaWiki-commits] [Gerrit] Lineardoc: Fix the reference parsing - change (mediawiki...cxserver)

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

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

Change subject: Lineardoc: Fix the reference parsing
..

Lineardoc: Fix the reference parsing

Parsoid started to output references in the following format:


[4]



And, our lineardoc started to wrongly output the content as



[4]




The extra  tag is problematic and causes references appearing twice
in CX translation interface.

The extra  was a regression introduced in 
I4cca925cb35a00fa27fd31380fae90e1c4c2767f,
it's test had to correct too.

While processing inline annotation tags like above, we were skipping the 
internal
inline empty spans and that was fixed in 
I4cca925cb35a00fa27fd31380fae90e1c4c2767f

But, when we started processing the internal annotations, we were inserting
a new inline content when there is non-whitespace content. But that caused
inserting inline content in unwanted situations too. The above example shows an
 tag inserted in that way. Making the conditions for this insertion a bit 
more
stricter found working. We are checking if those inline annotations are having
any of data-mw, data-parsoid attributes. Eventhough I am not 100% sure that is
the correct solution to meet any future changes like this.

Added tests with new reference structure. The parsoid DOM spec
https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Ref_and_References
does not seem to reflect this change.

Bug: T107140
Change-Id: I68bd92ecf4190f62db9b715f66f63cfada3aea57
---
M lineardoc/Builder.js
M tests/lineardoc/LinearDoc.test.js
M tests/lineardoc/data/test3-result.xhtml
M tests/lineardoc/data/test3-result.xml
A tests/lineardoc/data/test4-result.xhtml
A tests/lineardoc/data/test4-result.xml
A tests/lineardoc/data/test4.xhtml
7 files changed, 21 insertions(+), 9 deletions(-)


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

diff --git a/lineardoc/Builder.js b/lineardoc/Builder.js
index 8874681..fe33c12 100644
--- a/lineardoc/Builder.js
+++ b/lineardoc/Builder.js
@@ -83,7 +83,7 @@
}
whitespace.push( textChunk.text );
}
-   if ( replace ) {
+   if ( replace && ( tag.attributes[ 'data-mw' ] ||  tag.attributes[ 
'data-parsoid' ]  ) ) {
// truncate list and add data span as new sub-Doc.
this.textChunks.length = i + 1;
whitespace.reverse();
diff --git a/tests/lineardoc/LinearDoc.test.js 
b/tests/lineardoc/LinearDoc.test.js
index 13a1007..98e4f41 100644
--- a/tests/lineardoc/LinearDoc.test.js
+++ b/tests/lineardoc/LinearDoc.test.js
@@ -6,7 +6,7 @@
 QUnit.test( 'LinearDoc tests', function ( assert ) {
var parser, testXhtmlFile, resultXmlFile, resultXhtmlFile, testXhtml, 
resultXml,
resultXhtml, i,
-   numTests = 3;
+   numTests = 4;
QUnit.expect( 2 * numTests );
for ( i = 1; i <= numTests; i++ ) {
testXhtmlFile = __dirname + '/data/test' + i + '.xhtml';
diff --git a/tests/lineardoc/data/test3-result.xhtml 
b/tests/lineardoc/data/test3-result.xhtml
index d6ac7fa..ae458bc 100644
--- a/tests/lineardoc/data/test3-result.xhtml
+++ b/tests/lineardoc/data/test3-result.xhtml
@@ -6,7 +6,7 @@
 
 
 
-↑ 

+↑ 

 http://lhermanto-resepkeluarga.blogspot.com/2008/04/telor-bumbu-bali-bali-seasoning.html";
 rel="mw:ExtLink">
 
 
diff --git a/tests/lineardoc/data/test3-result.xml 
b/tests/lineardoc/data/test3-result.xml
index f0bc5b3..92c83e4 100644
--- a/tests/lineardoc/data/test3-result.xml
+++ b/tests/lineardoc/data/test3-result.xml
@@ -27,12 +27,6 @@
 
   

   ↑ 
-  
-
-
-
-
-  
   

   
 
diff --git a/tests/lineardoc/data/test4-result.xhtml 
b/tests/lineardoc/data/test4-result.xhtml
new file mode 100644
index 000..c2ecf48
--- /dev/null
+++ b/tests/lineardoc/data/test4-result.xhtml
@@ -0,0 +1,2 @@
+[4]
diff --git a/tests/lineardoc/data/test4-result.xml 
b/tests/lineardoc/data/test4-result.xml
new file mode 100644
index 000..1f825b3
--- /dev/null
+++ b/tests/lineardoc/data/test4-result.xml
@@ -0,0 +1,11 @@
+
+
+  
+
+
+  [4]
+
+
+  
+
+
diff --git a/tests/lineardoc/data/test4.xhtml b/tests/lineardoc/data/test4.xhtml
new file mode 100644
index 000..951e145
--- /dev/null
+++ b/tests/lineardoc/data/test4.xhtml
@@ -0,0 +1,5 @@
+[4]

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I68bd92ecf4190f62db9b715f66f63cfada3aea57
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

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


[MediaWiki-commits] [Gerrit] Provide useful error details when publishing fails - change (mediawiki...ContentTranslation)

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

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

Change subject: Provide useful error details when publishing fails
..

Provide useful error details when publishing fails

From our logs, we see 4 main reasons for publishing failures.
1. Timeout. Related to network.
2. spamblacklist catching URLs in translation
3. User blocked from editing. Now we are not providing Special:CX at all for 
this
   category of users
4. Parsoid failed to convert the HTML to wikitext.

For all of these provide a brief hint in publishing error message.

Bug: T100498
Change-Id: Ia96ec15a4d44c7c1403542bdd1e25660984fad8b
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M modules/publish/ext.cx.publish.js
4 files changed, 20 insertions(+), 6 deletions(-)


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

diff --git a/extension.json b/extension.json
index c20fdb5..ea27279 100644
--- a/extension.json
+++ b/extension.json
@@ -631,7 +631,8 @@
"cx-publish-page-success",
"cx-publish-page-error",
"cx-publish-button-publishing",
-   "cx-publish-captcha-title"
+   "cx-publish-captcha-title",
+   "unknown-error"
]
},
"ext.cx.wikibase.link": {
diff --git a/i18n/en.json b/i18n/en.json
index a965998..304ce59 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -28,7 +28,7 @@
"cx-header-all-translations": "All translations",
"cx-source-view-page": "view page",
"cx-publish-page-success": "Page published at $1",
-   "cx-publish-page-error": "An error occurred while saving the page. 
Please try to publish the page again.",
+   "cx-publish-page-error": "An error occurred while publishing the 
translation. Please try to publish the page again. Error: $1",
"cx-publish-button": "Publish translation",
"cx-publish-button-publishing": "Publishing...",
"cx-publish-summary": "Created by translating the page \"$1\"",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 2a2ded0..049b7b1 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -33,7 +33,7 @@
"cx-header-all-translations": "A link at the top of the translation 
interface to the main Special:ContentTranslation page that lists all 
translations by the user.\n{{Identical|All translations}}",
"cx-source-view-page": "A link that points to the source page under the 
heading of the source column.\n{{Identical|View page}}",
"cx-publish-page-success": "Message shown when page is published 
successfully. Parameters:\n* $1 - Link to the published page",
-   "cx-publish-page-error": "Error message to display when page saving 
fails.",
+   "cx-publish-page-error": "Error message to display when page saving 
fails.\n* $1 - Error details",
"cx-publish-button": "Publish button text in 
[[Special:ContentTranslation]].\n\nAlso used in 
{{msg-mw|Cx-tools-instructions-text6}}.",
"cx-publish-button-publishing": "Publish button text in 
[[Special:ContentTranslation]], shown while publishing is in progress. Replaces 
{{msg-mw|cx-publish-button}}.\n{{Identical|Publishing}}",
"cx-publish-summary": "This is an automatic edit summary for pages that 
were created by [[Special:ContentTranslation]].\n\nParameters:\n* $1 - the 
source page name",
diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index b658e28..de38895 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -289,7 +289,8 @@
 * @param {object} details
 */
CXPublish.prototype.onFail = function ( code, details ) {
-   var trace = {
+   var trace, error;
+   trace = {
sourceLanguage: mw.cx.sourceLanguage,
targetLanguage: mw.cx.targetLanguage,
sourceTitle: mw.cx.sourceTitle,
@@ -305,8 +306,20 @@
this.targetTitle,
JSON.stringify( details )
);
-
-   mw.hook( 'mw.cx.error' ).fire( mw.msg( 'cx-publish-page-error' 
) );
+   // Try providing useful error information.
+   error = mw.msg( 'unknown-error' );
+   if ( details.error && details.error.info ) {
+   // 
{"servedby":"mw","error":{"code":"blocked","info":"You have been blocked 
from editing",
+   // "*":"See ..
+   error = details.error.info;
+   } else if ( details.edit ) {
+   // 
{"result":"error","edit":{"spamblacklist":"facebook.com","result":"Failure"}}
+   error = JSON.stringify( details.edit )

[MediaWiki-commits] [Gerrit] Publish: Enable the publish button after a publish fail to r... - change (mediawiki...ContentTranslation)

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

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

Change subject: Publish: Enable the publish button after a publish fail to retry
..

Publish: Enable the publish button after a publish fail to retry

When publishing error happens, the publish button is disabled.
This behavior is not correct since the error message says:
"Publishing failed, please retry". To retry publishing, the button
should be enabled.

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


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

diff --git a/modules/publish/ext.cx.publish.js 
b/modules/publish/ext.cx.publish.js
index e8305bd..e85f3e2 100644
--- a/modules/publish/ext.cx.publish.js
+++ b/modules/publish/ext.cx.publish.js
@@ -70,8 +70,6 @@
self.onFail( 'cxpublish', response.cxpublish );
} ).fail( function ( code, details ) {
self.onFail( code, details );
-   } ).always( function () {
-   self.$trigger.prop( 'disabled', true ).text( 
mw.msg( 'cx-publish-button' ) );
} );
} );
};
@@ -307,6 +305,8 @@
 
mw.hook( 'mw.cx.error' ).fire( mw.msg( 'cx-publish-page-error' 
) );
mw.log( '[CX] Error while publishing:', code, trace );
+   // Enable the publish button for retry
+   this.$trigger.prop( 'disabled', false ).text( mw.msg( 
'cx-publish-button' ) );
};
 
/**

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

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

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


[MediaWiki-commits] [Gerrit] Increase line-height for source and translation content to 1... - change (mediawiki...ContentTranslation)

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

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

Change subject: Increase line-height for source and translation content to 1.5em
..

Increase line-height for source and translation content to 1.5em

Applying general typography guidelines for better readability.
Resulting font-size: 16px, line-height: 24px.

Change-Id: Ia1bef3c54737102f872c87e69250d2276b104d54
---
M modules/translationview/styles/ext.cx.translationview.less
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/modules/translationview/styles/ext.cx.translationview.less 
b/modules/translationview/styles/ext.cx.translationview.less
index 8b8e823..f897abf 100644
--- a/modules/translationview/styles/ext.cx.translationview.less
+++ b/modules/translationview/styles/ext.cx.translationview.less
@@ -65,6 +65,7 @@
}
 
.cx-column__content {
+   line-height: 1.5em;
clear: both;
word-wrap: break-word;
position: relative;

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

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

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


[MediaWiki-commits] [Gerrit] Reduce the code duplication in applyTranslationTemplate method - change (mediawiki...ContentTranslation)

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

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

Change subject: Reduce the code duplication in applyTranslationTemplate method
..

Reduce the code duplication in applyTranslationTemplate method

Change-Id: If38aa7cf381cb72a136a038724d29bf38e7b6fd4
---
M modules/translation/ext.cx.translation.js
1 file changed, 11 insertions(+), 22 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index f7081ea..c4365b6 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -265,39 +265,28 @@
'data-cx-state': 'source'
} );
 
-   if ( origin === 'mt-user-disabled' ) {
+   if ( origin === 'mt-user-disabled' || origin === 
'clear' ) {
$clone.attr( 'data-cx-state', 'empty' );
-   if ( $sourceSection.prop( 'tagName' ) === 
'FIGURE' ) {
-   // Clear figure caption alone.
-   $clone.find( 'figcaption' ).empty();
+   if ( $sourceSection.is( 'figure' ) ) {
+   if ( origin === 'clear' ) {
+   // When clearing figures, 
replace it with placeholder.
+   $clone = getPlaceholder( 
sourceId ).attr( 'data-cx-section-type', 'figure' );
+   } else {
+   // Clear figure caption alone.
+   $clone.find( 'figcaption' 
).empty();
+   }
} else if ( $sourceSection.is( 'ul, ol' ) ) {
$clone = $sourceSection.clone();
// Explicit contenteditable attribute 
helps to place the cursor
-   // in empty UL.
+   // in empty  or .
$clone.prop( 'contenteditable', true 
).find( 'li' ).empty();
} else {
$clone.empty();
}
}
-
-   if ( origin === 'clear' ) {
-   $clone.attr( 'data-cx-state', 'empty' );
-   if ( $sourceSection.prop( 'tagName' ) === 
'FIGURE' ) {
-   // When clearing figures, replace it 
with placeholder.
-   $clone = getPlaceholder( sourceId )
-   .attr( 'data-cx-section-type', 
$sourceSection.prop( 'tagName' ) );
-   } else if ( $sourceSection.is( 'ul, ol' ) ) {
-   $clone = $sourceSection.clone();
-   // Explicit contenteditable attribute 
helps to place the cursor
-   // in empty UL.
-   $clone.prop( 'contenteditable', true 
).find( 'li' ).empty();
-   } else {
-   $clone.empty();
-   }
-   } // else: service-failure, non-editable, 
mt-not-available
+   // else: service-failure, non-editable, mt-not-available
// Replace the placeholder with a translatable element
$section.replaceWith( $clone );
-
// $section was replaced. Get the updated instance.
$section = mw.cx.getTranslationSection( sourceId );
mw.hook( 'mw.cx.translation.postMT' ).fire( $section );

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

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

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


[MediaWiki-commits] [Gerrit] Allow placing cursor inside empty list when translating from... - change (mediawiki...ContentTranslation)

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

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

Change subject: Allow placing cursor inside empty list when translating from 
scratch
..

Allow placing cursor inside empty list when translating from scratch

Testplan:
Translate any page with list. Translate such a section, clear it using
"Clear paragraph", try typing to the list items. You should be able
to type there.

Alternatively, try language pairs with different directionality or
choose 'Disable machine translation'

There is some code duplication in the place the fix was made.
Deferred to another commit.

Bug: T103504
Change-Id: I52a26d67aef2e8e248565fb7f8ccc3b0b36d6571
---
M modules/translation/ext.cx.translation.js
1 file changed, 10 insertions(+), 0 deletions(-)


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

diff --git a/modules/translation/ext.cx.translation.js 
b/modules/translation/ext.cx.translation.js
index 45ffb35..3a7cf69 100644
--- a/modules/translation/ext.cx.translation.js
+++ b/modules/translation/ext.cx.translation.js
@@ -270,6 +270,11 @@
if ( $sourceSection.prop( 'tagName' ) === 
'FIGURE' ) {
// Clear figure caption alone.
$clone.find( 'figcaption' ).empty();
+   } else if ( $sourceSection.prop( 'tagName' ) 
=== 'UL' ) {
+   $clone = $sourceSection.clone();
+   // Explicit contenteditable attribute 
helps to place the cursor
+   // in empty UL.
+   $clone.prop( 'contenteditable', true 
).find( 'li' ).empty();
} else {
$clone.empty();
}
@@ -281,6 +286,11 @@
// When clearing figures, replace it 
with placeholder.
$clone = getPlaceholder( sourceId )
.attr( 'data-cx-section-type', 
$sourceSection.prop( 'tagName' ) );
+   } else if ( $sourceSection.prop( 'tagName' ) 
=== 'UL' ) {
+   $clone = $sourceSection.clone();
+   // Explicit contenteditable attribute 
helps to place the cursor
+   // in empty UL.
+   $clone.prop( 'contenteditable', true 
).find( 'li' ).empty();
} else {
$clone.empty();
}

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

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

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


[MediaWiki-commits] [Gerrit] Avoid providing Special:CX for blocked users - change (mediawiki...ContentTranslation)

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

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

Change subject: Avoid providing Special:CX for blocked users
..

Avoid providing Special:CX for blocked users

We have this check at publishing stage, but that is late and wastes
users time.

Bug: T100498
Change-Id: Ib6cdcc2e5f6e7fc631e5ff7d1d3a4f812f5fa6a6
---
M ContentTranslation.hooks.php
1 file changed, 4 insertions(+), 0 deletions(-)


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

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 1454ec2..f73edd2 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -25,6 +25,10 @@
return false;
}
 
+   if ( $user->isBlocked() ) {
+   return false;
+   }
+
if ( !$wgContentTranslationAsBetaFeature ) {
return true;
}

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

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

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


[MediaWiki-commits] [Gerrit] Allow to add a link by pressing enter from the link inspector - change (mediawiki...ContentTranslation)

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

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

Change subject: Allow to add a link by pressing enter from the link inspector
..

Allow to add a link by pressing enter from the link inspector

When a page is selected to be added as a link, the user needs to
press a button to complete the link creation.
Allow to trigger that action by pressing enter too for keyboard-only users.

Bug: T106441
Change-Id: I1f6e1dfb89814697043df8cd3415d80578bee4f9
---
M modules/tools/ext.cx.tools.link.js
M modules/widgets/pageselector/ext.cx.pageselector.js
2 files changed, 11 insertions(+), 2 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index edcaa43..54f457a 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -912,6 +912,7 @@
 * @return {jQuery}
 */
LinkerTool.prototype.getCard = function () {
+   var self = this;
this.$pageSelectorButton = $( '' )
.prop( 'disabled', true )
.addClass( 'mw-ui-button mw-ui-progressive' )
@@ -948,7 +949,10 @@
 
this.$targetPageSelector = new mw.PageSelector( 
this.$searchInput, {
api: mw.cx.siteMapper.getApi( mw.cx.targetLanguage ),
-   showMissingPage: true
+   showMissingPage: true,
+   onSelect: function ( selectedPage ) {
+   self.createLink( selectedPage, 'internal' );
+   }
} );
 
return this.$card;
diff --git a/modules/widgets/pageselector/ext.cx.pageselector.js 
b/modules/widgets/pageselector/ext.cx.pageselector.js
index 6821140..ef70272 100644
--- a/modules/widgets/pageselector/ext.cx.pageselector.js
+++ b/modules/widgets/pageselector/ext.cx.pageselector.js
@@ -244,6 +244,9 @@
if ( event.keyCode === 13 ) {
// Enter key handler
self.hide();
+   if ( self.options.onSelect ) {
+   self.options.onSelect.call( self, 
self.getSelectedPage() );
+   }
return false;
}
} );
@@ -257,6 +260,8 @@
// Example: mw.Api( { ajax: { url: apiURL } } )
api: new mw.Api(),
// Show a missing page if search did not return any page.
-   showMissingPage: false
+   showMissingPage: false,
+   // Callback when a page is selected
+   onSelect: null
};
 }( jQuery, mediaWiki ) );

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

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

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


[MediaWiki-commits] [Gerrit] When link target changed, reset the style classes - change (mediawiki...ContentTranslation)

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

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

Change subject: When link target changed, reset the style classes
..

When link target changed, reset the style classes

When the link inspector is used on a red link or a red link to create
a regular link, it is expected for the resulting link to become blue.
Currently, the link remains red or grey (as it was before) which is confusing.

Bug: T106437
Change-Id: Id86d4f154b1fbbbd9c411f24fadc7a7356a8f7fa
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index edcaa43..602d3b8 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -970,6 +970,8 @@
href: target.title,
title: target.title
} )
+   // Remove the classes that represent a 
different state for link.
+   .removeClass( 'cx-selection 
cx-highlight--blue new cx-target-link-unadapted' )
.removeData( 'cxTargetLink' ) // Unbind
.cxTargetLink();
} else {

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

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

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


[MediaWiki-commits] [Gerrit] Fix: Creating an external link with no text selected results... - change (mediawiki...ContentTranslation)

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

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

Change subject: Fix: Creating an external link with no text selected results 
link label as "null"
..

Fix: Creating an external link with no text selected results link label as 
"null"

Testplan:
Without selecting any text, use link tool to add an external link. Once URL
entered, press enter. The link should be inserted at cursor position, with
label as link URL. Link label should not be null.

Bug: T106521
Change-Id: Ie904fb6f1b8b952a38eb7926d1d72c4cf428728e
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index edcaa43..2754565 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -1048,7 +1048,10 @@
self.$pageSelectorButton.prop( 'disabled', false );
} ).on( 'keypress', function ( e ) {
if ( e.which === 13 ) {
-   self.createLink( 
self.$targetPageSelector.getSelectedPage(), 'external' );
+   if ( linkType === 'external' ) {
+   self.createLink( 
self.$externalLinkInput.val(), linkType );
+   }
+   // TODO: Add internal link also on enter 
keypress.
}
} );
this.$internalLink.on( 'click', function () {

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

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

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


[MediaWiki-commits] [Gerrit] Allow to scroll suggested lists of links in the link inspector - change (mediawiki...ContentTranslation)

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

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

Change subject: Allow to scroll suggested lists of links in the link inspector
..

Allow to scroll suggested lists of links in the link inspector

Set max-height for page selector menu and make it scrollable.

Bug: T106530
Change-Id: I3d4ed5befb40d03dc2996f91050e7332dc8c39d6
---
M modules/widgets/pageselector/ext.cx.pageselector.less
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/widgets/pageselector/ext.cx.pageselector.less 
b/modules/widgets/pageselector/ext.cx.pageselector.less
index 3a2ca14..c98957f 100644
--- a/modules/widgets/pageselector/ext.cx.pageselector.less
+++ b/modules/widgets/pageselector/ext.cx.pageselector.less
@@ -11,6 +11,8 @@
// Show it on top of others
z-index: ;
max-width: 30%;
+   max-height: 300px;
+   overflow-y: auto;
 
&> li {
border-bottom: 1px solid #eee;

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

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

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


[MediaWiki-commits] [Gerrit] Don't swap link cards when opening the link of the card behind - change (mediawiki...ContentTranslation)

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

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

Change subject: Don't swap link cards when opening the link of the card behind
..

Don't swap link cards when opening the link of the card behind

Link cards are presented usually in pairs. Although the card in front
represents the main action (add/remove link in the translation),
it is possible to explore the card behind by either hovering
(the card behind is temporary revealed allowing to click on the link
to open it) or clicking on the card (cards switch positions).
The problem is that when the link from the card behind it is opened,
the click event propagates to the whole card and the cards are also swapped.
Cards should be only swapped when clicking on the card behind except when 
clicking on the link.

Bug: T106595
Change-Id: I0873eb77b082c06004718a6e7b737d1a9fa97062
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 5 insertions(+), 2 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index edcaa43..35152b6 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -797,8 +797,11 @@
var self = this;
 
// Bring the card to front when clicked
-   this.$card.on( 'click', '.card:first', function () {
-   $( this ).insertAfter( self.$card.find( '.card:last' ) 
);
+   this.$card.on( 'click', '.card:first', function ( e ) {
+   if ( !$( e.target ).is( 'a' ) ) {
+   // We should not swap the cards when click was 
on the link in the card.
+   $( this ).insertAfter( self.$card.find( 
'.card:last' ) );
+   }
} );
};
 

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

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

___
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-07-26 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

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

Change subject: Fix JSCS errors
..

Fix JSCS errors

Change-Id: I741f327203b91bc20a94578ff4308ea8371431af
---
M modules/dashboard/ext.cx.translationlist.js
M modules/tools/ext.cx.tools.mt.js
2 files changed, 8 insertions(+), 4 deletions(-)


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

diff --git a/modules/dashboard/ext.cx.translationlist.js 
b/modules/dashboard/ext.cx.translationlist.js
index 5eb9337..9ed86d1 100644
--- a/modules/dashboard/ext.cx.translationlist.js
+++ b/modules/dashboard/ext.cx.translationlist.js
@@ -210,7 +210,7 @@
$( '' )
.prop( {
lang: 
translation.targetLanguage,
-   dir: targetDir,
+   dir: targetDir
} )
.addClass( 'target-title' )
.text( translation.targetTitle )
diff --git a/modules/tools/ext.cx.tools.mt.js b/modules/tools/ext.cx.tools.mt.js
index 6773c10..78fc16b 100644
--- a/modules/tools/ext.cx.tools.mt.js
+++ b/modules/tools/ext.cx.tools.mt.js
@@ -46,8 +46,10 @@
}
 
// (Re-)fetch cxserver token
-   cxserverToken.promise = (new mw.Api())
-   .postWithToken( 'edit', { action: 'cxtoken' } )
+   cxserverToken.promise = ( new mw.Api() )
+   .postWithToken( 'edit', {
+   action: 'cxtoken'
+   } )
.always( function () {
cxserverToken.promise = undefined;
} )
@@ -136,7 +138,9 @@
type: 'post',
url: mtURL,
data: sourceHtml,
-   headers: { Authorization: token }
+   headers: {
+   Authorization: token
+   }
} ).then( null, function () {
return $.Deferred().reject( 'service-failure', 
arguments ).promise();
} );

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

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

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


[MediaWiki-commits] [Gerrit] Dashboard: Use the available horizontal space for titles - change (mediawiki...ContentTranslation)

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

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

Change subject: Dashboard: Use the available horizontal space for titles
..

Dashboard: Use the available horizontal space for titles

Made it to use 80% instead of 50%.
See https://www.mediawiki.org/wiki/Topic:Slic5k7ei5a8p76n

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


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

diff --git a/modules/dashboard/styles/ext.cx.translationlist.less 
b/modules/dashboard/styles/ext.cx.translationlist.less
index b346395..56d856b 100644
--- a/modules/dashboard/styles/ext.cx.translationlist.less
+++ b/modules/dashboard/styles/ext.cx.translationlist.less
@@ -129,7 +129,7 @@
}
 
.cx-tlitem__details {
-   .mw-ui-one-half;
+   .mw-ui-four-fifths;
 
position: relative;
height: 100px;

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

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

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


[MediaWiki-commits] [Gerrit] Reduce the z-index of callout to a reasonable level - change (mediawiki...ContentTranslation)

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

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

Change subject: Reduce the z-index of callout to a reasonable level
..

Reduce the z-index of callout to a reasonable level

It had a huge z-index causing IME selector hidden under it.

Bug: T105954
Change-Id: I78a206c449309237efa04889dbdef536b8af3b2a
---
M modules/widgets/callout/ext.cx.callout.css
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/widgets/callout/ext.cx.callout.css 
b/modules/widgets/callout/ext.cx.callout.css
index 9fbf067..0531b32 100644
--- a/modules/widgets/callout/ext.cx.callout.css
+++ b/modules/widgets/callout/ext.cx.callout.css
@@ -7,7 +7,7 @@
border: 1px solid #ccc;
border-radius: 3px;
max-width: 500px;
-   z-index: 10;
+   z-index: 999;
 }
 
 .cx-callout::after, .cx-callout::before  {

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

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

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


[MediaWiki-commits] [Gerrit] Contribution hover menu icon and layout adjustments - change (mediawiki...ContentTranslation)

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

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

Change subject: Contribution hover menu icon and layout adjustments
..

Contribution hover menu icon and layout adjustments

* Icons are verically centered
* Reduced the min-width of menu from 250px to 200px

Bug: T105961
Change-Id: I0e72e4cc206d68e968f3e926990fe4fe7e21f01a
---
M modules/campaigns/styles/ext.cx.campaigns.contributionsmenu.less
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/campaigns/styles/ext.cx.campaigns.contributionsmenu.less 
b/modules/campaigns/styles/ext.cx.campaigns.contributionsmenu.less
index e2cd9e2..f988ab7 100644
--- a/modules/campaigns/styles/ext.cx.campaigns.contributionsmenu.less
+++ b/modules/campaigns/styles/ext.cx.campaigns.contributionsmenu.less
@@ -13,9 +13,9 @@
padding: 5px 10px 5px 40px;
margin: 0;
border-bottom: 1px solid #ccc;
-   min-width: 250px;
+   min-width: 200px;
background-size: 24px;
-   background-position: left 5px top 5px;
+   background-position: left 10px center;
background-repeat: no-repeat;
 
a {

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

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

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


[MediaWiki-commits] [Gerrit] Style improvements for page selector - change (mediawiki...ContentTranslation)

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

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

Change subject: Style improvements for page selector
..

Style improvements for page selector

* All items should have the same height.
* All images should occupy the same (square) area.
* Articles without an image should show a generic article placeholder.

Bug: T105966
Change-Id: I4ba24b76dcc354034c7e2b474a05b1dff24876c8
---
M modules/widgets/pageselector/ext.cx.pageselector.js
M modules/widgets/pageselector/ext.cx.pageselector.less
A modules/widgets/pageselector/page-placeholder.png
A modules/widgets/pageselector/page-placeholder.svg
4 files changed, 5 insertions(+), 2 deletions(-)


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

diff --git a/modules/widgets/pageselector/ext.cx.pageselector.js 
b/modules/widgets/pageselector/ext.cx.pageselector.js
index 898d83c..31dafbe 100644
--- a/modules/widgets/pageselector/ext.cx.pageselector.js
+++ b/modules/widgets/pageselector/ext.cx.pageselector.js
@@ -93,8 +93,7 @@
);
if ( page.thumbnail ) {
$resultItem.css( {
-   'background-image': 'url(' + 
page.thumbnail.source + ')',
-   'background-size': 
page.thumbnail.width + 'px ' + page.thumbnail.height + 'px'
+   'background-image': 'url(' + 
page.thumbnail.source + ')'
} );
}
self.$menu.append( $resultItem );
diff --git a/modules/widgets/pageselector/ext.cx.pageselector.less 
b/modules/widgets/pageselector/ext.cx.pageselector.less
index 7333275..df577c4 100644
--- a/modules/widgets/pageselector/ext.cx.pageselector.less
+++ b/modules/widgets/pageselector/ext.cx.pageselector.less
@@ -1,3 +1,4 @@
+@import "mediawiki.mixins";
 .mw-pageselector-menu {
position: absolute;
border: 1px solid #ccc;
@@ -16,6 +17,8 @@
background-position: left center;
background-size: 50px 50px;
padding: 5px 5px 5px 60px;
+   min-height: 40px;
+   .background-image-svg('page-placeholder.svg', 
'page-placeholder.png');
}
 
li.mw-pageselector-selected {
diff --git a/modules/widgets/pageselector/page-placeholder.png 
b/modules/widgets/pageselector/page-placeholder.png
new file mode 100644
index 000..6a79e7b
--- /dev/null
+++ b/modules/widgets/pageselector/page-placeholder.png
Binary files differ
diff --git a/modules/widgets/pageselector/page-placeholder.svg 
b/modules/widgets/pageselector/page-placeholder.svg
new file mode 100644
index 000..6e27a49
--- /dev/null
+++ b/modules/widgets/pageselector/page-placeholder.svg
@@ -0,0 +1 @@
+http://www.w3.org/2000/svg"; width="24" height="24" viewBox="0 0 24 
24">

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

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

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


[MediaWiki-commits] [Gerrit] Reduce the size of icons in dashboard to match the font size - change (mediawiki...ContentTranslation)

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

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

Change subject: Reduce the size of icons in dashboard to match the font size
..

Reduce the size of icons in dashboard to match the font size

Bug: T105962
Change-Id: I1d21ef1046f6b60fe39bfb1c1c71a3a1307997bf
---
M modules/dashboard/styles/ext.cx.dashboard.less
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/dashboard/styles/ext.cx.dashboard.less 
b/modules/dashboard/styles/ext.cx.dashboard.less
index 8341a45..926 100644
--- a/modules/dashboard/styles/ext.cx.dashboard.less
+++ b/modules/dashboard/styles/ext.cx.dashboard.less
@@ -56,7 +56,7 @@
padding: 30px 40px;
background-position: center left;
background-repeat: no-repeat;
-   background-size: 25px;
+   background-size: 20px;
}
 
&__title {

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

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

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


[MediaWiki-commits] [Gerrit] Make the height of search input field same as its container - change (mediawiki...ContentTranslation)

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

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

Change subject: Make the height of search input field same as its container
..

Make the height of search input field same as its container

Bug: T105960
Change-Id: I916c2add6cec3fe193de424a9d98a5e6cd08ccb0
---
M modules/tools/styles/ext.cx.tools.less
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/tools/styles/ext.cx.tools.less 
b/modules/tools/styles/ext.cx.tools.less
index e044684..9fa84ff 100644
--- a/modules/tools/styles/ext.cx.tools.less
+++ b/modules/tools/styles/ext.cx.tools.less
@@ -10,7 +10,7 @@
 .cx-card--search__input {
font-size: 16px;
width: 100%;
-   height: 100%;
+   height: 2.5em;
border: none;
background: none;
outline: none;

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

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

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


[MediaWiki-commits] [Gerrit] Fix: Redlink in link card opens CX with incorrect source page - change (mediawiki...ContentTranslation)

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

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

Change subject: Fix: Redlink in link card opens CX with incorrect source page
..

Fix: Redlink in link card opens CX with incorrect source page

Testplan:
Create a red link and clik on the link in the link tool card.
CX should open with source article as the text of the redlink

Bug: T105915
Change-Id: Ic4b30d5d0cfaae37ae9c30c0ae3f29b536b74680
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 5 insertions(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index 8629bfd..68339d0 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -417,7 +417,11 @@
target: '_blank',
title: mw.msg( 
'cx-tools-missing-link-tooltip' ),
href: new mw.Uri().extend( {
-   targettitle: 
this.getTitle()
+   targettitle: 
this.getTitle(),
+   // This is a non 
existing link and we cannot guess what can be the source,
+   // So using the same 
link text for now.
+   page: this.getTitle(),
+   draft: null
} ).toString()
} );
 

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

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

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


[MediaWiki-commits] [Gerrit] Gallery: Adapt the image namespaces to canonical File namespace - change (mediawiki...ContentTranslation)

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

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

Change subject: Gallery: Adapt the image namespaces to canonical File namespace
..

Gallery: Adapt the image namespaces to canonical File namespace

Bug: T105799
Change-Id: Id48116cca70444f7a6c6daf7c34d5e3acb8db814
---
M modules/tools/ext.cx.tools.gallery.js
1 file changed, 5 insertions(+), 2 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.gallery.js 
b/modules/tools/ext.cx.tools.gallery.js
index f44cee2..581bdb5 100644
--- a/modules/tools/ext.cx.tools.gallery.js
+++ b/modules/tools/ext.cx.tools.gallery.js
@@ -13,7 +13,7 @@
 
function adaptGallery( $section ) {
var i, $sourceSection, galleryData, galleryWikiMarkup = '',
-   imageItems, caption, imageIndex = 0;
+   imageItems, caption, imageTitle, imageIndex = 0;
 
if ( !$section.is( '[typeof*="mw:Extension/gallery"]' ) ) {
return;
@@ -29,8 +29,11 @@
// 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.
+   imageTitle = imageItems[ i ].split( '|' )[ 0 ];
+   // Change the image namespace to canonical 
File: namespace.
+   imageTitle = imageTitle.replace( /(.+)(:)/g, 
'File' + '$2' );
caption = $section.find( '.gallerytext' ).eq( 
imageIndex ).text().trim();
-   imageItems[ i ] = [ imageItems[ i ].split( '|' 
)[ 0 ], caption ].join( '|' );
+   imageItems[ i ] = [ imageTitle, caption ].join( 
'|' );
imageIndex++;
}
}

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

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

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


[MediaWiki-commits] [Gerrit] Add two hooks entries missed in extension.json - change (mediawiki...UniversalLanguageSelector)

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

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

Change subject: Add two hooks entries missed in extension.json
..

Add two hooks entries missed in extension.json

Change-Id: Ic53d79f7d8f7277e0768c1e461ae5d33c997a444
---
M extension.json
1 file changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/extension.json b/extension.json
index 7625015..85e86ac 100644
--- a/extension.json
+++ b/extension.json
@@ -23,7 +23,9 @@
"ResourceLoaderGetConfigVars": 
"UniversalLanguageSelectorHooks::addConfig",
"ResourceLoaderTestModules": 
"UniversalLanguageSelectorHooks::addTestModules",
"SkinTemplateOutputPageBeforeExec": 
"UniversalLanguageSelectorHooks::onSkinTemplateOutputPageBeforeExec",
-   "UserGetLanguageObject": 
"UniversalLanguageSelectorHooks::getLanguage"
+   "UserGetLanguageObject": 
"UniversalLanguageSelectorHooks::getLanguage",
+   "GetBetaFeaturePreferences": 
"UniversalLanguageSelectorHooks::onGetBetaFeaturePreferences",
+   "GetPreferences": 
"UniversalLanguageSelectorHooks::onGetPreferences"
},
"APIModules": {
"languagesearch": "ApiLanguageSearch",

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

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

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


[MediaWiki-commits] [Gerrit] fetchLinkData of CXLink class must return jQuery.Promise - change (mediawiki...ContentTranslation)

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

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

Change subject: fetchLinkData of CXLink class must return jQuery.Promise
..

fetchLinkData of CXLink class must return jQuery.Promise

An early return when title is null was causing js error

Testplan:
Translate the article La Gioconda (còpia del Museu del Prado)
from ca to en.
Click on first paragraph, you will see placeholder filled
with initial translation. Second paragraph onwards nothing
happens and a js error appears in console:
Uncaught TypeError: Cannot read property 'then' of undefined
With this patch, the js error should go away and placeholders
should work as expected.

Bug: T105687
Change-Id: I7565a3e2c9ee1bc5870314465e3f5b478e8addfa
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index b3ad055..8629bfd 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -320,7 +320,7 @@
 
title = this.getTitle();
if ( !title ) {
-   return;
+   return $.Deferred().reject().promise();
}
 
api = this.siteMapper.getApi( language );

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

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

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


[MediaWiki-commits] [Gerrit] Fix syntax errors in the sql query - change (analytics/limn-language-data)

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

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

Change subject: Fix syntax errors in the sql query
..

Fix syntax errors in the sql query

Wiki codes like 'as', 'or', 'is', 'to' are reserved keywords in sql.
They are now escaped using `.

Change-Id: I05914b5f62418fdeb5457b530e50aebe8c88875e
---
M language/content_translation_beta.sql
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/limn-language-data 
refs/changes/20/224220/1

diff --git a/language/content_translation_beta.sql 
b/language/content_translation_beta.sql
index df759c6..b1e949f 100644
--- a/language/content_translation_beta.sql
+++ b/language/content_translation_beta.sql
@@ -502,7 +502,7 @@
 left join
 ( select count(*) as vepwiki from vepwiki.user_properties 
where up_property = 'cx' and up_value = 1 ) vep on 1=1
 left join
-( select count(*) as aswiki from aswiki.user_properties where 
up_property = 'cx' and up_value = 1 ) as on 1=1
+( select count(*) as aswiki from aswiki.user_properties where 
up_property = 'cx' and up_value = 1 ) `as` on 1=1
 left join
 ( select count(*) as bnwiki from bnwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) bn on 1=1
 left join
@@ -524,7 +524,7 @@
 left join
 ( select count(*) as newwiki from newwiki.user_properties 
where up_property = 'cx' and up_value = 1 ) new on 1=1
 left join
-( select count(*) as orwiki from orwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) or on 1=1
+( select count(*) as orwiki from orwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) `or` on 1=1
 left join
 ( select count(*) as piwiki from piwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) pi on 1=1
 left join
@@ -644,7 +644,7 @@
 left join
 ( select count(*) as tetwiki from tetwiki.user_properties 
where up_property = 'cx' and up_value = 1 ) tet on 1=1
 left join
-( select count(*) as towiki from towiki.user_properties where 
up_property = 'cx' and up_value = 1 ) to on 1=1
+( select count(*) as towiki from towiki.user_properties where 
up_property = 'cx' and up_value = 1 ) `to` on 1=1
 left join
 ( select count(*) as tywiki from tywiki.user_properties where 
up_property = 'cx' and up_value = 1 ) ty on 1=1
 left join
@@ -668,7 +668,7 @@
 left join
 ( select count(*) as ikwiki from ikwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) ik on 1=1
 left join
-( select count(*) as iswiki from iswiki.user_properties where 
up_property = 'cx' and up_value = 1 ) is on 1=1
+( select count(*) as iswiki from iswiki.user_properties where 
up_property = 'cx' and up_value = 1 ) `is` on 1=1
 left join
 ( select count(*) as klwiki from klwiki.user_properties where 
up_property = 'cx' and up_value = 1 ) kl on 1=1
 ) seventh30

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05914b5f62418fdeb5457b530e50aebe8c88875e
Gerrit-PatchSet: 1
Gerrit-Project: analytics/limn-language-data
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

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


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

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

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

Change subject: Update extension version
..

Update extension version

Change-Id: I0b3070e747e68d8fa8af6add5c5af5eedebba45a
---
M extension.json
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/extension.json b/extension.json
index 5c2d65f..228bf2c 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
"name": "ContentTranslation",
-   "version": "1.0.0+20150401",
+   "version": "1.0.0+20150710",
"author": [
"Amir Aharoni",
"David Chan",

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

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

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


[MediaWiki-commits] [Gerrit] While adapting references, Validate whether the source has r... - change (mediawiki...ContentTranslation)

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

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

Change subject: While adapting references, Validate whether the source has 
references list
..

While adapting references, Validate whether the source has references list

Testplan:
Translate the following article to any language
https://en.wikipedia.org/w/index.php?title=Samsung_Galaxy_A7&oldid=668069510
You will notice that the references list is missing in loaded source article.
Use source as translation and translate all sections, publish.
Publish will fail without this patch.

Bug: T104947
Change-Id: I198f5c62b78a7b9e8cf0b613e3e5a870b4c8b2fd
---
M modules/tools/ext.cx.tools.reference.js
1 file changed, 14 insertions(+), 1 deletion(-)


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

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index f85293d..c44a7ad 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -323,7 +323,20 @@
}
 
function processReferences( $section ) {
-   var $sourceSection, referenceAdaptor, isRestoredFromDraft;
+   var $sourceSection, referenceAdaptor, isRestoredFromDraft, 
$referenceLists;
+
+   $referenceLists = $( '[typeof*="mw:Extension/references"]' );
+   if ( !$referenceLists.length ) {
+   // No references list!. There can be multiple reasons 
for this.
+   // (a) References list section use a template that we 
cannot adapt & filtered out from source.
+   // (b) References are in multi-part template that we 
cannot process at this point.
+   // Or any unknown reason. But if we adapt a reference 
without reference list at the
+   // translation, parsoid will fail causing publishing 
failure. That is serious issue and
+   // we are avoiding it.
+   mw.log( '[CX] References list not found in source 
article. References will be removed' );
+   $section.find( '[typeof*="mw:Extension/ref"]' 
).remove();
+   return;
+   }
 
isRestoredFromDraft = $section.data( 'cx-draft' ) === true;
 

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

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

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


[MediaWiki-commits] [Gerrit] Lineardoc: Do not skip tags with empty content but with attr... - change (mediawiki...cxserver)

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

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

Change subject: Lineardoc: Do not skip tags with empty content but with 
attributes
..

Lineardoc: Do not skip tags with empty content but with attributes

Those attributes are important and sometimes contain information for
parsoid to work with references or templates.

Added tests to verify lineardoc is not eating up empty tags

Bug: T104539
Change-Id: I4cca925cb35a00fa27fd31380fae90e1c4c2767f
---
M lineardoc/Builder.js
M tests/lineardoc/LinearDoc.test.js
A tests/lineardoc/data/test3-result.xhtml
A tests/lineardoc/data/test3-result.xml
A tests/lineardoc/data/test3.xhtml
5 files changed, 85 insertions(+), 2 deletions(-)


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

diff --git a/lineardoc/Builder.js b/lineardoc/Builder.js
index 15f806c..5df6a53 100644
--- a/lineardoc/Builder.js
+++ b/lineardoc/Builder.js
@@ -58,7 +58,11 @@
'Mismatched inline tags: open=' + ( tag && tag.name ) + 
', close=' + tagName
);
}
-   if ( tag.name !== 'span' || !tag.attributes[ 'data-mw' ] ) {
+
+   if ( !Object.keys( tag.attributes).length ) {
+   // if the tag has no attributes, we can safeley assume that
+   // we not check for empy/whitespace only tags. Otherwise, we 
might be skipping
+   // important tags just because it has no content. See Bug 
T104539
return tag;
}
// Check for empty/whitespace-only data span. Replace as inline content
diff --git a/tests/lineardoc/LinearDoc.test.js 
b/tests/lineardoc/LinearDoc.test.js
index 745fb36..13a1007 100644
--- a/tests/lineardoc/LinearDoc.test.js
+++ b/tests/lineardoc/LinearDoc.test.js
@@ -6,7 +6,7 @@
 QUnit.test( 'LinearDoc tests', function ( assert ) {
var parser, testXhtmlFile, resultXmlFile, resultXhtmlFile, testXhtml, 
resultXml,
resultXhtml, i,
-   numTests = 2;
+   numTests = 3;
QUnit.expect( 2 * numTests );
for ( i = 1; i <= numTests; i++ ) {
testXhtmlFile = __dirname + '/data/test' + i + '.xhtml';
diff --git a/tests/lineardoc/data/test3-result.xhtml 
b/tests/lineardoc/data/test3-result.xhtml
new file mode 100644
index 000..d6ac7fa
--- /dev/null
+++ b/tests/lineardoc/data/test3-result.xhtml
@@ -0,0 +1,14 @@
+
+
+
+test
+
+
+
+
+↑ 

+http://lhermanto-resepkeluarga.blogspot.com/2008/04/telor-bumbu-bali-bali-seasoning.html";
 rel="mw:ExtLink">
+
+
+
+
diff --git a/tests/lineardoc/data/test3-result.xml 
b/tests/lineardoc/data/test3-result.xml
new file mode 100644
index 000..f0bc5b3
--- /dev/null
+++ b/tests/lineardoc/data/test3-result.xml
@@ -0,0 +1,51 @@
+
+
+
+
+cxtextblock { border: solid #88f 1px }
+cxtextchunk { border-right: solid #f88 1px }
+
+  

+  
+
+  
+  

+
+
+
+  test
+
+
+
+
+
+
+
+
+
+
+
+  

+  ↑ 
+  
+
+
+
+
+  
+  

+  
+
+
+
+
+  
+  

+
+
+
+
+
+
+
+
diff --git a/tests/lineardoc/data/test3.xhtml b/tests/lineardoc/data/test3.xhtml
new file mode 100644
index 000..03339e0
--- /dev/null
+++ b/tests/lineardoc/data/test3.xhtml
@@ -0,0 +1,14 @@
+
+
+
+test
+
+
+
+
+↑ 

+http://lhermanto-resepkeluarga.blogspot.com/2008/04/telor-bumbu-bali-bali-seasoning.html";
 
data-parsoid="{"targetOff":4337,"contentOffsets":[4337,4337],"dsr":[4248,4338,89,1]}">
+
+
+
+

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4cca925cb35a00fa27fd31380fae90e1c4c2767f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

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


[MediaWiki-commits] [Gerrit] Load ext.cite.style once the source article loaded - change (mediawiki...ContentTranslation)

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

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

Change subject: Load ext.cite.style once the source article loaded
..

Load ext.cite.style once the source article loaded

This module is defined in Cite extension. So we cannot load
it unconditionally. Hence loading in a try-catch block.

Loading is delayed till the article is ready.

Testplan:
Configure cxserver to use RESTBase beta instance.
http://restbase-beta.wmflabs.org/@lang.wikipedia.beta.wmflabs.org/v1/page/html/@title
Restart cxserver and load any article from enwiki(beta labs).
For example: African linsang article.
Without the Cite extension, the references at the bottom of article will
look like
1. ↑ 1 2 3...
With Cite extension, the numbers after up-arrow will look like super scripts.

Bug: T99870

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


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

diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js
index cda252c..d7efeea 100644
--- a/modules/source/ext.cx.source.js
+++ b/modules/source/ext.cx.source.js
@@ -153,6 +153,12 @@
this.$content.find( 'base' ).detach();
 
mw.hook( 'mw.cx.source.ready' ).fire();
+   // Try to load ext.cite.style module. If Cite extension is not 
present, this can fail.
+   try {
+   mw.loader.using( 'ext.cite.style' );
+   } catch ( e ) {
+   mw.log( 'Could not load ext.cite.style, References will 
fallback to default style' );
+   }
};
 
/**

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

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

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


[MediaWiki-commits] [Gerrit] Attach link handlers to redlinks after restoring the draft - change (mediawiki...ContentTranslation)

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

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

Change subject: Attach link handlers to redlinks after restoring the draft
..

Attach link handlers to redlinks after restoring the draft

The redlinks were missing rel=mw:WikiLink attributes and because of that
the link handlers were not attached.

Testplan:
Do a translation. Make some link red. Save. Restore. See the redlink
is still present and clicking on it brings link card

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


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index 7643038..b3ad055 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -246,7 +246,11 @@
return;
}
}
-   this.$link.removeClass( 'cx-target-link-unadapted' ).addClass( 
'new' );
+
+   this.$link
+   .attr( 'rel', 'mw:WikiLink' )
+   .removeClass( 'cx-target-link-unadapted' )
+   .addClass( 'new' );
};
 
CXLink.prototype.isRedLink = function () {

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

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

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


[MediaWiki-commits] [Gerrit] Fix: Translation percentage sometimes goes beyond 100 - change (mediawiki...ContentTranslation)

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

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

Change subject: Fix: Translation percentage sometimes goes beyond 100
..

Fix: Translation percentage sometimes goes beyond 100

A missing parseInt was causing 0s appended to numbers instead of
adding, causing wrong calculation

Testplan:
Translate
Special:ContentTranslation&page=Before+This+World&from=en&to=vi
Click the section "Background". Without this patch, you will see the
progressbar growing beyond the limits. With this patch, it should
never go beyond 100%

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


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

diff --git a/modules/translation/ext.cx.translation.progress.js 
b/modules/translation/ext.cx.translation.progress.js
index dc8e804..48ccf5f 100644
--- a/modules/translation/ext.cx.translation.progress.js
+++ b/modules/translation/ext.cx.translation.progress.js
@@ -88,7 +88,7 @@
$sections.each( function () {
var weight, state, $section = $( this );
 
-   weight = $section.attr( 'data-cx-weight' );
+   weight = parseInt( $section.attr( 'data-cx-weight' ), 
10 );
weights.any += weight;
 
state = $section.data( 'cx-state' );

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

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

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


[MediaWiki-commits] [Gerrit] Consistently use title.toText() for cache access - change (mediawiki...ContentTranslation)

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

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

Change subject: Consistently use title.toText() for cache access
..

Consistently use title.toText() for cache access

Mixed use of title.toString() and title.getPrefixedText()
was causing lookup failures.

Title.prototype.toText is alias for Title.prototype.getPrefixedText
Which does not contain underscores.

Bug: T104055
Change-Id: Iff041043c569d98ef1b49a28c890513456396888
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 6 insertions(+), 6 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index c471117..1d3e264 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -26,7 +26,7 @@
var request;
 
// Normalize the title
-   title = mw.Title.newFromText( title ).toString();
+   title = mw.Title.newFromText( title ).toText();
if ( cache[ title ] && cache[ title ][ language ] ) {
return cache[ title ][ language ].promise();
}
@@ -112,7 +112,7 @@
title = mw.Title.newFromText( key );
 
if ( title ) {
-   linkPairs[ title.toString() ] = 
page.langlinks &&
+   linkPairs[ title.toText() ] = 
page.langlinks &&
page.langlinks[ 0 ][ '*' ];
}
} );
@@ -271,7 +271,7 @@
 
CXLink.prototype.getTargetTitle = function () {
var targetTitle = cache.linkPairs[ this.getTitle() ] || 
this.getTitle();
-   return mw.Title.newFromText( targetTitle ).getPrefixedText();
+   return mw.Title.newFromText( targetTitle ).toText();
};
 
/**
@@ -404,7 +404,7 @@
// This link opens Special:CX with this missing 
page to help translate it
$link = $( '' )
.addClass( 'card__link-text new' )
-   .text( mw.Title.newFromText( 
this.getTitle() ).getPrefixedText() )
+   .text( mw.Title.newFromText( 
this.getTitle() ).toText() )
.prop( {
target: '_blank',
title: mw.msg( 
'cx-tools-missing-link-tooltip' ),
@@ -669,7 +669,7 @@
return;
}
 
-   title = mw.Title.newFromText( title ).toString();
+   title = mw.Title.newFromText( title ).toText();
 
if ( cache.linkPairs[ title ] ) {
this.title = cache.linkPairs[ title ];
@@ -810,7 +810,7 @@
var title = text.trim();
 
title = mw.Title.newFromText( title );
-   title = title && title.toString();
+   title = title && title.toText();
 
return title;
}

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

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

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


[MediaWiki-commits] [Gerrit] Link cards does not work on sections restored from draft - change (mediawiki...ContentTranslation)

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

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

Change subject: Link cards does not work on sections restored from draft
..

Link cards does not work on sections restored from draft

Fetch the link data for links in the sections restored from draft.

Testplan:
Do some translation. Save. Restore. Click on the links in the restored
section. Link tools should work without any difference.

Change-Id: I37023ebe7110a2b8a53cdceae8de7a66e855f3d2
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 9 insertions(+), 10 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index c471117..7946e9c 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -62,6 +62,11 @@
var apiLanguage,
deferred = $.Deferred();
 
+   if ( !titles || !titles.length ) {
+   deferred.resolve( {} );
+   return;
+   }
+
if ( !$.isArray( titles ) ) {
titles = new Array( titles );
}
@@ -906,16 +911,10 @@
$sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
$sourceLinks = $sourceSection.find( 'a[rel="mw:WikiLink"]' );
 
-   if ( !$section.data( 'cx-draft' ) ) {
-   // Collect all source links' titles
-   sourceLinkTargets = $sourceLinks.map( function () {
-   return $( this ).attr( 'title' );
-   } ).get();
-   }
-
-   if ( !sourceLinkTargets.length ) {
-   return;
-   }
+   // Collect all source links' titles
+   sourceLinkTargets = $sourceLinks.map( function () {
+   return $( this ).attr( 'title' );
+   } ).get();
 
$targetLinks = $section.find( 'a[rel="mw:WikiLink"]' );
 

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

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

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


[MediaWiki-commits] [Gerrit] Rename the getLink method to avoid confusion with CXLink.get... - change (mediawiki...ContentTranslation)

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

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

Change subject: Rename the getLink method to avoid confusion with CXLink.getLink
..

Rename the getLink method to avoid confusion with CXLink.getLink

Bug: T104122
Change-Id: I1d76c0c9bb1b580175ee6d4146a5c6147f0fb1c5
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index c471117..04e6558 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -16,13 +16,13 @@
};
 
/**
-* Get the link data for a given title and language.
+* Get the link details for a given title and language such as page 
thumbnail image.
 * @param {mediawiki.Api} api
 * @param {string} title
 * @param {string} language
 * @return {jQuery.Promise}
 */
-   function getLink( api, title, language ) {
+   function getLinkDetails( api, title, language ) {
var request;
 
// Normalize the title
@@ -316,7 +316,7 @@
}
 
api = this.siteMapper.getApi( language );
-   return getLink( api, title, language ).then( function ( 
response ) {
+   return getLinkDetails( api, title, language ).then( function ( 
response ) {
var pageId;
 
pageId = Object.keys( response.query.pages )[ 0 ];

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

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

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


[MediaWiki-commits] [Gerrit] Update ULS settings UI style mediawiki.ui style - change (mediawiki...UniversalLanguageSelector)

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

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

Change subject: Update ULS settings UI style mediawiki.ui style
..

Update ULS settings UI style mediawiki.ui style

The ext.uls.buttons style can be removed but Translate extension use that.
Once it is separated we can remove it from ULS.

Testplan:
Use ULS settings and notice the style difference of buttons, checkboxes
and radio buttons. No functionality should be affected and UI should not
be broken in any ways.

This was once attempted in Id186ece6513f154e0388bc4170c21bdabb59038a
but we had to revert because of incompleteness

Bug: T52599
Change-Id: Ibbb2068b5036537f298fad6c49169a5b986304d5
---
M Resources.php
M extension.json
M resources/css/ext.uls.css
M resources/css/ext.uls.displaysettings.css
M resources/js/ext.uls.displaysettings.js
M resources/js/ext.uls.inputsettings.js
M resources/js/ext.uls.languagesettings.js
7 files changed, 42 insertions(+), 54 deletions(-)


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

diff --git a/Resources.php b/Resources.php
index 0d05f64..21d8f2a 100644
--- a/Resources.php
+++ b/Resources.php
@@ -34,6 +34,8 @@
'ext.uls.mediawiki',
'ext.uls.webfonts',
'mediawiki.api.parse',
+   'mediawiki.ui.checkbox',
+   'mediawiki.ui.button',
),
 ) + $resourcePaths;
 
@@ -101,6 +103,8 @@
'ext.uls.languagesettings',
'ext.uls.mediawiki',
'jquery.ime',
+   'mediawiki.ui.button',
+   'mediawiki.ui.radio',
),
 ) + $resourcePaths;
 
@@ -129,12 +133,12 @@
'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,
// but ULS itself is lazy-loaded
'jquery.uls.grid',
+   'mediawiki.ui.button'
),
 ) + $resourcePaths;
 
diff --git a/extension.json b/extension.json
index 727c6d4..bc3b85f 100644
--- a/extension.json
+++ b/extension.json
@@ -90,7 +90,9 @@
"ext.uls.languagesettings",
"ext.uls.mediawiki",
"ext.uls.webfonts",
-   "mediawiki.api.parse"
+   "mediawiki.api.parse",
+   "mediawiki.ui.checkbox",
+   "mediawiki.ui.button"
],
"localBasePath": "resources",
"remoteExtPath": "UniversalLanguageSelector/resources"
@@ -161,7 +163,9 @@
"ext.uls.ime",
"ext.uls.languagesettings",
"ext.uls.mediawiki",
-   "jquery.ime"
+   "jquery.ime",
+   "mediawiki.ui.button",
+   "mediawiki.ui.radio"
],
"localBasePath": "resources",
"remoteExtPath": "UniversalLanguageSelector/resources"
@@ -192,7 +196,8 @@
"ext.uls.buttons",
"ext.uls.messages",
"ext.uls.preferences",
-   "jquery.uls.grid"
+   "jquery.uls.grid",
+   "mediawiki.ui.button"
],
"localBasePath": "resources",
"remoteExtPath": "UniversalLanguageSelector/resources"
diff --git a/resources/css/ext.uls.css b/resources/css/ext.uls.css
index e02dcf5..cd9692c 100644
--- a/resources/css/ext.uls.css
+++ b/resources/css/ext.uls.css
@@ -23,9 +23,10 @@
 }
 
 .uls-ui-languages button {
-   width: 23%;
+   width: 22%;
text-overflow: ellipsis;
-   margin-right: 4%;
+   margin-right: 2%;
+   white-space: nowrap;
 }
 
 button.uls-more-languages {
diff --git a/resources/css/ext.uls.displaysettings.css 
b/resources/css/ext.uls.displaysettings.css
index 90fd149..7496396 100644
--- a/resources/css/ext.uls.displaysettings.css
+++ b/resources/css/ext.uls.displaysettings.css
@@ -23,24 +23,6 @@
z-index: 1;
 }
 
-.uls-button-group > button.button {
-   border-radius: 0;
-   float: left;
-   padding: 8px 10px;
-   min-width: 80px;
-   margin: 0;
-}
-
-.uls-button-group > button.button:first-child {
-   border-top-left-radius: 3px;
-   border-bottom-left-radius: 3px;
-}
-
-.uls-button-group > button.button:last-child {
-   bor

[MediaWiki-commits] [Gerrit] Dashboard: Add icons to the sidebar links - change (mediawiki...ContentTranslation)

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

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

Change subject: Dashboard: Add icons to the sidebar links
..

Dashboard: Add icons to the sidebar links

Bug: T88344
Change-Id: Ifba1fa593af3e28410660ead755b0fd2a8e51396
---
A modules/dashboard/images/cx-discuss.png
A modules/dashboard/images/cx-discuss.svg
A modules/dashboard/images/cx-find-missing.png
A modules/dashboard/images/cx-find-missing.svg
A modules/dashboard/images/cx-information.png
A modules/dashboard/images/cx-information.svg
M modules/dashboard/styles/ext.cx.dashboard.less
7 files changed, 56 insertions(+), 4 deletions(-)


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

diff --git a/modules/dashboard/images/cx-discuss.png 
b/modules/dashboard/images/cx-discuss.png
new file mode 100644
index 000..2239660
--- /dev/null
+++ b/modules/dashboard/images/cx-discuss.png
Binary files differ
diff --git a/modules/dashboard/images/cx-discuss.svg 
b/modules/dashboard/images/cx-discuss.svg
new file mode 100644
index 000..a434de7
--- /dev/null
+++ b/modules/dashboard/images/cx-discuss.svg
@@ -0,0 +1,12 @@
+
+http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; preserveAspectRatio="xMidYMid" 
width="86" height="64" viewBox="0 0 43 32">
+  
+
+
+  .cls-2 {
+fill: #2460cf;
+  }
+
+  
+  
+
diff --git a/modules/dashboard/images/cx-find-missing.png 
b/modules/dashboard/images/cx-find-missing.png
new file mode 100644
index 000..4b38542
--- /dev/null
+++ b/modules/dashboard/images/cx-find-missing.png
Binary files differ
diff --git a/modules/dashboard/images/cx-find-missing.svg 
b/modules/dashboard/images/cx-find-missing.svg
new file mode 100644
index 000..c9004d5
--- /dev/null
+++ b/modules/dashboard/images/cx-find-missing.svg
@@ -0,0 +1,12 @@
+
+http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; preserveAspectRatio="xMidYMid" 
width="74" height="74" viewBox="0 0 37 37">
+  
+
+
+  .cls-2 {
+fill: #2460cf;
+  }
+
+  
+  
+
diff --git a/modules/dashboard/images/cx-information.png 
b/modules/dashboard/images/cx-information.png
new file mode 100644
index 000..00cae1e
--- /dev/null
+++ b/modules/dashboard/images/cx-information.png
Binary files differ
diff --git a/modules/dashboard/images/cx-information.svg 
b/modules/dashboard/images/cx-information.svg
new file mode 100644
index 000..e841ced
--- /dev/null
+++ b/modules/dashboard/images/cx-information.svg
@@ -0,0 +1,12 @@
+
+http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; preserveAspectRatio="xMidYMid" 
width="80" height="80" viewBox="0 0 40 40">
+  
+
+
+  .cls-2 {
+fill: #2460cf;
+  }
+
+  
+  
+
diff --git a/modules/dashboard/styles/ext.cx.dashboard.less 
b/modules/dashboard/styles/ext.cx.dashboard.less
index 81f4f86..8341a45 100644
--- a/modules/dashboard/styles/ext.cx.dashboard.less
+++ b/modules/dashboard/styles/ext.cx.dashboard.less
@@ -49,15 +49,31 @@
}
}
 
-   &__link {
-   color: #07e;
-   font-size: 12px;
+   &__link,
+   &__link:visited {
+   color: #2460cf;
+   font-size: 14px;
+   padding: 30px 40px;
+   background-position: center left;
+   background-repeat: no-repeat;
+   background-size: 25px;
}
 
&__title {
-   font-size: 16px;
+   font-size: 20px;
padding-bottom: 15px;
}
+
+   .cx-sidebar__link--information {
+   .background-image-svg('../images/cx-information.svg', 
'../images/cx-information.png');
+   }
+
+   .cx-sidebar__link--feedback {
+   .background-image-svg('../images/cx-discuss.svg', 
'../images/cx-discuss.png');
+   }
+   .cx-sidebar__link--magnus {
+   .background-image-svg('../images/cx-find-missing.svg', 
'../images/cx-find-missing.png');
+   }
 }
 
 .cx-header--dashboard {

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

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

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


[MediaWiki-commits] [Gerrit] Use Echo notifications only when Echo is available - change (mediawiki...ContentTranslation)

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

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

Change subject: Use Echo notifications only when Echo is available
..

Use Echo notifications only when Echo is available

Avoid publishing error if the wiki does not have Echo installed.
Produce notifications only if Echo available.

Testplan:
Disable Echo, and publish translations(1st, 10th or 100th translations)
Publishing should work without errors and without complaining about
Echo missing.

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


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

diff --git a/api/ApiContentTranslationPublish.php 
b/api/ApiContentTranslationPublish.php
index d31833c..e58c394 100755
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -231,6 +231,10 @@
 * Notify user about milestones.
 */
public function notifyTranslator() {
+   // Make sure Echo is installed.
+   if ( !class_exists( 'EchoEvent' ) ) {
+   return;
+   }
$user = $this->getUser();
$translator = new ContentTranslation\Translator( $user );
$translationCount = $translator->getTranslationsCount();

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

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

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


[MediaWiki-commits] [Gerrit] [WIP] Changes to work with RESTBase ids for elements than CX... - change (mediawiki...ContentTranslation)

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

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

Change subject: [WIP] Changes to work with RESTBase ids for elements than CX 
generated ids
..

[WIP] Changes to work with RESTBase ids for elements than CX generated ids

[X] Restore drafts (new and old) against correct sections
[ ] links are connected properly
[X] Sequences are aligned since RESTBase does not know about them
[ ] Make this work with and without https://gerrit.wikimedia.org/r/#/c/220441/

Bug: T102584
Change-Id: Icc5dff9ba5cf79c599021f2a633024a257b397fb
---
M modules/draft/ext.cx.draft.js
M modules/tools/ext.cx.tools.link.js
M modules/util/ext.cx.util.js
3 files changed, 13 insertions(+), 3 deletions(-)


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

diff --git a/modules/draft/ext.cx.draft.js b/modules/draft/ext.cx.draft.js
index c628510..21a360a 100644
--- a/modules/draft/ext.cx.draft.js
+++ b/modules/draft/ext.cx.draft.js
@@ -168,6 +168,13 @@
$draftSection = $( this.$draft[ i ] );
sectionId = $draftSection.prop( 'id' );
$section = $( '#' + sectionId );
+   if ( !$section.length ) {
+   // Support old sections with sequential 
idendifiers
+   $section = mw.cx.getTranslationSection(
+   $( '[data-seqid="' + 
$draftSection.data( 'source' ) + '"]' ).prop( 'id' )
+   );
+   sectionId = $section.prop( 'id' );
+   }
$section.replaceWith( $draftSection );
// Get new section
$section = $( '#' + sectionId );
diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index 77f3087..78684d1 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -683,7 +683,10 @@
this.adapted = false;
this.markUnAdapted();
}
-
+   if ( this.$link.prop( 'id' ) ) {
+   this.id = this.$link.prop( 'id' );
+   this.$link.prop( 'id', 'cx' + this.id );
+   }
this.$link.addClass( 'cx-target-link' );
};
 
diff --git a/modules/util/ext.cx.util.js b/modules/util/ext.cx.util.js
index 5d42c36..25a3920 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 ( !id || ( isNaN( id ) && id.indexOf( 'cx' ) !== 0 ) ) {
+   if ( !id || ( isNaN( id ) && id.indexOf( 'cx' ) !== 0 ) &&  
id.indexOf( 'mw' ) !== 0 ) {
return $( [] );
} else {
return $( document.getElementById( id ) );
@@ -48,7 +48,7 @@
 
mw.cx.getTranslationSection = function ( id ) {
// Sanity check
-   if ( isNaN( id ) ) {
+   if (  !id || isNaN( id ) && id.indexOf( 'mw' ) !== 0 ) {
return $( [] );
} else {
return $( document.getElementById( 'cx' + id ) );

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

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

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


[MediaWiki-commits] [Gerrit] Reuse the element identifiers given by RESTBase - change (mediawiki...cxserver)

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

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

Change subject: Reuse the element identifiers given by RESTBase
..

Reuse the element identifiers given by RESTBase

TODO: Make this change transparent to client.
The drafts saved based on old source content should
work and align with new source.

Bug: T102584
Change-Id: Iedbf36ea872bee8149e842751fd7bb05b4b870b1
---
M lineardoc/Doc.js
1 file changed, 6 insertions(+), 1 deletion(-)


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

diff --git a/lineardoc/Doc.js b/lineardoc/Doc.js
index 0647e1b..22196c8 100644
--- a/lineardoc/Doc.js
+++ b/lineardoc/Doc.js
@@ -83,7 +83,12 @@
item = this.items[ i ];
if ( this.items[ i ].type === 'open' ) {
tag = Utils.cloneOpenTag( item.item );
-   tag.attributes.id = getNextId( 'block' );
+   if ( tag.attributes.id ) {
+   // Kept for restoring the old articles.
+   tag.attributes['data-seqid'] = getNextId( 
'block' );
+   } else{
+   tag.attributes.id = getNextId( 'block' );
+   }
newDoc.addItem( item.type, tag );
} else if ( this.items[ i ].type !== 'textblock' ) {
newDoc.addItem( item.type, item.item );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iedbf36ea872bee8149e842751fd7bb05b4b870b1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh 

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


[MediaWiki-commits] [Gerrit] Enable publish button when the preference is not use initial... - change (mediawiki...ContentTranslation)

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

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

Change subject: Enable publish button when the preference is not use initial 
translation
..

Enable publish button when the preference is not use initial translation

The translation weight were taken using $.data which does not reflect the
updated values. If there is no initial translation, the initial value is
0 and causing progress calculation understand it as 0 translation
permanantly. Changed the translation weight reading to .attr method and
fixed the issue.

Testplan:
Choose a translation where the direction of source and target differs.
page=גבעת+יערים&from=he&to=en is an example.
Click on some sections and start typing in the blank translation sections
You should notice the publish button enabled.

Bug: T103555
Change-Id: I1ec868e270fa65485fa8e21268f8e46a163e9178
---
M modules/translation/ext.cx.translation.progress.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/translation/ext.cx.translation.progress.js 
b/modules/translation/ext.cx.translation.progress.js
index 7fe2c07..dc8e804 100644
--- a/modules/translation/ext.cx.translation.progress.js
+++ b/modules/translation/ext.cx.translation.progress.js
@@ -88,7 +88,7 @@
$sections.each( function () {
var weight, state, $section = $( this );
 
-   weight = $section.data( 'cx-weight' );
+   weight = $section.attr( 'data-cx-weight' );
weights.any += weight;
 
state = $section.data( 'cx-state' );

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

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

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


[MediaWiki-commits] [Gerrit] Additional trigger to add reflist while adding a reference m... - change (mediawiki...ContentTranslation)

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

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

Change subject: Additional trigger to add reflist while adding a reference 
manually
..

Additional trigger to add reflist while adding a reference manually

Before this patch, the reference list was added as a handler of
mw.cx.translation.postMT. This wont work for two cases

(a) language pair with different directionality. For them we don't
give source text as initial translation.

(b) When user opted to not using any initial translation.

Testplan:
Translate the article 
https://he.wikipedia.org/wiki/%D7%92%D7%91%D7%A2%D7%AA_%D7%99%D7%A2%D7%A8%D7%99%D7%9D
from hewiki to English. Click on some sections. You will see empty
initial translation. After that, click on a reference in source section,
press 'Add reference' button from reference tool card.
You will see reference added. At the same time, you should see reference list
added at the bottom of the translation. The publishing of your translation
should succeed too.

Bug: T103502
Change-Id: I2a8d4d99eb8e69c75a35c28b638622a1b477bbf1
---
M modules/tools/ext.cx.tools.reference.js
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/tools/ext.cx.tools.reference.js 
b/modules/tools/ext.cx.tools.reference.js
index d40e884..f85293d 100644
--- a/modules/tools/ext.cx.tools.reference.js
+++ b/modules/tools/ext.cx.tools.reference.js
@@ -105,6 +105,8 @@
// Mark it readonly
.attr( 'contenteditable', false );
 
+   // Make sure we add reference list since we added a reference 
just now.
+   this.addReferenceList();
this.stop();
};
 

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

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

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


[MediaWiki-commits] [Gerrit] Fix missing new translation button for new users - change (mediawiki...ContentTranslation)

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

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

Change subject: Fix missing new translation button for new users
..

Fix missing new translation button for new users

Apparently, it can prevent users starting new translations :)

Testplan:
Create a new user, enable cx beta feature and access Special:CX
You should get a green button there.

Change-Id: I0a1692463394bdd86d11cb3d8ffa1e7175b09f32
---
M modules/dashboard/ext.cx.translationlist.js
1 file changed, 2 insertions(+), 7 deletions(-)


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

diff --git a/modules/dashboard/ext.cx.translationlist.js 
b/modules/dashboard/ext.cx.translationlist.js
index 5419751..2ce3eea 100644
--- a/modules/dashboard/ext.cx.translationlist.js
+++ b/modules/dashboard/ext.cx.translationlist.js
@@ -53,14 +53,9 @@
translations = $.map( translations, function ( e ) {
return e.translation;
} );
-
this.translations = translations;
-
-   if ( translations.length > 0 ) {
-   this.$header.show();
-   }
-
-   this.listTranslations( translations );
+   this.$header.show();
+   this.listTranslations( this.translations );
this.filters.status = 'draft';
this.applyFilters( this.filters, translations );
 

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

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

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


[MediaWiki-commits] [Gerrit] Add the missing CX icon for CX dashboard - change (mediawiki...ContentTranslation)

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

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

Change subject: Add the missing CX icon for CX dashboard
..

Add the missing CX icon for CX dashboard

Change-Id: Ia0630278a4c194058bc69ed26b81d4bdbf954e64
---
A modules/dashboard/images/cx-circle.png
A modules/dashboard/images/cx-circle.svg
2 files changed, 7 insertions(+), 0 deletions(-)


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

diff --git a/modules/dashboard/images/cx-circle.png 
b/modules/dashboard/images/cx-circle.png
new file mode 100644
index 000..c7aab70
--- /dev/null
+++ b/modules/dashboard/images/cx-circle.png
Binary files differ
diff --git a/modules/dashboard/images/cx-circle.svg 
b/modules/dashboard/images/cx-circle.svg
new file mode 100644
index 000..c4dd97c
--- /dev/null
+++ b/modules/dashboard/images/cx-circle.svg
@@ -0,0 +1,7 @@
+
+http://www.w3.org/2000/svg"; xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:sketch="http://www.bohemiancoding.com/sketch/ns";>
+
+
+
+
+

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

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

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


[MediaWiki-commits] [Gerrit] Fix JSCS errors of ext.cx.sitemapper.js - change (mediawiki...ContentTranslation)

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

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

Change subject: Fix JSCS errors of ext.cx.sitemapper.js
..

Fix JSCS errors of ext.cx.sitemapper.js

Removed unwanted empty lines

Change-Id: I23bedd3f61a095a9cd20423b8a9ab0ec77d91bb9
---
M modules/base/ext.cx.sitemapper.js
1 file changed, 0 insertions(+), 2 deletions(-)


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

diff --git a/modules/base/ext.cx.sitemapper.js 
b/modules/base/ext.cx.sitemapper.js
index bed8b0c..ffdd9fc 100644
--- a/modules/base/ext.cx.sitemapper.js
+++ b/modules/base/ext.cx.sitemapper.js
@@ -11,7 +11,6 @@
 ( function ( $, mw ) {
'use strict';
 
-
/**
 * Handles providing urls to different wikis.
 * @class
@@ -19,7 +18,6 @@
mw.cx.SiteMapper = function ( siteconfig ) {
this.config = siteconfig;
};
-
 
/**
 * Some wikis have domain names that do not match the content language.

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

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

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


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

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

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

Change subject: Support peom translations
..

Support peom translations

Adapt the peom (mw:Extension/poem) from the source article to the
target article
Editing the poem text is not supported. If there is MT, the translation
will be used for target article.

Testplan:
Translate an article with poem in it. Example: 
https://en.wikipedia.org/wiki/Puja_%28Hinduism%29
After translating, ensure that translation has poem with content in it.

Bug: T100385
Change-Id: I98d29f889b9afd4497898a2edbfce5366e5e719e
---
M extension.json
A modules/tools/ext.cx.tools.poem.js
2 files changed, 44 insertions(+), 0 deletions(-)


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

diff --git a/extension.json b/extension.json
index da3643b..c56f54e 100644
--- a/extension.json
+++ b/extension.json
@@ -374,6 +374,7 @@
"ext.cx.tools.dictionary",
"ext.cx.tools.formatter",
"ext.cx.tools.gallery",
+   "ext.cx.tools.poem",
"ext.cx.tools.images",
"ext.cx.tools.instructions",
"ext.cx.tools.link",
@@ -546,6 +547,11 @@
"tools/ext.cx.tools.gallery.js"
]
},
+   "ext.cx.tools.poem": {
+   "scripts": [
+   "tools/ext.cx.tools.poem.js"
+   ]
+   },
"ext.cx.tools.categories": {
"scripts": [
"tools/ext.cx.tools.categories.js"
diff --git a/modules/tools/ext.cx.tools.poem.js 
b/modules/tools/ext.cx.tools.poem.js
new file mode 100644
index 000..54fba4f
--- /dev/null
+++ b/modules/tools/ext.cx.tools.poem.js
@@ -0,0 +1,38 @@
+/**
+ * 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 adaptPoem( $section ) {
+   var $sourceSection, poemData, $poem;
+
+   $sourceSection = mw.cx.getSourceSection( $section.data( 
'source' ) );
+   if ( $section.is( '[typeof*="mw:Extension/poem"]' ) ) {
+   $poem = $sourceSection;
+   } else {
+   $poem = $sourceSection.find( 
'[typeof*="mw:Extension/poem"]' );
+   }
+   if ( !$poem.length ) {
+   return;
+   }
+   poemData = $poem.data( 'mw' );
+   // TODO: Note that we are not retaining markup here.
+   poemData.body.extsrc = $poem.text().replace( //mg, 
'\n' );
+   // Copy the data-mw to target section.
+   $section.find( '[typeof*="mw:Extension/poem"]' ).attr( 
'data-mw', JSON.stringify( poemData ) );
+   // Make the poem readonly. We can only adapt them. Not allowing 
edits.
+   $section.find( 'p' ).attr( 'contenteditable', false );
+   }
+
+   $( function () {
+   mw.hook( 'mw.cx.translation.postMT' ).add( adaptPoem );
+   } );
+}( jQuery, mediaWiki ) );

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

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

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


[MediaWiki-commits] [Gerrit] Fix all PHPCS errors and warnings - change (mediawiki...BetaFeatures)

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

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

Change subject: Fix all PHPCS errors and warnings
..

Fix all PHPCS errors and warnings

Change-Id: Idc0f8d506997e30f7e5c29e2c6056991abd6563c
---
M BetaFeatures.php
M BetaFeaturesHooks.php
M includes/ApiListBetaFeatures.php
M includes/BetaFeaturesUtil.php
M includes/HTMLFeatureField.php
M includes/NewHTMLCheckField.php
M includes/SpecialBetaFeatures.php
7 files changed, 32 insertions(+), 18 deletions(-)


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

diff --git a/BetaFeatures.php b/BetaFeatures.php
index 110b14e..af0300e 100644
--- a/BetaFeatures.php
+++ b/BetaFeatures.php
@@ -5,7 +5,8 @@
$wgMessagesDirs['BetaFeatures'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['BetaFeaturesAlias'] = __DIR__ . 
'/BetaFeatures.alias.php';
/* wfWarn(
-   'Deprecated PHP entry point used for BetaFeatures extension. 
Please use wfLoadExtension instead, ' .
+   'Deprecated PHP entry point used for BetaFeatures extension. ' .
+   'Please use wfLoadExtension instead, ' .
'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
); */
return;
diff --git a/BetaFeaturesHooks.php b/BetaFeaturesHooks.php
index 95ea6a7..de5e8fe 100755
--- a/BetaFeaturesHooks.php
+++ b/BetaFeaturesHooks.php
@@ -143,7 +143,8 @@
wfRunHooks( 'GetBetaFeatureDependencyHooks', array( &$depHooks 
) );
 
$saveUser = false;
-   $autoEnrollAll = $user->getOption( 'betafeatures-auto-enroll' ) 
=== HTMLFeatureField::OPTION_ENABLED;
+   $autoEnrollAll =
+   $user->getOption( 'betafeatures-auto-enroll' ) === 
HTMLFeatureField::OPTION_ENABLED;
$autoEnroll = array();
 
foreach ( $betaPrefs as $key => $info ) {
@@ -194,7 +195,9 @@
// A required field isn't present in 
the info array
// we got from the 
GetBetaFeaturePreferences hook.
// Don't add this feature to the form.
-   throw new 
BetaFeaturesMissingFieldException( "The field {$field} was missing from the 
beta feature {$key}." );
+   throw new 
BetaFeaturesMissingFieldException(
+   "The field {$field} was missing 
from the beta feature {$key}."
+   );
}
}
 
@@ -212,7 +215,8 @@
$autoEnrollForThisPref = false;
 
if ( isset( $info['group'] ) && isset( 
$autoEnroll[$info['group']] ) ) {
-   $autoEnrollForThisPref = $user->getOption( 
$autoEnroll[$info['group']] ) === HTMLFeatureField::OPTION_ENABLED;
+   $autoEnrollForThisPref =
+   $user->getOption( 
$autoEnroll[$info['group']] ) === HTMLFeatureField::OPTION_ENABLED;
}
 
$autoEnrollHere = $autoEnrollAll === true || 
$autoEnrollForThisPref === true;
@@ -235,7 +239,7 @@
// Check which other beta features are 
required, and fetch their labels
if ( isset( 
$prefs[$key]['requirements']['betafeatures'] ) ) {
$requiredPrefs = array();
-   foreach( 
$prefs[$key]['requirements']['betafeatures'] as $preference ) {
+   foreach ( 
$prefs[$key]['requirements']['betafeatures'] as $preference ) {
if ( !$user->getOption( 
$preference ) ) {
$requiredPrefs[] = 
$prefs[$preference]['label-message'];
}
@@ -298,7 +302,9 @@
$personal_urls = wfArrayInsertAfter( $personal_urls, 
array(
'betafeatures' => array(
'text' => wfMessage( 
'betafeatures-toplink' )->text(),
-   'href' => SpecialPage::getTitleFor( 
'Preferences', false, 'mw-prefsection-betafeatures' )->getLinkURL(),
+   'href' => SpecialPage::getTitleFor(
+   'Preferences', false, 
'mw-prefsection-betafeatures'
+   )->getLinkURL(),
'active' => $title->isSpecial( 
'Preferences' ),
),
), 'preferences' );
diff --git a/in

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

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

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

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

Migrate to JSON configuration based extension registration

Retaining the UniversalLanguageSelector.pho and Resources.php
to avoid breaking support for old MW versions. At some point,
we can validate how many old MW versions we need to support.

Change-Id: I006e968b70298b54013177aa792a4dfdf5b6aae2
---
A extension.json
1 file changed, 383 insertions(+), 0 deletions(-)


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

diff --git a/extension.json b/extension.json
new file mode 100644
index 000..727c6d4
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,383 @@
+{
+   "name": "UniversalLanguageSelector",
+   "version": "2015-06-08",
+   "author": [
+   "Alolita Sharma",
+   "Amir Aharoni",
+   "Arun Ganesh",
+   "Brandon Harris",
+   "Niklas Laxström",
+   "Pau Giner",
+   "Santhosh Thottingal",
+   "Siebrand Mazeland"
+   ],
+   "url": 
"https://www.mediawiki.org/wiki/Extension:UniversalLanguageSelector";,
+   "descriptionmsg": "uls-desc",
+   "license-name": "GPL-2.0+",
+   "Hooks": {
+   "BeforePageDisplay": 
"UniversalLanguageSelectorHooks::addModules",
+   "ResourceLoaderGetConfigVars": 
"UniversalLanguageSelectorHooks::addConfig",
+   "PersonalUrls": 
"UniversalLanguageSelectorHooks::addPersonalBarTrigger",
+   "EventLoggingRegisterSchemas": 
"UniversalLanguageSelectorHooks::onEventLoggingRegisterSchemas",
+   "ResourceLoaderTestModules": 
"UniversalLanguageSelectorHooks::addTestModules",
+   "MakeGlobalVariablesScript": 
"UniversalLanguageSelectorHooks::addVariables",
+   "UserGetLanguageObject": 
"UniversalLanguageSelectorHooks::getLanguage",
+   "SkinTemplateOutputPageBeforeExec": 
"UniversalLanguageSelectorHooks::onSkinTemplateOutputPageBeforeExec",
+   "EnterMobileMode": 
"UniversalLanguageSelectorHooks::onEnterMobileMode"
+   },
+   "APIModules": {
+   "languagesearch": "ApiLanguageSearch",
+   "ulslocalization": "ApiULSLocalization"
+   },
+   "MessagesDirs": {
+   "UniversalLanguageSelector": "i18n"
+   },
+   "AutoloadClasses": {
+   "UniversalLanguageSelectorHooks": 
"UniversalLanguageSelector.hooks.php",
+   "ResourceLoaderULSModule": 
"includes/ResourceLoaderULSModule.php",
+   "ResourceLoaderULSJsonMessageModule": 
"includes/ResourceLoaderULSJsonMessageModule.php",
+   "ApiLanguageSearch": "api/ApiLanguageSearch.php",
+   "ApiULSLocalization": "api/ApiULSLocalization.php",
+   "ULSJsonMessageLoader": "includes/ULSJsonMessageLoader.php",
+   "LanguageNameSearch": "data/LanguageNameSearch.php"
+   },
+   "DefaultUserOptions": {
+   "echo-subscriptions-web-cx": true
+   },
+   "config": {
+   "ULSGeoService": true,
+   "ULSEnable": true,
+   "ULSEnableAnon": true,
+   "ULSAnonCanChangeLanguage": true,
+   "ULSLanguageDetection": true,
+   "ULSIMEEnabled": true,
+   "ULSWebfontsEnabled": true,
+   "ULSMobileWebfontsEnabled": true,
+   "@ULSPosition": "The location and the form of the language 
selection trigger.  The possible values are: (a) \"personal\"- as a link near 
the username or the log in link in the personal toolbar (default). (b) 
\"interlanguage\": as an icon near the header of the list of interlanguage  
links in the sidebar.",
+   "ULSPosition": "personal",
+   "ULSEventLogging": false,
+   "ULSImeSelectors": [
+   "input:not([type])",
+   "input[type=text]",
+   "input[type=search]",
+   "textarea",
+   "[contenteditable]"
+   ],
+   "ULSNoImeSelectors": [ "#wpCaptchaWord", ".ve-ce-surface *" ],
+   "ULSNoWebfontsSelectors": [ "#p-lang li.interlanguage-link > a" 
],
+   "ULSFontRepositoryBasePath": false,
+   "ULSCompactLinks": false
+   },
+   "ResourceModules": {
+   "ext.uls.languagenames": {
+   "class": "ResourceLoaderULSModule"
+   },
+   "ext.uls.messages": {
+   "class": "ResourceLoaderULSJsonMessageModule",
+   "dependencies": "ext.uls.i18n",
+   "localBasePath": "resources",
+   "remoteExtPath": "UniversalLanguageSelector/resources"

<    1   2   3   4   5   6   7   8   9   10   >