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