Minor - format code

pull/3137/head
Julio Montoya 6 years ago
parent f25e786827
commit 37f0c7cfbc
  1. 4
      main/chat/chat.php
  2. 1
      main/inc/lib/CourseChatUtils.php
  3. 76
      main/template/default/chat/chat.tpl

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
define('CHAMILO_LOAD_WYSIWYG', false); define('CHAMILO_LOAD_WYSIWYG', false);
@ -11,14 +12,11 @@ Event::event_access_tool(TOOL_CHAT);
$logInfo = [ $logInfo = [
'tool' => TOOL_CHAT, 'tool' => TOOL_CHAT,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'start', 'action' => 'start',
'action_details' => 'start-chat', 'action_details' => 'start-chat',
]; ];
Event::registerLog($logInfo); Event::registerLog($logInfo);
// View
$externalCSS = [ $externalCSS = [
'jquery-emojiarea/jquery.emojiarea.css', 'jquery-emojiarea/jquery.emojiarea.css',
'jquery-textcomplete/jquery.textcomplete.css', 'jquery-textcomplete/jquery.textcomplete.css',

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Course; use Chamilo\CoreBundle\Entity\Course;

@ -136,18 +136,17 @@ $(function () {
$('#chat-users').html(html); $('#chat-users').html(html);
}, },
onPreviewListener: function () { onPreviewListener: function () {
$ $.post(ChChat._ajaxUrl, {
.post(ChChat._ajaxUrl, { action: 'preview',
action: 'preview', 'message': $('textarea#chat-writer').val()
'message': $('textarea#chat-writer').val() })
}) .done(function (response) {
.done(function (response) { if (!response.status) {
if (!response.status) { return;
return; }
}
$('#html-preview').html(response.data.message); $('#html-preview').html(response.data.message);
}); });
}, },
onSendMessageListener: function (e) { onSendMessageListener: function (e) {
e.preventDefault(); e.preventDefault();
@ -159,40 +158,38 @@ $(function () {
var self = this; var self = this;
self.disabled = true; self.disabled = true;
$ $.post(ChChat._ajaxUrl, {
.post(ChChat._ajaxUrl, { action: 'write',
action: 'write', message: $('textarea#chat-writer').val(),
message: $('textarea#chat-writer').val(), friend: ChChat.currentFriend
friend: ChChat.currentFriend })
}) .done(function (response) {
.done(function (response) { self.disabled = false;
self.disabled = false;
if (!response.status) { if (!response.status) {
return; return;
} }
$('textarea#chat-writer').val(''); $('textarea#chat-writer').val('');
$(".emoji-wysiwyg-editor").html(''); $(".emoji-wysiwyg-editor").html('');
}); });
}, },
onResetListener: function (e) { onResetListener: function (e) {
if (!confirm("{{ 'ConfirmReset'|get_lang }}")) { if (!confirm("{{ 'ConfirmReset'|get_lang }}")) {
e.preventDefault(); e.preventDefault();
return; return;
} }
$ $.get(ChChat._ajaxUrl, {
.get(ChChat._ajaxUrl, { action: 'reset',
action: 'reset', friend: ChChat.currentFriend
friend: ChChat.currentFriend })
}) .done(function (response) {
.done(function (response) { if (!response.status) {
if (!response.status) { return;
return; }
}
ChChat.setHistory(response.data); ChChat.setHistory(response.data);
}); });
}, },
init: function () { init: function () {
ChChat.track().done(function () { ChChat.track().done(function () {
@ -219,13 +216,13 @@ $(function () {
$('body').on('click', '#chat-reset', ChChat.onResetListener); $('body').on('click', '#chat-reset', ChChat.onResetListener);
$('#preview').on('click', ChChat.onPreviewListener); $('#preview').on('click', ChChat.onPreviewListener);
$('#emojis').on('click', function () { $('#emojis').on('click', function () {
$('[data-toggle="tab"][href="#tab1"]').show().tab('show'); $('[data-toggle="tab"][href="#tab1"]').show().tab('show');
}); });
$('textarea#chat-writer').emojiarea({
button: '#emojis' $('textarea#chat-writer').emojiarea({button: '#emojis'});
});
$('body').delay(1500).find('.emoji-wysiwyg-editor').textcomplete([{ $('body').delay(1500).find('.emoji-wysiwyg-editor').textcomplete([{
match: /\B:([\-+\w]*)$/, match: /\B:([\-+\w]*)$/,
@ -271,6 +268,7 @@ $(function () {
}], {}); }], {});
$('button#chat-send-message').on('click', ChChat.onSendMessageListener); $('button#chat-send-message').on('click', ChChat.onSendMessageListener);
$('#chat-users').on('click', 'div.chat-user', function (e) { $('#chat-users').on('click', 'div.chat-user', function (e) {
e.preventDefault(); e.preventDefault();
var jSelf = $(this), var jSelf = $(this),

Loading…
Cancel
Save