-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.cgi
More file actions
executable file
·65 lines (49 loc) · 2.01 KB
/
index.cgi
File metadata and controls
executable file
·65 lines (49 loc) · 2.01 KB
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
#!/usr/bin/perl
use common::sense;
# use CGI::Carp 'fatalsToBrowser'; # TODO: remove this before production use
# To load packages from current directory
use FindBin;
use lib "$FindBin::Bin/lib";
use WebTaskSubmitter;
# Configuration for WebTaskSubmitter:
my $webTaskSubmitter = new WebTaskSubmitter({
teacher_accounts => ['setnicka'], # usernames of teachers
# Use only existing accounts. You have to log out and log in again to apply new roles.
points_limit => 2/3,
db_file => "data/webtaskdb.sqlite", # WARNING: the directory with SQLite DB file must be writable by sqlite process (chmod this directory)
tasks_file => "data/tasks.pl",
auth_cookie_secret => "someTotallyRandomSecretString", # Change it to YOUR secret string, used to hash login cookies
# date_format_deadline => "%H:%M %d.%m.%Y", # Not used yet
# date_format_submits => "%H:%M:%S %d.%m.%Y", # Not used yet
usertable_for_students => 1, # If student could see table with other students and points
renew_password_expire => 3600, # Default: 60m
renew_password_enabled => 1,
emails_enabled => 1,
emails_immediate => 0, # Send emails immediate after change (otherwise send all notifications at once when teacher press "send emails" button)
emails_from => 'WebTaskSubmitter <test@test.test>',
css_path => "./css",
js_path => "./js",
script_url => "" # URL used in module would be created as <script_url>?page=tasklist... (for index.cgi is value "" the best option)
});
# Pre-render worker (may do some redirection and exit)
$webTaskSubmitter->process();
# When not redirected:
# Start web page content by sending appropiate headers
print "Content-type: text/html; charset=utf-8\n\n";
my $output = $webTaskSubmitter->render();
print <<EOF
<!doctype html>
<html lang="cs">
<head>
<title>UNIX - $webTaskSubmitter->{View}->{title}</title>
$webTaskSubmitter->{View}->{headers}
<link href='css/example_global.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div class='container'>
<h1>$webTaskSubmitter->{View}->{title}</h1>
$output
</div>
</body>
</html>
EOF