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