]> Frank Brehm's Git Trees - books.git/commitdiff
Kurzinhalt des Buches mit dazu
authorFrank Brehm <frank@brehm-online.com>
Thu, 25 Jun 2009 20:13:57 +0000 (20:13 +0000)
committerFrank Brehm <frank@brehm-online.com>
Thu, 25 Jun 2009 20:13:57 +0000 (20:13 +0000)
lib/FrBr/Books/Controller/Books.pm
lib/FrBr/Books/Db/Buecher.pm
lib/FrBr/Books/Util/Book.pm
root/src/books/form.tt2
root/src/books/view.tt2

index 18f8af89a09cd1ce940662a65c7e5d61d2a3d9e7..9f0e22690bb121d70f419e66569a0f8cee9bc31b 100644 (file)
@@ -802,6 +802,7 @@ sub bookdata_session2stash : Private {
     $c->stash->{'book_edit'}{'seiten'}         = $c->session->{'book_data_edit'}{'seiten'};
     $c->stash->{'book_edit'}{'preis'}          = $c->session->{'book_data_edit'}{'preis'};
     $c->stash->{'book_edit'}{'waehrungs_id'}   = $c->session->{'book_data_edit'}{'waehrungs_id'};
+    $c->stash->{'book_edit'}{'kurzinhalt'}     = $c->session->{'book_data_edit'}{'kurzinhalt'};
 
     $c->log->debug( get_output_string( $K . "Buch-Infos im Stash: ", $c->stash->{'book_edit'} ) );
 
@@ -1066,6 +1067,9 @@ sub bookdata_cgi2session : Private {
         $c->session->{'book_data_edit'}{'preis'} = $preis;
     }
 
+    # Kurzbeschreibung des Inhalts
+    $c->session->{'book_data_edit'}{'kurzinhalt'} = $c->request->params->{'book_kurzinhalt'} if defined $c->request->params->{'book_kurzinhalt'};
+
     return 1;
 
 }
index b880a7e3ce8e6307c472e9b876591107f1a33ee8..b6454470dd09c7f5f95f22aaeaf9ee3aa99dc732 100644 (file)
@@ -25,6 +25,7 @@ __PACKAGE__->add_columns(
   "seiten"         => { data_type => "INT",       default_value => undef, is_nullable => 1, size => 10 },
   "preis"          => { data_type => "FLOAT",     default_value => undef, is_nullable => 1, size => 32 },
   "waehrungs_id"   => { data_type => "INT",       default_value => undef, is_nullable => 1, size => 10 },
+  "kurzinhalt"     => { data_type => "TEXT",      default_value => undef, is_nullable => 1, size => 65535, },
 );
 
 __PACKAGE__->set_primary_key("id");
index 570bd947d386d574c2feed0b947ab4cd5c581735..7380fc1c87711fc535b8e93b3ddd4c072543705c 100644 (file)
@@ -91,6 +91,7 @@ Rueckgabe: Eine Array-Ref mit allen Buchtiteln, die den uebergebenen Suchkriteri
     'kategorien' => [
       'Mystery-Thriller'
     ],
+    'kurzinhalt' => 'Bla bla bla, tolles Buch',
     'ort_beschreibung' => undef,
     'ort_ist_statisch' => undef,
     'orts_id' => undef,
@@ -190,6 +191,7 @@ sub get_booklist {
         'me.ausgabejahr',
         'me.druckjahr',
         'me.seiten',
+        'me.kurzinhalt',
         'me.preis',
         'me.waehrungs_id',
         'waehrung.waehrungs_kuerzel',
@@ -215,6 +217,7 @@ sub get_booklist {
         'ausgabejahr',
         'druckjahr',
         'seiten',
+        'kurzinhalt',
         'preis',
         'waehrungs_id',
         'waehrungs_kuerzel',
@@ -244,6 +247,7 @@ sub get_booklist {
         $buch->{'ausgabejahr'}        = $book->ausgabejahr();
         $buch->{'druckjahr'}          = $book->druckjahr();
         $buch->{'seiten'}             = $book->seiten();
+        $buch->{'kurzinhalt'}         = $book->kurzinhalt();
         $buch->{'preis'}              = $book->preis();
         $buch->{'waehrungs_id'}       = $book->waehrungs_id();
         $buch->{'waehrungs_kuerzel'}  = $book->get_column('waehrungs_kuerzel');
@@ -528,6 +532,7 @@ sub delete_book {
     'kategorien' => [
       '2'
     ],
+    'kurzinhalt' => 'bla bla bla',
     'original_title' => '',
     'orts_id' => '2',
     'preis' => 14,
@@ -553,6 +558,12 @@ sub save_book {
 
     my $storage = $c->stash->{'storage'};
 
+    my $tmp = $book->{'kurzinhalt'};
+    $tmp = '' unless defined $tmp;
+    $tmp =~ s/^\s+//;
+    $tmp =~ s/\s+$//;
+       $book->{'kurzinhalt'} = $tmp eq '' ? undef : $tmp;
+
     my $save_func = sub {
 
         my $storage = shift;
@@ -561,10 +572,10 @@ sub save_book {
 
         my $sql = <<ENDE;
 INSERT INTO `buecher` (
-    `id`, `title`, `title_original`, `untertitel`, `verlags_id`, `orts_id`,
+    `id`, `title`, `title_original`, `untertitel`, `verlags_id`, `orts_id`, `kurzinhalt`,
     `bindungsart_id`, `isbn`, `buch_nr`, `ausgabejahr`, `druckjahr`, `seiten`, `preis`, `waehrungs_id` )
   VALUES (
-    ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
+    ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
   ON DUPLICATE KEY UPDATE
     `id`             = LAST_INSERT_ID(`id`),
     `title`          = ?,
@@ -572,6 +583,7 @@ INSERT INTO `buecher` (
     `untertitel`     = ?,
     `verlags_id`     = ?,
     `orts_id`        = ?,
+    `kurzinhalt`     = ?,
     `bindungsart_id` = ?,
     `isbn`           = ?,
     `buch_nr`        = ?,
@@ -589,6 +601,7 @@ ENDE
         push @params, $buch->{'untertitel'};
         push @params, $buch->{'verlags_id'};
         push @params, $buch->{'orts_id'};
+        push @params, $buch->{'kurzinhalt'};
         push @params, $buch->{'bindungsart_id'};
         push @params, $buch->{'isbn'};
         push @params, $buch->{'book_nr'};
@@ -603,6 +616,7 @@ ENDE
         push @params, $buch->{'untertitel'};
         push @params, $buch->{'verlags_id'};
         push @params, $buch->{'orts_id'};
+        push @params, $buch->{'kurzinhalt'};
         push @params, $buch->{'bindungsart_id'};
         push @params, $buch->{'isbn'};
         push @params, $buch->{'book_nr'};
index 0a2bfc1b35e670ea74612196ce734c23e8fd99bb..6e744e7566327b4ac46304b7d51db56920cf44a1 100644 (file)
@@ -164,6 +164,9 @@ function goto_new_ort() {
             <option value="">-- Währung auswählen --</option>[% FOR waehrungsid IN waehrungs_ids %]
             <option value="[% waehrungsid %]"[% IF book_edit.waehrungs_id == waehrungsid %] selected[% END %]>[% waehrungsliste.$waehrungsid.kuerzel %]</option>[% END %]
           </select>&nbsp;<input type="button" name="neue_waehrung" value="*" class="shift_button" title="Neue Währung" /></td>
+    </tr><tr>
+      <th>Kurzinhalt:</th>
+      <td><textarea name="book_kurzinhalt" cols="80" rows="10">[% book_edit.kurzinhalt | html %]</textarea></td>
     </tr><tr>
       <td colspan="2" class="empty"></td>
     </tr><tr>
index 04e37fc3766790530e2185243f722f72f71a1602..d2c806ef6b3fd17d5635b5990d06bc951ee40a71 100644 (file)
@@ -22,6 +22,7 @@
       'kategorien' => [
         'Mystery-Thriller'
       ],
+      'kurzinhalt' => => 'Bla Sülz, tolles Buch',
       'ort_beschreibung' => undef,
       'ort_ist_statisch' => undef,
       'orts_id' => undef,
@@ -42,6 +43,7 @@
     }
 
 -%]
+[% USE ForumCode -%]
 
 Buchanzeige -->
 
@@ -95,6 +97,9 @@ Buchanzeige -->
   </tr><tr>
     <th>Preis:</th>
     <td>[% book.preis | format('%.2f') | replace('\.', ',')  %] [% book.waehrungs_kuerzel | html %]</td>
+  </tr><tr>
+    <th>Kurzinhalt:</th>
+    <td>[% ForumCode.forumcode( book.kurzinhalt ) %]</td>
 </table>
 
 <div class="back">