diff options
author | Yorhel <git@yorhel.nl> | 2010-01-24 09:45:02 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2010-01-24 09:45:02 +0100 |
commit | d2dd07de4e0d9b8c00cd2db49aa2e7c0a5150bbc (patch) | |
tree | 4fc891330f8d7d513e1d22b1599880da304cdcd0 /lib/VNDB/Handler/Producers.pm | |
parent | 0f35ebbfc2cb4f8da4975ded1331bb80f408ccad (diff) |
Versioned the deleting and locking of database entries
This is implemented by adding ihid (item hidden) and ilock (item
locked) columns to the changes table,
The (vn|release|producer).(hidden|locked) columns now work as a
cache, refering to the changes.(ihid|ilock) columns with
changes.id = (vn|release|producer).latest.
The cached columns are updated automatically each time a new revision is
inserted.
This is a pretty large change, bugs are quite likely.
Diffstat (limited to 'lib/VNDB/Handler/Producers.pm')
-rw-r--r-- | lib/VNDB/Handler/Producers.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm index 064a06bc..b1203dd7 100644 --- a/lib/VNDB/Handler/Producers.pm +++ b/lib/VNDB/Handler/Producers.pm @@ -155,7 +155,7 @@ sub edit { || $pid && ($p->{locked} && !$self->authCan('lock') || $p->{hidden} && !$self->authCan('del')); my %b4 = !$pid ? () : ( - (map { $_ => $p->{$_} } qw|type name original lang website desc alias|), + (map { $_ => $p->{$_} } qw|type name original lang website desc alias ihid ilock|), l_wp => $p->{l_wp} || '', prodrelations => join('|||', map $_->{relation}.','.$_->{id}.','.$_->{name}, sort { $a->{id} <=> $b->{id} } @{$p->{relations}}), ); @@ -173,12 +173,17 @@ sub edit { { name => 'desc', required => 0, maxlength => 5000, default => '' }, { name => 'prodrelations', required => 0, maxlength => 5000, default => '' }, { name => 'editsum', maxlength => 5000 }, + { name => 'ihid', required => 0 }, + { name => 'ilock', required => 0 }, ); if(!$frm->{_err}) { # parse my $relations = [ map { /^([a-z]+),([0-9]+),(.+)$/ && (!$pid || $2 != $pid) ? [ $1, $2, $3 ] : () } split /\|\|\|/, $frm->{prodrelations} ]; # normalize + $frm->{ihid} = $frm->{ihid}?1:0; + $frm->{ilock} = $frm->{ilock}?1:0; + $relations = [] if $frm->{ihid}; $frm->{prodrelations} = join '|||', map $_->[0].','.$_->[1].','.$_->[2], sort { $a->[1] <=> $b->[1]} @{$relations}; return $self->resRedirect("/p$pid", 'post') |