portal-oddajanje-solar/templates/solar-oddaja.html
2022-01-08 16:25:25 +01:00

465 lines
20 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Portal za oddajanje besedil</title>
<link rel="stylesheet" href="../static/css/header.css" type="text/css">
<link rel="stylesheet" href="../static/css/form.css" type="text/css">
<link rel="stylesheet" href="../static/css/simple-grid.css" type="text/css">
<link rel="stylesheet" href="../static/css/utils.css" type="text/css">
</head>
<body>
<header>
<div class="logo"><a href="../"><img src="../static/image/logo-white.svg"/></a></div>
<div class="menu-items">
<a href="../logout">Odjava</a>
{% if is_institution_coordinator %}
<a href="../manage-institution">Upravljaj z institucijo</a>
{% endif %}
{% if is_admin %}
<a href="../admin">Administracijski meni</a>
{% endif %}
<a href="https://slovenscina.eu/" target="_blank">Več informacij</a>
</div>
</header>
<div class="container" style="margin-top:8rem;">
<div class="row">
<div class="col-12">
<h1 class="title">Korpus Šolar</h1>
<p class="subtitle" style="width:60%">Prosimo, določite podatke o besedilih, ki jih želite oddati, in nato naložite besedila. Če oddajate besedila, ki so nastala v različnih razredih, se razlikujejo glede učiteljskih popravkov in podobno, jih oddajte v ločenih paketih.</p>
<div class="tab-nav">
<a href="../oddaja" class="active">Oddaja besedil</a>
<a href="../zgodovina">Zgodovina sodelovanja</a>
<a href="../pogodbe">Ekipa</a>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
{% if not institution %}
<div class="alert">
<img src="../static/image/alert.svg" alt="alert"/>
<p>Niste član nobene institucije!</p>
</div>
{% elif not institution_contract %}
<!--<div class="alert">
<img src="../static/image/alert.svg" alt="alert"/>
<p>Pogodba s šolo še ni naložena!</p>
</div>-->
{% endif %}
<div class="alert" id="error-message">
<img src="../static/image/alert.svg" alt="alert"/>
<p></p>
</div>
<div class="alert alert-success" id="success-message">
<img src="../static/image/success.svg" alt="alert"/>
<p></p>
</div>
</div>
</div>
<form id="form-oddaja">
<div class="row">
<div class="col-6">
<div class="form-wrapper">
<label for="regija">Regija</label>
<select id="regija" name="regija">
<option value="CE" selected="selected">Celje (CE)</option>
<option value="GO">Nova Gorica (GO)</option>
<option value="KK">Krško (KK)</option>
<option value="KP">Koper (KP)</option>
<option value="KR">Kranj (KR)</option>
<option value="LJ">Ljubljana (LJ)</option>
<option value="MB">Maribor (MB)</option>
<option value="MS">Murska Sobota (MS)</option>
<option value="NM">Novo Mesto (NM)</option>
<option value="PO">Postojna (PO)</option>
<option value="SG">Slovenj Gradec (SG)</option>
</select>
</div>
</div>
<div class="col-6">
<p></p>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper">
<label for="program">Program</label>
<select id="program" name="program">
<option value="OS" selected="selected">Osnovnošolski (OŠ)</option>
<option value="SSG">Splošna in strokovna gimnazija (SGG)</option>
<option value="MGP">Mednarodni gimnazijski programi (MGP)</option>
<option value="ZG">Zasebne gimnazije (ZG)</option>
<option value="NPI">Nižje poklicno izobraževanje (NPI)</option>
<option value="SPI">Srednje poklicno izobraževanje (SPI)</option>
<option value="SSI">Srednje strokovno izobraževanje (SSI)</option>
<option value="PTI">Poklicno-tehniško izobraževanje (PTI)</option>
</select>
</div>
</div>
<div class="col-6">
<p></p>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper">
<label for="predmet">Predmet</label>
<select id="predmet" name="predmet">
<option value="SLO" selected="selected">Slovenščina (SLO)</option>
<option value="DJP">Drugi jezikoslovni predmeti (vtipkajte ime predmeta) (DJP)</option>
<option value="DDP">Drugi družboslovni predmeti (vtipkajte ime predmeta) (DDP)</option>
<option value="DNP">Drugi naravoslovni predmeti (vtipkajte ime predmeta) (DNP)</option>
<option value="DSP">Drugi strokovni predmeti (vtipkajte ime predmeta) (DSP)</option>
<option value="DIP">Drugi izbirni ali dodatni predmeti (vtipkajte ime predmeta) (DIP)</option>
</select>
</div>
</div>
<div class="col-6">
<p></p>
</div>
</div>
<div class="row set-open-transition">
<div class="col-6">
<div class="form-wrapper" id="predmet-custom-box">
<label for="predmet-custom">Ime predmeta:</label>
<input type="text" id="predmet-custom" name="predmet-custom"/>
</div>
</div>
<div class="col-6">
<p></p>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper">
<label for="letnik">Letnik</label>
<select id="letnik" name="letnik">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</div>
</div>
<div class="col-6">
<p></p>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper" >
<label for="vrsta">Vrsta besedila</label>
<select id="vrsta" name="vrsta">
<option value="E" selected="selected">Esej ali spis (E)</option>
<option value="PB">Praktično besedilo (npr. vabila, prošnje ipd. pri pouku slovenščine), napisano za oceno (PB)</option>
<option value="T">Šolski test (T)</option>
<option value="R">Delo v razredu, ne za oceno (vtipkajte besedilo vrsto) (R)</option>
</select>
</div>
</div>
<div class="col-6">
<p></p>
</div>
</div>
<div class="row set-open-transition">
<div class="col-6">
<div class="form-wrapper" id="vrsta-custom-box">
<label for="vrsta-custom">Vtipkajte besedilno vrsto:</label>
<input type="text" id="vrsta-custom" name="vrsta-custom"/>
</div>
</div>
<div class="col-6">
<p></p>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper">
<label for="solsko-leto">Šolsko leto</label>
<select id="solsko-leto" name="solsko-leto">
<option value="20-21" selected="selected">2020/21</option>
<option value="21-22">2021/22</option>
</select>
</div>
</div>
<div class="col-6">
<p></p>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper">
<label for="jezikovni-popravki">Jezikovni popravki</label>
<select id="jezikovni-popravki" name="jezikovni-popravki">
<option value="DD" selected="selected">Besedilo vsebuje učiteljske popravke in strinjam se z njihovo vključitvijo v korpus. (DD)</option>
<option value="N">Besedilo ne vsebuje učiteljskih popravkov. (N)</option>
<option value="DN">Besedilo vsebuje učiteljske popravke in ne strinjam se z njihovo vključitvijo v korpus. (DN)</option>
</select>
</div>
</div>
<div class="col-6">
<p></p>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper">
<div id="dropzone-previews" class="dropzone-previews"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper">
<label for="jezikovni-popravki">Datoteka</label>
<div id="my-dropzone" class="dropzone"></div>
</div>
</div>
<div class="col-6">
<p>Oddate lahko eno ali (hkrati) več besedil, ki ustrezajo izbranim podatkom. Sprejemljivi formati so: txt, csv, pdf, doc, docx, xls, xlsx, ppt, pptx, jpg, jpeg, png.</p>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-wrapper">
<button id="button-submit" type="button" class="btn">Oddaj</button>
</div>
</div>
<div class="col-6">
</div>
</div>
<div class="row submit-alert" id="data-confirm-notification">
<div class="col-6">
<button id="button-submit-final" type="button" class="btn">Potrdi in oddaj</button>
</div>
<div class="col-6">
<p>Prosimo, preverite, če so vneseni podatki ustrezni in besedila prava. Naknadno spreminjanje ne bo več mogoče.</p>
</div>
</div>
</form>
</div>
<br/><br/><br/><br/><br/><br/><br/>
<!--{{ dropzone.load_js() }}-->
<script src="../static/dropzone.js"></script>
<script>
/////////////////////////
// Dropzone //
/////////////////////////
var selectPredmet = document.getElementById("predmet");
var selectVrsta = document.getElementById("vrsta");
var btnSubmit = document.getElementById("button-submit");
var btnSubmitFinal = document.getElementById("button-submit-final");
var btnSubmitCancel = document.getElementById("button-submit-cancel");
var elemTermsPopup = document.getElementById("popup-terms");
var termsScrollbox = document.getElementById("popup-terms-text");
var dataConfirmNotification = document.getElementById("data-confirm-notification");
var errorMessage = document.getElementById("error-message");
var successMessage = document.getElementById("success-message");
var form = document.forms["form-oddaja"];
{% if not institution %}
btnSubmit.disabled = true;
{% endif %}
function isEmptyOrSpaces(str){
return str == null || str.match(/^ *$/) !== null;
}
function showError(str) {
errorMessage.querySelector("p").textContent = str;
errorMessage.style.display = "block";
window.scroll({
top: 0,
behavior: 'smooth'
});
}
function showSuccess(str) {
successMessage.querySelector("p").textContent = str;
successMessage.style.display = "block";
window.scroll({
top: 0,
behavior: 'smooth'
});
}
//onready
selectPredmet.addEventListener("change", function(e) {
var predmetCustomBox = document.getElementById("predmet-custom-box").closest('.row');
if (selectPredmet.value.startsWith("D")) {
predmetCustomBox.style.maxHeight = "150px";
} else {
predmetCustomBox.style.maxHeight = "0px";
}
});
selectVrsta.addEventListener("change", function(e) {
var vrstaCustomBox = document.getElementById("vrsta-custom-box").closest('.row');
if (selectVrsta.value == "R") {
vrstaCustomBox.style.maxHeight = "150px";
} else {
vrstaCustomBox.style.maxHeight = "0px";
}
});
var event = new CustomEvent("change");
selectPredmet.dispatchEvent(event);
selectVrsta.dispatchEvent(event);
Dropzone.options.myDropzone = { // The camelized version of the ID of the form element
url: "../upload",
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 20,
paramName: "file", // The name that will be used to transfer the file
maxFilesize: 1000, // MB
timeout: 5000000, // milliseconds
acceptedFiles: ".txt, .csv, .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .jpg, .jpeg, .png",
maxFiles: 20,
previewsContainer: "#dropzone-previews",
dictDefaultMessage: "Kliknite to polje ali povlecite datoteke vanj.",
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: "Ne morete naložiti več datotek.",
dictCancelUpload: "",
dictRemoveFile: "",
dictCancelUploadConfirmation: "Ali res želite odstraniti to datoteko?",
dictUploadCanceled: "Prenos prekinjen",
addRemoveLinks: true,
// The setting up of the dropzone
init: function() {
var dz = this;
dataConfirmNotification.style.display = "none";
errorMessage.style.display = "none";
successMessage.style.display = "none";
btnSubmit.addEventListener("click", function(e) {
// Make sure that the form isn't actually being sent.
e.preventDefault();
e.stopPropagation();
// Check form validity.
var regija = form["regija"].value;
var program = form["program"].value;
var predmet = form["predmet"].value;
var predmetCustom = form["predmet-custom"].value;
var letnik = form["letnik"].value;
var vrsta = form["vrsta"].value;
var vrstaCustom = form["vrsta-custom"].value;
var solskoLeto = form["solsko-leto"].value;
var jezikovniPopravki = form["jezikovni-popravki"].value;
if (predmet.startsWith("D") && isEmptyOrSpaces(predmetCustom)) {
showError("Polje za predmet ne more biti prazno!");
} else if (vrsta === "R" && isEmptyOrSpaces(vrstaCustom)) {
showError("Polje za vrsto besedila ne more biti prazno!");
} else if (dataConfirmNotification.style.display == "none") {
dataConfirmNotification.style.display = "inherit";
btnSubmit.style.display = "none";
} else {
// Hand off data to dropzone
//dz.processQueue();
// Clear fields and hide popup agian
dataConfirmNotification.style.display = "none";
btnSubmit.textContent = "Oddaj";
//form.reset();
}
});
// First change the button to actually tell dropzone to process the queue.
btnSubmitFinal.addEventListener("click", function(e) {
// Hand off data to dropzone
dz.processQueue();
});
// 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) {
showSuccess(response);
dz.removeAllFiles();
dataConfirmNotification.style.display = "none";
btnSubmit.style.display = "";
return;
// Gets triggered when the files have successfully been sent.
// Redirect user or notify of success.
});
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
});
this.on("sending", function(file, xhr, formData) {
formData.append("regija",form["regija"].value);
formData.append("program",form["program"].value);
formData.append("predmet",form["predmet"].value);
formData.append("predmet-custom",form["predmet-custom"].value);
formData.append("letnik",form["letnik"].value);
formData.append("vrsta",form["vrsta"].value);
formData.append("vrsta-custom",form["vrsta-custom"].value);
formData.append("solsko-leto",form["solsko-leto"].value);
formData.append("jezikovni-popravki",form["jezikovni-popravki"].value);
});
},
uploadprogress: function(file, progress, bytesSent) {
if (file.previewElement) {
//console.log(progress);
var progressElement = file.previewElement.querySelector("[data-dz-uploadprogress]");
progressElement.style.width = progress + "%";
//progressElement.querySelector(".progress-text").textContent = progress + "%";
}
}
}
</script>
</body>
</html>