Welcome to mirror list, hosted at ThFree Co, Russian Federation.

rowaction.js « javascripts « UserId « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eb78fac78d15a837ae2dc3daace49b6a198ba083 (plain)
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
66
67
68
69
70
71
72
73
/*!
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

/**
 * This file registers the visitor details overlay row action on the user IDs list page.
 */
(function () {

    var actionName = 'visitorDetails';

    function DataTable_RowActions_VisitorDetails(dataTable) {
        this.dataTable = dataTable;
        this.actionName = actionName;
        this.trEventName = 'piwikTriggerVisitorDetailsAction';
    }

    DataTable_RowActions_VisitorDetails.prototype = new DataTable_RowAction();

    DataTable_RowActions_VisitorDetails.prototype.performAction = function (label, tr, e) {
        var visitorId = this.getRowMetadata($(tr)).idvisitor || '';
        visitorId = encodeURIComponent(visitorId);
        if (visitorId.length > 0) {
            DataTable_RowAction.prototype.openPopover.apply(this, ['module=Live&action=getVisitorProfilePopup&visitorId=' + visitorId]);
        }
    };

    DataTable_RowActions_VisitorDetails.prototype.doOpenPopover = function (urlParam) {
        Piwik_Popover.createPopupAndLoadUrl(urlParam, _pk_translate('Live_VisitorProfile'), 'visitor-profile-popup');
    };

    DataTable_RowActions_Registry.register({

        name: actionName,

        instance: null,

        dataTableIcon: 'icon-visitor-profile',

        order: 30,

        dataTableIconTooltip: [
            _pk_translate('Live_ViewVisitorProfile'),
            ''
        ],

        isAvailableOnReport: function (dataTableParams, undefined) {
            return dataTableParams.module == 'UserId';
        },

        isAvailableOnRow: function (dataTableParams, tr) {
            return DataTable_RowAction.prototype.getRowMetadata(tr).hasOwnProperty('idvisitor');
        },

        createInstance: function (dataTable, param) {
            if (dataTable !== null && typeof dataTable.visitorDetailsInstance != 'undefined') {
                return dataTable.segmentVisitorLogInstance;
            }

            var instance = new DataTable_RowActions_VisitorDetails(dataTable);
            if (dataTable !== null) {
                dataTable.visitorDetailsInstance = instance;
            }

            this.instance = instance;

            return instance;
        }
    });
})();