2 [% INCLUDE 'doc-head-open.inc' %]
3 <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 [% INCLUDE 'doc-head-close.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.insertatcaret.js"></script>
8 <script type="text/javascript">
10 $(document).ready(function() {
11 $("#lettert:has(tbody tr)").dataTable($.extend(true, {}, dataTablesDefaults, {
14 { "aTargets": [ -1,-2, -3 ], "bSortable": false, "bSearchable": false }
19 $('#branch').change(function() {
21 $('#selectlibrary').submit();
23 $('#newnotice').click(function() {
24 $('#op').val("add_form");
29 $("#submit_form").click( function(event) {
30 event.preventDefault();
31 var at_least_one_exists = 0;
32 $("fieldset.mtt").each( function(){
33 var title = $(this).find('input[name="title"]').val();
34 var content = $(this).find('textarea[name="content"]').val();
36 ( title.length == 0 && content.length > 0 )
37 || ( title.length > 0 && content.length == 0 )
39 var mtt = $(this).find('input[name="message_transport_type"]').val();
40 var msg = _("Please specify title and content for %s");
41 msg = msg.replace( "%s", mtt );
42 at_least_one_exists = 1;
45 } else if ( title.length > 0 && content.length > 0 ) {
46 at_least_one_exists = 1;
49 if ( ! at_least_one_exists ) {
50 alert( _("Please fill at least one template.") );
54 // Test if code already exists in DB
55 var new_lettercode = $("#code").val();
56 var new_branchcode = $("#branch").val();
57 [% IF ( add_form and code ) # IF edit %]
58 if ( new_lettercode != '[% code %]' ) {
61 data: { code: new_lettercode, branchcode: new_branchcode },
63 url: '/cgi-bin/koha/svc/letters/',
64 success: function (data) {
65 if ( data.letters.length > 0 ) {
66 if( new_branchcode == '' ) {
67 alert( _("A default letter with the code '%s' already exists.").format(new_lettercode) );
69 alert( _("A letter with the code '%s' already exists for '%s'.").format(new_lettercode, new_branchcode) );
73 $("#add_notice").submit();
77 [% IF ( add_form and code ) %]
79 $("#add_notice").submit();
85 $("#content_sms").on("keyup", function(){
86 var length = $(this).val().length;
87 $("#sms_counter").html(length + "/" + sms_limit + _(" characters"));
88 if ( length > sms_limit ) {
89 $("#sms_counter").css("color", "red");
91 $("#sms_counter").css("color", "black");
94 $( "#transport-types" ).accordion({ collapsible: true, active:false, animate: 200 });
96 [% IF add_form or copy_form %]
104 function isNotNull(f,noalert) {
105 if (f.value.length ==0) {
111 function isNum(v,maybenull) {
112 var n = new Number(v.value);
116 if (maybenull==0 && v.value=='') {
121 function insertValueQuery(mtt_id) {
122 var fieldset = $("#" + mtt_id);
123 var myQuery = $(fieldset).find('textarea[name="content"]');
124 var myListBox = $(fieldset).find('select[name="SQLfieldname"]');
126 if($(myListBox).find('option').length > 0) {
129 $(myListBox).find('option').each( function (){
130 if ( $(this).attr('selected') ) {
134 chaineAj += $(this).val();
137 $(myQuery).insertAtCaret("<<" + chaineAj + ">>");
144 <body id="tools_letter" class="tools">
145 [% INCLUDE 'header.inc' %]
146 [% INCLUDE 'letters-search.inc' %]
148 <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>
150 [% IF add_form or copy_form %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
156 [% IF ( no_op_set ) %]
157 <h1>Notices and Slips</h1>
158 <form method="get" action="/cgi-bin/koha/tools/letter.pl" id="selectlibrary">
159 <input type="hidden" name="searchfield" value="[% searchfield %]" />
160 [% UNLESS independant_branch %]
163 <select name="branchcode" id="branch" style="width:20em;">
164 <option value="">All libraries</option>
165 [% FOREACH branchloo IN branchloop %]
166 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
171 <div id="toolbar" class="btn-toolbar">
172 <button type="submit" class="btn btn-small" id="newnotice"><i class="icon-plus"></i> New notice</button>
173 <input type="hidden" id="op" name="op" />
178 <p>You searched for <b>[% searchfield %]</b></p>
180 [% IF ( letter && !independant_branch) %]
181 [% select_for_copy = BLOCK %]
182 <select name="branchcode">
183 [% FOREACH branchloo IN branchloop %]
184 <option value="[% branchloo.value %]">Copy to [% branchloo.branchname %]</option>
203 [% FOREACH lette IN letter %]
204 [% can_edit = lette.branchcode || !independant_branch %]
206 <td>[% IF lette.branchname %][% lette.branchname %][% ELSE %](All libraries)[% END %]</td>
207 <td>[% lette.module %]</td>
208 <td>[% lette.code %]</td>
209 <td>[% lette.name %]</td>
210 <td style="white-space: nowrap">
211 [% IF !independant_branch || !lette.branchcode %]
212 <form method="post" action="/cgi-bin/koha/tools/letter.pl">
213 <input type="hidden" name="op" value="copy_form" />
214 <input type="hidden" name="oldbranchcode" value="[% lette.branchcode %]" />
215 <input type="hidden" name="module" value="[% lette.module %]" />
216 <input type="hidden" name="code" value="[% lette.code %]" />
217 [% IF independant_branch %]
218 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
220 [% select_for_copy %]
222 <input type="submit" value="Copy" />
228 <a href="/cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=[% lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]">Edit</a>
232 [% IF !lette.protected && can_edit %]
233 <a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&branchcode=[%lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]">Delete</a>
241 <div class="dialog message">
242 [% IF ( branchcode ) %]
243 <p>There are no notices for this library.</p>
245 <p>There are no notices.</p>
252 [% IF add_form or copy_form %]
253 <h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1>
254 <form id="add_notice" name="Aform" method="post" enctype="multipart/form-data" class="validate">
256 <input type="hidden" name="op" id="op" value="add_validate" />
258 <input type="hidden" name="op" id="op" value="copy_validate" />
261 <input type="hidden" name="checked" value="0" />
263 <input type="hidden" name="add" value="0" />
265 <input type="hidden" name="add" value="1" />
267 <fieldset class="rows">
268 <input type="hidden" name="oldbranchcode" value="[% oldbranchcode %]" />
269 [% IF independant_branch %]
270 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
274 <label for="branch">Library:</label>
275 <select name="branchcode" id="branch" style="width:20em;">
276 <option value="">All libraries</option>
277 [% FOREACH branchloo IN branchloop %]
278 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
284 <label for="module">Koha module:</label>
285 <input type="hidden" name="oldmodule" value="[% module %]" />
287 <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;">
289 <select name="module" id="module">
291 [% IF ( module == "catalogue" ) %]
292 <option value="catalogue" selected="selected">Catalog</option>
294 <option value="catalogue" >Catalog</option>
296 [% IF ( module == "circulation" ) %]
297 <option value="circulation" selected="selected">Circulation</option>
299 <option value="circulation">Circulation</option>
301 [% IF ( module == "claimacquisition" ) %]
302 <option value="claimacquisition" selected="selected">Claim acquisition</option>
304 <option value="claimacquisition">Claim acquisition</option>
306 [% IF ( module == "claimissues" ) %]
307 <option value="claimissues" selected="selected">Claim serial issue</option>
309 <option value="claimissues">Claim serial issue</option>
311 [% IF ( module == "reserves" ) %]
312 <option value="reserves" selected="selected">Holds</option>
314 <option value="reserves">Holds</option>
316 [% IF ( module == "members" ) %]
317 <option value="members" selected="selected">Members</option>
319 <option value="members">Members</option>
321 [% IF ( module == "serial" ) %]
322 <option value="serial" selected="selected">Serials (routing list)</option>
324 <option value="serial">Serials (routing list)</option>
326 [% IF ( module == "suggestions" ) %]
327 <option value="suggestions" selected="selected">Suggestions</option>
329 <option value="suggestions">Suggestions</option>
335 <label for="code" class="required">Code:</label>
336 <input type="text" id="code" name="code" size="20" maxlength="20" value="" required="required"/>
337 <span class="required">Required</span>
339 <label for="code">Code:</label>
340 <input type="hidden" id="code" name="code" size="20" maxlength="20" value="[% code %]" required="required"/>
345 <label for="name" class="required">Name:</label>
346 <input type="text" id="name" name="name" size="60" value="[% letter_name %]" required="required" />
347 <span class="required">Required</span>
351 <div id="transport-types" style="clear:both">
352 [% FOREACH letter IN letters %]
354 [% SWITCH letter.message_transport_type %]
366 [% letter.message_transport_type %]
369 [% IF letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %]
370 <fieldset class="rows mtt" id="[% letter.message_transport_type %]" disabled="disabled">
371 <div class="dialog message">You should enable the SMSSendDriver preference to use the SMS templates.</div>
372 [% ELSIF letter.message_transport_type == "phone" and not Koha.Preference("TalkingTechItivaPhoneNotification") %]
373 <fieldset class="rows mtt" id="[% letter.message_transport_type %]" disabled="disabled">
374 <div class="dialog message">You should enable the TalkingTechItivaPhoneNotification preference to use the phone templates.</div>
376 <fieldset class="rows mtt" id="[% letter.message_transport_type %]">
380 <input type="hidden" name="message_transport_type" value="[% letter.message_transport_type %]" />
381 <label for="is_html_[% letter.message_transport_type %]">HTML message:</label>
382 [% IF letter.is_html %]
383 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" checked="checked" />
385 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" />
389 <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 %]" />
392 <label for="SQLfieldname_[% letter.message_transport_type %]">Message body:</label>
393 [% IF letter.message_transport_type == 'sms' %]
394 <span id="sms_counter">[% IF letter.content.length > 0 %][% letter.content.length %][% ELSE %]0[% END %]/160 characters</span>
399 <select name="SQLfieldname" id="SQLfieldname_[% letter.message_transport_type %]" multiple="multiple" size="9">
400 [% FOREACH SQLfieldnam IN SQLfieldname %]
401 <option value="[% SQLfieldnam.value %]">[% SQLfieldnam.text %]</option>
405 <td><input type="button" name="insert" value=">>" onclick="insertValueQuery('[% letter.message_transport_type %]')" title="Insert" /></td>
406 <td><textarea name="content" id="content_[% letter.message_transport_type %]" cols="80" rows="15">[% letter.content %]</textarea></td>
413 </div> <!-- / #transport-types -->
415 [% 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 %]
416 <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>
417 <input type="hidden" name="searchfield" value="[% searchfield %]" />
421 [% IF ( add_validate or copy_validate) %]
423 <form action="[% action %]" method="post">
424 <input type="submit" value="OK" />
428 [% IF ( delete_confirm ) %]
429 <div class="dialog alert"><h3>Delete notice?</h3>
440 <td>[% branchname %]</td>
441 <td>[% module %]</td>
446 <form action="[% action %]" method="post">
447 <input type="hidden" name="op" value="delete_confirmed">
448 <input type="hidden" name="branchcode" value="[% branchcode %]" />
449 <input type="hidden" name="code" value="[% code %]" />
450 <input type="hidden" name="module" value="[% module %]" />
451 <input type="submit" value="Yes, delete" class="approve" />
454 <form action="[% action %]" method="get">
455 <input type="submit" value="No, do not delete" class="deny" />
461 [% IF ( delete_confirmed ) %]
463 <form action="[% action %]" method="post">
464 <input type="submit" value="OK" />
470 [% UNLESS add_form or copy_form %]
471 <div class="yui-b noprint">
472 [% INCLUDE 'tools-menu.inc' %]
476 [% INCLUDE 'intranet-bottom.inc' %]