Merge remote-tracking branch 'kc/new/bug_5449' 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                 [% 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 %]
188                                     [% IF ( catalogue ) %]
189                                     <option value="catalogue" selected="selected">Catalog</option>
190                                     [% ELSE %]
191                                     <option value="catalogue" >Catalog</option>
192                                     [% END %]
193                                     [% IF ( circulation ) %]
194                                     <option value="circulation" selected="selected">Circulation</option>
195                                     [% ELSE %]
196                                     <option value="circulation">Circulation</option>
197                                     [% END %]
198                                     [% IF ( claimacquisition ) %]
199                                     <option value="claimacquisition" selected="selected">Claim Acquisition</option>
200                                     [% ELSE %]
201                                     <option value="claimacquisition">Claim Acquisition</option>
202                                     [% END %]
203                                     [% IF ( claimissues ) %]
204                                     <option value="claimissues" selected="selected">Claim Serial Issue</option>
205                                     [% ELSE %]
206                                     <option value="claimissues">Claim Serial Issue</option>
207                                     [% END %]
208                                     [% IF ( reserves ) %]
209                                     <option value="reserves" selected="selected">Holds</option>
210                                     [% ELSE %]
211                                     <option value="reserves">Holds</option>
212                                     [% END %]
213                                     [% IF ( members ) %]
214                                     <option value="members" selected="selected">Members</option>
215                                     [% ELSE %]
216                                     <option value="members">Members</option>
217                                     [% END %]
218                                     [% IF ( serial ) %]
219                                     <option value="serial" selected="selected">Serials (Routing List)</option>
220                                     [% ELSE %]
221                                     <option value="serial">Serials (Routing List)</option>
222                                     [% END %]
223                                     [% IF ( suggestions ) %]
224                                     <option value="suggestions" selected="selected">Suggestions</option>
225                                     [% ELSE %]
226                                     <option value="suggestions">Suggestions</option>
227                                     [% END %]
228                                 </select>
229                         </li>
230                         <li>
231                                 <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 %]
232                         </li>
233                 <li>
234                         <label for="name">Name:</label><input type="text" id="name" name="name" size="60" value="[% name %]" />
235                 </li>
236                 <li>
237                         <label for="title">Message Subject:</label><input type="text" id="title" name="title" size="60" value="[% title %]" />
238                 </li>
239                 <li>
240                         <label for="SQLfieldname">Message Body:</label>
241                 </li>
242                 <li>
243                 <table>
244                 <tr><td><select name="SQLfieldname" id="SQLfieldname" size="9">
245                         [% FOREACH SQLfieldnam IN SQLfieldname %]
246                                 <option value="[% SQLfieldnam.value %]">[% SQLfieldnam.text %]</option>
247                         [% END %]
248                 </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>
249
250                 </li>
251                 </ol>
252                 </fieldset>
253                 <fieldset class="action"><input type="button" value="Submit" onclick="Check(this.form)" class="button" /></fieldset>
254                 </form>
255         [% END %]
256         
257         [% IF ( add_validate ) %]
258         Data recorded
259         <form action="[% action %]" method="post">
260         <input type="submit" value="OK" />
261         </form>
262         [% END %]
263         
264         [% IF ( delete_confirm ) %]
265         <div class="dialog alert"><h3>Delete Notice?</h3>
266         <table>
267         <thead>
268                 <tr>
269                         <th>Module</th>
270                         <th>Code</th>
271                         <th>Name</th>
272                 </tr>
273         </thead>
274                 <tr>
275                         <td>[% module %]</td>
276             <td>[% code %]</td>
277                         <td>[% name %]</td>
278                 </tr>
279         </table>
280                 <form action="[% action %]" method="post">
281                 <input type="hidden" name="op" value="delete_confirmed">
282                 <input type="hidden" name="code" value="[% code %]" />
283                 <input type="hidden" name="module" value="[% module %]" />
284                                 <input type="submit" value="Yes, Delete" class="approve" />
285                                 </form>
286
287                                 <form action="[% action %]" method="get">
288                                         <input type="submit" value="No, Do Not Delete" class="deny" />
289                                 </form>
290                 </div>
291
292         [% END %]
293         
294         [% IF ( delete_confirmed ) %]
295         Data deleted
296         <form action="[% action %]" method="post">
297         <input type="submit" value="OK" />
298         </form>
299         [% END %]
300
301 </div>
302 </div>
303 [% UNLESS ( add_form ) %]
304     <div class="yui-b noprint">
305         [% INCLUDE 'tools-menu.inc' %]
306     </div>
307 [% END %]
308 </div>
309 [% INCLUDE 'intranet-bottom.inc' %]