settings.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $(document).ready(function(){
  2. $('#timezone').change( function(){
  3. OC.msg.startSaving('#calendar .msg')
  4. // Serialize the data
  5. var post = $( '#timezone' ).serialize();
  6. $.post( OC.filePath('calendar', 'ajax/settings', 'settimezone.php'), post, function(data){
  7. //OC.msg.finishedSaving('#calendar .msg', data);
  8. });
  9. return false;
  10. });
  11. $('#timezone').chosen();
  12. $('#timeformat').change( function(){
  13. var data = $('#timeformat').serialize();
  14. $.post( OC.filePath('calendar', 'ajax/settings', 'settimeformat.php'), data, function(data){
  15. if(data == 'error'){
  16. console.log('saving timeformat failed');
  17. }
  18. });
  19. });
  20. $('#firstday').change( function(){
  21. var data = $('#firstday').serialize();
  22. $.post( OC.filePath('calendar', 'ajax/settings', 'setfirstday.php'), data, function(data){
  23. if(data == 'error'){
  24. console.log('saving firstday failed');
  25. }
  26. });
  27. });
  28. $('#timezonedetection').change( function(){
  29. var post = $('#timezonedetection').serialize();
  30. $.post( OC.filePath('calendar', 'ajax/settings', 'timezonedetection.php'), post, function(data){
  31. });
  32. });
  33. $.getJSON(OC.filePath('calendar', 'ajax/settings', 'timeformat.php'), function(jsondata, status) {
  34. $('#' + jsondata.timeformat).attr('selected',true);
  35. $('#timeformat').chosen();
  36. });
  37. $.getJSON(OC.filePath('calendar', 'ajax/settings', 'gettimezonedetection.php'), function(jsondata, status){
  38. if(jsondata.detection == 'true'){
  39. $('#timezonedetection').attr('checked', 'checked');
  40. }
  41. });
  42. $.getJSON(OC.filePath('calendar', 'ajax/settings', 'getfirstday.php'), function(jsondata, status) {
  43. $('#' + jsondata.firstday).attr('selected',true);
  44. $('#firstday').chosen();
  45. });
  46. });