X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FRequirementSpecTextBlock.pm;h=d6e8c35a66d3c0f8ee7ec7142b885afd7929cd3f;hb=1b9b086ff87a1cb2d6893892b3d66cfd413fdd35;hp=9f70e1bab522f8c2531e77275662f2f61175d651;hpb=786437b68e64cc7c8496792b2a34717f60ca3a22;p=kivitendo-erp.git diff --git a/SL/Controller/RequirementSpecTextBlock.pm b/SL/Controller/RequirementSpecTextBlock.pm index 9f70e1bab..d6e8c35a6 100644 --- a/SL/Controller/RequirementSpecTextBlock.pm +++ b/SL/Controller/RequirementSpecTextBlock.pm @@ -26,6 +26,7 @@ use Rose::Object::MakeMethods::Generic 'scalar --get_set_init' => [ qw(predefined_texts js picture) ], ); +__PACKAGE__->run_before('check_auth'); __PACKAGE__->run_before('load_requirement_spec_text_block', only => [qw(ajax_edit ajax_update ajax_delete ajax_flag dragged_and_dropped ajax_copy ajax_add_picture)]); # @@ -85,6 +86,7 @@ sub action_ajax_edit { ->insertAfter($html, '#text-block-' . $self->text_block->id) ->jstree->select_node('#tree', '#tb-' . $self->text_block->id) ->focus('#edit_text_block_' . $self->text_block->id . '_title') + ->reinit_widgets ->render($self); } @@ -136,7 +138,9 @@ sub action_ajax_update { ->replaceWith('#text-block-' . $self->text_block->id, $html) ->run(SORTABLE_PICTURE_LIST()) ->jstree->rename_node('#tree', '#tb-' . $self->text_block->id, $self->text_block->title) - ->prop('#tb-' . $self->text_block->id, 'title', $self->text_block->content_excerpt) + ->prop('#tb-' . $self->text_block->id . ' a', 'title', $self->text_block->content_excerpt) + ->addClass('#tb-' . $self->text_block->id . ' a', 'tooltip') + ->reinit_widgets ->render($self); } @@ -395,6 +399,11 @@ sub action_reorder_pictures { # filters # +sub check_auth { + my ($self) = @_; + $::auth->assert('requirement_spec_edit'); +} + sub load_requirement_spec_text_block { my ($self) = @_; $self->text_block(SL::DB::RequirementSpecTextBlock->new(id => $::form->{id})->load || die "No such requirement spec text block"); @@ -418,7 +427,7 @@ sub output_position_from_id { } sub init_predefined_texts { - return SL::DB::Manager::RequirementSpecPredefinedText->get_all_sorted; + return SL::DB::Manager::RequirementSpecPredefinedText->get_all_sorted(where => [ useable_for_text_blocks => 1 ]); } sub init_picture { @@ -454,6 +463,7 @@ sub add_new_text_block_form { $self->js ->action($params{insert_after_id} ? 'insertAfter' : 'appendTo', $html, '#text-block-' . ($params{insert_after_id} || 'list')) + ->reinit_widgets ->focus('#' . $id_base . '_title'); }