| 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/CoreHome/angularjs/ajax-form/ |
Upload File : |
/*!
* 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('AjaxFormController', AjaxFormController);
AjaxFormController.$inject = ['piwikApi', '$filter'];
function AjaxFormController(piwikApi, $filter) {
var vm = this;
/**
* Set to non-null when a form submit request returns successfully. When successful, it will
* be the entire JSON parsed response of the request.
*
* @type {null|string}
*/
vm.successfulPostResponse = null;
/**
* Set to non-null when a form submit request results in an error. When an error occurs,
* it will be set to the string error message.
*
* @type {null|string}
*/
vm.errorPostResponse = null;
/**
* true if currently submitting a POST request, false if otherwise.
*
* @type {bool}
*/
vm.isSubmitting = false;
vm.submitForm = submitForm;
/**
* Sends a POST to the configured API method.
*/
function submitForm() {
var postParams;
vm.successfulPostResponse = null;
vm.errorPostResponse = null;
if (vm.sendJsonPayload) {
postParams = {data: JSON.stringify(vm.data)};
} else {
postParams = vm.data;
}
vm.isSubmitting = true;
piwikApi.post(
{ // GET params
module: 'API',
method: vm.submitApiMethod
},
postParams,
{ // request options
createErrorNotification: !vm.noErrorNotification
}
).then(function (response) {
vm.successResponse = response;
if (!vm.noSuccessNotification) {
var UI = require('piwik/UI');
var notification = new UI.Notification();
notification.show($filter('translate')('General_YourChangesHaveBeenSaved'), {
context: 'success',
type: 'toast',
id: 'ajaxHelper'
});
notification.scrollToNotification();
}
}).catch(function (errorMessage) {
vm.errorPostResponse = errorMessage;
}).finally(function () {
vm.isSubmitting = false;
});
}
}
})();