Skip to content
Snippets Groups Projects
Commit dd9afca5 authored by Martin Mareš's avatar Martin Mareš
Browse files

App: Math/CS switch

parent 9b35bc78
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,7 @@
</head>
<body>
<h1>MFF Zoom</h1>
<p><b>This is still experimental, there might be dragons. Please report all bugs to Martin Mareš.</b>
<form method=GET action="?">
<label for=date>Date:</label>
<input id=date type=date name=date value="{{ g.date }}">
......@@ -60,23 +61,27 @@
<option value=0{{ " selected" if g.hours==0 else "" }}>Working hours</option>
<option value=1{{ " selected" if g.hours==1 else "" }}>Whole day</option>
</select>
<select name=rooms>
<option value=i{{ " selected" if g.rooms=="i" else "" }}>CompSci rooms</option>
<option value=m{{ " selected" if g.rooms=="m" else "" }}>Math rooms</option>
</select>
<input type=submit name=submit value="Submit">
</form>
<h2>Schedule for {{ g.dow }} {{ g.date }}</h2>
<div id=heading>
{% for r in g.rooms %}
{% for r in g.room_boxes %}
<div class=roomhead style='position: absolute; left: {{ r.x }}px; top: 0px; width: {{ r.w }}px;'>
<p>{{ r.name }}</p>
</div>
{% endfor %}
</div>
<div id=schedule>
{% for r in g.rooms %}
{% for r in g.room_boxes %}
<div class=room style='position: absolute; left: {{ r.x }}px; top: 0px; width: {{ r.w }}px; height: {{ r.h }}px;'></div>
{% endfor %}
{% for h in g.hours %}
{% for h in g.hour_boxes %}
<div class=hour style='position: absolute; left: {{ h.x }}px; top: {{ h.y }}px; width: {{ h.w }}px; height: {{ h.h }}px;'></div>
{% endfor %}
{% for m in g.meetings %}
......
......@@ -54,7 +54,8 @@ def get_date():
tz = dateutil.tz.tzlocal()
return dt.replace(hour=0, minute=0, second=0, microsecond=0, tzinfo=tz)
rooms = [
room_list = {
'i': [
('Z1', 'zoom-1@d3s.mff.cuni.cz'),
('Z2', 'zoom-2@d3s.mff.cuni.cz'),
('Z3', 'zoom-3@d3s.mff.cuni.cz'),
......@@ -63,7 +64,16 @@ rooms = [
('Z6', 'zoom-6@d3s.mff.cuni.cz'),
('Z7', 'zoom-7@d3s.mff.cuni.cz'),
('Z8', 'zoom-8@d3s.mff.cuni.cz'),
]
],
'm': [
('ZM1', 'zoom-m-1@d3s.mff.cuni.cz'),
('ZM2', 'zoom-m-2@d3s.mff.cuni.cz'),
('ZM3', 'zoom-m-3@d3s.mff.cuni.cz'),
('ZM4', 'zoom-m-4@d3s.mff.cuni.cz'),
('ZM7', 'zoom-m-7@d3s.mff.cuni.cz'),
('ZM8', 'zoom-m-8@d3s.mff.cuni.cz'),
],
}
@app.route('/')
def main_page():
......@@ -85,20 +95,25 @@ def main_page():
hour_max = 24
num_hours = hour_max - hour_min
g.rooms = request.args.get("rooms", "")
if g.rooms not in room_list:
g.rooms = "i"
rooms = room_list[g.rooms]
num_rooms = len(rooms)
email_to_room_index = { rooms[i][1]: i for i in range(num_rooms) }
room_box_width = 100
room_hour_height = 50
g.total_width = room_box_width * num_rooms
g.total_height = num_hours * room_hour_height
g.rooms = [{
g.room_boxes = [{
"x": i * room_box_width + 1,
"w": room_box_width - 1,
"h": g.total_height - 1,
"name": rooms[i][0],
} for i in range(num_rooms)]
g.hours = [{
g.hour_boxes = [{
"x": 1,
"y": i * room_hour_height + 1,
"w": num_rooms * room_box_width - 1,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment