correction mineure

This commit is contained in:
afornerot 2020-06-23 12:21:45 +02:00
parent 92a0d91a1d
commit be3cfa2814
5 changed files with 53 additions and 26 deletions

View File

@ -54,11 +54,6 @@
$session->set($config->getId(), strval($config->getValue()));
}
// Calcul des couleurs
$color = $this->container->get('cadoles.core.service.color');
$color->setColor();
// Utilisateur en cours
$curentuserid=0;
$token = $this->token_storage->getToken();
@ -303,9 +298,13 @@
}
}
// Calcul des couleurs
$color = $this->container->get('cadoles.core.service.color');
$color->setColor();
// Visite
if($curentuser!="anon.") {
$now=new \DateTime();
if(!$curentuser->getVisitedate()) {

View File

@ -517,18 +517,20 @@ class PageController extends Controller
// Compteur de visite
if($this->getUser()) {
$group=$em->getRepository("CadolesCoreBundle:Group")->find($groupid);
if($group && $group->getFgcanshare()) {
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["group"=>$group,"user"=>$this->getUser()]);
if($usergroup) {
$visitedate=$usergroup->getVisitedate();
if($visitedate) $visitedate->add(new \DateInterval("PT1H"));
$now=new \DateTime();
if($visitedate<$now) {
$usergroup->setVisitedate($now);
$usergroup->setVisitecpt($usergroup->getVisitecpt()+1);
$em->persist($usergroup);
$em->flush();
if($groupid) {
$group=$em->getRepository("CadolesCoreBundle:Group")->find($groupid);
if($group && $group->getFgcanshare()) {
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findoneby(["group"=>$group,"user"=>$this->getUser()]);
if($usergroup) {
$visitedate=$usergroup->getVisitedate();
if($visitedate) $visitedate->add(new \DateInterval("PT1H"));
$now=new \DateTime();
if($visitedate<$now) {
$usergroup->setVisitedate($now);
$usergroup->setVisitecpt($usergroup->getVisitecpt()+1);
$em->persist($usergroup);
$em->flush();
}
}
}
}

View File

@ -22,6 +22,8 @@
{% if colorbodyfont is null %}
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %}
{% set colorbody = color['colorbody'] %}
{% set colormain = color['main'] %}
{% if app.user %}
<style>.msgtopic a { color: #{{colorbodyfont}}; font-weight: bold; }</style>
@ -37,7 +39,7 @@
{% if onheader %}
<div class="widgetheader" style="{{ stylewidgetbodyimage }}">
<iframe src="{{ path(tool,{'id':group,'framed':true,'border':entity.border,'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" style="margin-top:30px" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
<iframe src="{{ path(tool,{'id':group,'framed':true,'border':entity.border,'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont,'colorbody':colorbody,'colormain':colormain}) }}" style="margin-top:30px" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
</div>
{% else %}
<div class="widgetheader" style="{{ stylewidgetheader }}">
@ -51,7 +53,7 @@
<div class="widgetbody" style="{{ stylewidgetbodyframe }}; overflow-y:auto; {%if entity.border %} padding-left: 10px; {%endif%}">
{% if group is not null %}
{{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont})) }}
{{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont,'colorbody':colorbody,'colormain':colormain})) }}
{% endif %}
<!--
<iframe src="{{ path(tool,{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>

View File

@ -32,11 +32,16 @@ class ChatController extends Controller
$colorbodyback=$request->query->get('colorbodyback');
$colorbodyfont=$request->query->get('colorbodyfont');
}
$colorbody=$request->query->get('colorbody');
$colormain=$request->query->get('colormain');
}
else {
$border=false;
$colorbodyback=$this->get('session')->get('color')["main"];
$colorbodyfont=$this->get('session')->get('color')["fontcolorhover"];
$colorbody=$this->get('session')->get('color')["colorbody"];
$colormain=$this->get('session')->get('color')["main"];
}
$em = $this->getDoctrine()->getManager();
@ -101,6 +106,8 @@ class ChatController extends Controller
'border' => $border,
'colorbodyback' => $colorbodyback,
'colorbodyfont' => $colorbodyfont,
'colorbody' => $colorbody,
'colormain' => $colormain,
'ingroup' => ($usergroup),
'fgmanager' => ($usergroup&&($usergroup->getFgmanager()||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO")),
'form' => $form->createView()

View File

@ -89,16 +89,24 @@
{% 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) }}
<div id="topchat" class='row'>
{{ form_widget(form.message) }}
<input id="sendbymail" type="checkbox" style="float:right" class='switch' ></input>
<label class="custom-control-label" for="sendbymail" style="color:#{{ colorbodyfont }}">Envoyer par Mail ?</label>
<label class="custom-control-label" for="sendbymail" style="color:#{{ colorlabel }}">Envoyer par Mail ?</label>
<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>
<input id="unsee" type="checkbox" style="float:right" class='switch' onChange="switchsee()"></input>
<label class="custom-control-label" for="unsee" style="color:#{{ colorbodyfont }}">Afficher les messages masqués ?</label>
<label class="custom-control-label" for="unsee" style="color:#{{ colorlabel }}">Afficher les messages masqués ?</label>
</div>
@ -733,10 +741,19 @@
}
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 = "<span id='online"+userid+"' style='width:70px; display:inline-block; text-align: center; font-size: 10px; color:#{{ colorbodyback }}; text-transform: uppercase; line-height:11px;overflow-wrap: break-word;vertical-align:top;'>";
html+= "<img style='cursor:pointer; width:40px; height:40px; margin-bottom:5px;' onclick='seeUser("+userid+")' title='"+userlastname+" "+userfirstname+"' id='user_avatar_img' src='/{{ alias }}/uploads/avatar/"+useravatar+"' class='avatar'>";
html+= "<span style='color:#{{colorbodyfont}}'>"+userlastname+" "+userfirstname+"</span>";
html+= "<span style='color:#{{colorlabel}}'>"+userlastname+" "+userfirstname+"</span>";
html+= "</span>";
$("#useronline").append(html);
}