Minor - format code

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

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

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Course;
@ -294,7 +295,7 @@ class CourseChatUtils
$connection = $em
->createQuery("
SELECT ccc FROM ChamiloCourseBundle:CChatConnected ccc
WHERE ccc.userId = :user AND ccc.cId = :course $extraCondition
WHERE ccc.userId = :user AND ccc.cId = :course $extraCondition
")
->setParameters([
'user' => $this->userId,

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

Loading…
Cancel
Save