Admin: Add configuration setting course_chat_send_message_only_on_button

BT#16926

true: send message on button click only
false: the send on textarea enter too.
pull/3137/head
Julio Montoya 6 years ago
parent 4651e5141a
commit efee935440
  1. 1
      main/chat/chat.php
  2. 3
      main/install/configuration.dist.php
  3. 10
      main/template/default/chat/chat.tpl

@ -58,6 +58,7 @@ $view->assign('icons', $iconList);
$view->assign('emoji_strategy', CourseChatUtils::getEmojiStrategy());
$view->assign('emoji_smile', \Emojione\Emojione::toImage(':smile:'));
$view->assign('restrict_to_coach', api_get_configuration_value('course_chat_restrict_to_coach'));
$view->assign('send_message_only_on_button', api_get_configuration_value('course_chat_send_message_only_on_button') === true ? 1 : 0);
$template = $view->get_template('chat/chat.tpl');
$content = $view->fetch($template);

@ -1422,6 +1422,9 @@ ALTER TABLE notification_event ADD COLUMN event_id INT NULL;
// Skip scorm package file names clean up
//$_configuration['skip_scorm_package_clean_up'] = false;
// Course chat: Send message on button click only, if false then send on enter too.
//$_configuration['course_chat_send_message_only_on_button'] = true;
// KEEP THIS AT THE END
// -------- Custom DB changes
// Add user activation by confirmation email

@ -269,6 +269,16 @@ $(function () {
$('button#chat-send-message').on('click', ChChat.onSendMessageListener);
if ({{ send_message_only_on_button }} == 0) {
$('.emoji-wysiwyg-editor').keypress(function (e) {
if (e.which == 13) {
ChChat.onSendMessageListener(e);
return false; //<---- Add this line
}
});
}
$('#chat-users').on('click', 'div.chat-user', function (e) {
e.preventDefault();
var jSelf = $(this),

Loading…
Cancel
Save