Skip to content

Commit d0d1d94

Browse files
committed
fixed draw_constraints continuation to use promise interface
show room size in unicode printout for room model but be explicit in template when the name is needed change constraint loading continuation function to use a promise. This is necessary because the constraints must all be loaded before the people conflicts can be calculated. Do the people conflict calculation and show it The conflicts display is still broken. make loading of events wait for area directors to be populated use embedded group object so that group info, and therefore responsible AD information is available when events are being populated into the table removed recalculate button return session object with embedded group to avoid additional group load do json formatting in view rather than in template added single constraint API for consistency and debug be careful not to follow parent if it does not exist make list of area directors, create people objects from it, and then assign an area directory number and class implement person API, use it to fill in the Area Director use a thicker box for more critical conflicts rip out conflict display table, sort conflicts into a single list reworked session and group load to use $.ajax and promise interface. firefox has many $.ajax load errors for groups: web server and tamper data thinks the data loaded fine... in these cases work around by silly knowledge of href. reworked css so that conflict box renders nicely. some icons for showing conflicts clarify copyright and header files added new relationship for people must be present find and retrieve people constraints added some user objects and person objects for constraint person must present. Without the user objects, the IESGHistory routines fail added bethere ConstraintName to implement AD Must be be present - Legacy-Id: 6337
1 parent 32a4dba commit d0d1d94

41 files changed

Lines changed: 4044 additions & 605 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

r6328/ietf/group/models.py

100644100755
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import datetime
1313
import debug
14-
14+
1515
class GroupInfo(models.Model):
1616
time = models.DateTimeField(default=datetime.datetime.now)
1717
name = models.CharField(max_length=80)
@@ -101,10 +101,14 @@ def json_dict(self, host_scheme):
101101
group1['name'] = self.name
102102
group1['state'] = self.state.slug
103103
group1['type'] = self.type.slug
104-
group1['parent_href'] = urljoin(host_scheme, self.parent.json_url())
104+
if self.parent is not None:
105+
group1['parent_href'] = urljoin(host_scheme, self.parent.json_url())
105106
# uncomment when people URL handle is created
106-
#if self.ad is not None:
107-
# group1['ad_href'] = urljoin(host_scheme, self.ad.url())
107+
try:
108+
if self.ad is not None:
109+
group1['ad_href'] = urljoin(host_scheme, self.ad.json_url())
110+
except Person.DoesNotExist:
111+
pass
108112
group1['list_email'] = self.list_email
109113
group1['list_subscribe'] = self.list_subscribe
110114
group1['list_archive'] = self.list_archive

r6328/ietf/meeting/ajax.py

100644100755
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,30 @@ def readonly(request, meeting_num, schedule_id):
6161
'owner_href': request.build_absolute_uri(schedule.owner.json_url()),
6262
'read_only': read_only})
6363

64+
@group_required('Area Director','Secretariat')
65+
@dajaxice_register
66+
def update_timeslot_pinned(request, schedule_id, scheduledsession_id, pinned=False):
67+
schedule = get_object_or_404(Schedule, pk = int(schedule_id))
68+
meeting = schedule.meeting
69+
cansee,canedit = agenda_permissions(meeting, schedule, request.user)
70+
71+
if not canedit:
72+
raise Http403
73+
return json.dumps({'error':'no permission'})
74+
75+
if scheduledsession_id is not None:
76+
ss_id = int(scheduledsession_id)
77+
78+
if ss_id != 0:
79+
ss = get_object_or_404(schedule.scheduledsession_set, pk=ss_id)
80+
81+
ss.pinned = pinned
82+
ss.save()
83+
84+
return json.dumps({'message':'valid'})
85+
86+
87+
6488
@group_required('Area Director','Secretariat')
6589
@dajaxice_register
6690
def update_timeslot(request, schedule_id, session_id, scheduledsession_id=None, extended_from_id=None, duplicate=False):
@@ -459,13 +483,35 @@ def session_json(request, num, sessionid):
459483
session = meeting.session_set.get(pk=int(sessionid))
460484
except Session.DoesNotExist:
461485
return json.dumps({'error':"no such session %s" % sessionid})
486+
return HttpResponse(json.dumps({'error':"no such session %s" % sessionid}),
487+
status = 404,
488+
mimetype="application/json")
462489

463490
sess1 = session.json_dict(request.build_absolute_uri('/'))
464491
return HttpResponse(json.dumps(sess1, sort_keys=True, indent=2),
465492
mimetype="application/json")
466493

467494
# Would like to cache for 1 day, but there are invalidation issues.
468495
#@cache_page(86400)
496+
def constraint_json(request, num, constraintid):
497+
meeting = get_meeting(num)
498+
499+
try:
500+
constraint = meeting.constraint_set.get(pk=int(constraintid))
501+
except Constraint.DoesNotExist:
502+
return HttpResponse(json.dumps({'error':"no such constraint %s" % constraintid}),
503+
status = 404,
504+
mimetype="application/json")
505+
506+
json1 = constraint.json_dict(request.get_host_protocol())
507+
return HttpResponse(json.dumps(json1, sort_keys=True, indent=2),
508+
mimetype="application/json")
509+
510+
511+
# Cache for 2 hour2
512+
#@cache_page(7200)
513+
# caching is a problem if there Host: header changes.
514+
#
469515
def session_constraints(request, num, sessionid):
470516
meeting = get_meeting(num)
471517

r6328/ietf/meeting/fixtures/constraint83.json

100644100755
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,5 +1454,9 @@
14541454
{"pk": 22491, "model": "meeting.constraint", "fields": {"source": 1847, "meeting": 83, "target": 1751, "name": "conflic2"}},
14551455
{"pk": 22492, "model": "meeting.constraint", "fields": {"source": 1847, "meeting": 83, "target": 1817, "name": "conflic2"}},
14561456
{"pk": 22493, "model": "meeting.constraint", "fields": {"source": 1847, "meeting": 83, "target": 1728, "name": "conflic2"}},
1457-
{"pk": 22494, "model": "meeting.constraint", "fields": {"source": 1847, "meeting": 83, "target": 1789, "name": "conflic2"}}
1458-
]
1457+
{"pk": 22494, "model": "meeting.constraint", "fields": {"source": 1847, "meeting": 83, "target": 1789, "name": "conflic2"}},
1458+
{"pk": 23000, "model": "meeting.constraint", "fields": {"source": 1816, "meeting": 83, "name": "bethere", "person": 103539}},
1459+
{"pk": 23001, "model": "meeting.constraint", "fields": {"source": 1816, "meeting": 83, "name": "bethere", "person": 108554}},
1460+
{"pk": 23002, "model": "meeting.constraint", "fields": {"source": 1816, "meeting": 83, "name": "bethere", "person": 102830}}
1461+
1462+
]

r6328/ietf/meeting/helpers.py

100644100755
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010

1111
from django import forms
1212
from django.http import Http404
13+
from django.http import HttpRequest
1314
from django.db.models import Max, Q
1415
from django.conf import settings
16+
from django.core.cache import cache
17+
from django.utils.cache import get_cache_key
1518

1619
import debug
1720
import urllib
@@ -127,7 +130,7 @@ def slot_decor(self):
127130
return self.timeslot.slot_decor
128131

129132
def build_url_pair(request, meeting):
130-
meeting_base_url = request.build_absolute_uri(meeting.base_url())
133+
meeting_base_url = request.build_absolute_uri(meeting.json_url())
131134
site_base_url = request.build_absolute_uri('/')
132135

133136
# remove trailing / from site_base_url.
@@ -354,3 +357,15 @@ def agenda_permissions(meeting, schedule, user):
354357
canedit = True
355358

356359
return cansee,canedit
360+
361+
def session_constraint_expire(session):
362+
from django.core.urlresolvers import reverse
363+
from ajax import session_constraints
364+
path = reverse(session_constraints, args=[session.meeting.number, session.pk])
365+
request = HttpRequest()
366+
request.path = path
367+
key = get_cache_key(request)
368+
if key is not None and cache.has_key(key):
369+
cache.delete(key)
370+
371+

0 commit comments

Comments
 (0)