From 6a39e557f114b8cbcc1ab775138fa340e56c322f Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 25 Oct 2021 21:14:25 +0200 Subject: [PATCH] word/edit: allow unnamed and/or untranslated entries Alternative variants can be populated without textual distinction, for example sexual dimorphism without specific terms, identified by category override alone. Probably still a good idea to describe eventually, but this is optional metadata for visual presentations. --- tools/word.pg.sql | 4 ++-- word/edit.plp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/word.pg.sql b/tools/word.pg.sql index a142ebc..821814d 100644 --- a/tools/word.pg.sql +++ b/tools/word.pg.sql @@ -8,9 +8,9 @@ CREATE TABLE login ( ); CREATE TABLE word ( - form text NOT NULL, + form text, alt text[], - lang text NOT NULL DEFAULT 'en', + lang text DEFAULT 'en', cat integer REFERENCES word (id), ref integer REFERENCES word (id), prio smallint DEFAULT '1' diff --git a/word/edit.plp b/word/edit.plp index f755f25..5957b1a 100644 --- a/word/edit.plp +++ b/word/edit.plp @@ -72,6 +72,7 @@ my $user = eval { }; my %lang = ( + '' => ['(reference)'], nl => ["\N{REGIONAL INDICATOR SYMBOL LETTER N}\N{REGIONAL INDICATOR SYMBOL LETTER L}", 'nederlands'], en => ["\N{REGIONAL INDICATOR SYMBOL LETTER G}\N{REGIONAL INDICATOR SYMBOL LETTER B}", 'english'], eo => [qq'\N{BLACK STAR}', 'esperanto'], @@ -158,7 +159,7 @@ elsif (defined $post{form}) {{ my $imagecol = $row->{image}; # backup image subcolumns ref $_ eq 'HASH' and $_ = encode_json($_) for values %{$row}; - if (!$row->{form}) { + if (!$row->{form} and $row->{lang}) { if ($row->{ref} ne 'delete') { Alert("Empty title", "Confirm removal by setting Reference to delete." @@ -223,7 +224,7 @@ elsif (defined $post{form}) {{ } }} else { - $row->{lang} //= $user->{editlang}->[0]; + $row->{lang} //= $user->{editlang}->[0] unless exists $row->{lang}; $row->{$_} = $get{$_} for keys %get; $row->{prio} = defined $row->{ref} ? undef : 1 unless exists $row->{prio}; } -- 2.30.0