2011-08-31 18:20:46 +00:00
|
|
|
$(document).ready(function(){
|
|
|
|
$("#timezone").change( function(){
|
2011-09-11 15:20:23 +00:00
|
|
|
OC.msg.startSaving('#calendar .msg')
|
2011-08-31 18:20:46 +00:00
|
|
|
// Serialize the data
|
|
|
|
var post = $( "#timezone" ).serialize();
|
2011-09-28 21:16:32 +00:00
|
|
|
$.post( OC.filePath('calendar', 'ajax', 'settimezone.php'), post, function(data){
|
2011-10-02 13:51:24 +00:00
|
|
|
//OC.msg.finishedSaving('#calendar .msg', data);
|
2011-08-31 18:20:46 +00:00
|
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
2011-10-01 07:54:52 +00:00
|
|
|
$("#timezone").chosen();
|
|
|
|
$("#firstdayofweek").change( function(){
|
|
|
|
var data = $("#firstdayofweek").serialize();
|
|
|
|
$.post( OC.filePath('calendar', 'ajax', 'setfirstdayofweek.php'), data, function(data){
|
|
|
|
if(data == "error"){
|
|
|
|
console.log("saving first day of week failed");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$.getJSON(OC.filePath('calendar', 'ajax', 'firstdayofweek.php'), function(jsondata, status) {
|
|
|
|
$("#select_" + jsondata.firstdayofweek).attr('selected',true);
|
|
|
|
$("#firstdayofweek").chosen();
|
|
|
|
});
|
|
|
|
$.getJSON(OC.filePath('calendar', 'ajax', 'daysofweekend.php'), function(jsondata, status) {
|
|
|
|
for(day in jsondata){
|
|
|
|
if(jsondata[day] == "true"){
|
|
|
|
$("#selectweekend_" + day).attr('selected',true);
|
|
|
|
}
|
|
|
|
}
|
2011-10-02 13:51:24 +00:00
|
|
|
$("#weekend").chosen();
|
2011-10-01 07:54:52 +00:00
|
|
|
});
|
2011-10-01 08:39:07 +00:00
|
|
|
$("#timeformat").change( function(){
|
|
|
|
var data = $("#timeformat").serialize();
|
|
|
|
$.post( OC.filePath('calendar', 'ajax', 'settimeformat.php'), data, function(data){
|
|
|
|
if(data == "error"){
|
|
|
|
console.log("saving timeformat failed");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$.getJSON(OC.filePath('calendar', 'ajax', 'timeformat.php'), function(jsondata, status) {
|
|
|
|
$("#" + jsondata.timeformat).attr('selected',true);
|
|
|
|
$("#timeformat").chosen();
|
|
|
|
});
|
2011-10-01 20:53:18 +00:00
|
|
|
$("#duration").blur( function(){
|
|
|
|
var data = $("#duration").val();
|
|
|
|
$.post( OC.filePath('calendar', 'ajax', 'setduration.php'), {duration: data}, function(data){
|
|
|
|
if(data == "error"){
|
|
|
|
console.log("saving duration failed");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$.getJSON(OC.filePath('calendar', 'ajax', 'duration.php'), function(jsondata, status) {
|
|
|
|
$("#duration").val(jsondata.duration);
|
|
|
|
});
|
2011-10-01 07:54:52 +00:00
|
|
|
$("#weekend").change( function(){
|
|
|
|
var data = $("#weekend").serialize();
|
|
|
|
$.post( OC.filePath('calendar', 'ajax', 'setdaysofweekend.php'), data, function(data){
|
|
|
|
if(data == "error"){
|
|
|
|
console.log("saving days of weekend failed");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2011-08-31 18:20:46 +00:00
|
|
|
});
|