word edit: copy translations from wikipedia download
[sheet.git] / writer.plp
index f954ba05563e9627c128f2bf9d3a7d881eade753..ba81e8a4d4ee42e1841ae2e0d56d67aa4a379b71 100644 (file)
@@ -106,9 +106,10 @@ my $db = eval {
 } or Abort('Database error', 501, $@);
 
 my %lang = (
-       nld => ["\N{REGIONAL INDICATOR SYMBOL LETTER N}\N{REGIONAL INDICATOR SYMBOL LETTER L}", 'dutch'],
-       eng => ["\N{REGIONAL INDICATOR SYMBOL LETTER G}\N{REGIONAL INDICATOR SYMBOL LETTER B}", 'english'],
-       epo => ['<span style="color:green">★</span>', 'esperanto'],
+       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 => ['<span style="color:green">★</span>', 'esperanto'],
+       ru => ["\N{REGIONAL INDICATOR SYMBOL LETTER R}\N{REGIONAL INDICATOR SYMBOL LETTER U}", 'русский'],
 );
 my @wordcols = pairkeys
 my %wordcol = (
@@ -147,6 +148,19 @@ elsif ($ENV{REQUEST_METHOD} eq 'POST') {{
        $row = {%post{keys %wordcol}};
        $_ = length ? $_ : undef for values %{$row};
 
+       if (!$row->{form}) {
+               if ($row->{ref} ne 'delete') {
+                       Alert("Empty title",
+                               "Confirm removal by setting <em>Reference</em> to <q>delete</q>."
+                       );
+               }
+               else {
+                       $db->delete(word => $find);
+                       Alert("Entry removed");
+               }
+               next;
+       }
+
        eval {
                my %res = (returning => '*');
                my $query = $find ? $db->update(word => $row, $find, \%res) :
@@ -277,7 +291,7 @@ package Shiar_Sheet::FormRow {
        sub imagepath {
                my ($row, $col) = @_;
                return "data/word/org/$row->{id}.jpg"   if $col eq 'source';
-               return "data/word/eng/$row->{form}.jpg" if $col eq 'thumb';
+               return "data/word/en/$row->{form}.jpg"  if $col eq 'thumb';
                return;
        }
 }