Messages view
This commit is contained in:
parent
4af67db415
commit
5017878701
|
@ -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',
|
||||
]
|
||||
).'</a>',
|
||||
];
|
||||
|
@ -64,7 +64,7 @@ $buttons['sent_messages'] = [
|
|||
true,
|
||||
[
|
||||
'title' => __('Sent messages'),
|
||||
'class' => 'invert_filter',
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
];
|
||||
|
@ -76,7 +76,7 @@ $buttons['create_message'] = [
|
|||
true,
|
||||
[
|
||||
'title' => __('Create message'),
|
||||
'class' => 'invert_filter',
|
||||
'class' => 'main_menu_icon invert_filter',
|
||||
]
|
||||
).'</a>',
|
||||
];
|
||||
|
@ -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'),
|
||||
'<span class="result_info_text">'.((empty($own_info['fullname']) === false) ? $own_info['fullname'] : $config['id_user']).'</span>'
|
||||
);
|
||||
|
||||
// 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,7 +323,10 @@ if ($reply === true) {
|
|||
|
||||
$groups = users_get_groups($config['id_user'], 'AR');
|
||||
// Get a list of all groups.
|
||||
$table->data[1][1] = html_print_select(
|
||||
$destinationInputs = html_print_div(
|
||||
[
|
||||
'class' => 'select_users mrgn_right_5px',
|
||||
'content' => html_print_select(
|
||||
$users,
|
||||
'dst_user',
|
||||
$dst_user,
|
||||
|
@ -334,11 +336,14 @@ if ($reply === true) {
|
|||
true,
|
||||
false,
|
||||
''
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
$table->data[1][1] .= ' '.__('OR').' ';
|
||||
$table->data[1][1] .= html_print_div(
|
||||
$destinationInputs .= __('OR');
|
||||
$destinationInputs .= html_print_div(
|
||||
[
|
||||
'class' => 'w250px inline',
|
||||
'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(
|
||||
$table->data[0][] = html_print_label_input_block(
|
||||
__('Destination'),
|
||||
html_print_div(
|
||||
[
|
||||
'class' => 'flex-content-left',
|
||||
'content' => $destinationInputs,
|
||||
],
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$table->colspan[1][] = 2;
|
||||
$table->data[1][] = html_print_label_input_block(
|
||||
__('Subject'),
|
||||
html_print_input_text(
|
||||
'subject',
|
||||
$subject,
|
||||
'',
|
||||
50,
|
||||
70,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$table->data[3][0] = __('Message');
|
||||
$table->data[3][1] = html_print_textarea(
|
||||
$table->colspan[2][] = 2;
|
||||
$table->data[2][] = html_print_label_input_block(
|
||||
__('Message'),
|
||||
html_print_textarea(
|
||||
'message',
|
||||
15,
|
||||
255,
|
||||
50,
|
||||
$message,
|
||||
'',
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
$jsOutput = '';
|
||||
|
@ -396,17 +418,14 @@ echo '<form method="post" action="index.php?sec=message_list&sec2=operation/
|
|||
// Print the main table.
|
||||
html_print_table($table);
|
||||
// Print the action buttons section.
|
||||
html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => html_print_submit_button(
|
||||
html_print_action_buttons(
|
||||
html_print_submit_button(
|
||||
__('Send message'),
|
||||
'send_mes',
|
||||
false,
|
||||
[ 'icon' => 'wand' ],
|
||||
true
|
||||
),
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
echo '</form>';
|
||||
|
|
|
@ -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
|
||||
|
@ -206,26 +206,37 @@ if (empty($messages) === true) {
|
|||
$data[0] = '';
|
||||
if ($message['read'] == 1) {
|
||||
if ($show_sent === true) {
|
||||
$data[0] .= '<a href="index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&show_sent=1&id_message='.$message_id.'">';
|
||||
$data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Click to read'), 'class' => 'invert_filter']);
|
||||
$data[0] .= '</a>';
|
||||
$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] .= '<a href="index.php?sec=message_list&sec2=operation/messages/message_list&mark_unread=1&id_message='.$message_id.'">';
|
||||
$data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Mark as unread'), 'class' => 'invert_filter']);
|
||||
$data[0] .= '</a>';
|
||||
$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] .= '<a href="index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&show_sent=1&id_message='.$message_id.'">';
|
||||
$data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Message unread - click to read'), 'class' => 'invert_filter']);
|
||||
$data[0] .= '</a>';
|
||||
$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] .= '<a href="index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&id_message='.$message_id.'">';
|
||||
$data[0] .= html_print_image('images/email_inbox.png', true, ['border' => 0, 'title' => __('Message unread - click to read'), 'class' => 'invert_filter']);
|
||||
$data[0] .= '</a>';
|
||||
$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] = '<a href="index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&show_sent=1&id_message='.$message_id.'">';
|
||||
$pathSubject = 'index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&show_sent=1&id_message='.$message_id;
|
||||
} else {
|
||||
$data[2] = '<a href="index.php?sec=message_list&sec2=operation/messages/message_edit&read_message=1&id_message='.$message_id.'">';
|
||||
$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 = '<strong>'.$contentSubject.'</strong>';
|
||||
}
|
||||
|
||||
$data[2] .= '</a>';
|
||||
$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] = '<a href="index.php?sec=message_list&sec2=operation/messages/message_list&show_sent=1&delete_message=1&id='.$message_id.'"
|
||||
onClick="javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
|
||||
$pathDelete = 'index.php?sec=message_list&sec2=operation/messages/message_list&show_sent=1&delete_message=1&id='.$message_id;
|
||||
} else {
|
||||
$data[4] = '<a href="index.php?sec=message_list&sec2=operation/messages/message_list&delete_message=1&id='.$message_id.'"
|
||||
onClick="javascript:if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
|
||||
$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 '<form id="create_message_form" method="post" class="float-right" action="index.php?sec=message_list&sec2=operation/messages/message_edit"></form>';
|
||||
|
||||
html_print_div(
|
||||
[
|
||||
'class' => 'action-buttons',
|
||||
'content' => $outputButton,
|
||||
]
|
||||
html_print_action_buttons(
|
||||
$outputButton
|
||||
);
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue