owncalendar/js/settings.js

66 lines
2.4 KiB
JavaScript
Raw Normal View History

$(document).ready(function(){
2012-01-02 10:39:23 +00:00
$('#timezone').change( function(){
var post = $( '#timezone' ).serialize();
$.post( OC.filePath('calendar', 'ajax/settings', 'settimezone.php'), post, function(data){return;});
return false;
});
2012-01-02 10:39:23 +00:00
$('#timezone').chosen();
$('#timeformat').change( function(){
var data = $('#timeformat').serialize();
2012-02-20 10:27:25 +00:00
$.post( OC.filePath('calendar', 'ajax/settings', 'settimeformat.php'), data, function(data){
2012-01-02 10:39:23 +00:00
if(data == 'error'){
console.log('saving timeformat failed');
}
});
});
$('#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');
}
});
});
$('#timezonedetection').change( function(){
var post = $('#timezonedetection').serialize();
2012-02-20 10:27:25 +00:00
$.post( OC.filePath('calendar', 'ajax/settings', 'timezonedetection.php'), post, function(data){
});
});
2012-02-20 10:27:25 +00:00
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'timeformat.php'), function(jsondata, status) {
2012-01-02 10:39:23 +00:00
$('#' + jsondata.timeformat).attr('selected',true);
$('#timeformat').chosen();
2012-07-21 15:09:10 +00:00
$('#timeformat_chzn').css('width', '100px');
2011-10-01 20:53:18 +00:00
});
2012-02-20 10:27:25 +00:00
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'gettimezonedetection.php'), function(jsondata, status){
if(jsondata.detection == 'true'){
$('#timezonedetection').attr('checked', 'checked');
}
});
$.getJSON(OC.filePath('calendar', 'ajax/settings', 'getfirstday.php'), function(jsondata, status) {
$('#' + jsondata.firstday).attr('selected',true);
$('#firstday').chosen();
2012-07-21 15:09:10 +00:00
$('#firstday_chzn').css('width', '100px');
});
2012-05-29 11:34:27 +00:00
$('#cleancalendarcache').click(function(){
$.getJSON(OC.filePath('calendar', 'ajax/cache', 'rescan.php'), function(){
calendarcachecheck();
});
2012-05-29 11:34:27 +00:00
});
calendarcachecheck();
});
function calendarcachecheck(){
$.getJSON(OC.filePath('calendar', 'ajax/cache', 'status.php'), function(jsondata, status) {
2012-06-19 11:26:55 +00:00
$('#cleancalendarcache').attr('title', jsondata.l10n.text);
if(jsondata.status == 'success'){
2012-07-21 15:09:10 +00:00
$('#cleancalendarcache').css('background', '#F8F8F8');
$('#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');
}
});
}