$c->stash->{'template'} = 'category/index.tt2';
$c->session->{'return_target_category_save'} = $c->web_path("/kategorie");
+ delete $c->session->{'from_category_list'} if exists $c->session->{'from_category_list'};
}
#-------------------------------------------------------
#-------------------------------------------------------
+=head2 form_view( )
+
+Ansehen einer vorhandenen Kategorie.
+
+=cut
+
+sub form_view : Path('view') {
+
+ my ( $self, $c ) = @_;
+ my $K = ( caller(0) )[3] . "(): ";
+
+ $c->log->debug( $K . "aufgerufen." ) if $c->stash->{'debug_level'} > 2;
+
+ $c->stash->{'menu_path'} = [] unless $c->stash->{'menu_path'};
+ $self->add_kategorielist_menu($c) if $c->session->{'from_category_list'};
+ push @{ $c->stash->{'menu_path'} }, {
+ 'path' => $c->web_path("/kategorie/view"),
+ 'name' => "Betrachten"
+ };
+
+ $c->stash->{'error_message'} = '';
+
+ my $category_id = to_int( $c->request->params->{'view_category_id'} || 0 );
+ unless ( $category_id ) {
+ $c->stash->{'template'} = 'error.tt2';
+ $c->stash->{'error'} = 'Keine oder ungültige Kategorie-Id übergeben.';
+ return 1;
+ }
+
+
+ my $category_list = get_category_list( $c, 'category_id' => $category_id, 'get_books' => 1, );
+ $c->log->debug( get_output_string( $K, "Erhaltene Kategorieliste: ", $category_list ) ) if $c->stash->{'debug_level'} >= 2;
+
+ unless ( $category_list and scalar( @$category_list ) ) {
+ $c->stash->{'template'} = 'error.tt2';
+ $c->stash->{'error'} = 'Zur übergebenen Kategorie-Id wurde keine Kategorie gefunden.';
+ return 1;
+ }
+
+ $c->stash->{'return_target'} = $c->session->{'return_target_view'} or $c->web_path("/kategorie/list");
+
+ $c->stash->{'kategorie'} = $category_list->[0];
+ $category_list = undef;
+ $c->stash->{'template'} = 'category/view.tt2';
+ push @{$c->stash->{'cssfiles'}}, 'category/view.css';
+
+}
+
+#-------------------------------------------------------
+
=head2 form_new( )
Erstellen eines neuen Verlages.
return ( wantarray ? ( $list, 0 ) : $list ) unless scalar @$list;
return ( wantarray ? ( $list, $anzahl_kategorien ) : $list ) unless $params->{'get_books'};
+ for my $cat ( @$list ) {
+
+ $cat->{'books'} = [];
+
+ $search_params = {
+ "buch_kategorie.kategorie_id" => $cat->{'id'},
+ };
+ $other_params = {};
+ $other_params->{'join'} = [ 'waehrung', 'ort', 'bindungsart', 'buch_kategorie', 'verlag', ];
+
+ $other_params->{'select'} = [
+ 'me.id',
+ 'me.title',
+ 'me.title_original',
+ 'me.untertitel',
+ 'me.bindungsart_id',
+ 'bindungsart.art_name',
+ 'me.orts_id',
+ 'me.isbn',
+ 'me.buch_nr',
+ 'me.ausgabejahr',
+ 'me.druckjahr',
+ 'me.seiten',
+ 'me.preis',
+ 'me.waehrungs_id',
+ 'waehrung.waehrungs_kuerzel',
+ 'waehrung.waehrungs_name',
+ 'waehrung.umrechnung_in_euro',
+ 'ort.name',
+ 'ort.descr',
+ 'ort.statisch',
+ 'buch_kategorie.kategorie_id',
+ 'verlag.name_short',
+ 'verlag.name_long',
+ ];
+ $other_params->{'as'} = [
+ 'id',
+ 'title',
+ 'title_original',
+ 'untertitel',
+ 'bindungsart_id',
+ 'bindungsart',
+ 'orts_id',
+ 'isbn',
+ 'buch_nr',
+ 'ausgabejahr',
+ 'druckjahr',
+ 'seiten',
+ 'preis',
+ 'waehrungs_id',
+ 'waehrungs_kuerzel',
+ 'waehrungs_name',
+ 'umrechnung_in_euro',
+ 'ortsname',
+ 'ort_beschreibung',
+ 'ort_ist_statisch',
+ 'kategorie_id',
+ 'verlags_name_short',
+ 'verlags_name_long',
+ ];
+
+ for my $book ( $c->model('Schema::Buecher')->search( $search_params, $other_params )->all() ) {
+ my $buch = {};
+ $buch->{'id'} = $book->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->{'orts_id'} = $book->orts_id();
+ $buch->{'isbn'} = $book->isbn();
+ $buch->{'buch_nr'} = $book->buch_nr();
+ $buch->{'ausgabejahr'} = $book->ausgabejahr();
+ $buch->{'druckjahr'} = $book->druckjahr();
+ $buch->{'seiten'} = $book->seiten();
+ $buch->{'preis'} = $book->preis();
+ $buch->{'waehrungs_id'} = $book->waehrungs_id();
+ $buch->{'waehrungs_kuerzel'} = $book->get_column('waehrungs_kuerzel');
+ $buch->{'waehrungs_name'} = $book->get_column('waehrungs_name');
+ $buch->{'umrechnung_in_euro'} = $book->get_column('umrechnung_in_euro');
+ $buch->{'ortsname'} = $book->get_column('ortsname');
+ $buch->{'ort_beschreibung'} = $book->get_column('ort_beschreibung');
+ $buch->{'ort_ist_statisch'} = $book->get_column('ort_ist_statisch');
+ $buch->{'kategorie_id'} = $book->get_column('kategorie_id');
+ $buch->{'verlags_name_short'} = $book->get_column('verlags_name_short');
+ $buch->{'verlags_name_long'} = $book->get_column('verlags_name_long');
+ $buch->{'autoren'} = [];
+ $buch->{'autor_ids'} = [];
+
+ my $a_search_params = {};
+ $a_search_params->{'buch_id'} = $buch->{'id'};
+ $other_params = {};
+ $other_params->{'order_by'} = [ 'ord_num' ];
+ $other_params->{'join'} = [ 'autor' ];
+ $other_params->{'select'} = [
+ 'me.buch_id',
+ 'autor.id',
+ 'autor.titel',
+ 'autor.vorname',
+ 'autor.mittelname',
+ 'autor.nachname',
+ 'autor.name_suffix',
+ ];
+ $other_params->{'as'} = [
+ 'buch_id',
+ 'autor_id',
+ 'titel',
+ 'vorname',
+ 'mittelname',
+ 'nachname',
+ 'name_suffix',
+ ];
+ for my $ref ( $c->model('Schema::Autor2buch')->search( $a_search_params, $other_params )->all() ) {
+ my $aid = $ref->get_column('autor_id');
+ my @N;
+ push @N, $ref->get_column('titel') if $ref->get_column('titel');
+ push @N, $ref->get_column('vorname') if $ref->get_column('vorname');
+ push @N, $ref->get_column('mittelname') if $ref->get_column('mittelname');
+ push @N, $ref->get_column('nachname');
+ push @N, $ref->get_column('name_suffix') if $ref->get_column('name_suffix');
+ my $autor = join( " ", @N );
+ push @{ $buch->{'autoren'} }, $autor;
+ push @{ $buch->{'autor_ids'} }, $aid;
+ }
+
+ push @{ $cat->{'books'} }, $buch;
+
+ }
+
+ }
+
return ( wantarray ? ( $list, $anzahl_kategorien ) : $list );
}
--- /dev/null
+/* [%#
+ # Template fuer Stylesheets Buchanzeige
+ #
+ # vim: noai : ts=4 fenc=utf-8 filetype=css
+ #
+ # $Id$
+ # $URL$
+ #
+-%]
+ Stylesheets Verlagsanzeige */
+
+[% PROCESS ftable.css %]
+
--- /dev/null
+<!-- [%#
+
+ Template fuer Kategorieanzeige
+
+ vim: noai : ts=4 fenc=utf-8 filetype=html
+
+ $Id$
+ $URL$
+
+ Übergebene Struktur in [kategorie]:
+
+ $kategorie = {
+ 'books' => [
+ {
+ 'ausgabejahr' => '1982',
+ 'autor_ids' => [
+ '22',
+ '20',
+ '21'
+ ],
+ 'autoren' => [
+ 'Henry Lincoln',
+ 'Michael Baigent',
+ 'Richard Leigh'
+ ],
+ 'bindungsart' => 'Softcover (Taschenbuch)',
+ 'bindungsart_id' => '4',
+ 'buch_nr' => undef,
+ 'druckjahr' => '2005',
+ 'id' => '34',
+ 'isbn' => '3-404-77002-1',
+ 'kategorie_id' => '6',
+ 'ort_beschreibung' => '',
+ 'ort_ist_statisch' => 'n',
+ 'orts_id' => '2',
+ 'ortsname' => 'Flur - Glasvitrine',
+ 'preis' => '5',
+ 'seiten' => '472',
+ 'title' => 'Der Heilige Gral und seine Erben',
+ 'title_original' => 'The Holy Blood and the Holy Gral',
+ 'umrechnung_in_euro' => '1',
+ 'untertitel' => 'Ursprung und Gegewart eines geheimen Ordens. Sein Wissen und seine Macht.',
+ 'verlags_name_long' => 'Bastei Lübbe Taschenbuchverlag (Imprint der Verlagsgruppe Lübbe)',
+ 'verlags_name_short' => 'Bastei Lübbe',
+ 'waehrungs_id' => '1',
+ 'waehrungs_kuerzel' => '€',
+ 'waehrungs_name' => 'Euro',
+ }
+ ],
+ 'count_books' => '1',
+ 'id' => '6',
+ 'name' => 'Dokumentation',
+ };
+
+-%]
+[%- BLOCK book_entry -%]
+[% book.title | html %][% IF book.autoren.size %] ([% book.autoren.join( ', ' ) | html %])[% END %]
+[%- END -%]
+
+
+Verlagsanzeige -->
+
+<table class="ftable" cellspacing="0">
+ <tr>
+ <th colspan="2" class="title">Kategorieangaben '[%- kategorie.name | html -%]'</th>
+ </tr><tr>
+ <td colspan="2" class="empty"></td>
+ </tr><tr>
+ <th>Kategorie:</th>
+ <td>[%- kategorie.name | html -%]</td>
+ </tr><tr>
+ <th>Anzahl Bücher:</th>
+ <td>[%- kategorie.count_books | html -%]</td>
+ </tr><tr>
+ <th>Bücher:</th>
+ <td>[% IF kategorie.count_books > 1 %]<ul>[% FOR buch IN kategorie.books %]<li>[% PROCESS book_entry book=buch %]</li>[% END %]</ul>[% ELSE %][% PROCESS book_entry book=kategorie.books.0 %][% END %]</td>
+</table>
+
+<div class="back">
+<h2><a href="[% return_target %]">[% 'Zurück' %]</a></h2>
+</div>
+