Browse Source

integration, presque termine

Sevajol Bastien 12 years ago
parent
commit
7ea30d4522

+ 1 - 1
app/Resources/translations/network.fr.yml View File

@@ -11,7 +11,7 @@ search:
11 11
     submit_value:       Rechercher
12 12
 users:                Utilisateurs
13 13
 groups:               Groupes
14
-followed_by:          Vous êtes suivis par
14
+followed_by:          Ces utilisateurs suivent désormais vos publications
15 15
 
16 16
 favorites:
17 17
   your_favorites:     Vos favoris

+ 10 - 0
app/Resources/translations/userui.fr.yml View File

@@ -200,8 +200,18 @@ autoplay:
200 200
 
201 201
 events:
202 202
   view:
203
+    link_delete:         Considérer comme vu(s)
203 204
     title:
204 205
       comments:          Commentaires
205 206
       nvxfav:            Mis en favoris
206 207
       tagsprop:          Proposition de tags
208
+    text:
209
+      comments:          |
210
+                          Sont affichés ci-dessous vos partages qui ont été commentés, ainsi que les
211
+                          partages sur lesquels vous avez rédigé un commentaire et souhaité être avertis des nouveaux
212
+                          commentaires.
213
+      nvxfav:            |
214
+                          Sont affichés ci-dessous vos partages qui ont été mis en favoris par d'autres utilisateurs
215
+      tagsprop:          |
216
+                          Sont affichés ci-dessous vos partages pour lesquels ont vous propose une nouvelle liste de tags
207 217
       

+ 7 - 8
src/Muzich/MynetworkBundle/Controller/MynetworkController.php View File

@@ -18,11 +18,11 @@ class MynetworkController extends Controller
18 18
   public function indexAction($event_id)
19 19
   {    
20 20
     $user = $this->getUser(true, array('join' => array(
21
-      'followeds_users', 'followers_users', 'followeds_groups'
21
+      'followers_users'//, 'followeds_users', 'followeds_groups'
22 22
     )));
23 23
     
24
-    $followeds_users = $user->getFollowedsUsers();
25
-    $followeds_groups = $user->getFollowedGroups();
24
+    //$followeds_users = $user->getFollowedsUsers();
25
+    //$followeds_groups = $user->getFollowedGroups();
26 26
     $followers_users = $user->getFollowersUsers();
27 27
     
28 28
     if ($event_id)
@@ -35,14 +35,14 @@ class MynetworkController extends Controller
35 35
 
36 36
       if ($event->getUser()->getId() != $this->getUserId())
37 37
       {
38
-        throw $this->createNotFoundException('NotAllowed');
38
+        throw $this->createNotFoundException();
39 39
       }
40 40
       $followers_users = $this->proceedForEvent($event, $followers_users, $event_id);
41 41
     }
42 42
     
43 43
     return array(
44
-      'followeds_users' => $followeds_users,
45
-      'followeds_groups' => $followeds_groups,
44
+      //'followeds_users' => $followeds_users,
45
+      //'followeds_groups' => $followeds_groups,
46 46
       'followers_users' => $followers_users
47 47
     );
48 48
   }
@@ -59,9 +59,8 @@ class MynetworkController extends Controller
59 59
     {
60 60
       if (in_array($user->getId(), $ids))
61 61
       {
62
-        $user->addLiveData('new', true);
62
+        $followers_users_new[] = $user;
63 63
       }
64
-      $followers_users_new[] = $user;
65 64
     }
66 65
     
67 66
     return $followers_users_new;

+ 4 - 34
src/Muzich/MynetworkBundle/Resources/views/Mynetwork/index.html.twig View File

@@ -1,52 +1,22 @@
1 1
 {% extends "MuzichMynetworkBundle::layout.html.twig" %}
2 2
 
3 3
 {% block title %}Mon réseau{% endblock %}
4
+{% block mainbox_classes %}mainbox_padding{% endblock %}
4 5
 
5 6
 {% block content %}
6 7
   
7
-  {% if followeds_users %}
8
-    <b>{{ 'users'|trans({}, 'network') }}</b>
9
-    <ul id="followeds_users" class="inline">
10
-    {% for user in followeds_users %} 
11
-      <li>
12
-        <a href="{{ path('show_user', { 'slug': user.slug }) }}">{{ user.username }}</a>
13
-      </li>
14
-    {% endfor %}
15
-    </ul>
16
-  {% endif %}
17
-  
18
-  {% if followeds_groups %}
19
-    <b>{{ 'groups'|trans({}, 'network') }}</b>
20
-    <ul id="followeds_groups" class="inline">
21
-    {% for group in followeds_groups %} 
22
-      <li>
23
-        <a href="{{ path('show_group', { 'slug': group.slug }) }}">{{ group.name }}</a>
24
-      </li>
25
-    {% endfor %}
26
-    </ul>
27
-  {% endif %}
8
+  <h1>{{ 'followed_by'|trans({}, 'network') }}</h1>
28 9
   
29 10
   {% if followers_users %}
30
-    <b>{{ 'followed_by'|trans({}, 'network') }}</b>
11
+    
31 12
     <ul id="followers_users" class="inline">
32 13
     {% for user in followers_users %} 
33
-      <li {% if user.hasLiveData('new', true) %}class="new"{% endif %}>
14
+      <li>
34 15
         <a href="{{ path('show_user', { 'slug': user.slug }) }}">{{ user.username }}</a>
35 16
       </li>
36 17
     {% endfor %}
37 18
     </ul>
38 19
   {% endif %}
39
-    
40
-  {% if followeds_users|length < 1  %}
41
-  {% if followeds_groups|length < 1 %}
42
-  {% if followers_users|length < 1 %}
43 20
   
44
-    <br />
45
-    {{ 'nothing'|trans({}, 'network') }}
46
-    <br /><br />
47
-    
48
-  {% endif %}
49
-  {% endif %}
50
-  {% endif %}
51 21
 
52 22
 {% endblock %}

+ 37 - 2
src/Muzich/UserBundle/Controller/EventController.php View File

@@ -3,9 +3,12 @@
3 3
 namespace Muzich\UserBundle\Controller;
4 4
 
5 5
 use Muzich\CoreBundle\lib\Controller;
6
+use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
6 7
 
7 8
 class EventController extends Controller
8 9
 {
10
+  
11
+  protected $event;
9 12
     
10 13
   public function infoBarAction()
11 14
   {
@@ -60,8 +63,7 @@ class EventController extends Controller
60 63
     $es->setIdsDisplay($event->getType());
61 64
     
62 65
     $this->setElementSearcherParams($es->getParams(), $user->getPersonalHash($event->getId()));
63
-    //$this->getDoctrine()->getEntityManager()->remove($event);
64
-    //$this->getDoctrine()->getEntityManager()->flush();
66
+    
65 67
         
66 68
     $elements = $es->getElements($this->getDoctrine(), $this->getUserId());
67 69
     
@@ -72,4 +74,37 @@ class EventController extends Controller
72 74
     ));
73 75
   }
74 76
   
77
+  public function userCanAccessToThisEvent($event_id)
78
+  {
79
+    if (!($this->event = $this->getDoctrine()->getRepository('MuzichCoreBundle:Event')
80
+      ->findOneById($event_id)))
81
+    {
82
+      throw $this->createNotFoundException();
83
+    }
84
+    
85
+    if ($this->event->getUser()->getId() != $this->getUserId())
86
+    {
87
+      throw $this->createNotFoundException();
88
+    }
89
+  }
90
+  
91
+  public function userUseCorrectToken($token)
92
+  {
93
+    if ($this->getUser()->getPersonalHash($this->event->getId()) != $token)
94
+    {
95
+      throw new AccessDeniedException();
96
+    }
97
+  }
98
+  
99
+  public function deleteAction($event_id, $token)
100
+  {
101
+    $this->userCanAccessToThisEvent($event_id);
102
+    $this->userUseCorrectToken($token);
103
+    
104
+    $this->getEntityManager()->remove($this->event);
105
+    $this->flush();
106
+    
107
+    return $this->redirect($this->generateUrl('home'));
108
+  }
109
+  
75 110
 }

+ 7 - 0
src/Muzich/UserBundle/Resources/config/routing.yml View File

@@ -37,3 +37,10 @@ update_address:
37 37
 event_view_elements:
38 38
   pattern: /event/view/elements/{event_id}
39 39
   defaults: { _controller: MuzichUserBundle:Event:viewElements }
40
+
41
+event_delete:
42
+  pattern: /event/delete/{event_id}/{token}
43
+  defaults: { _controller: MuzichUserBundle:Event:delete }
44
+  requirements:
45
+    _method:  GET
46
+    message_id: \d+

+ 25 - 1
src/Muzich/UserBundle/Resources/views/Event/elements.html.twig View File

@@ -1,25 +1,49 @@
1 1
 {% extends "MuzichHomeBundle::layout.html.twig" %}
2 2
 
3
-{% block title %}TODO{% endblock %}
3
+{% block title %}
4
+  {% if event.type == event_const('TYPE_COMMENT_ADDED_ELEMENT') %}
5
+    {{ 'events.view.title.comments'|trans({}, 'userui') }}
6
+  {% endif %}
7
+  {% if event.type == event_const('TYPE_FAV_ADDED_ELEMENT') %}
8
+    {{ 'events.view.title.nvxfav'|trans({}, 'userui') }}
9
+  {% endif %}
10
+  {% if event.type == event_const('TYPE_TAGS_PROPOSED') %}
11
+    {{ 'events.view.title.tagsprop'|trans({}, 'userui') }}
12
+  {% endif %}
13
+{% endblock %}
4 14
 {% block mainbox_classes %}mainbox_nopadding{% endblock %}
5 15
 
6 16
 {% block content %}
7 17
 
8 18
   <div class="top_tools">
9 19
     
20
+    <div class="show_options">
21
+     
22
+      <a class="button darkbutton" href="{{ path('event_delete', {
23
+        'event_id' : event.id,
24
+        'token'    : app.user.getPersonalHash(event.id)
25
+      }) }}" >
26
+        {{ 'events.view.link_delete'|trans({}, 'userui') }}
27
+      </a>
28
+    
29
+    </div>
30
+    
10 31
     {% if event.type == event_const('TYPE_COMMENT_ADDED_ELEMENT') %}
11 32
       
12 33
       <h1>{{ 'events.view.title.comments'|trans({}, 'userui') }}</h1>
34
+      <p>{{ 'events.view.text.comments'|trans({}, 'userui') }}</p>
13 35
       
14 36
     {% endif %}
15 37
     {% if event.type == event_const('TYPE_FAV_ADDED_ELEMENT') %}
16 38
       
17 39
       <h1>{{ 'events.view.title.nvxfav'|trans({}, 'userui') }}</h1>
40
+      <p>{{ 'events.view.text.nvxfav'|trans({}, 'userui') }}</p>
18 41
       
19 42
     {% endif %}
20 43
     {% if event.type == event_const('TYPE_TAGS_PROPOSED') %}
21 44
       
22 45
       <h1>{{ 'events.view.title.tagsprop'|trans({}, 'userui') }}</h1>
46
+      <p>{{ 'events.view.text.tagsprop'|trans({}, 'userui') }}</p>
23 47
       
24 48
     {% endif %}
25 49