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