]> Frank Brehm's Git Trees - books.git/commitdiff
mit Ausgabe Buch angefangen
authorFrank Brehm <frank@brehm-online.com>
Tue, 18 Nov 2008 23:56:13 +0000 (23:56 +0000)
committerFrank Brehm <frank@brehm-online.com>
Tue, 18 Nov 2008 23:56:13 +0000 (23:56 +0000)
lib/FrBr/Books/Controller/Books.pm
root/src/books/list.tt2
root/src/books/view.css [new file with mode: 0644]
root/src/books/view.tt2 [new file with mode: 0644]

index 7a420c81248e6ee20654586011833603d0cd46ec..c12d30371971ed8dbbcea793f95d5b10ad232d58 100644 (file)
@@ -165,6 +165,53 @@ sub form_new : Path('new') {
 
 #-------------------------------------------------------
 
+=head2 form_view( )
+
+Ansehen eines vorhandenen Buches.
+
+=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("/books/view"),
+        'name' => "Betrachten"
+    };
+
+    $c->stash->{'template'} = 'books/view.tt2';
+    push @{$c->stash->{'cssfiles'}}, 'books/view.css';
+
+    $c->stash->{'error_message'} = '';
+
+    $self->prepare_data_structures($c);
+
+    $self->bookdata_cgi2session($c);
+
+    if ( $c->request->params->{'neuer_autor'} ) {
+        $c->session->{'return_target_autor_save'} = $c->stash->{'self_url'};
+        $c->detach('/autor/form_new');
+    }
+
+    $c->stash->{'book_edit'} = {} unless $c->stash->{'book_edit'};
+    $self->bookdata_session2stash($c);
+    $c->stash->{'book_edit'}{'title'} = "Neues Buch" unless $c->stash->{'book_edit'}{'title'};
+
+    unless ( $c->request->params->{'book_form_sent'} and $c->request->params->{'do_save'} ) {
+        return 1;
+    }
+
+    return $self->do_save_book($c);
+
+}
+
+#-------------------------------------------------------
+
 sub do_save_book : Private {
 
     my ( $self, $c ) = @_;
index fbae6d869e2e011447b1330dc3ea2f246caadf60..37fa76a8d728967c6a1a18db6b5666dd22f12205 100644 (file)
@@ -16,7 +16,9 @@
     <th>Kategorie</th>
     <th>Verlag</th>
     <th>Aufbewahrungsort</th>
-    <th>ISBN</th>
+    <th></th>
+    <th></th>
+    <th></th>
   </tr>
 [%- FOREACH book IN books -%][% buch_id = book.id %]
   <tr>
@@ -25,7 +27,9 @@
     <td>[% tt_cat = [ ]; tt_cat.push(cat) FOREACH cat = book.kategorien %][% tt_cat.join(',<br />') %]</td>
     <td>[% book.verlagsname_short %]</td>
     <td>[% IF book.orts_id %][% book.ortsname %][% ELSE %]unbekannt[% END %]</td>
-    <td>[% book.isbn %]</td>
+    <td class="button"><a href="[% path('/books/view') %]?view_book_id=[% book.id %]">Ansehen</a></td>
+    <td class="button"><a href="[% path('/books/edit') %]?edit_book_id=[% book.id %]">Ändern</a></td>
+    <td class="button"><a href="[% path('/books/delete') %]?delete_book_id=[% book.id %]">Löschen</a></td>
   </tr>
 [% END -%]
 </table>
diff --git a/root/src/books/view.css b/root/src/books/view.css
new file mode 100644 (file)
index 0000000..0eb55e8
--- /dev/null
@@ -0,0 +1,10 @@
+[%#
+   # Template fuer Stylesheets Buchanzeige
+   #
+   # $Id$
+   # $URL$
+   #
+-%]
+/*  Stylesheets Buchanzeige */
+
+
diff --git a/root/src/books/view.tt2 b/root/src/books/view.tt2
new file mode 100644 (file)
index 0000000..02c829b
--- /dev/null
@@ -0,0 +1,131 @@
+[%#
+    Template fuer Buchanzeige
+
+    vim: noai : ts=4 fenc=utf-8 filetype=html expandtab :
+
+    $Id$
+    $URL$
+
+-%]
+
+<!-- Buchanzeige -->
+
+<table class="ftable" cellspacing="0">
+  <tr>
+    <th colspan="2" class="title">Buchangaben '[%- book_edit.title | html -%]'</th>
+  </tr><tr>
+    <td colspan="2">&nbsp;</td>
+  </tr><tr>
+    <th>Autor (-en):</th>
+    <td>[% FOR autor_id IN autor_list_book %]
+      [% autor_list.$autor_id %][% END %]</td>
+    </tr><tr>
+      <th>Buchtitel:</th>
+      <td>[% book_edit.title | html %]</td>
+    </tr><tr>
+      <th>Untertitel:</th>
+      <td>[% book_edit.untertitel | html %]</td>
+    </tr><tr>
+      <th>Original-Titel:</th>
+      <td>[% book_edit.original_title | html %]</td>
+    </tr><tr>
+      <th>Verlag:</th>
+      <td>[% book_edit.verlagsname_long %]<select name="verlags_id" size="1">
+            <option value="">-- Verlag auswählen --</option>[% FOR verlagsid IN verlags_ids %]
+            <option value="[% verlagsid %]"[% IF book_edit.verlags_id == verlagsid %] selected[% END %]>[% verlagsliste.$verlagsid %]</option>[% END %]
+          </select>&nbsp;<input type="button" name="neuer_verlag" value="*" class="shift_button" title="Neuer Verlag" onclick="goto_new_verlag();" /></td>
+    </tr><tr>
+      <th>Aufbewahrungsort:</th>
+      <td><select name="orts_id" size="1">
+            <option value="">-- Aufbewahrungsort auswählen --</option>[% FOR ortsid IN orts_ids %]
+            <option value="[% ortsid %]"[% IF book_edit.orts_id == ortsid %] selected[% END %]>[% ortsliste.$ortsid %]</option>[% END %]
+          </select>&nbsp;<input type="button" name="neuer_aufbewahrungsort" value="*" class="shift_button" title="Neuer Aufbewahrungsort" onclick="goto_new_ort();" /></td>
+    </tr><tr>
+      <th>Bindungsart:</th>
+      <td><select name="bindungsart_id" size="1">
+            <option value="">-- Bindungsart auswählen --</option>[% FOR bart_id IN bindungsarten_ids %]
+            <option value="[% bart_id %]"[% IF book_edit.bindungsart_id == bart_id %] selected[% END %]>[% bindungsartenliste.$bart_id %]</option>[% END %]
+          </select></td>
+    </tr><tr>
+      <th>Kategorie(n):</th>
+      <td>
+        <table class="two_lists" cellspacing="0">
+          <tr>
+            <th>Verfügbare Kategorien</th>
+            <th></th>
+            <th>Kategorien des Buchs</th>
+          </tr><tr>
+            <td><select name="kategorie_not" size="7" multiple>
+        <option value="">-- Kategorie oder Kategorien wählen --</option>[% FOR cat_id IN kategorie_list_no %]
+        <option value="[% cat_id %]">[% kategorie_list.$cat_id %]</option>
+      [% END %]</select></td>
+            <td><input type="submit" name="wird_kategorie" value="&rArr;" class="shift_button" title="Wird Kategorie" /><br /><br />
+                <input type="button" name="neue_kategorie" value="*"      class="shift_button" title="Neue Kategorie" onclick="goto_new_category();" /><br /><br />
+                <input type="submit" name="entf_kategorie" value="&lArr;" class="shift_button" title="Kategorie entfernen" />
+            </td>
+            <td><select name="kategorie_book" size="7" multiple>
+                  <option value="">-- Kategorie oder Kategorien entfernen --</option>[% FOR cat_id IN kategorie_list_book %]
+                  <option value="[% cat_id %]">[% kategorie_list.$cat_id %]</option>[% END %]
+                </select></td>
+          </tr></table></td>
+    </tr><tr>
+      <th>Buchserien:</th>
+      <td>
+        <table class="two_lists" cellspacing="0">
+          <tr>
+            <th>Verfügbare Buchserien</th>
+            <th></th>
+            <th>Serien des Buchs</th>
+          </tr><tr>
+            <td><select name="buchserie_not" size="7" multiple>
+        <option value="">-- Buchserie wählen --</option>[% FOR serien_id IN serienliste_no %]
+        <option value="[% serien_id %]">[% serienliste.$serien_id %]</option>
+      [% END %]</select></td>
+            <td><input type="submit" name="wird_serie" value="&rArr;" class="shift_button" title="Wird Serie" /><br /><br />
+                <input type="button" name="neue_serie" value="*"      class="shift_button" title="Neue Serie" onclick="goto_new_serie();" /><br /><br />
+                <input type="submit" name="entf_serie" value="&lArr;" class="shift_button" title="Serie entfernen" />
+            </td>
+            <td><select name="serie_book" size="7" multiple>
+                  <option value="">-- Buchserie entfernen --</option>[% FOR serien_id IN serienliste_book %]
+                  <option value="[% serien_id %]">[% serienliste.$serien_id %]</option>[% END %]
+                </select></td>
+          </tr></table></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" />
+          <select name="waehrungs_id" size="1">
+            <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>
+      <td colspan="2">&nbsp;</td>
+    </tr><tr>
+      <th colspan="2" class="button"><input type="submit" name="do_save" value="  OK  " /></th>
+    </tr>
+  </table>
+</form>
+[%- IF error_message %]
+<div class="error">
+<span class="bold">Fehler:</span>&nbsp;[% error_message %]
+</div>
+[% END -%]
+
+<div class="back">
+<h2><a href="[% path('/books') %]">[% 'Zurück' %]</a></h2>
+</div>
+