registration, charts, contracts history

This commit is contained in:
msinkec
2021-08-22 19:07:19 +02:00
parent 540f54dd06
commit 7da73f7d6a
20 changed files with 13999 additions and 489 deletions

View File

@@ -1,199 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Portal za oddajanje besedil</title>
<!--{{ dropzone.load_css() }}-->
<link rel="stylesheet" href="/static/dropzone.css" type="text/css">
{{ dropzone.style('position: absolute;
top: -0.5px;
width: 388px;
height: 831px;
left: 385px;
background: linear-gradient(198.62deg, rgba(255, 255, 255, 0.49) -1.62%, rgba(255, 255, 255, 0.73) -1.61%, rgba(255, 255, 255, 0.41) 79.34%);
box-shadow: 20px 4px 40px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(20px);
border: 0px;
border-radius: 0px 20px 20px 0px;') }}
<link rel="stylesheet" href="/static/style.css" type="text/css">
</head>
<body>
<div id="main-window" style="top: 45%;">
<div id="rect1" style="height: 831px;">
<div id="logo-container" style="top: -7.8%;">
<img src="/static/image/logo.svg" alt="logo"/>
</div>
<form id="my-dropzone" class="dropzone">
<div style="position: relative; right: 390px;">
<h1 id="title">Portal za oddajanje besedil</h1>
<div class="form-text">{{description|safe}}</div>
<label for="ime">* Ime in priimek:</label>
<input type="text" id="ime" name="ime" required="required"/>
<label for="naslov-predavanja">* Naslov predavanja:</label>
<input type="text" id="naslov-predavanja" name="naslov-predavanja" required="required"/>
<label for="predmet">* Predmet:</label>
<input type="text" id="predmet" name="predmet" required="required"/>
<label for="fakulteta">* Članica:</label>
<input type="text" id="fakulteta" name="fakulteta" required="required"/>
<label for="email">* E-Pošta:</label>
<input type="text" id="email" name="email" required="required"/>
<label for="telefon">Telefon:</label>
<input type="text" id="telefon" name="telefon"/>
<label for="kljucne-besede">* Ključne besede (ločene z vejico):</label>
<input type="text" id="kljucne-besede" name="kljucne-besede" required="required"/>
<br>
<div style="display:flex; flex-direction: row; justify-content: left; align-items: center">
<label style="width: 95%; text-transform: none; font-size: 12px;"><b>*Privolitev:</b><br>Strinjam se, da Univerza v Ljubljani uporabi posnetek naloženega predavanja v okviru projekta za strojno prevajanje predavanj ON. Dostop do posnetka bodo imeli izključno sodelavci projekta za namen transkripcije govora.</label>
<input style="width: 5%;" type="checkbox" name="strojno-prevajanje" value="strojno-prevajanje">
</div>
<div style="display: flex; flex-direction: row; justify-content: left; align-items: center; width: 310px;">
<label style="text-transform: none; font-size: 12px;"><b>Objava posnetka na portalu ON:</b><br>Ali bi se v prihodnosti strinjali z objavo posnetka na portalu sistema ON? (V primeru strinjanja bi podpisali poseben dogovor o pogojih objave.)</label>
<div style="display: inline-block;">
<input type="radio" name="javna-objava-prihodnost" value="da" style="display: inline; float: left; width: 20px;" >
<label for="da" style="display: inline; float: right; position: absolute; margin-top: 5px;">Da</label><br>
<input type="radio" name="javna-objava-prihodnost" value="morda" style="display: inline; float: left; width: 20px;">
<label for="morda" style="display: inline; float: right; position: absolute; margin-top: 10px;">Morda</label><br>
<input type="radio" name="javna-objava-prihodnost" value="ne" style="display: inline; float: left; width: 20px;">
<label for="ne" style="display: inline; float: right; position: absolute; margin-top: 18px;">Ne</label><br>
</div>
</div>
<br>
<div style="display:flex; flex-direction: row; justify-content: left; align-items: center">
<label style="width: 95%; text-transform: none; font-size: 12px;"><b>Obvestila:</b><br>Želim, da me Center za jezikovne vire in tehnologije UL obvešča o novicah v zvezi s sistemom za strojno prevajanje predavanj ON.</label>
<input style="width: 5%;" type="checkbox" name="obvestila" value="obvestila">
</div>
<br>
<a class="form-text" href="https://www.cjvt.si/obvestilo-o-obdelavi-osebnih-podatkov/" style="cursor: pointer;">Obvestilo o obdelavi osebnih podatkov</a>
<button id="button-submit" type="submit" style="top: 745px;">Oddaj</button>
</div>
<div class="dropzone-previews"></div>
</form>
</div>
</div>
<!--{{ dropzone.load_js() }}-->
<script src="/static/dropzone.js"></script>
<script>
/////////////////////////
// Dropzone //
/////////////////////////
var btnSubmit = document.getElementById("button-submit");
var form = document.forms["my-dropzone"];
function isEmptyOrSpaces(str){
return str == null || str.match(/^ *$/) !== null;
}
const reEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
//const reKeyword = /^[a-zA-Zščđ枊ČĐĆŽ, \-]+$/;
Dropzone.options.myDropzone = { // The camelized version of the ID of the form element
url: "/predavanja/upload",
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: {{max_files}},
paramName: "file", // The name that will be used to transfer the file
maxFilesize: 10000, // MB
timeout: 10000000, // milliseconds
//acceptedFiles: ".txt, .csv, .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx",
maxFiles: {{max_files}},
dictDefaultMessage: `Kliknite ali odložite datoteke sem.`,
dictFallbackMessage: "Vaš brskalnik ne podpira izbiranje datotek z odlaganjem (\"drag & drop\").",
dictInvalidFileType: "Datoteka je napačnega formata.",
dictFileTooBig: "Datoteke je prevelika {{filesize}}. Največja dovoljena velikost: {{maxFilesize}}MiB.",
dictResponseError: "Napaka strežnika: {{statusCode}}",
dictMaxFilesExceeded: "Največje število datotek že doseženo.",
dictCancelUpload: "Prekini prenos",
dictRemoveFile: "Odstrani datoteko",
dictCancelUploadConfirmation: "Ali res želite odstraniti to datoteko?",
dictUploadCanceled: "Prenos prekinjen",
// The setting up of the dropzone
init: function() {
var dz = this;
btnSubmit.addEventListener("click", function(e) {
// Make sure that the form isn't actually being sent.
e.preventDefault();
e.stopPropagation();
// Check form validity.
var ime = form["ime"].value;
var naslov = form["naslov-predavanja"].value;
var predmet = form["predmet"].value;
var fakulteta = form["fakulteta"].value;
var kljucneBesede = form["kljucne-besede"].value;
var email = form["email"].value;
var telefon = form["telefon"].value;
var privolitev = form["strojno-prevajanje"].checked;
var javnaObjava = form["javna-objava-prihodnost"];
if (isEmptyOrSpaces(ime) ||
isEmptyOrSpaces(naslov) ||
isEmptyOrSpaces(predmet) ||
isEmptyOrSpaces(fakulteta) ||
isEmptyOrSpaces(kljucneBesede) ||
isEmptyOrSpaces(email)) {
alert("Izpolnite vsa obvezna polja!");
} else if (!reEmail.test(email.toLowerCase())) {
alert("Email napačnega formata!");
// } else if (!reKeyword.test(kljucneBesede)) {
// alert("Ključne besede so napačnega formata! Besede ločujte z vejico. Besede naj ne vsebujejo posebnih znakov.");
} else if (ime.length > 100 ||
naslov.length > 100 ||
predmet.length > 100 ||
fakulteta.length > 100 ||
kljucneBesede.length > 100 ||
email.length > 100 ||
telefon.length > 100) {
alert("Velikost polj je omejena na 100 znakov.");
} else if (!privolitev) {
alert("Odkljukana privolitev je pogoj za oddajo.");
} else if (javnaObjava.value == "") {
alert("Izberite eno izmed možnosti pri polju za objavo na portalu ON!");
} else {
// Hand off data to dropzone
dz.processQueue();
// Clear fields and hide popup agian
btnSubmit.disabled = false;
form.reset();
}
});
// Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
// of the sending event because uploadMultiple is set to true.
this.on("sendingmultiple", function() {
// Gets triggered when the form is actually being sent.
// Hide the success button or the complete form.
});
this.on("successmultiple", function(files, response) {
// Gets triggered when the files have successfully been sent.
// Redirect user or notify of success.
alert("Odgovor strežnika: " + response);
location.reload();
});
this.on("errormultiple", function(files, response) {
// Gets triggered when there was an error sending the files.
// Maybe show form again, and notify user of error
});
}
}
</script>
</body>
</html>

View File

@@ -6,6 +6,6 @@
<body>
<a href="/prevodi">Korpus paralelnih besdil ANG-SLO</a><br>
<a href="/gigafida">Korpus Gigafida</a><br>
<a href="/predavanja">Korpus Predavanja</a><br>
<a href="/solar">Korpus Šolar</a><br>
</body>
</html>

View File

@@ -6,7 +6,7 @@
<style>
.tableFixHead {
overflow-y: auto;
height: 106px;
height: 306px;
}
.tableFixHead thead th {
position: sticky;
@@ -27,6 +27,13 @@
</style>
</head>
<body>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div style="background: blue;">
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
<h2>Uporabniki</h2>
<h3>Dodaj uporabnika</h3>
<form action="/solar/adduser" method="post">
@@ -35,7 +42,7 @@
<label for="email">Email:</label><br>
<input type="text" id="email" name="email"><br>
<label for="password">Geslo:</label><br>
<input type="text" id="password" name="password"><br>
<input type="password" id="password" name="password"><br>
<input type="submit" value="Dodaj">
</form>
<!--<h3>Odstrani uporabnika</h3>
@@ -52,15 +59,16 @@
<th>ID</th>
<th>Ime in priimek</th>
<th>Email</th>
<th>ID institucije</th>
</tr>
</thead>
<tbody>
{% for item in users %}
<tr>
<td>{{item.id}}</td>
<td>{{item.name}}</td>
<td>{{item.email}}</td>
</tr>
<td>{{item[0].id}}</td>
<td>{{item[0].name}}</td>
<td>{{item[0].email}}</td>
<td>{{item[1].institution}}</td>
{% endfor %}
</table>
</div>
@@ -107,4 +115,30 @@
{% endfor %}
</table>
</div>
<h3>Seznam uporabnikov, ki niso aktivirani</h3>
<div class="tableFixHead">
<table>
<thead>
<tr>
<th>ID</th>
<th>Ime in priimek</th>
<th>Email</th>
</tr>
</thead>
<tbody>
{% for item in inactive_users %}
<tr>
<td>{{item.id}}</td>
<td>{{item.name}}</td>
<td>{{item.email}}</td>
</tr>
{% endfor %}
</table>
</div>
<h3>Aktiviraj uporabnika</h3>
<form action="/solar/activateuser" method="post">
<label for="id">ID uporabnika:</label>
<input type="text" id="id" name="id"><br>
<input type="submit" value="Aktiviraj">
</form>
</body>

View File

@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Portal ŠOLAR</title>
<link rel="stylesheet" href="/static/style.css" type="text/css">
</head>
<body>
<div id="main-window">
<div id="rect1">
<div style="padding: 50px;">
<div id="logo-container">
<img src="/static/image/logo.svg" alt="logo"/>
</div>
<h3 id="title" style="font-size: 27px; text-align: left;">Pozabljeno geslo - ŠOLAR</h3>
<div>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div>
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
<form method="POST" action="/solar/sendresetpass">
<div>
<div>
<input type="email" name="email" placeholder="Email" autofocus="">
</div>
</div>
<button class="button-general" style="margin-top: 20px;">Pošlji povezavo za ponastavitev geslo</button>
</form>
<a href="/solar/register" class="contract-item-button">Registracija</a>
</div>
</div>
</div>
<div id="rect2" class="mock-side">
</div>
</div>
</body>

View File

@@ -1,13 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin panel - Šolar</title>
</head>
<body>
<h3>Uporabniki</h3>
TODO: odobri registracije
<form> </form>
<div> </div>
</body>

View File

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Portal {{title}}</title>
<title>Portal ŠOLAR</title>
<link rel="stylesheet" href="/static/style.css" type="text/css">
</head>
<body>
@@ -12,7 +12,7 @@
<div id="logo-container">
<img src="/static/image/logo.svg" alt="logo"/>
</div>
<h3 id="title" style="font-size: 27px; text-align: left;">Prijava - {{title}}</h3>
<h3 id="title" style="font-size: 27px; text-align: left;">Prijava - ŠOLAR</h3>
<div>
{% with messages = get_flashed_messages() %}
{% if messages %}
@@ -21,7 +21,7 @@
</div>
{% endif %}
{% endwith %}
<form method="POST" action="/{{corpus_name}}/login">
<form method="POST" action="/solar/login">
<div>
<div>
<input type="email" name="email" placeholder="Email" autofocus="">
@@ -39,6 +39,7 @@
</div>
<button class="button-general" style="margin-top: 20px;">PRIJAVA</button>
</form>
<a href="/solar/register" class="contract-item-button">Registracija</a>
</div>
</div>
</div>

View File

@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upravljanje institucije - Šolar</title>
<style>
.tableFixHead {
overflow-y: auto;
height: 206px;
}
.tableFixHead thead th {
position: sticky;
top: 0;
}
table {
border-collapse: collapse;
width: 100%;
}
th,
td {
padding: 8px 16px;
border: 1px solid #ccc;
}
th {
background: #eee;
}
</style>
</head>
<body>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div>
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
<h3>Seznam vseh aktivnih uporabnikov</h3>
<div class="tableFixHead">
<table>
<thead>
<tr>
<th>ID</th>
<th>Ime in priimek</th>
<th>Email</th>
</tr>
</thead>
<tbody>
{% for item in users %}
<tr>
<td>{{item.id}}</td>
<td>{{item.name}}</td>
<td>{{item.email}}</td>
</tr>
{% endfor %}
</table>
</div>
<h3>Seznam uporabnikov v vaši instituciji</h3>
<div class="tableFixHead">
<table>
<thead>
<tr>
<th>ID</th>
<th>Ime in priimek</th>
<th>Email</th>
</tr>
</thead>
<tbody>
{% for item in institution_users %}
<tr>
<td>{{item.id}}</td>
<td>{{item.name}}</td>
<td>{{item.email}}</td>
</tr>
{% endfor %}
</table>
</div>
<br>
<h3>Dodeli uporabnika instituciji</h3>
<form action="/solar/addusertoinstitution" method="post">
<label for="user_id">ID uporabnika:</label>
<input type="text" id="user_id" name="user_id"><br>
<label for="role">Vloga v instituciji:</label>
<select name="role" id="role">
<option value="moderator">Moderator</option>
<option value="user">Uporabnik</option>
</select>
<input type="submit" value="Dodeli">
</form>
<h3>Odstrani uporabnika iz institucije</h3>
<form action="/solar/deluserfrominstitution" method="post">
<label for="user_id">ID uporabnika:</label>
<input type="text" id="user_id" name="user_id"><br>
<input type="submit" value="Odstrani">
</form>
<div> </div>
</body>

View File

@@ -19,6 +19,12 @@
</head>
<body>
<a href="/solar/logout">Odjavi se</a>
{% if is_institution_moderator %}
<br><a href="/solar/manage-institution">Upravljaj z institucijo</a>
{% endif %}
{% if is_admin %}
<br><a href="/solar/admin">Administracijski meni</a>
{% endif %}
<div class="bg"></div>
<div id="main-window">
<div id="rect1">

View File

@@ -7,6 +7,12 @@
</head>
<body>
<a href="/solar/logout">Odjavi se</a>
{% if is_institution_moderator %}
<br><a href="/solar/manage-institution">Upravljaj z institucijo</a>
{% endif %}
{% if is_admin %}
<br><a href="/solar/admin">Administracijski meni</a>
{% endif %}
<div class="bg"></div>
<div id="main-window">
<div id="rect1">
@@ -21,13 +27,13 @@
<button onclick="window.location.replace('/solar/pogodbe');" class="selection-tab-button selected">POGODBE</button>
</div>
</div>
<div id="conract-container" style="padding: 20px;">
<div id="contract-container">
{% if contract_school %}
<div class="contract-item" style="background-color: #ccffcc;">
<div class="contract-item-icon"></div>
<div class="contract-item-title">Pogodba s šolo</div>
<div class="contract-item-date">DODANO {{contract_school.date}}</div>
<a href="/solar/pogodbe/{{ contract_school.file_contract }}.pdf" class="contract-item-button">PRENESI</a>
<div class="contract-item-date">DODANO: {{contract_school.timestamp}}</div>
<a href="/solar/pogodbe/{{ contract_school.file_contract }}.pdf" class="contract-item-button">Prenesi</a>
</div>
</br>
{% endif %}
@@ -35,8 +41,8 @@
<div class="contract-item">
<div class="contract-item-icon"></div>
<div class="contract-item-title">Pogodba o prenosu lastništva</div>
<div class="contract-item-date">DODANO {{item.date}}</div>
<a href="/solar/pogodbe/{{ item.file_contract }}.pdf" class="contract-item-button">PRENESI</a>
<div class="contract-item-date">DODANO: {{item.timestamp}}</div>
<a href="/solar/pogodbe/{{ item.file_contract }}.pdf" class="contract-item-button">Prenesi</a>
</div>
</br>
{% endfor %}
@@ -69,6 +75,19 @@
{% endif %}
</div>
<div id="rect2" class="mock-side">
<div id="collaborators-container">
<div class="container-title">Sodelujoči</div>
<div style="overflow-y: auto;">
{% for item in collaborators %}
<div class="collaborators-item">
<div class="collaborators-item-name">{{item.name}}</div>
</div>
{% endfor %}
</div>
</div>
<div id="awards-container">
<div class="container-title">Nagrade</div>
</div>
</div>
</div>
</body>

View File

@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Portal ŠOLAR</title>
<link rel="stylesheet" href="/static/style.css" type="text/css">
</head>
<body>
<div id="main-window">
<div id="rect1">
<div style="padding: 50px;">
<div id="logo-container">
<img src="/static/image/logo.svg" alt="logo"/>
</div>
<h3 id="title" style="font-size: 27px; text-align: left;">Registracija - ŠOLAR</h3>
<div>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div>
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
<form method="POST" action="/solar/register">
<div>
<div>
<input type="name" name="name" placeholder="Ime in priimek" autofocus="">
</div>
</div>
<div>
<div>
<input type="email" name="email" placeholder="Email" autofocus="">
</div>
</div>
<div>
<div>
<input type="password" name="password" placeholder="Geslo">
</div>
</div>
<button class="button-general" style="margin-top: 20px;">REGISTRACIJA</button>
</form>
</div>
</div>
</div>
<div id="rect2" class="mock-side">
</div>
</div>
</body>

View File

@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Portal ŠOLAR</title>
<link rel="stylesheet" href="/static/style.css" type="text/css">
</head>
<body>
<div id="main-window">
<div id="rect1">
<div style="padding: 50px;">
<div id="logo-container">
<img src="/static/image/logo.svg" alt="logo"/>
</div>
<h3 id="title" style="font-size: 27px; text-align: left;">Prijava - ŠOLAR</h3>
<div>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div>
{{ messages[0] }}
</div>
{% endif %}
{% endwith %}
<form method="POST" action="/solar/login">
<div>
<div>
<input type="email" name="email" placeholder="Email" autofocus="">
</div>
</div>
<div>
<div>
<input type="password" name="password" placeholder="Geslo">
</div>
</div>
<div style="display:flex; flex-direction: row; justify-content: left; align-items: center">
<label>Zapomni prijavo</label>
<input style="width: 10%;" type="checkbox">
</div>
<button class="button-general" style="margin-top: 20px;">PRIJAVA</button>
</form>
<a href="/solar/register" class="contract-item-button">Registracija</a>
</div>
</div>
</div>
<div id="rect2" class="mock-side">
</div>
</div>
</body>

View File

@@ -4,9 +4,16 @@
<meta charset="UTF-8">
<title>Portal za oddajanje besedil</title>
<link rel="stylesheet" href="/static/style.css" type="text/css">
<script src="/static/chart.js"></script>
</head>
<body>
<a href="/solar/logout">Odjavi se</a>
{% if is_institution_moderator %}
<br><a href="/solar/manage-institution">Upravljaj z institucijo</a>
{% endif %}
{% if is_admin %}
<br><a href="/solar/admin">Administracijski meni</a>
{% endif %}
<div class="bg"></div>
<div id="main-window">
<div id="rect1">
@@ -72,6 +79,40 @@
</div>
</div>
<div id="rect2" class="mock-side">
<canvas id="myChart" width="400" height="400"></canvas>
<script>
function drawChart(data) {
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: Object.keys(data),
datasets: [{
label: 'št. naloženih datotek',
data: Object.values(data),
backgroundColor: 'rgba(54, 162, 235, 1.0)',
borderWidth: 1
}]
},
options: {
plugins: {
title: {
display: true,
text: ''
}
},
scales: {
y: {
beginAtZero: true
}
},
indexAxis: 'y'
}
});
}
fetch('/solar/topuploads').then(r => r.json()).then(j => drawChart(j));
</script>
</div>
</div>
</body>