+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
@@ -99,42 +111,52 @@
class="alert alert-danger">Incorrect title
-
@@ -207,14 +229,26 @@
showFeedbackMessage("Файл успешно загружен");
console.debug(response);
- addNewFile(response);
+ addNewFile(response, $("#files-list"), false);
+ }
+ });
+ new FileLoader({
+ div: "latex-loader",
+ url: urlFileUpload,
+ maxSize: -1,
+ extensions: [],
+ callback: function (response) {
+ showFeedbackMessage("Файл успешно загружен");
+ console.debug(response);
+
+ addNewFile(response, $("#latex-files-list"), true);
}
});
$('.selectpicker').selectpicker();
});
/*]]>*/
- function addNewFile(fileDto) {
- var fileNumber = $("#files-list div.row").length;
+ function addNewFile(fileDto, listElement, isLatexAttach) {
+ var fileNumber = $('.files-list div.row').length;
var newFileRow = $("
")
.attr("id", 'files' + fileNumber)
@@ -248,6 +282,13 @@
.attr("name", "files[" + fileNumber + "].tmpFileName");
newFileRow.append(tmpFileNameInput);
+ var isLatexInput = $("
")
+ .attr("type", "hidden")
+ .attr("id", "files" + fileNumber + ".isLatexAttach")
+ .attr("value", isLatexAttach)
+ .attr("name", "files[" + fileNumber + "].isLatexAttach");
+ newFileRow.append(isLatexInput);
+
var nextDiv = $("
")
.addClass("col-2");
@@ -266,7 +307,7 @@
.attr("onclick", "downloadFile('" + fileDto.tmpFileName + "',null,'" + fileDto.fileName + "')"));
newFileRow.append(nameDiv);
- $("#files-list").append(newFileRow);
+ listElement.append(newFileRow);
}
@@ -298,6 +339,37 @@
}
}
}
+
+ function generatePDF() {
+ $('#pdfLoadingIcon').show();
+ $('#pdfBtn').prop('disabled', true);
+
+ var formData = new FormData(document.forms.paperform);
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", urlPdfGenerating);
+ xhr.send(formData);
+ xhr.responseType = 'blob';
+
+ xhr.onload = function () {
+ if (this.status == 200) {
+ console.debug(this.response);
+ var blob = new Blob([this.response], {type: 'application/pdf'});
+ let a = document.createElement("a");
+ a.style = "display: none";
+ document.body.appendChild(a);
+ let url = window.URL.createObjectURL(blob);
+ a.href = url;
+ a.download = $('#title').val() + '.pdf';
+ a.click();
+ window.URL.revokeObjectURL(url);
+ } else {
+ showFeedbackMessage("Ошибка при создании PDF", MessageTypesEnum.DANGER);
+ }
+ $('#pdfLoadingIcon').hide();
+ $('#pdfBtn').prop('disabled', false);
+ }
+ }
+
diff --git a/src/main/resources/templates/projects/project.html b/src/main/resources/templates/projects/project.html
index 3d356a7..3872cfe 100644
--- a/src/main/resources/templates/projects/project.html
+++ b/src/main/resources/templates/projects/project.html
@@ -1,7 +1,7 @@
+ layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
@@ -19,7 +19,8 @@
diff --git a/src/main/resources/templates/students/dashboard.html b/src/main/resources/templates/students/dashboard.html
index 78e749c..1f930cd 100644
--- a/src/main/resources/templates/students/dashboard.html
+++ b/src/main/resources/templates/students/dashboard.html
@@ -17,6 +17,7 @@