Merge branch 'new/bug_6479' into kcmaster
[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").tablesorter({
9                 widgets : ['zebra'],
10                 sortList: [[0,0]],
11                 headers: { 3: {sorter:false},4: { sorter: false }}
12         }); 
13 }); 
14 [% IF ( add_form ) %]
15         
16                 function isNotNull(f,noalert) {
17                         if (f.value.length ==0) {
18         return false;
19                         }
20                         return true;
21                 }
22         
23                 function toUC(f) {
24                         var x=f.value.toUpperCase();
25                         f.value=x;
26                         return true;
27                 }
28         
29                 function isNum(v,maybenull) {
30                 var n = new Number(v.value);
31                 if (isNaN(n)) {
32                         return false;
33                         }
34                 if (maybenull==0 && v.value=='') {
35                         return false;
36                 }
37                 return true;
38                 }
39         
40                 function isDate(f) {
41                         var t = Date.parse(f.value);
42                         if (isNaN(t)) {
43                                 return false;
44                         }
45                 }
46         
47                 function Check(f) {
48                         var ok=1;
49                         var _alertString="";
50                         var alertString2;
51 /*                      if (!(isNotNull(window.document.Aform.code))) {
52                                 _alertString += "\n- " + _("Code missing");
53                         }*/
54 /*                      if (!(isNotNull(window.document.Aform.name))) {
55                                 _alertString += "\n- " + _("Name missing");
56                         }*/
57                         if (_alertString.length==0) {
58                                 document.Aform.submit();
59                         } else {
60                                 alertString2  = _("Form not submitted because of the following problem(s)");
61                                 alertString2 += "\n------------------------------------------------------------------------------------\n";
62                                 alertString2 += _alertString;
63                                 alert(alertString2);
64                         }
65                 }
66                 // GPL code coming from PhpMyAdmin
67                 function insertValueQuery() {
68                         var myQuery = document.Aform.content;
69                         var myListBox = document.Aform.SQLfieldname;
70                 
71                         if(myListBox.options.length > 0) {
72                                 var chaineAj = "";
73                                 var NbSelect = 0;
74                                 for(var i=0; i<myListBox.options.length; i++) {
75                                         if (myListBox.options[i].selected){
76                                                 NbSelect++;
77                                                 if (NbSelect > 1)
78                                                         chaineAj += ", ";
79                                                 chaineAj += myListBox.options[i].value;
80                                         }
81                                 }
82                 
83                                 //IE support
84                                 if (document.selection) {
85                                         myQuery.focus();
86                                         sel = document.selection.createRange();
87                                         sel.text = chaineAj;
88                                         document.Aform.insert.focus();
89                                 }
90                                 //MOZILLA/NETSCAPE support
91                                 else if (document.Aform.content.selectionStart || document.Aform.content.selectionStart == "0") {
92                                         var startPos = document.Aform.content.selectionStart;
93                                         var endPos = document.Aform.content.selectionEnd;
94                                         var chaineSql = document.Aform.content.value;
95                                         myQuery.value = chaineSql.substring(0, startPos) +'<<'+ chaineAj+'>>' + chaineSql.substring(endPos, chaineSql.length);
96                                 } else {
97                                         myQuery.value += chaineAj;
98                                 }
99                         }
100                 }
101         [% END %]
102                 //]]>
103                 </script>
104 </head>
105 <body>
106 [% INCLUDE 'header.inc' %]
107 [% INCLUDE 'letters-search.inc' %]
108
109 <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</a> &rsaquo; Modify notice[% ELSE %] <a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Add notice[% END %][% ELSE %][% IF ( add_validate ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Notice added[% ELSE %][% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/tools/letter.pl">Notices</a> &rsaquo; Confirm Deletion[% ELSE %]Notices[% END %][% END %][% END %]</div>
110
111 [% IF ( add_form ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %]
112    
113    <div id="bd">
114         <div id="yui-main">
115         <div class="yui-b">
116
117         [% IF ( no_op_set ) %]
118 <div id="toolbar">
119         <script type="text/javascript">
120         //<![CDATA[
121         // prepare DOM for YUI Toolbar
122          $(document).ready(function() {
123             yuiToolbar();
124          });
125         // YUI Toolbar Functions
126         function yuiToolbar() {
127             new YAHOO.widget.Button("newnotice");
128         }
129         //]]>
130         </script>
131         <ul class="toolbar">
132         <li><a id="newnotice" href="/cgi-bin/koha/tools/letter.pl?op=add_form">New Notice</a></li>
133 </ul></div>
134                 
135                 [% IF ( search ) %]
136                 <p>You Searched for <b>[% searchfield %]</b></p>
137                 [% END %]
138                 [% IF ( letter ) %]<table id="lettert">
139                 <thead><tr>
140                         <th>Module</th>
141                         <th>Code</th>
142                         <th>Name</th>
143                         <th>&nbsp;</th>
144                         <th>&nbsp;</th>
145                 </tr></thead>
146                 <tbody>[% FOREACH lette IN letter %]
147                 [% UNLESS ( loop.odd ) %]
148                         <tr class="highlight">
149                 [% ELSE %]
150                         <tr>
151                 [% END %]
152                                 <td>[% lette.module %]</td>
153                                 <td>[% lette.code %]</td>
154                                 <td>[% lette.name %]</td>
155                                 <td>
156                                         <a href="/cgi-bin/koha/tools/letter.pl?op=add_form&amp;module=[% lette.module %]&amp;code=[% lette.code %]">Edit</a>
157                                 </td>
158                                 <td>
159                                         [% IF ( lette.protected ) %]
160                                         -
161                                         [% ELSE %]
162                                         <a href="/cgi-bin/koha/tools/letter.pl?op=delete_confirm&amp;module=[% lette.module %]&amp;code=[% lette.code %]">Delete</a>
163                                         [% END %]
164                                 </td>
165                         </tr>
166                 [% END %]</tbody>
167                 </table>
168                 [% END %]
169
170         [% END %]
171         
172         [% IF ( add_form ) %]
173         
174                 <form action="/cgi-bin/koha/tools/letter.pl" name="Aform" method="post">
175                 <input type="hidden" name="op" value="add_validate" />
176                 <input type="hidden" name="checked" value="0" />
177                 [% IF ( modify ) %]
178                 <input type="hidden" name="add" value="0" />
179                 [% ELSE %]
180                 <input type="hidden" name="add" value="1" />
181                 [% END %]
182                 <fieldset class="rows">
183                 <legend>[% IF ( modify ) %]Modify notice[% ELSE %]Add notice[% END %]</legend>
184                 <ol>
185                         <li>
186                                 <label for="module">Koha module:</label>
187                                 <input type="hidden" name="oldmodule" value="[% module %]" />
188                 [% 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 %]
189                                     [% IF ( catalogue ) %]
190                                     <option value="catalogue" selected="selected">Catalog</option>
191                                     [% ELSE %]
192                                     <option value="catalogue" >Catalog</option>
193                                     [% END %]
194                                     [% IF ( circulation ) %]
195                                     <option value="circulation" selected="selected">Circulation</option>
196                                     [% ELSE %]
197                                     <option value="circulation">Circulation</option>
198                                     [% END %]
199                                     [% IF ( claimacquisition ) %]
200                                     <option value="claimacquisition" selected="selected">Claim Acquisition</option>
201                                     [% ELSE %]
202                                     <option value="claimacquisition">Claim Acquisition</option>
203                                     [% END %]
204                                     [% IF ( claimissues ) %]
205                                     <option value="claimissues" selected="selected">Claim Serial Issue</option>
206                                     [% ELSE %]
207                                     <option value="claimissues">Claim Serial Issue</option>
208                                     [% END %]
209                                     [% IF ( reserves ) %]
210                                     <option value="reserves" selected="selected">Holds</option>
211                                     [% ELSE %]
212                                     <option value="reserves">Holds</option>
213                                     [% END %]
214                                     [% IF ( members ) %]
215                                     <option value="members" selected="selected">Members</option>
216                                     [% ELSE %]
217                                     <option value="members">Members</option>
218                                     [% END %]
219                                     [% IF ( serial ) %]
220                                     <option value="serial" selected="selected">Serials (Routing List)</option>
221                                     [% ELSE %]
222                                     <option value="serial">Serials (Routing List)</option>
223                                     [% END %]
224                                     [% IF ( suggestions ) %]
225                                     <option value="suggestions" selected="selected">Suggestions</option>
226                                     [% ELSE %]
227                                     <option value="suggestions">Suggestions</option>
228                                     [% END %]
229                                 </select>
230                         </li>
231                         <li>
232                                 <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 %]
233                         </li>
234                 <li>
235                         <label for="name">Name:</label><input type="text" id="name" name="name" size="60" value="[% name %]" />
236                 </li>
237                 <li>
238                         <label for="title">Message Subject:</label><input type="text" id="title" name="title" size="60" value="[% title %]" />
239                 </li>
240                 <li>
241                         <label for="SQLfieldname">Message Body:</label>
242                 </li>
243                 <li>
244                 <table>
245                 <tr><td><select name="SQLfieldname" id="SQLfieldname" size="9">
246                         [% FOREACH SQLfieldnam IN SQLfieldname %]
247                                 <option value="[% SQLfieldnam.value %]">[% SQLfieldnam.text %]</option>
248                         [% END %]
249                 </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>
250
251                 </li>
252                 </ol>
253                 </fieldset>
254                 <fieldset class="action"><input type="button" value="Submit" onclick="Check(this.form)" class="button" /></fieldset>
255                 </form>
256         [% END %]
257         
258         [% IF ( add_validate ) %]
259         Data recorded
260         <form action="[% action %]" method="post">
261         <input type="submit" value="OK" />
262         </form>
263         [% END %]
264         
265         [% IF ( delete_confirm ) %]
266         <div class="dialog alert"><h3>Delete Notice?</h3>
267         <table>
268         <thead>
269                 <tr>
270                         <th>Module</th>
271                         <th>Code</th>
272                         <th>Name</th>
273                 </tr>
274         </thead>
275                 <tr>
276                         <td>[% module %]</td>
277             <td>[% code %]</td>
278                         <td>[% name %]</td>
279                 </tr>
280         </table>
281                 <form action="[% action %]" method="post">
282                 <input type="hidden" name="op" value="delete_confirmed">
283                 <input type="hidden" name="code" value="[% code %]" />
284                 <input type="hidden" name="module" value="[% module %]" />
285                                 <input type="submit" value="Yes, Delete" class="approve" />
286                                 </form>
287
288                                 <form action="[% action %]" method="get">
289                                         <input type="submit" value="No, Do Not Delete" class="deny" />
290                                 </form>
291                 </div>
292
293         [% END %]
294         
295         [% IF ( delete_confirmed ) %]
296         Data deleted
297         <form action="[% action %]" method="post">
298         <input type="submit" value="OK" />
299         </form>
300         [% END %]
301
302 </div>
303 </div>
304 [% UNLESS ( add_form ) %]
305     <div class="yui-b noprint">
306         [% INCLUDE 'tools-menu.inc' %]
307     </div>
308 [% END %]
309 </div>
310 [% INCLUDE 'intranet-bottom.inc' %]