[open-ils-commits] [GIT] Evergreen ILS branch master updated. 94656bc7edb68ee2f3d1d4eecb128a2837f55d33

Evergreen Git git at git.evergreen-ils.org
Thu Mar 22 17:12:28 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  94656bc7edb68ee2f3d1d4eecb128a2837f55d33 (commit)
       via  c7368f1cce63ad3fadade381fd102cdae97f1fb9 (commit)
      from  001ef6a6b0f4da8ea5a3606c415a9bbfe0a6a9d8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 94656bc7edb68ee2f3d1d4eecb128a2837f55d33
Author: Dan Scott <dscott at laurentian.ca>
Date:   Thu Mar 22 17:07:10 2012 -0400

    Wrap upgrade script for bib record email / print actions
    
    Thanks again to Bill Erickson for another nice piece o' functionality.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.record_print_format_update.sql b/Open-ILS/src/sql/Pg/upgrade/0689.data.record_print_format_update.sql
similarity index 93%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.data.record_print_format_update.sql
rename to Open-ILS/src/sql/Pg/upgrade/0689.data.record_print_format_update.sql
index fa31353..c8c43a9 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.record_print_format_update.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0689.data.record_print_format_update.sql
@@ -1,5 +1,13 @@
+-- Evergreen DB patch 0689.data.record_print_format_update.sql
+--
+-- Updates print and email templates for bib record actions
+--
+BEGIN;
 
 
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0689', :eg_version);
+
 UPDATE action_trigger.event_definition SET template = $$
 <div>
     <style> li { padding: 8px; margin 5px; }</style>
@@ -95,4 +103,4 @@ DELETE FROM action_trigger.environment env
         def.hook = 'biblio.format.record_entry.email' AND 
         def.id < 100; -- sample data
 
-
+COMMIT;

commit c7368f1cce63ad3fadade381fd102cdae97f1fb9
Author: Bill Erickson <berick at esilibrary.com>
Date:   Wed Feb 29 10:49:18 2012 -0500

    Tpac: record detail print and email
    
    Implements Print and Email actions (as links below add-to-list) in the
    tpac record detail page.
    
    The existing bib record print/email A/T seed templates were also updated
    like so:
    
    * Instead of using the reporter tables, bib data is fetched and
    extracted via unapi, which allows access to SVF data (etc) and is more
    consistent with the tpac.
    
    * A number of unused A/T evnironment entries for the seed templates were
    removed.
    
    * The delay for the email template was explicitly set to 00:00:00
    instead of the default 5 minutes to get the emails out quicker.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
index 755f403..c333023 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
@@ -99,7 +99,8 @@ sub load {
         $path =~ m:opac/(advanced|numeric|expert):;
 
     return $self->load_rresults if $path =~ m|opac/results|;
-    return $self->load_record if $path =~ m|opac/record|;
+    return $self->load_print_record if $path =~ m|opac/record/print|;
+    return $self->load_record if $path =~ m|opac/record/\d|;
     return $self->load_cnbrowse if $path =~ m|opac/cnbrowse|;
 
     return $self->load_mylist_add if $path =~ m|opac/mylist/add|;
@@ -139,6 +140,8 @@ sub load {
     # ----------------------------------------------------------------
     return $self->redirect_auth unless $self->editor->requestor;
 
+    return $self->load_email_record if $path =~ m|opac/record/email|;
+
     return $self->load_place_hold if $path =~ m|opac/place_hold|;
     return $self->load_myopac_holds if $path =~ m|opac/myopac/holds|;
     return $self->load_myopac_circs if $path =~ m|opac/myopac/circs|;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
index e977a47..e2cf2bc 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
@@ -363,4 +363,33 @@ sub get_hold_copy_summary {
     $search->kill_me;
 }
 
+sub load_print_record {
+    my $self = shift;
+
+    my $rec_id = $self->ctx->{page_args}->[0] 
+        or return Apache2::Const::HTTP_BAD_REQUEST;
+
+    $self->{ctx}->{bre_id} = $rec_id;
+    $self->{ctx}->{printable_record} = $U->simplereq(
+        'open-ils.search',
+        'open-ils.search.biblio.record.print', $rec_id);
+
+    return Apache2::Const::OK;
+}
+
+sub load_email_record {
+    my $self = shift;
+
+    my $rec_id = $self->ctx->{page_args}->[0] 
+        or return Apache2::Const::HTTP_BAD_REQUEST;
+
+    $self->{ctx}->{bre_id} = $rec_id;
+    $U->simplereq(
+        'open-ils.search',
+        'open-ils.search.biblio.record.email', 
+        $self->ctx->{authtoken}, $rec_id);
+
+    return Apache2::Const::OK;
+}
+
 1;
diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index 3e6346b..bc3321f 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -8486,6 +8486,7 @@ INSERT INTO action_trigger.event_definition (
         cleanup_failure,
         group_field,
         granularity,
+        delay,
         template
     ) VALUES (
         31,
@@ -8499,22 +8500,42 @@ INSERT INTO action_trigger.event_definition (
         'DeleteTempBiblioBucket',
         'owner',
         NULL,
+        '00:00:00'
 $$
-[%- USE date -%]
 [%- SET user = target.0.owner -%]
 To: [%- params.recipient_email || user.email %]
 From: [%- params.sender_email || default_sender %]
 Subject: Bibliographic Records
 
-    [% FOR cbreb IN target %]
-    [% FOR cbrebi IN cbreb.items %]
-        Bib ID# [% cbrebi.target_biblio_record_entry.id %] ISBN: [% crebi.target_biblio_record_entry.simple_record.isbn %]
-        Title: [% cbrebi.target_biblio_record_entry.simple_record.title %]
-        Author: [% cbrebi.target_biblio_record_entry.simple_record.author %]
-        Publication Year: [% cbrebi.target_biblio_record_entry.simple_record.pubdate %]
+[% FOR cbreb IN target %]
+[% FOR item IN cbreb.items;
+    bre_id = item.target_biblio_record_entry;
 
-    [% END %]
-    [% END %]
+    bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
+    FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
+        title = title _ part.textContent;
+    END;
+
+    author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
+    item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
+    publisher = bibxml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
+    pubdate = bibxml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
+    isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
+    issn = bibxml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
+    upc = bibxml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
+%]
+
+[% loop.count %]/[% loop.size %].  Bib ID# [% bre_id %] 
+[% IF isbn %]ISBN: [% isbn _ "\n" %][% END -%]
+[% IF issn %]ISSN: [% issn _ "\n" %][% END -%]
+[% IF upc  %]UPC:  [% upc _ "\n" %] [% END -%]
+Title: [% title %]
+Author: [% author %]
+Publication Info: [% publisher %] [% pubdate %]
+Item Type: [% item_type %]
+
+[% END %]
+[% END %]
 $$
     )
     ,(
@@ -8529,17 +8550,33 @@ $$
         'DeleteTempBiblioBucket',
         'owner',
         'print-on-demand',
+        NULL,
 $$
-[%- USE date -%]
 <div>
     <style> li { padding: 8px; margin 5px; }</style>
     <ol>
     [% FOR cbreb IN target %]
-    [% FOR cbrebi IN cbreb.items %]
-        <li>Bib ID# [% cbrebi.target_biblio_record_entry.id %] ISBN: [% crebi.target_biblio_record_entry.simple_record.isbn %]<br />
-            Title: [% cbrebi.target_biblio_record_entry.simple_record.title %]<br />
-            Author: [% cbrebi.target_biblio_record_entry.simple_record.author %]<br />
-            Publication Year: [% cbrebi.target_biblio_record_entry.simple_record.pubdate %]
+    [% FOR item IN cbreb.items;
+        bre_id = item.target_biblio_record_entry;
+
+        bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
+        FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
+            title = title _ part.textContent;
+        END;
+
+        author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
+        item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
+        publisher = bibxml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
+        pubdate = bibxml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
+        isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
+        %]
+
+        <li>
+            Bib ID# [% bre_id %] ISBN: [% isbn %]<br />
+            Title: [% title %]<br />
+            Author: [% author %]<br />
+            Publication Info: [% publisher %] [% pubdate %]<br/>
+            Item Type: [% item_type %]
         </li>
     [% END %]
     [% END %]
@@ -8555,20 +8592,7 @@ INSERT INTO action_trigger.environment (
     ) VALUES -- for fleshing cbreb objects
          ( 31, 'owner' )
         ,( 31, 'items' )
-        ,( 31, 'items.target_biblio_record_entry' )
-        ,( 31, 'items.target_biblio_record_entry.simple_record' )
-        ,( 31, 'items.target_biblio_record_entry.call_numbers' )
-        ,( 31, 'items.target_biblio_record_entry.fixed_fields' )
-        ,( 31, 'items.target_biblio_record_entry.notes' )
-        ,( 31, 'items.target_biblio_record_entry.full_record_entries' )
-        ,( 32, 'owner' )
         ,( 32, 'items' )
-        ,( 32, 'items.target_biblio_record_entry' )
-        ,( 32, 'items.target_biblio_record_entry.simple_record' )
-        ,( 32, 'items.target_biblio_record_entry.call_numbers' )
-        ,( 32, 'items.target_biblio_record_entry.fixed_fields' )
-        ,( 32, 'items.target_biblio_record_entry.notes' )
-        ,( 32, 'items.target_biblio_record_entry.full_record_entries' )
 ;
 
 INSERT INTO acq.invoice_item_type (code,name) VALUES ('TAX',oils_i18n_gettext('TAX', 'Tax', 'aiit', 'name'));
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.record_print_format_update.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.record_print_format_update.sql
new file mode 100644
index 0000000..fa31353
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.record_print_format_update.sql
@@ -0,0 +1,98 @@
+
+
+UPDATE action_trigger.event_definition SET template = $$
+<div>
+    <style> li { padding: 8px; margin 5px; }</style>
+    <ol>
+    [% FOR cbreb IN target %]
+    [% FOR item IN cbreb.items;
+        bre_id = item.target_biblio_record_entry;
+
+        bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
+        FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
+            title = title _ part.textContent;
+        END;
+
+        author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
+        item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
+        publisher = bibxml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
+        pubdate = bibxml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
+        isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
+        issn = bibxml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
+        upc = bibxml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
+        %]
+
+        <li>
+            Bib ID# [% bre_id %]<br/>
+            [% IF isbn %]ISBN: [% isbn %]<br/>[% END %]
+            [% IF issn %]ISSN: [% issn %]<br/>[% END %]
+            [% IF upc  %]UPC:  [% upc %]<br/>[% END %]
+            Title: [% title %]<br />
+            Author: [% author %]<br />
+            Publication Info: [% publisher %] [% pubdate %]<br/>
+            Item Type: [% item_type %]
+        </li>
+    [% END %]
+    [% END %]
+    </ol>
+</div>
+$$ 
+WHERE hook = 'biblio.format.record_entry.print' AND id < 100; -- sample data
+
+
+UPDATE action_trigger.event_definition SET delay = '00:00:00', template = $$
+[%- SET user = target.0.owner -%]
+To: [%- params.recipient_email || user.email %]
+From: [%- params.sender_email || default_sender %]
+Subject: Bibliographic Records
+
+[% FOR cbreb IN target %]
+[% FOR item IN cbreb.items;
+    bre_id = item.target_biblio_record_entry;
+
+    bibxml = helpers.unapi_bre(bre_id, {flesh => '{mra}'});
+    FOR part IN bibxml.findnodes('//*[@tag="245"]/*[@code="a" or @code="b"]');
+        title = title _ part.textContent;
+    END;
+
+    author = bibxml.findnodes('//*[@tag="100"]/*[@code="a"]').textContent;
+    item_type = bibxml.findnodes('//*[local-name()="attributes"]/*[local-name()="field"][@name="item_type"]').getAttribute('coded-value');
+    publisher = bibxml.findnodes('//*[@tag="260"]/*[@code="b"]').textContent;
+    pubdate = bibxml.findnodes('//*[@tag="260"]/*[@code="c"]').textContent;
+    isbn = bibxml.findnodes('//*[@tag="020"]/*[@code="a"]').textContent;
+    issn = bibxml.findnodes('//*[@tag="022"]/*[@code="a"]').textContent;
+    upc = bibxml.findnodes('//*[@tag="024"]/*[@code="a"]').textContent;
+%]
+
+[% loop.count %]/[% loop.size %].  Bib ID# [% bre_id %] 
+[% IF isbn %]ISBN: [% isbn _ "\n" %][% END -%]
+[% IF issn %]ISSN: [% issn _ "\n" %][% END -%]
+[% IF upc  %]UPC:  [% upc _ "\n" %] [% END -%]
+Title: [% title %]
+Author: [% author %]
+Publication Info: [% publisher %] [% pubdate %]
+Item Type: [% item_type %]
+
+[% END %]
+[% END %]
+$$ 
+WHERE hook = 'biblio.format.record_entry.email' AND id < 100; -- sample data
+
+-- remove a swath of unused environment entries
+
+DELETE FROM action_trigger.environment env 
+    USING action_trigger.event_definition def 
+    WHERE env.event_def = def.id AND 
+        env.path != 'items' AND 
+        def.hook = 'biblio.format.record_entry.print' AND 
+        def.id < 100; -- sample data
+
+DELETE FROM action_trigger.environment env 
+    USING action_trigger.event_definition def 
+    WHERE env.event_def = def.id AND 
+        env.path != 'items' AND 
+        env.path != 'owner' AND 
+        def.hook = 'biblio.format.record_entry.email' AND 
+        def.id < 100; -- sample data
+
+
diff --git a/Open-ILS/src/templates/opac/parts/record/summary.tt2 b/Open-ILS/src/templates/opac/parts/record/summary.tt2
index f62c531..7ca150e 100644
--- a/Open-ILS/src/templates/opac/parts/record/summary.tt2
+++ b/Open-ILS/src/templates/opac/parts/record/summary.tt2
@@ -11,7 +11,7 @@
 
 <hr />
 
-[%- # This holds the record summary information %]
+[%-# This holds the record summary information %]
 <div id="rdetail_summary_header">
     <div id="rdetail_image_div">
         [% ident = attrs.isbn_clean || attrs.upc; IF ident; %]
@@ -39,6 +39,11 @@
                 [% label %]
             </a>
         </div>
+        <div class="rdetail_aux_utils">
+            <img src="[% ctx.media_prefix %]/images/clipboard.png" alt="" />
+            <a href="[% mkurl(ctx.opac_root _ '/record/print/' _ ctx.bre_id) %]" class="no-dec">[% l('Print') %]</a> /
+            <a href="[% mkurl(ctx.opac_root _ '/record/email/' _ ctx.bre_id) %]" class="no-dec">[% l('Email') %]</a>
+        </div>
     </div>
     <div id='rdetail_title_div'>
         [%- IF attrs.format_icon %]
diff --git a/Open-ILS/src/templates/opac/record/email.tt2 b/Open-ILS/src/templates/opac/record/email.tt2
new file mode 100644
index 0000000..bafd20a
--- /dev/null
+++ b/Open-ILS/src/templates/opac/record/email.tt2
@@ -0,0 +1,21 @@
+[%  PROCESS "opac/parts/header.tt2";
+    PROCESS "opac/parts/config.tt2";
+    WRAPPER "opac/parts/base.tt2";
+    INCLUDE "opac/parts/topnav.tt2";
+    ctx.page_title = l("Record Detail") %]
+    <div id="search-wrapper">
+        [% INCLUDE "opac/parts/searchbar.tt2" %]
+    </div>
+    <br class="clear-both" />
+    <div id="content-wrapper" class="content-wrapper-record-page">
+        <div id='main-content'>
+            <br/>
+            <h2 class='success'>[% l('Your email has been queued for Delivery.') %]</h2>
+            <br/>
+            <p>[ <a href="[% mkurl(ctx.opac_root  _ '/record/' _ ctx.bre_id) %]">[% l("Back to Record") %]</a> ]</p>
+            <div class="common-full-pad"></div>
+        </div>
+        <br class="clear-both" />
+    </div>
+[% END %]
+
diff --git a/Open-ILS/src/templates/opac/record/print.tt2 b/Open-ILS/src/templates/opac/record/print.tt2
new file mode 100644
index 0000000..d5d94e6
--- /dev/null
+++ b/Open-ILS/src/templates/opac/record/print.tt2
@@ -0,0 +1,27 @@
+[% PROCESS 'opac/parts/header.tt2' %]
+<html>
+    <head>
+        <title>[% l('Print Record') %]</title>
+        <style type="text/css" media="print">.noprint {display: none}</style>
+    </head>
+    <body onload="if (document.getElementById('printable-record')) window.print();">
+        [% IF ctx.printable_record.template_output %]
+        <tt id="printable-record">
+            [% ctx.printable_record.template_output.data %]
+        </tt>
+        [% ELSE %]
+        <div class="noprint print-error">
+            [% l(
+                'Error printing record: [_1]',
+                    (ctx.printable_record.textcode ? ctx.printable_record.textcode _ ' / ' _ ctx.printable_record.desc : 0) ||
+                    ctx.printable_record.error_output.data ||
+                    l('No record data returned from server')
+                ) | html %]
+        </div>
+        [% END %]
+        <div class='noprint'>
+            <hr />
+            <p>[ <a href="[% mkurl(ctx.opac_root  _ '/record/' _ ctx.bre_id) %]">[% l("Back to Record") %]</a> ]</p>
+        </div>
+    </body>
+</html>

-----------------------------------------------------------------------

Summary of changes:
 .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm    |    5 +-
 .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm |   29 ++++++
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |   80 ++++++++++-----
 .../0689.data.record_print_format_update.sql       |  106 ++++++++++++++++++++
 .../src/templates/opac/parts/record/summary.tt2    |    7 +-
 .../opac/{record.tt2 => record/email.tt2}          |   16 ++--
 Open-ILS/src/templates/opac/record/print.tt2       |   27 +++++
 7 files changed, 231 insertions(+), 39 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0689.data.record_print_format_update.sql
 copy Open-ILS/src/templates/opac/{record.tt2 => record/email.tt2} (53%)
 create mode 100644 Open-ILS/src/templates/opac/record/print.tt2


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list