601 |
601 |
|
602 |
602 |
return $self->js
|
603 |
603 |
->action($params{insert_position}, $html, $params{display_reference})
|
|
604 |
->action_if($self->item->item_type eq 'sub-function-block', 'show', '#sub-function-block-container-' . $self->item->parent_id)
|
604 |
605 |
->run('kivi.requirement_spec.init_function_block_keypress_events', "${id_base}_form")
|
605 |
606 |
->focus("#${id_base}_description");
|
606 |
607 |
}
|
... | ... | |
609 |
610 |
my ($self, %params) = @_;
|
610 |
611 |
|
611 |
612 |
my $created_item = $self->item;
|
612 |
|
my $is_section = $created_item->item_type eq 'section';
|
|
613 |
|
|
614 |
my ($new_item_type, $new_parent_id, $insert_position, $insert_reference, $display_reference);
|
|
615 |
if ($created_item->item_type eq 'section') {
|
|
616 |
# $created_item is section, new one will be function-block
|
|
617 |
$new_item_type = 'function-block';
|
|
618 |
$new_parent_id = $created_item->id;
|
|
619 |
$insert_position = 'appendTo';
|
|
620 |
$display_reference = '#section-list';
|
|
621 |
|
|
622 |
} elsif (!$::form->{shift_in_out}) {
|
|
623 |
# $created_item is function-block or sub-function-block, new one will be the same
|
|
624 |
$new_item_type = $created_item->item_type;
|
|
625 |
$new_parent_id = $created_item->parent_id;
|
|
626 |
$insert_position = 'insertAfter';
|
|
627 |
$insert_reference = $created_item->id;
|
|
628 |
$display_reference = '#' . $created_item->item_type . '-' . $created_item->id;
|
|
629 |
|
|
630 |
} elsif ($created_item->item_type eq 'function-block') {
|
|
631 |
# $created_item is function-block, new one will be sub-function-block
|
|
632 |
$new_item_type = 'sub-function-block';
|
|
633 |
$new_parent_id = $created_item->id;
|
|
634 |
$insert_position = 'appendTo';
|
|
635 |
$display_reference = '#sub-function-block-container-' . $created_item->id;
|
|
636 |
|
|
637 |
} else {
|
|
638 |
# $created_item is sub-function-block, new one will be function-block
|
|
639 |
$new_item_type = 'function-block';
|
|
640 |
$new_parent_id = $created_item->parent->parent_id;
|
|
641 |
$insert_position = 'insertAfter';
|
|
642 |
$insert_reference = $created_item->parent_id;
|
|
643 |
$display_reference = '#function-block-' . $created_item->parent_id;
|
|
644 |
}
|
|
645 |
|
|
646 |
$::lxdebug->message(LXDebug::DEBUG1(),
|
|
647 |
"OLD item_type " . $created_item->item_type . " ; NEW item_type $new_item_type ; parent_id $new_parent_id ; " .
|
|
648 |
"insert_position $insert_position ; insert_reference $insert_reference ; display_reference $display_reference");
|
613 |
649 |
|
614 |
650 |
$self->item(SL::DB::RequirementSpecItem->new(
|
615 |
651 |
requirement_spec_id => $created_item->requirement_spec_id,
|
616 |
|
parent_id => $is_section ? $created_item->id : $created_item->parent_id,
|
617 |
|
item_type => $is_section ? 'function-block' : $created_item->item_type,
|
|
652 |
parent_id => $new_parent_id,
|
|
653 |
item_type => $new_item_type,
|
618 |
654 |
));
|
619 |
655 |
|
620 |
656 |
$self->add_new_item_form(
|
621 |
|
insert_reference => $created_item->id,
|
622 |
|
insert_position => $is_section ? 'appendTo' : 'insertAfter',
|
623 |
|
display_reference => $is_section ? '#section-list' : '#' . $created_item->item_type . '-' . $created_item->id,
|
|
657 |
insert_reference => $insert_reference,
|
|
658 |
insert_position => $insert_position,
|
|
659 |
display_reference => $display_reference,
|
624 |
660 |
);
|
625 |
661 |
}
|
626 |
662 |
|
Pflichtenheftitems: Shift+Return = nächster neuer Block auf anderer Ebene