That is, a term is either approved, or rejected, or neither.
Without an external dictionary, most terms will fall into the
latter category.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
$sth->execute($term);
unless ($sth->rows) {
$ext_dict and return (spellcheck($term) ? 0 : 1); # spellcheck returns empty on OK word
- return undef;
+ return 0;
}
- return $sth->fetch;
+ return $sth->fetchrow;
}
sub get_tag_index ($;$) {
$sth->execute($borrowernumber,$biblionumber,$term);
# then
- if (@_) { # if an arg remains, it is the borrowernumber of the approver: tag is pre-approved. Note, whitelist unaffected.
+ if (scalar @_) { # if arg remains, it is the borrowernumber of the approver: tag is pre-approved.
my $approver = shift;
add_tag_approval($term,$approver);
add_tag_index($term,$biblionumber,$approver);
- } elsif (is_approved($term)) {
+ } elsif (is_approved($term) >= 1) {
add_tag_approval($term,1);
add_tag_index($term,$biblionumber,1);
} else {
var failure_test = function(tag){
$('#verdict').html(tag + ' is prohibited!');
};
+ var indeterminate_test = function(tag){
+ $('#verdict').html(tag + ' is neither permitted nor prohibited!');
+ };
var success_test_call = function() {
$('#test_button').removeAttr("disabled");
"<!-- TMPL_VAR NAME="test_term" -->" is permitted.
<!-- TMPL_ELSIF NAME="verdict_rej" -->
"<!-- TMPL_VAR NAME="test_term" -->" is prohibited.
+ <!-- TMPL_ELSIF NAME="verdict_indeterminate" -->
+ "<!-- TMPL_VAR NAME="test_term" -->" is neither permitted nor prohibited.
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
</div>
$debug and print STDERR "op: " . Dumper($operator) . "\n";
my ($tag, $js_reply);
if ($tag = $input->param('test')) {
- $js_reply = ( is_approved( $tag) ? 'success' : 'failure') . "_test('$tag');\n";
+ my $check = is_approved($tag);
+ $js_reply = ( $check >= 1 ? 'success' :
+ $check <= -1 ? 'failure' : 'indeterminate' ) . "_test('$tag');\n";
}
if ($tag = $input->param('ok')) {
$js_reply = ( whitelist($operator,$tag) ? 'success' : 'failure') . "_approve('$tag');\n";
} elsif ($op eq 'test' ) {
my $tag = $input->param('test');
push @tags, $tag;
+ my $check = is_approved($tag);
$template->param(
test_term => $tag,
- (is_approved($tag) ? 'verdict_ok' : 'verdict_rej') => 1,
+ ( $check >= 1 ? 'verdict_ok' :
+ $check <= -1 ? 'verdict_rej' : 'verdict_indeterminate' ) => 1,
);
}