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