From e83a957964b508be588098730c5ffbef1644e7c0 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Sun, 13 Feb 2011 16:33:12 +0000 Subject: [PATCH] Hervorhebung von Aufbewahrungsorten (z.B. fuer Ausleihe) dazu --- db/structure.sql | 3 +++ lib/FrBr/Books/Controller/Ort.pm | 5 +++++ lib/FrBr/Books/Db/Result/Orte.pm | 1 + lib/FrBr/Books/Plugin/Book.pm | 6 +++++- lib/FrBr/Books/Plugin/Ort.pm | 5 +++++ root/lib/config/colors.tt2 | 1 + root/lib/site/styles.css | 5 +++++ root/src/books/list.tt2 | 2 +- root/src/books/view.tt2 | 5 +++-- root/src/ort/form.tt2 | 6 ++++++ root/src/ort/list.tt2 | 2 +- root/src/ort/view.tt2 | 4 ++++ 12 files changed, 40 insertions(+), 5 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index 130b113..22ba9e2 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -238,6 +238,7 @@ CREATE TABLE `orte` ( `name` varchar(100) NOT NULL, `descr` text NOT NULL, `statisch` enum('n','y') NOT NULL DEFAULT 'n' COMMENT 'Ort darf nicht gelöscht oder verändert werden', + `emphased` enum('n','y') NOT NULL DEFAULT 'n' COMMENT 'Soll der Aufbewahrungsort hervorgehoben werden?', `created_at` datetime NOT NULL COMMENT 'Wann erstellt', `created_by` int(10) unsigned NOT NULL COMMENT 'Von welcher User-Id erstellt', `changed_at` datetime NOT NULL COMMENT 'Wann geändert', @@ -255,6 +256,8 @@ CREATE TABLE `orte` ( -- Dumping data for table `orte` -- +INSERT INTO `orte` (`id`, `name`, `descr`, `statisch`, `emphased`, `created_at`, `created_by`, `changed_at`, `changed_by`) VALUES +(1, 'Ausgeliehen', 'Irgendwohin hausgeliehen', 'y', 'y', NOW(), 1, NOW(), 1) -- -- Table structure for table `serien` diff --git a/lib/FrBr/Books/Controller/Ort.pm b/lib/FrBr/Books/Controller/Ort.pm index 0fa4feb..3bf18ca 100644 --- a/lib/FrBr/Books/Controller/Ort.pm +++ b/lib/FrBr/Books/Controller/Ort.pm @@ -476,6 +476,7 @@ sub check_formparams : Private { } $c->stash->{'ort_edit'}{'statisch'} = to_bool( $c->stash->{'ort_edit'}{'statisch'} ) ? 'y' : 'n'; + $c->stash->{'ort_edit'}{'emphased'} = to_bool( $c->stash->{'ort_edit'}{'emphased'} ) ? 'y' : 'n'; return 1; @@ -520,6 +521,9 @@ sub ort_cgi2session : Private { # ist es statischer (nicht änderbarer) Aufbewahrungsort ? $c->session->{'ort_data_edit'}{'statisch'} = to_bool( $c->request->params->{'ort_statisch'} ) ? 'y' : 'n'; + # ist es hervorgehobener Aufbewahrungsort ? + $c->session->{'ort_data_edit'}{'emphased'} = to_bool( $c->request->params->{'ort_emphased'} ) ? 'y' : 'n'; + return 1; } @@ -538,6 +542,7 @@ sub ort_session2stash : Private { $c->stash->{'ort_edit'}{'name'} = $c->session->{'ort_data_edit'}{'name'} if $c->session->{'ort_data_edit'}{'name'}; $c->stash->{'ort_edit'}{'descr'} = $c->session->{'ort_data_edit'}{'descr'}; $c->stash->{'ort_edit'}{'statisch'} = $c->session->{'ort_data_edit'}{'statisch'}; + $c->stash->{'ort_edit'}{'emphased'} = $c->session->{'ort_data_edit'}{'emphased'}; $c->stash->{'return_target_ort_save'} = $c->session->{'return_target_ort_save'} || $c->web_path('/ort'); diff --git a/lib/FrBr/Books/Db/Result/Orte.pm b/lib/FrBr/Books/Db/Result/Orte.pm index 54e9025..bb04280 100644 --- a/lib/FrBr/Books/Db/Result/Orte.pm +++ b/lib/FrBr/Books/Db/Result/Orte.pm @@ -15,6 +15,7 @@ __PACKAGE__->add_columns( "name" => { data_type => "VARCHAR", default_value => undef, is_nullable => 0, size => 100, }, "descr" => { data_type => "TEXT", default_value => undef, is_nullable => 0, size => 65535, }, "statisch" => { data_type => "ENUM", default_value => "n", is_nullable => 0, size => 1 }, + "emphased" => { data_type => "ENUM", default_value => "n", is_nullable => 0, size => 1 }, "created_at" => { data_type => "DATETIME", default_value => undef, is_nullable => 0, size => 19, }, "created_by" => { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, "changed_at" => { data_type => "DATETIME", default_value => undef, is_nullable => 0, size => 19, }, diff --git a/lib/FrBr/Books/Plugin/Book.pm b/lib/FrBr/Books/Plugin/Book.pm index 4f1d680..9a499da 100644 --- a/lib/FrBr/Books/Plugin/Book.pm +++ b/lib/FrBr/Books/Plugin/Book.pm @@ -93,7 +93,8 @@ Rueckgabe: Eine Array-Ref mit allen Buchtiteln, die den uebergebenen Suchkriteri 'kurzinhalt' => 'Bla bla bla, tolles Buch', 'notes' => 'naja, geht so', 'ort_beschreibung' => undef, - 'ort_ist_statisch' => undef, + 'ort_ist_statisch' => 'n', + 'ort_emphased' => 'n', 'orts_id' => undef, 'ortsname' => undef, 'preis' => '7.45', @@ -361,6 +362,7 @@ sub b_get_booklist { 'ort.name', 'ort.descr', 'ort.statisch', + 'ort.emphased', 'me.created_by', 'created_by.vorname', 'created_by.nachname', @@ -396,6 +398,7 @@ sub b_get_booklist { 'ortsname', 'ort_beschreibung', 'ort_ist_statisch', + 'ort_emphased', 'created_by', 'created_by_vorname', 'created_by_nachname', @@ -436,6 +439,7 @@ sub b_get_booklist { $buch->{'ortsname'} = $book->get_column('ortsname'); $buch->{'ort_beschreibung'} = $book->get_column('ort_beschreibung'); $buch->{'ort_ist_statisch'} = $book->get_column('ort_ist_statisch'); + $buch->{'ort_emphased'} = $book->get_column('ort_emphased'); $buch->{'id_created_by'} = $book->get_column('created_by'); $buch->{'created_at'} = $book->get_column('created_at'); diff --git a/lib/FrBr/Books/Plugin/Ort.pm b/lib/FrBr/Books/Plugin/Ort.pm index 96181ff..41d9a84 100644 --- a/lib/FrBr/Books/Plugin/Ort.pm +++ b/lib/FrBr/Books/Plugin/Ort.pm @@ -57,6 +57,7 @@ Rueckgabe: Eine Array-Ref von Hash-Refs mit allen Aufbewahrungsorten, die den ue 'name' => 'Ausgeliehen', 'descr' => '', 'statisch' => 'y', + 'emphased' => 'y', 'count_books' => 16, 'created_at' => '2010-02-22 12:13:14', 'id_created_by' => 1, @@ -153,6 +154,7 @@ sub b_get_ortsliste { 'me.name', 'me.descr', 'me.statisch', + 'me.emphased', 'me.created_by', 'created_by.vorname', 'created_by.nachname', @@ -168,6 +170,7 @@ sub b_get_ortsliste { 'name', 'descr', 'statisch', + 'emphased', 'created_by', 'created_by_vorname', 'created_by_nachname', @@ -194,6 +197,7 @@ sub b_get_ortsliste { $ort->{'name'} = $ort_rs->name(); $ort->{'descr'} = $ort_rs->descr(); $ort->{'statisch'} = $ort_rs->statisch(); + $ort->{'emphased'} = $ort_rs->emphased(); $ort->{'count_books'} = $ort_rs->get_column('count_books'); $ort->{'id_created_by'} = $ort_rs->get_column('created_by'); @@ -379,6 +383,7 @@ sub b_save_ort { $row->{'descr'} = defined $tmp ? $tmp : undef; $row->{'statisch'} = to_bool( $ort->{'statisch'} ) ? 'y' : 'n'; + $row->{'emphased'} = to_bool( $ort->{'emphased'} ) ? 'y' : 'n'; my $user_id = $c->stash->{'current_user_id'} || 1; $row->{'changed_at'} = \'NOW()'; diff --git a/root/lib/config/colors.tt2 b/root/lib/config/colors.tt2 index 0a7de39..17fe55c 100644 --- a/root/lib/config/colors.tt2 +++ b/root/lib/config/colors.tt2 @@ -61,6 +61,7 @@ line = site.rgb.dunkelgraugelb message = site.rgb.green error = site.rgb.red + emphased = site.rgb.rotbraun warn = site.rgb.darkgreen alink = site.rgb.darkblue statusbarbg = site.rgb.mittelmgenta diff --git a/root/lib/site/styles.css b/root/lib/site/styles.css index 3a32cef..0f3270f 100644 --- a/root/lib/site/styles.css +++ b/root/lib/site/styles.css @@ -177,6 +177,11 @@ SPAN.book_orgtitle { font-style: italic; } +SPAN.emphased { + font-weight: bold; + color: [% site.col.emphased %]; +} + DIV.error { white-space: pre; } diff --git a/root/src/books/list.tt2 b/root/src/books/list.tt2 index 5ed0113..dd73aa7 100644 --- a/root/src/books/list.tt2 +++ b/root/src/books/list.tt2 @@ -69,7 +69,7 @@ [% book.title %][% IF book.untertitel %]
[% book.untertitel %][% END %][% IF book.title_original %]
("[% book.title_original %]")[% END %] [% tt_cat = [ ]; tt_cat.push(cat) FOREACH cat = book.kategorien %][% tt_cat.join(',
') %] [% book.verlagsname_short %] - [% IF book.orts_id %][% book.ortsname %][% ELSE %]unbekannt[% END %] + [% IF book.orts_id %][% IF book.ort_emphased == 'y' %][% END %][% book.ortsname %][% IF book.ort_emphased == 'y' %][% END %][% ELSE %]unbekannt[% END %] Ansehen [% IF Catalyst.user_exists %]Ändern Löschen[% END %] diff --git a/root/src/books/view.tt2 b/root/src/books/view.tt2 index b00e119..84c4b90 100644 --- a/root/src/books/view.tt2 +++ b/root/src/books/view.tt2 @@ -31,7 +31,8 @@ 'name_created_by' => 'Frank Brehm', 'notes' => 'tolles Buch, wie gesagt', 'ort_beschreibung' => undef, - 'ort_ist_statisch' => undef, + 'ort_ist_statisch' => 'n', + 'ort_emphased' => 'n', 'orts_id' => undef, 'ortsname' => undef, 'preis' => '7.45', @@ -76,7 +77,7 @@ Buchanzeige --> [% book.verlagsname_long | html %] Aufbewahrungsort: - [% book.ortsname | html %] + [% IF book.ort_emphased == 'y' %][% END %][% book.ortsname | html %][% IF book.ort_emphased == 'y' %][% END %] Bindungsart: [% book.bindungsart | html %] diff --git a/root/src/ort/form.tt2 b/root/src/ort/form.tt2 index 7db0ffb..fdf64d8 100644 --- a/root/src/ort/form.tt2 +++ b/root/src/ort/form.tt2 @@ -25,6 +25,12 @@ Aufbewahrungsort-Formular -->   + + Hervorgehobene Darstellung: +     + + +   Beschreibung: diff --git a/root/src/ort/list.tt2 b/root/src/ort/list.tt2 index b49cf59..b90776f 100644 --- a/root/src/ort/list.tt2 +++ b/root/src/ort/list.tt2 @@ -42,7 +42,7 @@ [% PROCESS navrow %] [% rowstyle = 'even' %][%- FOREACH ort IN orte -%] - [% ort.name %] + [% IF ort.emphased == 'y' %][% END %][% ort.name %][% IF ort.emphased == 'y' %][% END %] [% ort.descr %] [% ort.count_books %] Ansehen diff --git a/root/src/ort/view.tt2 b/root/src/ort/view.tt2 index 9bc03f4..dcc533e 100644 --- a/root/src/ort/view.tt2 +++ b/root/src/ort/view.tt2 @@ -15,6 +15,7 @@ 'id' => '1', 'name' => 'Ausgeliehen', 'statisch' => 'y', + 'emphased' => 'y', 'changed_at' => '2010-02-25 21:45:18', 'created_at' => '2010-02-25 21:45:18', 'id_changed_by' => '1', @@ -68,6 +69,9 @@ Anzeige Aufbewahrungsort --> Aufbewahrungsort: [%- ort.name | html -%] + + Hervorgehobene Darstellung: + [% IF ort.emphased == 'y' %]Ja[% ELSE %]Nein[% END %] Beschreibung: [%- ort.descr | html %] -- 2.39.5