'name' => "Liste"
};
- my $liste = get_verlagsliste( $c, 'get_books' => 1 );
+ my $liste = get_verlagsliste( $c );
$c->log->debug( get_output_string( $K, "Erhaltene Liste der Verlage: ", $liste ) ) if $c->stash->{'debug_level'} >= 2;
$c->stash->{'verlage'} = $liste;
#-------------------------------------------------------
+=head2 form_view( )
+
+Ansehen eines vorhandenen Verlages.
+
+=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'};
+ push @{ $c->stash->{'menu_path'} }, {
+ 'path' => $c->web_path("/verlag/view"),
+ 'name' => "Betrachten"
+ };
+
+ $c->stash->{'error_message'} = '';
+
+ my $verlags_id = to_int( $c->request->params->{'view_verlags_id'} || 0 );
+ unless ( $verlags_id ) {
+ $c->stash->{'template'} = 'error.tt2';
+ $c->stash->{'error'} = 'Keine oder ungültige Verlags-Id übergeben.';
+ return 1;
+ }
+
+
+ my $verlagsliste = get_verlagsliste( $c, 'verlags_id' => $verlags_id, 'get_books' => 1, );
+ $c->log->debug( get_output_string( $K, "Erhaltene Verlagsliste: ", $verlagsliste ) ) if $c->stash->{'debug_level'} >= 2;
+
+ unless ( $verlagsliste and scalar( @$verlagsliste ) ) {
+ $c->stash->{'template'} = 'error.tt2';
+ $c->stash->{'error'} = 'Zur übergebenen Verlags-Id wurde kein Verlag gefunden.';
+ return 1;
+ }
+
+ $c->stash->{'return_target'} = $c->web_path("/verlag/list");
+
+ $c->stash->{'verlag'} = $verlagsliste->[0];
+ $verlagsliste = undef;
+ $c->stash->{'template'} = 'verlag/view.tt2';
+ push @{$c->stash->{'cssfiles'}}, 'verlag/view.css';
+
+}
+
+#-------------------------------------------------------
+
=head2 form_new( )
Erstellen eines neuen Verlages.
__END__
-# vim: noai : ts=4 fenc=utf-8 filetype=perl expandtab :
+# vim: noai : ts=4 fenc=utf-8 filetype=perl
=over 4
+=item B<verlags_id>: Die ID eines konkreten Verlages
+
+=item B<get_books>: Bool. Zeigt an, daß zu den gefundenen Verlagen die dazugehörigen
+Bücher geholt werden sollen.
+
=item B<page>
Integer: Zeigt an, welche Seite von Verlagen dargestellt werden soll.
$rows = $c->stash->{'list_length'} || 20 if defined $page;
my $search_params = undef;
+ if ( $params->{'verlags_id'} ) {
+ $search_params = {
+ 'me.id' => $params->{'verlags_id'},
+ };
+ }
my $other_params = {};
$other_params->{'order_by'} = [ 'name_short' ];
push @$list, $verlag;
}
- return $list;
+ return $list unless scalar $list;
+ return $list unless $params->{'get_books'};
+
+ for my $verlag ( @$list ) {
+
+ $verlag->{'books'} = [];
+
+ my $vid = $verlag->{'id'};
+ $search_params = {
+ "verlags_id" => $vid,
+ };
+ $other_params = {};
+ $other_params->{'join'} = [ 'waehrung', 'ort', 'bindungsart' ];
+ $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',
+ ];
+ $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',
+ ];
+
+ 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->{'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 @{ $verlag->{'books'} }, $buch;
+
+ }
+
+ }
+
+ return $list;
}
#-----------------------------------------------------------------------------------
--- /dev/null
+/* [%#
+ # Template fuer Stylesheets Buchanzeige
+ #
+ # vim: noai : ts=4 fenc=utf-8 filetype=css
+ #
+ # $Id$
+ # $URL$
+ #
+-%]
+ Stylesheets Verlagsanzeige */
+
+TABLE.ftable {
+ border-width: 2px;
+ border-style: solid;
+ border-top-color: [% site.col.tab_rahmen_hell %];
+ border-left-color: [% site.col.tab_rahmen_hell %];
+ border-right-color: [% site.col.tab_rahmen_dkl %];
+ border-bottom-color: [% site.col.tab_rahmen_dkl %];
+ border-collapse: separate;
+ border-spacing: 0;
+ margin: auto;
+}
+
+TABLE.ftable UL {
+ margin: 0;
+}
+
+TABLE.ftable TH {
+ vertical-align: top;
+ text-align: left;
+ padding: 2px;
+ border-width: 1px;
+ border-style: solid;
+ font-size: 1em;
+ border-top-color: [% site.col.tab_rahmen_dkl %];
+ border-left-color: [% site.col.tab_rahmen_dkl %];
+ border-right-color: [% site.col.tab_rahmen_hell %];
+ border-bottom-color: [% site.col.tab_rahmen_hell %];
+ background-color: [% site.col.list_head %];
+}
+
+TABLE.ftable TD {
+ vertical-align: top;
+ padding: 2px;
+ border-width: 1px;
+ border-style: solid;
+ border-top-color: [% site.col.tab_rahmen_dkl %];
+ border-left-color: [% site.col.tab_rahmen_dkl %];
+ border-right-color: [% site.col.tab_rahmen_hell %];
+ border-bottom-color: [% site.col.tab_rahmen_hell %];
+ background-color: [% site.col.list_row_bold %];
+}
+
+TABLE.ftable TD.empty {
+ height: 0.5em;
+}
+
+TABLE.ftable TH.button {
+ font-weight: bolder;
+ text-align: center;
+ font-size: 1.2em;
+ padding-left: 1em;
+ padding-right: 1em;
+}
+
+TABLE.ftable TH.button INPUT {
+ font-weight: bolder;
+ text-align: center;
+ font-size: 1em;
+ padding-left: 1em;
+ padding-right: 1em;
+}
+
+
--- /dev/null
+<!-- [%#
+
+ Template fuer Verlagsanzeige
+
+ vim: noai : ts=4 fenc=utf-8 filetype=html
+
+ $Id$
+ $URL$
+
+ Übergebene Struktur in [verlag]:
+
+ $verlag = {
+ 'books' => [
+ {
+ 'ausgabejahr' => '2004',
+ 'autor_ids' => [
+ '11',
+ ],
+ 'autoren' => [
+ 'Markus Heitz',
+ ],
+ 'bindungsart' => 'Softcover (Taschenbuch)',
+ 'bindungsart_id' => '4',
+ 'buch_nr' => undef,
+ 'druckjahr' => '2006',
+ 'id' => '11',
+ 'isbn' => '3-492-70076-4',
+ 'ort_beschreibung' => '',
+ 'ort_ist_statisch' => 'n',
+ 'orts_id' => '2',
+ 'ortsname' => 'Flur - Glasvitrine',
+ 'preis' => '14',
+ 'seiten' => '640',
+ 'title' => 'Die Zwerge',
+ 'title_original' => undef,
+ 'umrechnung_in_euro' => '1',
+ 'untertitel' => undef,
+ 'waehrungs_id' => '1',
+ 'waehrungs_kuerzel' => '€',
+ 'waehrungs_name' => 'Euro',
+ },
+ {
+ ...
+ },
+ ],
+ 'count_books' => '1',
+ 'descr' => '',
+ 'id' => '8',
+ 'name' => 'Piper',
+ };
+
+-%]
+[%- 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">Verlagsangaben '[%- verlag.name | html -%]'</th>
+ </tr><tr>
+ <td colspan="2" class="empty"></td>
+ </tr><tr>
+ <th>Verlag:</th>
+ <td>[%- verlag.name | html -%]</td>
+ </tr><tr>
+ <th>Kompletter Verlagsname / Beschreibung:</th>
+ <td>[%- verlag.descr | html %]</td>
+ </tr><tr>
+ <th>Anzahl Bücher:</th>
+ <td>[%- verlag.count_books | html -%]</td>
+ </tr><tr>
+ <th>Bücher:</th>
+ <td>[% IF verlag.count_books > 1 %]<ul>[% FOR buch IN verlag.books %]<li>[% PROCESS book_entry book=buch %]</li>[% END %]</ul>[% ELSE %][% PROCESS book_entry book=verlag.books.0 %][% END %]</td>
+</table>
+
+<div class="back">
+<h2><a href="[% return_target %]">[% 'Zurück' %]</a></h2>
+</div>
+