diff --git a/modules/core/functions.php b/modules/core/functions.php index 62e2e828fb..4358a7a165 100644 --- a/modules/core/functions.php +++ b/modules/core/functions.php @@ -656,6 +656,36 @@ function nexter_formats() { return $values; }} +if (!hm_exists('schedule_dropdown')) { +function schedule_dropdown($output, $send_now = false) { + $values = nexter_formats(); + + $txt = ''; + if ($send_now) { + $txt .= ''; + } + + return $txt; +}} + /** * @subpackage imap/functions */ diff --git a/modules/core/message_list_functions.php b/modules/core/message_list_functions.php index 7ddfb896ff..fbaa41568d 100644 --- a/modules/core/message_list_functions.php +++ b/modules/core/message_list_functions.php @@ -299,11 +299,11 @@ function subject_callback($vals, $style, $output_mod) { */ if (!hm_exists('date_callback')) { function date_callback($vals, $style, $output_mod) { - $snooze_class = isset($vals[2]) && $vals[2]? ' snoozed_date': ''; + $nexter_class = isset($vals[2]) && $vals[2]? ' nexter_date': ''; if ($style == 'news') { - return sprintf('
%s
', $snooze_class, $output_mod->html_safe($vals[0]), $output_mod->html_safe($vals[1])); + return sprintf('
%s
', $nexter_class, $output_mod->html_safe($vals[0]), $output_mod->html_safe($vals[1])); } - return sprintf('%s', $snooze_class, $output_mod->html_safe(date('r', $vals[1])), $output_mod->html_safe($vals[0]), $output_mod->html_safe($vals[1])); + return sprintf('%s', $nexter_class, $output_mod->html_safe(date('r', $vals[1])), $output_mod->html_safe($vals[0]), $output_mod->html_safe($vals[1])); }} /** diff --git a/modules/core/site.css b/modules/core/site.css index 0f0cfb08ba..02a6e1d20a 100644 --- a/modules/core/site.css +++ b/modules/core/site.css @@ -1271,7 +1271,7 @@ div.unseen, .mobile .imap_sort { width: 100%; } -.snoozed_date { +.nexter_date { color: var(--bs-primary) !important; } diff --git a/modules/core/site.js b/modules/core/site.js index d74fe67713..93dfcceb3d 100644 --- a/modules/core/site.js +++ b/modules/core/site.js @@ -2707,26 +2707,30 @@ const observeMessageTextMutationAndHandleExternalResources = (inline) => { }; var setup_nexter_date = function(callback) { + var scopedElement = function (el, selector) { + return $(el).parent().parent().find(selector); + } $(document).on('click', '.nexter_date_picker', function(e) { document.querySelector('.nexter_input_date').showPicker(); }); $(document).on('click', '.nexter_date_helper', function(e) { e.preventDefault(); - $('.nexter_input').val($(this).attr('data-value')).trigger('change'); + scopedElement(this, '.nexter_input').val($(this).attr('data-value')).trigger('change'); }); $(document).on('input', '.nexter_input_date', function(e) { var now = new Date(); now.setMinutes(now.getMinutes() + 1); $(this).attr('min', now.toJSON().slice(0, 16)); + var date_picker = scopedElement(this, '.nexter_date_picker'); if (new Date($(this).val()).getTime() <= now.getTime()) { - $('.nexter_date_picker').css('border', '1px solid red'); + date_picker.css('border', '1px solid red'); } else { - $('.nexter_date_picker').css({'border': 'unset', 'border-top': '1px solid #ddd'}); + date_picker.css({'border': 'unset', 'border-top': '1px solid #ddd'}); } }); $(document).on('change', '.nexter_input_date', function(e) { if ($(this).val() && new Date().getTime() < new Date($(this).val()).getTime()) { - $('.nexter_input').val($(this).val()).trigger('change'); + scopedElement(this, '.nexter_input').val($(this).val()).trigger('change'); } }); $(document).on('change', '.nexter_input', callback); diff --git a/modules/imap/functions.php b/modules/imap/functions.php index 52bb3a08eb..460fd99b26 100644 --- a/modules/imap/functions.php +++ b/modules/imap/functions.php @@ -225,10 +225,14 @@ function format_imap_message_list($msg_list, $output_module, $parent_list=false, $nofrom = ' nofrom'; } $is_snoozed = !empty($msg['x_snoozed']) && hex2bin($msg['folder']) == 'Snoozed'; + $is_scheduled = !empty($msg['x_schedule']) && hex2bin($msg['folder']) == 'Scheduled'; if ($is_snoozed) { $snooze_header = parse_nexter_header('X-Snoozed: '.$msg['x_snoozed'], 'X-Snoozed'); $date = $snooze_header['until']; $timestamp = strtotime($date); + } elseif ($is_scheduled) { + $date = $msg['x_schedule']; + $timestamp = strtotime($date); } else { if ($list_sort == 'date') { $date_field = 'date'; @@ -303,7 +307,7 @@ function format_imap_message_list($msg_list, $output_module, $parent_list=false, array('safe_output_callback', 'source', $source, $icon), array('safe_output_callback', 'from'.$nofrom, $from, null, str_replace(array($from, '<', '>'), '', $msg['from'])), array('subject_callback', $subject, $url, $flags), - array('date_callback', $date, $timestamp, $is_snoozed), + array('date_callback', $date, $timestamp, $is_snoozed || $is_scheduled), array('icon_callback', $flags) ), $id, @@ -1325,8 +1329,8 @@ function snooze_dropdown($output, $unsnooze = false) { $values = nexter_formats(); $txt = '