diff options
author | Stefan Giehl <stefan@piwik.org> | 2018-03-22 05:38:47 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2018-03-22 05:38:47 +0300 |
commit | 23a458abf86e53c1f2103129f40687f2f0279157 (patch) | |
tree | 2ca6efea0e918f3b306f831ef7415ba1bedc221e /plugins/CoreHome/javascripts | |
parent | 19ed4785db66566befae9ba65956df848825acd8 (diff) |
Export overlay for Datatables (#11958)
* Implements export overlay for datatables
* use popover instead of modal
* use radio instead of select
* fix positioning of popover
* improve popover; translations
* adjust tests
* update ui files
* add options for flatten & expanded
* make export popover work with other popover
- old popover will be recreated when export popover is closed
* improve export url creation
* update ui files
Diffstat (limited to 'plugins/CoreHome/javascripts')
-rw-r--r-- | plugins/CoreHome/javascripts/dataTable.js | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/plugins/CoreHome/javascripts/dataTable.js b/plugins/CoreHome/javascripts/dataTable.js index de620eb703..37a7e9548b 100644 --- a/plugins/CoreHome/javascripts/dataTable.js +++ b/plugins/CoreHome/javascripts/dataTable.js @@ -1168,157 +1168,6 @@ $.extend(DataTable.prototype, UIControl.prototype, { self.graphViewEnabled = 0; self.graphViewStartingThreads = 0; self.graphViewStartingKeep = false; //show keep flag - - //handle exportToFormat icons - self.exportToFormat = null; - $('.exportToFormatIcons a', domElem).click(function () { - self.exportToFormat = {}; - self.exportToFormat.lastActiveIcon = this; - self.exportToFormat.target = $(this).parent().siblings('.exportToFormatItems').show('fast'); - self.exportToFormat.obj = $(this).hide(); - }); - - //close exportToFormat onClickOutside - self._bodyMouseUp = function (e) { - if (self.exportToFormat) { - self.exportToFormatHide(domElem); - } - }; - $('body').on('mouseup', self._bodyMouseUp); - - $('.exportToFormatItems a', domElem) - // prevent click jacking attacks by dynamically adding the token auth when the link is clicked - .click(function () { - $(this).attr('href', function () { - var url = $(this).attr('href') + '&token_auth=' + piwik.token_auth; - - var limit = $('.limitSelection>div>span', domElem).attr('value'); - var defaultLimit = $(this).attr('filter_limit'); - if (!limit || 'undefined' === limit || defaultLimit == -1) { - limit = defaultLimit; - } - url += '&filter_limit=' + limit; - - return url; - }) - }) - .attr('href', function () { - var format = $(this).attr('format'); - var method = $(this).attr('methodToCall'); - var params = $(this).attr('requestParams'); - - if (params) { - params = JSON.parse(params) - } else { - params = {}; - } - - var segment = self.param.segment; - var label = self.param.label; - var idGoal = self.param.idGoal; - var idDimension = self.param.idDimension; - var param_date = self.param.date; - var date = $(this).attr('date'); - if (typeof date != 'undefined') { - param_date = date; - } - if (typeof self.param.dateUsedInGraph != 'undefined') { - param_date = self.param.dateUsedInGraph; - } - var period = self.param.period; - - var formatsUseDayNotRange = piwik.config.datatable_export_range_as_day.toLowerCase(); - if (!format) { - // eg export as image has no format - return; - } - - if (formatsUseDayNotRange.indexOf(format.toLowerCase()) != -1 - && self.param.period == 'range') { - period = 'day'; - } - - // Below evolution graph, show daily exports - if(self.param.period == 'range' - && self.param.viewDataTable == "graphEvolution") { - period = 'day'; - } - - var str = 'index.php?module=API' - + '&method=' + method - + '&format=' + format - + '&idSite=' + self.param.idSite - + '&period=' + period - + '&date=' + param_date - + ( typeof self.param.filter_pattern != "undefined" ? '&filter_pattern=' + self.param.filter_pattern : '') - + ( typeof self.param.filter_pattern_recursive != "undefined" ? '&filter_pattern_recursive=' + self.param.filter_pattern_recursive : ''); - - if ($.isPlainObject(params)) { - $.each(params, function (index, param) { - str += '&' + index + '=' + encodeURIComponent(param); - }); - } - - if (typeof self.param.flat != "undefined") { - str += '&flat=' + (self.param.flat == 0 ? '0' : '1'); - if (typeof self.param.include_aggregate_rows != "undefined" && self.param.include_aggregate_rows == '1') { - str += '&include_aggregate_rows=1'; - } - if (!self.param.flat - && typeof self.param.filter_pattern_recursive != "undefined" - && self.param.filter_pattern_recursive) { - str += '&expanded=1'; - } - - } else { - str += '&expanded=1'; - } - if (self.param.pivotBy) { - str += '&pivotBy=' + self.param.pivotBy + '&pivotByColumnLimit=20'; - if (self.props.pivot_by_column) { - str += '&pivotByColumn=' + self.props.pivot_by_column; - } - } - if (format == 'CSV' || format == 'TSV' || format == 'RSS') { - str += '&translateColumnNames=1&language=' + piwik.language; - } - if (typeof segment != 'undefined') { - str += '&segment=' + segment; - } - // Export Goals specific reports - if (typeof idGoal != 'undefined' - && idGoal != '-1') { - str += '&idGoal=' + idGoal; - } - // Export Dimension specific reports - if (typeof idDimension != 'undefined' - && idDimension != '-1') { - str += '&idDimension=' + idDimension; - } - if (label) { - label = label.split(','); - - if (label.length > 1) { - for (var i = 0; i != label.length; ++i) { - str += '&label[]=' + encodeURIComponent(label[i]); - } - } else { - str += '&label=' + encodeURIComponent(label[0]); - } - } - return str; - } - ); - }, - - exportToFormatHide: function (domElem, noAnimation) { - var self = this; - if (self.exportToFormat) { - var animationSpeed = noAnimation ? 0 : 'fast'; - self.exportToFormat.target.hide(animationSpeed); - self.exportToFormat.obj.show(animationSpeed); - self.exportToFormat = null; - } }, handleConfigurationBox: function (domElem, callbackSuccess) { |