update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Piwik - Web Analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -8,11 +8,12 @@
|
|||
function initDashboard(dashboardId, dashboardLayout) {
|
||||
|
||||
$('.dashboardSettings').show();
|
||||
initTopControls();
|
||||
|
||||
// Embed dashboard
|
||||
if (!$('#topBars').length) {
|
||||
if (!$('#header .navbar-right').length) {
|
||||
$('.dashboardSettings').after($('#Dashboard'));
|
||||
$('#Dashboard_embeddedIndex_' + dashboardId).addClass('sfHover');
|
||||
$('#Dashboard_embeddedIndex_' + dashboardId).addClass('sfActive');
|
||||
}
|
||||
|
||||
widgetsHelper.getAvailableWidgets();
|
||||
|
|
@ -167,21 +168,15 @@ function copyDashboardToUser() {
|
|||
// on menu item click, trigger action event on this
|
||||
var self = this;
|
||||
this.$element.on('click', 'ul.submenu li[data-action]', function (e) {
|
||||
self.$element.toggleClass('visible');
|
||||
|
||||
$(self).trigger($(this).attr('data-action'));
|
||||
if (!$(this).attr('disabled')) {
|
||||
self.$element.removeClass('expanded');
|
||||
$(self).trigger($(this).attr('data-action'));
|
||||
}
|
||||
});
|
||||
|
||||
// open manager on open
|
||||
this.$element.on('click', function (e) {
|
||||
if ($(e.target).is('.dashboardSettings,.dashboardSettings>span')) {
|
||||
self.$element.toggleClass('visible');
|
||||
|
||||
// fix position
|
||||
self.$element
|
||||
.find('.widgetpreview-widgetlist')
|
||||
.css('paddingTop', self.$element.find('.widgetpreview-categorylist').parent('li').position().top);
|
||||
|
||||
if ($(e.target).is('.dashboardSettings') || $(e.target).closest('.dashboardSettings').length) {
|
||||
self.onOpen();
|
||||
}
|
||||
});
|
||||
|
|
@ -192,7 +187,7 @@ function copyDashboardToUser() {
|
|||
&& !$(e.target).is('.dashboardSettings')
|
||||
) {
|
||||
self.$element.widgetPreview('reset');
|
||||
self.$element.removeClass('visible');
|
||||
self.$element.removeClass('expanded');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -205,7 +200,7 @@ function copyDashboardToUser() {
|
|||
},
|
||||
onSelect: function (widgetUniqueId) {
|
||||
var widget = widgetsHelper.getWidgetObjectFromUniqueId(widgetUniqueId);
|
||||
self.$element.removeClass('visible');
|
||||
self.$element.removeClass('expanded');
|
||||
|
||||
self.widgetSelected(widget);
|
||||
},
|
||||
|
|
@ -278,15 +273,29 @@ function copyDashboardToUser() {
|
|||
|
||||
$.extend(DashboardManagerControl.prototype, DashboardSettingsControlBase.prototype, {
|
||||
onOpen: function () {
|
||||
if ($('#dashboardWidgetsArea').dashboard('isDefaultDashboard')) {
|
||||
$('.removeDashboardLink', this.$element).hide();
|
||||
if ($('#dashboardWidgetsArea').dashboard('isDefaultDashboard')) {
|
||||
$('[data-action=removeDashboard]', this.$element).attr('disabled', 'disabled');
|
||||
$(this.$element).tooltip({
|
||||
items: '[data-action=removeDashboard]',
|
||||
show: false,
|
||||
hide: false,
|
||||
track: true,
|
||||
content: function() {
|
||||
return _pk_translate('Dashboard_RemoveDefaultDashboardNotPossible')
|
||||
},
|
||||
tooltipClass: 'small'
|
||||
});
|
||||
} else {
|
||||
$('.removeDashboardLink', this.$element).show();
|
||||
}
|
||||
$('[data-action=removeDashboard]', this.$element).removeAttr('disabled');
|
||||
// try to remove tooltip if any
|
||||
try {
|
||||
$(this.$element).tooltip('destroy');
|
||||
} catch (e) { }
|
||||
}
|
||||
},
|
||||
|
||||
hide: function () {
|
||||
this.$element.removeClass('visible');
|
||||
this.$element.removeClass('expanded');
|
||||
},
|
||||
|
||||
isWidgetAvailable: function (widgetUniqueId) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Piwik - Web Analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -297,8 +297,49 @@
|
|||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < columnCount; i++) {
|
||||
$('.col', dashboardElement)[i].className = 'col width-' + columnWidth[i];
|
||||
switch (layout) {
|
||||
case '100':
|
||||
$('.col', dashboardElement).removeClass()
|
||||
.addClass('col col-sm-12');
|
||||
break;
|
||||
case '50-50':
|
||||
$('.col', dashboardElement).removeClass()
|
||||
.addClass('col col-sm-6');
|
||||
break;
|
||||
case '67-33':
|
||||
$('.col', dashboardElement)[0].className = 'col col-sm-8';
|
||||
$('.col', dashboardElement)[1].className = 'col col-sm-4';
|
||||
break;
|
||||
case '33-67':
|
||||
$('.col', dashboardElement)[0].className = 'col col-sm-4';
|
||||
$('.col', dashboardElement)[1].className = 'col col-sm-8';
|
||||
break;
|
||||
case '33-33-33':
|
||||
$('.col', dashboardElement)[0].className = 'col col-sm-4';
|
||||
$('.col', dashboardElement)[1].className = 'col col-sm-4';
|
||||
$('.col', dashboardElement)[2].className = 'col col-sm-4';
|
||||
break;
|
||||
case '40-30-30':
|
||||
$('.col', dashboardElement)[0].className = 'col col-sm-6';
|
||||
$('.col', dashboardElement)[1].className = 'col col-sm-3';
|
||||
$('.col', dashboardElement)[2].className = 'col col-sm-3';
|
||||
break;
|
||||
case '30-40-30':
|
||||
$('.col', dashboardElement)[0].className = 'col col-sm-3';
|
||||
$('.col', dashboardElement)[1].className = 'col col-sm-6';
|
||||
$('.col', dashboardElement)[2].className = 'col col-sm-3';
|
||||
break;
|
||||
case '30-30-40':
|
||||
$('.col', dashboardElement)[0].className = 'col col-sm-3';
|
||||
$('.col', dashboardElement)[1].className = 'col col-sm-3';
|
||||
$('.col', dashboardElement)[2].className = 'col col-sm-6';
|
||||
break;
|
||||
case '25-25-25-25':
|
||||
$('.col', dashboardElement)[0].className = 'col col-sm-3';
|
||||
$('.col', dashboardElement)[1].className = 'col col-sm-3';
|
||||
$('.col', dashboardElement)[2].className = 'col col-sm-3';
|
||||
$('.col', dashboardElement)[3].className = 'col col-sm-3';
|
||||
break;
|
||||
}
|
||||
|
||||
makeWidgetsSortable();
|
||||
|
|
@ -436,25 +477,26 @@
|
|||
return $(this).attr('id').indexOf('Dashboard_embeddedIndex') == 0;
|
||||
}).remove();
|
||||
|
||||
if (dashboards.length === 0) {
|
||||
dashboards = [{iddashboard: 1, name: _pk_translate('Dashboard_Dashboard')}];
|
||||
}
|
||||
|
||||
if (dashboards.length > 1
|
||||
|| dashboardMenuListItems.length >= 1
|
||||
) {
|
||||
dashboardMenuList.show();
|
||||
var items = [];
|
||||
for (var i = 0; i < dashboards.length; i++) {
|
||||
var $link = $('<a/>').attr('data-idDashboard', dashboards[i].iddashboard).text(dashboards[i].name);
|
||||
var $link = $('<a/>').attr('data-idDashboard', dashboards[i].iddashboard).text(dashboards[i].name).addClass('item title');
|
||||
var $li = $('<li/>').attr('id', 'Dashboard_embeddedIndex_' + dashboards[i].iddashboard)
|
||||
.addClass('dashboardMenuItem').append($link);
|
||||
items.push($li);
|
||||
|
||||
if (dashboards[i].iddashboard == dashboardId) {
|
||||
dashboardName = dashboards[i].name;
|
||||
$li.addClass('sfHover');
|
||||
$li.addClass('sfActive');
|
||||
}
|
||||
}
|
||||
dashboardMenuList.prepend(items);
|
||||
} else {
|
||||
dashboardMenuList.hide();
|
||||
}
|
||||
|
||||
dashboardMenuList.find('a[data-idDashboard]').click(function (e) {
|
||||
|
|
@ -465,13 +507,13 @@
|
|||
if (typeof piwikMenu != 'undefined') {
|
||||
piwikMenu.activateMenu('Dashboard', 'embeddedIndex');
|
||||
}
|
||||
$('#Dashboard ul li').removeClass('sfHover');
|
||||
$('#Dashboard ul li').removeClass('sfActive');
|
||||
if ($(dashboardElement).length) {
|
||||
$(dashboardElement).dashboard('loadDashboard', idDashboard);
|
||||
} else {
|
||||
broadcast.propagateAjax('module=Dashboard&action=embeddedIndex&idDashboard=' + idDashboard);
|
||||
}
|
||||
$(this).closest('li').addClass('sfHover');
|
||||
$(this).closest('li').addClass('sfActive');
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Piwik - Web Analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -118,9 +118,12 @@
|
|||
var self = this, currentWidget = this.element;
|
||||
|
||||
function onWidgetLoadedReplaceElementWithContent(loadedContent) {
|
||||
$('.widgetContent', currentWidget).html(loadedContent);
|
||||
$('.widgetContent', currentWidget).removeClass('loading');
|
||||
$('.widgetContent', currentWidget).trigger('widget:create', [self]);
|
||||
var $widgetContent = $('.widgetContent', currentWidget);
|
||||
|
||||
$widgetContent.html(loadedContent);
|
||||
piwikHelper.compileAngularComponents($widgetContent);
|
||||
$widgetContent.removeClass('loading');
|
||||
$widgetContent.trigger('widget:create', [self]);
|
||||
}
|
||||
|
||||
// Reading segment from hash tag (standard case) or from the URL (when embedding dashboard)
|
||||
|
|
@ -134,7 +137,19 @@
|
|||
}
|
||||
|
||||
var params = $.extend(this.widgetParameters, overrideParams || {});
|
||||
widgetsHelper.loadWidgetAjax(this.uniqueId, params, onWidgetLoadedReplaceElementWithContent);
|
||||
widgetsHelper.loadWidgetAjax(this.uniqueId, params, onWidgetLoadedReplaceElementWithContent, function (deferred, status) {
|
||||
if (status == 'abort' || !deferred || deferred.status < 400 || deferred.status >= 600) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('.widgetContent', currentWidget).removeClass('loading');
|
||||
var errorMessage = _pk_translate('General_ErrorRequest', ['', '']);
|
||||
if ($('#loadingError').html()) {
|
||||
errorMessage = $('#loadingError').html();
|
||||
}
|
||||
|
||||
$('.widgetContent', currentWidget).html('<div class="widgetLoadingError">' + errorMessage + '</div>');
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
|
@ -283,6 +298,8 @@
|
|||
|
||||
var width = Math.floor($('body').width() * 0.7);
|
||||
|
||||
var isFooterExpanded = $('.dataTableFeatures', this.element).hasClass('expanded');
|
||||
|
||||
var self = this;
|
||||
this.element.dialog({
|
||||
title: '',
|
||||
|
|
@ -293,6 +310,9 @@
|
|||
autoOpen: true,
|
||||
close: function (event, ui) {
|
||||
self.isMaximised = false;
|
||||
if (!isFooterExpanded) {
|
||||
$('.dataTableFeatures', self.element).removeClass('expanded');
|
||||
}
|
||||
$('body').off('.dashboardWidget');
|
||||
$(this).dialog("destroy");
|
||||
$('#' + self.uniqueId + '-placeholder').replaceWith(this);
|
||||
|
|
@ -303,6 +323,7 @@
|
|||
}
|
||||
});
|
||||
this.element.find('div.piwik-graph').trigger('resizeGraph');
|
||||
$('.dataTableFeatures', this.element).addClass('expanded');
|
||||
|
||||
var currentWidget = this.element;
|
||||
$('body').on('click.dashboardWidget', function (ev) {
|
||||
|
|
@ -328,4 +349,4 @@
|
|||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
})(jQuery);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Piwik - Web Analytics
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
|
|
@ -72,7 +72,7 @@ widgetsHelper.getWidgetNameFromUniqueId = function (uniqueId) {
|
|||
* @param {function} onWidgetLoadedCallback callback to be executed after widget is loaded
|
||||
* @return {object}
|
||||
*/
|
||||
widgetsHelper.loadWidgetAjax = function (widgetUniqueId, widgetParameters, onWidgetLoadedCallback) {
|
||||
widgetsHelper.loadWidgetAjax = function (widgetUniqueId, widgetParameters, onWidgetLoadedCallback, onWidgetErrorCallback) {
|
||||
var disableLink = broadcast.getValueFromUrl('disableLink');
|
||||
if (disableLink.length) {
|
||||
widgetParameters['disableLink'] = disableLink;
|
||||
|
|
@ -83,6 +83,9 @@ widgetsHelper.loadWidgetAjax = function (widgetUniqueId, widgetParameters, onWid
|
|||
var ajaxRequest = new ajaxHelper();
|
||||
ajaxRequest.addParams(widgetParameters, 'get');
|
||||
ajaxRequest.setCallback(onWidgetLoadedCallback);
|
||||
if (onWidgetErrorCallback) {
|
||||
ajaxRequest.setErrorCallback(onWidgetErrorCallback);
|
||||
}
|
||||
ajaxRequest.setFormat('html');
|
||||
ajaxRequest.send(false);
|
||||
return ajaxRequest;
|
||||
|
|
@ -224,7 +227,12 @@ widgetsHelper.loadWidgetAjax = function (widgetUniqueId, widgetParameters, onWid
|
|||
|
||||
if ($('.' + settings.categorylistClass + ' .' + settings.choosenClass, widgetPreview).length) {
|
||||
var position = $('.' + settings.categorylistClass + ' .' + settings.choosenClass, widgetPreview).position().top -
|
||||
$('.' + settings.categorylistClass, widgetPreview).position().top;
|
||||
$('.' + settings.categorylistClass, widgetPreview).position().top +
|
||||
$('.dashboard-manager .addWidget').outerHeight();
|
||||
|
||||
if (!$('#content.admin').length) {
|
||||
position += 10; // + padding defined in dashboard view
|
||||
}
|
||||
|
||||
$('.' + settings.widgetlistClass, widgetPreview).css('top', position);
|
||||
$('.' + settings.widgetlistClass, widgetPreview).css('marginBottom', position);
|
||||
|
|
@ -278,6 +286,7 @@ widgetsHelper.loadWidgetAjax = function (widgetUniqueId, widgetParameters, onWid
|
|||
$('li:not(.' + settings.unavailableClass + ')', widgetList).on('click', function () {
|
||||
if (!$('.widgetLoading', widgetPreview).length) {
|
||||
settings.onSelect($(this).attr('uniqueid'));
|
||||
$(widgetPreview).closest('.dashboard-manager').removeClass('expanded');
|
||||
if (settings.resetOnSelect) {
|
||||
resetWidgetPreview(widgetPreview);
|
||||
}
|
||||
|
|
@ -338,6 +347,7 @@ widgetsHelper.loadWidgetAjax = function (widgetUniqueId, widgetParameters, onWid
|
|||
settings.onPreviewLoaded(widgetUniqueId, widgetElement);
|
||||
$('.' + settings.widgetpreviewClass + ' .widgetTop', widgetPreview).on('click', function () {
|
||||
settings.onSelect(widgetUniqueId);
|
||||
$(widgetPreview).closest('.dashboard-manager').removeClass('expanded');
|
||||
if (settings.resetOnSelect) {
|
||||
resetWidgetPreview(widgetPreview);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue