From: Sven Schöling Date: Thu, 4 Dec 2014 17:47:02 +0000 (+0100) Subject: Layout Aufräumaktion: X-Git-Tag: release-3.2.0beta~203 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=68dbf4a4cb26b9554a23f076438109d7fc2d861c;p=kivitendo-erp.git Layout Aufräumaktion: - Admin und V3 Menü entflochten. Benutzen jetzt beide das neue CssMenu als sub_layout - Top-Klone aus V3 und Javascript herausoperiert und als sub_layout eingebunden - Neues Layout AdminLogin für die Loginmaske im Adminbereich (d'oh) - Inputfelder im frame_header kleiner gemacht, Frickelfox ignoriert mal wieder css Vorgaben und inheritet font-size nicht. - Beschreibung in Placeholder verschoben. Ja das ist html5. Benutz halt nicht IE6. - javascript für Ansprechpartnersuche gefixt und ausgelagert. - Login, Classic und V3 sind top level Layouts und brauchen nicht sub_layoutbar sein. Macht den Code einfacher. --- diff --git a/SL/Controller/Admin.pm b/SL/Controller/Admin.pm index 7a3b1ca74..c2d9f29e7 100644 --- a/SL/Controller/Admin.pm +++ b/SL/Controller/Admin.pm @@ -15,6 +15,7 @@ use SL::Helper::Flash; use SL::Locale::String qw(t8); use SL::System::InstallationLock; use SL::User; +use SL::Layout::AdminLogin; use Rose::Object::MakeMethods::Generic ( @@ -585,8 +586,8 @@ sub use_multiselect_js { sub login_form { my ($self, %params) = @_; + $::request->layout(SL::Layout::AdminLogin->new); my $version = $::form->read_version; - $::request->layout->no_menu(1); $self->render('admin/adminlogin', title => t8('kivitendo v#1 administration', $version), %params, version => $version); } diff --git a/SL/Layout/Admin.pm b/SL/Layout/Admin.pm index 8b75c89ea..e10ed0341 100644 --- a/SL/Layout/Admin.pm +++ b/SL/Layout/Admin.pm @@ -1,32 +1,27 @@ package SL::Layout::Admin; use strict; -use parent qw(SL::Layout::V3); +use parent qw(SL::Layout::None); use SL::Menu; - -use Rose::Object::MakeMethods::Generic ( - scalar => [ qw(no_menu) ], -); - - -sub init_menu { - Menu->new('menus/admin.ini'); +use SL::Layout::None; +use SL::Layout::Top; +use SL::Layout::CssMenu; + +sub init_sub_layouts { + [ + SL::Layout::None->new, + SL::Layout::CssMenu->new(menu => Menu->new('menus/admin.ini')), + ] } sub start_content { "
\n"; } -sub render { - my ($self) = @_; - - $self->presenter->render( - 'menu/menuv3', - force_ul_width => 1, - skip_frame_header => 1, - menu => $self->no_menu ? '' : $self->print_menu, - ); +sub end_content { + "
\n"; } + 1; diff --git a/SL/Layout/AdminLogin.pm b/SL/Layout/AdminLogin.pm new file mode 100644 index 000000000..df482a6da --- /dev/null +++ b/SL/Layout/AdminLogin.pm @@ -0,0 +1,14 @@ +package SL::Layout::AdminLogin; + +use strict; +use parent qw(SL::Layout::None); + +sub start_content { + "
\n"; +} + +sub end_content { + "
\n"; +} + +1; diff --git a/SL/Layout/CssMenu.pm b/SL/Layout/CssMenu.pm new file mode 100644 index 000000000..c26fad7bb --- /dev/null +++ b/SL/Layout/CssMenu.pm @@ -0,0 +1,116 @@ +package SL::Layout::CssMenu; + +use strict; +use parent qw(SL::Layout::Base); + +use URI; + +sub print_menu { + my ($self, $parent, $depth) = @_; + + my $html; + + die if ($depth * 1 > 5); + + my @menuorder; + my $menu = $self->menu; + + @menuorder = $menu->access_control(\%::myconfig, $parent); + + $parent .= "--" if ($parent); + + foreach my $item (@menuorder) { + substr($item, 0, length($parent)) = ""; + next if (($item eq "") || ($item =~ /--/)); + + my $menu_item = $menu->{"${parent}${item}"}; + my $menu_title = $::locale->text($item); + my $menu_text = $menu_title; + + if ($menu_item->{"submenu"} || !defined($menu_item->{"module"}) && !defined($menu_item->{href})) { + + my $h = $self->print_menu("${parent}${item}", $depth * 1 + 1)."\n"; + if (!$parent) { + $html .= qq|\n|; + } else { + $html .= qq|
  • ${menu_text}
  • \n|; + } + } else { + if ($self->{sub_class} && $depth > 1) { + $html .= qq|
  • |; + } else { + $html .= qq|
  • |; + } + $html .= $self->menuitem_v3("${parent}$item", { "title" => $menu_title }); + $html .= qq|${menu_text}
  • \n|; + } + } + + return $html; +} + +sub menuitem_v3 { + $main::lxdebug->enter_sub(); + + my ($self, $item, $other) = @_; + my $menuitem = $self->menu->{$item}; + + my $action = "section_menu"; + my $module; + + if ($menuitem->{module}) { + $module = $menuitem->{module}; + } + if ($menuitem->{action}) { + $action = $menuitem->{action}; + } + + my $level = $::form->escape($item); + + my @vars; + my $target = $menuitem->{target} ? qq| target="| . $::form->escape($menuitem->{target}) . '"' : ''; + my $str = qq|'; + } + + $str .= qq|$module?action=| . $::form->escape($action); + + map { delete $menuitem->{$_} } qw(module action target href); + + # add other params + foreach my $key (keys %{ $menuitem }) { + $str .= "&" . $::form->escape($key, 1) . "="; + my ($value, $conf) = split(/=/, $menuitem->{$key}, 2); + $value = $::myconfig{$value} . "/$conf" if ($conf); + $str .= $::form->escape($value, 1); + } + + $str .= '"'; + + if ($other) { + foreach my $key (keys(%{$other})) { + $str .= qq| ${key}="| . $::form->quote($other->{$key}) . qq|"|; + } + } + + $str .= ">"; + + $main::lxdebug->leave_sub(); + + return $str; +} + +sub use_stylesheet { + qw(icons16.css frame_header/header.css), +} + +sub pre_content { + $_[0]->presenter->render('menu/menuv3', + menu => $_[0]->print_menu, + ); +} + +1; diff --git a/SL/Layout/Dispatcher.pm b/SL/Layout/Dispatcher.pm index 3dcde2733..b125a2668 100644 --- a/SL/Layout/Dispatcher.pm +++ b/SL/Layout/Dispatcher.pm @@ -3,6 +3,7 @@ package SL::Layout::Dispatcher; use strict; use SL::Layout::Admin; +use SL::Layout::AdminLogin; use SL::Layout::Login; use SL::Layout::Classic; use SL::Layout::V3; @@ -15,6 +16,7 @@ sub new { return SL::Layout::V3->new if $params{style} eq 'v3'; return SL::Layout::Javascript->new if $params{style} eq 'neu'; return SL::Layout::Admin->new if $params{style} eq 'admin'; + return SL::Layout::AdminLogin->new if $params{style} eq 'admin_login'; return SL::Layout::Login->new if $params{style} eq 'login'; return SL::Layout::None->new; } diff --git a/SL/Layout/Javascript.pm b/SL/Layout/Javascript.pm index 5615ce957..5ddb4d7fb 100644 --- a/SL/Layout/Javascript.pm +++ b/SL/Layout/Javascript.pm @@ -7,18 +7,22 @@ use List::Util qw(max); use URI; sub init_sub_layouts { - [ SL::Layout::None->new ] + [ + SL::Layout::None->new, + SL::Layout::Top->new, + ] } sub use_javascript { my $self = shift; qw( - js/quicksearch_input.js + js/dhtmlsuite/menu-for-applications.js ), $self->SUPER::use_javascript(@_); } sub pre_content { + $_[0]->SUPER::pre_content . &display } @@ -43,44 +47,13 @@ sub stylesheets { sub display { my ($self) = @_; - my $form = $main::form; - - my $callback = $form->unescape($form->{callback}); - $callback = URI->new($callback)->rel($callback) if $callback; - $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/; $self->presenter->render("menu/menunew", force_ul_width => 1, - date => $self->clock_line, menu_items => $self->acc_menu, - callback => $callback, ); } -sub clock_line { - my $form = $main::form; - - my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat, - $Jahr, $Wochentag, $Jahrestag, $Sommerzeit) - = localtime(time); - $Monat += 1; - $Jahrestag += 1; - $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat; - $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag; - $Jahr += 1900; - my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch", - "Donnerstag", "Freitag", "Samstag"); - my @Monatsnamen = ("", "Januar", "Februar", "März", - "April", "Mai", "Juni", "Juli", - "August", "September", "Oktober", "November", - "Dezember"); - return - $Wochentage[$Wochentag] . ", der " - . $Monatstag . "." - . $Monat . "." - . $Jahr . " - "; -} - sub acc_menu { my ($self) = @_; diff --git a/SL/Layout/Login.pm b/SL/Layout/Login.pm index ed649d052..dc0a31686 100644 --- a/SL/Layout/Login.pm +++ b/SL/Layout/Login.pm @@ -1,19 +1,7 @@ package SL::Layout::Login; use strict; -use parent qw(SL::Layout::Base); - -sub new { - my ($class, @slurp) = @_; - - my $self = $class->SUPER::new(@slurp); - - $self->add_sub_layouts([ - SL::Layout::None->new, - ]); - - $self; -} +use parent qw(SL::Layout::None); sub start_content { "\n"; } -sub render { - my ($self) = @_; - - my $callback = $::form->unescape($::form->{callback}); - $callback = URI->new($callback)->rel($callback) if $callback; - $callback = "login.pl?action=company_logo" if $callback =~ /^(\.\/)?$/; - - $self->presenter->render('menu/menuv3', - force_ul_width => 1, - date => $self->clock_line, - menu => $self->print_menu, - callback => $callback, - ); -} - 1; diff --git a/css/common.css b/css/common.css index ffb5e1829..687220650 100644 --- a/css/common.css +++ b/css/common.css @@ -50,3 +50,13 @@ a.cti_call_action { .row2-cvars-table tr { vertical-align: top } .row2-cvars-table th { text-align: right; padding-left: 15px; padding-right: 0 } .row2-cvars-table td, .row2-cvars-table th { padding-top: 10px } + +input.grow_on_focus { + width: 20px; + transition: width 0.1s; + -moz-transition: width 0.1s; + -webkit-transition: width 0.1s; + -o-transition: width 0.1s; +} +input.grow_on_focus:focus { width: 150px } + diff --git a/css/kivitendo/frame_header/header.css b/css/kivitendo/frame_header/header.css index 80ab601fb..029ca5c99 100644 --- a/css/kivitendo/frame_header/header.css +++ b/css/kivitendo/frame_header/header.css @@ -33,8 +33,16 @@ vertical-align: middle; } +#frame-header .frame-header-right { + margin-top: 3px; +} + #frame-header #ajax-spinner { margin-top: 2px; margin-right: 10px; display: none; } + +#frame-header input { + font-size: 12px; +} diff --git a/css/lx-office-erp/frame_header/header.css b/css/lx-office-erp/frame_header/header.css index 3046f2336..cf5d146eb 100644 --- a/css/lx-office-erp/frame_header/header.css +++ b/css/lx-office-erp/frame_header/header.css @@ -38,6 +38,10 @@ vertical-align: middle; } +#frame-header .frame-header-right { + margin-top: 3px; +} + #frame-header #ajax-spinner { margin-top: 2px; margin-right: 10px; @@ -47,3 +51,7 @@ min-width: 16px; min-height: 16px; } + +#frame-header input { + font-size: 12px; +} diff --git a/js/quicksearch_input.js b/js/quicksearch_input.js index 055b5f31a..e281f94d3 100644 --- a/js/quicksearch_input.js +++ b/js/quicksearch_input.js @@ -1,5 +1,6 @@ -function on_keydown_quicksearch(element, event) { +function on_keydown_quicksearch(event) { var key; + var element = $(this); if (window.event) key = window.event.keyCode; // IE @@ -16,8 +17,8 @@ function on_keydown_quicksearch(element, event) { var url = "ct.pl?action=list_contacts&INPUT_ENCODING=utf-8&filter.status=active&search_term=" + encodeURIComponent(value); - search_term.val(''); window.location.href = url; return false; } +$(function(){ $('#frame_header_contact_search').keydown(on_keydown_quicksearch) }); diff --git a/templates/webpages/menu/header.html b/templates/webpages/menu/header.html index 95004383f..42e485a17 100644 --- a/templates/webpages/menu/header.html +++ b/templates/webpages/menu/header.html @@ -1,14 +1,15 @@ [%- USE T8 %][%- USE LxERP -%] +[%- UNLESS skip_frame_header %]
    -[% UNLESS is_links %] +[%- UNLESS is_links %] - [[% 'Menu' | $T8 %]] [[% 'New window/tab' | $T8 %]] [[% 'Print' | $T8 %]] - [[% 'Back' | $T8 %]] - [[% 'Fwd' | $T8 %]] [%- IF AUTH.assert('general_ledger', 1) %] - [[% 'GL search' | $T8 %]: ] + [ ] +[%- END %] +[%- IF AUTH.assert('general_ledger', 1) %] + [] [%- END %] [%- END %] @@ -16,13 +17,9 @@ [[% 'User' | $T8 %]: [% MYCONFIG.login | html %] - [% 'Client' | $T8 %]: [% AUTH.client.name | html %] - [% 'Logout' | $T8 %]] - [% now.to_lxoffice %] - - [% now.hms %] [% LxERP.t8('Loading...') %]
    -[% IF AUTH.assert('general_ledger', 1) %] - -[% END %] +[%- END %] diff --git a/templates/webpages/menu/menunew.html b/templates/webpages/menu/menunew.html index fc0e32675..fe5eb2135 100644 --- a/templates/webpages/menu/menunew.html +++ b/templates/webpages/menu/menunew.html @@ -1,39 +1,5 @@ [%- USE T8 %] [% USE HTML %][%- USE LxERP -%] - - - - -
    - - [[% 'new Window' | $T8 %]] - [[% 'print' | $T8 %]] -[%- IF AUTH.assert('general_ledger', 1) %] - [[% 'GL search' | $T8 %]: ] -[%- END %] - - - [[% 'User' | $T8 %]: [% MYCONFIG.login | html %] - - [% 'Client' | $T8 %]: [% AUTH.client.name | html %] - - [% 'logout' | $T8 %]] - [% date %]   - - - [% LxERP.t8('Loading...') %] - -
    - [%- SET main_id = '100' %] @@ -100,6 +66,3 @@ function open_url(url, target) { --> -[% IF AUTH.assert('general_ledger', 1) %] - -[% END %] diff --git a/templates/webpages/menu/menuv3.html b/templates/webpages/menu/menuv3.html index 5e6fcf09d..648e49a8c 100644 --- a/templates/webpages/menu/menuv3.html +++ b/templates/webpages/menu/menuv3.html @@ -1,46 +1,2 @@ -[%- USE T8 %] -[% USE HTML %][%- USE LxERP -%] -[% UNLESS skip_frame_header %] - - - -
    - - [[% 'new Window' | $T8 %]] - [[% 'print' | $T8 %]] - [[% 'Search contacts' | $T8 %] ] -[%- IF AUTH.assert('general_ledger', 1) %] - [[% 'GL search' | $T8 %]: ] -[%- END %] - - - [[% 'User' | $T8 %]: [% MYCONFIG.login | html %] - - [% 'Client' | $T8 %]: [% AUTH.client.name | html %] - - [% 'logout' | $T8 %]] - [% date %]   - - - [% LxERP.t8('Loading...') %] - -
    -[% END %] - +
    -[% IF AUTH.assert('general_ledger', 1) %] - -[% END %]