Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/solr/indexes.tt
Jonathan Druart a281ac8df5 Bug 8385: Dirty patch to make tt_valid.t happy
A problem in routine text_replace_tag (tmpl_process3.pl) have to be
fixed to prevent this kind of patch :)

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-08-03 11:44:59 +02:00

222 lines
9.2 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Solr config</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/tablednd.js"></script>
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.textarea-expander.js"></script>
<script type="text/javascript" language="javascript">
function clean_line( line ) {
$(line).find('input[type="text"]').val("");
$(line).find('input[type="checkbox"]').attr("checked", false);
$(line).find('textarea').val("");
$(line).find('select').find('option:first').attr("selected", "selected");
}
function clone_line( line ) {
var new_line = $(line).clone();
$(new_line).removeClass("nodrag nodrop");
$(new_line).find('td:last-child>a').removeClass("add").addClass("delete").html(_("Delete"));
$(new_line).find('[data-id]').each( function() {
$(this).attr({ name: $(this).attr('data-id') }).removeAttr('data-id');
} );
$(new_line).find("select").each( function() {
var attr = $(this).attr('name');
var val = $(line).find('[data-id="' + attr + '"]').val();
$(this).find('option[value="' + val + '"]').attr("selected", "selected");
} );
return new_line;
}
$(document).ready(function() {
$('.delete').click(function() {
$(this).parents('tr').remove();
});
$(".indexes").tableDnD( {
onDragClass: "dragClass",
} );
$("textarea").TextAreaExpander();
$('.add').click(function() {
var table = $(this).closest('table');
var ressource_type = $(table).attr('data-ressource_type');
var code = $(table).find('input[data-id="code"]').val();
var label = $(table).find('input[data-id="label"]').val();
if ( code.length > 0 && label.length > 0 ) {
var line = $(this).closest("tr");
var mappings = $(line).find('textarea').val();
var new_line = clone_line( line );
$(new_line).find('textarea').val(mappings);
$(new_line).find("input:checkbox").val(code);
new_line.appendTo($('table[data-ressource_type="'+ressource_type+'"]>tbody'));
$('.delete').click(function() {
$(this).parents('tr').remove();
});
clean_line(line);
$(table).tableDnD( {
onDragClass: "dragClass",
} );
}
});
});
</script>
</head>
<body id="admin_searchengine_indexes" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<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>
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<h1>Search engine configuration</h1>
<div class="warning">
Warning: Any modification in these configurations will need a total reindexation to be fully taken into account !
</div>
[% IF ( errors ) %]
<div class="error">
Errors occurred, Modifications does not apply. Please check following values:
<ul>
[% FOREACH e IN errors %]
<li>
[% IF ( e.type == "malformed_mapping" ) %]
The value "[% e.value %]" is not supported for mappings
[% ELSIF ( e.type == "no_mapping" ) %]
There is no mapping for the index [% e.value %]
[% END %]
</li>
[% END %]
</ul>
</div>
[% END %]
<form method="post">
<input type="hidden" name="op" value="edit" />
[% FOREACH rt IN indexloop %]
<h2>[% rt.ressource_type %]</h2>
[% IF ( rt.ressource_type == 'authority' ) %]
This part is not yet implemented
[% END %]
<table id="pouet" class="indexes" data-ressource_type="[% rt.ressource_type %]">
<thead>
<tr class="nodrag nodrop">
<th>Code</th>
<th>Label</th>
<th>Type</th>
<th>Sortable</th>
<th>Facetable</th>
<th>Mapping</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH index IN rt.indexes %]
<tr>
<td>
[% IF ( index.mandatory ) %]
<input name="code" type="text" maxlength="25" value="[% index.code %]" disabled="disabled" />
<input name="code" type="hidden" maxlength="25" value="[% index.code %]" />
[% ELSE %]
<input name="code" type="text" maxlength="25" value="[% index.code %]" />
[% END %]
<input name="mandatory" type="hidden" maxlength="1" value="[% index.mandatory %]" />
<input name="ressource_type" type="hidden" value="[% index.ressource_type %]" />
</td>
<td><input name="label" type="text" maxlength="25" value="[% index.label %]" /></td>
<td>
[% IF ( index.mandatory ) %]
<input type="hidden" name="type" value="[% index.type %]" />
[% END %]
[% IF ( index.mandatory ) %]
<select name="type" disabled="disabled">
[% ELSE %]
<select name="type">
[% END %]
[% IF ( index.type == 'str' ) %]
<option value="str" selected="selected">String</option>
[% ELSE %]
<option value="str">String</option>
[% END %]
[% IF ( index.type == 'ste' ) %]
<option value="ste" selected="selected">Simple Text</option>
[% ELSE %]
<option value="ste">Simple Text</option>
[% END %]
[% IF ( index.type == 'txt' ) %]
<option value="txt" selected="selected">Text</option>
[% ELSE %]
<option value="txt">Text</option>
[% END %]
[% IF ( index.type == 'int' ) %]
<option value="int" selected="selected">Integer</option>
[% ELSE %]
<option value="int">Integer</option>
[% END %]
[% IF ( index.type == 'date' ) %]
<option value="date" selected="selected">Date</option>
[% ELSE %]
<option value="date">Date</option>
[% END %]
</select>
</td>
<td>
[% IF ( index.sortable ) %]
<input name="sortable" type="checkbox" checked="checked" value="[% index.code %]" />
[% ELSE %]
<input name="sortable" type="checkbox" value="[% index.code %]" />
[% END %]
</td>
<td>
[% IF ( index.facetable ) %]
<input name="facetable" type="checkbox" checked="checked" value="[% index.code %]" />
[% ELSE %]
<input name="facetable" type="checkbox" value="[% index.code %]" />
[% END %]
</td>
<td>
<textarea name="mappings" class="contentEditable">[% FOREACH m IN index.mappings %][% m %]
[% END %]</textarea> <!-- Don't indent this line -->
</td>
<td>[% UNLESS ( index.mandatory ) %]<a class="delete">Delete</a>[% END %]</td>
</tr>
[% END %]
</tbody>
<tfoot>
<tr class="nodrag nodrop">
<td>
<input data-id="code" type="text" maxlength="25" />
<input data-id="ressource_type" type="hidden" value="[% rt.ressource_type %]" />
<input data-id="mandatory" type="hidden" value="0" />
</td>
<td><input data-id="label" type="text" maxlength="25" /></td>
<td>
<select data-id="type">
<option value="str">String</option>
<option value="ste">Simple Text</option>
<option value="txt">Text</option>
<option value="int">Integer</option>
<option value="date">Date</option>
</select>
</td>
<td><input data-id="sortable" type="checkbox" /></td>
<td><input data-id="facetable" type="checkbox" /></td>
<td>
<textarea data-id="mappings" class="contentEditable"></textarea>
</td>
<td><a class="add">Add</a></td>
</tr>
</tfoot>
</table>
[% END %]
<p><input type="submit" value="Save" /></p>
</form>
</div>
</div>
<div class="yui-b">
[% INCLUDE 'admin-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]