From: Frank Brehm Date: Wed, 19 Mar 2008 22:48:03 +0000 (+0000) Subject: Formular Neues Buch begonnen X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=fc6be9d9d866a5b8cf78cb2aba0b189f3ee051c4;p=books.git Formular Neues Buch begonnen --- diff --git a/lib/FrBr/Books/Controller/Books.pm b/lib/FrBr/Books/Controller/Books.pm index 20a0c35..1aa08a5 100644 --- a/lib/FrBr/Books/Controller/Books.pm +++ b/lib/FrBr/Books/Controller/Books.pm @@ -22,6 +22,34 @@ Catalyst Controller. =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 @@ -33,6 +61,29 @@ sub index : Private { $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 @@ -45,9 +96,6 @@ sub list : Local { 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; @@ -56,6 +104,42 @@ sub list : Local { } +#------------------------------------------------------- + +=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 @@ -68,4 +152,6 @@ it under the same terms as Perl itself. =cut +#------------------------------------------------------- + 1; diff --git a/root/src/books/book_form.tt2 b/root/src/books/book_form.tt2 new file mode 100644 index 0000000..8707702 --- /dev/null +++ b/root/src/books/book_form.tt2 @@ -0,0 +1,54 @@ +[%# + Template fuer Buchangaben + + $Id$ + $URL$ + +-%] + +
+[%- IF book_edit.id %][% END %] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[% book_form_title %]
 
Buchtitel:
Untertitel:
Original-Titel:
ISBN:
Buch-Nummer (verlagseigen):
Ausgabejahr:
Druckjahr:
Seiten:
Preis:
 
+
+[%- IF error_message %] +
+Fehler: [% error_message %] +
+[% END -%] diff --git a/root/src/books/new.tt2 b/root/src/books/new.tt2 new file mode 100644 index 0000000..cb8f10d --- /dev/null +++ b/root/src/books/new.tt2 @@ -0,0 +1,13 @@ +[%# + Template fuer neues Buch + + $Id$ + $URL$ + +-%] +[%- book_form_title = 'Neues Buch' -%] +[% PROCESS books/book_form.tt2 %] + +
+

[% 'Zurück' %]

+
diff --git a/root/src/not_implemented.tt2 b/root/src/not_implemented.tt2 new file mode 100644 index 0000000..62da1b9 --- /dev/null +++ b/root/src/not_implemented.tt2 @@ -0,0 +1,8 @@ +[%- # + # Template zur Darstellung eines noch nicht implementierten Features + # + # $Id$ + # $URL$ + # +-%] +

Das gewünschte Feature wurde leider noch nicht implementiert.