From 5017878701e736b1dd028811ba607cbd6f7920b1 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Mar 2023 22:05:06 +0100 Subject: [PATCH] Messages view --- .../operation/messages/message_edit.php | 149 ++++++++++-------- .../operation/messages/message_list.php | 86 ++++++---- 2 files changed, 141 insertions(+), 94 deletions(-) diff --git a/pandora_console/operation/messages/message_edit.php b/pandora_console/operation/messages/message_edit.php index 105a9560de..0e232788e7 100644 --- a/pandora_console/operation/messages/message_edit.php +++ b/pandora_console/operation/messages/message_edit.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2022 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -52,7 +52,7 @@ $buttons['message_list'] = [ true, [ 'title' => __('Received messages'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ]; @@ -64,7 +64,7 @@ $buttons['sent_messages'] = [ true, [ 'title' => __('Sent messages'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ]; @@ -76,7 +76,7 @@ $buttons['create_message'] = [ true, [ 'title' => __('Create message'), - 'class' => 'invert_filter', + 'class' => 'main_menu_icon invert_filter', ] ).'', ]; @@ -218,11 +218,8 @@ if ($read_message) { true ); - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => $outputButtons, - ], + html_print_action_buttons( + $outputButtons ); return; @@ -264,18 +261,6 @@ if ($send_mes === true) { // User info. $own_info = get_user_info($config['id_user']); -$table = new stdClass(); -$table->width = '100%'; -$table->class = 'databox filters'; - -$table->data = []; - -$table->data[0][0] = __('Sender'); - -$table->data[0][1] = (empty($own_info['fullname']) === false) ? $own_info['fullname'] : $config['id_user']; - -$table->data[1][0] = __('Destination'); - $is_admin = (bool) db_get_value( 'is_admin', 'tusuario', @@ -305,15 +290,29 @@ foreach ($users_full as $user_id => $user_info) { $users[$user_info['id_user']] = (empty($user_info['fullname']) === true) ? $user_info['id_user'] : $user_info['fullname']; } +$table = new stdClass(); +$table->id = 'send_message_table'; +$table->width = '100%'; +$table->class = 'databox max_floating_element_size filter-table-adv'; +$table->style = []; +$table->style[0] = 'width: 30%'; +$table->style[1] = 'width: 70%'; +$table->data = []; + +$table->data[0][] = html_print_label_input_block( + __('Sender'), + ''.((empty($own_info['fullname']) === false) ? $own_info['fullname'] : $config['id_user']).'' +); + // Check if the user to reply is in the list, if not add reply user. if ($reply === true) { - $table->data[1][1] = (array_key_exists($dst_user, $users) === true) ? $users[$dst_user] : $dst_user; - $table->data[1][1] .= html_print_input_hidden( + $destinationInputs = (array_key_exists($dst_user, $users) === true) ? $users[$dst_user] : $dst_user; + $destinationInputs .= html_print_input_hidden( 'dst_user', $dst_user, true ); - $table->data[1][1] .= html_print_input_hidden( + $destinationInputs .= html_print_input_hidden( 'replied', '1', true @@ -324,21 +323,27 @@ if ($reply === true) { $groups = users_get_groups($config['id_user'], 'AR'); // Get a list of all groups. - $table->data[1][1] = html_print_select( - $users, - 'dst_user', - $dst_user, - 'changeStatusOtherSelect(\'dst_user\', \'dst_group\')', - __('Select user'), - false, - true, - false, - '' - ); - $table->data[1][1] .= '  '.__('OR').'  '; - $table->data[1][1] .= html_print_div( + $destinationInputs = html_print_div( [ - 'class' => 'w250px inline', + 'class' => 'select_users mrgn_right_5px', + 'content' => html_print_select( + $users, + 'dst_user', + $dst_user, + 'changeStatusOtherSelect(\'dst_user\', \'dst_group\')', + __('Select user'), + false, + true, + false, + '' + ), + ], + true + ); + $destinationInputs .= __('OR'); + $destinationInputs .= html_print_div( + [ + 'class' => 'mrgn_lft_5px', 'content' => html_print_select_groups( $config['id_user'], 'AR', @@ -355,24 +360,41 @@ if ($reply === true) { ); } -$table->data[2][0] = __('Subject'); -$table->data[2][1] = html_print_input_text( - 'subject', - $subject, - '', - 50, - 70, - true +$table->data[0][] = html_print_label_input_block( + __('Destination'), + html_print_div( + [ + 'class' => 'flex-content-left', + 'content' => $destinationInputs, + ], + true + ) ); -$table->data[3][0] = __('Message'); -$table->data[3][1] = html_print_textarea( - 'message', - 15, - 255, - $message, - '', - true +$table->colspan[1][] = 2; +$table->data[1][] = html_print_label_input_block( + __('Subject'), + html_print_input_text( + 'subject', + $subject, + '', + 50, + 70, + true + ) +); + +$table->colspan[2][] = 2; +$table->data[2][] = html_print_label_input_block( + __('Message'), + html_print_textarea( + 'message', + 15, + 50, + $message, + '', + true + ) ); $jsOutput = ''; @@ -396,17 +418,14 @@ echo '
'; - $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Click to read'), 'class' => 'invert_filter']); - $data[0] .= ''; + $pathRead = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&show_sent=1&id_message='.$message_id; + $titleRead = __('Click to read'); } else { - $data[0] .= ''; - $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Mark as unread'), 'class' => 'invert_filter']); - $data[0] .= ''; + $pathRead = 'index.php?sec=message_list&sec2=operation/messages/message_list&mark_unread=1&id_message='.$message_id; + $titleRead = __('Mark as unread'); } } else { if ($show_sent === true) { - $data[0] .= ''; - $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Message unread - click to read'), 'class' => 'invert_filter']); - $data[0] .= ''; + $pathRead = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&show_sent=1&id_message='.$message_id; + $titleRead = __('Message unread - click to read'); } else { - $data[0] .= ''; - $data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Message unread - click to read'), 'class' => 'invert_filter']); - $data[0] .= ''; + $pathRead = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&id_message='.$message_id; + $titleRead = __('Message unread - click to read'); } } + $data[0] = html_print_anchor( + [ + 'href' => $pathRead, + 'content' => html_print_image( + 'images/email_inbox.png', + true, + [ + 'title' => $titleRead, + 'class' => 'main_menu_icon invert_filter', + ], + ), + ], + true + ); + if ($show_sent === true) { $dest_user = get_user_fullname($message['dest']); if (!$dest_user) { @@ -243,18 +254,24 @@ if (empty($messages) === true) { } if ($show_sent === true) { - $data[2] = ''; + $pathSubject = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&show_sent=1&id_message='.$message_id; } else { - $data[2] = ''; + $pathSubject = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&id_message='.$message_id; } - if ($message['subject'] == '') { - $data[2] .= __('No Subject'); - } else { - $data[2] .= $message['subject']; + $contentSubject = (empty($message['subject']) === true) ? __('No Subject') : $message['subject']; + + if ((int) $message['read'] !== 1) { + $contentSubject = ''.$contentSubject.''; } - $data[2] .= ''; + $data[2] .= html_print_anchor( + [ + 'href' => $pathSubject, + 'content' => $contentSubject, + ], + true + ); $data[3] = ui_print_timestamp( $message['timestamp'], @@ -264,13 +281,27 @@ if (empty($messages) === true) { $table->cellclass[][4] = 'table_action_buttons'; if ($show_sent === true) { - $data[4] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; + $pathDelete = 'index.php?sec=message_list&sec2=operation/messages/message_list&show_sent=1&delete_message=1&id='.$message_id; } else { - $data[4] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).''; + $pathDelete = 'index.php?sec=message_list&sec2=operation/messages/message_list&delete_message=1&id='.$message_id; } + $data[4] = html_print_anchor( + [ + 'href' => $pathDelete, + 'content' => html_print_image( + 'images/delete.svg', + true, + [ + 'title' => __('Delete'), + 'class' => 'main_menu_icon invert_filter', + ] + ), + 'onClick' => 'javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;', + ], + true + ); + array_push($table->data, $data); } } @@ -312,11 +343,8 @@ if (empty($messages) === false) { echo '
'; - html_print_div( - [ - 'class' => 'action-buttons', - 'content' => $outputButton, - ] + html_print_action_buttons( + $outputButton ); ?>