Jonathan Druart
ea91896f15
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
141 lines
5.5 KiB
Text
141 lines
5.5 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% PROCESS 'i18n.inc' %]
|
|
[% USE Koha %]
|
|
[% SET footerjs = 1 %]
|
|
[% BLOCK pluginlist %]
|
|
<div class="pluginlist">
|
|
[% FOREACH plugin IN plugins %]
|
|
<div class="plugin">
|
|
<div class="pluginname">
|
|
[% IF plugin.enabled %]<input type="checkbox" checked="checked" id="checkbox_[% type | html %][% plugin.name | html %]">[% ELSE %]<input type="checkbox" id="checkbox_[% type | html %][% plugin.name | html %]">[% END %]
|
|
<label class='pluginlabel' for="checkbox_[% type | html %][% plugin.name | html %]">[% plugin.name | html %]</label></div>
|
|
<div class="plugindesc">
|
|
[% SWITCH plugin.name %]
|
|
[% CASE 'AuthorityFile' %]
|
|
<span>Suggest authorities which are relevant to the term the user searched for.</span>
|
|
[% CASE 'ExplodedTerms' %]
|
|
<span>Suggest that patrons expand their searches to include broader/narrower/related terms.</span>
|
|
[% CASE 'LibrisSpellcheck' %]
|
|
<span>Use the LIBRIS spellcheck API.</span>
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>[% FILTER collapse %]
|
|
[% t("Did you mean?") | html %] ›
|
|
[% t("Administration") | html %] ›
|
|
[% t("Koha") | html %]
|
|
[% END %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="admin_didyoumean" class="admin">
|
|
[% WRAPPER 'header.inc' %]
|
|
[% INCLUDE 'prefs-admin-search.inc' %]
|
|
[% END %]
|
|
|
|
[% WRAPPER 'sub-header.inc' %]
|
|
[% WRAPPER breadcrumbs %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
|
|
[% END %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
<span>Did you mean?</span>
|
|
[% END %]
|
|
[% END #/ WRAPPER breadcrumbs %]
|
|
[% END #/ WRAPPER sub-header.inc %]
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-10 col-sm-push-2">
|
|
<main>
|
|
|
|
<h1>Did you mean?</h1>
|
|
<noscript><div class="dialog alert"><strong>Please enable Javascript:</strong>
|
|
Configuring 'Did you mean?' plugins requires Javascript. If
|
|
you are unable to use Javascript, you may be able to enter the
|
|
configuration (which is stored in JSON in the OPACdidyoumean system preferences)
|
|
in the Local preferences tab in
|
|
the system preference editor, but this is unsupported, not
|
|
recommended, and likely will not work.</div></noscript>
|
|
<div id="didyoumeanlegend">
|
|
Please put the 'Did you mean?' plugins in order by significance, from
|
|
most significant to least significant, and check the box to enable those
|
|
plugins that you want to use.
|
|
</div>
|
|
<form action="/cgi-bin/koha/admin/didyoumean.pl" method="post">
|
|
[% INCLUDE 'csrf-token.inc' %]
|
|
<fieldset id="didyoumeanopac">
|
|
<legend>OPAC</legend>
|
|
[% PROCESS pluginlist plugins=OPACpluginlist type='opac' %]
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<button class="save-all btn btn-primary" type="submit">Save configuration</button>
|
|
<a href="/cgi-bin/koha/admin/didyoumean.pl" class="force_reload cancel">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
|
|
</main>
|
|
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
|
|
|
<div class="col-sm-2 col-sm-pull-10">
|
|
<aside>
|
|
[% INCLUDE 'admin-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/admin-menu.js") | $raw %]
|
|
<script>
|
|
$(document).ready(function() {
|
|
$( ".pluginlist" ).sortable();
|
|
$( ".plugin" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
|
|
.find( ".pluginname" )
|
|
.addClass( "ui-widget-header ui-corner-all" )
|
|
.end()
|
|
.find( ".plugindesc" );
|
|
$(".save-all").on("click",function(e){
|
|
e.preventDefault();
|
|
yesimeant();
|
|
});
|
|
$(".force_reload").on("click",function(e){
|
|
e.preventDefault();
|
|
window.location.reload(true);
|
|
});
|
|
});
|
|
|
|
function yesimeant() {
|
|
var OPACdidyoumean = serialize_plugins('opac');
|
|
|
|
const csrf_token = "[% Koha.GenerateCSRF | $raw %]";
|
|
let data = "pref_OPACdidyoumean=%s&csrf_token=%s".format(encodeURIComponent(OPACdidyoumean), csrf_token);
|
|
|
|
$.ajax({
|
|
data: data,
|
|
type: 'POST',
|
|
url: '/cgi-bin/koha/svc/config/systempreferences/',
|
|
success: function () { alert(_("Successfully saved configuration")); },
|
|
});
|
|
return false;
|
|
}
|
|
|
|
function serialize_plugins(interface) {
|
|
var serializedconfig = '[';
|
|
$('#didyoumean' + interface + ' .pluginlist .plugin').each(function(index) {
|
|
var name = $(this).find('.pluginlabel').text();
|
|
var enabled = $(this).find('input:checkbox:checked').length ?
|
|
', "enabled": 1' : '';
|
|
serializedconfig += '{ "name": "' + name + '"' + enabled + '}, ';
|
|
});
|
|
serializedconfig = serializedconfig.substring(0, serializedconfig.length - 2);
|
|
serializedconfig += ']';
|
|
return serializedconfig;
|
|
}
|
|
</script>
|
|
[% END %]
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|