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,39 @@
/*!
* 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('DelegateMobileMessagingSettingsController', DelegateMobileMessagingSettingsController);
DelegateMobileMessagingSettingsController.$inject = ['piwikApi', 'piwik'];
function DelegateMobileMessagingSettingsController(piwikApi, piwik) {
var self = this;
this.isLoading = false;
this.save = function () {
this.isLoading = true;
piwikApi.post(
{method: 'MobileMessaging.setDelegatedManagement'},
{delegatedManagement: (this.enabled == '1') ? 'true' : 'false'}
).then(function () {
var UI = require('piwik/UI');
var notification = new UI.Notification();
notification.show(_pk_translate('CoreAdminHome_SettingsSaveSuccess'), {
id: 'mobileMessagingSettings', context: 'success'
});
notification.scrollToNotification();
piwik.helper.redirect();
self.isLoading = false;
}, function () {
self.isLoading = false;
});
};
}
})();

View File

@@ -0,0 +1,110 @@
/*!
* 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('ManageMobilePhoneNumbersController', ManageMobilePhoneNumbersController);
ManageMobilePhoneNumbersController.$inject = ['piwikApi', 'piwik'];
function ManageMobilePhoneNumbersController(piwikApi, piwikk) {
// remember to keep controller very simple. Create a service/factory (model) if needed
var self = this;
this.isAddingPhonenumber = false;
this.canAddNumber = false;
this.isActivated = {};
this.validateActivationCode = function(phoneNumber, index) {
if (!this.validationCode || !this.validationCode[index] || this.validationCode[index] == '') {
return;
}
var verificationCode = this.validationCode[index];
var success = function (response) {
self.isChangingPhoneNumber = false;
var UI = require('piwik/UI');
var notification = new UI.Notification();
if (!response || !response.value) {
var message = _pk_translate('MobileMessaging_Settings_InvalidActivationCode');
notification.show(message, {
context: 'error',
id: 'MobileMessaging_ValidatePhoneNumber'
});
}
else {
var message = _pk_translate('MobileMessaging_Settings_PhoneActivated')
notification.show(message, {
context: 'success',
id: 'MobileMessaging_ValidatePhoneNumber'
});
self.isActivated[index] = true;
}
notification.scrollToNotification();
};
this.isChangingPhoneNumber = true;
piwikApi.post(
{method: 'MobileMessaging.validatePhoneNumber'},
{phoneNumber: phoneNumber, verificationCode: verificationCode},
{placeat: '#invalidVerificationCodeAjaxError'}
).then(success, function () {
self.isChangingPhoneNumber = false;
});
}
this.removePhoneNumber = function (phoneNumber) {
if (!phoneNumber) {
return;
}
this.isChangingPhoneNumber = true;
piwikApi.post(
{method: 'MobileMessaging.removePhoneNumber'},
{phoneNumber: phoneNumber},
{placeat: '#invalidVerificationCodeAjaxError'}
).then(function () {
self.isChangingPhoneNumber = false;
piwik.helper.redirect();
}, function () {
self.isChangingPhoneNumber = false;
});
}
this.validateNewPhoneNumberFormat = function () {
this.showSuspiciousPhoneNumber = $.trim(this.newPhoneNumber).lastIndexOf('0', 0) === 0;
this.canAddNumber = !!this.newPhoneNumber && this.newPhoneNumber != '';
};
this.addPhoneNumber = function() {
var phoneNumber = '+' + this.countryCallingCode + this.newPhoneNumber;
if (this.canAddNumber && phoneNumber.length > 1) {
this.isAddingPhonenumber = true;
piwikApi.post(
{method: 'MobileMessaging.addPhoneNumber'},
{phoneNumber: phoneNumber},
{placeat: '#ajaxErrorAddPhoneNumber'}
).then(function () {
self.isAddingPhonenumber = false;
piwik.helper.redirect();
}, function () {
self.isAddingPhonenumber = false;
});
}
}
}
})();

View File

@@ -0,0 +1,76 @@
/*!
* 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('ManageSmsProviderController', ManageSmsProviderController);
ManageSmsProviderController.$inject = ['piwikApi', 'piwik'];
function ManageSmsProviderController(piwikApi, piwik) {
var self = this;
this.isDeletingAccount = false;
this.isUpdatingAccount = false;
this.showAccountForm = false;
this.isUpdateAccountPossible = false;
this.credentials = '{}';
function deleteApiAccount() {
self.isDeletingAccount = true;
piwikApi.fetch(
{method: 'MobileMessaging.deleteSMSAPICredential'},
{placeat: '#ajaxErrorManageSmsProviderSettings'}
).then(function () {
self.isDeletingAccount = false;
piwik.helper.redirect();
}, function () {
self.isDeletingAccount = false;
});
}
this.showUpdateAccount = function () {
this.showAccountForm = true;
};
this.isUpdateAccountPossible = function () {
var self = this;
self.canBeUpdated = !!this.smsProvider;
var credentials = angular.fromJson(this.credentials);
angular.forEach(credentials, function(value, key) {
if (value == '') {
self.canBeUpdated = false;
}
});
return self.canBeUpdated;
};
this.updateAccount = function () {
if (this.isUpdateAccountPossible()) {
this.isUpdatingAccount = true;
piwikApi.post(
{method: 'MobileMessaging.setSMSAPICredential'},
{provider: this.smsProvider, credentials: angular.fromJson(this.credentials)},
{placeat: '#ajaxErrorManageSmsProviderSettings'}
).then(function () {
self.isUpdatingAccount = false;
piwik.helper.redirect();
}, function () {
self.isUpdatingAccount = false;
});
}
};
this.deleteAccount = function () {
piwikHelper.modalConfirm('#confirmDeleteAccount', {yes: deleteApiAccount});
};
}
})();

View File

@@ -0,0 +1,51 @@
/*!
* 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 sms-provider-credentials provider="providername">
*/
(function () {
angular.module('piwikApp').directive('smsProviderCredentials', smsProviderCredentials);
function smsProviderCredentials() {
return {
restrict: 'A',
require:"^ngModel",
transclude: true,
scope: {
provider: '=',
credentials: '=value'
},
template: '<ng-include src="getTemplateUrl()"/>',
controllerAs: 'ProviderCredentials',
controller: function($scope) {
$scope.getTemplateUrl = function() {
return '?module=MobileMessaging&action=getCredentialFields&provider=' + $scope.provider;
};
},
link: function(scope, elm, attrs, ctrl) {
if (!ctrl) {
return;
}
// view -> model
scope.$watch('credentials', function (val, oldVal) {
ctrl.$setViewValue(JSON.stringify(val));
}, true);
// unset credentials when new provider is shoosen
scope.$watch('provider', function (val, oldVal) {
if(val != oldVal) {
scope.credentials = {};
}
}, true);
}
};
}
})();