Revision dcef8eb0
Von Moritz Bunkus vor mehr als 7 Jahren hinzugefügt
SL/Controller/Project.pm | ||
---|---|---|
51 | 51 |
include_prefix => 'l_', |
52 | 52 |
include_value => 'Y'); |
53 | 53 |
|
54 |
$self->setup_search_action_bar; |
|
55 |
|
|
54 | 56 |
$self->render('project/search', %params); |
55 | 57 |
} |
56 | 58 |
|
57 | 59 |
sub action_list { |
58 | 60 |
my ($self) = @_; |
59 | 61 |
|
62 |
$self->setup_search_action_bar; |
|
63 |
|
|
60 | 64 |
$self->make_filter_summary; |
61 | 65 |
|
62 | 66 |
$self->prepare_report; |
63 | 67 |
|
64 |
$self->report_generator_list_objects(report => $self->{report}, objects => $self->models->get); |
|
68 |
$self->report_generator_list_objects(report => $self->{report}, objects => $self->models->get, action_bar => 1);
|
|
65 | 69 |
} |
66 | 70 |
|
67 | 71 |
sub action_new { |
... | ... | |
69 | 73 |
|
70 | 74 |
$self->project(SL::DB::Project->new); |
71 | 75 |
$self->display_form(title => $::locale->text('Create a new project'), |
72 |
callback => $::form->{callback} || $self->url_for(action => 'new'));
|
|
76 |
callback => $::form->{callback} || $self->url_for(action => 'list'));
|
|
73 | 77 |
} |
74 | 78 |
|
75 | 79 |
sub action_edit { |
76 | 80 |
my ($self) = @_; |
77 | 81 |
|
78 | 82 |
$self->display_form(title => $::locale->text('Edit project #1', $self->project->projectnumber), |
79 |
callback => $::form->{callback} || $self->url_for(action => 'edit', id => $self->project->id));
|
|
83 |
callback => $::form->{callback} || $self->url_for(action => 'list'));
|
|
80 | 84 |
} |
81 | 85 |
|
82 | 86 |
sub action_create { |
... | ... | |
232 | 236 |
|
233 | 237 |
CVar->render_inputs(variables => $params{CUSTOM_VARIABLES}) if @{ $params{CUSTOM_VARIABLES} }; |
234 | 238 |
|
239 |
$self->setup_edit_action_bar(callback => $params{callback}); |
|
240 |
|
|
235 | 241 |
$self->render('project/form', %params); |
236 | 242 |
} |
237 | 243 |
|
... | ... | |
372 | 378 |
|
373 | 379 |
$self->{filter_summary} = join ', ', @filter_strings; |
374 | 380 |
} |
381 |
|
|
382 |
sub setup_edit_action_bar { |
|
383 |
my ($self, %params) = @_; |
|
384 |
|
|
385 |
my $is_new = !$self->project->id; |
|
386 |
|
|
387 |
for my $bar ($::request->layout->get('actionbar')) { |
|
388 |
$bar->add( |
|
389 |
combobox => [ |
|
390 |
action => [ |
|
391 |
t8('Save'), |
|
392 |
submit => [ '#form', { action => 'Project/' . ($is_new ? 'create' : 'update') } ], |
|
393 |
accesskey => 'enter', |
|
394 |
], |
|
395 |
action => [ |
|
396 |
t8('Save as new'), |
|
397 |
submit => [ '#form', { action => 'Project/create' }], |
|
398 |
disabled => $is_new ? t8('The object has not been saved yet.') : undef, |
|
399 |
], |
|
400 |
], # end of combobox "Save" |
|
401 |
|
|
402 |
action => [ |
|
403 |
t8('Delete'), |
|
404 |
submit => [ '#form', { action => 'Project/destroy' } ], |
|
405 |
confirm => $::locale->text('Do you really want to delete this object?'), |
|
406 |
disabled => $is_new ? t8('This object has not been saved yet.') |
|
407 |
: $self->project->is_used ? t8('This object has already been used.') |
|
408 |
: undef, |
|
409 |
], |
|
410 |
|
|
411 |
link => [ |
|
412 |
t8('Abort'), |
|
413 |
link => $params{callback} || $self->url_for(action => 'list'), |
|
414 |
], |
|
415 |
); |
|
416 |
} |
|
417 |
} |
|
418 |
|
|
419 |
sub setup_search_action_bar { |
|
420 |
my ($self, %params) = @_; |
|
421 |
|
|
422 |
for my $bar ($::request->layout->get('actionbar')) { |
|
423 |
$bar->add( |
|
424 |
action => [ |
|
425 |
t8('Search'), |
|
426 |
submit => [ '#search_form', { action => 'Project/list' } ], |
|
427 |
accesskey => 'enter', |
|
428 |
], |
|
429 |
link => [ |
|
430 |
t8('Add Project'), |
|
431 |
link => $self->url_for(action => 'new'), |
|
432 |
], |
|
433 |
); |
|
434 |
} |
|
435 |
} |
|
436 |
|
|
375 | 437 |
1; |
locale/de/all | ||
---|---|---|
3025 | 3025 |
'The object has been created.' => 'Das Objekt wurde angelegt.', |
3026 | 3026 |
'The object has been deleted.' => 'Das Objekt wurde gelöscht..', |
3027 | 3027 |
'The object has been saved.' => 'Das Objekt wurde gespeichert.', |
3028 |
'The object has not been saved yet.' => 'Das Objekt wurde noch nicht gespeichert.', |
|
3028 | 3029 |
'The object is in use and cannot be deleted.' => 'Das Objekt ist in Benutzung und kann nicht gelöscht werden.', |
3029 | 3030 |
'The option field is empty.' => 'Das Optionsfeld ist leer.', |
3030 | 3031 |
'The order has been deleted' => 'Der Auftrag wurde gelöscht.', |
templates/webpages/project/_filter.html | ||
---|---|---|
3 | 3 |
[%- USE L %] |
4 | 4 |
[%- USE LxERP %] |
5 | 5 |
|
6 |
<table> |
|
6 |
<table id="filter_table">
|
|
7 | 7 |
<tr> |
8 | 8 |
<th align="right">[% 'Number' | $T8 %]</th> |
9 | 9 |
<td>[% L.input_tag('filter.projectnumber:substr::ilike', filter.projectnumber_substr__ilike, size=60) %]</td> |
templates/webpages/project/form.html | ||
---|---|---|
7 | 7 |
|
8 | 8 |
[%- INCLUDE 'common/flash.html' %] |
9 | 9 |
|
10 |
<form method="post" action="controller.pl"> |
|
10 |
<form method="post" action="controller.pl" id="form">
|
|
11 | 11 |
[% L.hidden_tag("callback", callback) %] |
12 | 12 |
[% L.hidden_tag("id", SELF.project.id) %] |
13 | 13 |
|
... | ... | |
39 | 39 |
[%- END %] |
40 | 40 |
|
41 | 41 |
</div> |
42 |
|
|
43 |
<p> |
|
44 |
[% L.hidden_tag("action", "Project/dispatch") %] |
|
45 |
[% L.submit_tag("action_" _ (SELF.project.id ? "update" : "create"), LxERP.t8('Save')) %] |
|
46 |
[%- IF SELF.project.id %] |
|
47 |
[% L.submit_tag("action_create", LxERP.t8('Save as new')) %] |
|
48 |
[% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) IF !SELF.project.is_used %] |
|
49 |
[%- END %] |
|
50 |
<a href="[% IF callback %][% callback %][% ELSE %][% SELF.url_for(action => 'search') %][% END %]">[%- LxERP.t8('Abort') %]</a> |
|
51 |
</p> |
|
52 | 42 |
</form> |
templates/webpages/project/report_top.html | ||
---|---|---|
15 | 15 |
[% L.hidden_tag('sort_by', FORM.sort_by) %] |
16 | 16 |
[% L.hidden_tag('sort_dir', FORM.sort_dir) %] |
17 | 17 |
[% L.hidden_tag('page', FORM.page) %] |
18 |
[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%] |
|
19 | 18 |
</div> |
20 | 19 |
|
21 | 20 |
</form> |
templates/webpages/project/search.html | ||
---|---|---|
11 | 11 |
<p> |
12 | 12 |
[%- INCLUDE 'project/_filter.html' %] |
13 | 13 |
</p> |
14 |
|
|
15 |
<hr size="3" noshade> |
|
16 |
|
|
17 |
[% L.hidden_tag('action', 'Project/list') %] |
|
18 |
|
|
19 |
<p>[% L.submit_tag('dummy', LxERP.t8('Continue')) %]</p> |
|
20 | 14 |
</form> |
Auch abrufbar als: Unified diff
ActionBar: Project-Controller umgestellt