Lines 5-10
Link Here
|
5 |
<title>Koha › Tools › Notices[% IF ( add_form or copy_form ) %][% IF ( modify ) %] › Modify notice[% ELSE %] › Add notice[% END %][% END %][% IF ( add_validate or copy_validate) %] › Notice added[% END %][% IF ( delete_confirm ) %] › Confirm deletion[% END %]</title> |
5 |
<title>Koha › Tools › Notices[% IF ( add_form or copy_form ) %][% IF ( modify ) %] › Modify notice[% ELSE %] › Add notice[% END %][% END %][% IF ( add_validate or copy_validate) %] › Notice added[% END %][% IF ( delete_confirm ) %] › Confirm deletion[% END %]</title> |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
7 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" /> |
7 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" /> |
|
|
8 |
<style type="text/css">#preview_template .modal-dialog { width : 80%; } .spinner { display: none; } @media (max-width: 767px) { #preview_template { margin: 0; width : auto; } }</style> |
8 |
</head> |
9 |
</head> |
9 |
|
10 |
|
10 |
<body id="tools_letter" class="tools"> |
11 |
<body id="tools_letter" class="tools"> |
Lines 61-70
Link Here
|
61 |
</div> |
62 |
</div> |
62 |
</form> |
63 |
</form> |
63 |
|
64 |
|
64 |
[% IF ( search ) %] |
65 |
[% IF ( search ) %] |
65 |
<p>You searched for <b>[% searchfield | html %]</b></p> |
66 |
<p>You searched for <b>[% searchfield | html %]</b></p> |
66 |
[% END %] |
67 |
[% END %] |
67 |
[% IF ( letter && !independant_branch) %] |
68 |
[% IF ( letter && !independant_branch) %] |
68 |
[% select_for_copy = BLOCK %] |
69 |
[% select_for_copy = BLOCK %] |
69 |
<select name="branchcode"> |
70 |
<select name="branchcode"> |
70 |
[% FOREACH l IN Branches.all() %] |
71 |
[% FOREACH l IN Branches.all() %] |
Lines 132-138
Link Here
|
132 |
[% END %] |
133 |
[% END %] |
133 |
[% END %] |
134 |
[% END %] |
134 |
|
135 |
|
135 |
|
|
|
136 |
[% IF add_form or copy_form %] |
136 |
[% IF add_form or copy_form %] |
137 |
<h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1> |
137 |
<h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1> |
138 |
|
138 |
|
Lines 149-168
Link Here
|
149 |
<a class="btn btn-default btn-sm cancel" href="/cgi-bin/koha/tools/letter.pl"><i class="fa fa-remove"></i> Cancel</a> |
149 |
<a class="btn btn-default btn-sm cancel" href="/cgi-bin/koha/tools/letter.pl"><i class="fa fa-remove"></i> Cancel</a> |
150 |
</div> |
150 |
</div> |
151 |
|
151 |
|
152 |
<form id="add_notice" name="Aform" method="post" enctype="multipart/form-data" class="validate"> |
152 |
<form id="add_notice" name="Aform" method="post" enctype="multipart/form-data"> |
153 |
[% IF add_form %] |
153 |
[% IF add_form %] |
154 |
<input type="hidden" name="op" id="op" value="add_validate" /> |
154 |
<input type="hidden" name="op" id="op" value="add_validate" /> |
155 |
[% ELSE %] |
155 |
[% ELSE %] |
156 |
<input type="hidden" name="op" id="op" value="copy_validate" /> |
156 |
<input type="hidden" name="op" id="op" value="copy_validate" /> |
157 |
[% END %] |
157 |
[% END %] |
158 |
|
158 |
|
159 |
<input type="hidden" name="checked" value="0" /> |
159 |
<input type="hidden" name="checked" value="0" /> |
160 |
[% IF ( modify ) %] |
160 |
[% IF ( modify ) %] |
161 |
<input type="hidden" name="add" value="0" /> |
161 |
<input type="hidden" name="add" value="0" /> |
162 |
[% ELSE %] |
162 |
[% ELSE %] |
163 |
<input type="hidden" name="add" value="1" /> |
163 |
<input type="hidden" name="add" value="1" /> |
164 |
[% END %] |
164 |
[% END %] |
165 |
<fieldset class="rows"> |
165 |
<fieldset class="rows"> |
166 |
<input type="hidden" name="oldbranchcode" value="[% oldbranchcode %]" /> |
166 |
<input type="hidden" name="oldbranchcode" value="[% oldbranchcode %]" /> |
167 |
<ol> |
167 |
<ol> |
168 |
[% IF independant_branch %] |
168 |
[% IF independant_branch %] |
Lines 187-195
Link Here
|
187 |
[% END %] |
187 |
[% END %] |
188 |
</li> |
188 |
</li> |
189 |
[% END %] |
189 |
[% END %] |
190 |
<li> |
190 |
<li> |
191 |
<label for="module">Koha module:</label> |
191 |
<label for="module">Koha module:</label> |
192 |
<input type="hidden" name="oldmodule" value="[% module %]" /> |
192 |
<input type="hidden" name="oldmodule" value="[% module %]" /> |
193 |
[% IF adding %] |
193 |
[% IF adding %] |
194 |
<select name="module" id="newmodule"> |
194 |
<select name="module" id="newmodule"> |
195 |
[% ELSE %] |
195 |
[% ELSE %] |
Lines 385-394
Link Here
|
385 |
[% END %] |
385 |
[% END %] |
386 |
|
386 |
|
387 |
[% IF ( add_validate or copy_validate) %] |
387 |
[% IF ( add_validate or copy_validate) %] |
388 |
Data recorded |
388 |
Data recorded |
389 |
<form action="[% action %]" method="post"> |
389 |
<form action="[% action %]" method="post"> |
390 |
<input type="submit" value="OK" /> |
390 |
<input type="submit" value="OK" /> |
391 |
</form> |
391 |
</form> |
392 |
[% END %] |
392 |
[% END %] |
393 |
|
393 |
|
394 |
[% IF ( delete_confirm ) %] |
394 |
[% IF ( delete_confirm ) %] |
Lines 425-434
Link Here
|
425 |
[% END %] |
425 |
[% END %] |
426 |
|
426 |
|
427 |
[% IF ( delete_confirmed ) %] |
427 |
[% IF ( delete_confirmed ) %] |
428 |
Data deleted |
428 |
Data deleted |
429 |
<form action="[% action %]" method="post"> |
429 |
<form action="[% action %]" method="post"> |
430 |
<input type="submit" value="OK" /> |
430 |
<input type="submit" value="OK" /> |
431 |
</form> |
431 |
</form> |
432 |
[% END %] |
432 |
[% END %] |
433 |
|
433 |
|
434 |
</div> |
434 |
</div> |
Lines 446-656
Link Here
|
446 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat_[% KOHA_VERSION %].js"></script> |
446 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat_[% KOHA_VERSION %].js"></script> |
447 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.insertatcaret_[% KOHA_VERSION %].js"></script> |
447 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.insertatcaret_[% KOHA_VERSION %].js"></script> |
448 |
<script type="text/javascript"> |
448 |
<script type="text/javascript"> |
449 |
$(document).ready(function() { |
449 |
var no_op_set = '[% no_op_set %]'; |
450 |
[% IF add_form or copy_form %] |
450 |
var interface = '[% interface %]'; |
451 |
$('#toolbar').fixFloat(); |
451 |
var theme = '[% theme %]'; |
452 |
[% END %] |
452 |
var add_form = '[% add_form %]'; |
453 |
$("#lettert:has(tbody tr)").dataTable($.extend(true, {}, dataTablesDefaults, { |
453 |
var copy_form = '[% copy_form %]'; |
454 |
"sDom": 't', |
454 |
var code = '[% code %]'; |
455 |
"aoColumnDefs": [ |
455 |
var new_lettercode = '[% new_lettercode %]'; |
456 |
{ "bSortable": false, "bSearchable": false, 'aTargets': [ 'nosort' ] } |
456 |
var new_branchcode = '[% new_branchcode %]'; |
457 |
], |
457 |
var MSG_CODE_EXISTS = _("A default letter with the code '%s' already exists."); |
458 |
"bPaginate": false |
458 |
var MSG_CODE_EXISTS_FOR_LIBRARY = _("A letter with the code '%s' already exists for '%s'."); |
459 |
})); |
459 |
var MSG_EMPTY_TITLE_AND_CONTENT = _("Please specify title and content for %s"); |
460 |
[% IF no_op_set %] |
460 |
var MSG_EMPTY_TEMPLATES = _("Please fill at least one template."); |
461 |
$('#branch').change(function() { |
461 |
var MSG_LOADING = _("Loading"); |
462 |
$('#op').val(""); |
|
|
463 |
$('#selectlibrary').submit(); |
464 |
}); |
465 |
$('#newnotice').click(function() { |
466 |
$('#op').val("add_form"); |
467 |
return true; |
468 |
}); |
469 |
[% END %] |
470 |
|
471 |
$("#newmodule").on("change",function(){ |
472 |
if( $("#branch").val() == ""){ |
473 |
var branchcode = "*"; |
474 |
} else { |
475 |
var branchcode = $("#branch").val(); |
476 |
} |
477 |
window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode; |
478 |
}); |
479 |
|
480 |
$("#submit_form").click( function(event) { |
481 |
event.preventDefault(); |
482 |
var at_least_one_exists = 0; |
483 |
var are_valid = 1; |
484 |
$("fieldset.mtt").each( function(){ |
485 |
var title = $(this).find('input[name="title"]').val(); |
486 |
var content = $(this).find('textarea[name="content"]').val(); |
487 |
if ( |
488 |
( title.length == 0 && content.length > 0 ) |
489 |
|| ( title.length > 0 && content.length == 0 ) |
490 |
) { |
491 |
var mtt = $(this).find('input[name="message_transport_type"]').val(); |
492 |
var msg = _("Please specify title and content for %s"); |
493 |
msg = msg.replace( "%s", mtt ); |
494 |
at_least_one_exists = 1; |
495 |
alert(msg); |
496 |
return are_valid = false; |
497 |
} else if ( title.length > 0 && content.length > 0 ) { |
498 |
at_least_one_exists = 1; |
499 |
} |
500 |
} ); |
501 |
if ( ! at_least_one_exists ) { |
502 |
alert( _("Please fill at least one template.") ); |
503 |
return false; |
504 |
} |
505 |
if ( ! are_valid ) { |
506 |
return false; |
507 |
} |
508 |
|
509 |
// Test if code already exists in DB |
510 |
var new_lettercode = $("#code").val(); |
511 |
var new_branchcode = $("#branch").val(); |
512 |
[% IF ( add_form and code ) # IF edit %] |
513 |
if ( new_lettercode != '[% code %]' ) { |
514 |
[% END %] |
515 |
$.ajax({ |
516 |
data: { code: new_lettercode, branchcode: new_branchcode }, |
517 |
type: 'GET', |
518 |
url: '/cgi-bin/koha/svc/letters/get/', |
519 |
success: function (data) { |
520 |
if ( data.letters.length > 0 ) { |
521 |
if( new_branchcode == '' ) { |
522 |
alert( _("A default letter with the code '%s' already exists.").format(new_lettercode) ); |
523 |
} else { |
524 |
alert( _("A letter with the code '%s' already exists for '%s'.").format(new_lettercode, new_branchcode) ); |
525 |
} |
526 |
return false; |
527 |
} else { |
528 |
$("#add_notice").submit(); |
529 |
} |
530 |
}, |
531 |
}); |
532 |
[% IF ( add_form and code ) %] |
533 |
} else { |
534 |
$("#add_notice").submit(); |
535 |
} |
536 |
[% END %] |
537 |
}); |
538 |
|
539 |
var sms_limit = 160; |
540 |
$("#content_sms").on("keyup", function(){ |
541 |
var length = $(this).val().length; |
542 |
$("#sms_counter").html(length + "/" + sms_limit + _(" characters")); |
543 |
if ( length > sms_limit ) { |
544 |
$("#sms_counter").css("color", "red"); |
545 |
} else { |
546 |
$("#sms_counter").css("color", "black"); |
547 |
} |
548 |
}); |
549 |
$( ".transport-types" ).accordion({ collapsible: true, active:false, animate: 200 }); |
550 |
$(".insert").on("click",function(){ |
551 |
var containerid = $(this).data("containerid"); |
552 |
insertValueQuery( containerid ); |
553 |
}) |
554 |
|
555 |
$("#tabs").tabs(); |
556 |
|
557 |
$("#saveandcontinue").on("click",function(e){ |
558 |
e.preventDefault(); |
559 |
$("#redirect").val("just_save"); |
560 |
$("#submit_form").click(); |
561 |
}); |
562 |
|
563 |
$("body").on("click", ".preview_template", function(e){ |
564 |
e.preventDefault(); |
565 |
var mtt = $(this).data("mtt"); |
566 |
var lang = $(this).data("lang"); |
567 |
|
568 |
var code = $("#code").val(); |
569 |
var content = $("#content_"+mtt+"_"+lang).val(); |
570 |
var title = $("#title_"+mtt+"_"+lang).val(); |
571 |
|
572 |
var is_html = $("#is_html_"+mtt+"_"+lang).val(); |
573 |
var page = $(this).attr("href"); |
574 |
var data_preview = $("#data_preview").val(); |
575 |
page += '?code='+encodeURIComponent(code); |
576 |
page += '&title='+encodeURIComponent(title); |
577 |
page += '&content='+encodeURIComponent(content); |
578 |
page += '&data_preview='+encodeURIComponent(data_preview); |
579 |
page += '&is_html='+encodeURIComponent(is_html); |
580 |
$("#preview_template .modal-body").load(page); |
581 |
$('#preview_template').modal('show'); |
582 |
$("#preview_template_button").attr("href", "/cgi-bin/koha/svc/letters/convert?code="+code+"&mtt="+mtt+"&lang="+lang); |
583 |
}); |
584 |
$("#preview_template").on("hidden", function(){ |
585 |
$("#preview_template_label").html(""); |
586 |
$("#preview_template .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); |
587 |
}); |
588 |
$("body").on("click", "#convert_template", function(e){ |
589 |
e.preventDefault(); |
590 |
var mtt = $(this).data("mtt"); |
591 |
var lang = $(this).data("lang"); |
592 |
|
593 |
var code = $("#code").val(); |
594 |
var content = $("#content_"+mtt+"_"+lang).val(); |
595 |
var title = $("#title_"+mtt+"_"+lang).val(); |
596 |
|
597 |
var is_html = $("#is_html_"+mtt+"_"+lang).val(); |
598 |
var page = $(this).attr("href"); |
599 |
var data_preview = $("#data_preview").val(); |
600 |
page += '?code='+encodeURIComponent(code); |
601 |
page += '&title='+encodeURIComponent(title); |
602 |
page += '&content='+encodeURIComponent(content); |
603 |
page += '&data_preview='+encodeURIComponent(data_preview); |
604 |
page += '&is_html='+encodeURIComponent(is_html); |
605 |
$("#preview_template .modal-body").load(page + " div"); |
606 |
$('#preview_template').modal('show'); |
607 |
$("#preview_template_button").attr("href", "/cgi-bin/koha/svc/letters/convert?code="+code+"&branchcode="+branchcode+"&mtt="+mtt+"&lang="+lang); |
608 |
}); |
609 |
$("#convert_template").on("hidden", function(){ |
610 |
$("#convert_template_label").html(""); |
611 |
$("#convert_template .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); |
612 |
}); |
613 |
|
614 |
}); |
615 |
[% IF add_form or copy_form %] |
616 |
function cancel(f) { |
617 |
$('#op').val(""); |
618 |
f.method = "get"; |
619 |
f.submit(); |
620 |
} |
621 |
|
622 |
function isNotNull(f,noalert) { |
623 |
if (f.value.length ==0) { |
624 |
return false; |
625 |
} |
626 |
return true; |
627 |
} |
628 |
|
629 |
function isNum(v,maybenull) { |
630 |
var n = new Number(v.value); |
631 |
if (isNaN(n)) { |
632 |
return false; |
633 |
} |
634 |
if (maybenull==0 && v.value==''){ |
635 |
return false; |
636 |
} |
637 |
return true; |
638 |
} |
639 |
function insertValueQuery(containerid) { |
640 |
var fieldset = $("#" + containerid); |
641 |
var myQuery = $(fieldset).find('textarea[name="content"]'); |
642 |
var myListBox = $(fieldset).find('select[name="SQLfieldname"]'); |
643 |
|
644 |
if($(myListBox).find('option').length > 0) { |
645 |
$(myListBox).find('option').each( function (){ |
646 |
if ( $(this).attr('selected') && $(this).val().length > 0 ) { |
647 |
$(myQuery).insertAtCaret("<<" + $(this).val() + ">>"); |
648 |
} |
649 |
}); |
650 |
} |
651 |
} |
652 |
[% END %] |
653 |
</script> |
462 |
</script> |
|
|
463 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/letter.js"></script> |
654 |
[% END %] |
464 |
[% END %] |
655 |
|
465 |
|
656 |
[% INCLUDE 'intranet-bottom.inc' %] |
466 |
[% INCLUDE 'intranet-bottom.inc' %] |