def materials(request, meeting_num=None): meeting = get_meeting(meeting_num) begin_date = meeting.get_submission_start_date() cut_off_date = meeting.get_submission_cut_off_date() cor_cut_off_date = meeting.get_submission_correction_date() now = datetime.date.today() if settings.SERVER_MODE != 'production' and '_testoverride' in request.REQUEST: pass elif now > cor_cut_off_date: return render(request, "meeting/materials_upload_closed.html", { 'meeting_num': meeting_num, 'begin_date': begin_date, 'cut_off_date': cut_off_date, 'cor_cut_off_date': cor_cut_off_date }) #sessions = Session.objects.filter(meeting__number=meeting_num, timeslot__isnull=False) schedule = get_schedule(meeting, None) sessions = Session.objects.filter(meeting__number=meeting_num, timeslotassignments__schedule=schedule).select_related() plenaries = sessions.filter(name__icontains='plenary') ietf = sessions.filter(group__parent__type__slug = 'area').exclude(group__acronym='edu') irtf = sessions.filter(group__parent__acronym = 'irtf') training = sessions.filter(group__acronym__in=['edu','iaoc']) iab = sessions.filter(group__parent__acronym = 'iab') cache_version = Document.objects.filter(session__meeting__number=meeting_num).aggregate(Max('time'))["time__max"] return render(request, "meeting/materials.html", { 'meeting_num': meeting_num, 'plenaries': plenaries, 'ietf': ietf, 'training': training, 'irtf': irtf, 'iab': iab, 'cut_off_date': cut_off_date, 'cor_cut_off_date': cor_cut_off_date, 'submission_started': now > begin_date, 'cache_version': cache_version, })
def materials(request, meeting_num=None, schedule_name=None): proceeding = get_object_or_404(Proceeding, meeting_num=meeting_num) begin_date = proceeding.sub_begin_date cut_off_date = proceeding.sub_cut_off_date cor_cut_off_date = proceeding.c_sub_cut_off_date now = datetime.date.today() if settings.SERVER_MODE != 'production' and '_testoverride' in request.REQUEST: pass elif now > cor_cut_off_date: return render_to_response("meeting/materials_upload_closed.html",{'meeting_num':meeting_num,'begin_date':begin_date, 'cut_off_date':cut_off_date, 'cor_cut_off_date':cor_cut_off_date}, context_instance=RequestContext(request)) sub_began = 0 if now > begin_date: sub_began = 1 meeting = get_meeting(meeting_num) schedule = get_schedule(meeting, schedule_name) scheduledsessions = get_scheduledsessions_from_schedule(schedule) plenaries = scheduledsessions.filter(session__name__icontains='plenary') ietf = scheduledsessions.filter(session__group__parent__type__slug = 'area').exclude(session__group__acronym='edu') irtf = scheduledsessions.filter(session__group__parent__acronym = 'irtf') training = scheduledsessions.filter(session__group__acronym='edu') iab = scheduledsessions.filter(session__group__parent__acronym = 'iab') cache_version = Document.objects.filter(session__meeting__number=meeting_num).aggregate(Max('time'))["time__max"] # return render_to_response("meeting/materials.html", {'meeting_num':meeting_num, 'plenaries': plenaries, 'ietf':ietf, 'training':training, 'irtf': irtf, 'iab':iab, 'begin_date':begin_date, 'cut_off_date':cut_off_date, 'cor_cut_off_date':cor_cut_off_date,'sub_began':sub_began, 'cache_version':cache_version}, context_instance=RequestContext(request))
def test_avtcore_has_two_slots(self): mtg83 = get_meeting(83) sch83 = get_schedule(mtg83, "mtg:83") avtcore = mtg83.session_set.get(group__acronym='avtcore') self.assertEqual(avtcore.pk, 2216) # sanity check self.assertEqual( len(avtcore.scheduledsession_set.filter(schedule=sch83)), 2)
def agenda_by_type(request,num=None,type=None): meeting = get_meeting(num) schedule = get_schedule(meeting) assignments = schedule.assignments.order_by('session__type__slug','timeslot__time') if type: assignments = assignments.filter(session__type__slug=type) return render(request,"meeting/agenda_by_type.html",{"meeting":meeting,"assignments":assignments})
def agenda_by_type_ics(request,num=None,type=None): meeting = get_meeting(num) schedule = get_schedule(meeting) assignments = schedule.assignments.order_by('session__type__slug','timeslot__time') if type: assignments = assignments.filter(session__type__slug=type) updated = meeting.updated() return render(request,"meeting/agenda.ics",{"schedule":schedule,"updated":updated,"assignments":assignments},content_type="text/calendar")
def week_view(request, num=None): meeting = get_meeting(num) schedule = get_schedule(meeting) if not schedule: raise Http404 filtered_assignments = schedule.assignments.exclude(timeslot__type__in=['lead','offagenda']) filtered_assignments = preprocess_assignments_for_agenda(filtered_assignments, meeting) items = [] for a in filtered_assignments: # we don't HTML escape any of these as the week-view code is using createTextNode item = { "key": str(a.timeslot.pk), "day": a.timeslot.time.strftime("%w"), "time": a.timeslot.time.strftime("%H%M") + "-" + a.timeslot.end_time().strftime("%H%M"), "duration": a.timeslot.duration.seconds, "time_id": a.timeslot.time.strftime("%m%d%H%M"), "dayname": "{weekday}, {month} {day_of_month}, {year}".format( weekday=a.timeslot.time.strftime("%A").upper(), month=a.timeslot.time.strftime("%B"), day_of_month=a.timeslot.time.strftime("%d").lstrip("0"), year=a.timeslot.time.strftime("%Y"), ), "type": a.timeslot.type.name } if a.session: if a.session.historic_group: item["group"] = a.session.historic_group.acronym if a.session.name: item["name"] = a.session.name elif a.timeslot.type_id == "break": item["name"] = a.timeslot.name item["area"] = a.timeslot.type_id item["group"] = a.timeslot.type_id elif a.session.historic_group: item["name"] = a.session.historic_group.name if a.session.historic_group.state_id == "bof": item["name"] += " BOF" item["state"] = a.session.historic_group.state.name if a.session.historic_group.historic_parent: item["area"] = a.session.historic_group.historic_parent.acronym if a.timeslot.show_location: item["room"] = a.timeslot.get_location() if a.session and a.session.agenda(): item["agenda"] = a.session.agenda().get_absolute_url() items.append(item) return render(request, "meeting/week-view.html", { "items": json.dumps(items), })
def test_DoNotGetSchedule(self): from django.http import Http404 num = '83' from ietf.meeting.views import get_meeting, get_schedule meeting = get_meeting(num) try: na = get_schedule(meeting, "none:83") except Http404: False
def ical_agenda(request, num=None, schedule_name=None): meeting = get_meeting(num) q = request.META.get('QUERY_STRING','') or "" filter = urllib.unquote(q).lower().split(','); include = set(filter) include_types = set(["Plenary","Other"]) exclude = [] # Process the special flags. # "-wgname" will remove a working group from the output. # "~Type" will add that type to the output. # "-~Type" will remove that type from the output # Current types are: # Session, Other (default on), Break, Plenary (default on) # Non-Working Group "wg names" include: # edu, ietf, tools, iesg, iab for item in include: if item: if item[0] == '-' and item[1] == '~': include_types -= set([item[2:3].upper()+item[3:]]) elif item[0] == '-': exclude.append(item[1:]) elif item[0] == '~': include_types |= set([item[1:2].upper()+item[2:]]) schedule = get_schedule(meeting, schedule_name) scheduledsessions = get_scheduledsessions_from_schedule(schedule) scheduledsessions = scheduledsessions.filter( Q(timeslot__type__name__in = include_types) | Q(session__group__acronym__in = filter) | Q(session__group__parent__acronym__in = filter) ).exclude(Q(session__group__acronym__in = exclude)) #.exclude(Q(session__group__isnull = False), #Q(session__group__acronym__in = exclude) | #Q(session__group__parent__acronym__in = exclude)) if meeting.time_zone: try: tzfn = os.path.join(settings.TZDATA_ICS_PATH, meeting.time_zone + ".ics") tzf = open(tzfn) icstext = tzf.read() debug.show('icstext[:128]') vtimezone = re.search("(?sm)(\nBEGIN:VTIMEZONE.*\nEND:VTIMEZONE\n)", icstext).group(1).strip() debug.show('vtimezone[:128]') tzf.close() except IOError: vtimezone = None else: vtimezone = None return HttpResponse(render_to_string("meeting/agendaREDESIGN.ics", {"scheduledsessions":scheduledsessions, "meeting":meeting, "vtimezone": vtimezone }, RequestContext(request)), mimetype="text/calendar")
def agenda_by_room(request,num=None): meeting = get_meeting(num) schedule = get_schedule(meeting) ss_by_day = OrderedDict() for day in schedule.assignments.dates('timeslot__time','day'): ss_by_day[day]=[] for ss in schedule.assignments.order_by('timeslot__location__functional_name','timeslot__location__name','timeslot__time'): day = ss.timeslot.time.date() ss_by_day[day].append(ss) return render(request,"meeting/agenda_by_room.html",{"meeting":meeting,"ss_by_day":ss_by_day})
def edit_agenda_properties(request, num=None, schedule_name=None): meeting = get_meeting(num) schedule = get_schedule(meeting, schedule_name) form = AgendaPropertiesForm(instance=schedule) return HttpResponse(render_to_string("meeting/properties_edit.html", {"schedule":schedule, "form":form, "meeting":meeting}, RequestContext(request)), mimetype="text/html")
def edit_agenda_properties(request, num=None, schedule_name=None): meeting = get_meeting(num) schedule = get_schedule(meeting, schedule_name) form = AgendaPropertiesForm(instance=schedule) return HttpResponse(render_to_string("meeting/properties_edit.html", { "schedule": schedule, "form": form, "meeting": meeting }, RequestContext(request)), mimetype="text/html")
def get_agenda_info(request, num=None, schedule_name=None): meeting = get_meeting(num) schedule = get_schedule(meeting, schedule_name) scheduledsessions = get_scheduledsessions_from_schedule(schedule) modified = get_modified_from_scheduledsessions(scheduledsessions) area_list = get_areas() wg_list = get_wg_list(scheduledsessions) time_slices,date_slices = build_all_agenda_slices(scheduledsessions, False) rooms = meeting.room_set return scheduledsessions, schedule, modified, meeting, area_list, wg_list, time_slices, date_slices, rooms
def get_agenda_info(request, num=None, schedule_name=None): meeting = get_meeting(num) schedule = get_schedule(meeting, schedule_name) scheduledsessions = get_scheduledsessions_from_schedule(schedule) modified = get_modified_from_scheduledsessions(scheduledsessions) area_list = get_areas() wg_list = get_wg_list(scheduledsessions) time_slices, date_slices = build_all_agenda_slices(scheduledsessions, False) rooms = meeting.room_set return scheduledsessions, schedule, modified, meeting, area_list, wg_list, time_slices, date_slices, rooms
def materials(request, meeting_num=None, schedule_name=None): proceeding = get_object_or_404(Proceeding, meeting_num=meeting_num) begin_date = proceeding.sub_begin_date cut_off_date = proceeding.sub_cut_off_date cor_cut_off_date = proceeding.c_sub_cut_off_date now = datetime.date.today() if settings.SERVER_MODE != 'production' and '_testoverride' in request.REQUEST: pass elif now > cor_cut_off_date: return render_to_response("meeting/materials_upload_closed.html", { 'meeting_num': meeting_num, 'begin_date': begin_date, 'cut_off_date': cut_off_date, 'cor_cut_off_date': cor_cut_off_date }, context_instance=RequestContext(request)) sub_began = 0 if now > begin_date: sub_began = 1 meeting = get_meeting(meeting_num) schedule = get_schedule(meeting, schedule_name) scheduledsessions = get_scheduledsessions_from_schedule(schedule) plenaries = scheduledsessions.filter(session__name__icontains='plenary') ietf = scheduledsessions.filter( session__group__parent__type__slug='area').exclude( session__group__acronym='edu') irtf = scheduledsessions.filter(session__group__parent__acronym='irtf') training = scheduledsessions.filter(session__group__acronym='edu') iab = scheduledsessions.filter(session__group__parent__acronym='iab') cache_version = Document.objects.filter( session__meeting__number=meeting_num).aggregate( Max('time'))["time__max"] # return render_to_response("meeting/materials.html", { 'meeting_num': meeting_num, 'plenaries': plenaries, 'ietf': ietf, 'training': training, 'irtf': irtf, 'iab': iab, 'begin_date': begin_date, 'cut_off_date': cut_off_date, 'cor_cut_off_date': cor_cut_off_date, 'sub_began': sub_began, 'cache_version': cache_version }, context_instance=RequestContext(request))
def agenda(request, num=None, name=None, base=None, ext=None): base = base if base else 'agenda' ext = ext if ext else '.html' if 'iPhone' in get_user_agent(request) and ext == ".html": base = 'm_agenda' mimetype = {".html":"text/html", ".txt": "text/plain", ".ics":"text/calendar", ".csv":"text/csv"} meeting = get_meeting(num) schedule = get_schedule(meeting, name) if schedule == None: return HttpResponse(render_to_string("meeting/no-"+base+ext, {'meeting':meeting }, RequestContext(request)), content_type=mimetype[ext]) updated = meeting_updated(meeting) return HttpResponse(render_to_string("meeting/"+base+ext, {"schedule":schedule, "updated": updated}, RequestContext(request)), content_type=mimetype[ext])
def agenda_infourl(request, num=None, schedule_name=None): meeting = get_meeting(num) #log.debug("agenda: %s / %s" % (meeting, schedule_name)) schedule = get_schedule(meeting, schedule_name) #log.debug("results in agenda: %u / %s" % (schedule.id, request.method)) if request.method == 'GET': return HttpResponse(json.dumps(schedule.json_dict(request.get_host_protocol())), mimetype="application/json") elif request.method == 'PUT': return agenda_update(request, meeting, schedule) elif request.method == 'DELETE': return agenda_del(request, meeting, schedule) else: return HttpResponse(status=406)
def ical_agenda(request, num=None, name=None, ext=None): meeting = get_meeting(num) schedule = get_schedule(meeting, name) updated = meeting.updated() if schedule is None: raise Http404 q = request.META.get('QUERY_STRING','') or "" filter = set(urllib.unquote(q).lower().split(',')) include = [ i for i in filter if not (i.startswith('-') or i.startswith('~')) ] include_types = set(["plenary","other"]) exclude = [] # Process the special flags. # "-wgname" will remove a working group from the output. # "~Type" will add that type to the output. # "-~Type" will remove that type from the output # Current types are: # Session, Other (default on), Break, Plenary (default on) # Non-Working Group "wg names" include: # edu, ietf, tools, iesg, iab for item in filter: if len(item) > 2 and item[0] == '-' and item[1] == '~': include_types -= set([item[2:]]) elif len(item) > 1 and item[0] == '-': exclude.append(item[1:]) elif len(item) > 1 and item[0] == '~': include_types |= set([item[1:]]) assignments = schedule.assignments.exclude(timeslot__type__in=['lead','offagenda']) assignments = preprocess_assignments_for_agenda(assignments, meeting) assignments = [a for a in assignments if (a.timeslot.type_id in include_types or (a.session.historic_group and a.session.historic_group.acronym in include) or (a.session.historic_group and a.session.historic_group.historic_parent and a.session.historic_group.historic_parent.acronym in include)) and (not a.session.historic_group or a.session.historic_group.acronym not in exclude)] return render(request, "meeting/agenda.ics", { "schedule": schedule, "assignments": assignments, "updated": updated }, content_type="text/calendar")
def gen_agenda(context): meeting = context['meeting'] schedule = get_schedule(meeting) scheduledsessions = ScheduledSession.objects.filter(schedule=schedule).exclude(session__isnull=True) html = render_to_response('proceedings/agenda.html',{ 'meeting': meeting, 'scheduledsessions': scheduledsessions} ) path = os.path.join(settings.SECR_PROCEEDINGS_DIR,meeting.number,'agenda.html') write_html(path,html.content) # get the text agenda from datatracker url = 'https://datatracker.ietf.org/meeting/%s/agenda.txt' % meeting.number text = urlopen(url).read() path = os.path.join(settings.SECR_PROCEEDINGS_DIR,meeting.number,'agenda.txt') write_html(path,text)
def ical_agenda(request, num=None, name=None, ext=None): meeting = get_meeting(num) schedule = get_schedule(meeting, name) updated = meeting_updated(meeting) if schedule is None: raise Http404 q = request.META.get('QUERY_STRING','') or "" filter = set(urllib.unquote(q).lower().split(',')) include = [ i for i in filter if not (i.startswith('-') or i.startswith('~')) ] include_types = set(["plenary","other"]) exclude = [] # Process the special flags. # "-wgname" will remove a working group from the output. # "~Type" will add that type to the output. # "-~Type" will remove that type from the output # Current types are: # Session, Other (default on), Break, Plenary (default on) # Non-Working Group "wg names" include: # edu, ietf, tools, iesg, iab for item in filter: if item: if item[0] == '-' and item[1] == '~': include_types -= set([item[2:]]) elif item[0] == '-': exclude.append(item[1:]) elif item[0] == '~': include_types |= set([item[1:]]) assignments = schedule.assignments.filter( Q(timeslot__type__slug__in = include_types) | Q(session__group__acronym__in = include) | Q(session__group__parent__acronym__in = include) ).exclude(session__group__acronym__in = exclude).distinct() #.exclude(Q(session__group__isnull = False), #Q(session__group__acronym__in = exclude) | #Q(session__group__parent__acronym__in = exclude)) return HttpResponse(render_to_string("meeting/agenda.ics", {"schedule":schedule, "assignments":assignments, "updated":updated}, RequestContext(request)), content_type="text/calendar")
def meeting_update(request, meeting): # at present, only the official agenda can be updated from this interface. #debug.log("1 meeting.agenda: %s / %s / %s" % (meeting.agenda, update_dict, request.body)) if "agenda" in request.POST: value = request.POST["agenda"] #debug.log("4 meeting.agenda: %s" % (value)) if not value or value == "None": # value == "None" is just weird, better with empty string meeting.set_official_agenda(None) else: schedule = get_schedule(meeting, value) if not schedule.public: return HttpResponse(status=406) #debug.log("3 meeting.agenda: %s" % (schedule)) meeting.set_official_agenda(schedule) #debug.log("2 meeting.agenda: %s" % (meeting.agenda)) meeting.save() return meeting_get(request, meeting)
def meeting_update(request, meeting): # at present, only the official agenda can be updated from this interface. #debug.log("1 meeting.agenda: %s / %s / %s" % (meeting.agenda, update_dict, request.body)) if "agenda" in request.POST: value = request.POST["agenda"] #debug.log("4 meeting.agenda: %s" % (value)) if not value or value == "None": # value == "None" is just weird, better with empty string meeting.set_official_agenda(None) else: schedule = get_schedule(meeting, value) if not schedule.public: return HttpResponse(status = 406) #debug.log("3 meeting.agenda: %s" % (schedule)) meeting.set_official_agenda(schedule) #debug.log("2 meeting.agenda: %s" % (meeting.agenda)) meeting.save() return meeting_get(request, meeting)
def meeting_update(request, meeting): # authorization was enforced by the @group_require decorator above. # at present, only the official agenda can be updated from this interface. update_dict = QueryDict(request.raw_post_data, encoding=request._encoding) #log.debug("1 meeting.agenda: %s / %s / %s" % (meeting.agenda, update_dict, request.raw_post_data)) if "agenda" in update_dict: value = update_dict["agenda"] #log.debug("4 meeting.agenda: %s" % (value)) if value is None or value == "None": meeting.agenda = None else: schedule = get_schedule(meeting, value) if not schedule.public: return HttpResponse(status = 406) #log.debug("3 meeting.agenda: %s" % (schedule)) meeting.agenda = schedule #log.debug("2 meeting.agenda: %s" % (meeting.agenda)) meeting.save() return meeting_get(request, meeting)
def handle(self, *labels, **options): meetingname = labels[0] schedname = labels[1] from ietf.meeting.helpers import get_meeting, get_schedule format = options.get('format', 'json') indent = options.get('indent', 2) meeting = get_meeting(meetingname) schedule = get_schedule(meeting, schedname) assignments = schedule.assignments.all() # cribbed from django/core/management/commands/dumpdata.py # Check that the serialization format exists; this is a shortcut to # avoid collating all the objects and _then_ failing. if format not in serializers.get_public_serializer_formats(): raise CommandError("Unknown serialization format: %s" % format) return serializers.serialize(format, assignments, indent=indent, use_natural_keys=True)
def edit_agenda(request, num=None, schedule_name=None): if request.method == 'POST': return agenda_create(request, num, schedule_name) user = request.user requestor = "AnonymousUser" if not user.is_anonymous(): print "user: %s" % (user) try: requestor = user.get_profile() except Person.DoesNotExist: # if we can not find them, leave them alone, only used for debugging. pass meeting = get_meeting(num) #sys.stdout.write("requestor: %s for sched_name: %s \n" % ( requestor, schedule_name )) schedule = get_schedule(meeting, schedule_name) #sys.stdout.write("2 requestor: %u for sched owned by: %u \n" % ( requestor.id, schedule.owner.id )) meeting_base_url = meeting.url(request.get_host_protocol(), "") site_base_url = request.get_host_protocol() rooms = meeting.room_set.order_by("capacity") rooms = rooms.all() saveas = SaveAsForm() saveasurl = reverse(edit_agenda, args=[meeting.number, schedule.name]) cansee, canedit = agenda_permissions(meeting, schedule, user) if not cansee: #sys.stdout.write("visible: %s public: %s owner: %s request from: %s\n" % ( # schedule.visible, schedule.public, schedule.owner, requestor)) return HttpResponse(render_to_string( "meeting/private_agenda.html", { "schedule": schedule, "meeting": meeting, "meeting_base_url": meeting_base_url }, RequestContext(request)), status=403, mimetype="text/html") sessions = meeting.session_set.exclude(status__slug='deleted').exclude( status__slug='notmeet').order_by("id", "group", "requested_by") scheduledsessions = get_all_scheduledsessions_from_schedule(schedule) # get_modified_from needs the query set, not the list modified = get_modified_from_scheduledsessions(scheduledsessions) area_list = get_pseudo_areas() wg_name_list = get_wg_name_list(scheduledsessions) wg_list = get_wg_list(wg_name_list) time_slices, date_slices = build_all_agenda_slices(scheduledsessions, True) return HttpResponse(render_to_string( "meeting/landscape_edit.html", { "schedule": schedule, "saveas": saveas, "saveasurl": saveasurl, "meeting_base_url": meeting_base_url, "site_base_url": site_base_url, "rooms": rooms, "time_slices": time_slices, "date_slices": date_slices, "modified": modified, "meeting": meeting, "area_list": area_list, "wg_list": wg_list, "sessions": sessions, "scheduledsessions": scheduledsessions, "show_inline": set(["txt", "htm", "html"]) }, RequestContext(request)), mimetype="text/html")
def ical_agenda(request, num=None, schedule_name=None): meeting = get_meeting(num) q = request.META.get('QUERY_STRING', '') or "" filter = urllib.unquote(q).lower().split(',') include = set(filter) include_types = set(["Plenary", "Other"]) exclude = [] # Process the special flags. # "-wgname" will remove a working group from the output. # "~Type" will add that type to the output. # "-~Type" will remove that type from the output # Current types are: # Session, Other (default on), Break, Plenary (default on) # Non-Working Group "wg names" include: # edu, ietf, tools, iesg, iab for item in include: if item: if item[0] == '-' and item[1] == '~': include_types -= set([item[2:3].upper() + item[3:]]) elif item[0] == '-': exclude.append(item[1:]) elif item[0] == '~': include_types |= set([item[1:2].upper() + item[2:]]) schedule = get_schedule(meeting, schedule_name) scheduledsessions = get_scheduledsessions_from_schedule(schedule) scheduledsessions = scheduledsessions.filter( Q(timeslot__type__name__in=include_types) | Q(session__group__acronym__in=filter) | Q(session__group__parent__acronym__in=filter)).exclude( Q(session__group__acronym__in=exclude)) #.exclude(Q(session__group__isnull = False), #Q(session__group__acronym__in = exclude) | #Q(session__group__parent__acronym__in = exclude)) if meeting.time_zone: try: tzfn = os.path.join(settings.TZDATA_ICS_PATH, meeting.time_zone + ".ics") tzf = open(tzfn) icstext = tzf.read() debug.show('icstext[:128]') vtimezone = re.search( "(?sm)(\nBEGIN:VTIMEZONE.*\nEND:VTIMEZONE\n)", icstext).group(1).strip() debug.show('vtimezone[:128]') tzf.close() except IOError: vtimezone = None else: vtimezone = None return HttpResponse(render_to_string( "meeting/agendaREDESIGN.ics", { "scheduledsessions": scheduledsessions, "meeting": meeting, "vtimezone": vtimezone }, RequestContext(request)), mimetype="text/calendar")
def agenda_create(request, num=None, schedule_name=None): meeting = get_meeting(num) schedule = get_schedule(meeting, schedule_name) if schedule is None: # here we have to return some ajax to display an error. raise Http404("No meeting information for meeting %s schedule %s available" % (num,schedule_name)) # authorization was enforced by the @group_require decorator above. saveasform = SaveAsForm(request.POST) if not saveasform.is_valid(): return HttpResponse(status=404) savedname = saveasform.cleaned_data['savename'] # create the new schedule, and copy the scheduledsessions try: sched = meeting.schedule_set.get(name=savedname, owner=request.user.person) if sched: # XXX needs to record a session error and redirect to where? return HttpResponseRedirect( reverse(edit_agenda, args=[meeting.number, sched.name])) except Schedule.DoesNotExist: pass # must be done newschedule = Schedule(name=savedname, owner=request.user.person, meeting=meeting, visible=False, public=False) newschedule.save() if newschedule is None: return HttpResponse(status=500) # keep a mapping so that extendedfrom references can be chased. mapping = {}; for ss in schedule.scheduledsession_set.all(): # hack to copy the object, creating a new one # just reset the key, and save it again. oldid = ss.pk ss.pk = None ss.schedule=newschedule ss.save() mapping[oldid] = ss.pk # now fix up any extendedfrom references to new set. for ss in newschedule.scheduledsession_set.all(): if ss.extendedfrom is not None: ss.extendedfrom = newschedule.scheduledsession_set.get(pk = mapping[ss.extendedfrom.id]) ss.save() # now redirect to this new schedule. return HttpResponseRedirect( reverse(edit_agenda, args=[meeting.number, newschedule.name]))
def agenda(request, num=None, name=None, base=None, ext=None): base = base if base else 'agenda' ext = ext if ext else '.html' mimetype = { ".html":"text/html; charset=%s"%settings.DEFAULT_CHARSET, ".txt": "text/plain; charset=%s"%settings.DEFAULT_CHARSET, ".csv": "text/csv; charset=%s"%settings.DEFAULT_CHARSET, } meetings = get_meetings(num) # We do not have the appropriate data in the datatracker for IETF 64 and earlier. # So that we're not producing misleading pages... meeting = meetings.first() if not meetings.exists() or (meeting.number.isdigit() and meeting.number <= 64 and not meeting.agenda.assignments.exists()): if ext == '.html': return HttpResponseRedirect( 'https://www.ietf.org/proceedings/%s' % num ) else: raise Http404 schedule = get_schedule(meeting, name) if schedule == None: base = base.replace("-utc", "") return render(request, "meeting/no-"+base+ext, {'meeting':meeting }, content_type=mimetype[ext]) updated = meeting.updated() filtered_assignments = schedule.assignments.exclude(timeslot__type__in=['lead','offagenda']) filtered_assignments = preprocess_assignments_for_agenda(filtered_assignments, meeting) if ext == ".csv": return agenda_csv(schedule, filtered_assignments) # extract groups hierarchy, it's a little bit complicated because # we can be dealing with historic groups seen = set() groups = [a.session.historic_group for a in filtered_assignments if a.session and a.session.historic_group and a.session.historic_group.type_id in ('wg', 'rg', 'ag', 'iab') and a.session.historic_group.historic_parent] group_parents = [] for g in groups: if g.historic_parent.acronym not in seen: group_parents.append(g.historic_parent) seen.add(g.historic_parent.acronym) seen = set() for p in group_parents: p.group_list = [] for g in groups: if g.acronym not in seen and g.historic_parent.acronym == p.acronym: p.group_list.append(g) seen.add(g.acronym) p.group_list.sort(key=lambda g: g.acronym) return render(request, "meeting/"+base+ext, { "schedule": schedule, "filtered_assignments": filtered_assignments, "updated": updated, "group_parents": group_parents, }, content_type=mimetype[ext])
def test_GetSchedule(self): num = '83' from ietf.meeting.views import get_meeting, get_schedule meeting = get_meeting(num) na = get_schedule(meeting, "mtg:83") self.assertIsNotNone(na)
def edit_agenda(request, num=None, schedule_name=None): if request.method == 'POST': return agenda_create(request, num, schedule_name) user = request.user requestor = "AnonymousUser" if not user.is_anonymous(): print "user: %s" % (user) try: requestor = user.get_profile() except Person.DoesNotExist: # if we can not find them, leave them alone, only used for debugging. pass meeting = get_meeting(num) #sys.stdout.write("requestor: %s for sched_name: %s \n" % ( requestor, schedule_name )) schedule = get_schedule(meeting, schedule_name) #sys.stdout.write("2 requestor: %u for sched owned by: %u \n" % ( requestor.id, schedule.owner.id )) meeting_base_url = meeting.url(request.get_host_protocol(), "") site_base_url =request.get_host_protocol() rooms = meeting.room_set.order_by("capacity") rooms = rooms.all() saveas = SaveAsForm() saveasurl=reverse(edit_agenda, args=[meeting.number, schedule.name]) cansee,canedit = agenda_permissions(meeting, schedule, user) if not cansee: #sys.stdout.write("visible: %s public: %s owner: %s request from: %s\n" % ( # schedule.visible, schedule.public, schedule.owner, requestor)) return HttpResponse(render_to_string("meeting/private_agenda.html", {"schedule":schedule, "meeting": meeting, "meeting_base_url":meeting_base_url}, RequestContext(request)), status=403, mimetype="text/html") sessions = meeting.session_set.exclude(status__slug='deleted').exclude(status__slug='notmeet').order_by("id", "group", "requested_by") scheduledsessions = get_all_scheduledsessions_from_schedule(schedule) # get_modified_from needs the query set, not the list modified = get_modified_from_scheduledsessions(scheduledsessions) area_list = get_pseudo_areas() wg_name_list = get_wg_name_list(scheduledsessions) wg_list = get_wg_list(wg_name_list) time_slices,date_slices = build_all_agenda_slices(scheduledsessions, True) return HttpResponse(render_to_string("meeting/landscape_edit.html", {"schedule":schedule, "saveas": saveas, "saveasurl": saveasurl, "meeting_base_url": meeting_base_url, "site_base_url": site_base_url, "rooms":rooms, "time_slices":time_slices, "date_slices":date_slices, "modified": modified, "meeting":meeting, "area_list": area_list, "wg_list": wg_list , "sessions": sessions, "scheduledsessions": scheduledsessions, "show_inline": set(["txt","htm","html"]) }, RequestContext(request)), mimetype="text/html")
def test_avtcore_has_two_slots(self): mtg83 = get_meeting(83) sch83 = get_schedule(mtg83, "mtg:83") avtcore = mtg83.session_set.get(group__acronym='avtcore') self.assertEqual(avtcore.pk, 2216) # sanity check self.assertEqual(len(avtcore.scheduledsession_set.filter(schedule = sch83)), 2)
def agenda_create(request, num=None, schedule_name=None): meeting = get_meeting(num) schedule = get_schedule(meeting, schedule_name) if schedule is None: # here we have to return some ajax to display an error. raise Http404( "No meeting information for meeting %s schedule %s available" % (num, schedule_name)) # authorization was enforced by the @group_require decorator above. saveasform = SaveAsForm(request.POST) if not saveasform.is_valid(): return HttpResponse(status=404) savedname = saveasform.cleaned_data['savename'] # create the new schedule, and copy the scheduledsessions try: sched = meeting.schedule_set.get(name=savedname, owner=request.user.person) if sched: # XXX needs to record a session error and redirect to where? return HttpResponseRedirect( reverse(edit_agenda, args=[meeting.number, sched.name])) except Schedule.DoesNotExist: pass # must be done newschedule = Schedule(name=savedname, owner=request.user.person, meeting=meeting, visible=False, public=False) newschedule.save() if newschedule is None: return HttpResponse(status=500) # keep a mapping so that extendedfrom references can be chased. mapping = {} for ss in schedule.scheduledsession_set.all(): # hack to copy the object, creating a new one # just reset the key, and save it again. oldid = ss.pk ss.pk = None ss.schedule = newschedule ss.save() mapping[oldid] = ss.pk # now fix up any extendedfrom references to new set. for ss in newschedule.scheduledsession_set.all(): if ss.extendedfrom is not None: ss.extendedfrom = newschedule.scheduledsession_set.get( pk=mapping[ss.extendedfrom.id]) ss.save() # now redirect to this new schedule. return HttpResponseRedirect( reverse(edit_agenda, args=[meeting.number, newschedule.name]))