Bug 29602: Surround strings with span tag
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / didyoumean.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% BLOCK pluginlist %]
5 <div class="pluginlist">
6 [% FOREACH plugin IN plugins %]
7     <div class="plugin">
8         <div class="pluginname">
9             [% 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 %]
10             <label class='pluginlabel' for="checkbox_[% type | html %][% plugin.name | html %]">[% plugin.name | html %]</label></div>
11         <div class="plugindesc">
12         [% SWITCH plugin.name %]
13         [% CASE 'AuthorityFile' %]
14             <span>Suggest authorities which are relevant to the term the user searched for.</span>
15         [% CASE 'ExplodedTerms' %]
16             <span>Suggest that patrons expand their searches to include broader/narrower/related terms.</span>
17         [% CASE 'LibrisSpellcheck' %]
18             <span>Use the LIBRIS spellcheck API.</span>
19         [% END %]
20         </div>
21     </div>
22 [% END %]
23 </div>
24 [% END %]
25 [% INCLUDE 'doc-head-open.inc' %]
26 <title>Did you mean? &rsaquo; Administration &rsaquo; Koha</title>
27 [% INCLUDE 'doc-head-close.inc' %]
28 </head>
29
30 <body id="admin_didyoumean" class="admin">
31 [% INCLUDE 'header.inc' %]
32 [% INCLUDE 'prefs-admin-search.inc' %]
33
34 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
35     <ol>
36         <li>
37             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
38         </li>
39         <li>
40             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
41         </li>
42         <li>
43             <a href="#" aria-current="page">
44                 Did you mean?
45             </a>
46         </li>
47     </ol>
48 </nav>
49
50 <div class="main container-fluid">
51     <div class="row">
52         <div class="col-sm-10 col-sm-push-2">
53             <main>
54
55         <h3>Did you mean?</h3>
56         <noscript><div class="dialog alert"><strong>Please enable Javascript:</strong>
57             Configuring 'Did you mean?' plugins requires Javascript. If
58             you are unable to use Javascript, you may be able to enter the
59             configuration (which is stored in JSON in the OPACdidyoumean system preferences)
60             in the Local preferences tab in
61             the system preference editor, but this is unsupported, not
62             recommended, and likely will not work.</div></noscript>
63         <div id="didyoumeanlegend">
64             Please put the 'Did you mean?' plugins in order by significance, from
65             most significant to least significant, and check the box to enable those
66             plugins that you want to use.
67         </div>
68         <form action="/cgi-bin/koha/admin/didyoumean.pl" method="post">
69             <fieldset id="didyoumeanopac">
70                 <legend>OPAC</legend>
71                 [% PROCESS pluginlist plugins=OPACpluginlist type='opac' %]
72             </fieldset>
73             <fieldset class="action"><button class="save-all submit" type="submit">Save configuration</button> <a href="/cgi-bin/koha/admin/didyoumean.pl" class="force_reload cancel">Cancel</a></fieldset>
74         </form>
75
76             </main>
77         </div> <!-- /.col-sm-10.col-sm-push-2 -->
78
79         <div class="col-sm-2 col-sm-pull-10">
80             <aside>
81                 [% INCLUDE 'admin-menu.inc' %]
82             </aside>
83         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
84      </div> <!-- /.row -->
85
86 [% MACRO jsinclude BLOCK %]
87     [% Asset.js("js/admin-menu.js") | $raw %]
88     <script>
89         $(document).ready(function() {
90             $( ".pluginlist" ).sortable();
91             $( ".plugin" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
92                 .find( ".pluginname" )
93                         .addClass( "ui-widget-header ui-corner-all" )
94                         .end()
95                 .find( ".plugindesc" );
96             $(".save-all").on("click",function(e){
97                 e.preventDefault();
98                 yesimeant();
99             });
100             $(".force_reload").on("click",function(e){
101                 e.preventDefault();
102                 window.location.reload(true);
103             });
104         });
105
106         function yesimeant() {
107             var OPACdidyoumean = serialize_plugins('opac');
108
109             var data = "pref_OPACdidyoumean=" + encodeURIComponent(OPACdidyoumean);
110
111             $.ajax({
112                 data: data,
113                 type: 'POST',
114                 url: '/cgi-bin/koha/svc/config/systempreferences/',
115                 success: function () { alert(_("Successfully saved configuration")); },
116             });
117             return false;
118         }
119
120         function serialize_plugins(interface) {
121             var serializedconfig = '[';
122             $('#didyoumean' + interface + ' .pluginlist .plugin').each(function(index) {
123                 var name = $(this).find('.pluginlabel').text();
124                 var enabled = $(this).find('input:checkbox:checked').length ?
125                               ', "enabled": 1' : '';
126                 serializedconfig += '{ "name": "' + name + '"' + enabled + '}, ';
127                 });
128                 serializedconfig = serializedconfig.substring(0, serializedconfig.length - 2);
129                 serializedconfig += ']';
130                 return serializedconfig;
131         }
132     </script>
133 [% END %]
134 [% INCLUDE 'intranet-bottom.inc' %]