Merge branch 'bug_8942' into 3.12-master
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / letter.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Tools &rsaquo; Notices[% IF ( add_form ) %][% IF ( modify ) %] &rsaquo; Modify notice[% ELSE %] &rsaquo; Add notice[% END %][% END %][% IF ( add_validate ) %] &rsaquo; Notice added[% END %][% IF ( delete_confirm ) %] &rsaquo; Confirm deletion[% END %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/datatables.css" />
5 <script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
6 [% INCLUDE 'datatables-strings.inc' %]
7 <script type="text/javascript" src="/intranet-tmpl/prog/en/js/datatables.js"></script>
8 <script type="text/javascript">
9 //<![CDATA[
10 $(document).ready(function() {
11     $("#lettert:has(tbody tr)").dataTable($.extend(true, {}, dataTablesDefaults, {
12         "sDom": 't',
13         "aoColumnDefs": [
14             { "aTargets": [ -1,-2, -3 ], "bSortable": false, "bSearchable": false }
15         ],
16         "bPaginate": false
17     }));
18     $('#branch').change(function() {
19             $('#op').val("");
20             $('#selectlibrary').submit();
21     });
22     $('#newnotice').click(function() {
23             $('#op').val("add_form");
24             return true;
25     });
26 }); 
27 [% IF ( add_form ) %]
28         
29     function cancel(f) {
30         $('#op').val("");
31         f.method = "get";
32         f.submit();
33     }
34
35                 function isNotNull(f,noalert) {
36                         if (f.value.length ==0) {
37         return false;
38                         }
39                         return true;
40                 }
41         
42                 function toUC(f) {
43                         var x=f.value.toUpperCase();
44                         f.value=x;
45                         return true;
46                 }
47         
48                 function isNum(v,maybenull) {
49                 var n = new Number(v.value);
50                 if (isNaN(n)) {
51                         return false;
52                         }
53                 if (maybenull==0 && v.value=='') {
54                         return false;
55                 }
56                 return true;
57                 }
58         
59                 function isDate(f) {
60                         var t = Date.parse(f.value);
61                         if (isNaN(t)) {
62                                 return false;
63                         }
64                 }
65         
66                 function Check(f) {
67                         var ok=1;
68                         var _alertString="";
69                         var alertString2;
70 /*                      if (!(isNotNull(window.document.Aform.code))) {
71                                 _alertString += "\n- " + _("Code missing");
72                         }*/
73 /*                      if (!(isNotNull(window.document.Aform.name))) {
74                                 _alertString += "\n- " + _("Name missing");
75                         }*/
76                         if (_alertString.length==0) {
77                                 document.Aform.submit();
78                         } else {
79                                 alertString2  = _("Form not submitted because of the following problem(s)");
80                                 alertString2 += "\n------------------------------------------------------------------------------------\n";
81                                 alertString2 += _alertString;
82                                 alert(alertString2);
83                         }
84                 }
85                 // GPL code coming from PhpMyAdmin
86                 function insertValueQuery() {
87                         var myQuery = document.Aform.content;
88                         var myListBox = document.Aform.SQLfieldname;
89                 
90                         if(myListBox.options.length > 0) {
91                                 var chaineAj = "";
92                                 var NbSelect = 0;
93                                 for(var i=0; i<myListBox.options.length; i++) {
94                                         if (myListBox.options[i].selected){
95                                                 NbSelect++;
96                                                 if (NbSelect > 1)
97                                                         chaineAj += ", ";
98                                                 chaineAj += myListBox.options[i].value;
99                                         }
100                                 }
101                 
102                                 //IE support
103                                 if (document.selection) {
104                                         myQuery.focus();
105                                         sel = document.selection.createRange();
106                                         sel.text = chaineAj;
107                                         document.Aform.insert.focus();
108                                 }
109                                 //MOZILLA/NETSCAPE support
110                                 else if (document.Aform.content.selectionStart || document.Aform.content.selectionStart == "0") {
111                                         var startPos = document.Aform.content.selectionStart;
112                                         var endPos = document.Aform.content.selectionEnd;
113                                         var chaineSql = document.Aform.content.value;
114                                         myQuery.value = chaineSql.substring(0, startPos) +'<<'+ chaineAj+'>>' + chaineSql.substring(endPos, chaineSql.length);
115                                 } else {
116                                         myQuery.value += chaineAj;
117                                 }
118                         }
119                 }
120         [% END %]
121                 //]]>
122                 </script>
123 </head>
124 <body id="tools_letter" class="tools">
125 [% INCLUDE 'header.inc' %]
126 [% INCLUDE 'letters-search.inc' %]
127
128 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% IF ( add_form ) %][% IF ( modify ) %]<a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; Slips</a> &rsaquo; Modify notice[% ELSE %] <a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; Slips</a> &rsaquo; Add notice[% END %][% ELSE %][% IF ( add_validate ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; Slips</a> &rsaquo; Notice added[% ELSE %][% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices &amp; Slips</a> &rsaquo; Confirm deletion[% ELSE %]Notices &amp; Slips[% END %][% END %][% END %]</div>
129
130 [% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
131    
132    <div id="bd">
133         <div id="yui-main">
134         <div class="yui-b">
135
136 [% IF ( no_op_set ) %]
137     <h1>Notices and Slips</h1>
138     <form method="get" action="/cgi-bin/koha/tools/letter.pl" id="selectlibrary">
139       <input type="hidden" name="searchfield" value="[% searchfield %]" />
140     [% UNLESS independant_branch %]
141       <p>
142         Select a library :
143             <select name="branchcode" id="branch" style="width:20em;">
144                 <option value="">All libraries</option>
145             [% FOREACH branchloo IN branchloop %]
146                 [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
147             [% END %]
148             </select>
149       </p>
150     [% END %]
151       <div id="toolbar">
152               <input type="submit" id="newnotice" value="New Notice" />
153         <input type="hidden" id="op" name="op" />
154       </div>
155     </form>
156
157                 [% IF ( search ) %]
158         <p>You searched for <b>[% searchfield %]</b></p>
159                 [% END %]
160                 [% IF ( letter && !independant_branch) %]
161             [% select_for_copy = BLOCK %]
162             <select name="branchcode">
163                 [% FOREACH branchloo IN branchloop %]
164                 <option value="[% branchloo.value %]">Copy to [% branchloo.branchname %]</option>
165                 [% END %]
166             </select>
167             [% END %]
168         [% END %]
169
170 [% IF ( letter ) %]
171         <table id="lettert">
172                 <thead><tr>
173                         <th>Library</th>
174                         <th>Module</th>
175                         <th>Code</th>
176                         <th>Name</th>
177             <th>Copy notice</th>
178                         <th>&nbsp;</th>
179                         <th>&nbsp;</th>
180                 </tr></thead>
181                 <tbody>
182     [% FOREACH lette IN letter %]
183         [% can_edit = lette.branchcode || !independant_branch %]
184         [% UNLESS ( loop.odd ) %]
185                         <tr class="highlight">
186         [% ELSE %]
187                         <tr>
188         [% END %]
189                                 <td>[% lette.branchname || "(All libraries)" %]</td>
190                                 <td>[% lette.module %]</td>
191                                 <td>[% lette.code %]</td>
192                                 <td>[% lette.name %]</td>
193                                 <td style="white-space: nowrap">
194         [% IF !independant_branch || !lette.branchcode %]
195                     <form method="post" action="/cgi-bin/koha/tools/letter.pl">
196                         <input type="hidden" name="op" value="copy" />
197                                         <input type="hidden" name="oldbranchcode" value="[% lette.branchcode %]" />
198                         <input type="hidden" name="module" value="[% lette.module %]" />
199                         <input type="hidden" name="code" value="[% lette.code %]" />
200             [% IF independant_branch %]
201                         <input type="hidden" name="branchcode" value="[% independant_branch %]" />
202             [% ELSE %]
203                         [% select_for_copy %]
204             [% END %]
205                         <input type="submit" value="Copy" />
206                     </form>
207         [% END %]
208                 </td>
209                 <td>
210         [% IF can_edit %]
211                     <a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;branchcode=[% lette.branchcode %]&amp;module=[% lette.module %]&amp;code=[% lette.code %]">Edit</a>
212         [% END %]
213                                 </td>
214                                 <td>
215         [% IF !lette.protected && can_edit %]
216                                         <a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&amp;branchcode=[%lette.branchcode %]&amp;module=[% lette.module %]&amp;code=[% lette.code %]">Delete</a>
217         [% END %]
218                                 </td>
219                         </tr>
220     [% END %]
221         </tbody>
222                 </table>
223 [% ELSE %]
224     <div class="dialog message">
225         [% IF ( branchcode ) %]
226            <p>There are no notices for this library.</p>
227         [% ELSE %]
228             <p>There are no notices.</p>
229         [% END %]
230     </div>
231 [% END %]
232 [% END %]
233
234         
235 [% IF ( add_form ) %]
236 <h1>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</h1>
237                 <form action="?" name="Aform" method="post">
238                 <input type="hidden" name="op" id="op" value="add_validate" />
239                 <input type="hidden" name="checked" value="0" />
240                 [% IF ( modify ) %]
241                 <input type="hidden" name="add" value="0" />
242                 [% ELSE %]
243                 <input type="hidden" name="add" value="1" />
244                 [% END %]
245                 <fieldset class="rows">
246                                 <input type="hidden" name="oldbranchcode" value="[% branchcode %]" />
247             [% IF independant_branch %]
248                 <input type="hidden" name="branchcode" value="[% independant_branch %]" />
249             [% ELSE %]
250                 <ol>
251                         <li>
252                                 <label for="branch">Library:</label>
253                 <select name="branchcode" id="branch" style="width:20em;">
254                     <option value="">All libraries</option>
255                 [% FOREACH branchloo IN branchloop %]
256                     [% IF ( branchloo.selected ) %]<option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %]<option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %]
257                 [% END %]
258                 </select>
259                         </li>
260             [% END %]
261                         <li>
262                                 <label for="module">Koha module:</label>
263                                 <input type="hidden" name="oldmodule" value="[% module %]" />
264                 [% IF ( modify ) %]<select name="module" id="module">[% END %] [% IF ( adding ) %] <select name="module" id="module" onchange="javascript:window.location.href = unescape(window.location.pathname)+'?op=add_form&amp;module='+this.value+'&amp;content='+window.document.forms['Aform'].elements['content'].value;">[% END %]
265                                     [% IF ( catalogue ) %]
266                                     <option value="catalogue" selected="selected">Catalog</option>
267                                     [% ELSE %]
268                                     <option value="catalogue" >Catalog</option>
269                                     [% END %]
270                                     [% IF ( circulation ) %]
271                                     <option value="circulation" selected="selected">Circulation</option>
272                                     [% ELSE %]
273                                     <option value="circulation">Circulation</option>
274                                     [% END %]
275                                     [% IF ( claimacquisition ) %]
276                                     <option value="claimacquisition" selected="selected">Claim acquisition</option>
277                                     [% ELSE %]
278                                     <option value="claimacquisition">Claim acquisition</option>
279                                     [% END %]
280                                     [% IF ( claimissues ) %]
281                                     <option value="claimissues" selected="selected">Claim serial issue</option>
282                                     [% ELSE %]
283                                     <option value="claimissues">Claim serial issue</option>
284                                     [% END %]
285                                     [% IF ( reserves ) %]
286                                     <option value="reserves" selected="selected">Holds</option>
287                                     [% ELSE %]
288                                     <option value="reserves">Holds</option>
289                                     [% END %]
290                                     [% IF ( members ) %]
291                                     <option value="members" selected="selected">Members</option>
292                                     [% ELSE %]
293                                     <option value="members">Members</option>
294                                     [% END %]
295                                     [% IF ( serial ) %]
296                                     <option value="serial" selected="selected">Serials (routing list)</option>
297                                     [% ELSE %]
298                                     <option value="serial">Serials (routing list)</option>
299                                     [% END %]
300                                     [% IF ( suggestions ) %]
301                                     <option value="suggestions" selected="selected">Suggestions</option>
302                                     [% ELSE %]
303                                     <option value="suggestions">Suggestions</option>
304                                     [% END %]
305                                 </select>
306                         </li>
307                         <li>
308                                 <span class="label">Code:</span>[% IF ( adding ) %]<input type="text" id="code" name="code" size="20" maxlength="20" />[% ELSE %]<input type="hidden" id="code" name="code" value="[% code %]" />[% code %][% END %]
309                         </li>
310                 <li>
311                         <label for="name">Name:</label><input type="text" id="name" name="name" size="60" value="[% name %]" />
312                 </li>
313                 <li>
314             <label for="is_html">HTML message:</label>
315       [% IF is_html %]
316       <input type="checkbox" id="is_html" name="is_html" value="1" checked />
317       [% ELSE %]
318       <input type="checkbox" id="is_html" name="is_html" value="1" />
319       [% END %]
320                 </li>
321                 <li>
322             <label for="title">Message subject:</label><input type="text" id="title" name="title" size="60" value="[% title %]" />
323                 </li>
324                 <li>
325             <label for="SQLfieldname">Message body:</label>
326                 </li>
327                 <li>
328                 <table>
329                 <tr><td><select name="SQLfieldname" id="SQLfieldname" size="9">
330                         [% FOREACH SQLfieldnam IN SQLfieldname %]
331                                 <option value="[% SQLfieldnam.value %]">[% SQLfieldnam.text %]</option>
332                         [% END %]
333                 </select></td><td><input type="button" name="insert" value="&gt;&gt;" onclick="insertValueQuery()" title="Insert" /></td><td><textarea name="content" cols="80" rows="15">[% content %]</textarea></td></tr></table>
334
335                 </li>
336                 </ol>
337                 [% 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 %]
338                 </fieldset>
339                 <fieldset class="action"><input type="button" value="Submit" onclick="Check(this.form)" class="button" /> <a class="cancel" href="/cgi-bin/koha/tools/letter.pl">Cancel</a></fieldset>
340       <input type="hidden" name="searchfield" value="[% searchfield %]" />
341                 </form>
342 [% END %]
343         
344 [% IF ( add_validate ) %]
345         Data recorded
346         <form action="[% action %]" method="post">
347         <input type="submit" value="OK" />
348         </form>
349 [% END %]
350         
351 [% IF ( delete_confirm ) %]
352     <div class="dialog alert"><h3>Delete notice?</h3>
353         <table>
354         <thead>
355                 <tr>
356                         <th>Library</th>
357                         <th>Module</th>
358                         <th>Code</th>
359                         <th>Name</th>
360                 </tr>
361         </thead>
362                 <tr>
363                         <td>[% branchname %]</td>
364                         <td>[% module %]</td>
365             <td>[% code %]</td>
366                         <td>[% name %]</td>
367                 </tr>
368         </table>
369                 <form action="[% action %]" method="post">
370                 <input type="hidden" name="op" value="delete_confirmed">
371                 <input type="hidden" name="branchcode" value="[% branchcode %]" />
372                 <input type="hidden" name="code" value="[% code %]" />
373                 <input type="hidden" name="module" value="[% module %]" />
374                 <input type="submit" value="Yes, delete" class="approve" />
375                                 </form>
376
377                                 <form action="[% action %]" method="get">
378                     <input type="submit" value="No, do not delete" class="deny" />
379                                 </form>
380                 </div>
381
382 [% END %]
383         
384 [% IF ( delete_confirmed ) %]
385         Data deleted
386         <form action="[% action %]" method="post">
387         <input type="submit" value="OK" />
388         </form>
389 [% END %]
390
391 </div>
392 </div>
393 [% UNLESS ( add_form ) %]
394     <div class="yui-b noprint">
395         [% INCLUDE 'tools-menu.inc' %]
396     </div>
397 [% END %]
398 </div>
399 [% INCLUDE 'intranet-bottom.inc' %]