From b6fd15a8dc44f9b09d5a2bce766cda14b87c6e13 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 16 Oct 2012 12:58:50 +0200 Subject: [PATCH] Layout package names refactored SL::Controller::Layout::* -> SL::Layout::* SL::Controller::Layout -> SL::Layout::Dispatcher --- SL/Controller/Layout.pm | 28 ------------------------ SL/Controller/Layout/Classic.pm | 23 ------------------- SL/Controller/LoginScreen.pm | 4 ++-- SL/Dispatcher.pm | 4 ++-- SL/Dispatcher/AuthHandler/Admin.pm | 4 ++-- SL/Dispatcher/AuthHandler/User.pm | 4 ++-- SL/Form.pm | 3 ++- SL/{Controller => }/Layout/Admin.pm | 6 ++--- SL/{Controller => }/Layout/Base.pm | 2 +- SL/Layout/Classic.pm | 23 +++++++++++++++++++ SL/{Controller => }/Layout/Css.pm | 2 +- SL/Layout/Dispatcher.pm | 27 +++++++++++++++++++++++ SL/{Controller => }/Layout/Javascript.pm | 6 ++--- SL/{Controller => }/Layout/Login.pm | 6 ++--- SL/{Controller => }/Layout/MenuLeft.pm | 4 ++-- SL/{Controller => }/Layout/None.pm | 4 ++-- SL/{Controller => }/Layout/Top.pm | 4 ++-- SL/{Controller => }/Layout/V3.pm | 8 +++---- SL/{Controller => }/Layout/V4.pm | 12 +++++----- 19 files changed, 87 insertions(+), 87 deletions(-) delete mode 100644 SL/Controller/Layout.pm delete mode 100644 SL/Controller/Layout/Classic.pm rename SL/{Controller => }/Layout/Admin.pm (66%) rename SL/{Controller => }/Layout/Base.pm (98%) create mode 100644 SL/Layout/Classic.pm rename SL/{Controller => }/Layout/Css.pm (98%) create mode 100644 SL/Layout/Dispatcher.pm rename SL/{Controller => }/Layout/Javascript.pm (96%) rename SL/{Controller => }/Layout/Login.pm (66%) rename SL/{Controller => }/Layout/MenuLeft.pm (96%) rename SL/{Controller => }/Layout/None.pm (83%) rename SL/{Controller => }/Layout/Top.pm (82%) rename SL/{Controller => }/Layout/V3.pm (83%) rename SL/{Controller => }/Layout/V4.pm (77%) diff --git a/SL/Controller/Layout.pm b/SL/Controller/Layout.pm deleted file mode 100644 index 82d5da848..000000000 --- a/SL/Controller/Layout.pm +++ /dev/null @@ -1,28 +0,0 @@ -package SL::Controller::Layout; - -use strict; -use parent qw(SL::Controller::Base); - -use SL::Menu; -use SL::Controller::Layout::Admin; -use SL::Controller::Layout::Login; -use SL::Controller::Layout::Classic; -use SL::Controller::Layout::V3; -use SL::Controller::Layout::V4; -use SL::Controller::Layout::Javascript; - -my %menu_cache; - -sub new { - my ($class, %params) = @_; - - return SL::Controller::Layout::Classic->new if $params{style} eq 'old'; - return SL::Controller::Layout::V3->new if $params{style} eq 'v3'; - return SL::Controller::Layout::V4->new if $params{style} eq 'v4'; - return SL::Controller::Layout::Javascript->new if $params{style} eq 'neu'; - return SL::Controller::Layout::Admin->new if $params{style} eq 'admin'; - return SL::Controller::Layout::Login->new if $params{style} eq 'login'; - return SL::Controller::Layout::None->new; -} - -1; diff --git a/SL/Controller/Layout/Classic.pm b/SL/Controller/Layout/Classic.pm deleted file mode 100644 index b7438740c..000000000 --- a/SL/Controller/Layout/Classic.pm +++ /dev/null @@ -1,23 +0,0 @@ -package SL::Controller::Layout::Classic; - -use strict; -use parent qw(SL::Controller::Layout::Base); - -use SL::Controller::Layout::Top; -use SL::Controller::Layout::MenuLeft; - -sub new { - my ($class, @slurp) = @_; - - my $self = $class->SUPER::new(@slurp); - - $self->add_sub_layouts([ - SL::Controller::Layout::Top->new, - SL::Controller::Layout::MenuLeft->new, - SL::Controller::Layout::None->new, - ]); - - $self; -} - -1; diff --git a/SL/Controller/LoginScreen.pm b/SL/Controller/LoginScreen.pm index e73224bcc..89909c00d 100644 --- a/SL/Controller/LoginScreen.pm +++ b/SL/Controller/LoginScreen.pm @@ -39,7 +39,7 @@ sub action_login { $::form->{login} = $::myconfig{login}; $::locale = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode}; my $user = User->new(login => $::myconfig{login}); - $::request->{layout} = SL::Controller::Layout->new(style => $user->{menustyle}); + $::request->{layout} = SL::Layout->new(style => $user->{menustyle}); # if we get an error back, bale out my $result = $user->login($::form); @@ -118,7 +118,7 @@ sub error_state { } sub set_layout { - $::request->{layout} = SL::Controller::Layout->new(style => 'login'); + $::request->{layout} = SL::Layout::Dispatcher->new(style => 'login'); } 1; diff --git a/SL/Dispatcher.pm b/SL/Dispatcher.pm index d65e5d5e0..35a351877 100644 --- a/SL/Dispatcher.pm +++ b/SL/Dispatcher.pm @@ -35,7 +35,7 @@ use SL::Form; use SL::Helper::DateTime; use SL::InstanceConfiguration; use SL::Template::Plugin::HTMLFixes; -use SL::Controller::Layout::None; +use SL::Layout::None; # Trailing new line is added so that Perl will not add the line # number 'die' was called in. @@ -184,7 +184,7 @@ sub handle_request { $::instance_conf = SL::InstanceConfiguration->new; $::request = { cgi => CGI->new({}), - layout => SL::Controller::Layout::None->new, + layout => SL::Layout::None->new, }; my $session_result = $::auth->restore_session; diff --git a/SL/Dispatcher/AuthHandler/Admin.pm b/SL/Dispatcher/AuthHandler/Admin.pm index 86efbb2dc..2e41ee90e 100644 --- a/SL/Dispatcher/AuthHandler/Admin.pm +++ b/SL/Dispatcher/AuthHandler/Admin.pm @@ -3,7 +3,7 @@ package SL::Dispatcher::AuthHandler::Admin; use strict; use parent qw(Rose::Object); -use SL::Controller::Layout; +use SL::Layout::Dispatcher; sub handle { %::myconfig = (); @@ -11,7 +11,7 @@ sub handle { return if $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'}) == $::auth->OK()); return if !$::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::auth->get_session_value('admin_password')) == $::auth->OK()); - $::request->{layout} = SL::Controller::Layout->new(style => 'admin'); + $::request->{layout} = SL::Layout::Dispatcher->new(style => 'admin'); $::auth->punish_wrong_login; $::auth->delete_session_value('admin_password'); diff --git a/SL/Dispatcher/AuthHandler/User.pm b/SL/Dispatcher/AuthHandler/User.pm index 6dc200bae..1273d679f 100644 --- a/SL/Dispatcher/AuthHandler/User.pm +++ b/SL/Dispatcher/AuthHandler/User.pm @@ -3,7 +3,7 @@ package SL::Dispatcher::AuthHandler::User; use strict; use parent qw(Rose::Object); -use SL::Controller::Layout; +use SL::Layout::Dispatcher; sub handle { my ($self, %param) = @_; @@ -16,7 +16,7 @@ sub handle { $self->_error(%param) unless $::myconfig{login}; $::locale = Locale->new($::myconfig{countrycode}); - $::request->{layout} = SL::Controller::Layout->new(style => $::myconfig{menustyle}); + $::request->{layout} = SL::Layout::Dispatcher->new(style => $::myconfig{menustyle}); my $ok = $::form->{'{AUTH}login'} && (SL::Auth::OK() == $::auth->authenticate($::myconfig{login}, $::form->{'{AUTH}password'})); $ok ||= !$::form->{'{AUTH}login'} && (SL::Auth::OK() == $::auth->authenticate($::myconfig{login}, undef)); diff --git a/SL/Form.pm b/SL/Form.pm index 591e02df3..aa83e2913 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -56,6 +56,7 @@ use SL::DBUtils; use SL::DO; use SL::IC; use SL::IS; +use SL::Layout::Dispatcher; use SL::Locale; use SL::Mailer; use SL::Menu; @@ -457,7 +458,7 @@ sub header { $::lxdebug->leave_sub and return if !$ENV{HTTP_USER_AGENT} || $self->{header}++; if ($params{no_layout}) { - $::request->{layout} = SL::Controller::Layout->new(style => 'none'); + $::request->{layout} = SL::Layout::Dispatcher->new(style => 'none'); } my $layout = $::request->{layout}; diff --git a/SL/Controller/Layout/Admin.pm b/SL/Layout/Admin.pm similarity index 66% rename from SL/Controller/Layout/Admin.pm rename to SL/Layout/Admin.pm index 9d8f30c61..188655fae 100644 --- a/SL/Controller/Layout/Admin.pm +++ b/SL/Layout/Admin.pm @@ -1,7 +1,7 @@ -package SL::Controller::Layout::Admin; +package SL::Layout::Admin; use strict; -use parent qw(SL::Controller::Layout::Base); +use parent qw(SL::Layout::Base); sub new { my ($class, @slurp) = @_; @@ -9,7 +9,7 @@ sub new { my $self = $class->SUPER::new(@slurp); $self->add_sub_layouts([ - SL::Controller::Layout::None->new, + SL::Layout::None->new, ]); $self; diff --git a/SL/Controller/Layout/Base.pm b/SL/Layout/Base.pm similarity index 98% rename from SL/Controller/Layout/Base.pm rename to SL/Layout/Base.pm index ed25f1b78..56d5b8e2f 100644 --- a/SL/Controller/Layout/Base.pm +++ b/SL/Layout/Base.pm @@ -1,4 +1,4 @@ -package SL::Controller::Layout::Base; +package SL::Layout::Base; use strict; use parent qw(SL::Controller::Base); diff --git a/SL/Layout/Classic.pm b/SL/Layout/Classic.pm new file mode 100644 index 000000000..a2ef7702d --- /dev/null +++ b/SL/Layout/Classic.pm @@ -0,0 +1,23 @@ +package SL::Layout::Classic; + +use strict; +use parent qw(SL::Layout::Base); + +use SL::Layout::Top; +use SL::Layout::MenuLeft; + +sub new { + my ($class, @slurp) = @_; + + my $self = $class->SUPER::new(@slurp); + + $self->add_sub_layouts([ + SL::Layout::Top->new, + SL::Layout::MenuLeft->new, + SL::Layout::None->new, + ]); + + $self; +} + +1; diff --git a/SL/Controller/Layout/Css.pm b/SL/Layout/Css.pm similarity index 98% rename from SL/Controller/Layout/Css.pm rename to SL/Layout/Css.pm index 43e2b68de..2bb0455ca 100644 --- a/SL/Controller/Layout/Css.pm +++ b/SL/Layout/Css.pm @@ -1,4 +1,4 @@ -package SL::Controller::Layout::Css; +package SL::Layout::Css; use strict; diff --git a/SL/Layout/Dispatcher.pm b/SL/Layout/Dispatcher.pm new file mode 100644 index 000000000..ea14319d8 --- /dev/null +++ b/SL/Layout/Dispatcher.pm @@ -0,0 +1,27 @@ +package SL::Layout::Dispatcher; + +use strict; + +use SL::Menu; +use SL::Layout::Admin; +use SL::Layout::Login; +use SL::Layout::Classic; +use SL::Layout::V3; +use SL::Layout::V4; +use SL::Layout::Javascript; + +my %menu_cache; + +sub new { + my ($class, %params) = @_; + + return SL::Layout::Classic->new if $params{style} eq 'old'; + return SL::Layout::V3->new if $params{style} eq 'v3'; + return SL::Layout::V4->new if $params{style} eq 'v4'; + return SL::Layout::Javascript->new if $params{style} eq 'neu'; + return SL::Layout::Admin->new if $params{style} eq 'admin'; + return SL::Layout::Login->new if $params{style} eq 'login'; + return SL::Layout::None->new; +} + +1; diff --git a/SL/Controller/Layout/Javascript.pm b/SL/Layout/Javascript.pm similarity index 96% rename from SL/Controller/Layout/Javascript.pm rename to SL/Layout/Javascript.pm index f9ee831bf..1785a198b 100644 --- a/SL/Controller/Layout/Javascript.pm +++ b/SL/Layout/Javascript.pm @@ -1,7 +1,7 @@ -package SL::Controller::Layout::Javascript; +package SL::Layout::Javascript; use strict; -use parent qw(SL::Controller::Layout::Base); +use parent qw(SL::Layout::Base); use List::Util qw(max); use URI; @@ -12,7 +12,7 @@ sub new { my $self = $class->SUPER::new(@slurp); $self->add_sub_layouts([ - SL::Controller::Layout::None->new, + SL::Layout::None->new, ]); $self; diff --git a/SL/Controller/Layout/Login.pm b/SL/Layout/Login.pm similarity index 66% rename from SL/Controller/Layout/Login.pm rename to SL/Layout/Login.pm index 60f6e940a..ed649d052 100644 --- a/SL/Controller/Layout/Login.pm +++ b/SL/Layout/Login.pm @@ -1,7 +1,7 @@ -package SL::Controller::Layout::Login; +package SL::Layout::Login; use strict; -use parent qw(SL::Controller::Layout::Base); +use parent qw(SL::Layout::Base); sub new { my ($class, @slurp) = @_; @@ -9,7 +9,7 @@ sub new { my $self = $class->SUPER::new(@slurp); $self->add_sub_layouts([ - SL::Controller::Layout::None->new, + SL::Layout::None->new, ]); $self; diff --git a/SL/Controller/Layout/MenuLeft.pm b/SL/Layout/MenuLeft.pm similarity index 96% rename from SL/Controller/Layout/MenuLeft.pm rename to SL/Layout/MenuLeft.pm index 75c99e3b1..a171ed184 100644 --- a/SL/Controller/Layout/MenuLeft.pm +++ b/SL/Layout/MenuLeft.pm @@ -1,7 +1,7 @@ -package SL::Controller::Layout::MenuLeft; +package SL::Layout::MenuLeft; use strict; -use parent qw(SL::Controller::Layout::Base); +use parent qw(SL::Layout::Base); use URI; diff --git a/SL/Controller/Layout/None.pm b/SL/Layout/None.pm similarity index 83% rename from SL/Controller/Layout/None.pm rename to SL/Layout/None.pm index 204b8ee36..57b996669 100644 --- a/SL/Controller/Layout/None.pm +++ b/SL/Layout/None.pm @@ -1,7 +1,7 @@ -package SL::Controller::Layout::None; +package SL::Layout::None; use strict; -use parent qw(SL::Controller::Layout::Base); +use parent qw(SL::Layout::Base); sub javascripts_inline { _setup_formats(), diff --git a/SL/Controller/Layout/Top.pm b/SL/Layout/Top.pm similarity index 82% rename from SL/Controller/Layout/Top.pm rename to SL/Layout/Top.pm index b8e4c080d..533977450 100644 --- a/SL/Controller/Layout/Top.pm +++ b/SL/Layout/Top.pm @@ -1,7 +1,7 @@ -package SL::Controller::Layout::Top; +package SL::Layout::Top; use strict; -use parent qw(SL::Controller::Layout::Base); +use parent qw(SL::Layout::Base); sub pre_content { my ($self) = @_; diff --git a/SL/Controller/Layout/V3.pm b/SL/Layout/V3.pm similarity index 83% rename from SL/Controller/Layout/V3.pm rename to SL/Layout/V3.pm index 3a2c9848b..78b498e97 100644 --- a/SL/Controller/Layout/V3.pm +++ b/SL/Layout/V3.pm @@ -1,8 +1,8 @@ -package SL::Controller::Layout::V3; +package SL::Layout::V3; use strict; -use parent qw(SL::Controller::Layout::Base); -use SL::Controller::Layout::Css; +use parent qw(SL::Layout::Base); +use SL::Layout::Css; use URI; @@ -12,7 +12,7 @@ sub new { my $self = $class->SUPER::new(@slurp); $self->add_sub_layouts([ - SL::Controller::Layout::None->new, + SL::Layout::None->new, ]); $self; diff --git a/SL/Controller/Layout/V4.pm b/SL/Layout/V4.pm similarity index 77% rename from SL/Controller/Layout/V4.pm rename to SL/Layout/V4.pm index aee0b1318..fff1dfe0e 100644 --- a/SL/Controller/Layout/V4.pm +++ b/SL/Layout/V4.pm @@ -1,9 +1,9 @@ -package SL::Controller::Layout::V4; +package SL::Layout::V4; use strict; -use parent qw(SL::Controller::Layout::Base); -use SL::Controller::Layout::Css; -use SL::Controller::Layout::Top; +use parent qw(SL::Layout::Base); +use SL::Layout::Css; +use SL::Layout::Top; use URI; @@ -12,8 +12,8 @@ sub new { my $self = $class->SUPER::new(@slurp); $self->add_sub_layouts( - SL::Controller::Layout::Top->new, - SL::Controller::Layout::None->new, + SL::Layout::Top->new, + SL::Layout::None->new, ); $self; } -- 2.20.1