You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vacation_sieve.js 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. +-----------------------------------------------------------------------+
  3. | Vacation Module for RoundCube, using Sieve |
  4. | |
  5. | Copyright (C) 2011 André Rodier <andre.rodier@gmail.com> |
  6. | Licensed under the GNU GPL |
  7. +-----------------------------------------------------------------------+
  8. */
  9. if (window.rcmail)
  10. {
  11. rcmail.addEventListener('init', function(evt) {
  12. var tab = $('<span>').attr('id', 'settingstabpluginvacation_sieve').addClass('tablink');
  13. var button = $('<a>').attr('href',
  14. rcmail.env.comm_path + '&_action=plugin.vacation_sieve').html(
  15. rcmail.gettext('vacation', 'vacation_sieve')).appendTo(tab);
  16. button.bind('click', function(e) {
  17. return rcmail.command('plugin.vacation_sieve', this);
  18. });
  19. rcmail.add_element(tab, 'tabs');
  20. rcmail.register_command('plugin.vacation_sieve', function() {
  21. rcmail.goto_url('plugin.vacation_sieve')
  22. }, true);
  23. rcmail.register_command('plugin.vacation_sieve-save', function() {
  24. rcmail.gui_objects.vacationsieveform.submit();
  25. }, true);
  26. })
  27. // Adjust the eight of the identities list
  28. $(function () {
  29. $('select#addressed_to').multiselect({header:false, selectedList: 2, height:"auto"});
  30. // Make sure we have one address selected. On select 'null' select the default.
  31. $("select#addressed_to").change(function(){
  32. if ( $(this).val() == null ) {
  33. $(this).val($("option:first", $(this)).text());
  34. $(this).multiselect("refresh");
  35. }
  36. });
  37. });
  38. // Datepicker for the vacation dates
  39. $(function() {
  40. var dates = $('#vacation_start, #vacation_end').datepicker({
  41. defaultDate: 7,
  42. changeMonth: true,
  43. numberOfMonths: 1,
  44. dateFormat: rcmail.env.date_format,
  45. onSelect: function( selectedDate ) {
  46. var option = this.id == "vacation_start" ? "minDate" : "maxDate",
  47. instance = $( this ).data( "datepicker" ),
  48. date = $.datepicker.parseDate(
  49. instance.settings.dateFormat,
  50. selectedDate, instance.settings );
  51. dates.not( this ).datepicker( "option", option, date );
  52. }
  53. });
  54. });
  55. }