TPAC: Show deleted record warning for deleted records
authorDan Scott <dan@coffeecode.net>
Sun, 8 Apr 2012 19:47:10 +0000 (15:47 -0400)
committerDan Scott <dan@coffeecode.net>
Mon, 9 Apr 2012 12:45:57 +0000 (08:45 -0400)
At the cost of an extra database query per record displayed, we can
properly activate the "This record has been deleted..." message. Prior
to this commit, the message was embedded on every page but hidden via
CSS - which isn't great for search engines or source-reading types.

Now we only include & display the message if it has, in fact, been
deleted.

Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
Open-ILS/src/templates/opac/parts/record/body.tt2
Open-ILS/web/css/skin/default/opac/style.css

index abb8265..9150480 100644 (file)
@@ -64,6 +64,14 @@ sub load_record {
 
     $self->get_hold_copy_summary($rec_id, $org);
 
+    $self->ctx->{bib_is_dead} = OpenILS::Application::AppUtils->is_true(
+        OpenILS::Utils::CStoreEditor->new->json_query({
+            select => { bre => [ 'deleted' ] },
+            from => 'bre',
+            where => { 'id' => $rec_id }
+        })->[0]->{deleted}
+    );
+
     $cstore->kill_me;
 
     if (
index 9f120c6..0571a72 100644 (file)
         <div class="clear-both"></div>
     </div>
     [% END %]
-
-    <div style='font-weight: bold; padding: 5px; margin: 5px; width: 100%;'
-        class='hide_me color_4' id='rdetail_deleted_exp'>
+    [%- IF ctx.bib_is_dead %]
+    <div id='rdetail_deleted_exp'>
         [% l("This record has been deleted from the database.  We recommend that you remove this title from any bookbags it may have been added to.") %]
     </div>
+    [%- END %]
     [% INCLUDE "opac/parts/record/summary.tt2" %]
 </div>
index 62b677f..b5d4387 100644 (file)
@@ -1425,3 +1425,9 @@ a.preflib_change {
 .rdetail-holding-group { margin-left: 1.5em; }
 .rdetail-holding-group span { margin-left: 1.5em; }
 .rdetail-holding-group .paging { margin-left: 1.5em; }
+#rdetail_deleted_exp {
+    font-weight: bold;
+    padding: 1em;
+    margin: 1em;
+    border: thick solid red;
+}