2011-08-31 22:20:46 +04:00
|
|
|
$(document).ready(function(){
|
2012-01-02 14:39:23 +04:00
|
|
|
$('#timezone').change( function(){
|
2011-09-11 19:20:23 +04:00
|
|
|
OC.msg.startSaving('#calendar .msg')
|
2011-08-31 22:20:46 +04:00
|
|
|
// Serialize the data
|
2012-01-02 14:39:23 +04:00
|
|
|
var post = $( '#timezone' ).serialize();
|
2012-02-20 14:27:25 +04:00
|
|
|
$.post( OC.filePath('calendar', 'ajax/settings', 'settimezone.php'), post, function(data){
|
2011-10-02 17:51:24 +04:00
|
|
|
//OC.msg.finishedSaving('#calendar .msg', data);
|
2011-08-31 22:20:46 +04:00
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
2012-01-02 14:39:23 +04:00
|
|
|
$('#timezone').chosen();
|
|
|
|
$('#timeformat').change( function(){
|
|
|
|
var data = $('#timeformat').serialize();
|
2012-02-20 14:27:25 +04:00
|
|
|
$.post( OC.filePath('calendar', 'ajax/settings', 'settimeformat.php'), data, function(data){
|
2012-01-02 14:39:23 +04:00
|
|
|
if(data == 'error'){
|
|
|
|
console.log('saving timeformat failed');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2012-02-27 00:23:20 +04:00
|
|
|
$('#firstday').change( function(){
|
|
|
|
var data = $('#firstday').serialize();
|
|
|
|
$.post( OC.filePath('calendar', 'ajax/settings', 'setfirstday.php'), data, function(data){
|
|
|
|
if(data == 'error'){
|
|
|
|
console.log('saving firstday failed');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2012-01-02 14:35:50 +04:00
|
|
|
$('#timezonedetection').change( function(){
|
|
|
|
var post = $('#timezonedetection').serialize();
|
2012-02-20 14:27:25 +04:00
|
|
|
$.post( OC.filePath('calendar', 'ajax/settings', 'timezonedetection.php'), post, function(data){
|
2012-01-02 14:35:50 +04:00
|
|
|
|
|
|
|
});
|
|
|
|
});
|
2012-02-20 14:27:25 +04:00
|
|
|
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'timeformat.php'), function(jsondata, status) {
|
2012-01-02 14:39:23 +04:00
|
|
|
$('#' + jsondata.timeformat).attr('selected',true);
|
|
|
|
$('#timeformat').chosen();
|
2011-10-02 00:53:18 +04:00
|
|
|
});
|
2012-02-20 14:27:25 +04:00
|
|
|
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'gettimezonedetection.php'), function(jsondata, status){
|
2012-01-02 14:35:50 +04:00
|
|
|
if(jsondata.detection == 'true'){
|
|
|
|
$('#timezonedetection').attr('checked', 'checked');
|
|
|
|
}
|
|
|
|
});
|
2012-02-27 00:23:20 +04:00
|
|
|
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'getfirstday.php'), function(jsondata, status) {
|
|
|
|
$('#' + jsondata.firstday).attr('selected',true);
|
|
|
|
$('#firstday').chosen();
|
|
|
|
});
|
2012-05-29 15:34:27 +04:00
|
|
|
$('#cleancalendarcache').click(function(){
|
2012-06-12 00:16:26 +04:00
|
|
|
$.getJSON(OC.filePath('calendar', 'ajax/cache', 'rescan.php'), function(){
|
|
|
|
calendarcachecheck();
|
|
|
|
});
|
2012-05-29 15:34:27 +04:00
|
|
|
});
|
2012-06-12 00:16:26 +04:00
|
|
|
calendarcachecheck();
|
2011-08-31 22:20:46 +04:00
|
|
|
});
|
2012-06-12 00:16:26 +04:00
|
|
|
function calendarcachecheck(){
|
|
|
|
$.getJSON(OC.filePath('calendar', 'ajax/cache', 'status.php'), function(jsondata, status) {
|
2012-06-19 15:26:55 +04:00
|
|
|
$('#cleancalendarcache').attr('title', jsondata.l10n.text);
|
2012-06-12 00:16:26 +04:00
|
|
|
if(jsondata.status == 'success'){
|
|
|
|
$('#cleancalendarcache').css('background', '#90EE90');
|
|
|
|
$('#cleancalendarcache').css('color', '#333');
|
|
|
|
$('#cleancalendarcache').css('text-shadow', '#fff 0 1px 0');
|
|
|
|
}else{
|
|
|
|
$('#cleancalendarcache').css('background', '#DC143C');
|
|
|
|
$('#cleancalendarcache').css('color', '#FFFFFF');
|
|
|
|
$('#cleancalendarcache').css('text-shadow', '0px 0px 0px #fff, 0px 0px #fff');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|