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();
57 if ( new_lettercode == '[% code %]' ) {
58 alert( _("Please change the code.") );
63 [% IF ( add_form and code ) # IF edit %]
64 if ( new_lettercode != '[% code %]' ) {
67 data: { code: new_lettercode },
69 url: '/cgi-bin/koha/svc/letters/',
70 success: function (data) {
71 if ( data.letters.length > 0 ) {
72 alert( _("This letter code is already used for another letter.") );
75 $("#add_notice").submit();
79 [% IF ( add_form and code ) %]
81 $("#add_notice").submit();
87 $("#content_sms").on("keyup", function(){
88 var length = $(this).val().length;
89 $("#sms_counter").html(length + "/" + sms_limit + _(" characters"));
90 if ( length > sms_limit ) {
91 $("#sms_counter").css("color", "red");
93 $("#sms_counter").css("color", "black");
96 $( "#transport-types" ).accordion({ collapsible: true, active:false, animate: 200 });
98 [% IF add_form or copy_form %]
106 function isNotNull(f,noalert) {
107 if (f.value.length ==0) {
113 function isNum(v,maybenull) {
114 var n = new Number(v.value);
118 if (maybenull==0 && v.value=='') {
123 function insertValueQuery(mtt_id) {
124 var fieldset = $("#" + mtt_id);
125 var myQuery = $(fieldset).find('textarea[name="content"]');
126 var myListBox = $(fieldset).find('select[name="SQLfieldname"]');
128 if($(myListBox).find('option').length > 0) {
131 $(myListBox).find('option').each( function (){
132 if ( $(this).attr('selected') ) {
136 chaineAj += $(this).val();
139 $(myQuery).insertAtCaret("<<" + chaineAj + ">>");
146 <body id="tools_letter" class="tools">
147 [% INCLUDE 'header.inc' %]
148 [% INCLUDE 'letters-search.inc' %]
150 <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>
152 [% IF add_form or copy_form %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
158 [% IF ( no_op_set ) %]
159 <h1>Notices and Slips</h1>
160 <form method="get" action="/cgi-bin/koha/tools/letter.pl" id="selectlibrary">
161 <input type="hidden" name="searchfield" value="[% searchfield %]" />
162 [% UNLESS independant_branch %]
165 <select name="branchcode" id="branch" style="width:20em;">
166 <option value="">All libraries</option>
167 [% FOREACH branchloo IN branchloop %]
168 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
173 <div id="toolbar" class="btn-toolbar">
174 <button type="submit" class="btn btn-small" id="newnotice"><i class="icon-plus"></i> New notice</button>
175 <input type="hidden" id="op" name="op" />
180 <p>You searched for <b>[% searchfield %]</b></p>
182 [% IF ( letter && !independant_branch) %]
183 [% select_for_copy = BLOCK %]
184 <select name="branchcode">
185 [% FOREACH branchloo IN branchloop %]
186 <option value="[% branchloo.value %]">Copy to [% branchloo.branchname %]</option>
205 [% FOREACH lette IN letter %]
206 [% can_edit = lette.branchcode || !independant_branch %]
208 <td>[% IF lette.branchname %][% lette.branchname %][% ELSE %](All libraries)[% END %]</td>
209 <td>[% lette.module %]</td>
210 <td>[% lette.code %]</td>
211 <td>[% lette.name %]</td>
212 <td style="white-space: nowrap">
213 [% IF !independant_branch || !lette.branchcode %]
214 <form method="post" action="/cgi-bin/koha/tools/letter.pl">
215 <input type="hidden" name="op" value="copy_form" />
216 <input type="hidden" name="oldbranchcode" value="[% lette.branchcode %]" />
217 <input type="hidden" name="module" value="[% lette.module %]" />
218 <input type="hidden" name="code" value="[% lette.code %]" />
219 [% IF independant_branch %]
220 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
222 [% select_for_copy %]
224 <input type="submit" value="Copy" />
230 <a href="/cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=[% lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]">Edit</a>
234 [% IF !lette.protected && can_edit %]
235 <a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&branchcode=[%lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]">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 %]" />
271 [% IF independant_branch %]
272 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
276 <label for="branch">Library:</label>
277 <select name="branchcode" id="branch" style="width:20em;">
278 <option value="">All libraries</option>
279 [% FOREACH branchloo IN branchloop %]
280 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
286 <label for="module">Koha module:</label>
287 <input type="hidden" name="oldmodule" value="[% module %]" />
289 <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;">
291 <select name="module" id="module">
293 [% IF ( module == "catalogue" ) %]
294 <option value="catalogue" selected="selected">Catalog</option>
296 <option value="catalogue" >Catalog</option>
298 [% IF ( module == "circulation" ) %]
299 <option value="circulation" selected="selected">Circulation</option>
301 <option value="circulation">Circulation</option>
303 [% IF ( module == "claimacquisition" ) %]
304 <option value="claimacquisition" selected="selected">Claim acquisition</option>
306 <option value="claimacquisition">Claim acquisition</option>
308 [% IF ( module == "claimissues" ) %]
309 <option value="claimissues" selected="selected">Claim serial issue</option>
311 <option value="claimissues">Claim serial issue</option>
313 [% IF ( module == "reserves" ) %]
314 <option value="reserves" selected="selected">Holds</option>
316 <option value="reserves">Holds</option>
318 [% IF ( module == "members" ) %]
319 <option value="members" selected="selected">Members</option>
321 <option value="members">Members</option>
323 [% IF ( module == "serial" ) %]
324 <option value="serial" selected="selected">Serials (routing list)</option>
326 <option value="serial">Serials (routing list)</option>
328 [% IF ( module == "suggestions" ) %]
329 <option value="suggestions" selected="selected">Suggestions</option>
331 <option value="suggestions">Suggestions</option>
336 <label for="code" class="required">Code:</label>
337 <input type="text" id="code" name="code" size="20" maxlength="20" value="[% code %]" required="required"/>
338 <span class="required">Required</span>
340 You must change this code to reflect the copy.
342 <input type="hidden" name="oldcode" value="[% oldcode %]" />
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="hidden" name="message_transport_type" value="*" />
452 <input type="submit" value="Yes, delete" class="approve" />
455 <form action="[% action %]" method="get">
456 <input type="submit" value="No, do not delete" class="deny" />
462 [% IF ( delete_confirmed ) %]
464 <form action="[% action %]" method="post">
465 <input type="submit" value="OK" />
471 [% UNLESS add_form or copy_form %]
472 <div class="yui-b noprint">
473 [% INCLUDE 'tools-menu.inc' %]
477 [% INCLUDE 'intranet-bottom.inc' %]