Bug 8385: Dirty patch to make tt_valid.t happy
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / searchengine / solr / indexes.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Solr config</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/tablednd.js"></script>
5 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.textarea-expander.js"></script>
6 <script type="text/javascript" language="javascript">
7     function clean_line( line ) {
8         $(line).find('input[type="text"]').val("");
9         $(line).find('input[type="checkbox"]').attr("checked", false);
10         $(line).find('textarea').val("");
11         $(line).find('select').find('option:first').attr("selected", "selected");
12     }
13
14     function clone_line( line ) {
15         var new_line = $(line).clone();
16         $(new_line).removeClass("nodrag nodrop");
17         $(new_line).find('td:last-child>a').removeClass("add").addClass("delete").html(_("Delete"));
18         $(new_line).find('[data-id]').each( function() {
19             $(this).attr({ name: $(this).attr('data-id') }).removeAttr('data-id');
20         } );
21         $(new_line).find("select").each( function() {
22             var attr = $(this).attr('name');
23             var val = $(line).find('[data-id="' + attr + '"]').val();
24             $(this).find('option[value="' + val + '"]').attr("selected", "selected");
25         } );
26         return new_line;
27     }
28
29     $(document).ready(function() {
30         $('.delete').click(function() {
31             $(this).parents('tr').remove();
32         });
33
34         $(".indexes").tableDnD( {
35             onDragClass: "dragClass",
36         } );
37         $("textarea").TextAreaExpander();
38         $('.add').click(function() {
39             var table = $(this).closest('table');
40             var ressource_type  = $(table).attr('data-ressource_type');
41             var code            = $(table).find('input[data-id="code"]').val();
42             var label           = $(table).find('input[data-id="label"]').val();
43             if ( code.length > 0 && label.length > 0 ) {
44                 var line = $(this).closest("tr");
45                 var mappings = $(line).find('textarea').val();
46                 var new_line = clone_line( line );
47                 $(new_line).find('textarea').val(mappings);
48                 $(new_line).find("input:checkbox").val(code);
49                 new_line.appendTo($('table[data-ressource_type="'+ressource_type+'"]>tbody'));
50                 $('.delete').click(function() {
51                     $(this).parents('tr').remove();
52                 });
53                 clean_line(line);
54
55                 $(table).tableDnD( {
56                     onDragClass: "dragClass",
57                 } );
58             }
59         });
60     });
61 </script>
62 </head>
63 <body id="admin_searchengine_indexes" class="admin">
64 [% INCLUDE 'header.inc' %]
65 [% INCLUDE 'cat-search.inc' %]
66
67 <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; Search engine configuration</div>
68
69 <div id="doc3" class="yui-t1">
70
71   <div id="bd">
72     <div id="yui-main">
73     <div class="yui-b">
74     <h1>Search engine configuration</h1>
75     <div class="warning">
76         Warning: Any modification in these configurations will need a total reindexation to be fully taken into account !
77     </div>
78     [% IF ( errors ) %]
79         <div class="error">
80         Errors occurred, Modifications does not apply. Please check following values:
81           <ul>
82             [% FOREACH e IN errors %]
83                 <li>
84                     [% IF ( e.type == "malformed_mapping" ) %]
85                         The value "[% e.value %]" is not supported for mappings
86                     [% ELSIF ( e.type == "no_mapping" ) %]
87                         There is no mapping for the index [% e.value %]
88                     [% END %]
89                 </li>
90             [% END %]
91           </ul>
92         </div>
93     [% END %]
94
95     <form method="post">
96       <input type="hidden" name="op" value="edit" />
97       [% FOREACH rt IN indexloop %]
98         <h2>[% rt.ressource_type %]</h2>
99         [% IF ( rt.ressource_type == 'authority' ) %]
100             This part is not yet implemented
101         [% END %]
102         <table id="pouet" class="indexes" data-ressource_type="[% rt.ressource_type %]">
103           <thead>
104             <tr class="nodrag nodrop">
105               <th>Code</th>
106               <th>Label</th>
107               <th>Type</th>
108               <th>Sortable</th>
109               <th>Facetable</th>
110               <th>Mapping</th>
111               <th></th>
112             </tr>
113           </thead>
114           <tbody>
115             [% FOREACH index IN rt.indexes %]
116               <tr>
117                 <td>
118                   [% IF ( index.mandatory ) %]
119                     <input name="code" type="text" maxlength="25" value="[% index.code %]" disabled="disabled" />
120                     <input name="code" type="hidden" maxlength="25" value="[% index.code %]" />
121                   [% ELSE %]
122                     <input name="code" type="text" maxlength="25" value="[% index.code %]" />
123                   [% END %]
124                   <input name="mandatory" type="hidden" maxlength="1" value="[% index.mandatory %]" />
125                   <input name="ressource_type" type="hidden" value="[% index.ressource_type %]" />
126                 </td>
127                 <td><input name="label" type="text" maxlength="25" value="[% index.label %]" /></td>
128                 <td>
129                   [% IF ( index.mandatory ) %]
130                     <input type="hidden" name="type" value="[% index.type %]" />
131                   [% END %]
132                   [% IF ( index.mandatory ) %]
133                     <select name="type" disabled="disabled">
134                   [% ELSE %]
135                     <select name="type">
136                   [% END %]
137                     [% IF ( index.type == 'str' ) %]
138                         <option value="str" selected="selected">String</option>
139                     [% ELSE %]
140                         <option value="str">String</option>
141                     [% END %]
142                     [% IF ( index.type == 'ste' ) %]
143                         <option value="ste" selected="selected">Simple Text</option>
144                     [% ELSE %]
145                         <option value="ste">Simple Text</option>
146                     [% END %]
147                     [% IF ( index.type == 'txt' ) %]
148                         <option value="txt" selected="selected">Text</option>
149                     [% ELSE %]
150                         <option value="txt">Text</option>
151                     [% END %]
152                     [% IF ( index.type == 'int' ) %]
153                         <option value="int" selected="selected">Integer</option>
154                     [% ELSE %]
155                         <option value="int">Integer</option>
156                     [% END %]
157                     [% IF ( index.type == 'date' ) %]
158                         <option value="date" selected="selected">Date</option>
159                     [% ELSE %]
160                         <option value="date">Date</option>
161                     [% END %]
162                   </select>
163                 </td>
164                 <td>
165                   [% IF ( index.sortable ) %]
166                     <input name="sortable" type="checkbox" checked="checked" value="[% index.code %]" />
167                   [% ELSE %]
168                     <input name="sortable" type="checkbox" value="[% index.code %]" />
169                   [% END %]
170                 </td>
171                 <td>
172                   [% IF ( index.facetable ) %]
173                     <input name="facetable" type="checkbox" checked="checked" value="[% index.code %]" />
174                   [% ELSE %]
175                     <input name="facetable" type="checkbox" value="[% index.code %]" />
176                   [% END %]
177                 </td>
178                 <td>
179                     <textarea name="mappings" class="contentEditable">[% FOREACH m IN index.mappings %][% m %]
180 [% END %]</textarea> <!-- Don't indent this line -->
181                 </td>
182                 <td>[% UNLESS ( index.mandatory ) %]<a class="delete">Delete</a>[% END %]</td>
183               </tr>
184               [% END %]
185           </tbody>
186           <tfoot>
187             <tr class="nodrag nodrop">
188               <td>
189                 <input data-id="code" type="text" maxlength="25" />
190                 <input data-id="ressource_type" type="hidden" value="[% rt.ressource_type %]" />
191                 <input data-id="mandatory" type="hidden" value="0" />
192               </td>
193               <td><input data-id="label" type="text" maxlength="25" /></td>
194               <td>
195                 <select data-id="type">
196                   <option value="str">String</option>
197                   <option value="ste">Simple Text</option>
198                   <option value="txt">Text</option>
199                   <option value="int">Integer</option>
200                   <option value="date">Date</option>
201                 </select>
202               </td>
203               <td><input data-id="sortable" type="checkbox" /></td>
204               <td><input data-id="facetable" type="checkbox" /></td>
205               <td>
206                 <textarea data-id="mappings" class="contentEditable"></textarea>
207               </td>
208               <td><a class="add">Add</a></td>
209             </tr>
210           </tfoot>
211         </table>
212       [% END %]
213       <p><input type="submit" value="Save" /></p>
214     </form>
215 </div>
216
217 </div>
218 <div class="yui-b">
219 [% INCLUDE 'admin-menu.inc' %]
220 </div>
221 </div>
222 [% INCLUDE 'intranet-bottom.inc' %]