PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -0,0 +1,72 @@
/*!
* 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('LocationProviderSelectionController', LocationProviderSelectionController);
LocationProviderSelectionController.$inject = ['piwikApi'];
function LocationProviderSelectionController(piwikApi) {
var self = this;
this.isLoading = false;
this.updateLoading = {};
// handle 'refresh location' link click
this.refreshProviderInfo = function (providerId) {
this.updateLoading[providerId] = true;
// this should not be in a controller... ideally we fetch this data always from client side and do not
// prefill it server side
var $locationNode = $('.provider' + providerId + ' .location');
$locationNode.css('visibility', 'hidden');
piwikApi.fetch({
module: 'UserCountry',
action: 'getLocationUsingProvider',
id: providerId,
format: 'html'
}).then(function (response) {
self.updateLoading[providerId] = false;
$locationNode.html('<strong>' + response + '</strong>').css('visibility', 'visible');
}, function () {
self.updateLoading[providerId] = false;
});
};
this.save = function () {
if (!this.selectedProvider) {
return;
}
this.isLoading = true;
var parent = $(this).closest('p'),
loading = $('.loadingPiwik', parent),
ajaxSuccess = $('.success', parent);
piwikApi.withTokenInUrl();
piwikApi.fetch({
method: 'UserCountry.setLocationProvider',
providerId: this.selectedProvider
}).then(function () {
self.isLoading = false;
var UI = require('piwik/UI');
var notification = new UI.Notification();
notification.show(_pk_translate('General_Done'), {
context: 'success',
noclear: true,
type: 'toast',
id: 'userCountryLocationProvider'
});
notification.scrollToNotification();
}, function () {
self.isLoading = false;
});
};
}
})();

View File

@ -0,0 +1,33 @@
/*!
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
/**
* Usage:
* <div piwik-location-provider-selection>
*/
(function () {
angular.module('piwikApp').directive('piwikLocationProviderSelection', piwikLocationProviderSelection);
piwikLocationProviderSelection.$inject = ['piwik'];
function piwikLocationProviderSelection(piwik){
return {
restrict: 'A',
transclude: true,
controller: 'LocationProviderSelectionController',
controllerAs: 'locationSelector',
template: '<div ng-transclude></div>',
compile: function (element, attrs) {
return function (scope, element, attrs, controller) {
controller.selectedProvider = attrs.piwikLocationProviderSelection;
};
}
};
}
})();