Letters / alert system, continuing...
[wip/koha-chris_n.git] / koha-tmpl / intranet-tmpl / default / en / parameters / letter.tmpl
1 <!-- TMPL_INCLUDE NAME="parameters-top.inc" -->
2 <div id="mainbloc">
3         <h1>Letters admin</h1>
4         <!-- TMPL_IF NAME="else" -->
5                 <form action="/cgi-bin/koha/admin/letter.pl" method="post">
6                 <input type="text" name="searchfield" value="">
7                 <input type="submit" class="button" value="Filter"></form>
8                 <!-- TMPL_IF NAME="search" -->
9                 <br>You Searched for <b><!-- TMPL_VAR NAME="searchfield" --></b><p><br>
10                 <!-- /TMPL_IF -->
11                 <table>
12                 <tr>
13                         <th>Module</th>
14                         <th>Code</th>
15                         <th>Name</th>
16                         <th>&nbsp;</th>
17                         <th>&nbsp;</th>
18                 </tr>
19                 <!-- TMPL_LOOP NAME="letter" -->
20                         <tr bgcolor=<!-- TMPL_VAR NAME="toggle" --> >
21                                 <td><!-- TMPL_VAR NAME="module" --></td>
22                                 <td><!-- TMPL_VAR NAME="code" --></td>
23                                 <td><!-- TMPL_VAR NAME="name" --></td>
24                                 <td>
25                                         <a href="/cgi-bin/koha/admin/letter.pl?op=add_form&amp;module=<!-- TMPL_VAR name="module" -->&amp;code=<!-- TMPL_VAR NAME="code" -->">
26                                                 <img src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/fileopen.png"  width="32" hspace="0" vspace="0" border="0">
27                                         </a>
28                                 </td>
29                                 <td>
30                                         <a href="/cgi-bin/koha/admin/letter.pl?op=delete_confirm&amp;module=<!-- TMPL_VAR name="module"-->&amp;code=<!-- TMPL_VAR NAME="code" -->">
31                                                 <img src="<!-- TMPL_VAR NAME="interface" -->/<!-- TMPL_VAR NAME="theme" -->/images/edittrash.png" width="32" hspace="0" vspace="0" border="0">
32                                         </a>
33                                 </td>
34                         </tr>
35                 <!-- /TMPL_LOOP -->
36                 </table>
37                 <form action="/cgi-bin/koha/admin/letter.pl" method="post">
38                         <input type="hidden" name="op" value="add_form">
39                         <br>
40                         <input type="submit" class="button" value="Add Letter" title="Add Letter" alt="Add Letter">
41                         <br>
42                 </form>
43                 <br clear="all">
44         <!-- /TMPL_IF -->
45         
46         <!-- TMPL_IF NAME="add_form" -->
47         <script language="javascript" type="text/javascript">
48                 function _(s) { return s } // dummy function for gettext
49                 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
50                 function isNotNull(f,noalert) {
51                         if (f.value.length ==0) {
52         return false;
53                         }
54                         return true;
55                 }
56                 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
57                 function toUC(f) {
58                         var x=f.value.toUpperCase();
59                         f.value=x;
60                         return true;
61                 }
62                 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
63                 function isNum(v,maybenull) {
64                 var n = new Number(v.value);
65                 if (isNaN(n)) {
66                         return false;
67                         }
68                 if (maybenull==0 && v.value=='') {
69                         return false;
70                 }
71                 return true;
72                 }
73                 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
74                 function isDate(f) {
75                         var t = Date.parse(f.value);
76                         if (isNaN(t)) {
77                                 return false;
78                         }
79                 }
80                 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
81                 function Check(f) {
82                         var ok=1;
83                         var _alertString="";
84                         var alertString2;
85 /*                      if (!(isNotNull(window.document.Aform.code))) {
86                                 _alertString += "\n- " + _("Code missing");
87                         }*/
88 /*                      if (!(isNotNull(window.document.Aform.name))) {
89                                 _alertString += "\n- " + _("Name missing");
90                         }*/
91                         if (_alertString.length==0) {
92                                 document.Aform.submit();
93                         } else {
94                                 alertString2  = _("Form not submitted because of the following problem(s)");
95                                 alertString2 += "\n------------------------------------------------------------------------------------\n";
96                                 alertString2 += _alertString;
97                                 alert(alertString2);
98                         }
99                 }
100                 // GPL code coming from PhpMyAdmin
101                 function insertValueQuery() {
102                         var myQuery = document.Aform.content;
103                         var myListBox = document.Aform.SQLfieldname;
104                 
105                         if(myListBox.options.length > 0) {
106                                 var chaineAj = "";
107                                 var NbSelect = 0;
108                                 for(var i=0; i<myListBox.options.length; i++) {
109                                         if (myListBox.options[i].selected){
110                                                 NbSelect++;
111                                                 if (NbSelect > 1)
112                                                         chaineAj += ", ";
113                                                 chaineAj += myListBox.options[i].value;
114                                         }
115                                 }
116                 
117                                 //IE support
118                                 if (document.selection) {
119                                         myQuery.focus();
120                                         sel = document.selection.createRange();
121                                         sel.text = chaineAj;
122                                         document.Aform.insert.focus();
123                                 }
124                                 //MOZILLA/NETSCAPE support
125                                 else if (document.Aform.content.selectionStart || document.Aform.content.selectionStart == "0") {
126                                         var startPos = document.Aform.content.selectionStart;
127                                         var endPos = document.Aform.content.selectionEnd;
128                                         var chaineSql = document.Aform.content.value;
129                                         myQuery.value = chaineSql.substring(0, startPos) +'<<'+ chaineAj+'>>' + chaineSql.substring(endPos, chaineSql.length);
130                                 } else {
131                                         myQuery.value += chaineAj;
132                                 }
133                         }
134                 }
135                 
136                 </script>
137         <div id="bloc25">
138                 <!-- TMPL_IF name="modify" -->
139                         <h2 class="parameters">Modify letter</h2>
140                 <!-- TMPL_ELSE -->
141                         <h2 class="parameters">Add letter</h2>
142                 <!-- /TMPL_IF -->
143                 <form action="/cgi-bin/koha/admin/letter.pl" name="Aform" method="post">
144                 <input type="hidden" name="op" value="add_validate">
145                 <input type="hidden" name="checked" value="0">
146                 <!-- TMPL_IF NAME="modify" -->
147                         <p>
148                                 <label class="label100">Koha module:</label>
149                                 <select name="module">
150                                         <!-- TMPL_IF name="acquisition" -->
151                                                 <option value="acquisition" selected>Acquisition</option>
152                                         <!-- TMPL_ELSE -->
153                                                 <option value="acquisition">Acquisition</option>
154                                         <!-- /TMPL_IF -->
155                                         <!-- TMPL_IF name="catalogue" -->
156                                                 <option value="catalogue" selected>Catalogue</option>
157                                         <!-- TMPL_ELSE -->
158                                                 <option value="catalogue">Catalogue</option>
159                                         <!-- /TMPL_IF -->
160                                         <!-- TMPL_IF name="serial" -->
161                                                 <option value="serial" selected>Serial</option>
162                                         <!-- TMPL_ELSE -->
163                                                 <option value="serial">Serial</option>
164                                         <!-- /TMPL_IF -->
165                                         <!-- TMPL_IF name="circulation" -->
166                                                 <option value="circulation" selected>Circulation</option>
167                                         <!-- TMPL_ELSE -->
168                                                 <option value="circulation">Circulation</option>
169                                         <!-- /TMPL_IF -->
170                                         <!-- TMPL_IF name="members" -->
171                                                 <option value="members" selected>Members</option>
172                                         <!-- TMPL_ELSE -->
173                                                 <option value="members">Members</option>
174                                         <!-- /TMPL_IF -->
175                                         <!-- TMPL_IF name="authorities" -->
176                                                 <option value="authorities" selected>Authorities</option>
177                                         <!-- TMPL_ELSE -->
178                                                 <option value="authorities">Authorities</option>
179                                         <!-- /TMPL_IF -->
180                                         <!-- TMPL_IF name="reports" -->
181                                                 <option value="reports" selected>Reports</option>
182                                         <!-- TMPL_ELSE -->
183                                                 <option value="reports">Reports</option>
184                                         <!-- /TMPL_IF -->
185                                         <!-- TMPL_IF name="parameters" -->
186                                                 <option value="parameters" selected>Parameters</option>
187                                         <!-- TMPL_ELSE -->
188                                                 <option value="parameters">Parameters</option>
189                                         <!-- /TMPL_IF -->
190                                 </select>
191                         </p>
192                         <p>
193                                 <label class="label100">Code:</label><input type="hidden" name="code" value="<!-- TMPL_VAR NAME="code" -->"><!-- TMPL_VAR NAME="code" -->
194                         </p>
195                 <!-- /TMPL_IF -->
196                 
197                 <!-- TMPL_IF NAME="adding" -->
198                         <p>
199                                 <label class="label100">Koha module:</label>
200                                 <select name="module">
201                                                 <option value="acquisition">Acquisition</option>
202                                                 <option value="catalogue">Catalogue</option>
203                                                 <option value="serial">Serial</option>
204                                                 <option value="circulation">Circulation</option>
205                                                 <option value="members">Members</option>
206                                                 <option value="authorities">Authorities</option>
207                                                 <option value="reports">Reports</option>
208                                                 <option value="parameters">Parameters</option>
209                                 </select>
210                         </p>
211                         <p>
212                                 <label class="label100">Code:</label><input type="text" name="code" size="20" maxlength="20">
213                         </p>
214                 <!-- /TMPL_IF -->
215                 
216                 <p>
217                         <label class="label100">Name:</label><input type="text" name="name" size="100" value="<!-- TMPL_VAR NAME="name" -->">
218                 </p>
219                 <p>
220                         <label class="label100">Title (mail subject):</label><input type="text" name="title" size="100" value="<!-- TMPL_VAR NAME="title" -->">
221                 </p>
222                 <p>
223                         <label class="label100">Content (mail content):</label>
224                 </p>
225                 <p><textarea name="content" cols="80" rows="10"><!-- TMPL_VAR NAME="content" --></textarea>
226                 <input type="button" name="insert" value="&lt;&lt;" onclick="insertValueQuery()" title="Insert" />
227                 <select name="SQLfieldname" size=10>
228                         <!-- TMPL_LOOP name="SQLfieldname" -->
229                                 <option value="<!-- TMPL_VAR name="value"-->"><!-- TMPL_VAR name="text"--></option>
230                         <!-- /TMPL_LOOP -->
231                 </select>
232                 </p>
233                 <p><input type="button" value="OK" onclick="Check(this.form)" class="button"></p>
234                 </form>
235         </div>
236         <!-- /TMPL_IF -->
237         
238         <!-- TMPL_IF NAME="add_validate" -->
239         Data recorded
240         <form action="<!-- TMPL_VAR NAME="action" -->" method="post">
241         <input type="submit" value="OK">
242         </form>
243         <!-- /TMPL_IF -->
244         
245         <!-- TMPL_IF NAME="delete_confirm" -->
246         <table border="0" cellspacing="0" cellpadding="5">
247                 <tr valign="top" bgcolor="#99cc33">
248                         <td background="<!-- TMPL_VAR NAME="themelang" -->/images/background-mem.gif">
249                                 <b>module / Code</b>
250                         </td>
251                         <td background="<!-- TMPL_VAR NAME="themelang" -->/images/background-mem.gif">
252                                 <b><!-- TMPL_VAR name="module"--> / <!-- TMPL_VAR NAME="code" --></b>
253                         </td>
254                 </tr>
255         
256                 <form action="<!-- TMPL_VAR NAME="action" -->" method="post"><input type="hidden" name="op" value="delete_confirmed">
257                 <input type="hidden" name="code" value="<!-- TMPL_VAR NAME="code" -->">
258                 <input type="hidden" name="module" value="<!-- TMPL_VAR NAME="module" -->">
259                 <tr>
260                         <td>Name</td>
261                         <td><!-- TMPL_VAR NAME="Name" --></td>
262                 </tr>
263                 <tr>
264                         <td colspan="2" align="center">CONFIRM DELETION</td>
265                 </tr>
266                 <tr>
267                         <td>
268                                 <input type="submit" value="YES">
269                                 </form>
270                         </td>
271                         <td>
272                                 <form action="<!-- TMPL_VAR NAME="action" -->" method="post">
273                                         <input type="submit" value="NO">
274                                 </form>
275                         </td>
276                 </tr>
277         </table>
278         <!-- /TMPL_IF -->
279         
280         <!-- TMPL_IF NAME="delete_confirmed" -->
281         Data deleted
282         <form action="<!-- TMPL_VAR NAME="action" -->" method="post">
283         <input type="submit" value="OK">
284         </form>
285         <!-- /TMPL_IF -->
286 </div>
287 <!-- TMPL_INCLUDE NAME="parameters-bottom.inc" -->