{% extends '@CadolesCore/base.html.twig' %} {% block localstyle %} {% if framed %} {% if border %} #topchat { margin: 5px -15px 5px -25px; } .mychat{ margin: 0px 0px 0px -10px; } {% else %} #topchat { margin: 5px -30px; } .mychat{ margin: 0px -15px; } {% endif %} {% else %} #topchat { padding-top:20px; padding-bottom:30px; } {% endif %} .message { padding:10px; margin-top: 5px; background-color: #{{ colorbodyback }}; color: #{{ colorbodyfont }}; } .message-toread { font-weight:bold; } .message-see { display:none; } .msgavatar { float:left; height:40px; text-align: center; } .msgdiv { padding-left:60px; } .msgtitle { line-height: 12px; margin-bottom: 10px; } .msgreplys { margin-bottom:10px; } .messagereply { padding:0px; border-top: 1px solid #{{ colorbodyfont }}; font-size:12px; } .btnreplymessage, .btnreplymessagemail { padding: 5px; background-color: #{{ colorbodyfont }}; color : #{{ colorbodyback }}; border-radius:5px; cursor:pointer; margin-right:5px; } .btnreplymessage:hover, .btnreplymessagemail:hover { color : #{{ colorbodyback }}; } .replymessage { display:none} .replymessage textarea { width:100%; margin:20px 0px 5px 0px; height:150px; color:#000000; } .sendreply { width:100%} .bootstrap-switch{ margin-top:5px; } .labelswitch { line-height: 40px; float: right; margin-right: 10px; } #listtoavatar img { margin:0px 5px 5px 0px; cursor:pointer; } .cke_bottom{ display:none } {% endblock %} {% block pagewrapper %} {% set colorlabel= colormain %} {% if border %} {% set colorlabel = colorbody %} {% endif %} {% if colorbody==colorbodyfont %} {% set colorlabel = colorbodyback %} {% endif %} {% if app.user and ingroup %} {{ form_start(form) }}
"+$("#replymessage-"+id+" textarea").val()+"
"; event={mykey: "{{userkey}}", type: "reply", message: data, parent: id}; session.publish("websocket/channel/{{groupid}}", event); $("#replymessage-"+id+" textarea").val(""); $("#replymessage-"+id).hide(); } catch(error) { // L'envoi ne s'est pas fait console.log("Retry to send"); // On flag le fait de retenter l'envoit à la reconnexion tosend=true; // On signal que l'envoi est en cours sur le bouton $("#replymessage-"+id+" a").html("Envoi en cours"); $("#replymessage-"+id+" a").addClass("btn-danger"); $("#replymessage-"+id+" a").css('cursor','progress'); } } function recuplastmsg() { console.log("recuplastmsg"); $.ajax({ method: "POST", url: "{{ path('cadoles_websocket_message_list') }}", data: { "id": {{ groupid }}, }, success: function(datas) { $.each(datas, function(i,data) { // Le message a-t-il été déposé durant la déconnexion ? if(!$("#message-"+data.id).length) { html =" "; $(".mychat").prepend(html); } $.each(data.childs, function(i,child) { if(!$("#message-"+child.id).length) { html =" "; $("#msgreplys-"+data.id).prepend(html); } }); }); } }); } // islive function islive() { if(!session) return; isalive=true; {% if app.user.visible %} addOnline({{app.user.id}}, "{{app.user.avatar}}", "{{app.user.lastname}}", "{{app.user.firstname}}"); event={mykey: "{{userkey}}", type: "islive", userid: {{app.user.id}}, useravatar: "{{app.user.avatar}}", userlastname: "{{app.user.lastname}}", userfirstname: "{{app.user.firstname}}" }; console.log("send islive"); session.publish("websocket/channel/{{groupid}}", event); {% endif %} } function addOnline(userid, useravatar, userlastname, userfirstname) { {% set colorlabel= colormain %} {% if border %} {% set colorlabel = colorbody %} {% endif %} {% if colorbody==colorbodyfont %} {% set colorlabel = colorbodyback %} {% endif %} if(!$("#online"+userid).length) { html = ""; html+= ""; html+= "