]> Frank Brehm's Git Trees - books.git/commitdiff
Formular Neues Buch begonnen
authorFrank Brehm <frank@brehm-online.com>
Wed, 19 Mar 2008 22:48:03 +0000 (22:48 +0000)
committerFrank Brehm <frank@brehm-online.com>
Wed, 19 Mar 2008 22:48:03 +0000 (22:48 +0000)
lib/FrBr/Books/Controller/Books.pm
root/src/books/book_form.tt2 [new file with mode: 0644]
root/src/books/new.tt2 [new file with mode: 0644]
root/src/not_implemented.tt2 [new file with mode: 0644]

index 20a0c354ee8cb9d39e672f89dec6b233865f38bc..1aa08a5a7c9be2bb3c46e673eaae0a3fbf07766e 100644 (file)
@@ -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 (file)
index 0000000..8707702
--- /dev/null
@@ -0,0 +1,54 @@
+[%#
+     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">&nbsp;</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">&nbsp;</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>&nbsp;[% error_message %]
+</div>
+[% END -%]
diff --git a/root/src/books/new.tt2 b/root/src/books/new.tt2
new file mode 100644 (file)
index 0000000..cb8f10d
--- /dev/null
@@ -0,0 +1,13 @@
+[%#
+     Template fuer neues Buch
+
+     $Id$
+     $URL$
+
+-%]
+[%- book_form_title = 'Neues Buch' -%]
+[% PROCESS books/book_form.tt2 %]
+
+<div class="back">
+<h2><a href="[% Catalyst.uri_for('/books') %]">[% 'Zurück' %]</a></h2>
+</div>
diff --git a/root/src/not_implemented.tt2 b/root/src/not_implemented.tt2
new file mode 100644 (file)
index 0000000..62da1b9
--- /dev/null
@@ -0,0 +1,8 @@
+[%- #
+    # Template zur Darstellung eines noch nicht implementierten Features
+    #
+    # $Id$
+    # $URL$
+    #
+-%]
+<h3>Das gewünschte Feature wurde leider noch nicht implementiert.</h3>