Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
wizards
mffzoom
Commits
dd9afca5
Commit
dd9afca5
authored
Mar 23, 2020
by
Martin Mareš
Browse files
App: Math/CS switch
parent
9b35bc78
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/templates/main.html
View file @
dd9afca5
...
...
@@ -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
_boxe
s %}
<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
_boxe
s %}
<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
_boxe
s %}
<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 %}
...
...
app/zoom.py
View file @
dd9afca5
...
...
@@ -54,16 +54,26 @@ def get_date():
tz
=
dateutil
.
tz
.
tzlocal
()
return
dt
.
replace
(
hour
=
0
,
minute
=
0
,
second
=
0
,
microsecond
=
0
,
tzinfo
=
tz
)
rooms
=
[
(
'Z1'
,
'zoom-1@d3s.mff.cuni.cz'
),
(
'Z2'
,
'zoom-2@d3s.mff.cuni.cz'
),
(
'Z3'
,
'zoom-3@d3s.mff.cuni.cz'
),
(
'Z4'
,
'zoom-4@d3s.mff.cuni.cz'
),
(
'Z5'
,
'zoom-5@d3s.mff.cuni.cz'
),
(
'Z6'
,
'zoom-6@d3s.mff.cuni.cz'
),
(
'Z7'
,
'zoom-7@d3s.mff.cuni.cz'
),
(
'Z8'
,
'zoom-8@d3s.mff.cuni.cz'
),
]
room_list
=
{
'i'
:
[
(
'Z1'
,
'zoom-1@d3s.mff.cuni.cz'
),
(
'Z2'
,
'zoom-2@d3s.mff.cuni.cz'
),
(
'Z3'
,
'zoom-3@d3s.mff.cuni.cz'
),
(
'Z4'
,
'zoom-4@d3s.mff.cuni.cz'
),
(
'Z5'
,
'zoom-5@d3s.mff.cuni.cz'
),
(
'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
_boxe
s
=
[{
"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
_boxe
s
=
[{
"x"
:
1
,
"y"
:
i
*
room_hour_height
+
1
,
"w"
:
num_rooms
*
room_box_width
-
1
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment