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.insertatcaret.js"></script>
9 <script type="text/javascript">
11 $(document).ready(function() {
12 $("#lettert:has(tbody tr)").dataTable($.extend(true, {}, dataTablesDefaults, {
15 { "bSortable": false, "bSearchable": false, 'aTargets': [ 'nosort' ] }
20 $('#branch').change(function() {
22 $('#selectlibrary').submit();
24 $('#newnotice').click(function() {
25 $('#op').val("add_form");
30 $("#submit_form").click( function(event) {
31 event.preventDefault();
32 var at_least_one_exists = 0;
34 $("fieldset.mtt").each( function(){
35 var title = $(this).find('input[name="title"]').val();
36 var content = $(this).find('textarea[name="content"]').val();
38 ( title.length == 0 && content.length > 0 )
39 || ( title.length > 0 && content.length == 0 )
41 var mtt = $(this).find('input[name="message_transport_type"]').val();
42 var msg = _("Please specify title and content for %s");
43 msg = msg.replace( "%s", mtt );
44 at_least_one_exists = 1;
46 return are_valid = false;
47 } else if ( title.length > 0 && content.length > 0 ) {
48 at_least_one_exists = 1;
51 if ( ! at_least_one_exists ) {
52 alert( _("Please fill at least one template.") );
59 // Test if code already exists in DB
60 var new_lettercode = $("#code").val();
61 var new_branchcode = $("#branch").val();
62 [% IF ( add_form and code ) # IF edit %]
63 if ( new_lettercode != '[% code %]' ) {
66 data: { code: new_lettercode, branchcode: new_branchcode },
68 url: '/cgi-bin/koha/svc/letters/',
69 success: function (data) {
70 if ( data.letters.length > 0 ) {
71 if( new_branchcode == '' ) {
72 alert( _("A default letter with the code '%s' already exists.").format(new_lettercode) );
74 alert( _("A letter with the code '%s' already exists for '%s'.").format(new_lettercode, new_branchcode) );
78 $("#add_notice").submit();
82 [% IF ( add_form and code ) %]
84 $("#add_notice").submit();
90 $("#content_sms").on("keyup", function(){
91 var length = $(this).val().length;
92 $("#sms_counter").html(length + "/" + sms_limit + _(" characters"));
93 if ( length > sms_limit ) {
94 $("#sms_counter").css("color", "red");
96 $("#sms_counter").css("color", "black");
99 $( "#transport-types" ).accordion({ collapsible: true, active:false, animate: 200 });
101 [% IF add_form or copy_form %]
109 function isNotNull(f,noalert) {
110 if (f.value.length ==0) {
116 function isNum(v,maybenull) {
117 var n = new Number(v.value);
121 if (maybenull==0 && v.value=='') {
126 function insertValueQuery(mtt_id) {
127 var fieldset = $("#" + mtt_id);
128 var myQuery = $(fieldset).find('textarea[name="content"]');
129 var myListBox = $(fieldset).find('select[name="SQLfieldname"]');
131 if($(myListBox).find('option').length > 0) {
134 $(myListBox).find('option').each( function (){
135 if ( $(this).attr('selected') ) {
139 chaineAj += $(this).val();
142 $(myQuery).insertAtCaret("<<" + chaineAj + ">>");
149 <body id="tools_letter" class="tools">
150 [% INCLUDE 'header.inc' %]
151 [% INCLUDE 'letters-search.inc' %]
153 <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>
155 [% IF add_form or copy_form %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
161 [% IF ( no_op_set ) %]
162 <h1>Notices and Slips</h1>
163 <form method="get" action="/cgi-bin/koha/tools/letter.pl" id="selectlibrary">
164 <input type="hidden" name="searchfield" value="[% searchfield %]" />
165 [% UNLESS independant_branch %]
168 <select name="branchcode" id="branch" style="width:20em;">
169 <option value="*">All libraries</option>
170 [% FOREACH branchloo IN branchloop %]
171 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
176 <div id="toolbar" class="btn-toolbar">
177 <button type="submit" class="btn btn-small" id="newnotice"><i class="fa fa-plus"></i> New notice</button>
178 <input type="hidden" id="op" name="op" />
183 <p>You searched for <b>[% searchfield %]</b></p>
185 [% IF ( letter && !independant_branch) %]
186 [% select_for_copy = BLOCK %]
187 <select name="branchcode">
188 [% FOREACH branchloo IN branchloop %]
189 <option value="[% branchloo.value %]">Copy to [% branchloo.branchname %]</option>
202 <th class="nosort">Copy notice</th>
203 <th class="nosort">Actions</th>
207 [% FOREACH lette IN letter %]
208 [% can_edit = lette.branchcode || !independant_branch %]
210 <td>[% IF lette.branchname %][% lette.branchname %][% ELSE %](All libraries)[% END %]</td>
211 <td>[% lette.module %]</td>
212 <td>[% lette.code %]</td>
213 <td>[% lette.name %]</td>
215 [% IF !independant_branch || !lette.branchcode %]
216 <form method="post" action="/cgi-bin/koha/tools/letter.pl">
217 <input type="hidden" name="op" value="copy_form" />
218 <input type="hidden" name="oldbranchcode" value="[% lette.branchcode %]" />
219 <input type="hidden" name="module" value="[% lette.module %]" />
220 <input type="hidden" name="code" value="[% lette.code %]" />
221 [% IF independant_branch %]
222 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
224 [% select_for_copy %]
226 <button class="btn btn-mini"><i class="fa fa-clone"></i> Copy</button>
232 <a class="btn btn-mini" 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>
234 [% IF !lette.protected && can_edit %]
235 <a class="btn btn-mini" 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>
243 <div class="dialog message">
244 [% IF ( branchcode ) %]
245 <p>There are no notices for this library.</p>
247 <p>There are no notices.</p>
254 [% IF add_form or copy_form %]
255 <h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1>
256 <form id="add_notice" name="Aform" method="post" enctype="multipart/form-data" class="validate">
258 <input type="hidden" name="op" id="op" value="add_validate" />
260 <input type="hidden" name="op" id="op" value="copy_validate" />
263 <input type="hidden" name="checked" value="0" />
265 <input type="hidden" name="add" value="0" />
267 <input type="hidden" name="add" value="1" />
269 <fieldset class="rows">
270 <input type="hidden" name="oldbranchcode" value="[% oldbranchcode %]" />
272 [% IF independant_branch %]
273 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
277 <label for="branch">Library:</label>
279 <select name="branchcode" id="branch" style="width:20em;">
280 <option value="">All libraries</option>
281 [% FOREACH branchloo IN branchloop %]
282 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
286 <input type="hidden" id="branch" name="branchcode" value="[% branchcode %]" />
287 [% Branches.GetName( branchcode ) %]
292 <label for="module">Koha module:</label>
293 <input type="hidden" name="oldmodule" value="[% module %]" />
295 <select name="module" id="module" onchange="javascript:window.location.href = unescape(window.location.pathname)+'?op=add_form&module='+this.value+'&content='+window.document.forms['Aform'].elements['content'].value;">
297 <select name="module" id="module">
299 [% IF ( module == "acquisition" ) %]
300 <option value="acquisition" selected="selected">Acquisition</option>
302 <option value="acquisition" >Acquisition</option>
304 [% IF ( module == "catalogue" ) %]
305 <option value="catalogue" selected="selected">Catalog</option>
307 <option value="catalogue" >Catalog</option>
309 [% IF ( module == "circulation" ) %]
310 <option value="circulation" selected="selected">Circulation</option>
312 <option value="circulation">Circulation</option>
314 [% IF ( module == "claimacquisition" ) %]
315 <option value="claimacquisition" selected="selected">Claim acquisition</option>
317 <option value="claimacquisition">Claim acquisition</option>
319 [% IF ( module == "claimissues" ) %]
320 <option value="claimissues" selected="selected">Claim serial issue</option>
322 <option value="claimissues">Claim serial issue</option>
324 [% IF ( module == "reserves" ) %]
325 <option value="reserves" selected="selected">Holds</option>
327 <option value="reserves">Holds</option>
329 [% IF ( module == "members" ) %]
330 <option value="members" selected="selected">Members</option>
332 <option value="members">Members</option>
334 [% IF ( module == "serial" ) %]
335 <option value="serial" selected="selected">Serials (routing list)</option>
337 <option value="serial">Serials (routing list)</option>
339 [% IF ( module == "suggestions" ) %]
340 <option value="suggestions" selected="selected">Suggestions</option>
342 <option value="suggestions">Suggestions</option>
348 <label for="code" class="required">Code:</label>
349 <input type="text" id="code" name="code" size="20" maxlength="20" value="" required="required"/>
350 <span class="required">Required</span>
352 <label for="code">Code:</label>
353 <input type="hidden" id="code" name="code" size="20" maxlength="20" value="[% code %]" required="required"/>
358 <label for="name" class="required">Name:</label>
359 <input type="text" id="name" name="name" size="60" value="[% letter_name %]" required="required" />
360 <span class="required">Required</span>
364 <div id="transport-types" style="clear:both">
365 [% FOREACH letter IN letters %]
367 [% SWITCH letter.message_transport_type %]
379 [% letter.message_transport_type %]
382 [% IF letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %]
383 <fieldset class="rows mtt" id="[% letter.message_transport_type %]" disabled="disabled">
384 <div class="dialog message">You should enable the SMSSendDriver preference to use the SMS templates.</div>
385 [% ELSIF letter.message_transport_type == "phone" and not Koha.Preference("TalkingTechItivaPhoneNotification") %]
386 <fieldset class="rows mtt" id="[% letter.message_transport_type %]" disabled="disabled">
387 <div class="dialog message">You should enable the TalkingTechItivaPhoneNotification preference to use the phone templates.</div>
389 <fieldset class="rows mtt" id="[% letter.message_transport_type %]">
393 <input type="hidden" name="message_transport_type" value="[% letter.message_transport_type %]" />
394 <label for="is_html_[% letter.message_transport_type %]">HTML message:</label>
395 [% IF letter.is_html %]
396 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" checked="checked" />
398 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" />
402 <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 %]" />
405 <label for="SQLfieldname_[% letter.message_transport_type %]">Message body:</label>
406 [% IF letter.message_transport_type == 'sms' %]
407 <span id="sms_counter">[% IF letter.content && letter.content.length > 0 %][% letter.content.length %][% ELSE %]0[% END %]/160 characters</span>
412 <select name="SQLfieldname" id="SQLfieldname_[% letter.message_transport_type %]" multiple="multiple" size="9">
413 [% FOREACH SQLfieldname IN SQLfieldnames %]
414 <option value="[% SQLfieldname.value %]">[% SQLfieldname.text %]</option>
418 <td><input type="button" name="insert" value=">>" onclick="insertValueQuery('[% letter.message_transport_type %]')" title="Insert" /></td>
419 <td><textarea name="content" id="content_[% letter.message_transport_type %]" cols="80" rows="15">[% letter.content %]</textarea></td>
426 </div> <!-- / #transport-types -->
428 [% 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 %]
429 <fieldset class="action"><input type="submit" id="submit_form" value="Submit" class="button" /> <a class="cancel" href="/cgi-bin/koha/tools/letter.pl">Cancel</a></fieldset>
430 <input type="hidden" name="searchfield" value="[% searchfield %]" />
434 [% IF ( add_validate or copy_validate) %]
436 <form action="[% action %]" method="post">
437 <input type="submit" value="OK" />
441 [% IF ( delete_confirm ) %]
442 <div class="dialog alert">
443 <h3>Delete notice?</h3>
454 <td>[% IF letter.branchcode %][% Branches.GetName( letter.branchcode ) %][% ELSE %](All libraries)[% END %]</td>
455 <td>[% letter.module %]</td>
456 <td>[% letter.code %]</td>
457 <td>[% letter.name %]</td>
460 <form action="[% action %]" method="post">
461 <input type="hidden" name="op" value="delete_confirmed">
462 <input type="hidden" name="branchcode" value="[% letter.branchcode %]" />
463 <input type="hidden" name="code" value="[% letter.code %]" />
464 <input type="hidden" name="module" value="[% letter.module %]" />
465 <button type="submit" class="approve"><i class="fa fa-check"></i> Yes, delete</button>
468 <form action="[% action %]" method="get">
469 <button type="submit" class="deny"><i class="fa fa-times"></i> No, do not delete</button>
474 [% IF ( delete_confirmed ) %]
476 <form action="[% action %]" method="post">
477 <input type="submit" value="OK" />
483 [% UNLESS add_form or copy_form %]
484 <div class="yui-b noprint">
485 [% INCLUDE 'tools-menu.inc' %]
489 [% INCLUDE 'intranet-bottom.inc' %]