Bug 27846: (follow-up) Add id back to breadcrumbs container
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / oai_set_mappings.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Administration &rsaquo; OAI sets &rsaquo; OAI set mappings</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 </head>
8
9 <body id="admin_oai_set_mappings" class="admin">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'prefs-admin-search.inc' %]
12
13 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
14     <ol>
15         <li>
16             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
17         </li>
18         <li>
19             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
20         </li>
21         <li>
22             <a href="/cgi-bin/koha/admin/oai_sets.pl">OAI sets configuration</a>
23         </li>
24         <li>
25             <a href="#" aria-current="page">OAI set mappings</a>
26         </li>
27     </ol>
28 </nav>
29
30 <div class="main container-fluid">
31     <div class="row">
32         <div class="col-sm-10 col-sm-push-2">
33             <main>
34
35       [% IF ( mappings_saved ) %]
36         <div class="dialog message">
37           <h4>Mappings have been saved</h4>
38           <p><a href="/cgi-bin/koha/admin/oai_sets.pl">Return to sets management</a></p>
39         </div>
40       [% END %]
41       <h1>Mappings for set '[% setName | html %]' ([% setSpec | html %])</h1>
42       [% UNLESS ( mappings ) %]
43         <div class="dialog alert"><p><strong>Warning:</strong> No mappings have been defined for this set</p></div>
44       [% END %]
45       <form action="/cgi-bin/koha/admin/oai_set_mappings.pl" method="post" id="mappingform">
46         <table id="mappings">
47           <thead>
48             <tr>
49               <th>Rule operator</th>
50               <th>Field</th>
51               <th>Subfield</th>
52               <th>Operator</th>
53               <th>Value</th>
54               <th>&nbsp;</th>
55               <th>&nbsp;</th>
56             </tr>
57           </thead>
58           <tbody>
59             [% IF ( mappings ) %]
60               [% FOREACH mapping IN mappings %]
61                 <tr>
62                   <td>
63                   <select name="rule_operator">
64                     [% IF (mapping.rule_operator == 'and') %]
65                     <option value="and" selected="selected">and</option>
66                     [% ELSE %]
67                     <option value="and">and</option>
68                     [% END %]
69                     [% IF (mapping.rule_operator == 'or') %]
70                     <option value="or" selected="selected">or</option>
71                     [% ELSE %]
72                     <option value="or">or</option>
73                     [% END %]
74                   </select>
75                   </td>
76                   <td><input type="text" name="marcfield" size="3" value="[% mapping.marcfield | html %]" /></td>
77                   <td><input type="text" name="marcsubfield" size="1" value="[% mapping.marcsubfield | html %]" /></td>
78                   <td><select name=operator>
79                       [% IF mapping.operator == 'equal' %]
80                         <option value="equal" selected="selected">is equal to</option>
81                         <option value="notequal">not equal to</option>
82                       [% ELSE %]
83                         <option value="equal">is equal to</option>
84                         <option value="notequal" selected="selected">not equal to</option>
85                       [% END %]
86                       </select></td>
87                   <td><input type="text" name="marcvalue" value="[% mapping.marcvalue | html %]" /></td>
88                   <td>
89                     [% IF ( loop.last ) %]
90                         <button type="button" id="new_rule_button" class="btn btn-default btn-xs" title="Add another condition"><i class="fa fa-plus"></i> Add</button>
91                     [% END %]
92                   </td>
93                   <td><button class="btn btn-default btn-xs clear-field" type="button"><i class="fa fa-trash"></i> Delete</button></td>
94                 </tr>
95               [% END %]
96             [% ELSE %]
97               <tr>
98                 <td>
99                   <select name="rule_operator">
100                     [% IF (mapping.rule_operator == 'and') %]
101                     <option value="and" selected="selected">and</option>
102                     [% ELSE %]
103                     <option value="and">and</option>
104                     [% END %]
105                     [% IF (mapping.rule_operator == 'or') %]
106                     <option value="or" selected="selected">or</option>
107                     [% ELSE %]
108                     <option value="or">or</option>
109                     [% END %]
110                   </select>
111                 </td>
112                 <td><input type="text" name="marcfield" size="3" /></td>
113                 <td><input type="text" name="marcsubfield" size="1" /></td>
114                 <td><select name=operator>
115                     <option value="equal">is equal to</option>
116                     <option value="notequal">not equal to</option>
117                     </select></td>
118                 <td><input type="text" name="marcvalue" /></td>
119                 <td>
120                     <button type="button" id="new_rule_button" class="btn btn-default btn-xs" title="Add another condition"><i class="fa fa-plus"></i> Add</button>
121                 </td>
122                 <td><button class="btn btn-default btn-xs clear-field" type="button"><i class="fa fa-trash"></i> Delete</button></td>
123               </tr>
124             [% END %]
125           </tbody>
126         </table>
127         <input type="hidden" name="id" value="[% id | html %]" />
128         <input type="hidden" name="op" value="save" />
129         <fieldset class="action">
130             <input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/oai_sets.pl">Cancel</a>
131         </fieldset>
132       </form>
133
134             </main>
135         </div> <!-- /.col-sm-10.col-sm-push-2 -->
136
137         <div class="col-sm-2 col-sm-pull-10">
138             <aside>
139                 [% INCLUDE 'admin-menu.inc' %]
140             </aside>
141         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
142      </div> <!-- /.row -->
143
144 [% MACRO jsinclude BLOCK %]
145     [% Asset.js("js/admin-menu.js") | $raw %]
146     <script>
147         $(document).ready(function() {
148             $("#mappingform").submit(function(){
149               hideDialogBox();
150             });
151             $("body").on("click","#new_rule_button", function(e){
152                 e.preventDefault();
153                 newCondition();
154             });
155             $("body").on("click",".clear-field",function(e){
156                 e.preventDefault();
157                 clearRow(e.target);
158             });
159             $("#mappings tbody tr:first-child td:first-child select").hide();
160         });
161
162         function newCondition() {
163             var tr = $('#new_rule_button').parents('tr');
164             var clone = $(tr).clone();
165             $("#new_rule_button").parent('td').find("#new_rule_button").remove();
166             $(clone).find("select").show();
167             $(tr).parent('tbody').append(clone);
168         }
169         function clearRow(link){
170             var tr = $(link).parent().parent();
171             var found = tr.find('#new_rule_button');
172             if( found.length ){
173               tr.find('input[type="text"]').attr("value","");
174             } else {
175               tr.remove();
176             }
177             $("#mappings tbody tr:first-child td:first-child select").hide();
178         }
179         function hideDialogBox() {
180             $('div.dialog').remove();
181         }
182     </script>
183 [% END %]
184 [% INCLUDE 'intranet-bottom.inc' %]