This repository has been archived by the owner on Feb 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scriptor.html
93 lines (79 loc) · 3.95 KB
/
scriptor.html
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
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Script0r²</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/lib/codemirror.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/fold/foldgutter.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/hint/show-hint.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/lint/lint.css">
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/lib/codemirror.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/comment/comment.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/display/autorefresh.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/selection/active-line.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/keymap/sublime.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/hint/show-hint.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/lint/lint.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/mode/python/python.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/fold/foldcode.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/fold/foldgutter.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/fold/brace-fold.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/fold/indent-fold.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/fold/comment-fold.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/edit/closebrackets.js"></script>
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.8/addon/edit/matchbrackets.js"></script>
<link rel="stylesheet" href="css/neo.css">
<link rel="stylesheet" href="css/scriptor.css">
<script src="scriptor.js"></script>
</head>
<body>
<main class="main">
<header class="header">
<div class="header-left">
<h1 id="host">Script0r²</h1>
<div class="header-note">The ViUR Scripting Environment</div>
</div>
<div class="header-right">
<button id="run" class="btn header-btn btn-run" title="Runs the current script">
<img src="icon/run.svg" class="icon">
<span>Run</span>
</button>
<button id="clear" class="btn header-btn btn-clear" title="Clears the output area">
<img src="icon/clear.svg" class="icon">
<span>Clear</span>
</button>
<button id="stop" disabled class="btn header-btn btn-abort" title="Abort running script">
<img src="icon/abort.svg" class="icon">
<span>Abort</span>
</button>
</div>
</header>
<div class="content">
<div class="code">
<textarea id="code"># Debugging
logging.debug("Debug")
logging.warning("Warning")
logging.error("Error")
# Get current user
if not (user := viur.view("/user/view/self")):
logging.error("You are not logged in")
exit()
logging.debug("Hello " + user["name"])
# Get list of all users
for i, user in enumerate(viur.list("/user/list")):
print(i, user["name"])
# Export a CSV file with specific fields from the user module
csv = csvwriter("key", "name", "access")
for user in viur.list("/user/list"):
csv.write(user)
csv.download("users.csv")
print("CSV file with", len(csv), "entries has been exported")
</textarea>
</div>
<div class="output">
<ul class="output-list" id="output"></ul>
</div>
</div>
</main>
</body>
</html>