blob: 87ac2877ead9c1ef764e6cf28fee63e3fc37a2c6 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
function getUserSettingsAJAX()
{
var ajaxRequest = piwikHelper.getStandardAjaxConf('ajaxLoadingUserSettings', 'ajaxErrorUserSettings');
var alias = $('#alias').val();
var email = $('#email').val();
var password = $('#password').val();
var passwordBis = $('#passwordBis').val();
var defaultReport = $('input[name=defaultReport]:checked').val();
if(defaultReport == 1) {
defaultReport = $('#defaultReportWebsite option:selected').val();
}
var defaultDate = $('input[name=defaultDate]:checked').val();
var request = '';
request += 'module=UsersManager';
request += '&action=recordUserSettings';
request += '&format=json';
request += '&alias='+alias;
request += '&email='+email;
request += '&password='+password;
request += '&passwordBis='+passwordBis;
request += '&defaultReport='+defaultReport;
request += '&defaultDate='+defaultDate;
request += '&token_auth=' + piwik.token_auth;
ajaxRequest.data = request;
return ajaxRequest;
}
function getAnonymousUserSettingsAJAX()
{
var ajaxRequest = piwikHelper.getStandardAjaxConf('ajaxLoadingAnonymousUserSettings', 'ajaxErrorAnonymousUserSettings');
var anonymousDefaultReport = $('input[name=anonymousDefaultReport]:checked').val();
if(anonymousDefaultReport == 1) {
anonymousDefaultReport = $('#anonymousDefaultReportWebsite option:selected').val();
}
var anonymousDefaultDate = $('input[name=anonymousDefaultDate]:checked').val();
var request = '';
request += 'module=UsersManager';
request += '&action=recordAnonymousUserSettings';
request += '&format=json';
request += '&anonymousDefaultReport='+anonymousDefaultReport;
request += '&anonymousDefaultDate='+anonymousDefaultDate;
request += '&token_auth=' + piwik.token_auth;
ajaxRequest.data = request;
return ajaxRequest;
}
$(document).ready( function() {
$('#userSettingsSubmit').click( function() {
$.ajax( getUserSettingsAJAX() );
});
$('#userSettingsTable input').keypress( function(e) {
var key=e.keyCode || e.which;
if (key==13) {
$('#userSettingsSubmit').click();
}});
$('#anonymousUserSettingsSubmit').click( function() {
$.ajax( getAnonymousUserSettingsAJAX() );
});
});
|