my $storage = $c->model('Schema')->storage;
$c->stash->{'storage'} = $storage;
+ $c->stash->{'site_title'} = "Franks Büchersammlung";
+
+ $c->stash->{'menu_path'} = [] unless $c->stash->{'menu_path'};
+ push @{ $c->stash->{'menu_path'} }, {
+ 'path' => $c->uri_for("/"),
+ 'name' => "Startseite"
+ };
+
$c->config->{'debug_level'} = 0 unless defined $c->config->{'debug_level'};
$c->log->debug( get_output_string( $K, "Aktuelle Konfiguration: ", $c->config ) ) if $c->config->{'debug_level'} >= 3;
$c->session->{'cur_path'} = $req_path;
}
- $c->stash->{'menu_path'} = [] unless $c->stash->{'menu_path'};
- push @{ $c->stash->{'menu_path'} }, { 'path' => $c->uri_for("/"), 'name' => "Home" };
-
# Request-URI in Sitzung einpflegen
$c->session->{'request'} = {};
$c->session->{'request'}{'uri'} = $c->req->uri();
#$c->stash->{'lang_to_use'} = $lang;
#$c->log->debug( $K . "Neue Sprache: '" . $lang . "' (" . $LangsToUseInDates{$lang} . ")." ) if $c->stash->{'debug_level'} >= 2;
+ $c->stash->{'login_action'} = 'login';
+
1;
} ## end sub auto :
sub index : Private {
my ( $self, $c ) = @_;
- $c->response->body('Matched FrBr::Books::Controller::Books in Books.');
+ $c->stash->{'template'} = 'books/index.tt2';
+
}
#-------------------------------------------------------
my $K = __PACKAGE__ . "::list(): ";
$c->log->debug( $K . "aufgerufen." ) if $c->stash->{'debug_level'} > 2;
+ push @{ $c->stash->{'menu_path'} }, {
+ 'path' => $c->uri_for("/books/list"),
+ 'name' => "Liste"
+ };
+
my $buchliste = get_booklist( $c );
$c->log->debug( get_output_string( $K, "Erhaltene Buchliste: ", $buchliste ) ) if $c->stash->{'debug_level'} >= 2;
$c->stash->{'books'} = $buchliste;
--- /dev/null
+package FrBr::Books::Controller::Login;
+
+# $Id$
+# $URL$
+
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+use FrBr::Common;
+
+=head1 NAME
+
+FrBr::Books::Controller::Login - Catalyst Controller
+
+=head1 DESCRIPTION
+
+Catalyst Controller.
+
+=head1 METHODS
+
+=cut
+
+
+=head2 index
+
+=cut
+
+sub index : Private {
+ my ( $self, $c ) = @_;
+
+ $c->stash->{'template'} = 'not_implemented.tt2';
+
+ push @{ $c->stash->{'menu_path'} }, {
+ 'path' => $c->uri_for("/login"),
+ 'name' => "Anmeldung"
+ };
+
+}
+
+
+=head1 AUTHOR
+
+Frank Brehm
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
use strict;
use warnings;
use base 'Catalyst::Controller';
+use FrBr::Common;
#
# Sets the actions in this controller to be registered with no prefix
=cut
+#---------------------------------------------------------------------------
+
=head2 default
=cut
my ( $self, $c ) = @_;
#$c->stash->{'site_title'} = sprintf( $c->localize( "%s's Cookbook" ) , 'Frank Brehm' );
- $c->stash->{'site_title'} = "Franks Bucharchiv";
+ $c->stash->{'site_title'} = "Willkommen in Franks Büchersammlung";
$c->stash->{'message'} = 'Willkommen!';
- $c->stash->{'template'} = 'welcome.tt2';
+ $c->stash->{'template'} = 'index.tt2';
# Hello World
#$c->response->body( $c->welcome_message );
}
+#---------------------------------------------------------------------------
+
=head2 end
Attempt to render a view, if needed.
=cut
-sub end : ActionClass('RenderView') {}
+sub end : ActionClass('RenderView') {
+
+ my ( $self, $c ) = @_;
+ my $K = __PACKAGE__ . "::end(): ";
+
+ pop @{ $c->stash->{'menu_path'} };
+ $c->log->debug( get_output_string( $K, "Menue-Pfad: ", $c->stash->{'menu_path'} ) ) if $c->stash->{'debug_level'};
+
+}
=head1 AUTHOR
$URL$
-%]
-
+<table cellpadding="0" cellspacing="0" width="100%" class="statusbar">
+ <tr>
+ <td style="text-align: left;">
+[%- IF login_action == 'none' -%]
+
+[%- ELSE -%]
+ [% tt_menu = [ ]; tt_menu.push( "<a href=\"${item.path}\">${item.name}</a>" ) FOREACH item IN menu_path %][% tt_menu.join(' » ') %]
+[%- END -%]
+ </td>
+ <td style="text-align: right;">
+[%- IF login_action == 'none' -%]
+
+[%- ELSE -%]
+ [%- IF login_action == 'login' -%]
+ <span class="login"><a href="[% Catalyst.uri_for("/login") %]">Anmelden</a></span>
+ [%- ELSE -%]
+ Angemeldet als: <span class="login">[% current_user %] -
+ <a href="[% Catalyst.uri_for("/logout") %]">Abmelden</a></span>
+ [%- END -%]
+[%- END -%]
+ </td>
+ </tr>
+</table>
+<!-- END site/statusbar -->
color: [% site.col.error %];
}
+TABLE.menu {
+ font-size: 14pt;
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: 20px;
+ margin-bottom: 20px;
+ border-spacing: 0;
+ padding: 2px;
+}
+
+TABLE.menu TH {
+ background-color: [% site.col.head %];
+ border: 1px solid [% site.col.line %];
+ margin: 0;
+ padding: 5px;
+}
+
+TABLE.menu TD {
+ text-align: left;
+}
+
+TABLE.menu TD.empty {
+ margin: 0;
+ padding: 0;
+ font-size: 6pt;
+}
+
+TABLE.menu TD.button {
+ background-color: [% site.col.head %];
+ border: 1px solid [% site.col.line %];
+ margin: 0;
+ padding: 5px;
+}
+
+
+TABLE.menu TD.item {
+ background-color: [% site.col.statusbarbg %];
+ border: 1px solid [% site.col.line %];
+ margin: 0;
+ padding: 5px;
+}
+
+
[%- FOREACH cssfile IN cssfiles %]
/* --- [% cssfile %] ----------------- */
[% PROCESS $cssfile -%]
--- /dev/null
+[%#
+
+ message.tt2 - Universal-Template
+
+ #$Id$
+ #$URL$
+
+-%]
+<div style="text-align: center">
+<table class="menu" cellspacing="0">
+ <tr>
+ <th colspan="2">Menü</th>
+ </tr>
+ <tr>
+ <td colspan="2" class="empty">
+ </td>
+ </tr>
+ <tr>
+ <td class="button">
+ </td>
+ <td class="item">
+ <a href="[% Catalyst.uri_for('/books/search') %]">Suchmaske</a></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="empty">
+ </td>
+ </tr>
+ <tr>
+ <td class="button">
+ </td>
+ <td class="item">
+ <a href="[% Catalyst.uri_for('/books/list') %]">Bücherliste</a></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="empty">
+ </td>
+ </tr>
+ <tr>
+ <td class="button">
+ </td>
+ <td class="item">
+ <a href="[% Catalyst.uri_for('/') %]">Zurück zum Hauptmenü</a></td>
+ </tr>
+</table>
+</div>
--- /dev/null
+[%#
+
+ message.tt2 - Universal-Template
+
+ #$Id$
+ #$URL$
+
+-%]
+[%- META title = 'Willkommen in Franks Büchersammlung' -%]
+
+<div style="text-align: center">
+<table class="menu" cellspacing="0">
+ <tr>
+ <th colspan="2">Menü</th>
+ </tr>
+ <tr>
+ <td colspan="2" class="empty">
+ </td>
+ </tr>
+ <tr>
+ <td class="button">
+ </td>
+ <td class="item">
+ <a href="[% Catalyst.uri_for('/books') %]">Bücher suchen</a></td>
+ </tr>
+</table>
+</div>
--- /dev/null
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+BEGIN { use_ok 'Catalyst::Test', 'FrBr::Books' }
+BEGIN { use_ok 'FrBr::Books::Controller::Login' }
+
+ok( request('/login')->is_success, 'Request should succeed' );
+
+