Lines 4-221
Link Here
|
4 |
<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> |
4 |
<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 |
[% INCLUDE 'doc-head-close.inc' %] |
5 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
6 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
|
|
7 |
<style type="text/css">#preview_template .modal-dialog { width : 80%; } .spinner { display: none; } @media (max-width: 767px) { #preview_template { margin: 0; width : auto; } }</style> |
7 |
[% INCLUDE 'datatables.inc' %] |
8 |
[% INCLUDE 'datatables.inc' %] |
8 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script> |
9 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script> |
9 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.insertatcaret.js"></script> |
10 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.insertatcaret.js"></script> |
10 |
<script type="text/javascript"> |
11 |
<script type="text/javascript"> |
11 |
//<![CDATA[ |
12 |
var no_op_set = '[% no_op_set %]'; |
12 |
$(document).ready(function() { |
13 |
var interface = '[% interface %]'; |
13 |
[% IF add_form or copy_form %] |
14 |
var theme = '[% theme %]'; |
14 |
$('#toolbar').fixFloat(); |
15 |
var add_form = '[% add_form %]'; |
15 |
[% END %] |
16 |
var copy_form = '[% copy_form %]'; |
16 |
$("#lettert:has(tbody tr)").dataTable($.extend(true, {}, dataTablesDefaults, { |
17 |
var code = '[% code %]'; |
17 |
"sDom": 't', |
18 |
var new_lettercode = '[% new_lettercode %]'; |
18 |
"aoColumnDefs": [ |
19 |
var new_branchcode = '[% new_branchcode %]'; |
19 |
{ "bSortable": false, "bSearchable": false, 'aTargets': [ 'nosort' ] } |
20 |
var MSG_CODE_EXISTS = _("A default letter with the code '%s' already exists."); |
20 |
], |
21 |
var MSG_CODE_EXISTS_FOR_LIBRARY = _("A letter with the code '%s' already exists for '%s'."); |
21 |
"bPaginate": false |
22 |
var MSG_EMPTY_TITLE_AND_CONTENT = _("Please specify title and content for %s"); |
22 |
})); |
23 |
var MSG_EMPTY_TEMPLATES = _("Please fill at least one template."); |
23 |
[% IF no_op_set %] |
24 |
var MSG_LOADING = _("Loading"); |
24 |
$('#branch').change(function() { |
25 |
</script> |
25 |
$('#op').val(""); |
26 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/letter.js"></script> |
26 |
$('#selectlibrary').submit(); |
|
|
27 |
}); |
28 |
$('#newnotice').click(function() { |
29 |
$('#op').val("add_form"); |
30 |
return true; |
31 |
}); |
32 |
[% END %] |
33 |
|
34 |
$("#newmodule").on("change",function(){ |
35 |
if( $("#branch").val() == ""){ |
36 |
var branchcode = "*"; |
37 |
} else { |
38 |
var branchcode = $("#branch").val(); |
39 |
} |
40 |
window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode; |
41 |
}); |
42 |
|
43 |
$("#submit_form").click( function(event) { |
44 |
event.preventDefault(); |
45 |
var at_least_one_exists = 0; |
46 |
var are_valid = 1; |
47 |
$("fieldset.mtt").each( function(){ |
48 |
var title = $(this).find('input[name="title"]').val(); |
49 |
var content = $(this).find('textarea[name="content"]').val(); |
50 |
if ( |
51 |
( title.length == 0 && content.length > 0 ) |
52 |
|| ( title.length > 0 && content.length == 0 ) |
53 |
) { |
54 |
var mtt = $(this).find('input[name="message_transport_type"]').val(); |
55 |
var msg = _("Please specify title and content for %s"); |
56 |
msg = msg.replace( "%s", mtt ); |
57 |
at_least_one_exists = 1; |
58 |
alert(msg); |
59 |
return are_valid = false; |
60 |
} else if ( title.length > 0 && content.length > 0 ) { |
61 |
at_least_one_exists = 1; |
62 |
} |
63 |
} ); |
64 |
if ( ! at_least_one_exists ) { |
65 |
alert( _("Please fill at least one template.") ); |
66 |
return false; |
67 |
} |
68 |
if ( ! are_valid ) { |
69 |
return false; |
70 |
} |
71 |
|
72 |
// Test if code already exists in DB |
73 |
var new_lettercode = $("#code").val(); |
74 |
var new_branchcode = $("#branch").val(); |
75 |
[% IF ( add_form and code ) # IF edit %] |
76 |
if ( new_lettercode != '[% code %]' ) { |
77 |
[% END %] |
78 |
$.ajax({ |
79 |
data: { code: new_lettercode, branchcode: new_branchcode }, |
80 |
type: 'GET', |
81 |
url: '/cgi-bin/koha/svc/letters/get/', |
82 |
success: function (data) { |
83 |
if ( data.letters.length > 0 ) { |
84 |
if( new_branchcode == '' ) { |
85 |
alert( _("A default letter with the code '%s' already exists.").format(new_lettercode) ); |
86 |
} else { |
87 |
alert( _("A letter with the code '%s' already exists for '%s'.").format(new_lettercode, new_branchcode) ); |
88 |
} |
89 |
return false; |
90 |
} else { |
91 |
$("#add_notice").submit(); |
92 |
} |
93 |
}, |
94 |
}); |
95 |
[% IF ( add_form and code ) %] |
96 |
} else { |
97 |
$("#add_notice").submit(); |
98 |
} |
99 |
[% END %] |
100 |
}); |
101 |
|
102 |
var sms_limit = 160; |
103 |
$("#content_sms").on("keyup", function(){ |
104 |
var length = $(this).val().length; |
105 |
$("#sms_counter").html(length + "/" + sms_limit + _(" characters")); |
106 |
if ( length > sms_limit ) { |
107 |
$("#sms_counter").css("color", "red"); |
108 |
} else { |
109 |
$("#sms_counter").css("color", "black"); |
110 |
} |
111 |
}); |
112 |
$( ".transport-types" ).accordion({ collapsible: true, active:false, animate: 200 }); |
113 |
$(".insert").on("click",function(){ |
114 |
var containerid = $(this).data("containerid"); |
115 |
insertValueQuery( containerid ); |
116 |
}) |
117 |
|
118 |
$("#tabs").tabs(); |
119 |
|
120 |
$("#saveandcontinue").on("click",function(e){ |
121 |
e.preventDefault(); |
122 |
$("#redirect").val("just_save"); |
123 |
$("#submit_form").click(); |
124 |
}); |
125 |
|
126 |
$("body").on("click", ".preview_template", function(e){ |
127 |
e.preventDefault(); |
128 |
var mtt = $(this).data("mtt"); |
129 |
var lang = $(this).data("lang"); |
130 |
|
131 |
var code = $("#code").val(); |
132 |
var content = $("#content_"+mtt+"_"+lang).val(); |
133 |
var title = $("#title_"+mtt+"_"+lang).val(); |
134 |
|
135 |
var is_html = $("#is_html_"+mtt+"_"+lang).val(); |
136 |
var page = $(this).attr("href"); |
137 |
var data_preview = $("#data_preview").val(); |
138 |
page += '?code='+encodeURIComponent(code); |
139 |
page += '&title='+encodeURIComponent(title); |
140 |
page += '&content='+encodeURIComponent(content); |
141 |
page += '&data_preview='+encodeURIComponent(data_preview); |
142 |
page += '&is_html='+encodeURIComponent(is_html); |
143 |
$("#preview_template .modal-body").load(page); |
144 |
$('#preview_template').modal('show'); |
145 |
$("#preview_template_button").attr("href", "/cgi-bin/koha/svc/letters/convert?code="+code+"&mtt="+mtt+"&lang="+lang); |
146 |
}); |
147 |
$("#preview_template").on("hidden", function(){ |
148 |
$("#preview_template_label").html(""); |
149 |
$("#preview_template .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); |
150 |
}); |
151 |
$("body").on("click", "#convert_template", function(e){ |
152 |
e.preventDefault(); |
153 |
var mtt = $(this).data("mtt"); |
154 |
var lang = $(this).data("lang"); |
155 |
|
156 |
var code = $("#code").val(); |
157 |
var content = $("#content_"+mtt+"_"+lang).val(); |
158 |
var title = $("#title_"+mtt+"_"+lang).val(); |
159 |
|
160 |
var is_html = $("#is_html_"+mtt+"_"+lang).val(); |
161 |
var page = $(this).attr("href"); |
162 |
var data_preview = $("#data_preview").val(); |
163 |
page += '?code='+encodeURIComponent(code); |
164 |
page += '&title='+encodeURIComponent(title); |
165 |
page += '&content='+encodeURIComponent(content); |
166 |
page += '&data_preview='+encodeURIComponent(data_preview); |
167 |
page += '&is_html='+encodeURIComponent(is_html); |
168 |
$("#preview_template .modal-body").load(page + " div"); |
169 |
$('#preview_template').modal('show'); |
170 |
$("#preview_template_button").attr("href", "/cgi-bin/koha/svc/letters/convert?code="+code+"&branchcode="+branchcode+"&mtt="+mtt+"&lang="+lang); |
171 |
}); |
172 |
$("#convert_template").on("hidden", function(){ |
173 |
$("#convert_template_label").html(""); |
174 |
$("#convert_template .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); |
175 |
}); |
176 |
|
177 |
}); |
178 |
[% IF add_form or copy_form %] |
179 |
|
180 |
function cancel(f) { |
181 |
$('#op').val(""); |
182 |
f.method = "get"; |
183 |
f.submit(); |
184 |
} |
185 |
|
186 |
function isNotNull(f,noalert) { |
187 |
if (f.value.length ==0) { |
188 |
return false; |
189 |
} |
190 |
return true; |
191 |
} |
192 |
|
193 |
function isNum(v,maybenull) { |
194 |
var n = new Number(v.value); |
195 |
if (isNaN(n)) { |
196 |
return false; |
197 |
} |
198 |
if (maybenull==0 && v.value=='') { |
199 |
return false; |
200 |
} |
201 |
return true; |
202 |
} |
203 |
function insertValueQuery(containerid) { |
204 |
var fieldset = $("#" + containerid); |
205 |
var myQuery = $(fieldset).find('textarea[name="content"]'); |
206 |
var myListBox = $(fieldset).find('select[name="SQLfieldname"]'); |
207 |
|
208 |
if($(myListBox).find('option').length > 0) { |
209 |
$(myListBox).find('option').each( function (){ |
210 |
if ( $(this).attr('selected') && $(this).val().length > 0 ) { |
211 |
$(myQuery).insertAtCaret("<<" + $(this).val() + ">>"); |
212 |
} |
213 |
}); |
214 |
} |
215 |
} |
216 |
[% END %] |
217 |
//]]> |
218 |
</script> |
219 |
</head> |
27 |
</head> |
220 |
<body id="tools_letter" class="tools"> |
28 |
<body id="tools_letter" class="tools"> |
221 |
[% INCLUDE 'header.inc' %] |
29 |
[% INCLUDE 'header.inc' %] |
Lines 244-251
$(document).ready(function() {
Link Here
|
244 |
[% IF add_form or copy_form %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %] |
52 |
[% IF add_form or copy_form %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %] |
245 |
|
53 |
|
246 |
<div id="bd"> |
54 |
<div id="bd"> |
247 |
<div id="yui-main"> |
55 |
<div id="yui-main"> |
248 |
<div class="yui-b"> |
56 |
<div class="yui-b"> |
249 |
|
57 |
|
250 |
[% IF ( no_op_set ) %] |
58 |
[% IF ( no_op_set ) %] |
251 |
<h1>Notices and Slips</h1> |
59 |
<h1>Notices and Slips</h1> |
Lines 266-275
$(document).ready(function() {
Link Here
|
266 |
</div> |
74 |
</div> |
267 |
</form> |
75 |
</form> |
268 |
|
76 |
|
269 |
[% IF ( search ) %] |
77 |
[% IF ( search ) %] |
270 |
<p>You searched for <b>[% searchfield | html %]</b></p> |
78 |
<p>You searched for <b>[% searchfield | html %]</b></p> |
271 |
[% END %] |
79 |
[% END %] |
272 |
[% IF ( letter && !independant_branch) %] |
80 |
[% IF ( letter && !independant_branch) %] |
273 |
[% select_for_copy = BLOCK %] |
81 |
[% select_for_copy = BLOCK %] |
274 |
<select name="branchcode"> |
82 |
<select name="branchcode"> |
275 |
[% FOREACH l IN Branches.all() %] |
83 |
[% FOREACH l IN Branches.all() %] |
Lines 337-343
$(document).ready(function() {
Link Here
|
337 |
[% END %] |
145 |
[% END %] |
338 |
[% END %] |
146 |
[% END %] |
339 |
|
147 |
|
340 |
|
|
|
341 |
[% IF add_form or copy_form %] |
148 |
[% IF add_form or copy_form %] |
342 |
<h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1> |
149 |
<h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1> |
343 |
|
150 |
|
Lines 354-373
$(document).ready(function() {
Link Here
|
354 |
<a class="btn btn-default btn-sm cancel" href="/cgi-bin/koha/tools/letter.pl"><i class="fa fa-remove"></i> Cancel</a> |
161 |
<a class="btn btn-default btn-sm cancel" href="/cgi-bin/koha/tools/letter.pl"><i class="fa fa-remove"></i> Cancel</a> |
355 |
</div> |
162 |
</div> |
356 |
|
163 |
|
357 |
<form id="add_notice" name="Aform" method="post" enctype="multipart/form-data" class="validate"> |
164 |
<form id="add_notice" name="Aform" method="post" enctype="multipart/form-data"> |
358 |
[% IF add_form %] |
165 |
[% IF add_form %] |
359 |
<input type="hidden" name="op" id="op" value="add_validate" /> |
166 |
<input type="hidden" name="op" id="op" value="add_validate" /> |
360 |
[% ELSE %] |
167 |
[% ELSE %] |
361 |
<input type="hidden" name="op" id="op" value="copy_validate" /> |
168 |
<input type="hidden" name="op" id="op" value="copy_validate" /> |
362 |
[% END %] |
169 |
[% END %] |
363 |
|
170 |
|
364 |
<input type="hidden" name="checked" value="0" /> |
171 |
<input type="hidden" name="checked" value="0" /> |
365 |
[% IF ( modify ) %] |
172 |
[% IF ( modify ) %] |
366 |
<input type="hidden" name="add" value="0" /> |
173 |
<input type="hidden" name="add" value="0" /> |
367 |
[% ELSE %] |
174 |
[% ELSE %] |
368 |
<input type="hidden" name="add" value="1" /> |
175 |
<input type="hidden" name="add" value="1" /> |
369 |
[% END %] |
176 |
[% END %] |
370 |
<fieldset class="rows"> |
177 |
<fieldset class="rows"> |
371 |
<input type="hidden" name="oldbranchcode" value="[% oldbranchcode %]" /> |
178 |
<input type="hidden" name="oldbranchcode" value="[% oldbranchcode %]" /> |
372 |
<ol> |
179 |
<ol> |
373 |
[% IF independant_branch %] |
180 |
[% IF independant_branch %] |
Lines 392-400
$(document).ready(function() {
Link Here
|
392 |
[% END %] |
199 |
[% END %] |
393 |
</li> |
200 |
</li> |
394 |
[% END %] |
201 |
[% END %] |
395 |
<li> |
202 |
<li> |
396 |
<label for="module">Koha module:</label> |
203 |
<label for="module">Koha module:</label> |
397 |
<input type="hidden" name="oldmodule" value="[% module %]" /> |
204 |
<input type="hidden" name="oldmodule" value="[% module %]" /> |
398 |
[% IF adding %] |
205 |
[% IF adding %] |
399 |
<select name="module" id="newmodule"> |
206 |
<select name="module" id="newmodule"> |
400 |
[% ELSE %] |
207 |
[% ELSE %] |
Lines 590-599
$(document).ready(function() {
Link Here
|
590 |
[% END %] |
397 |
[% END %] |
591 |
|
398 |
|
592 |
[% IF ( add_validate or copy_validate) %] |
399 |
[% IF ( add_validate or copy_validate) %] |
593 |
Data recorded |
400 |
Data recorded |
594 |
<form action="[% action %]" method="post"> |
401 |
<form action="[% action %]" method="post"> |
595 |
<input type="submit" value="OK" /> |
402 |
<input type="submit" value="OK" /> |
596 |
</form> |
403 |
</form> |
597 |
[% END %] |
404 |
[% END %] |
598 |
|
405 |
|
599 |
[% IF ( delete_confirm ) %] |
406 |
[% IF ( delete_confirm ) %] |
Lines 630-639
$(document).ready(function() {
Link Here
|
630 |
[% END %] |
437 |
[% END %] |
631 |
|
438 |
|
632 |
[% IF ( delete_confirmed ) %] |
439 |
[% IF ( delete_confirmed ) %] |
633 |
Data deleted |
440 |
Data deleted |
634 |
<form action="[% action %]" method="post"> |
441 |
<form action="[% action %]" method="post"> |
635 |
<input type="submit" value="OK" /> |
442 |
<input type="submit" value="OK" /> |
636 |
</form> |
443 |
</form> |
637 |
[% END %] |
444 |
[% END %] |
638 |
|
445 |
|
639 |
</div> |
446 |
</div> |