]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Template/Plugin/L.pm
Merge branch 'dpt_trans_entfernen'
[mfinanz.git] / SL / Template / Plugin / L.pm
index 4ed65ab291ce78c8ecda644a452b1ec2cb70e8b4..bac6f7f12ac4833d88517e1e0a194e6bb9836a2c 100644 (file)
@@ -6,6 +6,8 @@ use List::MoreUtils qw(apply);
 use List::Util qw(max);
 use Scalar::Util qw(blessed);
 
+use SL::Presenter;
+
 use strict;
 
 { # This will give you an id for identifying html tags and such.
@@ -281,7 +283,8 @@ sub input_tag {
 }
 
 sub hidden_tag {
-  return shift->input_tag(@_, type => 'hidden');
+  my ($self, $name, $value, @slurp) = @_;
+  return $self->input_tag($name, $value, _hashify(@slurp), type => 'hidden');
 }
 
 sub div_tag {
@@ -355,41 +358,23 @@ sub stylesheet_tag {
   return $code;
 }
 
+my $date_tag_id_idx = 0;
 sub date_tag {
   my ($self, $name, $value, @slurp) = @_;
+
   my %params   = _hashify(@slurp);
-  my $name_e   = _H($name);
-  my $seq      = _tag_id();
-  my $datefmt  = apply {
-    s/d+/\%d/gi;
-    s/m+/\%m/gi;
-    s/y+/\%Y/gi;
-  } $::myconfig{"dateformat"};
-
-  my $cal_align = delete $params{cal_align} || 'BR';
-  my $onchange  = delete $params{onchange};
-  my $str_value = blessed $value ? $value->to_lxoffice : $value;
-
-  $self->input_tag($name, $str_value,
-    id     => $name_e,
+  my $id       = $self->name_to_id($name) . _tag_id();
+  my @onchange = $params{onchange} ? (onChange => delete $params{onchange}) : ();
+  my @class    = $params{no_cal} || $params{readonly} ? () : (class => 'datepicker');
+
+  return $self->input_tag(
+    $name, blessed($value) ? $value->to_lxoffice : $value,
+    id     => $id,
     size   => 11,
-    title  => _H($::myconfig{dateformat}),
-    onBlur => 'check_right_date_format(this)',
-    ($onchange ? (
-    onChange => $onchange,
-    ) : ()),
-    %params,
-  ) . ((!$params{no_cal} && !$params{readonly}) ?
-  $self->html_tag('img', undef,
-    src    => 'image/calendar.png',
-    alt    => $::locale->text('Calendar'),
-    id     => "trigger$seq",
-    title  => _H($::myconfig{dateformat}),
+    onblur => "check_right_date_format(this);",
     %params,
-  ) .
-  $self->javascript(
-    "Calendar.setup({ inputField: '$name_e', ifFormat: '$datefmt', align: '$cal_align', button: 'trigger$seq' });"
-  ) : '');
+    @class, @onchange,
+  );
 }
 
 sub customer_picker {
@@ -462,27 +447,15 @@ sub tabbed {
 
     next if $tab eq '';
 
-    my $selected = $params{selected} == $i;
-    my $tab_id   = "__tab_id_$i";
-    push @header, $self->li_tag(
-      $self->link('', $tab->{name}, rel => $tab_id),
-        ($selected ? (class => 'selected') : ())
-    );
-    push @blocks, $self->div_tag($tab->{data},
-      id => $tab_id, class => 'tabcontent');
+    my $tab_id = "__tab_id_$i";
+    push @header, $self->li_tag($self->link('#' . $tab_id, $tab->{name}));
+    push @blocks, $self->div_tag($tab->{data}, id => $tab_id);
   }
 
   return '' unless @header;
-  return $self->ul_tag(
-    join('', @header), id => $id, class => 'shadetabs'
-  ) .
-  $self->div_tag(
-    join('', @blocks), class => 'tabcontentstyle'
-  ) .
-  $self->javascript(
-    qq|var $id = new ddtabcontent("$id");$id.setpersist(true);| .
-    qq|$id.setselectedClassTarget("link");$id.init();|
-  );
+
+  my $ul = $self->ul_tag(join('', @header), id => $id);
+  return $self->div_tag(join('', $ul, @blocks), class => 'tabwidget');
 }
 
 sub tab {
@@ -675,9 +648,7 @@ sub paginate_controls {
     },
   );
 
-  my $output;
-  $controller->_template_obj->process('templates/webpages/common/paginate.html', \%template_params, \$output);
-  return $output;
+  return SL::Presenter->get->render('common/paginate', %template_params);
 }
 
 1;
@@ -840,13 +811,10 @@ If C<%attributes> contains a key C<checkall> then the value is taken as a
 JQuery selector and clicking this checkbox will also toggle all checkboxes
 matching the selector.
 
-=item C<date_tag $name, $value, cal_align =E<gt> $align_code, %attributes>
+=item C<date_tag $name, $value, %attributes>
 
 Creates a date input field, with an attached javascript that will open a
-calendar on click. The javascript ist by default anchoered at the bottom right
-sight. This can be overridden with C<cal_align>, see Calendar documentation for
-the details, usually you'll want a two letter abbreviation of the alignment.
-Right + Bottom becomes C<BL>.
+calendar on click.
 
 =item C<radio_button_tag $name, %attributes>
 
@@ -872,14 +840,6 @@ for each file name parameter passed. Each file name will be postfixed
 with '.css' if it isn't already and prefixed with 'css/' if it doesn't
 contain a slash.
 
-=item C<date_tag $name, $value, cal_align =E<gt> $align_code, %attributes>
-
-Creates a date input field, with an attached javascript that will open a
-calendar on click. The javascript ist by default anchoered at the bottom right
-sight. This can be overridden with C<cal_align>, see Calendar documentation for
-the details, usually you'll want a two letter abbreviation of the alignment.
-Right + Bottom becomes C<BL>.
-
 =item C<tabbed \@tab, %attributes>
 
 Will create a tabbed area. The tabs should be created with the helper function
@@ -890,9 +850,6 @@ C<tab>. Example:
     L.tab(LxERP.t8('Custom Variables'), 'part/_cvar_tab.html', if => SELF.display_cvar_tab),
   ]) %]
 
-An optional attribute is C<selected>, which accepts the ordinal of a tab which
-should be selected by default.
-
 =item C<areainput_tag $name, $content, %PARAMS>
 
 Creates a generic input tag or textarea tag, depending on content size. The