Bug 20731: Move template JavaScript to the footer: Call number browser MARC plugin
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / value_builder / marc21_linking_section.tt
1 [% SET footerjs = 1 %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Cataloguing &rsaquo; plugin for links</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 [% IF ( fillinput ) %]
6     </head>
7
8 <body id="cat_marc21_linking_section" class="cat" style="padding:1em;">
9 <h3>MARC21 Plugin to build links between records</h3>
10 [% ELSE %]
11     </head>
12
13 <body id="cat_marc21_linking_section" class="cat" style="padding:1em;">
14 <h3>Plugin to build links between records</h3>
15     [% IF ( Search ) %]
16             <div id="MARC21_Linking_section_search">
17                <h2>Search for</h2>
18             <form name="f" method="post" action="/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl">
19
20                      <p>
21                             <input type="hidden" name="plugin_name" value="marc21_linking_section.pl" />
22                            <input type="hidden" name="index" value="[% index %]" />
23                                <input type="hidden" name="result" value="marc12 field 7 [% index %]" />
24                                <input type="hidden" name="op" value="do_search" />
25                             <label class="label100" for="searchbox">Any word</label>
26                                <input type="text" name="search" id="searchbox" size="35" /><br />
27                              <label for="itypeloop">Item type</label>
28                                <select name="itype" id="itypeloop">
29                            <option value="" selected="selected">All Item Types</option>
30                                [% FOREACH itypeloo IN itypeloop %]
31                              <option value="[% itypeloo.itemtype %]">[% itypeloo.description %]</option>
32                               [% END %]
33                               </select>
34                       </p>
35                    <p>
36                             <input type="submit" value="Start search" />
37                    </p>
38
39             </form>
40         </div>
41
42        [% ELSE %]
43
44
45            <h2>Search results</h2>
46                 <div id="MARC21_Linking_section__resultnumber">
47                         <p>[% IF ( displayprev ) %] <a class="resultnumber" href="/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&amp;index=[% index %]&amp;startfrom=[% startfromprev %]&amp;search=[% search %]&amp;resultsperpage=[% resultsperpage %]&amp;type=intranet&amp;op=do_search">&lt;&lt; Previous</a>[% END %]
48                               [% FOREACH number IN numbers %]
49                                 [% IF ( number.highlight ) %] <span class="highlight">[% number.number %]</span>
50                                 [% ELSE %] <a class="resultnumber" href="/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&amp;index=[% index %]&amp;startfrom=[% number.startfrom %]&amp;search=[% number.search |url %]&amp;resultsperpage=[% number.resultsperpage %]&amp;type=intranet&amp;op=do_search">[% number.number %]</a>
51                                 [% END %]
52                                 [% END %]
53                                 [% IF ( displaynext ) %]
54                                   <a class="resultnumber" href="/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&amp;index=[% index %]&amp;startfrom=[% startfromnext %]&amp;search=[% search %]&amp;resultsperpage=[% resultsperpage %]&amp;type=intranet&amp;op=do_search">Next&gt;&gt;</a>
55                                 [% END %]</p>
56                   <p class="resultcount">
57                           [% IF ( total ) %]Results [% from %] to [% to %] of [% total %]
58                           [% ELSE %]No results found
59                           [% END %]</p></div>
60             <div id="resultlist">
61                   <table>
62                                 <tr>
63                                    <th>Concise description</th>
64                                    <th>&nbsp;</th>
65                                 </tr>
66                           [% FOREACH resul IN result %]
67                           [% IF ( resul.title ) %]
68                                <tr>
69                                     [% IF ( resul.even ) %]<td class="hilighted">
70                                     [% ELSE %]<td>[% END %]
71                                                             [% IF ( resul.MARC_ON ) %]
72                                                                     <a class="transparent resultlist" href="/cgi-bin/koha/MARCdetail.pl?biblionumber=[% resul.biblionumber |url %]">[% resul.title |html %]</a>
73                                                             [% ELSE %]
74                                                                     <a class="transparent resultlist" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% resul.biblionumber |url %]">[% resul.title |html %]</a>
75                                                             [% END %]
76                                                     <p>[% resul.author %]
77                                                     [% IF ( resul.publishercode ) %]- [% resul.publishercode %][% END %]
78                                                     [% IF ( resul.place ) %] ; [% resul.place %][% END %]
79                                                     [% IF ( resul.pages ) %] - [% resul.pages %][% END %]
80                                                     [% IF ( resul.notes ) %] : [% resul.notes %][% END %]
81                                                     [% IF ( resul.size ) %] ; [% resul.size %][% END %]
82                                             </p>
83                                   </td>
84
85                                  <td>
86                       [% IF ( resul.biblionumber ) %]
87                                              <a href="javascript:jumpfull('/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&amp;index=[% index %]&amp;biblionumber=[% resul.biblionumber %]&amp;type=intranet&amp;op=fillinput')">Choose</a>
88                       [% ELSE %]
89                                              <a href="javascript:jumpfull('/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&amp;index=[% index %]&amp;type=intranet&amp;op=fillinput')">Clear field</a>
90                       [% END %]
91                                    </td>
92                           </tr>
93                           [% END %]
94                               [% END %]
95                       </table>
96                </div>
97          <div id="resultnumber">
98                         <p>
99                             [% IF ( displayprev ) %]
100                                <a class="resultnumber" href="/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&amp;amp;index=[% index %]&amp;amp;startfrom=[% startfromprev %]&amp;amp;search=[% search |url %]&amp;amp;resultsperpage=[% resultsperpage %]&amp;amp;type=intranet&amp;amp;op=do_search">
101                                      &lt;&lt; Previous
102                               </a>
103                            [% END %]
104
105                              [% FOREACH number IN numbers %]
106                                         [% IF ( number.highlight ) %]
107                                           <span class="highlight">
108                                                        [% number.number %]
109                                             </span>
110                                         [% ELSE %]
111                                              <a class="resultnumber" href="/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&amp;index=[% index %]&amp;startfrom=[% number.startfrom %]&amp;search=[% number.search %]&amp;resultsperpage=[% number.resultsperpage %]&amp;type=intranet&amp;op=do_search">
112                                                  [% number.number %]
113                                             </a>
114                                    [% END %]
115                               [% END %]
116
117                              [% IF ( displaynext ) %]
118                                <a class="resultnumber" href="/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&amp;index=[% index %]&amp;startfrom=[% startfromnext %]&amp;search=[% search %]&amp;resultsperpage=[% resultsperpage %]&amp;type=intranet&amp;op=do_search">
119                                   Next&gt;&gt;
120                            </a>
121                            [% END %]
122                       </p>
123            </div>
124     [% END %]
125
126 [% END %]
127
128 [% MACRO jsinclude BLOCK %]
129     [% IF ( fillinput ) %]
130         <script type="text/javascript">
131             function go() {
132
133                 var index_start = "[% index %]";
134                 var whichfield;
135                 try {
136                     whichfield = opener.opener.document.getElementById(index_start);
137                 } catch (e) {
138                     return;
139                 }
140
141                 // browse all its subfields
142
143                 var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input');
144
145                 var re = /^tag_\d*_code_/;
146                 for (var i = 0, len = subfields.length; i < len; i++) {
147                     if (subfields[i].getAttribute('name').match(re)) { // it s a subfield
148                         var code = subfields[i];
149                         var subfield = subfields[i + 1];
150
151                         if (code.value == '9') {
152                             subfield.value = "[% subfield_value_9 %]";
153                         }
154                         if (code.value == '0') {
155                             subfield.value = "[% subfield_value_0 %]";
156                         }
157                         if (code.value == 'a') {
158                             subfield.value = "[% subfield_value_a %]";
159                         }
160                         if (code.value == 'c') {
161                             subfield.value = "[% subfield_value_c %]";
162                         }
163                         if (code.value == 'd') {
164                             subfield.value = "[% subfield_value_d %]";
165                         }
166                         if (code.value == 'e') {
167                             subfield.value = "[% subfield_value_e %]";
168                         }
169                         if (code.value == 'h') {
170                             subfield.value = "[% subfield_value_h %]";
171                         }
172                         if (code.value == 'i') {
173                             subfield.value = "[% subfield_value_i %]";
174                         }
175                         if (code.value == 'p') {
176                             subfield.value = "[% subfield_value_p %]";
177                         }
178                         if (code.value == 't') {
179                             subfield.value = "[% subfield_value_t %]";
180                         }
181                         if (code.value == 'u') {
182                             subfield.value = "[% subfield_value_u %]";
183                         }
184                         if (code.value == 'v') {
185                             subfield.value = "[% subfield_value_v %]";
186                         }
187                         if (code.value == 'w') {
188                             subfield.value = "[% subfield_value_w %]";
189                         }
190                         if (code.value == 'x') {
191                             subfield.value = "[% subfield_value_x %]";
192                         }
193                         if (code.value == 'y') {
194                             subfield.value = "[% subfield_value_y %]";
195                         }
196                         if (code.value == 'z') {
197                             subfield.value = "[% subfield_value_z %]";
198                         }
199                     }
200                 }
201                 return false;
202             }
203
204             window.onload = go();
205             opener.close();
206             window.close();
207         </script>
208     [% ELSE %]
209         <script type="text/javascript">
210             function report(value2report) {
211                 if (document.f_pop.result.value.length == 0) {
212                     document.f_pop.result.value = value2report;
213                 } else {
214                     document.f_pop.result.value = document.f_pop.result.value + '|' + value2report;
215                 }
216                 return true;
217             }
218
219             function finish() {
220                 opener.document.f.field_value[[ % index % ]].value = document.f_pop.result.value;
221                 self.close();
222                 return false;
223             }
224         </script>
225     [% END %]
226     <script type="text/javascript">
227         function jumpfull(page){
228             window.open(page,'','width=100,height=100,toolbar=false,scrollbars=yes');
229         }
230     </script>
231 [% END %]
232
233 [% INCLUDE 'intranet-bottom.inc' popup_window=1 %]