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

export-widget.controller.js « export-widget « angularjs « Widgetize « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 821fcb5ff71c52e81bba868ebb74bff938ff993e (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
/*!
 * Piwik - free/libre analytics platform
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */
(function () {
    angular.module('piwikApp').controller('ExportWidgetController', ExportWidgetController);

    ExportWidgetController.$inject = ['piwik', '$window'];

    function ExportWidgetController(piwik, $window) {

        function getIframeCode(iframeUrl)
        {
            var url = iframeUrl.replace(/"/g, '"');

            return '<iframe src="' + url + '" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%"></iframe>';
        }

        // remember to keep controller very simple. Create a service/factory (model) if needed
        var urlPath = $window.location.protocol + '//' + $window.location.hostname + ($window.location.port == '' ? '' : (':' + $window.location.port)) + $window.location.pathname;
        this.dashboardUrl = urlPath + '?module=Widgetize&action=iframe&moduleToWidgetize=Dashboard&actionToWidgetize=index&idSite=' + piwik.idSite + '&period=week&date=yesterday';
        this.dashboardCode = getIframeCode(this.dashboardUrl);

        this.allWebsitesDashboardUrl = urlPath + '?module=Widgetize&action=iframe&moduleToWidgetize=MultiSites&actionToWidgetize=standalone&idSite=' + piwik.idSite + '&period=week&date=yesterday';
        this.allWebsitesDashboardCode = getIframeCode(this.allWebsitesDashboardUrl);
    }
})();