function validate(form,list) {
if(list.selectedIndex<0) {
alert("Please select someone to send the message to.")
return false
} else {
return true
}
}
';
$htmlHeadXtra[] = '';
$htmlHeadXtra[] = ' ';
$htmlHeadXtra[] = '
';
$nameTools = get_lang('ComposeMessage');
/* FUNCTIONS */
/**
* Shows the compose area + a list of users to select from.
*/
function show_compose_to_any ($user_id) {
$online_user_list = MessageManager::get_online_user_list($user_id);
$default['user_list'] = 0;
$online_user_list=null;
manage_form($default, $online_user_list);
}
function show_compose_reply_to_message ($message_id, $receiver_id) {
global $charset;
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "SELECT user_sender_id FROM $table_message WHERE user_receiver_id=".intval($receiver_id)." AND id='".intval($message_id)."';";
$result = Database::query($query);
$row = Database::fetch_array($result,'ASSOC');
if (!isset($row['user_sender_id'])) {
echo get_lang('InvalidMessageId');
die();
}
$pre_html = '
';
$id_content_right = '';
//LEFT COLUMN
if (api_get_setting('allow_social_tool') != 'true') {
$id_content_right = 'inbox';
} else {
echo '
';
//this include the social menu div
SocialManager::show_social_menu('messages');
echo '
';
$id_content_right = 'social-content-right';
}
echo '
';
//MAIN CONTENT
if (api_get_setting('allow_social_tool') == 'true') {
echo '
';
}
if (!isset($_POST['compose'])) {
if(isset($_GET['re_id'])) {
show_compose_reply_to_message($_GET['re_id'], api_get_user_id());
} elseif(isset($_GET['send_to_user'])) {
show_compose_to_user($_GET['send_to_user']);
} else {
show_compose_to_any($_user['user_id']);
}
} else {
$restrict = false;
if (isset($_POST['users'])) {
$restrict = true;
} elseif (isset($_POST['group_id'])) {
$restrict = true;
} elseif(isset($_POST['hidden_user'])) {
$restrict = true;
}
$default['title'] = $_POST['title'];
$default['content'] = $_POST['content'];
// comes from a reply button
if (isset($_GET['re_id'])) {
manage_form($default);
} else {
// post
if ($restrict) {
if (!isset($_POST['group_id'])) {
$default['users'] = $_POST['users'];
} else {
$default['group_id'] = $_POST['group_id'];
}
if (isset($_POST['hidden_user'])) {
$default['users'] = array($_POST['hidden_user']);
}
manage_form($default);
} else {
Display::display_error_message(get_lang('ErrorSendingMessage'));
}
}
}
echo '
';
echo '
';
/* FOOTER */
Display::display_footer();