--- /dev/null
+#!/usr/local/bin/perl
+
+# $Id$
+# $URL$
+
+use strict;
+use warnings;
+
+# Own modules
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use FrBr::Common;
+use FrBr::Books::Db;
+use MIME::Base64 ();
+use Storable;
+use Data::Dumper;
+
+$Data::Dumper::Indent = 1;
+$Data::Dumper::Sortkeys = 1;
+
+my $db = 'books';
+my $title = "Sitzungsdaten:";
+
+my $dsn = 'DBI:mysql:database=' . $db . ';host=localhost';
+my $user = 'books';
+my $password = 'uhu';
+my $attrs = {
+ 'AutoCommit' => 1,
+ 'PrintError' => 0,
+ 'RaiseError' => 0,
+};
+
+my $schema = FrBr::Books::Db->connect( $dsn, $user, $password, $attrs );
+
+my @all_items = $schema->resultset('Session')->search( undef, {
+ 'columns' => [ qw/
+ id
+ session_data
+ expires
+ / ],
+ 'order_by' => 'expires' },
+ );
+
+print $title . "\n\n";
+
+for ( @all_items ) {
+ print( ( '-' x 80 ) . "\n");
+ my $data = $_->session_data;
+ $data =~ s/\s+$//s;
+ my $sess_data = Storable::thaw(MIME::Base64::decode($data));
+ my $create_time = $sess_data->{'__created'} ? ( $sess_data->{'__created'} . " (" . localtime($sess_data->{'__created'}) . ")" ) : '<undef>';
+ my $update_time = $sess_data->{'__updated'} ? ( $sess_data->{'__updated'} . " (" . localtime($sess_data->{'__updated'}) . ")" ) : '<undef>';
+ print( $_->id . ": " . Dumper($sess_data) );
+ print( "Created: " . $create_time . "\n" );
+ print( "Updated: " . $update_time . "\n" );
+ print( "Expires: " . $_->expires . " (" . localtime($_->expires) . ")\n\n");
+}
+
+exit 0;
+
---
-name: FrBr::Books
+# Der Name der Anwendung
+#;name: Buchdatenbank Frank Brehm
+# Debug-Level
+debug_level: 0
+# Ist diese laufende Instanz eine Testumgebung?
+# is_test_environment: 0
+# Log-Level fue log4perl
+# Moegliche Werte: fatal, error, warn, info, debug
+log_level: info
+# Soll die Log-Ausgabe farbig erfolgen ?
+colored_log: 0
+#
+# Sitzungsparameter
+session:
+ expires: 7200
database:
- host: localhost
- port: 3306
- schema: books
- user: books
+ host: localhost
+ port: 3306
+ schema: books
+ user: books
# passwd:
authentication:
dbic:
# Other options can go here for hashed passwords
password_type: salted_hash
password_salt_len: 4
-
use Catalyst::Runtime '5.70';
+use Sys::Hostname;
+use Catalyst::Log::Log4perl;
use FrBr::Common;
# Set flags and add plugins for the application
Static::Simple
+ StackTrace
+
+ Session
+ Session::Store::DBIC
+ Session::State::Cookie
+
/;
our $VERSION = '0.01';
# with a external configuration file acting as an override for
# local deployment.
-__PACKAGE__->config( name => 'FrBr::Books' );
+__PACKAGE__->config(
+ 'name' => 'FrBr::Books',
+ 'session' => {
+ 'dbic_class' => 'Schema::Session',
+ 'expires' => 3600,
+ },
+);
# Start the application
__PACKAGE__->setup;
my ( $self, $c ) = @_;
my $K = __PACKAGE__ . "::auto(): ";
+ my $storage = $c->model('Schema')->storage;
+ $c->stash->{'storage'} = $storage;
+
$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->stash->{'debug_level'} = $env_debug_level if $env_debug_level and $env_debug_level > $c->stash->{'debug_level'};
$c->log->debug( $K . "Aktuelles Debug-Level: " . $c->stash->{'debug_level'} ) if $c->stash->{'debug_level'};
+ $c->log->debug( get_output_string( $K . "Speicher-Objekt: ", $storage ) ) if $c->stash->{'debug_level'} >= 6;
+
+ # Feststellen, ob es eine Testumgebung ist
+ $c->stash->{'is_test_environment'} = 0;
+ if ( $c->config->{'is_test_environment'} ) {
+ $c->log->debug( $K . "TEST-Umgebung" ) if $c->stash->{'debug_level'};
+ $c->stash->{'is_test_environment'} = 1;
+ }
+
+ $storage->sql_maker->quote_char( [qw/` `/] );
+ $storage->sql_maker->name_sep('.');
+
+ $c->session->{'last_run'} = localtime();
+
+ # Letzten und aktuellen Pfad behalten
+ my $last_path = $c->session->{'last_path'} || '';
+ my $cur_path = $c->session->{'cur_path'} || '';
+ my $req_path = '/' . $c->request->path();
+ if ( $req_path ne $cur_path ) {
+ $c->session->{'last_path'} = $cur_path;
+ $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->session->{'request'}{'host'} = hostname();
+ $c->session->{'request'}{'client'} = $c->req->address();
+ $c->session->{'request'}{'uagent'} = $c->req->user_agent();
########################
# Sprachabhaengige Dinge
"id" => { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 },
"title" => { data_type => "VARCHAR", default_value => undef, is_nullable => 0, size => 250, },
"title_original" => { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 250, },
+ "untertitel" => { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 250, },
"bindungsart_id" => { data_type => "INT", default_value => undef, is_nullable => 1, size => 10 },
"verlags_id" => { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 },
"isbn" => { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 20, },
'me.id',
'me.title',
'me.title_original',
+ 'me.untertitel',
'me.bindungsart_id',
- 'bindungsart.art_name AS `bindungsart`',
+ 'bindungsart.art_name',
'me.verlags_id',
'me.isbn',
'me.buch_nr',
'waehrung.waehrungs_kuerzel',
'waehrung.waehrungs_name',
'waehrung.umrechnung_in_euro',
- 'verlag.name_short AS `verlagsname_short`',
- 'verlag.name_long AS `verlagsname_long`',
+ 'verlag.name_short',
+ 'verlag.name_long',
];
$other_params->{'as'} = [
'id',
'title',
'title_original',
+ 'untertitel',
'bindungsart_id',
'bindungsart',
'verlags_id',
$buch->{'id'} = $id;
$buch->{'title'} = $book->title();
$buch->{'title_original'} = $book->title_original();
+ $buch->{'untertitel'} = $book->untertitel();
$buch->{'bindungsart_id'} = $book->bindungsart_id();
$buch->{'bindungsart'} = $book->get_column('bindungsart');
$buch->{'verlags_id'} = $book->verlags_id();
<th>Kategorie</th>
<th>Verlag</th>
<th>ISBN</th>
- <th>Buch-Nummer</th>
- <th>Ausgabejahr</th>
- <th>Preis</th>
- <th>Seiten</th>
- <th>Typ</th>
</tr>
[%- FOREACH book IN books -%][% buch_id = book.id %]
<tr>
<td>[% tt_authors = [ ]; tt_authors.push(autor) FOREACH autor = book.autoren %][% tt_authors.join(', ') %]</td>
- <td>[% book.title %][% IF book.title_original %] ([% book.title_original %])[% END %]</td>
+ <td>[% book.title %]</td>
<td>[% tt_cat = [ ]; tt_cat.push(cat) FOREACH cat = book.kategorien %][% tt_cat.join(',<br />') %]</td>
<td>[% book.verlagsname_short %]</td>
<td>[% book.isbn %]</td>
- <td>[% book.buch_nr %]</td>
- <td>[% book.ausgabejahr %]</td>
- <td style="text-align: right;">[% book.preis | format '%0.2f' | replace('\.', ',') %][% IF book.waehrungs_kuerzel %] [% book.waehrungs_kuerzel %][% END %]</td>
- <td style="text-align: right;">[% book.seiten %]</td>
- <td>[% book.bindungsart %]</td>
</tr>
[% END -%]
</table>