Direct entry point into the call number browser
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 29 Jul 2011 15:51:26 +0000 (11:51 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 29 Jul 2011 15:51:26 +0000 (11:51 -0400)
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
Open-ILS/web/css/skin/default/opac/style.css
Open-ILS/web/templates/default/opac/cnbrowse.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/opac/parts/advanced/numeric.tt2
Open-ILS/web/templates/default/opac/parts/record/cnbrowse.tt2

index 6097498..6412907 100644 (file)
@@ -94,6 +94,7 @@ sub load {
 
     return $self->load_rresults if $path =~ m|opac/results|;
     return $self->load_record if $path =~ m|opac/record|;
+    return $self->load_cnbrowse if $path =~ m|opac/cnbrowse|;
 
     return $self->load_mylist_add if $path =~ m|opac/mylist/add|;
     return $self->load_mylist_move if $path =~ m|opac/mylist/move|;
index dbfad54..f7a86b5 100644 (file)
@@ -62,9 +62,8 @@ sub load_record {
             $ctx->{expanded_holdings} =
                 $self->get_expanded_holdings($rec_id, $org, $depth);
         } elsif ($expand eq 'cnbrowse') {
-            $ctx->{browsed_call_numbers} = $self->browse_call_numbers();
+            $self->prepare_browse_call_numbers();
         }
-
     }
 
     return Apache2::Const::OK;
@@ -209,10 +208,10 @@ sub any_call_number_label {
     }
 }
 
-sub browse_call_numbers {
+sub prepare_browse_call_numbers {
     my ($self) = @_;
 
-    my $cn = $self->any_call_number_label or
+    my $cn = ($self->cgi->param("cn") || $self->any_call_number_label) or
         return [];
 
     my $org_unit = $self->ctx->{get_aou}->($self->cgi->param('loc')) ||
@@ -224,7 +223,7 @@ sub browse_call_numbers {
         $cn, $org_unit->shortname, 9, $self->cgi->param("cnoffset")
     )->gather(1) || [];
 
-    return [
+    $self->ctx->{browsed_call_numbers} = [
         map {
             $_->record->marc(
                 (new XML::LibXML)->parse_string($_->record->marc)
@@ -232,6 +231,7 @@ sub browse_call_numbers {
             $_;
         } @$results
     ];
+    $self->ctx->{browsing_ou} = $org_unit;
 }
 
 sub get_hold_copy_summary {
index f597001..96f150e 100644 (file)
@@ -135,11 +135,15 @@ sub load_rresults {
 
     $ctx->{page} = 'rresult';
 
+    # Special alternative searches here.  This could all stand to be cleaner.
     if ($cgi->param("_special")) {
         return $self->marc_expert_search if scalar($cgi->param("tag"));
         return $self->item_barcode_shortcut if (
             $cgi->param("qtype") and ($cgi->param("qtype") eq "item_barcode")
         );
+        return $self->call_number_browse_standalone if (
+            $cgi->param("qtype") and ($cgi->param("qtype") eq "cnbrowse")
+        );
     }
 
     my $page = $cgi->param('page') || 0;
@@ -328,4 +332,29 @@ sub marc_expert_search {
     }
 }
 
+sub call_number_browse_standalone {
+    my ($self) = @_;
+
+    if (my $cnfrag = $self->cgi->param("query")) {
+        my $url = sprintf(
+            'http%s://%s%s/cnbrowse?cn=%s',
+            $self->cgi->https ? "s" : "",
+            $self->apache->hostname,
+            $self->ctx->{opac_root},
+            $cnfrag # XXX some kind of escaping needed here?
+        );
+        return $self->generic_redirect($url);
+    } else {
+        return $self->generic_redirect; # return to search page
+    }
+}
+
+sub load_cnbrowse {
+    my ($self) = @_;
+
+    $self->prepare_browse_call_numbers();
+
+    return Apache2::Const::OK;
+}
+
 1;
index 6a0a19a..dd69b49 100644 (file)
@@ -1015,3 +1015,7 @@ a.dash-link:hover { text-decoration: underline !important; }
 .rdetail-extras-summary { margin: 10px; }
 .staff-hold { background-color: #eee; }
 .expert-search tbody tr th { text-align: right; padding-left: 2em; }
+.bookshelf thead tr td {
+    border-bottom: 1px dashed #999;
+    padding-bottom: 1ex;
+}
diff --git a/Open-ILS/web/templates/default/opac/cnbrowse.tt2 b/Open-ILS/web/templates/default/opac/cnbrowse.tt2
new file mode 100644 (file)
index 0000000..b9c7453
--- /dev/null
@@ -0,0 +1,21 @@
+[%  # This is the stand-alone call-number browser.  This mainly wraps around
+    # the same guts as the "shelf browser" part of a record results page.
+
+    PROCESS "default/opac/parts/header.tt2";
+    PROCESS "default/opac/parts/misc_util.tt2";
+    WRAPPER "default/opac/parts/base.tt2";
+    INCLUDE "default/opac/parts/topnav.tt2";
+    ctx.page_title = l("Call Number Browse"); %]
+    <div id="search-wrapper">
+        [% INCLUDE "default/opac/parts/printnav.tt2" %]
+        [% INCLUDE "default/opac/parts/searchbar.tt2" %]
+    </div>
+    <div id="content-wrapper">
+        <div id="main-content">
+            <div class="cnbrowse_div">
+                [% INCLUDE "default/opac/parts/record/cnbrowse.tt2" %]
+            </div>
+            <div class="common-full-pad"></div>        
+        </div>
+    </div>
+[% END %]
index c2a1d3d..d842942 100644 (file)
@@ -9,6 +9,7 @@
                     <option value="identifier|isbn">[% l('ISBN') %]</option>
                     <option value="identifier|issn">[% l('ISSN') %]</option>
                     <option value="identifier|bib_cn">[% l('Call Number') %]</option>
+                    <option value="cnbrowse">[% l('Call Number (Browse)') %]</option>
                     <option value="identifier|lccn">[% l('LCCN') %]</option>
                     <option value="identifier|tcn">[% l('TCN') %]</option>
                     <option value="item_barcode">[% l('Item Barcode') %]</option>
index 88e4fbf..c3a1cb4 100644 (file)
@@ -1,20 +1,26 @@
+[%- IF ctx.page == "record";
+    prev_next_root = "/record/" _ ctx.bre_id _ extras_propagator;
+ELSE;
+    cn = CGI.param('cn') | uri;
+    prev_next_root = "/cnbrowse?cn=" _ cn;
+END -%]
 <div id='cn_browse' class='cn_browser'>
     <div id='cn_browse_div'> 
         <div class='color_4'>
             <span>[% l("You are now browsing") %]</span>
-            <strong>[% ctx.get_aou(CGI.param('loc')).name %]</strong>
+            <strong>[% ctx.browsing_ou.name %]</strong>
         </div>
         <table class='data_grid bookshelf' width='100%'>
             <thead>
                 <tr>
                     <td>
-                        <a id='cn_browse_prev' class='classic_link' href="[% ctx.opac_root %]/record/[% ctx.bre_id _ extras_propagator _ '&amp;cnoffset=' _ ((CGI.param('cnoffset') || 0) - 1) _ '&amp;expand=cnbrowse#cnbrowse' %]"<b>[%
+                        <a id='cn_browse_prev' class='classic_link' href="[% ctx.opac_root _ prev_next_root _ '&amp;cnoffset=' _ ((CGI.param('cnoffset') || 0) - 1) _ '&amp;expand=cnbrowse#cnbrowse' %]"<b>[%
                             l("&lt;&lt; Previous Page")
                         %]</b></a>
                     </td>
                     <td colspan='1' align='center'>[% l("Shelf Browser") %]</td>
                     <td>
-                        <a id='cn_browse_next' class='classic_link' href="[% ctx.opac_root %]/record/[% ctx.bre_id _ extras_propagator _ '&amp;cnoffset=' _ ((CGI.param('cnoffset') || 0) + 1) _ '&amp;expand=cnbrowse#cnbrowse' %]"<b>[%
+                        <a id='cn_browse_next' class='classic_link' href="[% ctx.opac_root _ prev_next_root _ '&amp;cnoffset=' _ ((CGI.param('cnoffset') || 0) + 1) _ '&amp;expand=cnbrowse#cnbrowse' %]"<b>[%
                             l("Next Page &gt;&gt;")
                         %]</b></a>
                     </td>