Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/206373
Change subject: Special:CXStats - use same full screen layout of Special:CX ...................................................................... Special:CXStats - use same full screen layout of Special:CX Also add a campaign(id: cxstats) to enable CX beta feature for those who did not enable it already. All campaigns are with eventlogging tooling Change-Id: Ic7eb77b36eb07e98bb10b5d5e883125a7802a1f4 --- M ContentTranslation.php M Resources.php M i18n/en.json M i18n/qqq.json M modules/stats/ext.cx.stats.js M modules/stats/styles/ext.cx.stats.less M specials/SpecialContentTranslationStats.php 7 files changed, 69 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/73/206373/1 diff --git a/ContentTranslation.php b/ContentTranslation.php index 149c0a3..9687023 100644 --- a/ContentTranslation.php +++ b/ContentTranslation.php @@ -146,8 +146,8 @@ */ $GLOBALS['wgContentTranslationTargetNamespace'] = 'Main'; -// List of campaigns enabled. Available campaigns: 'newarticle' -$GLOBALS['wgContentTranslationCampaigns'] = array(); +// List of campaigns enabled. Available campaigns: 'newarticle', 'cxstats' +$GLOBALS['wgContentTranslationCampaigns'] = array('cxstats'); /* * Whether the Magnus tool to find missing articles to be enabled or not. diff --git a/Resources.php b/Resources.php index 906f6a7..268d835 100644 --- a/Resources.php +++ b/Resources.php @@ -686,6 +686,7 @@ 'cx-stats-published-translators-title', 'cx-trend-all-translations', 'cx-trend-translations-to', + 'cx-stats-try-contenttranslation', ) ) + $resourcePaths; diff --git a/i18n/en.json b/i18n/en.json index c4ac923..b2edbe8 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -173,5 +173,6 @@ "cx-campaign-contributionsmenu-mytranslations": "Translations", "cx-campaign-contributionsmenu-myuploads": "Uploaded media", "cx-trend-all-translations": "All translations", - "cx-trend-translations-to": "Translations to $1 language" + "cx-trend-translations-to": "Translations to $1 language", + "cx-stats-try-contenttranslation": "Content Translation is a tool to create new pages by translating from other languages. [$1 Try Content Translation]" } diff --git a/i18n/qqq.json b/i18n/qqq.json index d07b425..499f9b4 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -177,5 +177,6 @@ "cx-campaign-contributionsmenu-mytranslations": "Menu item for menu shown while hovering the contributions link in personal toolbar. Points to the Content Translation dashboard\n{{Identical|Translation}}", "cx-campaign-contributionsmenu-myuploads": "Menu item for menu shown while hovering the contributions link in personal toolbar. Points to the Special:MyUploads in commons", "cx-trend-all-translations": "Label shown in the legend section Content translation trends(graph visualization)", - "cx-trend-translations-to": "Label shown in the legend section Content translation trends(graph visualization)\n$1 - language name" + "cx-trend-translations-to": "Label shown in the legend section Content translation trends(graph visualization)\n$1 - language name", + "cx-stats-try-contenttranslation": "A message shown in [[Special:CXStats]] for users not enabled Content Translation . \n$1 - link to enable Content Translation beta featue and go to Content Translation dashboard" } diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js index e9e7121..be6675b 100644 --- a/modules/stats/ext.cx.stats.js +++ b/modules/stats/ext.cx.stats.js @@ -257,8 +257,28 @@ } $( function () { - var $canvas, ctx, - $container = $( '#bodyContent' ); + var $canvas, ctx, cxLink, + $header = $( '<div>' ).addClass( 'cx-widget__header' ), + $container = $( '<div>' ).addClass( 'cx-stats-container' ); + + // Set the global siteMapper for code which we cannot inject it + mw.cx.siteMapper = new mw.cx.SiteMapper( mw.config.get( 'wgContentTranslationSiteTemplates' ) ); + $( 'body' ).append( + $( '<div>' ).addClass( 'cx-widget' ) + .append( $header, $container ) + ); + $header.cxHeader( mw.cx.siteMapper ); + + if ( mw.user.options.get( 'cx' ) !== '1' ) { + cxLink = mw.util.getUrl( 'Special:ContentTranslation', { + campaign: 'cxstats', + targettitle: mw.config.get( 'wgPageName' ), + to: mw.config.get( 'wgContentLanguage' ) + } ); + + $( '.cx-header__bar' ).hide(); + mw.hook( 'mw.cx.error' ).fire( mw.message( 'cx-stats-try-contenttranslation', cxLink ) ); + } $canvas = $( '<canvas>' ).attr( { id: 'cxtrend', diff --git a/modules/stats/styles/ext.cx.stats.less b/modules/stats/styles/ext.cx.stats.less index 99e818c..6f7a9ac 100644 --- a/modules/stats/styles/ext.cx.stats.less +++ b/modules/stats/styles/ext.cx.stats.less @@ -1,3 +1,12 @@ + .cx-stats-container { + margin: 20px; + clear: both; +} + +.cx-header__publish { + display: none; +} + .cx-stats { border-collapse: collapse; border: 1px solid black; diff --git a/specials/SpecialContentTranslationStats.php b/specials/SpecialContentTranslationStats.php index 1a91115..c3c1c39 100644 --- a/specials/SpecialContentTranslationStats.php +++ b/specials/SpecialContentTranslationStats.php @@ -22,12 +22,39 @@ public function execute( $parameters ) { $out = $this->getOutput(); + $skin = $this->getSkin(); $this->setHeaders(); - $this->outputHeader(); + $out->setArticleBodyOnly( true ); + // Default modules copied from OutputPage::addDefaultModules + $out->addModules( array( + 'mediawiki.user', + 'mediawiki.page.startup', + 'mediawiki.page.ready', + ) ); + $out->addModules( array('ext.cx.header' , 'ext.cx.stats' ) ); + // Load legacy modules if any, for the skin. + // Some wikis have Common.js scripts that depend on this module. + $defaultSkinModules = $skin->getDefaultModules(); + $out->addModules( $defaultSkinModules['legacy'] ); - // @TODO better to return title => stats iterator - $stats = ContentTranslation\Stats::getStats(); - $out->addModules( 'ext.cx.stats' ); + wfRunHooks( 'BeforePageDisplay', array( &$out, &$skin ) ); + + $out->addHTML( $out->headElement( $skin ) ); + $out->addHTML( Html::element( + 'noscript', + array(), + $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 ) ); + + $out->addHTML( $skin->bottomScripts() ); + $out->addHTML( '</body></html>' ); } } -- To view, visit https://gerrit.wikimedia.org/r/206373 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic7eb77b36eb07e98bb10b5d5e883125a7802a1f4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits