Commit d5c0d270 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Fix hash et icone pour le context

parent b3c5912c
Loading
Loading
Loading
Loading
+15 −2
Changes for module/Oscar/src/Oscar/Service/NotificationService.php: 15 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@

namespace Oscar\Service;

use Doctrine\ORM\NoResultException;
use Oscar\Entity\Activity;
use Oscar\Entity\Notification;
use Oscar\Provider\Privileges;
@@ -69,11 +70,17 @@ class NotificationService implements ServiceLocatorAwareInterface, EntityManager
    public function notification( $message, $personsId, $context='Application', $contextId=-1, $key=null)
    {
        if ($key === null) {
            $key = $context.':'.$contextId.'-'.uniqid();
            $key = $context.':'.$contextId;
        }
        $push = [];
        foreach ($personsId as $personid) {
            $hash = md5($personid . '/' . $key);

            try {
                // On commence par regarder si une notification n'existe pas déjà
                // pour cette person dans le context (basé sur le HASH)
                $exist = $this->getEntityManager()->getRepository(Notification::class)->findOneBy(['hash' => $hash]);
                if( !$exist ){
                    $date = new \DateTime();
                    $notification = new Notification();
                    $notification->setContext('Application')
@@ -88,9 +95,15 @@ class NotificationService implements ServiceLocatorAwareInterface, EntityManager
                        ->setRecipientId($personid);
                    $this->getEntityManager()->persist($notification);

            $this->getEntityManager()->flush($notification);
                    $push[] = $notification->getId();
                } else {
                    $notification->setDateEffective(new \DateTime());
                }
            } catch ( \Exception $e ){

            }
        }
        $this->getEntityManager()->flush();

        // Push vers le socket si besoin
        $configSocket = $this->getServiceLocator()->get('Config')['oscar']['socket'];
+12 −0
Changes for public/css/app.css: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -7510,6 +7510,18 @@ span[class*="status-400"] .icon:before {
[class*="icon-tutelle-de-gestion"]:before {
  content: '\e851'; }

[class*="icon-Activity"]:before {
  content: '\e880'; }

[class*="icon-Application"]:before {
  content: '\e87d'; }

[class*="icon-Person"]:before {
  content: '\e89a'; }

[class*="icon-Organization"]:before {
  content: '\e876'; }

/*
span[class*="status-102"] .icon:before{ content: '\e85e '}
span[class*="status-4"] .icon:before{ content: '\e865 '}
+6 −0
Changes for public/css/app.scss: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1874,6 +1874,12 @@ span[class*="status-400"] .icon:before{ content: '\e87f'; color: #550000; }
[class*="icon-composante-responsable"],[class*="charge-de-valorisation"] { &:before{ content: '\e87f'; }}
[class*="icon-tutelle-de-gestion"]:before{ content: '\e851'; }

// Icon / Context
[class*="icon-Activity"]:before{ content: '\e880'; }
[class*="icon-Application"]:before{ content: '\e87d'; }
[class*="icon-Person"]:before{ content: '\e89a'; }
[class*="icon-Organization"]:before{ content: '\e876'; }


/*
span[class*="status-102"] .icon:before{ content: '\e85e '}
+1 −1
Changes for public/js/components/build/notifications.js: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ define(['exports', 'vue', 'vue-resource', 'mm'], function (exports, _vue, _vueRe
    _vue2.default.http.options.emulateHTTP = true;

    var notifications = _vue2.default.extend({
        template: ' <p class="navbar-text navbar-right" id="notifications-area" >\n                        <a class="navbar-link" @click="open = !open">\n                            <i class="icon-bell"></i> Notifications \n                            <span class="notifications-total" :class="notifications.length ? \'unread\' : \'\'">{{ notifications.length }}</span>\n                        </a>\n                        <section class="list" v-show="open">\n                            <header class="control">\n                                <h3>\n                                    <span class="intitule">\n                                        <i class="icon-bell"></i>\n                                        {{ notifications.length }} notifications\n                                        <i class="animate-spin icon-asterisk" v-show="loading"></i>\n                                    </span>\n                                    <a href="#" title="Tous effacer" @click="deleteNotification(notifications)"><i class="icon-trash-empty"></i></a>\n                                    <a href="#" title="Tous marquer comme lu"><i class="icon-ok-circled"></i></a>\n                                </h3>\n                            </header>\n                            <article v-for="notification in orderedNotifications" :class="{ \'read\': notification.read, \'fresh\' : notification.fresh }" class="notification">\n                                <h4>\n                                    <time datetime="">{{ notification.dateEffective | moment }}</time>\n                                    <a href="#" @click="deleteNotification([notification])"><i class="icon-trash-empty"></i></a>\n                                </h4>\n                                <p>{{ notification.message }}</p>\n                            </article>\n                        </section>\n                    </p>',
        template: ' <p class="navbar-text navbar-right" id="notifications-area" >\n                        <a class="navbar-link" @click="open = !open">\n                            <i class="icon-bell"></i> Notifications \n                            <span class="notifications-total" :class="notifications.length ? \'unread\' : \'\'">{{ notifications.length }}</span>\n                        </a>\n                        <section class="list" v-show="open">\n                            <header class="control">\n                                <h3>\n                                    <span class="intitule">\n                                        <i class="icon-bell"></i>\n                                        {{ notifications.length }} notifications\n                                        <i class="animate-spin icon-asterisk" v-show="loading"></i>\n                                    </span>\n                                    <a href="#" title="Tous effacer" @click="deleteNotification(notifications)"><i class="icon-trash-empty"></i></a>\n                                    <a href="#" title="Tous marquer comme lu"><i class="icon-ok-circled"></i></a>\n                                </h3>\n                            </header>\n                            <article v-for="notification in orderedNotifications" :class="{ \'read\': notification.read, \'fresh\' : notification.fresh }" class="notification">\n                                <h4>\n                                    <i :class="\'icon-\'+notification.context"></i>\n                                    <time datetime="">{{ notification.dateEffective | moment }}</time>\n                                    <a href="#" @click="deleteNotification([notification])"><i class="icon-trash-empty"></i></a>\n                                </h4>                              \n                                <p>{{ notification.message }}</p>\n                            </article>\n                        </section>\n                    </p>',

        data: function data() {
            return {
+1 −0
Changes for public/js/components/src/notifications.js: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ var notifications = Vue.extend({
                            </header>
                            <article v-for="notification in orderedNotifications" :class="{ 'read': notification.read, 'fresh' : notification.fresh }" class="notification">
                                <h4>
                                    <i :class="'icon-'+notification.context"></i>
                                    <time datetime="">{{ notification.dateEffective | moment }}</time>
                                    <a href="#" @click="deleteNotification([notification])"><i class="icon-trash-empty"></i></a>
                                </h4>