git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
word edit: prio(rity level) column input
[sheet.git]
/
writer.plp
diff --git
a/writer.plp
b/writer.plp
index 11754e8a72d4b1834aa904126ad158cda5fee5f4..275909b094feeae07ddd9131913aa4a898ab912e 100644
(file)
--- a/
writer.plp
+++ b/
writer.plp
@@
-108,13
+108,14
@@
my $db = eval {
} or Abort('Database error', 501, $@);
my @wordcols = (
} or Abort('Database error', 501, $@);
my @wordcols = (
+ lang => 'Language',
+ cat => 'Category',
form => 'Translation',
wptitle => 'Wikipedia',
form => 'Translation',
wptitle => 'Wikipedia',
- ref => 'Reference',
- cat => 'Category',
- lang => 'Language',
source => 'Image URL',
thumb => 'Convert options',
source => 'Image URL',
thumb => 'Convert options',
+ prio => 'Level',
+ ref => 'Reference',
);
my ($find) = map {{id => $_}} $fields{id} || $Request || ();
);
my ($find) = map {{id => $_}} $fields{id} || $Request || ();
@@
-125,9
+126,9
@@
if ($find) {
}
if (exists $get{copy}) {
}
if (exists $get{copy}) {
- $row = {%{$row}{ qw(lang cat) }};
+ $row = {%{$row}{ qw(
prio
lang cat) }};
}
}
-elsif ($ENV{REQUEST_METHOD} eq 'POST') {
+elsif ($ENV{REQUEST_METHOD} eq 'POST') {
{
my $replace = $row;
$row = {%post{ pairkeys @wordcols }};
$_ = length ? $_ : undef for values %{$row};
my $replace = $row;
$row = {%post{ pairkeys @wordcols }};
$_ = length ? $_ : undef for values %{$row};
@@
-137,7
+138,10
@@
elsif ($ENV{REQUEST_METHOD} eq 'POST') {
my $query = $find ? $db->update(word => $row, $find, \%res) :
$db->insert(word => $row, \%res);
$row = $query->hash;
my $query = $find ? $db->update(word => $row, $find, \%res) :
$db->insert(word => $row, \%res);
$row = $query->hash;
- } or Alert("Entry could not be saved", $@);
+ } or do {
+ Alert("Entry could not be saved", $@);
+ next;
+ };
my $imgpath = "data/word/org/$row->{id}.jpg";
if (($row->{source} // '') ne ($replace->{source} // '')) {
my $imgpath = "data/word/org/$row->{id}.jpg";
if (($row->{source} // '') ne ($replace->{source} // '')) {
@@
-182,8
+186,9
@@
elsif ($ENV{REQUEST_METHOD} eq 'POST') {
unlink $thumbpath;
}
}
unlink $thumbpath;
}
}
-}
+}
}
else {
else {
+ $row->{prio} //= 1;
$row->{$_} = $get{$_} for keys %get;
}
$row->{$_} = $get{$_} for keys %get;
}