-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoteachingassistant.py
82 lines (81 loc) · 7.3 KB
/
autoteachingassistant.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import os
from mainpath import mainpath
def create_teaching_assistant_page(hw_num):
final_html = f"""
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="icon" href="https://cdn-icons-png.flaticon.com/512/328/328201.png" type="image/x-icon"/>
<title>最高權限</title>
<style type="text/css">
body {{width: 100%;height: 100%;font-family: 'Open Sans',sans-serif;margin: 0; background-color: #37464a; background:url("/img/homepage_background.jpg");background-size: cover;background-attachment: fixed;background-position: center;}}
#login{{position: fixed;top: 50%;left:50%;transform: translate(-50%,-50%);background:#2329358e;text-align: center;border-radius: 40px;padding: 30px;}}
#login h1{{color: #fff; text-shadow:0 0 10px; letter-spacing: 5px; text-align: center;white-space:nowrap;}}
#login h3{{color: #fff; text-shadow:0 0 10px; letter-spacing: 5px; text-align: center;white-space:nowrap;}}
.but {{width: 300px;min-height: 20px;display: block;background-color: #07070785;border: 2px solid #bccdf3;color: #fff;padding: 17px 20px;font-size: 16px;line-height: normal;border-radius: 10px;cursor: pointer; font-family: consolas;}}
.but:hover {{background-color: #fcfcfc85;color: rgb(2, 0, 0);}}
.but_old {{width: 267px;min-height: 50px;display: block;background-color: #52747a78;border: 2px solid #f0f0ed;color: rgb(26, 24, 24);padding: 9px 14px;font-size: 15px;margin-left:1%;cursor: pointer; border-radius: 10px;}}
ul {{margin: 0;padding: 0;list-style: none;}} /* 取消ul預設的內縮及樣式*/
ul.drop-down-menu {{border: rgba(245, 241, 241, 0.548) 2px solid;display: inline-block;font-family: "Open Sans", consolas, sans-serif;font-size: 13px;}}
ul.drop-down-menu li {{position: relative;white-space: nowrap;border-right: #ccc 1px solid;}}
ul.drop-down-menu > li:last-child {{border-right: none;}}
ul.drop-down-menu > li {{float: left;}} /* 只有第一層是靠左對齊*/
ul.drop-down-menu a {{background-color: rgba(20, 20, 20, 0.466);color: rgb(253, 161, 22);display: block;padding: 0 40px;text-decoration: none;line-height: 70px;font-size: 200%; font-family: consolas;font-weight:bold;}}
ul.drop-down-menu a:hover {{background-color: #ef5c28;color: #fff;}} /* 滑鼠滑入按鈕變色*/
ul.drop-down-menu li:hover > a {{background-color: #ef5c28;color: #fff;}} /* 滑鼠移入次選單上層按鈕保持變色*/
ul.drop-down-menu button {{background-color: rgba(7, 1, 1, 0.616);color: rgb(245, 244, 244);display: block;padding: 0 40px;text-decoration: none;line-height: 40px;cursor:pointer;font-family: consolas;font-size: 150%;}}
ul.drop-down-menu button:hover {{background-color: #ef5c28;color: #fff;}} /* 滑鼠滑入按鈕變色*/
ul.drop-down-menu li:hover > button {{background-color: #ef5c28;color: #fff;}} /* 滑鼠移入次選單上層按鈕保持變色*/
ul.drop-down-menu ul {{display: none;left: 99999px;opacity: 0;-webkit-transition: opacity 0.3s;transition: opacity 0.3s;}} /*隱藏次選單*/
ul.drop-down-menu li:hover > ul {{display: block;opacity: 1;-webkit-transition: opacity 0.3s;transition: opacity 0.3s;left: -1px;border-right: 5px;}} /* 滑鼠滑入展開次選單*/
ul.drop-down-menu li:hover > ul ul {{left: 99999px;}} /* 滑鼠滑入之後、次選單之後的選單依舊隱藏*/
ul.drop-down-menu ul li:hover > ul {{left: 90%;}} /* 第二層之後的選單展開位置*/
</style>
</head>
<body style="background-color: #315e49;"></br></br>
<div style="float:left; width: 1%; height: 100%;"></div>
<ul class="drop-down-menu">
<li><a href="#">Homework {hw_num[2:]} ⏬</a>
<ul></br>
<li><form action="/teachingassistant/hw1"><button class="but_old">Homework 1</button></form></li></br>
<li><form action="/teachingassistant/hw2"><button class="but_old">Homework 2</button></form></li></br>
<!-- <li><form action="/teachingassistant/hw3"><button class="but_old">Homework 3</button></form></li> -->
<!-- <li><form action="/teachingassistant/hw4"><button class="but_old">Homework 4</button></form></li> -->
<li><button class="but_old">Comeing Soon</button></li></br>
</ul>
</li>
</ul>
<div id="login">
<div style="text-align:center;">
<h1>助教專用網站</h1></br>
</div>
<div style = "text-align: center;padding:10px">
<form action="/opensmallname/{hw_num}" style="display:inline-block;"><button class="but" style="font-size: 23px;">開啟匿名留言</button></form>
<form action="/unopensmallname/{hw_num}" style="display:inline-block;"><button class="but" style="font-size: 23px;">關閉匿名留言</button></form>
</div>
<div style = "text-align: center;padding:10px">
<form action="/opencodereviewcomment/{hw_num}" style="display:inline-block;"><button class="but" style="font-size: 23px;">開啟程式碼審查</button></form>
<form action="/unopencodereviewcomment/{hw_num}" style="display:inline-block;"><button class="but" style="font-size: 23px;">關閉程式碼審查</button></form>
</div>
<div style = "text-align: center;padding:10px">
<form action="/openuploadfile/{hw_num}" style="display:inline-block;"><button class="but" style="font-size: 23px;">開啟上傳作業</button></form>
<form action="/unopenuploadfile/{hw_num}" style="display:inline-block;"><button class="but" style="font-size: 23px;">關閉上傳作業</button></form>
</div>
<div style = "text-align: center;padding:10px">
<form action="/Assignnumber/{hw_num}" style="display:inline-block;"><button class="but" style="font-size: 23px;">分配學生編號</button></form>
</div>
<div style = "text-align: center;padding:10px">
<form action="/studentdata/{hw_num}" style="display:inline-block;"><button class="but" style="font-size: 23px;">學生後臺數據</button></form>
<form action="/homepage/{hw_num}" style="display:inline-block;"><button class="but" style="font-size: 23px;">返回會員首頁</button></form>
<form action="/signout" style="display:inline-block;"><button class="but" style="font-size: 23px;">登出</button></form>
</div>
</div>
</body>
</html>
"""
final_html = final_html.replace("'", "\"")
os.chdir(mainpath)
with open(f"templates/teachingassistant.html", "w", encoding="utf-8") as file:
file.write(final_html)
os.chdir(mainpath)