Bug 8726 follow-up: fix QA issues
Fixes several perlcritic complaints, and some overflow in the configuration page. Also notes that Did You Mean is not yet enabled on the staff client. Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> Sorry about the problematic last attempt at uploading. I missed a patch when squashing. It is now included.
This commit is contained in:
parent
ef87bb0a81
commit
52f54eec1d
|
|
@ -34,9 +34,9 @@ B<get_suggestions (\%param)> - get suggestions for the search described
|
|||
in $param->{'search'}, and return them in a hashref with the suggestions
|
||||
as keys and relevance as values.
|
||||
|
||||
The following variables must be defined in each filter:
|
||||
our $NAME ='Filter';
|
||||
our $VERSION = '1.0';
|
||||
B<NAME> - return a string with the name of the plugin.
|
||||
|
||||
B<VERSION> - return a string with the version of the plugin.
|
||||
|
||||
These methods may be overriden:
|
||||
|
||||
|
|
@ -123,46 +123,4 @@ sub get_suggestions {
|
|||
return;
|
||||
}
|
||||
|
||||
=head2 NAME
|
||||
|
||||
my $name = $plugin->NAME;
|
||||
|
||||
Getter function for plugin names.
|
||||
|
||||
=cut
|
||||
|
||||
sub NAME {
|
||||
my $self = shift;
|
||||
my $package = ref $self || $self;
|
||||
return eval '$' . $package . '::NAME';
|
||||
}
|
||||
|
||||
=head2 VERSION
|
||||
|
||||
my $version = $plugin->VERSION;
|
||||
|
||||
Getter function for plugin versions.
|
||||
|
||||
=cut
|
||||
|
||||
sub VERSION {
|
||||
my $self = shift;
|
||||
my $package = ref $self || $self;
|
||||
return eval '$' . $package . '::VERSION';
|
||||
}
|
||||
|
||||
=head2 DESCRIPTION
|
||||
|
||||
my $description = $plugin->DESCRIPTION;
|
||||
|
||||
Getter function for plugin descriptions.
|
||||
|
||||
=cut
|
||||
|
||||
sub DESCRIPTION {
|
||||
my $self = shift;
|
||||
my $package = ref $self || $self;
|
||||
return eval '$' . $package . '::DESCRIPTION';
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -35,8 +35,24 @@ use warnings;
|
|||
use Carp;
|
||||
|
||||
use base qw(Koha::SuggestionEngine::Base);
|
||||
our $NAME = 'AuthorityFile';
|
||||
our $VERSION = '1.0';
|
||||
|
||||
=head2 NAME
|
||||
my $name = $plugin->NAME;
|
||||
|
||||
=cut
|
||||
|
||||
sub NAME {
|
||||
return 'AuthorityFile';
|
||||
}
|
||||
|
||||
=head2 VERSION
|
||||
my $version = $plugin->VERSION;
|
||||
|
||||
=cut
|
||||
|
||||
sub VERSION {
|
||||
return '1.1';
|
||||
}
|
||||
|
||||
=head2 get_suggestions
|
||||
|
||||
|
|
@ -85,3 +101,5 @@ sub get_suggestions {
|
|||
}
|
||||
return \@results;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -37,8 +37,24 @@ use Carp;
|
|||
use C4::Templates qw(gettemplate); # This is necessary for translatability
|
||||
|
||||
use base qw(Koha::SuggestionEngine::Base);
|
||||
our $NAME = 'ExplodedTerms';
|
||||
our $VERSION = '1.0';
|
||||
|
||||
=head2 NAME
|
||||
my $name = $plugin->NAME;
|
||||
|
||||
=cut
|
||||
|
||||
sub NAME {
|
||||
return 'ExplodedTerms';
|
||||
}
|
||||
|
||||
=head2 VERSION
|
||||
my $version = $plugin->VERSION;
|
||||
|
||||
=cut
|
||||
|
||||
sub VERSION {
|
||||
return '1.0';
|
||||
}
|
||||
|
||||
=head2 get_suggestions
|
||||
|
||||
|
|
@ -85,3 +101,5 @@ sub get_suggestions {
|
|||
};
|
||||
} return \@results;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -36,8 +36,24 @@ use warnings;
|
|||
use Carp;
|
||||
|
||||
use base qw(Koha::SuggestionEngine::Base);
|
||||
our $NAME = 'Null';
|
||||
our $VERSION = '1.0';
|
||||
|
||||
=head2 NAME
|
||||
my $name = $plugin->NAME;
|
||||
|
||||
=cut
|
||||
|
||||
sub NAME {
|
||||
return 'Null';
|
||||
}
|
||||
|
||||
=head2 VERSION
|
||||
my $version = $plugin->VERSION;
|
||||
|
||||
=cut
|
||||
|
||||
sub VERSION {
|
||||
return '1.1';
|
||||
}
|
||||
|
||||
=head2 get_suggestions
|
||||
|
||||
|
|
@ -58,3 +74,5 @@ sub get_suggestions {
|
|||
|
||||
return \@result;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -2439,10 +2439,6 @@ ul.ui-tabs-nav li {
|
|||
width: 260px;
|
||||
}
|
||||
|
||||
#didyoumeanlegend {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.pluginlist {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
[% FOREACH plugin IN plugins %]
|
||||
<div class="plugin">
|
||||
<div class="pluginname">
|
||||
[% IF plugin.enabled %]<input type="checkbox" checked="checked" id="checkbox_[% plugin.name %]">[% ELSE %]<input type="checkbox" id="checkbox_[% plugin.name %]">[% END %]
|
||||
<label class='pluginlabel' for="checkbox_[% plugin.name %]">[% plugin.name %]</label></div>
|
||||
[% IF plugin.enabled %]<input type="checkbox" checked="checked" id="checkbox_[% type %][% plugin.name %]">[% ELSE %]<input type="checkbox" id="checkbox_[% type %][% plugin.name %]">[% END %]
|
||||
<label class='pluginlabel' for="checkbox_[% type %][% plugin.name %]">[% plugin.name %]</label></div>
|
||||
<div class="plugindesc">
|
||||
[% SWITCH plugin.name %]
|
||||
[% CASE 'AuthorityFile' %]
|
||||
|
|
@ -81,16 +81,17 @@
|
|||
<div id="didyoumeanlegend">
|
||||
Please put the <em>Did you mean?</em> plugins in order by significance, from
|
||||
most significant to least significant, and check the box to enable those
|
||||
plugins that you want to use.
|
||||
plugins that you want to use. (NOTE: <em>Did you mean?</em> functionality
|
||||
is not yet enabled on the staff client)
|
||||
</div>
|
||||
<form action="/cgi-bin/koha/admin/didyoumean.pl" method="post">
|
||||
<fieldset id="didyoumeanopac">
|
||||
<legend>OPAC</legend>
|
||||
[% PROCESS pluginlist plugins=OPACpluginlist %]
|
||||
[% PROCESS pluginlist plugins=OPACpluginlist type='opac' %]
|
||||
</fieldset>
|
||||
<fieldset id="didyoumeanintranet">
|
||||
<legend>Intranet</legend>
|
||||
[% PROCESS pluginlist plugins=INTRApluginlist %]
|
||||
[% PROCESS pluginlist plugins=INTRApluginlist type='intranet' %]
|
||||
</fieldset>
|
||||
<fieldset class="action"><button class="save-all submit" onclick="yesimeant();return false;" type="submit">Save configuration</button> <a href="#" onclick="window.location.reload(true);" class="cancel">Cancel</a></fieldset>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -20,15 +20,15 @@ foreach my $plugin (@installed_plugins) {
|
|||
ok(grep($plugin, @available_plugins), "Found plugin $plugin");
|
||||
}
|
||||
|
||||
my $suggestor = Koha::SuggestionEngine->new( { plugins => ( 'ABCD::EFGH::IJKL' ) } );
|
||||
my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'ABCD::EFGH::IJKL' ] } );
|
||||
|
||||
is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine with invalid plugin');
|
||||
is(scalar @{ $suggestor->get_suggestions({ 'search' => 'books' }) }, 0 , 'Request suggestions with empty suggestor');
|
||||
|
||||
$suggestor = Koha::SuggestionEngine->new( { plugins => ( 'Null' ) } );
|
||||
$suggestor = Koha::SuggestionEngine->new( { plugins => [ 'Null' ] } );
|
||||
is(ref($suggestor->plugins->[0]), 'Koha::SuggestionEngine::Plugin::Null', 'Created record suggestor with implicitly scoped Null filter');
|
||||
|
||||
$suggestor = Koha::SuggestionEngine->new( { plugins => ( 'Koha::SuggestionEngine::Plugin::Null' ) } );
|
||||
$suggestor = Koha::SuggestionEngine->new( { plugins => [ 'Koha::SuggestionEngine::Plugin::Null' ] } );
|
||||
is(ref($suggestor->plugins->[0]), 'Koha::SuggestionEngine::Plugin::Null', 'Created record suggestor with explicitly scoped Null filter');
|
||||
|
||||
my $suggestions = $suggestor->get_suggestions({ 'search' => 'books' });
|
||||
|
|
@ -38,7 +38,7 @@ is_deeply($suggestions->[0], { 'search' => 'book', label => 'Book!', relevance =
|
|||
$suggestions = $suggestor->get_suggestions({ 'search' => 'silliness' });
|
||||
|
||||
eval {
|
||||
$suggestor = Koha::SuggestionEngine->new( { plugins => ( 'Koha::SuggestionEngine::Plugin::Null' ) } );
|
||||
$suggestor = Koha::SuggestionEngine->new( { plugins => [ 'Koha::SuggestionEngine::Plugin::Null' ] } );
|
||||
undef $suggestor;
|
||||
};
|
||||
ok(!$@, 'Destroyed suggestor successfully');
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ $module->mock('SearchAuthorities', sub {
|
|||
} ], 1
|
||||
});
|
||||
|
||||
my $suggestor = Koha::SuggestionEngine->new( { plugins => ( 'AuthorityFile' ) } );
|
||||
my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'AuthorityFile' ] } );
|
||||
is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
|
||||
|
||||
my $result = $suggestor->get_suggestions({search => 'Cookery'});
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ BEGIN {
|
|||
use_ok('Koha::SuggestionEngine');
|
||||
}
|
||||
|
||||
my $suggestor = Koha::SuggestionEngine->new( { plugins => ( 'ExplodedTerms' ) } );
|
||||
my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'ExplodedTerms' ] } );
|
||||
is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
|
||||
|
||||
my $result = $suggestor->get_suggestions({search => 'Cookery'});
|
||||
|
|
|
|||
Loading…
Reference in New Issue