Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ee51b82f

Von Tamino Steinert vor mehr als 2 Jahren hinzugefügt

  • ID ee51b82f6206a33d436cb453ebe835d6fbbb4c2c
  • Vorgänger a0a10e44
  • Nachfolger 84dfd7a5

Presenter: nutze link_tag anstelle von html im perl-code

(cherry picked aus Kundenprojekt)

Unterschiede anzeigen:

SL/Presenter/Chart.pm
use Carp;
use Data::Dumper;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(input_tag name_to_id html_tag);
use SL::Presenter::Tag qw(input_tag name_to_id html_tag link_tag);
sub chart {
my ($chart, %params) = @_;
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = join '', (
$params{no_link} ? '' : '<a href="am.pl?action=edit_account&id=' . escape($chart->id) . '">',
escape($chart->accno),
$params{no_link} ? '' : '</a>',
);
my $text = escape($chart->accno);
if (! delete $params{no_link}) {
my $href = 'am.pl?action=edit_account&id=' . escape($chart->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
......
Returns a rendered version (actually an instance of
L<SL::Presenter::EscapedText>) of the chart object C<$object>
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 4
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the chart's name linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
If falsish (the default) then the account number will be linked to the "edit"
dialog.
=back
SL/Presenter/CustomerVendor.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag);
use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(customer_vendor customer vendor customer_vendor_picker customer_picker vendor_picker);
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $callback = $params{callback} ? '&callback=' . $::form->escape($params{callback}) : '';
my $text = join '', (
$params{no_link} ? '' : '<a href="controller.pl?action=CustomerVendor/edit&amp;db=' . $type . '&amp;id=' . escape($cv->id) . '">',
escape($cv->name),
$params{no_link} ? '' : '</a>',
);
my $text = escape($cv->name);
if (! delete $params{no_link}) {
my $href = 'controller.pl?action=CustomerVendor/edit&db=' . $type
. '&id=' . escape($cv->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
......
Returns a rendered version (actually an instance of
L<SL::Presenter::EscapedText>) of the customer object C<$object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the customer's name linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
......
Returns a rendered version (actually an instance of
L<SL::Presenter::EscapedText>) of the vendor object C<$object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the vendor's name linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
SL/Presenter/DeliveryOrder.pm
use SL::DB::DeliveryOrder::TypeData ();
use SL::Locale::String qw(t8);
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(sales_delivery_order purchase_delivery_order delivery_order_status_line);
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = join '', (
$params{no_link} ? '' : '<a href="do.pl?action=edit&amp;type=' . $type . '&amp;id=' . escape($delivery_order->id) . '">',
escape($delivery_order->donumber),
$params{no_link} ? '' : '</a>',
);
my $text = escape($delivery_order->donumber);
if (! delete $params{no_link}) {
my $href = 'do.pl?action=edit&type=' . $type
. '&id=' . escape($delivery_order->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
......
L<SL::Presenter::EscapedText>) of the sales delivery order object
C<$object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the objects's delivery
order number linked to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
......
L<SL::Presenter::EscapedText>) of the purchase delivery order object
C<$object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the objects's delivery
order number linked to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
SL/Presenter/Dunning.pm
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = escape($dunning->dunning_config->dunning_description);
if (! delete $params{no_link}) {
my @flags;
push @flags, 'showold=1';
SL/Presenter/EmailJournal.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(email_journal);
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = join '', (
$params{no_link} ? '' : '<a href="controller.pl?action=EmailJournal/show&amp;id=' . escape($email_journal_entry->id) . '">',
escape($email_journal_entry->subject),
$params{no_link} ? '' : '</a>',
);
my $text = escape($email_journal_entry->subject);
if (! delete $params{no_link}) {
my $href = 'controller.pl?action=EmailJournal/show'
. '&id=' . escape($email_journal_entry->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
......
L<SL::Presenter::EscapedText>) of the email journal object C<$object>
.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the invoice number linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function C<SL::Presenter::Tag::link_tag>.
=item * no_link
SL/Presenter/FileObject.pm
L<SL::Presenter::EscapedText>) of the file object
C<$file_object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
SL/Presenter/GL.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(gl_transaction);
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = join '', (
$params{no_link} ? '' : '<a href="gl.pl?action=edit&amp;id=' . escape($gl_transaction->id) . '">',
escape($gl_transaction->reference),
$params{no_link} ? '' : '</a>',
);
my $text = escape($gl_transaction->reference);
if (! delete $params{no_link}) {
my $href = 'gl.pl?action=edit&id=' . escape($gl_transaction->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
......
Returns a rendered version (actually an instance of
L<SL::Presenter::EscapedText>) of a gl object C<$object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the trans_id number linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
SL/Presenter/Invoice.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(invoice sales_invoice ar_transaction purchase_invoice ap_transaction);
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = join '', (
$params{no_link} ? '' : '<a href="' . $controller . '.pl?action=edit&amp;type=invoice&amp;id=' . escape($invoice->id) . '">',
escape($invoice->invnumber),
$params{no_link} ? '' : '</a>',
);
my $text = escape($invoice->invnumber);
if (! delete $params{no_link}) {
my $href = $controller . '.pl?action=edit&type=invoice'
. '&id=' . escape($invoice->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
......
L<SL::Presenter::EscapedText>) of an ar/ap/is/ir object C<$object> . Determines
which type (sales or purchase, invoice or not) the object is.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the invoice number linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
......
L<SL::Presenter::EscapedText>) of the sales invoice object C<$object>
.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the invoice number linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
......
L<SL::Presenter::EscapedText>) of the AR transaction object C<$object>
.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the invoice number linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
......
L<SL::Presenter::EscapedText>) of the purchase invoice object
C<$object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the invoice number name
linked to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
......
L<SL::Presenter::EscapedText>) of the AP transaction object C<$object>
.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the invoice number linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
SL/Presenter/Letter.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(letter);
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = join '', (
$params{no_link} ? '' : '<a href="controller.pl?action=Letter/edit&amp;letter.id=' . escape($letter->id) . '">',
escape($letter->letternumber),
$params{no_link} ? '' : '</a>',
);
my $text = escape($letter->letternumber);
if (! delete $params{no_link}) {
my $href = 'controller.pl?action=Letter/edit'
. '&letter.id=' . escape($letter->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
......
L<SL::Presenter::EscapedText>) of the letter object C<$object>
.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the invoice number linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
SL/Presenter/Order.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(sales_quotation sales_order request_quotation purchase_order);
......
my $number_method = $order->quotation ? 'quonumber' : 'ordnumber';
my $link_start = '';
my $link_end = '';
unless ($params{no_link}) {
my $text = escape($order->$number_method);
if (! delete $params{no_link}) {
my $action = $::instance_conf->get_feature_experimental_order
? 'controller.pl?action=Order/edit'
: 'oe.pl?action=edit';
$link_start = '<a href="' . $action . '&amp;type=' . $type . '&amp;id=' . escape($order->id) . '">';
$link_end = '</a>';
my $href = $action
. '&type=' . $type
. '&id=' . escape($order->id);
$text = link_tag($href, $text, %params);
}
my $text = join '', ($link_start, escape($order->$number_method), $link_end);
is_escaped($text);
}
......
L<SL::Presenter::EscapedText>) of the sales quotation object
C<$object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the objects's
quotation number linked to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
......
Returns a rendered version (actually an instance of
L<SL::Presenter::EscapedText>) of the sales order object C<$object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the objects's
order number linked to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
......
L<SL::Presenter::EscapedText>) of the request for quotation object
C<$object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the objects's
quotation number linked to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
......
L<SL::Presenter::EscapedText>) of the purchase order object
C<$object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the objects's
order number linked to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
SL/Presenter/Part.pm
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = join '', (
$params{no_link} ? '' : '<a href="controller.pl?action=Part/edit&part.id=' . escape($part->id) . '">',
escape($part->partnumber),
$params{no_link} ? '' : '</a>',
);
my $text = escape($part->partnumber);
if (! delete $params{no_link}) {
my $href = 'controller.pl?action=Part/edit'
. '&part.id=' . escape($part->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
......
Returns a rendered version (actually an instance of
L<SL::Presenter::EscapedText>) of the part object C<$object>
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 4
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the part's name linked
to the corresponding 'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * no_link
If falsish (the default) then the part number will be linked to the "edit"
dialog.
=back
SL/Presenter/Project.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag);
use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(project project_picker);
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $description = $project->full_description(style => $params{style});
my $callback = $params{callback} ? '&callback=' . $::form->escape($params{callback}) : '';
my $description = $project->full_description(style => delete $params{style});
my $callback = $params{callback} ?
'&callback=' . $::form->escape(delete $params{callback})
: '';
my $text = escape($description);
if (! delete $params{no_link}) {
my $href = 'controller.pl?action=Project/edit'
. '&id=' . escape($project->id)
. $callback;
$text = link_tag($href, $text, %params);
}
my $text = join '', (
$params{no_link} ? '' : '<a href="controller.pl?action=Project/edit&amp;id=' . escape($project->id) . $callback . '">',
escape($description),
$params{no_link} ? '' : '</a>',
);
is_escaped($text);
}
......
Returns a rendered version (actually an instance of
L<SL::Presenter::EscapedText>) of the project object C<$customer>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2
=item * display
Either C<inline> (the default) or C<table-cell>. At the moment both
representations are identical and produce the project's description
(controlled by the C<style> parameter) linked to the corresponding
'edit' action.
Either C<inline> (the default) or C<table-cell>. Is passed to the function
C<SL::Presenter::Tag::link_tag>.
=item * style
Determines what exactly will be output. Can be one of the values with
C<both> being the default if it is missing:
=item * no_link
If falsish (the default) then the description will be linked to the "edit"
dialog.
=over 2
=item C<projectnumber> (or simply C<number>)
SL/Presenter/RequirementSpec.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(requirement_spec);
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = join '', (
$params{no_link} ? '' : '<a href="controller.pl?action=RequirementSpec/show&amp;id=' . escape($requirement_spec->id) . '">',
escape($requirement_spec->id),
$params{no_link} ? '' : '</a>',
);
my $text = escape($requirement_spec->id);
if (! delete $params{no_link}) {
my $href = 'controller.pl?action=RequirementSpec/show'
. '&id=' . escape($requirement_spec->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
SL/Presenter/SepaExport.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(sepa_export);
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = join '', (
$params{no_link} ? '' : '<a href="sepa.pl?action=bank_transfer_edit&amp;vc=' . escape($sepa_export->vc) . '&amp;id=' . escape($sepa_export->id) . '">',
escape($sepa_export->id),
$params{no_link} ? '' : '</a>',
);
my $text = escape($sepa_export->id);
if (! delete $params{no_link}) {
my $href = 'sepa.pl?action=bank_transfer_edit'
. '&vc=' . escape($sepa_export->vc)
. '&id=' . escape($sepa_export->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
SL/Presenter/ShopOrder.pm
use strict;
use SL::Presenter::EscapedText qw(escape is_escaped);
use SL::Presenter::Tag qw(link_tag);
use Exporter qw(import);
our @EXPORT_OK = qw(shop_order);
......
croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
my $text = join '', (
$params{no_link} ? '' : '<a href="controller.pl?action=ShopOrder/show&amp;id='. escape($shop_order->id) .'">',
escape($shop_order->shop_ordernumber),
$params{no_link} ? '' : '</a>',
);
my $text = escape($shop_order->shop_ordernumber);
if (! delete $params{no_link}) {
my $href = 'controller.pl?action=ShopOrder/show'
. '&id='. escape($shop_order->id);
$text = link_tag($href, $text, %params);
}
is_escaped($text);
}
SL/Presenter/WebdavObject.pm
L<SL::Presenter::EscapedText>) of the webdav object
C<$webdav_object>.
C<%params> can include:
Remaining C<%params> are passed to the function
C<SL::Presenter::Tag::link_tag>. It can include:
=over 2

Auch abrufbar als: Unified diff