Bug 11877 - Eliminate use of deprecated jQuery .live() method
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / oai_set_mappings.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; OAI sets &rsaquo; OAI set mappings</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript">
5 //<![CDATA[
6 $(document).ready(function() {
7     $("#mappingform").submit(function(){
8       hideDialogBox();
9     });
10     $("body").on("click","#ORbutton", function(e){
11         e.preventDefault();
12         newCondition();
13     });
14     $("body").on("click",".clear-field",function(e){
15         e.preventDefault();
16         clearRow(e.target);
17     });
18 });
19
20 function newCondition() {
21     var tr = $('#ORbutton').parents('tr');
22     var clone = $(tr).clone();
23     $("#ORbutton").parent('td').replaceWith('<td style="text-align:center">OR</td>');
24     $(tr).parent('tbody').append(clone);
25 }
26 function clearRow(link){
27     var tr = $(link).parent().parent();
28     var found = tr.find('#ORbutton');
29     if( found.length ){
30       tr.find('input[type="text"]').attr("value","");
31     } else {
32       tr.find('input[type="text"]').attr("value","").end().hide();
33     }
34 }
35 function hideDialogBox() {
36     $('div.dialog').remove();
37 }
38 //]]>
39 </script>
40 </head>
41
42 <body id="admin_oai_set_mappings" class="admin">
43 [% INCLUDE 'header.inc' %]
44 [% INCLUDE 'cat-search.inc' %]
45
46 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <a href="/cgi-bin/koha/admin/oai_sets.pl">OAI sets configuration</a> &rsaquo; <a href="/cgi-bin/koha/admin/oai_set_mappings.pl?id=[% id %]">OAI set mappings</a></div>
47
48 <div id="doc3" class="yui-t2">
49
50 <div id="bd">
51   <div id="yui-main">
52     <div class="yui-b">
53       [% IF ( mappings_saved ) %]
54         <div class="dialog message">
55           <h4>Mappings have been saved</h4>
56           <p><a href="/cgi-bin/koha/admin/oai_sets.pl">Return to sets management</a></p>
57         </div>
58       [% END %]
59       <h1>Mappings for set '[% setName %]' ([% setSpec %])</h1>
60       [% UNLESS ( mappings ) %]
61         <div class="dialog alert"><p><strong>Warning:</strong> No mappings have been defined for this set</p></div>
62       [% END %]
63       <form action="/cgi-bin/koha/admin/oai_set_mappings.pl" method="post" id="mappingform">
64         <table id="mappings">
65           <thead>
66             <tr>
67               <th>Field</th>
68               <th>Subfield</th>
69               <th>Operator</th>
70               <th>Value</th>
71               <th>&nbsp;</th>
72               <th>&nbsp;</th>
73             </tr>
74           </thead>
75           <tbody>
76             [% IF ( mappings ) %]
77               [% FOREACH mapping IN mappings %]
78                 <tr>
79                   <td><input type="text" name="marcfield" size="3" value="[% mapping.marcfield %]" /></td>
80                   <td style="text-align:center"><input type="text" name="marcsubfield" size="1" value="[% mapping.marcsubfield %]" /></td>
81                   <td><select name=operator>
82                       [% IF mapping.operator == 'equal' %]
83                         <option selected value="equal">is equal to</option>
84                         <option value="notequal">not equal to</option>
85                       [% ELSE %]
86                         <option value="equal">is equal to</option>
87                         <option selected value="notequal">not equal to</option>
88                       [% END %]
89                       </select></td>
90                   <td><input type="text" name="marcvalue" value="[% mapping.marcvalue %]" /></td>
91                   <td style="text-align:center">
92                     [% IF ( loop.last ) %]
93                       <input type="button" id="ORbutton" value="OR" title="Add another condition" />
94                     [% ELSE %]
95                       OR
96                     [% END %]
97                   </td>
98                   <td><a class="clear-field" href="#">Delete</a></td>
99                 </tr>
100               [% END %]
101             [% ELSE %]
102               <tr>
103                 <td><input type="text" name="marcfield" size="3" /></td>
104                 <td style="text-align:center"><input type="text" name="marcsubfield" size="1" /></td>
105                 <td><select name=operator>
106                     <option value="equal">is equal to</option>
107                     <option value="notequal">not equal to</option>
108                     </select></td>
109                 <td><input type="text" name="marcvalue" /></td>
110                 <td><input type="button" id="ORbutton" value="OR" /></td>
111                 <td><a class="clear-field" href="#">Delete</a></td>
112               </tr>
113             [% END %]
114           </tbody>
115         </table>
116         <input type="hidden" name="id" value="[% id %]" />
117         <input type="hidden" name="op" value="save" />
118         <fieldset class="action">
119             <input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/oai_sets.pl">Cancel</a>
120         </fieldset>
121       </form>
122
123     </div>
124   </div>
125   <div class="yui-b">
126     [% INCLUDE 'admin-menu.inc' %]
127   </div>
128 </div>
129 [% INCLUDE 'intranet-bottom.inc' %]