[open-ils-commits] [GIT] Evergreen ILS branch master updated. 1f8f87ae3708140672a3ce3f2a9d49ce308b276f

Evergreen Git git at git.evergreen-ils.org
Tue Jan 10 14:26:57 EST 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  1f8f87ae3708140672a3ce3f2a9d49ce308b276f (commit)
       via  a8db0cd7efd660b062a2265778a5fa26b9fd4064 (commit)
      from  4bca5949ed01f29c1a1bd6de6e9f139b3dba391f (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 1f8f87ae3708140672a3ce3f2a9d49ce308b276f
Merge: 4bca594 a8db0cd
Author: Mike Rylander <mrylander at gmail.com>
Date:   Tue Jan 10 14:26:50 2012 -0500

    Merge remote-tracking branch 'eg-working/user/senator/tpac-bookbag-viewer'


commit a8db0cd7efd660b062a2265778a5fa26b9fd4064
Author: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Date:   Tue Nov 15 01:50:00 2011 -0500

    Tpac: better "HTML view" for shared lists under "my lists"
    
    From the "my lists" interface, you get a link labeled "HTML View" for
    any shared lists, and this link, while meant to be shared, just
    gives you a search results page where the only search term is simply "in
    the given list."
    
    This commit makes the search results page a little smarter in that case,
    in order to
        a) show you the bookbag metadata, including name, description and
            item notes.
        b) allow you to keep searching *within* your list, until you don't
            want to anymore, at which point there's a checkbox you can uncheck.
    
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
index 6e74628..bce9cdb 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
@@ -82,6 +82,10 @@ sub _prepare_biblio_search {
         }
     }
 
+    if ($cgi->param("bookbag")) {
+        $query .= " container(bre,bookbag," . int($cgi->param("bookbag")) . ")";
+    }
+
     if ($cgi->param('pubdate') && $cgi->param('date1')) {
         if ($cgi->param('pubdate') eq 'between') {
             $query .= ' between(' . $cgi->param('date1');
@@ -170,6 +174,62 @@ sub tag_circed_items {
 
     return 0 unless @$sets;
     return 1;
+
+}
+
+# This only loads the bookbag itself (in support of a record results page)
+# if a "bookbag" CGI parameter is specified and if the bookbag is public
+# or owned by the logged-in user (if any).  Bookbag notes are fetched
+# later if applicable.
+sub load_rresults_bookbag {
+    my ($self) = @_;
+
+    my $bookbag_id = int($self->cgi->param("bookbag"));
+    return if $bookbag_id < 1;
+
+    my %authz = $self->ctx->{"user"} ?
+        ("-or" => {"pub" => "t", "owner" => $self->ctx->{"user"}->id}) :
+        ("pub" => "t");
+
+    my $bbag = $self->editor->search_container_biblio_record_entry_bucket(
+        {"id" => $bookbag_id, "btype" => "bookbag", %authz}
+    );
+
+    if (!$bbag) {
+        $self->apache->log->warn(
+            "error from cstore retrieving bookbag $bookbag_id!"
+        );
+        return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+    } elsif (@$bbag) {
+        $self->ctx->{"bookbag"} = shift @$bbag;
+    }
+
+    return;
+}
+
+# assumes context has a bookbag we're already authorized to look at, and
+# a list of rec_ids, reasonably sized (from paged search).
+sub load_rresults_bookbag_item_notes {
+    my ($self, $rec_ids) = @_;
+
+    my $items_with_notes =
+        $self->editor->search_container_biblio_record_entry_bucket_item([
+            {"target_biblio_record_entry" => $rec_ids,
+                "bucket" => $self->ctx->{"bookbag"}->id},
+            {"flesh" => 1, "flesh_fields" => {"cbrebi" => ["notes"]},
+                "order_by" => {"cbrebi" => ["id"]}}
+        ]);
+
+    if (!$items_with_notes) {
+        $self->apache->log->warn("error from cstore retrieving cbrebi objects");
+        return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR;
+    }
+
+    $self->ctx->{"bookbag_items_by_bre_id"} = +{
+        map { $_->target_biblio_record_entry => $_ } @$items_with_notes
+    };
+
+    return;
 }
 
 # context additions: 
@@ -184,6 +244,11 @@ sub load_rresults {
     my $ctx = $self->ctx;
     my $e = $self->editor;
 
+    # load bookbag metadata, if requested.
+    if (my $bbag_err = $self->load_rresults_bookbag) {
+        return $bbag_err;
+    }
+
     $ctx->{page} = 'rresult' unless $internal;
     $ctx->{ids} = [];
     $ctx->{records} = [];
@@ -294,6 +359,8 @@ sub load_rresults {
 
     return Apache2::Const::OK if @$rec_ids == 0 or $internal;
 
+    $self->load_rresults_bookbag_item_notes($rec_ids) if $ctx->{bookbag};
+
     my ($facets, @data) = $self->get_records_and_facets(
         $rec_ids, $results->{facet_key}, 
         {
diff --git a/Open-ILS/src/templates/opac/myopac/lists.tt2 b/Open-ILS/src/templates/opac/myopac/lists.tt2
index 41c77f9..45404e8 100644
--- a/Open-ILS/src/templates/opac/myopac/lists.tt2
+++ b/Open-ILS/src/templates/opac/myopac/lists.tt2
@@ -102,7 +102,7 @@
             <div class="bookbag-controls">
                 [% IF bbag.pub == 't'; %]
                 <a href='[%-
-                    mkurl( ctx.opac_root _ '/results', {page => '0', query => 'container(bre,bookbag,' _ bbag.id _ ')'} )
+                    mkurl( ctx.opac_root _ '/results', {page => '0', bookbag => bbag.id} )
                 -%]'>[% l('HTML View') %]</a>
                 [% END %]
             </div>
diff --git a/Open-ILS/src/templates/opac/parts/result/lowhits.tt2 b/Open-ILS/src/templates/opac/parts/result/lowhits.tt2
index db8266a..f6f39b2 100644
--- a/Open-ILS/src/templates/opac/parts/result/lowhits.tt2
+++ b/Open-ILS/src/templates/opac/parts/result/lowhits.tt2
@@ -8,6 +8,11 @@
                 [% IF is_advanced OR is_special; l('your search'); ELSE %]
                 <q>[% CGI.param('query') | html %]</q>
                 [% END %]
+                [% IF ctx.bookbag;
+                    l('within') %]
+                    <span class="lowhits-bookbag-name">[% ctx.bookbag.name | html %]</span>.
+                [% END %]
+
             </p>
         </div>
         <div style="float:right;width:353px;background:#ccc;padding:10px;margin-top:7px;">
diff --git a/Open-ILS/src/templates/opac/parts/result/paginate.tt2 b/Open-ILS/src/templates/opac/parts/result/paginate.tt2
index 6582c01..bcce1c8 100644
--- a/Open-ILS/src/templates/opac/parts/result/paginate.tt2
+++ b/Open-ILS/src/templates/opac/parts/result/paginate.tt2
@@ -2,7 +2,7 @@
 <div class="results_header_nav1">
     <table cellpadding="0" cellspacing="0" border="0" width="100%">
         <tr>
-            <td class="h1" width="116">[% l('Search Results') %]</td>
+            <td class="h1" width="116">[% ctx.bookbag ? l('List Contents') : l('Search Results') %]</td>
             <td valign="bottom" nowrap="nowrap" class="result_number">
                 [% |l(ctx.result_start, ctx.result_stop, ctx.hit_count) %]
                 Results <strong>[_1]</strong> - <strong>[_2]</strong> of <strong>[_3]</strong>
diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2
index 8312379..36a4e76 100644
--- a/Open-ILS/src/templates/opac/parts/result/table.tt2
+++ b/Open-ILS/src/templates/opac/parts/result/table.tt2
@@ -13,6 +13,12 @@
 [% ctx.results_count_header = PROCESS results_count_header;
     ctx.results_count_header %]
 
+[% IF ctx.bookbag %]
+<div id="result-bookbag-heading">
+    <div class="result-bookbag-name">[% ctx.bookbag.name | html %]</div>
+    <div class="result-bookbag-description">[% ctx.bookbag.description | html %]</div>
+</div>
+[% END %]
 <div id="result_table_div">
             <div class="facet_sidebar">
                 [% INCLUDE "opac/parts/staff_saved_searches.tt2" %]
@@ -181,6 +187,14 @@
                                                         <span>[% l('I have checked this item out before') %]</span>
                                                     </div>
                                                     [% END %]
+                                                    [% IF ctx.bookbag;
+                                                        rec_id = rec.id;
+                                                        FOR note IN ctx.bookbag_items_by_bre_id.$rec_id.notes %]
+                                                    <div class="result-bookbag-item-note">
+                                                        [% note.note | html %]
+                                                    </div>
+                                                        [% END %]
+                                                    [% END %]
                                                 </div>
                                             </td>
 
diff --git a/Open-ILS/src/templates/opac/parts/searchbar.tt2 b/Open-ILS/src/templates/opac/parts/searchbar.tt2
index 43a9c85..360bd25 100644
--- a/Open-ILS/src/templates/opac/parts/searchbar.tt2
+++ b/Open-ILS/src/templates/opac/parts/searchbar.tt2
@@ -29,6 +29,15 @@
         <img id='search-submit-spinner' src='/opac/images/progressbar_green.gif' style='height:16px;width:16px;' class='hidden' alt=''/>
     </span>
     </div>
+    [% IF ctx.bookbag %]
+    <div id="search-only-bookbag-container">
+        <input type="checkbox" id="search-only-bookbag" name="bookbag"
+            value="[% ctx.bookbag.id | html %]" checked="checked" />
+        <label for="search-only-bookbag">
+            [% l('Search only within the chosen list') %]
+        </label>
+    </div>
+    [% END %]
     [% IF is_advanced || is_special %]
     <div>
         <input type="hidden" name="_adv" value="1" />
diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css
index 4fddfe3..9848bba 100644
--- a/Open-ILS/web/css/skin/default/opac/style.css
+++ b/Open-ILS/web/css/skin/default/opac/style.css
@@ -1335,3 +1335,11 @@ table.bookbag-specific {
     top:-3px;
     left:3px;
 }
+
+#search-only-bookbag-container { margin: 2ex 0; font-weight: bold; }
+#result-bookbag-heading { text-align: center; margin: 2ex; }
+
+.result-bookbag-name { font-size: 140%; font-weight: bold; }
+.result-bookbag-description { font-size: 120%; font-style: italic; }
+.result-bookbag-item-note { font-style: italic; }
+.lowhits-bookbag-name { font-weight: bold; }

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

Summary of changes:
 .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm |   67 ++++++++++++++++++++
 Open-ILS/src/templates/opac/myopac/lists.tt2       |    2 +-
 .../src/templates/opac/parts/result/lowhits.tt2    |    5 ++
 .../src/templates/opac/parts/result/paginate.tt2   |    2 +-
 Open-ILS/src/templates/opac/parts/result/table.tt2 |   14 ++++
 Open-ILS/src/templates/opac/parts/searchbar.tt2    |    9 +++
 Open-ILS/web/css/skin/default/opac/style.css       |    8 +++
 7 files changed, 105 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list