New XML API
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / serials / distributedto.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Subscription edit -- Select supplier<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
2 <!-- TMPL_INCLUDE NAME="menus.inc" -->
3 <!-- TMPL_INCLUDE NAME="menu-serials.inc" -->
4
5         <h1>Select borrowers or enter manually the names</h1>
6         <p>
7                 <form action="/cgi-bin/koha/serials/distributedto.pl" method="post" name="Aform">
8                         <table>
9                         <tr>
10                         <td>
11                                 <input type="text" name="searchfield" value="<!-- TMPL_VAR name="searchfield" -->">
12                                 <input type="submit" class="button" value="Filter">
13                         </td>
14                         <td rowspan="2">
15                                 <h2>Distributed to</h2>
16                                 <p>
17                                         <textarea name="distributedto" rows="15" cols="30"><!-- TMPL_VAR name="distributedto" --></textarea>
18                                 </p>
19                                 <p>
20                                         <!-- TMPL_IF name="save" -->
21                                                 saved</p><p>
22                                         <!-- /TMPL_IF -->
23                                         <input type="hidden" name="SaveList" value="0">
24                                         <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->">
25                                         <input type="button" name="save" value="Save" class="button" onClick="FSaveList()">
26                                         <input type="button" name="clode" value="Close" class="button" onClick="javascript:window.close()">
27                         </td>
28                         </tr>
29                         <tr>
30                         <td>
31                                 <!-- TMPL_VAR NAME="borrowername" -->
32                                 <select name="borlist" size="15">
33                                         <!-- TMPL_LOOP name="borlist" -->
34                                                 <option value="<!-- TMPL_VAR name="surname" --><!-- TMPL_VAR name="firstname" -->">
35                                                         <!-- TMPL_VAR name="surname" --> <!-- TMPL_VAR name="firstname" -->
36                                                 </option>
37                                         <!-- /TMPL_LOOP -->
38                                 </select>
39                                 <input type="button" name="insert" value="&gt;&gt;" class="button" onclick="insertValueQuery()" title="Insert" />
40                         </td>
41                         </tr>
42                         </table>
43                 </form>
44         </p>
45         <script language="javascript" type="text/javascript">
46                 // GPL code coming from PhpMyAdmin
47                 function insertValueQuery() {
48                         var myQuery = document.Aform.distributedto;
49                         var myListBox = document.Aform.borlist;
50                 
51                         if(myListBox.options.length > 0) {
52                                 var chaineAj = "";
53                                 var NbSelect = 0;
54                                 for(var i=0; i<myListBox.options.length; i++) {
55                                         if (myListBox.options[i].selected){
56                                                 NbSelect++;
57                                                 if (NbSelect > 1)
58                                                         chaineAj += ", ";
59                                                 chaineAj += myListBox.options[i].value;
60                                         }
61                                 }
62                 
63                                 //IE support
64                                 if (document.selection) {
65                                         myQuery.focus();
66                                         sel = document.selection.createRange();
67                                         sel.text = chaineAj;
68                                         document.Aform.insert.focus();
69                                 }
70                                 //MOZILLA/NETSCAPE support
71                                 else if (document.Aform.distributedto.selectionStart || document.Aform.distributedto.selectionStart == "0") {
72                                         var startPos = document.Aform.distributedto.selectionStart;
73                                         var endPos = document.Aform.distributedto.selectionEnd;
74                                         var chaineSql = document.Aform.distributedto.value;
75                                         myQuery.value = chaineSql.substring(0, startPos) +''+ chaineAj+"\n" + chaineSql.substring(endPos, chaineSql.length);
76                                 } else {
77                                         myQuery.value += chaineAj;
78                                 }
79                         }
80                 }
81                 function FSaveList() {
82                         document.Aform.SaveList.value=1;
83                         document.Aform.submit();
84                 }
85         </script>
86
87 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->