+++ /dev/null
-package SL::Controller::RequirementSpecPredefinedText;
-
-use strict;
-
-use parent qw(SL::Controller::Base);
-
-use List::MoreUtils qw(none);
-
-use SL::DB::RequirementSpecPredefinedText;
-use SL::Helper::Flash;
-use SL::Locale::String;
-
-use Rose::Object::MakeMethods::Generic
-(
- scalar => [ qw(requirement_spec_predefined_text) ],
-);
-
-__PACKAGE__->run_before('check_auth');
-__PACKAGE__->run_before('setup');
-__PACKAGE__->run_before('load_requirement_spec_predefined_text', only => [ qw(edit update destroy) ]);
-
-#
-# actions
-#
-
-sub action_list {
- my ($self) = @_;
-
- $self->render('requirement_spec_predefined_text/list',
- title => t8('Pre-defined Texts'),
- REQUIREMENT_SPEC_PREDEFINED_TEXTS => SL::DB::Manager::RequirementSpecPredefinedText->get_all_sorted);
-}
-
-sub action_new {
- my ($self) = @_;
-
- $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new(useable_for_text_blocks => 1);
- $self->render('requirement_spec_predefined_text/form', title => t8('Create a new predefined text'));
-}
-
-sub action_edit {
- my ($self) = @_;
- $self->render('requirement_spec_predefined_text/form', title => t8('Edit predefined text'));
-}
-
-sub action_create {
- my ($self) = @_;
-
- $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new;
- $self->create_or_update;
-}
-
-sub action_update {
- my ($self) = @_;
- $self->create_or_update;
-}
-
-sub action_destroy {
- my ($self) = @_;
-
- if (eval { $self->{requirement_spec_predefined_text}->delete; 1; }) {
- flash_later('info', t8('The predefined text has been deleted.'));
- } else {
- flash_later('error', t8('The predefined text is in use and cannot be deleted.'));
- }
-
- $self->redirect_to(action => 'list');
-}
-
-sub action_reorder {
- my ($self) = @_;
-
- SL::DB::RequirementSpecPredefinedText->reorder_list(@{ $::form->{requirement_spec_predefined_text_id} || [] });
-
- $self->render(\'', { type => 'json' });
-}
-
-#
-# filters
-#
-
-sub check_auth {
- $::auth->assert('config');
-}
-
-sub setup {
- $::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery);
-}
-
-#
-# helpers
-#
-
-sub create_or_update {
- my $self = shift;
- my $is_new = !$self->{requirement_spec_predefined_text}->id;
- my $params = delete($::form->{requirement_spec_predefined_text}) || { };
- my $title = $is_new ? t8('Create a new predefined text') : t8('Edit predefined text');
-
- # Force presence of booleans for the useable_* flags.
- my @useable_flags = qw(text_blocks sections);
- $params->{"useable_for_${_}"} = !!$params->{"useable_for_${_}"} for @useable_flags;
-
- # Force usage for text blocks if none of the check boxes are marked.
- $params->{useable_for_text_blocks} = 1 if none { $params->{"useable_for_${_}"} } @useable_flags;
-
- $self->{requirement_spec_predefined_text}->assign_attributes(%{ $params });
-
- my @errors = $self->{requirement_spec_predefined_text}->validate;
-
- if (@errors) {
- flash('error', @errors);
- $self->render('requirement_spec_predefined_text/form', title => $title);
- return;
- }
-
- $self->{requirement_spec_predefined_text}->save;
-
- flash_later('info', $is_new ? t8('The predefined text has been created.') : t8('The predefined text has been saved.'));
- $self->redirect_to(action => 'list');
-}
-
-sub load_requirement_spec_predefined_text {
- my ($self) = @_;
- $self->{requirement_spec_predefined_text} = SL::DB::RequirementSpecPredefinedText->new(id => $::form->{id})->load;
-}
-
-1;
},
},
+ requirement_spec_predefined_text => {
+ # Make locales.pl happy: $self->render("simple_system_setting/_requirement_spec_predefined_text_form")
+ class => 'RequirementSpecPredefinedText',
+ titles => {
+ list => t8('Pre-defined Texts'),
+ add => t8('Add pre-defined text'),
+ edit => t8('Edit pre-defined text'),
+ },
+ list_attributes => [
+ { method => 'description', title => t8('Description') },
+ { method => 'title', title => t8('Title') },
+ { title => t8('Content'), formatter => sub { my $t = $_[0]->text_as_stripped_html; length($t) > 50 ? substr($t, 0, 50) . '…' : $t } },
+ { title => t8('Useable for text blocks'), formatter => sub { $_[0]->useable_for_text_blocks ? t8('yes') : t8('no') } },
+ { title => t8('Useable for sections'), formatter => sub { $_[0]->useable_for_sections ? t8('yes') : t8('no') } },
+ ],
+ },
+
);
my @default_list_attributes = (
'Add partsgroup' => 'Warengruppe hinzufügen',
'Add picture' => 'Bild hinzufügen',
'Add picture to text block' => 'Bild dem Textblock hinzufügen',
+ 'Add pre-defined text' => 'Vordefinierten Textblock hinzufügen',
'Add pricegroup' => 'Preisgruppe hinzufügen',
'Add project status' => 'Projektstatus hinzufügen',
'Add project type' => 'Projekttypen hinzufügen',
'Create a new delivery term' => 'Neue Lieferbedingungen anlegen',
'Create a new group' => 'Neue Benutzergruppe erfassen',
'Create a new payment term' => 'Neue Zahlungsbedingungen anlegen',
- 'Create a new predefined text' => 'Einen neuen vordefinierten Textblock anlegen',
'Create a new price rule' => 'Neue Preisregel anlegen',
'Create a new printer' => 'Einen neuen Drucker anlegen',
'Create a new project' => 'Neues Projekt anlegen',
'Edit partsgroup' => 'Warengruppe bearbeiten',
'Edit payment term' => 'Zahlungsbedingungen bearbeiten',
'Edit picture' => 'Bild bearbeiten',
- 'Edit predefined text' => 'Vordefinierten Textblock bearbeiten',
+ 'Edit pre-defined text' => 'Vordefinierten Textblock bearbeiten',
'Edit price rule' => 'Preisregel bearbeiten',
'Edit pricegroup' => 'Preisgruppe bearbeiten',
'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)',
'No payment term has been created yet.' => 'Es wurden noch keine Zahlungsbedingungen angelegt.',
'No picture has been uploaded' => 'Es wurde kein Bild hochgeladen',
'No picture uploaded yet' => 'Noch kein Bild hochgeladen',
- 'No predefined texts has been created yet.' => 'Es wurden noch keine vordefinierten Textblöcken angelegt.',
'No prices will be updated because no prices have been entered.' => 'Es werden keine Preise aktualisiert, weil keine gültigen Preisänderungen eingegeben wurden.',
'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.',
'No printers have been created yet.' => 'Es wurden noch keine Drucker angelegt.',
'The payment term has been saved.' => 'Die Zahlungsbedingungen wurden gespeichert.',
'The payment term is in use and cannot be deleted.' => 'Die Zahlungsbedingungen werden bereits benutzt und können nicht gelöscht werden.',
'The payments have been posted.' => 'Die Zahlungen wurden gebucht.',
- 'The predefined text has been created.' => 'Der vordefinierte Textblock wurde angelegt.',
- 'The predefined text has been deleted.' => 'Der vordefinierte Textblock wurde gelöscht.',
- 'The predefined text has been saved.' => 'Der vordefinierte Textblock wurde gespeichert.',
- 'The predefined text is in use and cannot be deleted.' => 'Der vordefinierte Textblock wird verwendet und kann nicht gelöscht werden.',
'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).',
'The price rule for this discount does not exist anymore' => 'Die Preisregel für diesen Rabatt existiert nicht mehr',
'The price rule for this price does not exist anymore' => 'Die Preisregel für diesen Preis existiert nicht mehr',
'Use this storage backend for all generated PDF-Files' => 'Verwende dieses Backend für generierte PDF-Dateien',
'Use this storage backend for all uploaded attachments' => 'Verwende dieses Backend für hochgeladene Dateien',
'Use this storage backend for uploaded images' => 'Verwende dieses Backend für hochgeladene Bilder',
+ 'Useable for sections' => 'Für Abschnitte nutzbar',
+ 'Useable for text blocks' => 'Für Textblöcke nutzbar',
'Useable for…' => 'Benutzbar für…',
'Used for Purchase' => 'im Einkauf verwenden',
'Used for Sale' => 'im Verkauf verwenden',
name: Pre-defined Texts
order: 100
params:
- action: RequirementSpecPredefinedText/list
+ action: SimpleSystemSetting/list
+ type: requirement_spec_predefined_text
- parent: system_requirement_specs
id: system_requirement_specs_requirement_spec_types
name: Requirement Spec Types
+++ /dev/null
-[% USE HTML %][% USE L %][% USE LxERP %]
-<h1>[% FORM.title %]</h1>
-
- <form method="post" action="controller.pl">
-
-[%- INCLUDE 'common/flash.html' %]
-
- <table>
- <tr>
- <td>[% LxERP.t8("Description") %]</td>
- <td>[% L.input_tag("requirement_spec_predefined_text.description", SELF.requirement_spec_predefined_text.description, size=60, class='initial_focus') %]</td>
- </tr>
-
- <tr>
- <td>[% LxERP.t8("Title") %]</td>
- <td>[% L.input_tag("requirement_spec_predefined_text.title", SELF.requirement_spec_predefined_text.title, size=60) %]</td>
- </tr>
-
- <tr valign="top">
- <td>[% LxERP.t8("Content") %]</td>
- <td>[% L.textarea_tag("requirement_spec_predefined_text.text_as_restricted_html", SELF.requirement_spec_predefined_text.text_as_restricted_html, class='texteditor', style='width: 800px; height: 300px') %]</td>
- </tr>
-
- <tr>
- <td>[% LxERP.t8("Useable for…") %]</sup></td>
- <td>
- [% L.checkbox_tag("requirement_spec_predefined_text.useable_for_text_blocks", label=LxERP.t8("Text blocks"), value=1, checked=SELF.requirement_spec_predefined_text.useable_for_text_blocks) %]
- [% L.checkbox_tag("requirement_spec_predefined_text.useable_for_sections", label=LxERP.t8("Sections"), value=1, checked=SELF.requirement_spec_predefined_text.useable_for_sections) %]
- </td>
- </tr>
- </table>
-
- <p>
- [% L.hidden_tag("id", SELF.requirement_spec_predefined_text.id) %]
- [% L.hidden_tag("action", "RequirementSpecPredefinedText/dispatch") %]
- [% L.submit_tag("action_" _ (SELF.requirement_spec_predefined_text.id ? "update" : "create"), LxERP.t8('Save')) %]
- [%- IF SELF.requirement_spec_predefined_text.id %]
- [% L.submit_tag("action_destroy", LxERP.t8('Delete'), confirm=LxERP.t8('Do you really want to delete this object?')) %]
- [%- END %]
- <a href="[% SELF.url_for(action => 'list') %]">[%- LxERP.t8('Abort') %]</a>
- </p>
- </form>
+++ /dev/null
-[% USE HTML %][% USE L %][% USE LxERP %]
-<h1>[% FORM.title %]</h1>
-
-[%- INCLUDE 'common/flash.html' %]
-
- <form method="post" action="controller.pl">
- [% IF !REQUIREMENT_SPEC_PREDEFINED_TEXTS.size %]
- <p>
- [%- LxERP.t8('No predefined texts has been created yet.') %]
- </p>
-
- [%- ELSE %]
- <table id="requirement_spec_predefined_text_list">
- <thead>
- <tr class="listheading">
- <th colspan="4"></th>
- <th colspan="2" align="center">[% LxERP.t8("Useable for…") %]</th>
- </tr>
- <tr class="listheading">
- <th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
- <th>[% LxERP.t8("Description") %]</th>
- <th>[% LxERP.t8("Title") %]</th>
- <th>[% LxERP.t8("Content") %]</th>
- <th>[% LxERP.t8("Text blocks") %]</th>
- <th>[% LxERP.t8("Sections") %]</th>
- </tr>
- </thead>
-
- <tbody>
- [%- FOREACH requirement_spec_predefined_text = REQUIREMENT_SPEC_PREDEFINED_TEXTS %]
- <tr class="listrow[% loop.count % 2 %]" id="requirement_spec_predefined_text_id_[% requirement_spec_predefined_text.id %]">
- <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
- <td>
- <a href="[% SELF.url_for(action => 'edit', id => requirement_spec_predefined_text.id) %]">
- [%- HTML.escape(requirement_spec_predefined_text.description) -%]
- </a>
- </td>
-
- <td>[% HTML.escape(requirement_spec_predefined_text.title) %]</td>
- <td>[% HTML.escape(L.truncate(requirement_spec_predefined_text.text_as_stripped_html)) %]</td>
- <td align="right">[% IF requirement_spec_predefined_text.useable_for_text_blocks %][% LxERP.t8("Yes") %][% ELSE %][% LxERP.t8("No") %][% END %]</td>
- <td align="right">[% IF requirement_spec_predefined_text.useable_for_sections %][% LxERP.t8("Yes") %][% ELSE %][% LxERP.t8("No") %][% END %]</td>
- </tr>
- [%- END %]
- </tbody>
- </table>
- [%- END %]
-
- <p>
- <a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8("Create a new predefined text") %]</a>
- </p>
- </form>
-
- [% L.sortable_element('#requirement_spec_predefined_text_list tbody', url => 'controller.pl?action=RequirementSpecPredefinedText/reorder', with => 'requirement_spec_predefined_text_id') %]
--- /dev/null
+[%- USE LxERP -%][%- USE L -%]<table>
+ <tr>
+ <th align="right">[% LxERP.t8("Description") %]</th>
+ <td>[% L.input_tag("object.description", SELF.object.description, size=60, class="initial_focus", "data-validate"="required", "data-title"=LxERP.t8("Description")) %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% LxERP.t8("Title") %]</th>
+ <td>[% L.input_tag("object.title", SELF.object.title, size=60) %]</td>
+ </tr>
+
+ <tr valign="top">
+ <th align="right">[% LxERP.t8("Content") %]</th>
+ <td>[% L.textarea_tag("object.text_as_restricted_html", SELF.object.text_as_restricted_html, class="texteditor", style="width: 800px; height: 300px") %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% LxERP.t8("Useable for…") %]</th>
+ <td>
+ [% L.checkbox_tag("object.useable_for_text_blocks", label=LxERP.t8("Text blocks"), for_submit=1, value=1, checked=SELF.object.useable_for_text_blocks) %]
+ [% L.checkbox_tag("object.useable_for_sections", label=LxERP.t8("Sections"), for_submit=1, value=1, checked=SELF.object.useable_for_sections) %]
+ </td>
+ </tr>
+</table>