Bug 32618: Add 'page-section' to various administration pages
[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
49         <div class="page-section">
50             <form action="/cgi-bin/koha/admin/oai_set_mappings.pl" method="post" id="mappingform">
51                 <table id="mappings">
52                     <thead>
53                         <tr>
54                         <th>Rule operator</th>
55                         <th>Field</th>
56                         <th>Subfield</th>
57                         <th>Operator</th>
58                         <th>Value</th>
59                         <th>&nbsp;</th>
60                         <th>&nbsp;</th>
61                         </tr>
62                     </thead>
63                     <tbody>
64                         [% IF ( mappings ) %]
65                             [% FOREACH mapping IN mappings %]
66                                 <tr>
67                                     <td>
68                                     <select name="rule_operator">
69                                         [% IF (mapping.rule_operator == 'and') %]
70                                         <option value="and" selected="selected">and</option>
71                                         [% ELSE %]
72                                         <option value="and">and</option>
73                                         [% END %]
74                                         [% IF (mapping.rule_operator == 'or') %]
75                                         <option value="or" selected="selected">or</option>
76                                         [% ELSE %]
77                                         <option value="or">or</option>
78                                         [% END %]
79                                     </select>
80                                     </td>
81                                     <td><input type="text" name="marcfield" size="3" value="[% mapping.marcfield | html %]" /></td>
82                                     <td><input type="text" name="marcsubfield" size="1" value="[% mapping.marcsubfield | html %]" /></td>
83                                     <td><select name=operator>
84                                         [% IF mapping.operator == 'equal' %]
85                                             <option value="equal" selected="selected">is equal to</option>
86                                             <option value="notequal">not equal to</option>
87                                         [% ELSE %]
88                                             <option value="equal">is equal to</option>
89                                             <option value="notequal" selected="selected">not equal to</option>
90                                         [% END %]
91                                         </select></td>
92                                     <td><input type="text" name="marcvalue" value="[% mapping.marcvalue | html %]" /></td>
93                                     <td>
94                                         [% IF ( loop.last ) %]
95                                             <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>
96                                         [% END %]
97                                     </td>
98                                     <td><button class="btn btn-default btn-xs clear-field" type="button"><i class="fa fa-trash"></i> Delete</button></td>
99                                 </tr>
100                             [% END %]
101                         [% ELSE %]
102                             <tr>
103                                 <td>
104                                     <select name="rule_operator">
105                                         [% IF (mapping.rule_operator == 'and') %]
106                                             <option value="and" selected="selected">and</option>
107                                         [% ELSE %]
108                                             <option value="and">and</option>
109                                         [% END %]
110                                         [% IF (mapping.rule_operator == 'or') %]
111                                             <option value="or" selected="selected">or</option>
112                                         [% ELSE %]
113                                             <option value="or">or</option>
114                                         [% END %]
115                                     </select>
116                                 </td>
117                                 <td><input type="text" name="marcfield" size="3" /></td>
118                                 <td><input type="text" name="marcsubfield" size="1" /></td>
119                                 <td><select name=operator>
120                                     <option value="equal">is equal to</option>
121                                     <option value="notequal">not equal to</option>
122                                     </select></td>
123                                 <td><input type="text" name="marcvalue" /></td>
124                                 <td>
125                                     <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>
126                                 </td>
127                                 <td><button class="btn btn-default btn-xs clear-field" type="button"><i class="fa fa-trash"></i> Delete</button></td>
128                             </tr>
129                         [% END %]
130                     </tbody>
131                 </table>
132                 <input type="hidden" name="id" value="[% id | html %]" />
133                 <input type="hidden" name="op" value="save" />
134                 <fieldset class="action">
135                     <input type="submit" class="btn btn-primary" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/oai_sets.pl">Cancel</a>
136                 </fieldset>
137             </form>
138         </div> <!-- /.page-section -->
139
140             </main>
141         </div> <!-- /.col-sm-10.col-sm-push-2 -->
142
143         <div class="col-sm-2 col-sm-pull-10">
144             <aside>
145                 [% INCLUDE 'admin-menu.inc' %]
146             </aside>
147         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
148      </div> <!-- /.row -->
149
150 [% MACRO jsinclude BLOCK %]
151     [% Asset.js("js/admin-menu.js") | $raw %]
152     <script>
153         $(document).ready(function() {
154             $("#mappingform").submit(function(){
155               hideDialogBox();
156             });
157             $("body").on("click","#new_rule_button", function(e){
158                 e.preventDefault();
159                 newCondition();
160             });
161             $("body").on("click",".clear-field",function(e){
162                 e.preventDefault();
163                 clearRow(e.target);
164             });
165             $("#mappings tbody tr:first-child td:first-child select").hide();
166         });
167
168         function newCondition() {
169             var tr = $('#new_rule_button').parents('tr');
170             var clone = $(tr).clone();
171             $("#new_rule_button").parent('td').find("#new_rule_button").remove();
172             $(clone).find("select").show();
173             $(tr).parent('tbody').append(clone);
174         }
175         function clearRow(link){
176             var tr = $(link).parent().parent();
177             var found = tr.find('#new_rule_button');
178             if( found.length ){
179               tr.find('input[type="text"]').attr("value","");
180             } else {
181               tr.remove();
182             }
183             $("#mappings tbody tr:first-child td:first-child select").hide();
184         }
185         function hideDialogBox() {
186             $('div.dialog').remove();
187         }
188     </script>
189 [% END %]
190 [% INCLUDE 'intranet-bottom.inc' %]