summaryrefslogtreecommitdiffstats
path: root/agenda/billboardviews.py
diff options
context:
space:
mode:
Diffstat (limited to 'agenda/billboardviews.py')
-rw-r--r--agenda/billboardviews.py367
1 files changed, 156 insertions, 211 deletions
diff --git a/agenda/billboardviews.py b/agenda/billboardviews.py
index eaea323..50139ee 100644
--- a/agenda/billboardviews.py
+++ b/agenda/billboardviews.py
@@ -8,231 +8,134 @@ from django.contrib.auth import authenticate, login
from django.contrib.auth.models import Group,User
from django.contrib.comments.models import Comment
from infopoint.agenda.templatetags import *
-from infopoint.agenda.models import Event, Attendance,Todo, Billboard,Location
+from infopoint.agenda.models import Event, Attendance,Todo, Billboard
from infopoint.agenda.forms import TodoCreateForm, TodoForm
from django.contrib.formtools.preview import FormPreview
from django.views.generic import create_update
from django.template import RequestContext
from django.forms import ModelForm
import pydot
-import unicodedata
+today = date.today()
-def event_style(event_id):
- ev_node_style = "style='filled',fontname='Arial',fontsize='14',shape='component',URL='http://infopoint/agenda/'+str(event_id),rank='same'"
- return ev_node_style
-
-def group_galaxymap(request,object_id):
- this_group = Group.objects.get(pk=object_id)
-
- group_map = pydot.Dot(this_group.name, graph_type='digraph',strict=False, suppress_disconnected=True, fontname='Arial',size="12,12",overlap="False", ranksep='0.5',ratio='auto',bgcolor="#ffffff00", packmode="clust",URL="http://infopoint/",concentrate='True' )
- group_map.add_node(pydot.Node(this_group.name,fontname='Arial',style='filled',fontsize='26',shape='tab',fillcolor="#fd47bbff" ,URL="/agenda/map/user/"+object_id))
- related_groups = Group.objects.all().filter(user__in=this_group.user_set.all())
- for other_group in related_groups.exclude(pk=object_id):
- group_map.add_node(pydot.Node(other_group.name,fillcolor='#ec8968ff',fontname='Arial',style='filled',fontsize='12',shape='tab' ,URL="/agenda/group/"+str(other_group.id)))
- for members in other_group.user_set.all().exclude(pk=object_id):
- group_map.add_edge(pydot.Edge(members.username,other_group.name,fontname='Arial',fontsize='8',rank="sink"))
-
- for user_group in User.objects.all().filter(groups__in=(Group.objects.all().filter(user__in=this_group.user_set.all()))).distinct().exclude(pk=object_id):
- group_map.add_node(pydot.Node(user_group.username,color='purple',fontsize='12',style="filled",fillcolor="#00ff005f",fontname='Arial',shape='egg',URL="/agenda/user/"+str(user_group.id),rank="same"))
-
- for person in this_group.user_set.all():
- group_map.add_node(pydot.Node(person.username,color='yellow',fontsize='12',style="filled",fillcolor="#f7c640ff",fontname='Arial',shape='egg',URL="/agenda/user/"+str(person.id),rank="same"))
- group_map.add_edge(pydot.Edge(person.username,this_group.name,style='rounded',fontname='Arial'))
-
- for one_todo in this_group.todo_set.all().exclude(done=True):
- group_map.add_node(pydot.Node(one_todo.title,fillcolor="#f7c640ff",fontname='Arial',style='filled',fontsize='12',shape='note',URL='http://infopoint/agenda/todo/'+str(one_todo.id),rank='sink' ))
- group_map.add_edge(pydot.Edge(one_todo.title,this_group.name,style='rounded',fontname='Arial'))
- group_map.add_edge(pydot.Edge(one_todo.creator,one_todo.title,style='dotted',fontname='Arial',constraint='False'))
- for comment in Comment.objects.filter(content_type=2,object_pk=this_group.id):
- decoded = comment.comment.encode('ascii','replace')[0:12]
- group_map.add_node(pydot.Node(str(comment.id),label=decoded,fillcolor='#8bde93ff',fontname='Arial',style='filled',fontsize='14',shape='note',URL='http://infopoint/comment/'+str(comment.id),rank='same' ))
- group_map.add_edge(pydot.Edge(this_group.name,str(comment.id),style='rounded'))
- group_map.add_edge(pydot.Edge(str(comment.user),str(comment.id),style='dotted'))
- for one_event in this_group.events.all():
- group_map.add_node(pydot.Node(one_event.title[0:20], style='filled',fontname='Arial',fontsize='14',shape='component',URL='http://infopoint/agenda/'+str(one_event.id),rank='same', fillcolor="#acce4aff"))
- this_location = one_event.location
- group_map.add_edge(pydot.Edge(one_event.title[0:20],this_location.title))
- group_map.add_edge(pydot.Edge(this_group.name,this_location.title,style='dotted',fontname='Arial'))
- group_map.add_edge(pydot.Edge(this_group.name,one_event.title[0:20],style='rounded',fontname='Arial'))
- group_map.add_node(pydot.Node(this_location.title,fillcolor="#e399f6ff",fontname='Arial',style='filled',fontsize='8',shape='house',URL='http://infopoint/agenda/location/'+str(this_location.id)))
- if one_event.todo.count():
- todo_count = one_event.todo.count()
- group_map.add_node(pydot.Node(str(todo_count)+" todos",color='black',fillcolor="#f7c640ff",fontname='Arial',style='filled',fontsize='8',shape='note',URL='http://infopoint/agenda/'+str(one_event.id),rank='sink' ))
- group_map.add_edge(pydot.Edge(one_event.title[0:20],str(todo_count)+" todos",style='rounded',fontname='Arial'))
- group_map.add_edge(pydot.Edge(this_group.name,one_event.title[0:20],style='rounded'))
-
- for another_group in one_event.redes.all().exclude(pk=object_id):
- group_map.add_edge(pydot.Edge(another_group.name,one_event.title[0:20],style='dotted',fontname='Arial'))
-
- group_map.write_png('/var/www/media/maps/group_'+object_id+'.png', prog='dot')
- group_map.write_cmap('/var/www/media/maps/group_'+object_id+'.map', prog='dot')
- group_map.write_dot('/var/www/media/maps/group_'+object_id+'.dot', prog='dot')
- return HttpResponseRedirect('/agenda/group/'+object_id)
-
-
-
-def user_galaxymap(request,object_id):
- user = User.objects.get(pk=object_id)
- #comments =
-
-
- user_map = pydot.Dot(user.username, graph_type='digraph',strict=False, suppress_disconnected=True, fontname='Arial',size="11,14",overlap="False", ranksep='0.5',ratio='auto',bgcolor="#ffffff00", packmode="clust",URL="http://infopoint/",concentrate='True' )
- user_map.add_node(pydot.Node(user.username,color='purple',fontname='Arial',style='filled',fontsize='20',shape='record' ,URL="http://infopoint/agenda/map/user/"+object_id))
- user_events = user.events.all()
- user_comments = user.comment_comments.all()
- todos_created_by_user = user.todocreator.all().filter(done=False)
- groups = pydot.Subgraph(graph_name='Groups', label='Groups',suppress_disconnected=False,style='filled',fillcolor='#00ff005d',fontname='Arial', rank='same')
-
- user_map.add_node(pydot.Node('Todos',color='purple',fontname='Arial',style='filled',fontsize='20',shape='note' ,URL="http://infopoint/agenda/map/user/"+object_id))
- user_map.add_edge(pydot.Edge(user.username,'Todos',style='rounded',fontname='Arial',label='location',len='1'))
- for one_event in todos_created_by_user:
- user_map.add_node(pydot.Node(one_event.title,fontname='Arial',style='filled',fontsize='16',shape='component',URL='http://infopoint/agenda/todo/'+str(one_event.id),rank='same' ))
- user_map.add_edge(pydot.Edge('Todos',one_event.title,style='rounded',fontname='Arial'))
-
- for one_event in user_events:
- user_map.add_node(pydot.Node(str(one_event.title),color='green',fontname='Arial',style='filled',fontsize='10',shape='record',URL='http://infopoint/agenda/'+str(one_event.id)))
- user_map.add_edge(pydot.Edge(user.username,str(one_event.title),style='rounded',fontname='Arial',label='goes to',len='1'))
- user_map.add_edge(pydot.Edge(str(one_event.title),str(one_event.location),style='rounded',fontname='Arial',label='location',len='1'))
- user_map.add_subgraph(groups)
-
- user_map.write_png('/var/www/media/maps/user_'+object_id+'.png', prog='dot')
- user_map.write_cmap('/var/www/media/maps/user_'+object_id+'.map', prog='dot')
- map_coordinates = user_map.create_cmap( prog='dot')
- return HttpResponseRedirect('/agenda/user/'+object_id)
-
-
-def location_galaxymap(request,object_id):
- location = Location.places.get(pk=object_id)
- #comments =
- location_map = pydot.Dot(location.title, graph_type='digraph',strict=False, suppress_disconnected=False, fontname='Arial',size="12,4",overlap="False", ranksep='0.5',ratio='auto',bgcolor="#ffffff00", packmode="clust",URL="http://infopoint/", concentrate='True' )
- location_map.add_node(pydot.Node(location.title,fontname='Arial',style='filled',fontsize='24',shape='house',fillcolor='#e399f6ff', URL='/agenda/location/'+str(object_id)))
- events_map = pydot.Subgraph(graph_name='Events')
- todo_map = pydot.Subgraph(graph_name='Todos')
- groups_map = pydot.Subgraph(graph_name='Groups')
- comments_map = pydot.Subgraph(graph_name='Comments')
-
- for one_todo in location.todolocation.all():
- todo_map.add_node(pydot.Node(one_todo.title[0:20],URL='/agenda/'+str(one_todo.id) ))
- location_map.add_edge(pydot.Edge(one_todo.title[0:20],location.title))
- location_map.add_edge(pydot.Edge(one_todo.creator,one_todo.title[0:20]))
-
- for events in location.event_set.all():
- events_map.add_node(pydot.Node(events.title.encode('ascii', 'ignore')[0:20],URL='/agenda/'+str(events.id) ))
- location_map.add_edge(pydot.Edge(events.title.encode('ascii', 'ignore')[0:20],location.title))
- for comment in Comment.objects.filter(content_type='13',object_pk=events.id):
- comment.comment.encode('ascii', 'ignore')
- comments_map.add_node(pydot.Node(comment.comment[0:20],URL='/comment/'+str(comment.id) ))
- location_map.add_edge(pydot.Edge(events.title[0:20],comment.comment[0:20]))
- location_map.add_edge(pydot.Edge(comment.user,comment.comment[0:20],constraint='False'))
-
- for group in events.group.iterator():
- groups_map.add_node(pydot.Node(group.group,URL='/comment/'+str(group.group_id) ))
- location_map.add_edge(pydot.Edge(events.title,group.group[0:20]))
-
- for todo in events.todo.all().exclude(done='True'):
- todo.title.encode('ascii', 'ignore')
- todo_map.add_node(pydot.Node(todo.title[0:20],URL='/agenda/todo/'+str(events.id) ))
- location_map.add_edge(pydot.Edge(todo.title[0:20],events.title[0:20]))
- location_map.add_edge(pydot.Edge(todo.creator,todo.title[0:20]))
-
- for comment in Comment.objects.filter(content_type='12',object_pk=object_id):
- comment.comment.encode('ascii', 'ignore')
- comments_map.add_node(pydot.Node(comment.comment[0:20],URL='/comment/'+str(comment.id) ))
- location_map.add_edge(pydot.Edge(location.title,comment.comment[0:20]))
- location_map.add_edge(pydot.Edge(comment.user,comment.comment[0:20]))
-
-
- for a in todo_map.node_list:
- a.set_fontname('Arial')
- a.set_fillcolor("#f7c640ff")
- a.set_style('filled')
- a.set_shape('tab')
- for a in events_map.node_list:
- a.set_fontname('Arial')
- a.set_fillcolor("#acce4aff")
- a.set_style('filled')
- a.set_shape('component')
-
- for a in comments_map.node_list:
+def event_galaxy(request,object_id):
+ event = Event.calendar.select_related().get(pk=object_id)
+ event_redes = event.redes.all()
+ event_attending = event.atendees.all()
+ comments = Comment.objects.filter(content_type=13,object_pk=object_id,is_public=True)
+ other_events_on_this_location = event.location.event_set.all().filter(public=True,start_date__gte=today,end_date__gte=today)[:3]
+ other_events_attended_by_atendees = Event.events.next_events().filter(public=True,start_date__gte=today,atendees__in=event.atendees.all()).distinct()
+ other_events_with_this_event_groups = Event.events.next_events().filter(public=True,redes__in=event.redes.all()).distinct()
+
+ map = pydot.Dot("ev"+str(event.id), graph_type="digraph",strict="True", suppress_disconnected="False", fontname="Arial",ratio="compress",size="8,8",overlap="False", bgcolor="#ffffff6d", packmode="clust",URL="/",remincross="True" )
+ map.add_node(pydot.Node("ev"+str(event.id),label=str(event.title)+" "+str(event.start_date.strftime('%d %b')),color='purple',fontname='Arial',style='filled',fontsize='30',shape='record' ,URL="/agenda/map/"+str(object_id)))
+ map.add_node(pydot.Node("lo"+str(event.location.id),label=str(event.location.title),fontname='Arial',style='filled',fontsize='20',shape='record', fillcolor='#00ff005d',URL='/agenda/location/'+str(event.location.id)))
+ map.add_edge(pydot.Edge("ev"+str(event.id),"lo"+str(event.location.id),style='rounded',len='1'))
+
+ cluster_Groups = pydot.Subgraph(graph_name='cluster_Groups',label='Groups',fontname='Arial',style='rounded')
+ todos = pydot.Subgraph(graph_name='cluster_Todos',label='Tasks',fontname='Arial',style='rounded')
+ events = pydot.Subgraph(label='Events',shape='note',fillcolor='lightgrey',fontname='Arial',style='rounded')
+ comments_graph = pydot.Subgraph(graph_name='Comments',label='Comments',style='rounded',fontname='Arial')
+ for todo in event.todo.all()[:3]:
+ todos.add_node(pydot.Node("td"+str(todo.id),label=todo.title,color='lightpink',fontname='Arial',style='filled',fontsize='10',shape='box'))
+ events.add_edge(pydot.Edge("ev"+str(event.id),"td"+str(todo.id)))
+ for todo in event.location.todolocation.all()[:3]:
+ todos.add_node(pydot.Node("td"+str(todo.id),label=todo.title,color='lightpink',fontname='Arial',style='filled',fontsize='10',shape='box'))
+ events.add_edge(pydot.Edge("lo"+str(event.location.id),"td"+str(todo.id)))
+ for location_event in event.location.event_set.all().filter(public=True,end_date__gte=today).exclude(id=object_id,end_date__lte=today)[:3]:
+ if (location_event.id != event.id):
+ events.add_edge(pydot.Edge("lo"+str(event.location.id),"ev"+str(location_event.id)))
+ events.add_node(pydot.Node("ev"+str(location_event.id),label=str(location_event.title)+"\\n"+str(location_event.start_date.strftime('%b %d')),color='green',fontname='Arial',style='filled',fontsize='10',shape='record',URL='/agenda/'+str(location_event.id)))
+ for pixie in event.pixie.iterator():
+ comments_graph.add_edge(pydot.Edge(pixie.username,"ev"+str(event.id),style='dotted'))
+ comments_graph.add_node(pydot.Node(pixie.username,color='lightpink',fontname='Arial',style='filled',fontsize='10',shape='record'))
+ for comment in comments:
+ comments_graph.add_node(pydot.Node(unicode(comment.comment).encode('ascii'),color="lightpink",fontname='Arial',style='filled',fontsize='10',shape='note' ,URL="/agenda/"+object_id,rank="min"))
+ comments_graph.add_edge(pydot.Edge(comment.user.username,comment.comment.encode('ascii', 'ignore'),style='dotted'))
+ comments_graph.add_edge(pydot.Edge("ev"+str(event.id),comment.comment.encode('ascii', 'ignore'),style='rounded',rank='same'))
- a.set_fontname('Arial')
- a.set_fillcolor("#8bde93ff")
- a.set_style('filled')
- a.set_shape('note')
- location_map.add_subgraph(events_map)
- location_map.add_subgraph(todo_map)
- location_map.add_subgraph(groups_map)
- location_map.add_subgraph(comments_map)
- location_map.write_png('/var/www/media/maps/location_'+object_id+'.png', prog='dot')
- location_map.write_cmap('/var/www/media/maps/location_'+object_id+'.map', prog='dot')
- map_coordinates = location_map.create_cmap( prog='dot')
- return HttpResponseRedirect('/agenda/location/'+object_id)
+ for group in event_redes:
+ cluster_Groups.add_node(pydot.Node("gr"+str(group.id),label=group.name,color='yellow',style="filled",fillcolor="#ff33cc5f" ,shape='record',group='groups',URL="/agenda/group/"+str(group.id), rank="5"))
+ events.add_edge(pydot.Edge("gr"+str(group.id),"ev"+str(event.id),fontname='Arial',fontsize='8',rank="sink"))
+
+ for related_event in other_events_with_this_event_groups.exclude(pk=object_id,public=False,end_date__lte=today)[:3]:
+ if (related_event.id != event.id):
+ events.add_node(pydot.Node("ev"+str(related_event.id),label=related_event.title+"\\n"+str(related_event.start_date.strftime('%b %d')),color='green',fontsize='12',style="filled",fillcolor="#00ff005f",fontname='Arial',shape='box',URL="/agenda/map/"+str(related_event.id),rank="same"))
+
+ for group in related_event.redes.all():
+ events.add_edge(pydot.Edge("gr"+str(group.id),"ev"+str(related_event.id),shape='point',fontsize='8',rank="sink"))
+ cluster_Groups.add_node(pydot.Node("gr"+str(group.id),label=group.name,color='yellow',style="filled",fillcolor="#ff33cc5f" ,shape='record',group='groups',URL="/agenda/group/"+str(group.id), rank="5",fontname='Arial'))
+ if (related_event.id != event.id):
+ events.add_node(pydot.Node("ev"+str(related_event.id),label=related_event.title+"\\n"+str(related_event.start_date.strftime('%b %d')),color='green',fontsize='12',style="filled",fillcolor="#00ff005f",fontname='Arial',shape='box',URL="/agenda/map/"+str(related_event.id),rank="same"))
+ events.add_edge(pydot.Edge("ev"+str(event.id),"ev"+str(related_event.id),fontname='Arial',fontsize='8',style='dotted'))
+ for user in related_event.atendees.all().distinct():
+ events.add_edge(pydot.Edge(user.username,"ev"+str(related_event.id),fontname='Arial',fontsize='8',rank="sink"))
+ map.add_subgraph(comments_graph)
+ map.add_subgraph(cluster_Groups)
+ map.add_subgraph(todos)
+ map.add_subgraph(events)
+ map.write_png('/var/www/media/maps/event_'+object_id+'.png', prog='dot')
+ map.write_dot('/var/www/media/maps/event_'+object_id+'.dot', prog='dot')
+ map.write_cmap('/var/www/media/maps/event_'+object_id+'.map', prog='dot')
+ map_coordinates = map.create_cmap( prog='dot')
+ #return render_to_response('agenda/map_view.html', {'event': event,'map_coordinates':map_coordinates },context_instance=RequestContext(request))
+ return HttpResponseRedirect('/agenda/'+object_id)
-def event_galaxy(request,object_id):
- event = Event.calendar.get(pk=object_id)
+def event_galaxy_for_map(request,object_id):
+ event = Event.calendar.select_related().get(pk=object_id)
event_redes = event.redes.all()
event_attending = event.atendees.all()
- comments = Comment.objects.filter(content_type=13,object_pk=object_id)
- location_comments = Comment.objects.filter(content_type=12,object_pk=event.location.id)
- other_events_on_this_location = event.location.event_set.all()
- other_events_attended_by_atendees = Event.events.next_events().filter(atendees__in=event.atendees.all()).distinct()
- other_events_with_this_event_groups = Event.events.next_events().filter(redes__in=event.redes.all()).distinct()
-
- map = pydot.Dot(event.description, graph_type='digraph',strict=False, suppress_disconnected=True, size="12,4",overlap="False", ranksep='0.5',ratio='auto',bgcolor="#ffffff00", packmode="clust",URL="http://infopoint/" )
- events = pydot.Subgraph(graph_name='Events',label='Events',style='filled',fillcolor='lightgrey',packmode="clust")
- comments_graph = pydot.Subgraph(graph_name='Comments',label='Comments',style='rounded',fillcolor='lightgrey')
- map.add_node(pydot.Node(event.title,fillcolor="#fd47bbff",style='filled',fontsize='24',shape='component' ,URL="http://infopoint/agenda/"+object_id))
- map.add_edge(pydot.Edge(event.title,event.location.title,style='rounded',label='location',len='1'))
- map.add_node(pydot.Node(event.location.title,style='filled',fontsize='14',shape='house',fillcolor='#e399f6ff', URL='http://infopoint/agenda/location/'+str(event.location.id)))
-
- for comment in location_comments:
- comment.comment.encode('ascii','ignore')
- comments_graph.add_node(pydot.Node(comment.comment[0:20],fillcolor="#8bde93ff",style='filled',fontsize='10',shape='note' ,URL="http://infopoint/admin/comments/comment/"+object_id+"/",rank="min"))
- comments_graph.add_edge(pydot.Edge(comment.user,comment.comment[0:20],style='dotted',label='is_author',len='3'))
- comments_graph.add_edge(pydot.Edge(event.location,comment.comment[0:20],style='rounded',len='1',rank='same' ))
-
- for todo in event.location.todolocation.all().exclude(done=True):
- decoded_todo = todo.title.encode('ascii','ignore')[0:20]
- events.add_node(pydot.Node(decoded_todo,fillcolor="#f7c640ff",style='filled',fontsize='10',shape='note' ,URL="http://infopoint/agenda/todo/"+str(todo.id),rank="min"))
- events.add_edge(pydot.Edge(decoded_todo,event.location,style='dotted',len='1'))
-
- groups = pydot.Subgraph(graph_name='Groups', label='Groups',suppress_disconnected=False,style='filled',fillcolor='#00ff005d')
- for todo in event.todo.all().exclude(done=True):
- decoded_todo = todo.title.encode('ascii','ignore')[0:20]
- events.add_node(pydot.Node(decoded_todo,fillcolor="#f7c640ff",style='filled',fontsize='10',shape='note' ,URL="http://infopoint/agenda/todo/"+str(todo.id),rank="min"))
- events.add_edge(pydot.Edge(decoded_todo,event.title,style='dotted',len='2'))
- events.add_edge(pydot.Edge(todo.creator,decoded_todo,style='dotted',len='2',constraint=False))
- for location_event in event.location.event_set.all().exclude(id=object_id):
- events.add_node(pydot.Node(location_event.title,fillcolor="#acce4aff",style='filled',fontsize='10',shape='component',URL='http://infopoint/agenda/'+str(location_event.id)))
- events.add_edge(pydot.Edge(location_event.title,event.location,fontsize='8',rank="sink"))
+ comments = Comment.objects.filter(content_type=14,object_pk=object_id)
+ other_events_on_this_location = event.location.event_set.all().filter(public=True,end_date__gte=today)[:3]
+ other_events_attended_by_atendees = Event.events.next_events().filter(atendees__in=event.atendees.all()).distinct()[:3]
+ other_events_with_this_event_groups = Event.events.next_events().filter(public=True,end_date__gte=today,redes__in=event.redes.all()).distinct().exclude(id=object_id)
+
+
+ map = pydot.Dot(event.id, graph_type="digraph",strict="True", suppress_disconnected="True", fontname="Arial",size="10,6",overlap="True", ranksep="1",ratio="auto",bgcolor="#dddddd5d", packmode="group",URL="/" )
+ map.add_node(pydot.Node(event.title,color='purple',fontname='Arial',style='filled',fontsize='20',shape='record' ,URL="/agenda/"+object_id))
+ map.add_node(pydot.Node(event.location.title,color='purple',fontname='Arial',style='filled',fontsize='20',shape='record',URL='/agenda/location/'+str(event.location.id)))
+ map.add_edge(pydot.Edge(event.title,event.location.title,fontname='Arial',label='location',len='1'))
+
+ groups = pydot.Subgraph(graph_name='Groups', label='Groups',suppress_disconnected=False,style='filled',fillcolor='#00ff005d',fontname='Arial')
+ events = pydot.Subgraph(graph_name='Events',label='Events',style='filled',shape='note',fillcolor='lightgrey',fontname='Arial')
+ comments_graph = pydot.Subgraph(graph_name='Comments',label='Comments',fillcolor='lightgrey',fontname='Arial')
+ for todo in event.location.todolocation.all()[:3]:
+ events.add_node(pydot.Node("td"+str(todo.id),label=todo.title,color='#00ff005d',fontname='Arial',style='filled',fontsize='10',shape='box'))
+ events.add_edge(pydot.Edge("lo"+str(event.location.location.id),"td"+str(todo.id),rank="sink"))
+ for location_event in event.location.todolocation.all()[:3]:
+ events.add_node(pydot.Node(location_event.title,color='lightpink',fontname='Arial',style='filled',fontsize='10',shape='record',URL='/agenda/map/'+str(location_event.id)))
+ events.add_edge(pydot.Edge(event.location.title,location_event.title,fontname='Arial',fontsize='8',rank="sink"))
+
+ for location_event in event.location.event_set.all().exclude(id=object_id,end_date__gte=today)[:3]:
+ events.add_node(pydot.Node(location_event.title,color='green',fontname='Arial',style='filled',fontsize='10',shape='record',URL='/agenda/map/'+str(location_event.id)))
+ events.add_edge(pydot.Edge(event.location.title,location_event.title,fontname='Arial',fontsize='8',rank="sink"))
for pixie in event.pixie.iterator():
- comments_graph.add_edge(pydot.Edge(pixie,event.title.encode('ascii', 'ignore'),style='dotted',len='2'))
- events.add_node(pydot.Node(pixie,fontsize='12',style="filled",fillcolor="#f7c640ff",shape='egg',URL="/agenda/user/"+str(pixie.id),rank="same"))
+ comments_graph.add_edge(pydot.Edge(pixie.username,event.title.encode('ascii', 'ignore'),style='dotted',fontname='Arial',len='2'))
+ comments_graph.add_node(pydot.Node(pixie.username,color='lightpink',fontname='Arial',style='filled',fontsize='10',shape='record'))
for comment in comments:
- comment.comment.encode('ascii', 'ignore')
- comments_graph.add_node(pydot.Node(comment.comment[0:20],fillcolor="#8bde93ff",style='filled',fontsize='10',shape='note' ,URL="http://infopoint/admin/comments/comment/"+object_id+"/",rank="min"))
- comments_graph.add_edge(pydot.Edge(comment.user,comment.comment[0:20],style='dotted',label='is_author',len='3'))
- comments_graph.add_edge(pydot.Edge(comment.comment[0:20],event.title,style='rounded',len='1',rank='same' ))
+ comments_graph.add_node(pydot.Node(unicode(comment.comment).encode('ascii'),color="lightpink",fontname='Arial',style='filled',fontsize='10',shape='note' ,URL="/agenda/map/"+object_id,rank="min"))
+ comments_graph.add_edge(pydot.Edge(comment.user.username,comment.comment.encode('ascii', 'ignore'),style='dotted',fontname='Arial',label='is_author',len='3'))
+ comments_graph.add_edge(pydot.Edge(event.title,comment.comment.encode('ascii', 'ignore'),fontname='Arial',label='location',len='1',rank='same'))
for person in event_attending:
- events.add_node(pydot.Node(person.username,fontsize='12',style="filled",fillcolor="#f7c640ff",shape='egg',URL="/agenda/user/"+str(person.id),rank="same"))
- events.add_edge(pydot.Edge(person.username,event.title,fontsize='8',rank="sink"))
+ events.add_node(pydot.Node(person.username,color='purple',fontsize='12',style="filled",fillcolor="#00ff005f",fontname='Arial',shape='note',URL="/agenda/map/user/"+str(person.id),rank="same"))
+ events.add_edge(pydot.Edge(person.username,event.title,fontname='Arial',fontsize='8',rank="sink"))
for group in event_redes:
- groups.add_node(pydot.Node(group.name,style="filled",fillcolor='#ec8968ff' ,shape='tab',group='groups',URL="http://infopoint/agenda/group/"+str(group.id), rank="5"))
- events.add_edge(pydot.Edge(group.name,event.title,fontsize='8',rank="sink"))
+ groups.add_node(pydot.Node(group.name,color='yellow',style="filled",fillcolor="#ff33cc5f" ,shape='record',group='groups',URL="/agenda/map/group/"+str(group.id), rank="5",fontname='Arial'))
+ events.add_edge(pydot.Edge(event.title,group.name,fontname='Arial',fontsize='8',rank="sink"))
+
+ for related_event in other_events_with_this_event_groups.exclude(pk=object_id,start_date__gte=datetime.now())[:3]:
- for related_event in other_events_with_this_event_groups.exclude(pk=object_id):
- events.add_node(pydot.Node(related_event.title,fontsize='12',style="filled",fillcolor="#acce4aff",fontname='Arial',shape='component',URL="/agenda/"+str(related_event.id),rank="same"))
+ events.add_node(pydot.Node(related_event.title,color='green',fontsize='12',style="filled",fillcolor="#00ff005f",fontname='Arial',shape='box',URL="/agenda/map/"+str(related_event.id),rank="same"))
- for group in related_event.group.all():
- events.add_edge(pydot.Edge(group.group,related_event.title,fontname='Arial',shape='point',fontsize='8',rank="sink"))
- groups.add_node(pydot.Node(group.group,style="filled",fillcolor='#ec8968ff',shape='tab',group='groups',URL="http://infopoint/agenda/group/"+str(group.group_id), rank="5",fontname='Arial'))
+ for group in related_event.redes.all():
+ events.add_edge(pydot.Edge(group.name,related_event.title,fontname='Arial',shape='point',fontsize='8',rank="sink"))
+ groups.add_node(pydot.Node(group.name,color='yellow',style="filled",fillcolor="#ff33cc5f" ,shape='record',group='groups',URL="/agenda/map/group/"+str(group.id), rank="5",fontname='Arial'))
- events.add_node(pydot.Node(related_event.title,fontsize='12',style="filled",fillcolor="#acce4aff",fontname='Arial',shape='component',URL="/agenda/"+str(related_event.id),rank="same"))
- events.add_edge(pydot.Edge(event.title,related_event.title,fontname='Arial' ,fontsize='8',style='dotted',rank='same'))
+ events.add_node(pydot.Node(related_event.title,color='green',fontsize='12',style="filled",fillcolor="#00ff005f",fontname='Arial',shape='box',URL="/agenda/map/"+str(related_event.id),rank="same"))
+ events.add_edge(pydot.Edge(event.title,related_event.title,fontname='Arial',fontsize='8',style='dotted'))
for user in related_event.atendees.all().distinct():
events.add_edge(pydot.Edge(user.username,related_event.title,fontname='Arial',label='goes to',fontsize='8',rank="sink"))
@@ -240,18 +143,52 @@ def event_galaxy(request,object_id):
map.add_subgraph(comments_graph)
map.add_subgraph(groups)
map.add_subgraph(events)
- for a in comments_graph.node_list:
- a.set_fontname('Arial')
- for a in events.node_list:
- a.set_fontname('Arial')
- for a in groups.node_list:
- a.set_fontname('Arial')
-
map.write_png('/var/www/media/maps/event_'+object_id+'.png', prog='dot')
map.write_cmap('/var/www/media/maps/event_'+object_id+'.map', prog='dot')
map.write_dot('/var/www/media/maps/event_'+object_id+'.dot', prog='dot')
+ map_coordinates = map.create_cmap( prog='dot')
+ #return render_to_response('agenda/event_map_view.html', {'event': event,'map_coordinates':map_coordinates },context_instance=RequestContext(request))
return HttpResponseRedirect('/agenda/'+object_id)
+def event_galaxy2(request,object_id):
+ event = Event.calendar.get(pk=object_id)
+ event_redes = event.redes.all()
+ event_attending = event.atendees.all()
+ other_events_attended_by_atendees = Event.events.next_events().filter(atendees__in=event.atendees.all()).distinct()
+ other_events_with_this_event_groups = Event.events.next_events().filter(redes__in=event.redes.all()).distinct()
+
+ map = pydot.Dot(event.title, graph_type='digraph',strict=True, suppress_disconnected=False, fontname='Arial',size="14,17",overlap="False", ranksep='2',ratio='auto',bgcolor="#dddddd5d", packmode="clust",URL='http://infopoint/' )
+ map.add_node(pydot.Node(event.title,color='purple',fontname='Arial',style='filled',fontsize='20',shape='record' ,URL="http://infopoint/agenda/map/"+str(object_id)))
+ map.add_node(pydot.Node(event.location.title,color='purple',fontname='Arial',style='filled',fontsize='20',shape='record',URL="http://infopoint/agenda/map/location/"+str(event.location.id)))
+ map.add_edge(pydot.Edge(event.title,event.location.title))
+
+ groups = pydot.Subgraph(graph_name='Groups', suppress_disconnected=False,style='filled',fillcolor='#00ff005d',fontname='Arial')
+ events = pydot.Subgraph(graph_name='Events',style='filled',shape='note',fillcolor='lightgrey',fontname='Arial')
+
+
+ for related_event in other_events_with_this_event_groups:
+ for group in related_event.redes.all():
+ events.add_edge(pydot.Edge(group.name,related_event.title,fontname='Arial',shape='point',fontsize='8',rank="sink"))
+
+ for a in event_redes.distinct():
+ groups.add_node(pydot.Node(a.name,color='yellow',style="filled",fillcolor="#ff33cc5f" ,shape='record',group='groups',URL="http://infopoint/agenda/map/group/"+str(a.id), rank="2",fontname='Arial'))
+ groups.add_edge(pydot.Edge(event.title,a.name,style='dotted',fontname='Arial'))
+ for group in event_redes.iterator():
+ for related_event in group.networkevent.all().distinct():
+ events.add_node(pydot.Node(str(related_event.event),color='green',fontsize='8',style="filled",fillcolor="#00ff005f",fontname='Arial',shape='record',URL='/agenda/map/'+str(related_event.event_id),rank="min"))
+
+ for a in event_attending:
+ events.add_node(pydot.Node(a.username,color='yellow',style="filled",fillcolor="#00ffff5f" ,shape='note',group='users',rank="sink",fontname='Arial'))
+ events.add_edge(pydot.Edge(event.title,a.username,fontname='Arial',shape='point',fontsize='8',rank="sink"))
+
+ map.add_subgraph(groups)
+ map.add_subgraph(events)
+ map.write_png('/var/www/media/maps/event_'+object_id+'.png', prog='dot')
+ map.write_dot('/var/www/media/maps/event_'+str(object_id)+'.dot', prog='dot')
+ map_coordinates = map.create_cmap( prog='dot')
+ map.write_imap('/var/www/media/maps/event_'+str(object_id)+'.map', prog='dot')
+ return render_to_response('agenda/billboard_still.html', {'event': event,'map_coordinates':map_coordinates },context_instance=RequestContext(request))
+
def one_still_event(request,object_id,billboard_id):
event = Event.calendar.get(pk=object_id)
style = Billboard.objects.get(pk=billboard_id)
@@ -260,7 +197,15 @@ def one_still_event(request,object_id,billboard_id):
def billboard(request,billboard_id):
style = Billboard.objects.get(pk=billboard_id)
- list = Event.calendar.filter(location__in=style.location.all()).distinct()|Event.calendar.filter(group__in=style.groups.all()).distinct()
+ list = Event.events.filter(location__in=style.location.all())|Event.calendar.filter(redes__in=style.groups.all())
+ if style.timespan=='1':
+ list = Event.events.next_events().filter(location__in=style.location.all()).distinct()|Event.events.next_events().filter(redes__in=style.groups.all()).distinct()
+ if style.timespan=='2':
+ list = Event.events.past_events().filter(location__in=style.location.all()).distinct()|Event.events.past_events().filter(redes__in=style.groups.all()).distinct()
+ if style.timespan=='3':
+ list = Event.events.all().filter(location__in=style.location.all()).distinct()|Event.events.all().filter(redes__in=style.groups.all()).distinct()
+ if style.timespan=='4':
+ list = Event.events.today_events().filter(location__in=style.location.all()).distinct()|Event.events.today_events().filter(redes__in=style.groups.all()).distinct()
event = list.order_by('?')[:1]
return render_to_response('agenda/billboard.html', { 'event': event,'list': list, 'style': style },context_instance=RequestContext(request))