3 [% INCLUDE 'doc-head-open.inc' %]
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' %]
6 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
7 [% 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.insertatcaret.js"></script>
10 <script type="text/javascript">
12 $(document).ready(function() {
13 [% IF add_form or copy_form %]
14 $('#toolbar').fixFloat();
16 $("#lettert:has(tbody tr)").dataTable($.extend(true, {}, dataTablesDefaults, {
19 { "bSortable": false, "bSearchable": false, 'aTargets': [ 'nosort' ] }
24 $('#branch').change(function() {
26 $('#selectlibrary').submit();
28 $('#newnotice').click(function() {
29 $('#op').val("add_form");
34 $("#newmodule").on("change",function(){
35 if( $("#branch").val() == ""){
38 var branchcode = $("#branch").val();
40 window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode;
43 $("#submit_form").click( function(event) {
44 event.preventDefault();
45 var at_least_one_exists = 0;
47 $("fieldset.mtt").each( function(){
48 var title = $(this).find('input[name="title"]').val();
49 var content = $(this).find('textarea[name="content"]').val();
51 ( title.length == 0 && content.length > 0 )
52 || ( title.length > 0 && content.length == 0 )
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;
59 return are_valid = false;
60 } else if ( title.length > 0 && content.length > 0 ) {
61 at_least_one_exists = 1;
64 if ( ! at_least_one_exists ) {
65 alert( _("Please fill at least one template.") );
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 %]' ) {
79 data: { code: new_lettercode, branchcode: new_branchcode },
81 url: '/cgi-bin/koha/svc/letters/',
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) );
87 alert( _("A letter with the code '%s' already exists for '%s'.").format(new_lettercode, new_branchcode) );
91 $("#add_notice").submit();
95 [% IF ( add_form and code ) %]
97 $("#add_notice").submit();
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");
109 $("#sms_counter").css("color", "black");
112 $( ".transport-types" ).accordion({ collapsible: true, active:false, animate: 200 });
113 $(".insert").on("click",function(){
114 var containerid = $(this).data("containerid");
115 insertValueQuery( containerid );
120 $("#saveandcontinue").on("click",function(e){
122 $("#redirect").val("just_save");
123 $("#submit_form").click();
127 [% IF add_form or copy_form %]
135 function isNotNull(f,noalert) {
136 if (f.value.length ==0) {
142 function isNum(v,maybenull) {
143 var n = new Number(v.value);
147 if (maybenull==0 && v.value=='') {
152 function insertValueQuery(containerid) {
153 var fieldset = $("#" + containerid);
154 var myQuery = $(fieldset).find('textarea[name="content"]');
155 var myListBox = $(fieldset).find('select[name="SQLfieldname"]');
157 if($(myListBox).find('option').length > 0) {
158 $(myListBox).find('option').each( function (){
159 if ( $(this).attr('selected') && $(this).val().length > 0 ) {
160 $(myQuery).insertAtCaret("<<" + $(this).val() + ">>");
169 <body id="tools_letter" class="tools">
170 [% INCLUDE 'header.inc' %]
171 [% INCLUDE 'letters-search.inc' %]
173 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF ( add_form or copy_form) %][% IF ( modify ) %]<a href="/cgi-bin/koha/tools/letter.pl">Notices & Slips</a> › Modify notice[% ELSE %] <a href="/cgi-bin/koha/tools/letter.pl">Notices & Slips</a> › Add notice[% END %][% ELSE %][% IF ( add_validate or copy_validate) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices & Slips</a> › Notice added[% ELSE %][% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices & Slips</a> › Confirm deletion[% ELSE %]Notices & Slips[% END %][% END %][% END %]</div>
175 [% IF add_form or copy_form %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
181 [% IF ( no_op_set ) %]
182 <h1>Notices and Slips</h1>
183 <form method="get" action="/cgi-bin/koha/tools/letter.pl" id="selectlibrary">
184 <input type="hidden" name="searchfield" value="[% searchfield %]" />
185 [% UNLESS independant_branch %]
188 <select name="branchcode" id="branch" style="width:20em;">
189 <option value="*">All libraries</option>
190 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
194 <div id="toolbar" class="btn-toolbar">
195 <button type="submit" class="btn btn-default btn-sm" id="newnotice"><i class="fa fa-plus"></i> New notice</button>
196 <input type="hidden" id="op" name="op" />
201 <p>You searched for <b>[% searchfield | html %]</b></p>
203 [% IF ( letter && !independant_branch) %]
204 [% select_for_copy = BLOCK %]
205 <select name="branchcode">
206 [% FOREACH l IN Branches.all() %]
207 <option value="[% l.branchcode %]">Copy to [% l.branchname %]</option>
220 <th class="nosort">Copy notice</th>
221 <th class="nosort">Actions</th>
225 [% FOREACH lette IN letter %]
226 [% can_edit = lette.branchcode || !independant_branch %]
228 <td>[% IF lette.branchname %][% lette.branchname %][% ELSE %](All libraries)[% END %]</td>
229 <td>[% lette.module %]</td>
230 <td>[% lette.code %]</td>
231 <td>[% lette.name %]</td>
233 [% IF !independant_branch || !lette.branchcode %]
234 <form method="post" action="/cgi-bin/koha/tools/letter.pl">
235 <input type="hidden" name="op" value="copy_form" />
236 <input type="hidden" name="oldbranchcode" value="[% lette.branchcode %]" />
237 <input type="hidden" name="module" value="[% lette.module %]" />
238 <input type="hidden" name="code" value="[% lette.code %]" />
239 [% IF independant_branch %]
240 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
242 [% select_for_copy %]
244 <button class="btn btn-default btn-xs"><i class="fa fa-clone"></i> Copy</button>
250 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=[% lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]"><i class="fa fa-pencil"></i> Edit</a>
252 [% IF !lette.protected && can_edit %]
253 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&branchcode=[%lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]"><i class="fa fa-trash"></i> Delete</a>
261 <div class="dialog message">
262 [% IF ( branchcode ) %]
263 <p>There are no notices for this library.</p>
265 <p>There are no notices.</p>
272 [% IF add_form or copy_form %]
273 <h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1>
275 <div id="toolbar" class="btn-toolbar">
276 <div class="btn-group">
277 <button class="btn btn-default btn-sm" id="submit_form"><i class="fa fa-save"></i> Save</button>
278 <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
279 <span class="caret"></span>
281 <ul class="dropdown-menu">
282 <li><a id="saveandcontinue" href="#">Save and continue editing</a></li>
285 <a class="btn btn-default btn-sm cancel" href="/cgi-bin/koha/tools/letter.pl"><i class="fa fa-remove"></i> Cancel</a>
288 <form id="add_notice" name="Aform" method="post" enctype="multipart/form-data" class="validate">
290 <input type="hidden" name="op" id="op" value="add_validate" />
292 <input type="hidden" name="op" id="op" value="copy_validate" />
295 <input type="hidden" name="checked" value="0" />
297 <input type="hidden" name="add" value="0" />
299 <input type="hidden" name="add" value="1" />
301 <fieldset class="rows">
302 <input type="hidden" name="oldbranchcode" value="[% oldbranchcode %]" />
304 [% IF independant_branch %]
305 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
310 <label for="branch">Library:</label>
311 <select name="branchcode" id="branch" style="width:20em;">
312 <option value="">All libraries</option>
313 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
316 <span class="label">Library:</span>
317 <input type="hidden" id="branch" name="branchcode" value="[% branchcode %]" />
318 [% IF ( branchcode ) %]
319 [% Branches.GetName( branchcode ) %]
327 <label for="module">Koha module:</label>
328 <input type="hidden" name="oldmodule" value="[% module %]" />
330 <select name="module" id="newmodule">
332 <select name="module" id="module">
334 [% IF ( module == "acquisition" ) %]
335 <option value="acquisition" selected="selected">Acquisition</option>
337 <option value="acquisition" >Acquisition</option>
339 [% IF ( module == "catalogue" ) %]
340 <option value="catalogue" selected="selected">Catalog</option>
342 <option value="catalogue" >Catalog</option>
344 [% IF ( module == "circulation" ) %]
345 <option value="circulation" selected="selected">Circulation</option>
347 <option value="circulation">Circulation</option>
349 [% IF ( module == "orderacquisition" ) %]
350 <option value="orderacquisition" selected="selected">Order acquisition</option>
352 <option value="orderacquisition">Order acquisition</option>
354 [% IF ( module == "claimacquisition" ) %]
355 <option value="claimacquisition" selected="selected">Claim acquisition</option>
357 <option value="claimacquisition">Claim acquisition</option>
359 [% IF ( module == "claimissues" ) %]
360 <option value="claimissues" selected="selected">Claim serial issue</option>
362 <option value="claimissues">Claim serial issue</option>
364 [% IF ( module == "reserves" ) %]
365 <option value="reserves" selected="selected">Holds</option>
367 <option value="reserves">Holds</option>
369 [% IF ( module == "members" ) %]
370 <option value="members" selected="selected">Members</option>
372 <option value="members">Members</option>
374 [% IF ( module == "serial" ) %]
375 <option value="serial" selected="selected">Serials (routing list)</option>
377 <option value="serial">Serials (routing list)</option>
379 [% IF ( module == "suggestions" ) %]
380 <option value="suggestions" selected="selected">Suggestions</option>
382 <option value="suggestions">Suggestions</option>
388 <label for="code" class="required">Code:</label>
389 <input type="text" id="code" name="code" size="20" maxlength="20" value="" required="required"/>
390 <span class="required">Required</span>
392 <span class="label">Code:</span>
393 <input type="hidden" id="code" name="code" value="[% code %]" />
398 <label for="name" class="required">Name:</label>
399 <input type="text" id="name" name="name" size="60" value="[% letter_name %]" required="required" />
400 <span class="required">Required</span>
404 [% IF Koha.Preference('TranslateNotices') %]
405 <div style="clear:both"></div>
408 <li><a href="#lang_default">Default</a></li>
409 [% FOR language IN languages %]
410 [% FOR sublanguage IN language.sublanguages_loop %]
411 [% IF language.plural %]
412 <li><a href="#lang_[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] [% sublanguage.region_description %] ([% sublanguage.rfc4646_subtag %])</a></li>
414 <li><a href="#lang_[% sublanguage.rfc4646_subtag %]">[% sublanguage.native_description %] ([% sublanguage.rfc4646_subtag %])</a></li>
421 [% FOREACH lang IN letters.keys %]
422 <div id="lang_[% lang %]">
423 <div class="transport-types" style="clear:both">
424 [% FOR mtt IN letters.$lang.templates.keys.sort %]
425 [% SET letter = letters.$lang.templates.$mtt %]
427 [% SWITCH letter.message_transport_type %]
439 [% letter.message_transport_type %]
442 [% IF letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %]
443 <fieldset class="rows mtt" id="[% letter.message_transport_type %]_[% lang %]" disabled="disabled">
444 <div class="dialog message">You should enable the SMSSendDriver preference to use the SMS templates.</div>
445 [% ELSIF letter.message_transport_type == "phone" and not Koha.Preference("TalkingTechItivaPhoneNotification") %]
446 <fieldset class="rows mtt" id="[% letter.message_transport_type %]_[% lang %]" disabled="disabled">
447 <div class="dialog message">You should enable the TalkingTechItivaPhoneNotification preference to use the phone templates.</div>
449 <fieldset class="rows mtt" id="[% letter.message_transport_type %]_[% lang %]">
453 <input type="hidden" name="message_transport_type" value="[% letter.message_transport_type %]" />
454 <input type="hidden" name="lang" value="[% lang %]" />
455 <label for="is_html_[% letter.message_transport_type %]">HTML message:</label>
456 [% IF letter.is_html %]
457 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" checked="checked" />
459 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" />
463 <label for="title_[% letter.message_transport_type %]">Message subject:</label><input type="text" id="title_[% letter.message_transport_type %]" name="title" size="60" value="[% letter.title %]" />
466 <label for="SQLfieldname_[% letter.message_transport_type %]">Message body:</label>
467 [% IF letter.message_transport_type == 'sms' %]
468 <span id="sms_counter">[% IF letter.content && letter.content.length > 0 %][% letter.content.length %][% ELSE %]0[% END %]/160 characters</span>
473 <select name="SQLfieldname" id="SQLfieldname_[% letter.message_transport_type %]" multiple="multiple" size="9">
474 [% FOREACH SQLfieldname IN SQLfieldnames %]
475 <option value="[% SQLfieldname.value %]">[% SQLfieldname.text %]</option>
480 <button type="button" data-containerid="[% letter.message_transport_type %]_[% lang %]" class="btn btn-default btn-sm insert">Insert <i class="fa fa-long-arrow-right"></i></button>
482 <td><textarea name="content" id="content_[% letter.message_transport_type %]" cols="80" rows="15">[% letter.content %]</textarea></td>
490 </div> <!-- / #transport-types -->
492 [% IF Koha.Preference('TranslateNotices') %]
496 [% IF code.search('DGST') %] <span class="overdue">Warning, this is a template for a Digest, as such, any references to branch data ( e.g. branches.branchname ) will refer to the borrower's home branch.</span> [% END %]
498 <input type="hidden" id="redirect" name="redirect" value="" />
499 <input type="hidden" name="searchfield" value="[% searchfield %]" />
503 [% IF ( add_validate or copy_validate) %]
505 <form action="[% action %]" method="post">
506 <input type="submit" value="OK" />
510 [% IF ( delete_confirm ) %]
511 <div class="dialog alert">
512 <h3>Delete notice?</h3>
523 <td>[% IF letter.branchcode %][% Branches.GetName( letter.branchcode ) %][% ELSE %](All libraries)[% END %]</td>
524 <td>[% letter.module %]</td>
525 <td>[% letter.code %]</td>
526 <td>[% letter.name %]</td>
529 <form action="[% action %]" method="post">
530 <input type="hidden" name="op" value="delete_confirmed">
531 <input type="hidden" name="branchcode" value="[% letter.branchcode %]" />
532 <input type="hidden" name="code" value="[% letter.code %]" />
533 <input type="hidden" name="module" value="[% letter.module %]" />
534 <button type="submit" class="approve"><i class="fa fa-check"></i> Yes, delete</button>
537 <form action="[% action %]" method="get">
538 <button type="submit" class="deny"><i class="fa fa-times"></i> No, do not delete</button>
543 [% IF ( delete_confirmed ) %]
545 <form action="[% action %]" method="post">
546 <input type="submit" value="OK" />
552 [% UNLESS add_form or copy_form %]
553 <div class="yui-b noprint">
554 [% INCLUDE 'tools-menu.inc' %]
558 [% INCLUDE 'intranet-bottom.inc' %]