=cut
+#-------------------------------------------------------
+
+=head2 auto
+
+=cut
+
+sub auto : Private {
+
+ my ( $self, $c ) = @_;
+ my $K = __PACKAGE__ . "::auto(): ";
+
+ $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->uri_for("/books"),
+ 'name' => "Bücher"
+ };
+
+ $c->stash->{'cssfiles'} = [] unless $c->stash->{'cssfiles'};
+ push @{$c->stash->{'cssfiles'}}, 'books/styles.css';
+
+ 1;
+
+} ## end sub auto :
+
+#-------------------------------------------------------
+
=head2 index
$c->response->body('Matched FrBr::Books::Controller::Books in Books.');
}
+#-------------------------------------------------------
+
+=head2 default
+
+=cut
+
+sub default : Private {
+
+ my ( $self, $c ) = @_;
+ my $K = __PACKAGE__ . "::default(): ";
+
+ $c->stash->{'template'} = 'not_implemented.tt2';
+
+ push @{ $c->stash->{'menu_path'} }, {
+ 'path' => $c->uri_for("/books/default"),
+ 'name' => "Nicht Implementiert"
+ };
+
+} ## end sub default :
+
+
+#-------------------------------------------------------
+
=head2 list
Fetch all book objects and pass to books/list.tt2 in stash to be displayed
my $K = __PACKAGE__ . "::list(): ";
$c->log->debug( $K . "aufgerufen." ) if $c->stash->{'debug_level'} > 2;
- $c->stash->{'cssfiles'} = [] unless $c->stash->{'cssfiles'};
- push @{$c->stash->{'cssfiles'}}, 'books/styles.css';
-
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;
}
+#-------------------------------------------------------
+
+=head2 form_new( )
+
+Erstellen eines neuen Buches.
+
+=cut
+
+sub form_new : Path('new') {
+
+ my ( $self, $c ) = @_;
+ my $K = __PACKAGE__ . "::form_new(): ";
+
+ $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->uri_for("/books/new"),
+ 'name' => "Neu"
+ };
+
+ $c->stash->{'template'} = 'books/new.tt2';
+
+ $c->stash->{'error_message'} = '';
+ $c->stash->{'book_edit'} = {};
+ $c->stash->{'book_edit'}{'title'} = 'Neues Buch';
+
+ unless ( $c->request->params->{'do_save'} ) {
+ return 1;
+ }
+
+ return 1;
+
+}
+
+#-------------------------------------------------------
=head1 AUTHOR
=cut
+#-------------------------------------------------------
+
1;
--- /dev/null
+[%#
+ Template fuer Buchangaben
+
+ $Id$
+ $URL$
+
+-%]
+<!-- Book form -->
+<form method="post" name="book_form" action="[% Catalyst.request.base %][% Catalyst.request.path %]">
+[%- IF book_edit.id %]<input type="hidden" name="book_id" value="[% book_edit.id | html %]" />[% END %]
+ <table class="ftable" cellspacing="0">
+ <tr>
+ <th colspan="2" class="title">[% book_form_title %]</th>
+ </tr><tr>
+ <td colspan="2"> </td>
+ </tr><tr>
+ <th>Buchtitel:</th>
+ <td><input type="text" name="book_title" size="60" maxlength="250" value="[% book_edit.title | html %]" /></td>
+ </tr><tr>
+ <th>Untertitel:</th>
+ <td><input type="text" name="book_untertitel" size="60" maxlength="250" value="[% book_edit.untertitel | html %]" /></td>
+ </tr><tr>
+ <th>Original-Titel:</th>
+ <td><input type="text" name="book_original_title" size="60" maxlength="250" value="[% book_edit.original_title | html %]" /></td>
+ </tr><tr>
+ <th>ISBN:</th>
+ <td><input type="text" name="book_isbn" size="20" maxlength="20" value="[% book_edit.isbn | html %]" /></td>
+ </tr><tr>
+ <th>Buch-Nummer (verlagseigen):</th>
+ <td><input type="text" name="book_nr" size="20" maxlength="100" value="[% book_edit.book_nr | html %]" /></td>
+ </tr><tr>
+ <th>Ausgabejahr:</th>
+ <td><input type="text" name="book_ajahr" size="20" maxlength="20" value="[% book_edit.ausgabejahr | html %]" class="zahl" /></td>
+ </tr><tr>
+ <th>Druckjahr:</th>
+ <td><input type="text" name="book_djahr" size="20" maxlength="20" value="[% book_edit.druckjahr | html %]" class="zahl" /></td>
+ </tr><tr>
+ <th>Seiten:</th>
+ <td><input type="text" name="book_seiten" size="20" maxlength="20" value="[% book_edit.seiten | html %]" class="zahl" /></td>
+ </tr><tr>
+ <th>Preis:</th>
+ <td><input type="text" name="book_preis" size="20" maxlength="20" value="[% book_edit.preis | replace('\.', ',') %]" class="zahl" /></td>
+ </tr><tr>
+ <td colspan="2"> </td>
+ </tr><tr>
+ <th colspan="2" class="button"><input type="submit" name="submit" value=" OK " /></th>
+ </tr>
+ </table>
+</form>
+[%- IF error_message %]
+<div class="error">
+<span class="bold">Fehler:</span> [% error_message %]
+</div>
+[% END -%]