]> wagnertech.de Git - mfinanz.git/commitdiff
Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
authorNiclas Zimmermann <niclas@lx-office-hosting.de>
Tue, 4 Sep 2012 15:15:33 +0000 (17:15 +0200)
committerNiclas Zimmermann <niclas@lx-office-hosting.de>
Tue, 4 Sep 2012 15:15:33 +0000 (17:15 +0200)
SL/Controller/Helper/GetModels.pm
SL/Controller/Helper/Paginated.pm
SL/Controller/Helper/Sorted.pm
templates/webpages/background_job/form.html
templates/webpages/background_job/list.html
templates/webpages/background_job_history/list.html
templates/webpages/background_job_history/show.html
templates/webpages/common/paginate.html

index 4658717f6bf4e4946c07adc2810ba3d75d294fde..00ef31017d8db686066db7b9689f0bdc2b89d2da 100644 (file)
@@ -5,7 +5,8 @@ use strict;
 use Exporter qw(import);
 our @EXPORT = qw(get_callback get_models);
 
-my $current_action;
+use constant PRIV => '__getmodelshelperpriv';
+
 my %registered_handlers = ( callback => [], get_models => [] );
 
 sub register_get_models_handlers {
@@ -15,7 +16,7 @@ sub register_get_models_handlers {
   $only           = [ $only ] if !ref $only;
   my %hook_params = @{ $only } ? ( only => $only ) : ();
 
-  $class->run_before(sub { $current_action = $_[1]; }, %hook_params);
+  $class->run_before(sub { $_[0]->{PRIV()} = { current_action => $_[1] }; }, %hook_params);
 
   map { push @{ $registered_handlers{$_} }, $additional_handlers{$_} if $additional_handlers{$_} } keys %registered_handlers;
 }
@@ -23,7 +24,7 @@ sub register_get_models_handlers {
 sub get_callback {
   my ($self, %override_params) = @_;
 
-  my %default_params = _run_handlers($self, 'callback', action => $current_action);
+  my %default_params = _run_handlers($self, 'callback', action => ($self->{PRIV()} || {})->{current_action});
 
   return $self->url_for(%default_params, %override_params);
 }
index f0d617d3174160ac5452349c090fd3d88cebf160..f4a319d2c72ba62da6c2d737233c2023ad36f8c1 100644 (file)
@@ -5,7 +5,9 @@ use strict;
 use Exporter qw(import);
 our @EXPORT = qw(make_paginated get_paginate_spec get_current_paginate_params _save_current_paginate_params _get_models_handler_for_paginated _callback_handler_for_paginated);
 
-my ($controller_paginate_spec, $current_page, $current_per_page);
+use constant PRIV => '__paginatedhelper_priv';
+
+my $controller_paginate_spec;
 
 sub make_paginated {
   my ($class, %specs)       = @_;
@@ -43,8 +45,9 @@ sub get_current_paginate_params {
 
   my $spec              = $self->get_paginate_spec;
 
-  $params{page}         = $current_page     unless defined $params{page};
-  $params{per_page}     = $current_per_page unless defined $params{per_page};
+  my $priv              = $self->{PRIV()} || {};
+  $params{page}         = $priv->{page}     unless defined $params{page};
+  $params{per_page}     = $priv->{per_page} unless defined $params{per_page};
 
   my %paginate_params   =  (
     page                => ($params{page}     * 1) || 1,
@@ -71,19 +74,22 @@ sub _save_current_paginate_params {
   my ($self)        = @_;
 
   my $paginate_spec = $self->get_paginate_spec;
-  $current_page     = $::form->{ $paginate_spec->{FORM_PARAMS}->[0] } || 1;
-  $current_per_page = $::form->{ $paginate_spec->{FORM_PARAMS}->[1] } * 1;
+  $self->{PRIV()}   = {
+    page            => $::form->{ $paginate_spec->{FORM_PARAMS}->[0] } || 1,
+    per_page        => $::form->{ $paginate_spec->{FORM_PARAMS}->[1] } * 1,
+  };
 
-  # $::lxdebug->message(0, "saving current paginate params to $current_page / $current_per_page");
+  # $::lxdebug->message(0, "saving current paginate params to " . $self->{PRIV()}->{page} . ' / ' . $self->{PRIV()}->{per_page});
 }
 
 sub _callback_handler_for_paginated {
   my ($self, %params) = @_;
+  my $priv            = $self->{PRIV()} || {};
 
-  if ($current_page) {
+  if ($priv->{page}) {
     my $paginate_spec                             = $self->get_paginate_spec;
-    $params{ $paginate_spec->{FORM_PARAMS}->[0] } = $current_page;
-    $params{ $paginate_spec->{FORM_PARAMS}->[1] } = $current_per_page if $current_per_page;
+    $params{ $paginate_spec->{FORM_PARAMS}->[0] } = $priv->{page};
+    $params{ $paginate_spec->{FORM_PARAMS}->[1] } = $priv->{per_page} if $priv->{per_page};
   }
 
   # $::lxdebug->dump(0, "CB handler for paginated; params nach modif:", \%params);
index f522d9df698f65c4cc64c50055253dd989b21e75..4afae9d79f34ab2ff15a96392df339a230c3b240 100644 (file)
@@ -5,7 +5,9 @@ use strict;
 use Exporter qw(import);
 our @EXPORT = qw(make_sorted get_sort_spec get_current_sort_params _save_current_sort_params _get_models_handler_for_sorted _callback_handler_for_sorted);
 
-my ($controller_sort_spec, $current_sort_by, $current_sort_dir);
+use constant PRIV => '__sortedhelperpriv';
+
+my $controller_sort_spec;
 
 sub make_sorted {
   my ($class, %specs) = @_;
@@ -56,8 +58,9 @@ sub get_current_sort_params {
   my $sort_spec = $self->get_sort_spec;
 
   if (!$params{sort_by}) {
-    $params{sort_by}  = $current_sort_by;
-    $params{sort_dir} = $current_sort_dir;
+    my $priv          = $self->{PRIV()} || {};
+    $params{sort_by}  = $priv->{by};
+    $params{sort_dir} = $priv->{dir};
   }
 
   my $by          = $params{sort_by} || $sort_spec->{DEFAULT_BY};
@@ -74,22 +77,25 @@ sub get_current_sort_params {
 #
 
 sub _save_current_sort_params {
-  my ($self) = @_;
+  my ($self)      = @_;
 
-  my $sort_spec     = $self->get_sort_spec;
-  $current_sort_by  =   $::form->{ $sort_spec->{FORM_PARAMS}->[0] };
-  $current_sort_dir = !!$::form->{ $sort_spec->{FORM_PARAMS}->[1] } * 1;
+  my $sort_spec   = $self->get_sort_spec;
+  $self->{PRIV()} = {
+    by            =>   $::form->{ $sort_spec->{FORM_PARAMS}->[0] },
+    dir           => !!$::form->{ $sort_spec->{FORM_PARAMS}->[1] } * 1,
+  };
 
-  # $::lxdebug->message(0, "saving current sort params to $current_sort_by / $current_sort_dir");
+  # $::lxdebug->message(0, "saving current sort params to " . $self->{PRIV()}->{by} . ' / ' . $self->{PRIV()}->{dir});
 }
 
 sub _callback_handler_for_sorted {
   my ($self, %params) = @_;
 
-  if ($current_sort_by) {
+  my $priv = $self->{PRIV()} || {};
+  if ($priv->{by}) {
     my $sort_spec                             = $self->get_sort_spec;
-    $params{ $sort_spec->{FORM_PARAMS}->[0] } = $current_sort_by;
-    $params{ $sort_spec->{FORM_PARAMS}->[1] } = $current_sort_dir;
+    $params{ $sort_spec->{FORM_PARAMS}->[0] } = $priv->{by};
+    $params{ $sort_spec->{FORM_PARAMS}->[1] } = $priv->{dir};
   }
 
   # $::lxdebug->dump(0, "CB handler for sorted; params nach modif:", \%params);
index e7e364010c19f49cd514dffb01449d31c0625c58..cbd43af806ec10269e5e368adabade3d7efda5e4 100644 (file)
@@ -1,11 +1,11 @@
 [% USE HTML %][% USE L %][% USE LxERP %]
 <body>
 
- <form method="post" action="controller.pl">
-  <div class="listtop">[% FORM.title %]</div>
+ <h1>[% FORM.title %]</h1>
 
 [%- INCLUDE 'common/flash.html' %]
 
+ <form method="post" action="controller.pl">
   <table>
    <tr>
     <th align="right">[%- LxERP.t8('Active') %]</th>
index 7d480472a87a4d776c2e03b0c4ca342115364199..b8ea3f64dcc39051ba4f7d89c61674eff27e3a7a 100644 (file)
@@ -1,7 +1,7 @@
 [% USE HTML %][% USE L %][% USE LxERP %]
 
 <body>
- <div class="listtop">[% FORM.title %]</div>
+ <h1>[% FORM.title %]</h1>
 
 [%- INCLUDE 'common/flash.html' %]
 
index 48e78b4eeb03c78c703521a90d9acbf073f16985..bf732d44eed0f4bd1fb7fbf6f72474a6fe826839 100644 (file)
@@ -1,7 +1,7 @@
 [% USE HTML %][% USE L %][% USE LxERP %]
 
 <body>
- <div class="listtop">[% FORM.title %]</div>
+ <h1>[% FORM.title %]</h1>
 
 [%- INCLUDE 'common/flash.html' %]
 
index 0a0584fbc4032d3915c734bcb862bd05f90661a6..e9df400604a9afd61db9505a87b8c26d98b8691c 100644 (file)
@@ -1,7 +1,7 @@
 [% USE HTML %][% USE L %][% USE LxERP %]
 <body>
 
- <div class="listtop">[% FORM.title %]</div>
+ <h1>[% FORM.title %]</h1>
 
 [%- INCLUDE 'common/flash.html' %]
 
index 750561efb8112ffe4caee7016d1220163aef7cf2..089972947473e08ff5c998bcabfb5652c6964d35 100644 (file)
@@ -7,12 +7,12 @@
  [%- END %]
 [%- END %]
 [%- IF pages.max > 1 %]
-<span class='paginate'>
+<div class='paginate'>
 [%- IF pages.cur > 1 %]<a class='paginate-prev' href='[% build_url(page=pages.cur - 1) %]'>&laquo; [% 'prev' | $T8 %]</a> [% ELSE %]<b>&laquo;</b> [% END %]
 [%- FOR p = pages.common %]
   [%- NEXT UNLESS p.visible %]
   [%- IF p.active %]<a class='paginate-page' href="[% build_url(page=p.page) %]">[% p.page %]</a> [% ELSE %]<b>[% p.page %]</b> [%- END %]
 [%- END %]
 [%- IF pages.cur < pages.max %]<a class='paginate-next' href='[% build_url(page=pages.cur + 1) %]'>[% 'next' | $T8 %] &raquo;</a>[% ELSE %]<b>&raquo;</b>[%- END %]
-</span>
+</div>
 [%- END %]