Revision 630 (by ahitrov, 2016/12/09 15:54:41) |
Tag editing form
|
<%args>
$SETS => {}
$object => undef
</%args>
<%init>
return unless ref $object;
return unless exists $SETS->{pid} && defined $SETS->{pid};
my $pid = $SETS->{pid};
if ( $pid == 0 ) {
$object->pid( 0 );
$object->level( 1 );
} elsif ( $pid < 0 ) {
$object->pid( 0 );
$object->level( 0 );
} elsif ( $pid > 0 ) {
my $tag = $keeper->get_document_by_id( $pid, class => 'tag::Tag' );
if ( ref $tag ) {
$object->pid( $pid );
$object->level( $tag->level + 1 );
} else {
$object->pid( 0 );
$object->level( 0 );
}
}
</%init>