use SL::Locale::String qw(t8);
use SL::System::InstallationLock;
use SL::User;
+use SL::Layout::AdminLogin;
use Rose::Object::MakeMethods::Generic
(
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);
}
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 {
"<div id='admin' class='admin'>\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 {
+ "</div>\n";
}
+
1;
--- /dev/null
+package SL::Layout::AdminLogin;
+
+use strict;
+use parent qw(SL::Layout::None);
+
+sub start_content {
+ "<div id='admin' class='admin'>\n";
+}
+
+sub end_content {
+ "</div>\n";
+}
+
+1;
--- /dev/null
+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|<ul><li><h2>${menu_text}</h2><ul>${h}</ul></li></ul>\n|;
+ } else {
+ $html .= qq|<li><div class="x">${menu_text}</div><ul>${h}</ul></li>\n|;
+ }
+ } else {
+ if ($self->{sub_class} && $depth > 1) {
+ $html .= qq|<li class='sub'>|;
+ } else {
+ $html .= qq|<li>|;
+ }
+ $html .= $self->menuitem_v3("${parent}$item", { "title" => $menu_title });
+ $html .= qq|${menu_text}</a></li>\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|<a${target} href="|;
+
+ if ($menuitem->{href}) {
+ $main::lxdebug->leave_sub();
+ return $str . $menuitem->{href} . '">';
+ }
+
+ $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;
use strict;
use SL::Layout::Admin;
+use SL::Layout::AdminLogin;
use SL::Layout::Login;
use SL::Layout::Classic;
use SL::Layout::V3;
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;
}
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
}
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) = @_;
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 {
"<div id='login' class='login'>\n";
sub javascripts_inline {
my $self = shift;
- $self->SUPER::javascripts_inline;
my $sections = [ section_menu($self->menu) ];
$self->presenter->render('menu/menu',
sections => $sections,
my ($self) = @_;
$self->presenter->render('menu/header',
- now => DateTime->now_local,
- is_fastcgi => scalar($::dispatcher->interface_type =~ /fastcgi/i),
- is_links => scalar($ENV{HTTP_USER_AGENT} =~ /links/i));
+ now => DateTime->now_local,
+ is_fastcgi => scalar($::dispatcher->interface_type =~ /fastcgi/i),
+ is_links => scalar($ENV{HTTP_USER_AGENT} =~ /links/i),
+ );
}
sub stylesheets {
'frame_header/header.css';
}
+sub javascripts {
+ ('js/quicksearch_input.js') x!! $::auth->assert('customer_vendor_edit', 1),
+ ('js/glquicksearch.js') x!! $::auth->assert('general_ledger', 1)
+}
+
1;
__END__
use strict;
use parent qw(SL::Layout::Base);
-use URI;
-
-sub clock_line {
- 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 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|<ul><li><h2>${menu_text}</h2><ul>${h}</ul></li></ul>\n|;
- } else {
- $html .= qq|<li><div class="x">${menu_text}</div><ul>${h}</ul></li>\n|;
- }
- } else {
- if ($self->{sub_class} && $depth > 1) {
- $html .= qq|<li class='sub'>|;
- } else {
- $html .= qq|<li>|;
- }
- $html .= $self->menuitem_v3("${parent}$item", { "title" => $menu_title });
- $html .= qq|${menu_text}</a></li>\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|<a${target} href="|;
-
- if ($menuitem->{href}) {
- $main::lxdebug->leave_sub();
- return $str . $menuitem->{href} . '">';
- }
-
- $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;
-}
+use SL::Layout::None;
+use SL::Layout::Top;
+use SL::Layout::CssMenu;
sub init_sub_layouts {
- [ SL::Layout::None->new ]
-}
-
-sub use_stylesheet {
- my $self = shift;
- qw(
- icons16.css frame_header/header.css
- ),
- $self->SUPER::use_stylesheet(@_);
-}
-
-sub use_javascript {
- my $self = shift;
- qw(
- js/quicksearch_input.js
- ),
- $self->SUPER::use_javascript(@_);
-}
-
-sub pre_content {
- $_[0]->render;
+ [
+ SL::Layout::None->new,
+ SL::Layout::Top->new,
+ SL::Layout::CssMenu->new,
+ ]
}
sub start_content {
"</div>\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;
.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 }
+
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;
+}
vertical-align: middle;
}
+#frame-header .frame-header-right {
+ margin-top: 3px;
+}
+
#frame-header #ajax-spinner {
margin-top: 2px;
margin-right: 10px;
min-width: 16px;
min-height: 16px;
}
+
+#frame-header input {
+ font-size: 12px;
+}
-function on_keydown_quicksearch(element, event) {
+function on_keydown_quicksearch(event) {
var key;
+ var element = $(this);
if (window.event)
key = window.event.keyCode; // IE
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) });
[%- USE T8 %][%- USE LxERP -%]
+[%- UNLESS skip_frame_header %]
<div id="frame-header">
-[% UNLESS is_links %]
+[%- UNLESS is_links %]
<span class="frame-header-element frame-header-left">
- [<a href="JavaScript:Switch_Menu();" title="[% 'Switch Menu on / off' | $T8 %]">[% 'Menu' | $T8 %]</a>]
[<a href="controller.pl?action=LoginScreen/user_login" target="_blank" title="[% 'Open a further kivitendo window or tab' | $T8 %]">[% 'New window/tab' | $T8 %]</a>]
[<a href="JavaScript:top.print();" title="[% 'Hardcopy' | $T8 %]">[% 'Print' | $T8 %]</a>]
- [<a href="Javascript:top.history.back();" title="[% 'Go one step back' | $T8 %]">[% 'Back' | $T8 %]</a>]
- [<a href="Javascript:top.history.forward();" title="[% 'Go one step forward' | $T8 %]">[% 'Fwd' | $T8 %]</a>]
[%- IF AUTH.assert('general_ledger', 1) %]
- [[% 'GL search' | $T8 %]: <input id="glquicksearch" name="glquicksearch" type="text" class="ui-widget" size="20" maxlength="20">]
+ [ <input name="frame_header_contact_search" id="frame_header_contact_search" placeholder="[% 'Search contacts' | $T8 %]" size="14">]
+[%- END %]
+[%- IF AUTH.assert('general_ledger', 1) %]
+ [<input id="glquicksearch" name="glquicksearch" type="text" class="ui-widget" placeholder="[% 'GL search' | $T8 %]" maxlength="20">]
[%- END %]
</span>
[%- END %]
[[% 'User' | $T8 %]: [% MYCONFIG.login | html %] -
[% 'Client' | $T8 %]: [% AUTH.client.name | html %] -
<a href="controller.pl?action=LoginScreen/logout" target="_top" title="[% 'Logout now' | $T8 %]">[% 'Logout' | $T8 %]</a>]
- [% now.to_lxoffice %] -
- [% now.hms %]
</span>
<span class="frame-header-element frame-header-right" id="ajax-spinner">
<img src="image/[% IF MYCONFIG.stylesheet == 'lx-office-erp.css' %]spinner-blue.gif[% ELSE %]spinner-white.gif[% END %]" alt="[% LxERP.t8('Loading...') %]">
</span>
</div>
-[% IF AUTH.assert('general_ledger', 1) %]
- <script type="text/javascript" src="js/glquicksearch.js"></script>
-[% END %]
+[%- END %]
[%- USE T8 %]
[% USE HTML %][%- USE LxERP -%]
- <script type="text/javascript">
-<!--
-function clockon() {
- var now = new Date();
- var h = now.getHours();
- var m = now.getMinutes();
- document.getElementById('clock_id').innerHTML = (h<10?'0'+h:h)+":"+(m<10?'0'+m:m);
- var timer=setTimeout("clockon()", 10000);
-}
-$(clockon);
-//-->
- </script>
-
- <script type="text/javascript" src="js/dhtmlsuite/menu-for-applications.js"></script>
-
- <div id="frame-header">
- <span class="frame-header-element frame-header-left">
- [<a href="login.pl?action=company_logo" target="_blank">[% 'new Window' | $T8 %]</a>]
- [<a href="JavaScript:top.print()">[% 'print' | $T8 %]</a>]
-[%- IF AUTH.assert('general_ledger', 1) %]
- [[% 'GL search' | $T8 %]: <input id="glquicksearch" name="glquicksearch" type="text" class="ui-widget" size="20" maxlength="20">]
-[%- END %]
- </span>
- <span class="frame-header-element frame-header-right">
- [[% 'User' | $T8 %]: [% MYCONFIG.login | html %] -
- [% 'Client' | $T8 %]: [% AUTH.client.name | html %] -
- <a href="controller.pl?action=LoginScreen/logout" target="_top">[% 'logout' | $T8 %]</a>]
- [% date %] <span id='clock_id' style='position:relative'></span>
- </span>
- <span class="frame-header-element frame-header-right" id="ajax-spinner">
- <img src="image/[% IF MYCONFIG.stylesheet == 'lx-office-erp.css' %]spinner-blue.gif[% ELSE %]spinner-white.gif[% END %]" alt="[% LxERP.t8('Loading...') %]">
- </span>
- </div>
-
<div id="main_menu_div"></div>
[%- SET main_id = '100' %]
-->
</script>
-[% IF AUTH.assert('general_ledger', 1) %]
- <script type="text/javascript" src="js/glquicksearch.js"></script>
-[% END %]
-[%- USE T8 %]
-[% USE HTML %][%- USE LxERP -%]
-[% UNLESS skip_frame_header %]
- <script type="text/javascript" src="js/quicksearch_input.js"></script>
- <script type="text/javascript">
- <!--
-function clockon() {
- var now = new Date();
- var h = now.getHours();
- var m = now.getMinutes();
- document.getElementById('clock_id').innerHTML = (h<10?'0'+h:h)+":"+(m<10?'0'+m:m);
- var timer=setTimeout("clockon()", 10000);
-}
-$(clockon);
-//-->
- </script>
-
-<div id="frame-header">
- <span class="frame-header-element frame-header-left">
- [<a href="login.pl?action=company_logo" target="_blank">[% 'new Window' | $T8 %]</a>]
- [<a href="JavaScript:top.print()">[% 'print' | $T8 %]</a>]
- [[% 'Search contacts' | $T8 %] <input size="15" name="search_term" id="search_term" onkeydown="return on_keydown_quicksearch($('#search_term'), event)">]
-[%- IF AUTH.assert('general_ledger', 1) %]
- [[% 'GL search' | $T8 %]: <input id="glquicksearch" name="glquicksearch" type="text" class="ui-widget" size="20" maxlength="20">]
-[%- END %]
- </span>
- <span class="frame-header-element frame-header-right">
- [[% 'User' | $T8 %]: [% MYCONFIG.login | html %] -
- [% 'Client' | $T8 %]: [% AUTH.client.name | html %] -
- <a href="controller.pl?action=LoginScreen/logout" target="_top">[% 'logout' | $T8 %]</a>]
- [% date %] <span id='clock_id' style='position:relative'></span>
- </span>
- <span class="frame-header-element frame-header-right" id="ajax-spinner">
- <img src="image/[% IF MYCONFIG.stylesheet == 'lx-office-erp.css' %]spinner-blue.gif[% ELSE %]spinner-white.gif[% END %]" alt="[% LxERP.t8('Loading...') %]">
- </span>
-</div>
-[% END %]
- <div id="menuv3">
-
- [% menu %]
-
- </div>
+ <div id="menuv3">[% menu %]</div>
<div style="clear: both;"></div>
-[% IF AUTH.assert('general_ledger', 1) %]
- <script type="text/javascript" src="js/glquicksearch.js"></script>
-[% END %]