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="[% themelang %]/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 { "aTargets": [ -1,-2, -3 ], "bSortable": false, "bSearchable": false }
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;
33 $("fieldset.mtt").each( function(){
34 var title = $(this).find('input[name="title"]').val();
35 var content = $(this).find('textarea[name="content"]').val();
37 ( title.length == 0 && content.length > 0 )
38 || ( title.length > 0 && content.length == 0 )
40 var mtt = $(this).find('input[name="message_transport_type"]').val();
41 var msg = _("Please specify title and content for %s");
42 msg = msg.replace( "%s", mtt );
43 at_least_one_exists = 1;
46 } else if ( title.length > 0 && content.length > 0 ) {
47 at_least_one_exists = 1;
50 if ( ! at_least_one_exists ) {
51 alert( _("Please fill at least one template.") );
55 // Test if code already exists in DB
56 var new_lettercode = $("#code").val();
57 var new_branchcode = $("#branch").val();
58 [% IF ( add_form and code ) # IF edit %]
59 if ( new_lettercode != '[% code %]' ) {
62 data: { code: new_lettercode, branchcode: new_branchcode },
64 url: '/cgi-bin/koha/svc/letters/',
65 success: function (data) {
66 if ( data.letters.length > 0 ) {
67 if( new_branchcode == '' ) {
68 alert( _("A default letter with the code '%s' already exists.").format(new_lettercode) );
70 alert( _("A letter with the code '%s' already exists for '%s'.").format(new_lettercode, new_branchcode) );
74 $("#add_notice").submit();
78 [% IF ( add_form and code ) %]
80 $("#add_notice").submit();
86 $("#content_sms").on("keyup", function(){
87 var length = $(this).val().length;
88 $("#sms_counter").html(length + "/" + sms_limit + _(" characters"));
89 if ( length > sms_limit ) {
90 $("#sms_counter").css("color", "red");
92 $("#sms_counter").css("color", "black");
95 $( "#transport-types" ).accordion({ collapsible: true, active:false, animate: 200 });
97 [% IF add_form or copy_form %]
105 function isNotNull(f,noalert) {
106 if (f.value.length ==0) {
112 function isNum(v,maybenull) {
113 var n = new Number(v.value);
117 if (maybenull==0 && v.value=='') {
122 function insertValueQuery(mtt_id) {
123 var fieldset = $("#" + mtt_id);
124 var myQuery = $(fieldset).find('textarea[name="content"]');
125 var myListBox = $(fieldset).find('select[name="SQLfieldname"]');
127 if($(myListBox).find('option').length > 0) {
130 $(myListBox).find('option').each( function (){
131 if ( $(this).attr('selected') ) {
135 chaineAj += $(this).val();
138 $(myQuery).insertAtCaret("<<" + chaineAj + ">>");
145 <body id="tools_letter" class="tools">
146 [% INCLUDE 'header.inc' %]
147 [% INCLUDE 'letters-search.inc' %]
149 <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>
151 [% IF add_form or copy_form %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
157 [% IF ( no_op_set ) %]
158 <h1>Notices and Slips</h1>
159 <form method="get" action="/cgi-bin/koha/tools/letter.pl" id="selectlibrary">
160 <input type="hidden" name="searchfield" value="[% searchfield %]" />
161 [% UNLESS independant_branch %]
164 <select name="branchcode" id="branch" style="width:20em;">
165 <option value="">All libraries</option>
166 [% FOREACH branchloo IN branchloop %]
167 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
172 <div id="toolbar" class="btn-toolbar">
173 <button type="submit" class="btn btn-small" id="newnotice"><i class="icon-plus"></i> New notice</button>
174 <input type="hidden" id="op" name="op" />
179 <p>You searched for <b>[% searchfield %]</b></p>
181 [% IF ( letter && !independant_branch) %]
182 [% select_for_copy = BLOCK %]
183 <select name="branchcode">
184 [% FOREACH branchloo IN branchloop %]
185 <option value="[% branchloo.value %]">Copy to [% branchloo.branchname %]</option>
204 [% FOREACH lette IN letter %]
205 [% can_edit = lette.branchcode || !independant_branch %]
207 <td>[% IF lette.branchname %][% lette.branchname %][% ELSE %](All libraries)[% END %]</td>
208 <td>[% lette.module %]</td>
209 <td>[% lette.code %]</td>
210 <td>[% lette.name %]</td>
211 <td style="white-space: nowrap">
212 [% IF !independant_branch || !lette.branchcode %]
213 <form method="post" action="/cgi-bin/koha/tools/letter.pl">
214 <input type="hidden" name="op" value="copy_form" />
215 <input type="hidden" name="oldbranchcode" value="[% lette.branchcode %]" />
216 <input type="hidden" name="module" value="[% lette.module %]" />
217 <input type="hidden" name="code" value="[% lette.code %]" />
218 [% IF independant_branch %]
219 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
221 [% select_for_copy %]
223 <input type="submit" value="Copy" />
229 <a href="/cgi-bin/koha/tools/letter.pl?op=add_form&branchcode=[% lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]">Edit</a>
233 [% IF !lette.protected && can_edit %]
234 <a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&branchcode=[%lette.branchcode %]&module=[% lette.module %]&code=[% lette.code %]">Delete</a>
242 <div class="dialog message">
243 [% IF ( branchcode ) %]
244 <p>There are no notices for this library.</p>
246 <p>There are no notices.</p>
253 [% IF add_form or copy_form %]
254 <h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1>
255 <form id="add_notice" name="Aform" method="post" enctype="multipart/form-data" class="validate">
257 <input type="hidden" name="op" id="op" value="add_validate" />
259 <input type="hidden" name="op" id="op" value="copy_validate" />
262 <input type="hidden" name="checked" value="0" />
264 <input type="hidden" name="add" value="0" />
266 <input type="hidden" name="add" value="1" />
268 <fieldset class="rows">
269 <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>
278 <select name="branchcode" id="branch" style="width:20em;">
279 <option value="">All libraries</option>
280 [% FOREACH branchloo IN branchloop %]
281 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
285 [% Branches.GetName( branchcode ) %]
290 <label for="module">Koha module:</label>
291 <input type="hidden" name="oldmodule" value="[% module %]" />
293 <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;">
295 <select name="module" id="module">
297 [% IF ( module == "catalogue" ) %]
298 <option value="catalogue" selected="selected">Catalog</option>
300 <option value="catalogue" >Catalog</option>
302 [% IF ( module == "circulation" ) %]
303 <option value="circulation" selected="selected">Circulation</option>
305 <option value="circulation">Circulation</option>
307 [% IF ( module == "claimacquisition" ) %]
308 <option value="claimacquisition" selected="selected">Claim acquisition</option>
310 <option value="claimacquisition">Claim acquisition</option>
312 [% IF ( module == "claimissues" ) %]
313 <option value="claimissues" selected="selected">Claim serial issue</option>
315 <option value="claimissues">Claim serial issue</option>
317 [% IF ( module == "reserves" ) %]
318 <option value="reserves" selected="selected">Holds</option>
320 <option value="reserves">Holds</option>
322 [% IF ( module == "members" ) %]
323 <option value="members" selected="selected">Members</option>
325 <option value="members">Members</option>
327 [% IF ( module == "serial" ) %]
328 <option value="serial" selected="selected">Serials (routing list)</option>
330 <option value="serial">Serials (routing list)</option>
332 [% IF ( module == "suggestions" ) %]
333 <option value="suggestions" selected="selected">Suggestions</option>
335 <option value="suggestions">Suggestions</option>
341 <label for="code" class="required">Code:</label>
342 <input type="text" id="code" name="code" size="20" maxlength="20" value="" required="required"/>
343 <span class="required">Required</span>
345 <label for="code">Code:</label>
346 <input type="hidden" id="code" name="code" size="20" maxlength="20" value="[% code %]" required="required"/>
351 <label for="name" class="required">Name:</label>
352 <input type="text" id="name" name="name" size="60" value="[% letter_name %]" required="required" />
353 <span class="required">Required</span>
357 <div id="transport-types" style="clear:both">
358 [% FOREACH letter IN letters %]
360 [% SWITCH letter.message_transport_type %]
372 [% letter.message_transport_type %]
375 [% IF letter.message_transport_type == "sms" and not Koha.Preference("SMSSendDriver") %]
376 <fieldset class="rows mtt" id="[% letter.message_transport_type %]" disabled="disabled">
377 <div class="dialog message">You should enable the SMSSendDriver preference to use the SMS templates.</div>
378 [% ELSIF letter.message_transport_type == "phone" and not Koha.Preference("TalkingTechItivaPhoneNotification") %]
379 <fieldset class="rows mtt" id="[% letter.message_transport_type %]" disabled="disabled">
380 <div class="dialog message">You should enable the TalkingTechItivaPhoneNotification preference to use the phone templates.</div>
382 <fieldset class="rows mtt" id="[% letter.message_transport_type %]">
386 <input type="hidden" name="message_transport_type" value="[% letter.message_transport_type %]" />
387 <label for="is_html_[% letter.message_transport_type %]">HTML message:</label>
388 [% IF letter.is_html %]
389 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" checked="checked" />
391 <input type="checkbox" name="is_html_[% letter.message_transport_type %]" id="is_html_[% letter.message_transport_type %]" value="1" />
395 <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 %]" />
398 <label for="SQLfieldname_[% letter.message_transport_type %]">Message body:</label>
399 [% IF letter.message_transport_type == 'sms' %]
400 <span id="sms_counter">[% IF letter.content && letter.content.length > 0 %][% letter.content.length %][% ELSE %]0[% END %]/160 characters</span>
405 <select name="SQLfieldname" id="SQLfieldname_[% letter.message_transport_type %]" multiple="multiple" size="9">
406 [% FOREACH SQLfieldname IN SQLfieldnames %]
407 <option value="[% SQLfieldname.value %]">[% SQLfieldname.text %]</option>
411 <td><input type="button" name="insert" value=">>" onclick="insertValueQuery('[% letter.message_transport_type %]')" title="Insert" /></td>
412 <td><textarea name="content" id="content_[% letter.message_transport_type %]" cols="80" rows="15">[% letter.content %]</textarea></td>
419 </div> <!-- / #transport-types -->
421 [% 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 %]
422 <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>
423 <input type="hidden" name="searchfield" value="[% searchfield %]" />
427 [% IF ( add_validate or copy_validate) %]
429 <form action="[% action %]" method="post">
430 <input type="submit" value="OK" />
434 [% IF ( delete_confirm ) %]
435 <div class="dialog alert">
436 <h3>Delete notice?</h3>
447 <td>[% Branches.GetName( letter.branchcode ) %]</td>
448 <td>[% letter.module %]</td>
449 <td>[% letter.code %]</td>
450 <td>[% letter.name %]</td>
453 <form action="[% action %]" method="post">
454 <input type="hidden" name="op" value="delete_confirmed">
455 <input type="hidden" name="branchcode" value="[% letter.branchcode %]" />
456 <input type="hidden" name="code" value="[% letter.code %]" />
457 <input type="hidden" name="module" value="[% letter.module %]" />
458 <input type="submit" value="Yes, delete" class="approve" />
461 <form action="[% action %]" method="get">
462 <input type="submit" value="No, do not delete" class="deny" />
467 [% IF ( delete_confirmed ) %]
469 <form action="[% action %]" method="post">
470 <input type="submit" value="OK" />
476 [% UNLESS add_form or copy_form %]
477 <div class="yui-b noprint">
478 [% INCLUDE 'tools-menu.inc' %]
482 [% INCLUDE 'intranet-bottom.inc' %]