Compare commits
No commits in common. "d2e199e509490b95905ecc21759b56644ceca0cc" and "dd86fc1fcb8243b746bd6c202f61571d779b3be9" have entirely different histories.
d2e199e509
...
dd86fc1fcb
12 changed files with 178 additions and 177 deletions
|
@ -4,5 +4,4 @@ from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('korektury/api/<int:pdf_id>/stav', org_required(views.korektury_stav_view), name='korektury_api_pdf_stav'),
|
path('korektury/api/<int:pdf_id>/stav', org_required(views.korektury_stav_view), name='korektury_api_pdf_stav'),
|
||||||
path('korektury/api/oprava/stav', org_required(views.oprava_stav_view), name='korektury_api_oprava_stav'),
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -18,17 +18,3 @@ def korektury_stav_view(request, pdf_id: int, **kwargs):
|
||||||
pdf.status = status
|
pdf.status = status
|
||||||
pdf.save()
|
pdf.save()
|
||||||
return JsonResponse({'status': pdf.status})
|
return JsonResponse({'status': pdf.status})
|
||||||
|
|
||||||
|
|
||||||
def oprava_stav_view(request, **kwargs):
|
|
||||||
q = request.POST
|
|
||||||
op_id_str = q.get('id')
|
|
||||||
assert op_id_str is not None
|
|
||||||
op_id = int(op_id_str)
|
|
||||||
op = get_object_or_404(Oprava, id=op_id)
|
|
||||||
status = q.get('action')
|
|
||||||
if status is not None:
|
|
||||||
assert status in Oprava.STATUS.values
|
|
||||||
op.status = status
|
|
||||||
op.save()
|
|
||||||
return JsonResponse({'status': op.status})
|
|
||||||
|
|
|
@ -20,35 +20,17 @@ body[data-status="zastarale"] {
|
||||||
img{background:white;}
|
img{background:white;}
|
||||||
|
|
||||||
/* Barvy korektur */
|
/* Barvy korektur */
|
||||||
[data-opravastatus="k_oprave"] {
|
.k_oprave {
|
||||||
--rgb: 255, 0, 0;
|
--rgb: 255, 0, 0;
|
||||||
|
|
||||||
[value="k_oprave"] { display: none }
|
|
||||||
[value="notcomment"] { display: none }
|
|
||||||
}
|
}
|
||||||
[data-opravastatus="opraveno"] {
|
.opraveno {
|
||||||
--rgb: 0, 0, 255;
|
--rgb: 0, 0, 255;
|
||||||
|
|
||||||
[value="opraveno"] { display: none }
|
|
||||||
[value="comment"] { display: none }
|
|
||||||
}
|
}
|
||||||
[data-opravastatus="neni_chyba"] {
|
.neni_chyba {
|
||||||
--rgb: 128, 128, 128;
|
--rgb: 128, 128, 128;
|
||||||
|
|
||||||
[value="neni_chyba"] { display: none }
|
|
||||||
[value="comment"] { display: none }
|
|
||||||
}
|
}
|
||||||
[data-opravastatus="k_zaneseni"] {
|
.k_zaneseni {
|
||||||
--rgb: 0, 255, 0;
|
--rgb: 0, 255, 0;
|
||||||
|
|
||||||
[value="k_zaneseni"] { display: none }
|
|
||||||
[value="notcomment"] { display: none }
|
|
||||||
}
|
|
||||||
|
|
||||||
[data-opravazobrazit="false"] {
|
|
||||||
.corr-body { display: none; }
|
|
||||||
.corr-buttons { display: none; }
|
|
||||||
.toggle-button { transform: rotate(180deg); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.pointer-hi,
|
.pointer-hi,
|
||||||
|
|
|
@ -22,6 +22,7 @@ function place_comments_one_div(img_id, comments)
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
//console.log("w:" + w);
|
||||||
for (c in comments_sorted) {
|
for (c in comments_sorted) {
|
||||||
var id = comments_sorted[c][0];
|
var id = comments_sorted[c][0];
|
||||||
var x = comments_sorted[c][1];
|
var x = comments_sorted[c][1];
|
||||||
|
@ -52,8 +53,13 @@ function place_comments_one_div(img_id, comments)
|
||||||
|
|
||||||
var bott = el.offsetTop + el.offsetHeight;
|
var bott = el.offsetTop + el.offsetHeight;
|
||||||
bott_max = ( bott_max > bott ) ? bott_max : bott;
|
bott_max = ( bott_max > bott ) ? bott_max : bott;
|
||||||
|
|
||||||
|
//console.log( "par.w:" + par.style.width);
|
||||||
|
|
||||||
}
|
}
|
||||||
if( par.offsetHeight < bott_max ) {
|
if( par.offsetHeight < bott_max ) {
|
||||||
|
//par.style.height = bott_max;
|
||||||
|
//alert("preteklo to:"+ par.offsetHeight +",mx:" + bott_max );
|
||||||
par.style.height = bott_max;
|
par.style.height = bott_max;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,6 +71,33 @@ function place_comments() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ctrl-enter submits form
|
||||||
|
function textarea_onkey(ev)
|
||||||
|
{
|
||||||
|
//console.log("ev:" + ev.keyCode + "," + ev.ctrlKey);
|
||||||
|
if( (ev.keyCode == 13 || ev.keyCode == 10 ) && ev.ctrlKey ) {
|
||||||
|
var form = document.getElementById('commform');
|
||||||
|
if( form ) {
|
||||||
|
save_scroll(form);
|
||||||
|
//form.action ='';
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//hide comment form
|
||||||
|
function close_commform() {
|
||||||
|
var formdiv = document.getElementById('commform-div');
|
||||||
|
if( formdiv == null ) {
|
||||||
|
alert("form null");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
formdiv.style.display = 'none';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// show comment form, when clicked to image
|
// show comment form, when clicked to image
|
||||||
function img_click(element, ev) {
|
function img_click(element, ev) {
|
||||||
var body_class = document.body.className;
|
var body_class = document.body.className;
|
||||||
|
@ -96,8 +129,19 @@ function img_click(element, ev) {
|
||||||
return show_form(img_id, dx, dy, '', '', '', '');
|
return show_form(img_id, dx, dy, '', '', '', '');
|
||||||
}
|
}
|
||||||
// hide or show text of correction
|
// hide or show text of correction
|
||||||
function toggle_visibility(oprava){
|
function toggle_visibility(oid){
|
||||||
oprava.dataset.opravazobrazit = oprava.dataset.opravazobrazit !== 'true';
|
var buttondiv = document.getElementById(oid+'-buttons')
|
||||||
|
var text = document.getElementById(oid+'-body');
|
||||||
|
var toggleimg = document.getElementById(oid+'-toggleimg');
|
||||||
|
if (text.style.display == 'none'){
|
||||||
|
text.style.display = 'block';
|
||||||
|
buttondiv.style.display = 'inline-block';
|
||||||
|
toggleimg.style.transform = "";
|
||||||
|
}else {
|
||||||
|
text.style.display = 'none';
|
||||||
|
buttondiv.style.display = 'none';
|
||||||
|
toggleimg.style.transform = "rotate(180deg)";
|
||||||
|
}
|
||||||
for (var i=0;i<comments.length-1;i++){
|
for (var i=0;i<comments.length-1;i++){
|
||||||
place_comments_one_div(comments[i][0], comments[i][1])
|
place_comments_one_div(comments[i][0], comments[i][1])
|
||||||
}
|
}
|
||||||
|
@ -111,7 +155,7 @@ function box_edit(oid, action)
|
||||||
var text;
|
var text;
|
||||||
if (action == 'update') {
|
if (action == 'update') {
|
||||||
var text_el = document.getElementById(oid + '-text');
|
var text_el = document.getElementById(oid + '-text');
|
||||||
text = text_el.textContent;
|
text = text_el.textContent; // FIXME původně tu bylo innerHTML.unescapeHTML()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
text = '';
|
text = '';
|
||||||
|
@ -120,6 +164,7 @@ function box_edit(oid, action)
|
||||||
var dx = parseInt(divpointer.style.left);
|
var dx = parseInt(divpointer.style.left);
|
||||||
var dy = parseInt(divpointer.style.top);
|
var dy = parseInt(divpointer.style.top);
|
||||||
var divbox = document.getElementById(oid);
|
var divbox = document.getElementById(oid);
|
||||||
|
//alert('not yet 2:' + text + text_el); // + divpointer.style.top "x" + divpo );
|
||||||
id = oid.substring(2);
|
id = oid.substring(2);
|
||||||
return show_form(divbox.img_id, dx, dy, id, text, action);
|
return show_form(divbox.img_id, dx, dy, id, text, action);
|
||||||
}
|
}
|
||||||
|
@ -132,13 +177,55 @@ function update_comment(oid,ktid)
|
||||||
var dy = parseInt(divpointer.style.top);
|
var dy = parseInt(divpointer.style.top);
|
||||||
|
|
||||||
var divbox = document.getElementById(oid);
|
var divbox = document.getElementById(oid);
|
||||||
var text = document.getElementById(ktid).textContent;
|
var text = document.getElementById(ktid).textContent; // FIXME původně tu bylo innerHTML.unescapeHTML()
|
||||||
|
|
||||||
return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment');
|
return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//fill up comment form and show him
|
||||||
|
function show_form(img_id, dx, dy, id, text, action) {
|
||||||
|
var form = document.getElementById('commform');
|
||||||
|
var formdiv = document.getElementById('commform-div');
|
||||||
|
var textarea = document.getElementById('commform-text');
|
||||||
|
var inputX = document.getElementById('commform-x');
|
||||||
|
var inputY = document.getElementById('commform-y');
|
||||||
|
var inputImgId = document.getElementById('commform-img-id');
|
||||||
|
var inputId = document.getElementById('commform-id');
|
||||||
|
var inputAction = document.getElementById('commform-action');
|
||||||
|
var img = document.getElementById(img_id);
|
||||||
|
|
||||||
|
if( formdiv == null || textarea == null ) {
|
||||||
|
alert("form null");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//form.action = "#" + img_id;
|
||||||
|
|
||||||
|
// set hidden values
|
||||||
|
inputX.value = dx;
|
||||||
|
inputY.value = dy;
|
||||||
|
inputImgId.value = img_id;
|
||||||
|
inputId.value = id;
|
||||||
|
inputAction.value = action;
|
||||||
|
textarea.value = text;
|
||||||
|
|
||||||
|
//textarea.value = "dxy:"+ dx + "x" + dy + "\n" + 'id:' + img_id;
|
||||||
|
|
||||||
|
// show form
|
||||||
|
formdiv.style.display = 'block';
|
||||||
|
formdiv.style.left = dx;
|
||||||
|
formdiv.style.top = dy;
|
||||||
|
|
||||||
|
img.parentNode.appendChild(formdiv);
|
||||||
|
|
||||||
|
textarea.focus();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function box_onmouseover(box)
|
function box_onmouseover(box)
|
||||||
{
|
{
|
||||||
|
var id = box.id;
|
||||||
var pointer = document.getElementById(box.id + '-pointer');
|
var pointer = document.getElementById(box.id + '-pointer');
|
||||||
pointer.classList.remove('pointer');
|
pointer.classList.remove('pointer');
|
||||||
pointer.classList.add('pointer-hi');
|
pointer.classList.add('pointer-hi');
|
||||||
|
@ -146,8 +233,54 @@ function box_onmouseover(box)
|
||||||
|
|
||||||
function box_onmouseout(box)
|
function box_onmouseout(box)
|
||||||
{
|
{
|
||||||
|
var id = box.id;
|
||||||
var pointer = document.getElementById(box.id + '-pointer');
|
var pointer = document.getElementById(box.id + '-pointer');
|
||||||
pointer.classList.remove('pointer-hi');
|
pointer.classList.remove('pointer-hi');
|
||||||
pointer.classList.add('pointer');
|
pointer.classList.add('pointer');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function save_scroll(form)
|
||||||
|
{
|
||||||
|
//alert('save_scroll:' + document.body.scrollTop);
|
||||||
|
form.scroll.value = document.body.scrollTop;
|
||||||
|
//alert('save_scroll:' + form.scroll.value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggle_corrections(aclass)
|
||||||
|
{
|
||||||
|
var stylesheets = document.styleSheets;
|
||||||
|
var ssheet = null;
|
||||||
|
for (var i=0;i<stylesheets.length; i++){
|
||||||
|
if (stylesheets[i].title === "opraf-css"){
|
||||||
|
ssheet = stylesheets[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (! ssheet){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (var i=0;i<ssheet.cssRules.length;i++){
|
||||||
|
var rule = ssheet.cssRules[i];
|
||||||
|
if (rule.selectorText === '.'+aclass){
|
||||||
|
if (rule.style.display === ""){
|
||||||
|
rule.style.display = "none";
|
||||||
|
} else {
|
||||||
|
rule.style.display = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
place_comments();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String.prototype.unescapeHTML = function () {
|
||||||
|
return(
|
||||||
|
this.replace(/&/g,'&').
|
||||||
|
replace(/>/g,'>').
|
||||||
|
replace(/</g,'<').
|
||||||
|
replace(/"/g,'"')
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div id="commform-div">
|
<div id="commform-div">
|
||||||
<form action='' id="commform" method="POST">
|
<form action='' onsubmit='save_scroll(this)' id="commform" method="POST">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input size="24" name="au" value="{{user.first_name}} {{user.last_name}}" readonly/>
|
<input size="24" name="au" value="{{user.first_name}} {{user.last_name}}" readonly/>
|
||||||
<input type=submit value="Oprav!"/>
|
<input type=submit value="Oprav!"/>
|
||||||
|
@ -12,72 +12,6 @@
|
||||||
<input type="hidden" size="3" id="commform-img-id" name="img-id"/>
|
<input type="hidden" size="3" id="commform-img-id" name="img-id"/>
|
||||||
<input type="hidden" size="3" id="commform-id" name="id"/>
|
<input type="hidden" size="3" id="commform-id" name="id"/>
|
||||||
<input type="hidden" size="3" id="commform-action" name="action"/>
|
<input type="hidden" size="3" id="commform-action" name="action"/>
|
||||||
|
<input type="hidden" size="3" id="commform-action" name="scroll"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
// ctrl-enter submits form
|
|
||||||
function textarea_onkey(ev)
|
|
||||||
{
|
|
||||||
if( (ev.keyCode == 13 || ev.keyCode == 10 ) && ev.ctrlKey ) {
|
|
||||||
var form = document.getElementById('commform');
|
|
||||||
if( form ) {
|
|
||||||
form.submit();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//hide comment form
|
|
||||||
function close_commform() {
|
|
||||||
var formdiv = document.getElementById('commform-div');
|
|
||||||
if( formdiv == null ) {
|
|
||||||
alert("form null");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
formdiv.style.display = 'none';
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//fill up comment form and show him
|
|
||||||
function show_form(img_id, dx, dy, id, text, action) {
|
|
||||||
var form = document.getElementById('commform');
|
|
||||||
var formdiv = document.getElementById('commform-div');
|
|
||||||
var textarea = document.getElementById('commform-text');
|
|
||||||
var inputX = document.getElementById('commform-x');
|
|
||||||
var inputY = document.getElementById('commform-y');
|
|
||||||
var inputImgId = document.getElementById('commform-img-id');
|
|
||||||
var inputId = document.getElementById('commform-id');
|
|
||||||
var inputAction = document.getElementById('commform-action');
|
|
||||||
var img = document.getElementById(img_id);
|
|
||||||
|
|
||||||
if( formdiv == null || textarea == null ) {
|
|
||||||
alert("form null");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//form.action = "#" + img_id;
|
|
||||||
|
|
||||||
// set hidden values
|
|
||||||
inputX.value = dx;
|
|
||||||
inputY.value = dy;
|
|
||||||
inputImgId.value = img_id;
|
|
||||||
inputId.value = id;
|
|
||||||
inputAction.value = action;
|
|
||||||
textarea.value = text;
|
|
||||||
|
|
||||||
//textarea.value = "dxy:"+ dx + "x" + dy + "\n" + 'id:' + img_id;
|
|
||||||
|
|
||||||
// show form
|
|
||||||
formdiv.style.display = 'block';
|
|
||||||
formdiv.style.left = dx;
|
|
||||||
formdiv.style.top = dy;
|
|
||||||
|
|
||||||
img.parentNode.appendChild(formdiv);
|
|
||||||
|
|
||||||
textarea.focus();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
<div class='author'>{{k.autor}}</div>
|
<div class='author'>{{k.autor}}</div>
|
||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
<!-- Komentar !-->
|
<!-- Komentar !-->
|
||||||
<form action='' method='POST'>
|
<form action='' onsubmit='save_scroll(this)' method='POST'>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type='hidden' name='id' value='{{k.id}}'>
|
<input type='hidden' name='id' value='{{k.id}}'>
|
||||||
|
<input type='hidden' name='scroll'>
|
||||||
<button style="display: none" type='submit' name='action' value='del-comment' title='Smaž komentář'
|
<button style="display: none" type='submit' name='action' value='del-comment' title='Smaž komentář'
|
||||||
onclick='return confirm("Opravdu smazat komentář?")'>
|
onclick='return confirm("Opravdu smazat komentář?")'>
|
||||||
<img src="{% static "korektury/imgs/delete.png" %}"/>
|
<img src="{% static "korektury/imgs/delete.png" %}"/>
|
||||||
|
|
|
@ -2,17 +2,12 @@
|
||||||
|
|
||||||
<div onclick='img_click(this,event)'
|
<div onclick='img_click(this,event)'
|
||||||
id='op{{o.id}}-pointer'
|
id='op{{o.id}}-pointer'
|
||||||
class='pointer'
|
class='pointer {{o.status}}'>
|
||||||
data-opravastatus="{{o.status}}"
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
<div name='op{{o.id}}' id='op{{o.id}}'
|
<div name='op{{o.id}}' id='op{{o.id}}'
|
||||||
class='box'
|
class='box {{o.status}}'
|
||||||
data-opravastatus="{{o.status}}"
|
|
||||||
data-opravazobrazit="true"
|
|
||||||
onmouseover='box_onmouseover(this)'
|
onmouseover='box_onmouseover(this)'
|
||||||
onmouseout='box_onmouseout(this)'
|
onmouseout='box_onmouseout(this)'>
|
||||||
>
|
|
||||||
|
|
||||||
<div class='corr-body' id='op{{o.id}}-body'>
|
<div class='corr-body' id='op{{o.id}}-body'>
|
||||||
|
|
||||||
|
@ -23,38 +18,50 @@
|
||||||
</div>
|
</div>
|
||||||
<div class='corr-header'>
|
<div class='corr-header'>
|
||||||
<span class='float-right'>
|
<span class='float-right'>
|
||||||
<span id='op{{o.id}}-buttons' class='corr-buttons'>
|
<span id='op{{o.id}}-buttons'>
|
||||||
<form action='' method='POST'>
|
<form action='' onsubmit='save_scroll(this)' method='POST'>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type='hidden' name='id' value='{{o.id}}'>
|
<input type='hidden' name='id' value='{{o.id}}'>
|
||||||
|
<input type='hidden' name='scroll'>
|
||||||
|
|
||||||
<button style="display: none" type='submit' name='action' value='del' title='Smaž opravu'>
|
<button style="display: none" type='submit' name='action' value='del' title='Smaž opravu'>
|
||||||
<img src="{% static "korektury/imgs/delete.png"%}"/>
|
<img src="{% static "korektury/imgs/delete.png"%}"/>
|
||||||
</button>
|
</button>
|
||||||
|
{% if o.status != o.STATUS.K_OPRAVE %}
|
||||||
<button type='submit' name='action' value='{{ o.STATUS.K_OPRAVE }}' title='Označ jako neopravené'>
|
<button type='submit' name='action' value='{{ o.STATUS.K_OPRAVE }}' title='Označ jako neopravené'>
|
||||||
<img src="{% static "korektury/imgs/undo.png"%}"/>
|
<img src="{% static "korektury/imgs/undo.png"%}"/>
|
||||||
</button>
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
{% if o.status != o.STATUS.OPRAVENO %}
|
||||||
<button type='submit' name='action' value='{{ o.STATUS.OPRAVENO }}' title='Označ jako opravené'>
|
<button type='submit' name='action' value='{{ o.STATUS.OPRAVENO }}' title='Označ jako opravené'>
|
||||||
<img src="{% static "korektury/imgs/check.png"%}"/>
|
<img src="{% static "korektury/imgs/check.png"%}"/>
|
||||||
</button>
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
{% if o.status != o.STATUS.NENI_CHYBA %}
|
||||||
<button type='submit' name='action' value='{{ o.STATUS.NENI_CHYBA }}' title='Označ, že se nebude měnit'>
|
<button type='submit' name='action' value='{{ o.STATUS.NENI_CHYBA }}' title='Označ, že se nebude měnit'>
|
||||||
<img src="{% static "korektury/imgs/cross.png" %}"/>
|
<img src="{% static "korektury/imgs/cross.png" %}"/>
|
||||||
</button>
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
{% if o.status != o.STATUS.K_ZANESENI %}
|
||||||
<button type='submit' name='action' value='{{ o.STATUS.K_ZANESENI }}' title='Označ jako připraveno k zanesení'>
|
<button type='submit' name='action' value='{{ o.STATUS.K_ZANESENI }}' title='Označ jako připraveno k zanesení'>
|
||||||
<img src="{% static "korektury/imgs/tex.png" %}"/>
|
<img src="{% static "korektury/imgs/tex.png" %}"/>
|
||||||
</button>
|
</button>
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<button type='button' value="notcomment" title='Korekturu nelze komentovat, protože už je uzavřená'>
|
{% if o.status == 'opraveno' or o.status == 'neni_chyba' %}
|
||||||
|
<button type='button' title='Korekturu nelze komentovat, protože už je uzavřená'>
|
||||||
<img src="{% static "korektury/imgs/comment-gr.png" %}"/>
|
<img src="{% static "korektury/imgs/comment-gr.png" %}"/>
|
||||||
</button>
|
</button>
|
||||||
<button type='button' value="comment" onclick='box_edit("op{{o.id}}", "comment");' title='Komentovat'>
|
{% else %}
|
||||||
|
<button type='button' onclick='box_edit("op{{o.id}}", "comment");' title='Komentovat'>
|
||||||
<img src="{% static "korektury/imgs/comment.png" %}"/>
|
<img src="{% static "korektury/imgs/comment.png" %}"/>
|
||||||
</button>
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
<button type='button' onclick='toggle_visibility(this.parentElement.parentElement.parentElement);' title='Skrýt/Zobrazit'>
|
<button type='button' onclick='toggle_visibility("op{{o.id}}");' title='Skrýt/Zobrazit'>
|
||||||
<img id='op{{o.id}}-toggleimg' class='toggle-button' src="{% static "korektury/imgs/hide.png" %}"/>
|
<img id='op{{o.id}}-toggleimg' src="{% static "korektury/imgs/hide.png" %}"/>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -24,4 +24,7 @@
|
||||||
["img-{{s.strana}}", [{% for o in s.op_id %}["op{{o.id}}",{{o.x}},{{o.y}}],{% endfor %}[]]],
|
["img-{{s.strana}}", [{% for o in s.op_id %}["op{{o.id}}",{{o.x}},{{o.y}}],{% endfor %}[]]],
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
[]]
|
[]]
|
||||||
|
{% if scroll %}
|
||||||
|
window.scrollTo(0,{{scroll}});
|
||||||
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -21,31 +21,3 @@ Zobrazit:
|
||||||
<label for="k_zaneseni_checkbox">K zanesení ({{k_zaneseni_cnt}})</label>
|
<label for="k_zaneseni_checkbox">K zanesení ({{k_zaneseni_cnt}})</label>
|
||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
<script>
|
|
||||||
function toggle_corrections(aclass)
|
|
||||||
{
|
|
||||||
var stylesheets = document.styleSheets;
|
|
||||||
var ssheet = null;
|
|
||||||
for (var i=0;i<stylesheets.length; i++){
|
|
||||||
if (stylesheets[i].title === "opraf-css"){
|
|
||||||
ssheet = stylesheets[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (! ssheet){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (var i=0;i<ssheet.cssRules.length;i++){
|
|
||||||
var rule = ssheet.cssRules[i];
|
|
||||||
if (rule.selectorText === '[data-opravastatus="'+aclass+'"]'){
|
|
||||||
if (rule.style.display === ""){
|
|
||||||
rule.style.display = "none";
|
|
||||||
} else {
|
|
||||||
rule.style.display = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
place_comments();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const pdfstav_form = document.getElementById('PDFSTAV_FORM');
|
const pdfstav_form = document.getElementById('PDFSTAV_FORM');
|
||||||
|
const csrf_form = document.getElementById('CSRF_FORM');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -42,25 +42,3 @@
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function zmenStavKorektury(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
oprava = event.target.parentElement.parentElement.parentElement.parentElement;
|
|
||||||
|
|
||||||
const data = new FormData(event.target);
|
|
||||||
data.append("action", event.submitter.value);
|
|
||||||
|
|
||||||
fetch("{% url 'korektury_api_oprava_stav' %}", {method: "POST", body: data})
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {alert("Něco se nepovedlo:" + response.statusText);}
|
|
||||||
else response.json().then(data => {oprava.dataset.opravastatus = data["status"]; oprava.previousElementSibling.dataset.opravastatus = data["status"]});
|
|
||||||
})
|
|
||||||
.catch(error => {alert("Něco se nepovedlo:" + error);});
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const form of document.querySelectorAll("[action='']")) form.addEventListener('submit', async event => { zmenStavKorektury(event); });
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ class KorekturyView(generic.TemplateView):
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
q = request.POST
|
q = request.POST
|
||||||
|
scroll = q.get('scroll')
|
||||||
|
|
||||||
# prirazeni autora podle prihlaseni
|
# prirazeni autora podle prihlaseni
|
||||||
autor_user = request.user
|
autor_user = request.user
|
||||||
|
@ -69,6 +70,9 @@ class KorekturyView(generic.TemplateView):
|
||||||
if not autor:
|
if not autor:
|
||||||
return HttpResponseForbidden()
|
return HttpResponseForbidden()
|
||||||
|
|
||||||
|
if not scroll:
|
||||||
|
scroll = 0
|
||||||
|
|
||||||
action = q.get('action')
|
action = q.get('action')
|
||||||
if (action == ''): # Přidej
|
if (action == ''): # Přidej
|
||||||
x = int(q.get('x'))
|
x = int(q.get('x'))
|
||||||
|
@ -115,6 +119,7 @@ class KorekturyView(generic.TemplateView):
|
||||||
self.pdf.status = status
|
self.pdf.status = status
|
||||||
self.pdf.save()
|
self.pdf.save()
|
||||||
context = self.get_context_data()
|
context = self.get_context_data()
|
||||||
|
context['scroll'] = scroll
|
||||||
context['autor'] = autor
|
context['autor'] = autor
|
||||||
return render(request, 'korektury/korekturovatko/htmlstrana.html', context)
|
return render(request, 'korektury/korekturovatko/htmlstrana.html', context)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue