diff --git a/README.md b/README.md
index 34c1fd4c..37844248 100644
--- a/README.md
+++ b/README.md
@@ -11,9 +11,9 @@ A web app and suite of tools for performing copyright review projects.
```
git submodule init
git submodule update
-docker-compose build
-docker-compose up -d mariadb
-docker-compose run --rm test
+docker compose build
+docker compose up -d mariadb
+docker compose run --rm test
```
## Running Tests with Coverage
diff --git a/cgi/BibRights.pm b/cgi/BibRights.pm
index 98544311..0226c322 100644
--- a/cgi/BibRights.pm
+++ b/cgi/BibRights.pm
@@ -60,6 +60,7 @@ sub query {
my $bib_info = $br->get_bib_info($marc, $cid);
$data->{cid} = $cid;
$data->{title} = $marc->title();
+ $data->{record} = $metadata;
$data->{entries} = [];
foreach my $htid (@{$htids}) {
my $enumcron = $metadata->enumcron($htid) || '';
diff --git a/cgi/CRMS.pm b/cgi/CRMS.pm
index 4ff3c960..eaaf1921 100755
--- a/cgi/CRMS.pm
+++ b/cgi/CRMS.pm
@@ -66,7 +66,7 @@ sub new
return $self;
}
-our $VERSION = '8.5.23';
+our $VERSION = '8.5.24';
sub Version
{
return $VERSION;
@@ -6305,6 +6305,7 @@ sub TrackingQuery
}
}
$data->{'data'} = \@ids;
+ $data->{'record'} = $record;
return $data;
}
@@ -8149,16 +8150,17 @@ sub Commify
return $n;
}
-sub Keio
-{
+# The following module hooks exist so that templates
+# (which typically have only a CRMS object among their locals)
+# can call various modules of interest.
+sub Keio {
my $self = shift;
use Keio;
Keio->new('crms' => $self);
}
-sub Licensing
-{
+sub Licensing {
my $self = shift;
use Licensing;
@@ -8169,7 +8171,14 @@ sub BibRights {
my $self = shift;
use BibRights;
- return BibRights->new;
+ BibRights->new;
+}
+
+sub Field008Formatter {
+ my $self = shift;
+
+ use CRMS::Field008Formatter;
+ CRMS::Field008Formatter->new;
}
1;
diff --git a/cgi/bib_rights.tt b/cgi/bib_rights.tt
index e9076632..79ffd7ed 100755
--- a/cgi/bib_rights.tt
+++ b/cgi/bib_rights.tt
@@ -30,7 +30,8 @@
[% END %]
-
+ |
---|
+
[% IF data.cid %]
[% data.cid %]
@@ -43,7 +44,17 @@
[% ELSE %]
[% crms.EchoInput(id) %] (not in catalog)
[% END %]
- |
+
+
+
+ [% IF data.cid %]
+
+
+ [% f008 = data.record.GetControlfield('008') %]
+ [% crms.Field008Formatter.format(f008) %]
+ |
+
+ [% END %]
HTID |
diff --git a/cgi/track.tt b/cgi/track.tt
index dcaac640..411eb4ff 100755
--- a/cgi/track.tt
+++ b/cgi/track.tt
@@ -30,7 +30,8 @@
Download
[% END %]
-
+ |
---|
+
[% IF sysid %]
[% sysid %]
@@ -43,8 +44,15 @@
[% ELSE %]
[% crms.EchoInput(id) %] (not in catalog)
[% END %]
- |
+
+
[% IF sysid %]
+
+
+ [% f008 = data.record.GetControlfield('008') %]
+ [% crms.Field008Formatter.format(f008) %]
+ |
+
Volume |
Enum/Chron |
diff --git a/lib/CRMS/Field008Formatter.pm b/lib/CRMS/Field008Formatter.pm
new file mode 100644
index 00000000..8b44122c
--- /dev/null
+++ b/lib/CRMS/Field008Formatter.pm
@@ -0,0 +1,68 @@
+package CRMS::Field008Formatter;
+
+# Displays a 008 field with subparts separated out and bit positions numbered.
+
+use strict;
+use warnings;
+use utf8;
+
+sub new {
+ my ($class, %args) = @_;
+ my $self = bless {}, $class;
+ return $self;
+}
+
+# Pad a truncated or undefined 008 to the full 40 characters.
+sub pad {
+ my $self = shift;
+ my $f008 = shift || '';
+
+ if (length $f008 < 40) {
+ $f008 .= (' ' x (40 - length $f008));
+ }
+ return $f008;
+}
+
+sub format {
+ my $self = shift;
+ my $f008 = shift;
+
+ # Pad to length if truncated
+ $f008 = $self->pad($f008);
+ # Replace spaces with U+2294 square cup for display
+ $f008 =~ s/\s/⊔/g;
+ my $f008_1 = substr $f008, 0, 6;
+ my $f008_2 = substr $f008, 6, 9;
+ my $f008_3 = substr $f008, 15, 3;
+ my $f008_4 = substr $f008, 18, 17;
+ my $f008_5 = substr $f008, 35, 3;
+ my $f008_6 = substr $f008, 38, 1;
+ my $f008_7 = substr $f008, 39, 1;
+
+ my $format = <$f008_1
+ 00 01 02 03 04 05
+
+$f008_2
+ 06 07 08 09 10 11 12 13 14
+
+$f008_3
+ 15 16 17
+
+$f008_4
+ 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
+
+$f008_5
+ 35 36 37
+
+$f008_6
+ 38
+
+$f008_7
+ 39
+
+END
+ return $format;
+}
+
+1;
diff --git a/scripts/cover.sh b/scripts/cover.sh
index b5f4255c..adfd326a 100755
--- a/scripts/cover.sh
+++ b/scripts/cover.sh
@@ -2,4 +2,4 @@
# This script doesn't do the wait-for song and dance so if there are sporadic database errors,
# try making sure the databases are fully up and running again.
-docker-compose run --rm test cover -ignore_re '^t/' +ignore_re '^post' -test -make 'prove -r t/; exit $?'
+docker compose run --rm test cover -ignore_re '^t/' +ignore_re '^post' -test -make 'prove -r t/; exit $?'
diff --git a/t/CRMS.t b/t/CRMS.t
index b6800492..fa099a92 100755
--- a/t/CRMS.t
+++ b/t/CRMS.t
@@ -56,4 +56,8 @@ subtest '#LinkToJira' => sub {
'DEV-000');
};
+subtest '#Field008Formatter' => sub {
+ isa_ok $crms->Field008Formatter, "CRMS::Field008Formatter";
+};
+
done_testing();
diff --git a/t/lib/CRMS/CollectionBuilder.t b/t/lib/CRMS/CollectionBuilder.t
index d0afdc4a..3295473c 100644
--- a/t/lib/CRMS/CollectionBuilder.t
+++ b/t/lib/CRMS/CollectionBuilder.t
@@ -52,5 +52,3 @@ subtest '::set_visibility_cmd' => sub {
};
done_testing();
-
-1;
diff --git a/t/lib/CRMS/Field008Formatter.t b/t/lib/CRMS/Field008Formatter.t
new file mode 100644
index 00000000..a9f39d91
--- /dev/null
+++ b/t/lib/CRMS/Field008Formatter.t
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib $ENV{'SDRROOT'} . '/crms/lib';
+use CRMS::Field008Formatter;
+
+my $FAKE_008 = '850423s1940 uk a 000 0 eng d';
+
+subtest '::new' => sub {
+ my $formatter = CRMS::Field008Formatter->new;
+ isa_ok($formatter, 'CRMS::Field008Formatter');
+};
+
+subtest '#pad' => sub {
+ # Make sure we always get back 40 characters.
+ subtest 'with a normal 008' => sub {
+ my $formatter = CRMS::Field008Formatter->new;
+ is(length($formatter->pad($FAKE_008)), 40);
+ };
+
+ subtest 'with a truncated 008' => sub {
+ my $formatter = CRMS::Field008Formatter->new;
+ is(length($formatter->pad('850423')), 40);
+ };
+
+ subtest 'with an undefined 008' => sub {
+ my $formatter = CRMS::Field008Formatter->new;
+ is(length($formatter->pad()), 40);
+ };
+};
+
+subtest '#format' => sub {
+ # Make sure we get back a string.
+ subtest 'with a well-formed 008' => sub {
+ my $formatter = CRMS::Field008Formatter->new;
+ is(ref $formatter->format($FAKE_008), '');
+ };
+
+ subtest 'with a truncated 008' => sub {
+ my $formatter = CRMS::Field008Formatter->new;
+ is(ref $formatter->format(''), '');
+ };
+};
+
+done_testing();
diff --git a/t/lib/CRMS/RightsPredictor.t b/t/lib/CRMS/RightsPredictor.t
index ceb41b1d..adf1e53e 100644
--- a/t/lib/CRMS/RightsPredictor.t
+++ b/t/lib/CRMS/RightsPredictor.t
@@ -244,4 +244,3 @@ subtest 'RightsPredictor::rights' => sub {
done_testing();
-1;
diff --git a/web/css/review.css b/web/css/review.css
index b71dc262..a19e5809 100644
--- a/web/css/review.css
+++ b/web/css/review.css
@@ -8,6 +8,27 @@ code {
font-family:Courier, 'Courier New', Monaco, monospace;
}
+.f008 {
+ font-family:Courier, 'Courier New', Monaco, monospace;
+ border: 1px solid #000;
+ padding: 3px;
+ margin: 4px;
+ letter-spacing: .2rem;
+ text-align: center;
+ display: inline-flex;
+ flex-direction: column;
+ align-items: center;
+}
+
+.f008 .f008-annotation {
+ margin-block-end: 0.1em;
+ font-size: 0.65em;
+ white-space: nowrap;
+ text-align: left;
+ letter-spacing: -0.02rem;
+}
+
+
.pages {
margin: 10px;
padding: 10px;
@@ -191,11 +212,11 @@ table.ReviewError {
}
#Notes textarea {
- margin-top: 5px;
+ margin-block-start: 5px;
}
#SubmitForm {
- margin-top: 8px;
+ margin-block-start: 8px;
}
.reviewPartial {
@@ -411,7 +432,7 @@ hr {
}
#select * {
- margin-bottom:.5em;
+ margin-block-end: 0.5em;
}
select.review {