diff --git a/app.py b/app.py index 78b72dd..6734e98 100644 --- a/app.py +++ b/app.py @@ -9,6 +9,12 @@ app.register_blueprint(upload) app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY') +@app.after_request +def add_header(response): + response.headers['SameSite'] = "Strict" + return response + + @ app.route('/', methods=['GET', 'POST']) def index(): if request.method == 'GET': diff --git a/manage.py b/manage.py index 2f9c6f3..58e81f3 100644 --- a/manage.py +++ b/manage.py @@ -187,16 +187,16 @@ def manageRoot(): return manageProcess("", "") -@manage.route('/manage/date', methods=['POST']) -def manage_date(): - return manageProcess("date", request.form['date']) +@manage.route('/manage/date/', methods=['GET']) +def manage_date(date): + return manageProcess("date", date) -@manage.route('/manage/admin', methods=['POST']) -def manage_admin(): +@manage.route('/manage/admin///', methods=['GET']) +def manage_admin(g, r, date): data = [ - request.form['grade'] + '^' + request.form['room'], - request.form['date'] + g + '^' + r, + date ] return manageProcess("admin", data) diff --git a/templates/admin.html b/templates/admin.html index 4fff365..f3ddb41 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -34,38 +34,43 @@

Homeroom NOT Confirmed 班導尚未確認

{% endif %} + +
-
-
-
- -
-
- -
-
- -
-
- -
+
+
+
- +
+ +
+
+ +
+
+ +
+
@@ -84,7 +89,11 @@
{% for i in periods %} -
{{absData[currDate][i]['name']}}
+
{{absData[currDate][i]['name']}} + {% if 'changed' in absData[currDate][i] %} + (換) + {% endif %} +
{% endfor %}
@@ -102,7 +111,7 @@
{{homeroomCode[0]}}{{homeroomCode[1]}}
{{i}}
-
{{ homeroomData[i]['name'] }}
+
{{ homeroomData[i]['name'] }}
{{ homeroomData[i]['eng_name'] }}
{% for j in periods %}
@@ -222,16 +231,6 @@ homerooms['{{i}}'].push({{ j }}); {% endfor %} {% endfor %} - console.log(homerooms) - function loadingAnimation() { - if ($("#sel-room").val() == "") { - alert("請選擇年級 / 班級!"); - return; - } - document.getElementById('adminSelForm').submit(); - $('.container').hide(); - $('#loading').show(); - } function getHR() { var grade = $('#sel-grade').val(); $('#sel-room').html(''); @@ -244,9 +243,19 @@ }); $('#sel-room').removeAttr('disabled') } - function submitQuery() { - loadingAnimation(); - document.getElementById('hrSelForm').submit(); + function redirAdmin() { + if ($("#sel-room").val() == "") { + alert("請選擇年級 / 班級!"); + return; + } + var url = "/manage/admin/" + $('#sel-grade').val() + "/" + $('#sel-room').val() + "/" + $('#date').val(); + var new_form = document.createElement('form'); + new_form.method = 'GET'; + new_form.action = url; + document.body.appendChild(new_form); + new_form.submit(); + $('.container').hide(); + $('#loading').show(); } diff --git a/templates/group_teach.html b/templates/group_teach.html index 1c8919e..d83f979 100644 --- a/templates/group_teach.html +++ b/templates/group_teach.html @@ -30,17 +30,15 @@

[{{currDate}}]

-
- -
+ {% for i in absData %} {% set alr_fill = namespace(found=false) %}
@@ -202,7 +200,12 @@ } function chgDate(sel) { loadingAnimation(); - document.getElementById('dateSelForm').submit(); + var url = '/manage/date/' + $('#date').val() + var new_form = document.createElement('form'); + new_form.method = 'GET'; + new_form.action = url; + document.body.appendChild(new_form); + new_form.submit(); } diff --git a/templates/homeroom.html b/templates/homeroom.html index 91cf703..43d2b00 100644 --- a/templates/homeroom.html +++ b/templates/homeroom.html @@ -31,17 +31,15 @@

[{{currDate}}]

- - -
+
@@ -241,7 +239,12 @@ } function chgDate() { loadingAnimation(); - document.getElementById('dateSelForm').submit(); + var url = '/manage/date/' + $('#date').val() + var new_form = document.createElement('form'); + new_form.method = 'GET'; + new_form.action = url; + document.body.appendChild(new_form); + new_form.submit(); } function submitForm() { if (!signaturePad.isEmpty()) {