latin: enlarge horizontal domino tiles to letter height
[sheet.git] / word / edit.plp
index f7d39485c992ae1f60373d2ca445534772122cd0..5957b1a9b6a9541bb75b4a162d9190d3a5bf0c60 100644 (file)
@@ -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'<span style="color:green">\N{BLACK STAR}</span>', 'esperanto'],
@@ -112,7 +113,8 @@ my %wordcol = (
 );
 
 if (my $search = $fields{q}) {
-       my %filter = (form => {ilike => '%'.$search.'%'});
+       my %filter = $search eq '^' ? (cat => undef, ref => undef) :
+               (form => {ilike => '%'.parseinput($search).'%'});
        my $results = $db->select(word => '*', \%filter);
        say '<h1>Search</h1><ul>';
        printf("<li><small>%s</small> %s %s</li>\n",
@@ -157,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 <em>Reference</em> to <q>delete</q>."
@@ -222,13 +224,13 @@ 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};
 }
 
 eval {
-       my $imagerow = $row->{image} && decode_json(delete $row->{image}) || {};
+       my $imagerow = $row->{image} && JSON->new->decode(delete $row->{image}) || {};
        while (my ($col, $val) = each %{$imagerow}) {
                $row->{$col} = $val;
        }
@@ -265,7 +267,7 @@ for my $col (@wordcols) {
 }
 
 if (not $row->{ref}) {
-       printf '<li><label for="%s">%s</label><div><ul class="inline" id="%1$s">',
+       printf '<li><label for="%s">%s</label><div><ul class="inline multiinput" id="%1$s">',
                'trans', 'Translations';
        my @children = !$row->{id} ? () :
                $db->select(word => '*', {ref => $row->{id}}, 'lang, id')->hashes;