Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 14b824ae

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID 14b824ae47b746673eb94885b0c972fd5a84a62a
  • Vorgänger 6d75a1bc
  • Nachfolger 21f24006

Verwaltung von vordefinierten Textblöcken für Pflichtenhefte

Unterschiede anzeigen:

SL/Controller/RequirementSpecPredefinedText.pm
1
package SL::Controller::RequirementSpecPredefinedText;
2

  
3
use strict;
4

  
5
use parent qw(SL::Controller::Base);
6

  
7
use SL::DB::RequirementSpecPredefinedText;
8
use SL::DB::Language;
9
use SL::Helper::Flash;
10
use SL::Locale::String;
11

  
12
use Rose::Object::MakeMethods::Generic
13
(
14
 scalar => [ qw(requirement_spec_predefined_text) ],
15
);
16

  
17
__PACKAGE__->run_before('check_auth');
18
__PACKAGE__->run_before('load_requirement_spec_predefined_text', only => [ qw(edit update destroy) ]);
19

  
20
#
21
# actions
22
#
23

  
24
sub action_list {
25
  my ($self) = @_;
26

  
27
  $self->render('requirement_spec_predefined_text/list',
28
                title                             => t8('Predefined Texts'),
29
                REQUIREMENT_SPEC_PREDEFINED_TEXTS => SL::DB::Manager::RequirementSpecPredefinedText->get_all_sorted);
30
}
31

  
32
sub action_new {
33
  my ($self) = @_;
34

  
35
  $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new;
36
  $self->render('requirement_spec_predefined_text/form', title => t8('Create a new predefined text'));
37
}
38

  
39
sub action_edit {
40
  my ($self) = @_;
41
  $self->render('requirement_spec_predefined_text/form', title => t8('Edit predefined text'));
42
}
43

  
44
sub action_create {
45
  my ($self) = @_;
46

  
47
  $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new;
48
  $self->create_or_update;
49
}
50

  
51
sub action_update {
52
  my ($self) = @_;
53
  $self->create_or_update;
54
}
55

  
56
sub action_destroy {
57
  my ($self) = @_;
58

  
59
  if (eval { $self->{requirement_spec_predefined_text}->delete; 1; }) {
60
    flash_later('info',  t8('The predefined text has been deleted.'));
61
  } else {
62
    flash_later('error', t8('The predefined text is in use and cannot be deleted.'));
63
  }
64

  
65
  $self->redirect_to(action => 'list');
66
}
67

  
68
sub action_reorder {
69
  my ($self) = @_;
70

  
71
  SL::DB::RequirementSpecPredefinedText->reorder_list(@{ $::form->{requirement_spec_predefined_text_id} || [] });
72

  
73
  $self->render('1;', { type => 'js', inline => 1 });
74
}
75

  
76
#
77
# filters
78
#
79

  
80
sub check_auth {
81
  $::auth->assert('config');
82
}
83

  
84
#
85
# helpers
86
#
87

  
88
sub create_or_update {
89
  my $self   = shift;
90
  my $is_new = !$self->{requirement_spec_predefined_text}->id;
91
  my $params = delete($::form->{requirement_spec_predefined_text}) || { };
92
  my $title  = $is_new ? t8('Create a new predefined text') : t8('Edit predefined text');
93

  
94
  $self->{requirement_spec_predefined_text}->assign_attributes(%{ $params });
95

  
96
  my @errors = $self->{requirement_spec_predefined_text}->validate;
97

  
98
  if (@errors) {
99
    flash('error', @errors);
100
    $self->render('requirement_spec_predefined_text/form', title => $title);
101
    return;
102
  }
103

  
104
  $self->{requirement_spec_predefined_text}->save;
105

  
106
  flash_later('info', $is_new ? t8('The predefined text has been created.') : t8('The predefined text has been saved.'));
107
  $self->redirect_to(action => 'list');
108
}
109

  
110
sub load_requirement_spec_predefined_text {
111
  my ($self) = @_;
112
  $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new(id => $::form->{id})->load;
113
}
114

  
115
1;
SL/DB/RequirementSpecPredefinedText.pm
11 11
  my ($self) = @_;
12 12

  
13 13
  my @errors;
14
  push @errors, t8('The title is missing.')       if !$self->title;
15
  push @errors, t8('The description is missing.') if !$self->description;
14
  push @errors, t8('The description is missing.')    if !$self->description;
15
  push @errors, t8('The description is not unique.') if  $self->get_first_conflicting('description');
16
  push @errors, t8('The title is missing.')          if !$self->title;
16 17

  
17 18
  return @errors;
18 19
}
locale/de/all
497 497
  'Contact person (surname)'    => 'Ansprechperson (Nachname)',
498 498
  'Contact persons'             => 'Ansprechpersonen',
499 499
  'Contacts'                    => 'Ansprechpersonen',
500
  'Content'                     => 'Inhalt',
500 501
  'Continue'                    => 'Weiter',
501 502
  'Contra'                      => 'gegen',
502 503
  'Conversion of "birthday" contact person attribute' => 'Umstellung des Kontaktpersonenfeldes "Geburtstag"',
......
524 525
  'Create a new group'          => 'Neue Benutzergruppe erfassen',
525 526
  'Create a new payment term'   => 'Neue Zahlungsbedingungen anlegen',
526 527
  'Create a new printer'        => 'Einen neuen Drucker anlegen',
528
  'Create a new predefined text' => 'Einen neuen vordefinierten Textblock anlegen',
527 529
  'Create a new project'        => 'Neues Projekt anlegen',
528 530
  'Create a new project type'   => 'Einen neuen Projekttypen anlegen',
529 531
  'Create a new requirement spec status' => 'Einen neuen Pflichtenheftstatus anlegen',
......
859 861
  'Edit greetings'              => 'Anreden bearbeiten',
860 862
  'Edit note'                   => 'Notiz bearbeiten',
861 863
  'Edit payment term'           => 'Zahlungsbedingungen bearbeiten',
864
  'Edit predefined text'        => 'Vordefinierten Textblock bearbeiten',
862 865
  'Edit prices and discount (if not used, textfield is ONLY set readonly)' => 'Preise und Rabatt in Formularen frei anpassen (falls deaktiviert, wird allerdings NUR das textfield auf READONLY gesetzt / kann je nach Browserversion und technischen Fähigkeiten des Anwenders noch umgangen werden)',
863 866
  'Edit project'                => 'Projekt bearbeiten',
864 867
  'Edit project #1'             => 'Projekt #1 bearbeiten',
......
1408 1411
  'No or an unknown authenticantion module specified in "config/kivitendo.conf".' => 'Es wurde kein oder ein unbekanntes Authentifizierungsmodul in "config/kivitendo.conf" angegeben.',
1409 1412
  'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
1410 1413
  'No payment term has been created yet.' => 'Es wurden noch keine Zahlungsbedingungen angelegt.',
1414
  'No predefined texts has been created yet.' => 'Es wurden noch keine vordefinierten Textblöcken angelegt.',
1411 1415
  'No prices will be updated because no prices have been entered.' => 'Es werden keine Preise aktualisiert, weil keine gültigen Preisänderungen eingegeben wurden.',
1412 1416
  'No print templates have been created for this client yet. Please do so in the client configuration.' => 'Für diesen Mandanten wurden noch keine Druckvorlagen angelegt. Bitte holen Sie dies in der Mandantenkonfiguration nach.',
1413 1417
  'No printers have been created yet.' => 'Es wurden noch keine Drucker angelegt.',
......
1631 1635
  'Postscript'                  => 'Postscript',
1632 1636
  'Posustva_coa'                => 'USTVA Kennz.',
1633 1637
  'Pre-defined Texts'           => 'Vordefinierte Textblöcke',
1638
  'Predefined Texts'            => 'Vordefinierte Textblöcke',
1634 1639
  'Preferences'                 => 'Einstellungen',
1635 1640
  'Preferences saved!'          => 'Einstellungen gespeichert!',
1636 1641
  'Prefix for the new bins\' names' => 'Namenspräfix für die neuen Lagerplätze',
......
2240 2245
  'The payment term has been saved.' => 'Die Zahlungsbedingungen wurden gespeichert.',
2241 2246
  'The payment term is in use and cannot be deleted.' => 'Die Zahlungsbedingungen werden bereits benutzt und können nicht gelöscht werden.',
2242 2247
  'The payments have been posted.' => 'Die Zahlungen wurden gebucht.',
2248
  'The predefined text has been created.' => 'Der vordefinierte Textblock wurde angelegt.',
2249
  'The predefined text has been deleted.' => 'Der vordefinierte Textblock wurde gelöscht.',
2250
  'The predefined text has been saved.' => 'Der vordefinierte Textblock wurde gespeichert.',
2251
  'The predefined text is in use and cannot be deleted.' => 'Der vordefinierte Textblock wird verwendet und kann nicht gelöscht werden.',
2243 2252
  'The preferred one is to install packages provided by your operating system distribution (e.g. Debian or RPM packages).' => 'Die bevorzugte Art, ein Perl-Modul zu installieren, ist durch Installation eines von Ihrem Betriebssystem zur Verfügung gestellten Paketes (z.B. Debian-Pakete oder RPM).',
2244 2253
  'The printer could not be deleted.' => 'Der Drucker konnte nicht gelöscht werden.',
2245 2254
  'The printer has been created.' => 'Der Drucker wurde angelegt.',
templates/webpages/requirement_spec_predefined_text/form.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2

  
3
 <form method="post" action="controller.pl">
4
  <div class="listtop">[% FORM.title %]</div>
5

  
6
[%- INCLUDE 'common/flash.html' %]
7

  
8
  <table>
9
   <tr>
10
    <td>[% LxERP.t8("Description") %]</sup></td>
11
    <td>[% L.input_tag("requirement_spec_predefined_text.description", SELF.requirement_spec_predefined_text.description, size=60) %]</td>
12
   </tr>
13

  
14
   <tr>
15
    <td>[% LxERP.t8("Title") %]</sup></td>
16
    <td>[% L.input_tag("requirement_spec_predefined_text.title", SELF.requirement_spec_predefined_text.title, size=60) %]</td>
17
   </tr>
18

  
19
   <tr>
20
    <td>[% LxERP.t8("Content") %]</td>
21
    <td>[% L.textarea_tag("requirement_spec_predefined_text.text", SELF.requirement_spec_predefined_text.text, rows=10, cols=80) %]</td>
22
   </tr>
23
  </table>
24

  
25
  <p>
26
   [% L.hidden_tag("id", SELF.requirement_spec_predefined_text.id) %]
27
   [% L.hidden_tag("action", "RequirementSpecPredefinedText/dispatch") %]
28
   [% L.submit_tag("action_" _ (SELF.requirement_spec_predefined_text.id ? "update" : "create"), LxERP.t8('Save')) %]
29
   [%- IF SELF.requirement_spec_predefined_text.id %]
30
    [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %]
31
   [%- END %]
32
   <a href="[% SELF.url_for(action => 'list') %]">[%- LxERP.t8('Abort') %]</a>
33
  </p>
34
 </form>
templates/webpages/requirement_spec_predefined_text/list.html
1
[% USE HTML %][% USE L %][% USE LxERP %]
2

  
3
 <div class="listtop">[% FORM.title %]</div>
4

  
5
[%- INCLUDE 'common/flash.html' %]
6

  
7
 <form method="post" action="controller.pl">
8
  [% IF !REQUIREMENT_SPEC_PREDEFINED_TEXTS.size %]
9
   <p>
10
    [%- LxERP.t8('No predefined texts has been created yet.') %]
11
   </p>
12

  
13
  [%- ELSE %]
14
   <table id="requirement_spec_predefined_text_list">
15
    <thead>
16
    <tr class="listheading">
17
     <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
18
     <th>[% LxERP.t8("Description") %]</th>
19
     <th>[% LxERP.t8("Title") %]</th>
20
     <th>[% LxERP.t8("Content") %]</th>
21
    </tr>
22
    </thead>
23

  
24
    <tbody>
25
    [%- FOREACH requirement_spec_predefined_text = REQUIREMENT_SPEC_PREDEFINED_TEXTS %]
26
    <tr class="listrow[% loop.count % 2 %]" id="requirement_spec_predefined_text_id_[% requirement_spec_predefined_text.id %]">
27
     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
28
     <td>
29
      <a href="[% SELF.url_for(action => 'edit', id => requirement_spec_predefined_text.id) %]">
30
       [%- HTML.escape(requirement_spec_predefined_text.description) -%]
31
      </a>
32
     </td>
33

  
34
     <td>[% HTML.escape(requirement_spec_predefined_text.title) %]</td>
35
     <td>[% HTML.escape(L.truncate(requirement_spec_predefined_text.text)) %]</td>
36
    </tr>
37
    [%- END %]
38
    </tbody>
39
   </table>
40
  [%- END %]
41

  
42
  <p>
43
   <a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8("Create a new predefined text") %]</a>
44
  </p>
45
 </form>
46

  
47
 [% L.sortable_element('#requirement_spec_predefined_text_list tbody', url => 'controller.pl?action=RequirementSpecPredefinedText/reorder', with => 'requirement_spec_predefined_text_id') %]

Auch abrufbar als: Unified diff