Compare commits

..

No commits in common. "5d877dd8ca46cc3d486abce05dbd537d93cd81a2" and "87ce3767fa20ab5721f6de948e4f5c2595913ccb" have entirely different histories.

3 changed files with 6 additions and 58 deletions

View File

@ -1,6 +1,5 @@
/.web-server-pid /.web-server-pid
/app/config/parameters.yml /app/config/parameters.yml
/src/Cadoles/CoreBundle/Command/data/core-init-01.sql
/build/ /build/
/phpunit.xml /phpunit.xml
/var/* /var/*

View File

@ -58,7 +58,6 @@
<input id="sendbymail" type="checkbox" id="item_essential" name="item[essential]" style="float:right" class='switch' ></input> <input id="sendbymail" type="checkbox" id="item_essential" name="item[essential]" style="float:right" class='switch' ></input>
<label class="custom-control-label" for="sendbymail">Envoyer par Mail ?</label> <label class="custom-control-label" for="sendbymail">Envoyer par Mail ?</label>
<a id="sendbtn" class="btn btn-success" style="margin-top:5px; width:100%; margin-bottom:15px">Envoyer</a> <a id="sendbtn" class="btn btn-success" style="margin-top:5px; width:100%; margin-bottom:15px">Envoyer</a>
<div id="useronline" style="margin-bottom:10px"></div>
</div> </div>
@ -223,18 +222,16 @@
], ],
height: 150 height: 150
}); });
},1000); },500);
$(".switch").bootstrapSwitch(); $(".switch").bootstrapSwitch();
$("#mymodal-sendmail").removeAttr("tabindex"); $("#mymodal-sendmail").removeAttr("tabindex");
websocket(); websocket();
/*
setInterval(function(){ setInterval(function(){
islive(); islive();
}, 15000); }, 15000);
*/
}); });
{% if websocket_activate and app.user %} {% if websocket_activate and app.user %}
@ -306,28 +303,6 @@
if(payload.alert) { if(payload.alert) {
alert(payload.alert); alert(payload.alert);
} }
if(payload.islive) {
if(payload.userid!={{app.user.id}}) {
console.log("Received message islive", payload.userid);
addOnline(payload.userid, payload.useravatar, payload.userlastname, payload.userfirstname);
{% if app.user.visible %}
event={mykey: "{{userkey}}", type: "meto", userid: {{app.user.id}}, useravatar: "{{app.user.avatar}}", userlastname: "{{ app.user.lastname}}", userfirstname: "{{ app.user.firstname }}" };
session.publish("websocket/channel/{{groupid}}", event);
{% endif %}
}
}
if(payload.meto) {
console.log("Received message meto", payload.userid, payload.useravatar, payload.userlastname, payload.userfirstname);
addOnline(payload.userid, payload.useravatar, payload.userlastname, payload.userfirstname);
}
if(payload.isdead) {
console.log("Received message isdead", payload.userid);
$("#online"+payload.userid).remove();
}
}); });
}); });
@ -497,24 +472,11 @@
function islive() { function islive() {
if(!session) return; if(!session) return;
isalive=true; isalive=true;
event={mykey: "{{userkey}}", type: "islive", userid: {{app.user.id}}};
{% 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"); console.log("send islive");
session.publish("websocket/channel/{{groupid}}", event); session.publish("websocket/channel/{{groupid}}", event);
{% endif %}
} }
function addOnline(userid, useravatar, userlastname, userfirstname) {
if(!$("#online"+userid).length) {
html = "<span id='online"+userid+"'>";
html+= "<img style='cursor:pointer; width:30px; height:30px; margin-right:5px;' onclick='seeUser("+userid+")' title='"+userlastname+" "+userfirstname+"' id='user_avatar_img' src='/{{ alias }}/uploads/avatar/"+useravatar+"' class='avatar'>";
html+= "</span>";
$("#useronline").append(html);
}
}
{% endif %} {% endif %}

View File

@ -52,7 +52,9 @@ class WebsocketTopic implements TopicInterface
public function onUnSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request) public function onUnSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request)
{ {
//this will broadcast the message to ALL subscribers of this topic. //this will broadcast the message to ALL subscribers of this topic.
$topic->broadcast(['isdead' => 'isdead','userid'=>$connection->userId]); $topic->broadcast(['log' => "Alive = ".$event["userid"]]);
$topic->broadcast(['log' => $connection->resourceId . " has left " . $topic->getId(). " || userid = ".$connection->userId]);
} }
@ -88,25 +90,10 @@ class WebsocketTopic implements TopicInterface
if($group&&$usergroup&&$user) { if($group&&$usergroup&&$user) {
if($event["type"]=="islive") { if($event["type"]=="islive") {
$topic->broadcast([ $topic->broadcast(['log' => "Alive = ".$event["userid"]]);
"islive" => "islive",
"userid" => $event["userid"],
"useravatar" => $event["useravatar"],
"userlastname" => $event["userlastname"],
"userfirstname" => $event["userfirstname"],
]);
$connection->userId=$event["userid"]; $connection->userId=$event["userid"];
} }
if($event["type"]=="meto") {
$topic->broadcast([
"meto" => "meto",
"userid" => $event["userid"],
"useravatar" => $event["useravatar"],
"userlastname" => $event["userlastname"],
"userfirstname" => $event["userfirstname"],
]);
}
if($event["type"]=="add") { if($event["type"]=="add") {
if(array_key_exists("mail",$event)) { if(array_key_exists("mail",$event)) {