1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*!
* Piwik - Web Analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
/**
* This file registers the Overlay row action on the pages report.
*/
function DataTable_RowActions_Overlay(dataTable) {
this.dataTable = dataTable;
}
DataTable_RowActions_Overlay.prototype = new DataTable_RowAction;
DataTable_RowActions_Overlay.prototype.onClick = function (actionA, tr, e) {
if (!actionA.data('overlay-manipulated')) {
actionA.data('overlay-manipulated', 1);
var link = tr.find('> td:first > a').attr('href');
link = $('<textarea>').html(link).val(); // remove html entities
actionA.attr({
target: '_blank',
href: Overlay_Helper.getOverlayLink(this.dataTable.param.idSite, 'month', 'today', link)
});
}
return true;
};
DataTable_RowActions_Registry.register({
name: 'Overlay',
dataTableIcon: 'plugins/Overlay/images/overlay_icon.png',
dataTableIconHover: 'plugins/Overlay/images/overlay_icon_hover.png',
order: 30,
dataTableIconTooltip: [
_pk_translate('General_OverlayRowActionTooltipTitle_js'),
_pk_translate('General_OverlayRowActionTooltip_js')
],
createInstance: function (dataTable) {
return new DataTable_RowActions_Overlay(dataTable);
},
isAvailableOnReport: function (dataTableParams) {
// Overlay plugin only works when Transitions plugin is enabled
if (!window.DataTable_RowActions_Transitions) {
return false;
}
return DataTable_RowActions_Transitions.isPageUrlReport(dataTableParams.module, dataTableParams.action);
},
isAvailableOnRow: function (dataTableParams, tr) {
var transitions = DataTable_RowActions_Registry.getActionByName('Transitions');
return transitions.isAvailableOnRow(dataTableParams, tr);
}
});
|