|
|
|
@ -20,35 +20,47 @@
|
|
|
|
|
<hr/>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
<form id="paper-form" method="post" th:action="@{'/papers/paper?id='+ *{id == null ? '' : id} + ''}"
|
|
|
|
|
<form name="paperform" id="paper-form" method="post"
|
|
|
|
|
th:action="@{'/papers/paper?id='+ *{id == null ? '' : id} + ''}"
|
|
|
|
|
th:object="${paperDto}">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-md-7 col-sm-12">
|
|
|
|
|
<input type="hidden" name="id" th:field="*{id}"/>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="title">Название:</label>
|
|
|
|
|
<input class="form-control" id="title" type="text"
|
|
|
|
|
placeholder="Название статьи"
|
|
|
|
|
th:field="*{title}"/>
|
|
|
|
|
<p th:if="${#fields.hasErrors('title')}" th:errors="*{title}"
|
|
|
|
|
class="alert alert-danger">Incorrect title</p>
|
|
|
|
|
<p class="help-block text-danger"></p>
|
|
|
|
|
</div>
|
|
|
|
|
<nav>
|
|
|
|
|
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
|
|
|
|
<a class="nav-item nav-link active" id="nav-main-tab" data-toggle="tab"
|
|
|
|
|
href="#nav-main" role="tab" aria-controls="nav-main" aria-selected="true">Статья</a>
|
|
|
|
|
<a class="nav-item nav-link" id="nav-latex-tab" data-toggle="tab"
|
|
|
|
|
href="#nav-latex" role="tab" aria-controls="nav-latex" aria-selected="false">Latex</a>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
|
|
|
|
<div class="tab-content" id="nav-tabContent">
|
|
|
|
|
<div class="tab-pane fade show active" id="nav-main" role="tabpanel"
|
|
|
|
|
aria-labelledby="nav-main-tab">
|
|
|
|
|
<input type="hidden" name="id" th:field="*{id}"/>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="title">Название:</label>
|
|
|
|
|
<input class="form-control" id="title" type="text"
|
|
|
|
|
placeholder="Название статьи"
|
|
|
|
|
th:field="*{title}"/>
|
|
|
|
|
<p th:if="${#fields.hasErrors('title')}" th:errors="*{title}"
|
|
|
|
|
class="alert alert-danger">Incorrect title</p>
|
|
|
|
|
<p class="help-block text-danger"></p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="status">Статус:</label>
|
|
|
|
|
<select class="form-control" th:field="*{status}" id="status">
|
|
|
|
|
<option th:each="status : ${allStatuses}" th:value="${status}"
|
|
|
|
|
th:text="${status.statusName}">Status
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="status">Статус:</label>
|
|
|
|
|
<select class="form-control" th:field="*{status}" id="status">
|
|
|
|
|
<option th:each="status : ${allStatuses}" th:value="${status}"
|
|
|
|
|
th:text="${status.statusName}">Status
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="comment">Комментарий:</label>
|
|
|
|
|
<textarea class="form-control" rows="5" id="comment"
|
|
|
|
|
th:field="*{comment}"></textarea>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="comment">Комментарий:</label>
|
|
|
|
|
<textarea class="form-control" rows="5" id="comment"
|
|
|
|
|
th:field="*{comment}"></textarea>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="title">Ссылка на сайт конференции:</label>
|
|
|
|
@ -99,42 +111,52 @@
|
|
|
|
|
class="alert alert-danger">Incorrect title</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="form-group" id="files-list">
|
|
|
|
|
<label>Файлы:</label>
|
|
|
|
|
<th:block th:each="file, rowStat : *{files}">
|
|
|
|
|
<div class="row" th:id="|files${rowStat.index}|"
|
|
|
|
|
th:style="${file.deleted} ? 'display: none;' :''">
|
|
|
|
|
<input type="hidden" th:field="*{files[__${rowStat.index}__].id}"/>
|
|
|
|
|
<input type="hidden" th:field="*{files[__${rowStat.index}__].deleted}"/>
|
|
|
|
|
<input type="hidden" th:field="*{files[__${rowStat.index}__].name}"/>
|
|
|
|
|
<input type="hidden" th:field="*{files[__${rowStat.index}__].tmpFileName}"/>
|
|
|
|
|
<div class="col-2">
|
|
|
|
|
<a class="btn btn-danger float-right"
|
|
|
|
|
th:onclick="|$('#files${rowStat.index}\\.deleted').val('true'); $('#files${rowStat.index}').hide(); |">
|
|
|
|
|
<span aria-hidden="true"><i class="fa fa-times"/></span>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-10">
|
|
|
|
|
<a th:onclick="${file.id==null} ? 'downloadFile('+${file.tmpFileName}+',null,\''+${file.name}+'\')':
|
|
|
|
|
'downloadFile(null,'+${file.id}+',\''+${file.name}+'\')' "
|
|
|
|
|
href="javascript:void(0)"
|
|
|
|
|
th:text="*{files[__${rowStat.index}__].name}">
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group files-list" id="files-list">
|
|
|
|
|
<label>Файлы:</label>
|
|
|
|
|
|
|
|
|
|
<div th:replace="papers/fragments/paperFilesListFragment :: filesList(isLatexAttach = ${false})"/>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</th:block>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-check">
|
|
|
|
|
<input type="checkbox" class="form-check-input" id="locked"
|
|
|
|
|
th:field="*{locked}"/>
|
|
|
|
|
<label class="form-check-label" for="locked">Заблокирована</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="loader">Загрузить статью:</label>
|
|
|
|
|
<div id="loader">
|
|
|
|
|
|
|
|
|
|
<div class="form-check">
|
|
|
|
|
<input type="checkbox" class="form-check-input" id="locked"
|
|
|
|
|
th:field="*{locked}"/>
|
|
|
|
|
<label class="form-check-label" for="locked">Заблокирована</label>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="loader">Загрузить статью:</label>
|
|
|
|
|
<div id="loader">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="tab-pane fade" id="nav-latex" role="tabpanel"
|
|
|
|
|
aria-labelledby="nav-profile-tab">
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="latex-text">Latex текст:</label>
|
|
|
|
|
<textarea class="form-control" id="latex-text" type="text" rows="10"
|
|
|
|
|
placeholder="Latex.."
|
|
|
|
|
th:field="*{latexText}"/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group files-list" id="latex-files-list">
|
|
|
|
|
<label>Файлы:</label>
|
|
|
|
|
<div th:replace="papers/fragments/paperFilesListFragment :: filesList(isLatexAttach = ${true})"/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label for="latex-loader">Загрузить файлы:</label>
|
|
|
|
|
<div id="latex-loader">
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<button id="pdfBtn" class="btn btn-primary text-uppercase"
|
|
|
|
|
onclick="generatePDF()"
|
|
|
|
|
type="button">
|
|
|
|
|
<i id="pdfLoadingIcon" class='fa fa-circle-o-notch fa-spin'
|
|
|
|
|
style="display: none;"></i>
|
|
|
|
|
pdf
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -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 = $("<div/>")
|
|
|
|
|
.attr("id", 'files' + fileNumber)
|
|
|
|
@ -248,6 +282,13 @@
|
|
|
|
|
.attr("name", "files[" + fileNumber + "].tmpFileName");
|
|
|
|
|
newFileRow.append(tmpFileNameInput);
|
|
|
|
|
|
|
|
|
|
var isLatexInput = $("<input/>")
|
|
|
|
|
.attr("type", "hidden")
|
|
|
|
|
.attr("id", "files" + fileNumber + ".isLatexAttach")
|
|
|
|
|
.attr("value", isLatexAttach)
|
|
|
|
|
.attr("name", "files[" + fileNumber + "].isLatexAttach");
|
|
|
|
|
newFileRow.append(isLatexInput);
|
|
|
|
|
|
|
|
|
|
var nextDiv = $("<div/>")
|
|
|
|
|
.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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|