[open-ils-commits] [GIT] Evergreen ILS branch master updated. 95f607400e1adc51c8dea8c38a917ed85c7c2772

Evergreen Git git at git.evergreen-ils.org
Tue Oct 9 13:00:42 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  95f607400e1adc51c8dea8c38a917ed85c7c2772 (commit)
      from  ee8d5613cd3bc469678deece795fb43adb0e8f91 (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 95f607400e1adc51c8dea8c38a917ed85c7c2772
Author: Jason Stephenson <jstephenson at mvlc.org>
Date:   Wed Oct 3 12:42:01 2012 -0400

    LP1052941: Internal Server Error when adding to My List in staff client.
    
    Don't redirect in EGCatLoader/Account.pm when in staff client context and
    we're adding to a My List/Bookbag.
    
    Add a wrapper macro to bookbag_actions.tt2 to wrap the add to book bag URLs
    with some javascript that opens a new tab in the staff client. This is to
    prevent the staff person from losing their search results as they would if
    the new URL were opened in their current tab.
    
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
index 91576d4..852b11c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
@@ -1776,9 +1776,12 @@ sub load_myopac_bookbags {
     # or "See all" popmenu items.
     if (my $add_rec = $self->cgi->param('add_rec')) {
         $self->ctx->{add_rec} = $add_rec;
-        $self->ctx->{where_from} = $self->ctx->{referer};
-        if ( my $anchor = $self->cgi->param('anchor') ) {
-            $self->ctx->{where_from} =~ s/#.*|$/#$anchor/;
+        # But not in the staff client, 'cause that breaks things.
+        unless ($self->ctx->{is_staff}) {
+            $self->ctx->{where_from} = $self->ctx->{referer};
+            if ( my $anchor = $self->cgi->param('anchor') ) {
+                $self->ctx->{where_from} =~ s/#.*|$/#$anchor/;
+            }
         }
     }
 
@@ -1921,7 +1924,7 @@ sub load_myopac_bookbag_update {
             last unless $success;
         }
         # Redirect back where we came from if we have an anchor parameter:
-        if ( my $anchor = $cgi->param('anchor') ) {
+        if ( my $anchor = $cgi->param('anchor') && !$self->ctx->{is_staff}) {
             $url = $self->ctx->{referer};
             $url =~ s/#.*|$/#$anchor/;
         } elsif ($cgi->param('where_from')) {
diff --git a/Open-ILS/src/templates/opac/parts/bookbag_actions.tt2 b/Open-ILS/src/templates/opac/parts/bookbag_actions.tt2
index 1ba888e..5aca80d 100644
--- a/Open-ILS/src/templates/opac/parts/bookbag_actions.tt2
+++ b/Open-ILS/src/templates/opac/parts/bookbag_actions.tt2
@@ -2,6 +2,16 @@
     dsetting = "opac.default_list";
     tclass = "temporary divider";
 
+    # Wrap a url to open in a new tab in staff client.
+    MACRO opac_wrap(url) BLOCK;
+    	  IF ctx.is_staff;
+              # void(0) to return false and not go to new page in current tab.
+              "javascript:xulG.new_tab(xulG.urls.XUL_OPAC_WRAPPER, {}, {'opac_url' : 'oils://remote" _ url _ "'});void(0);";
+          ELSE;
+              url;
+          END;
+    END;
+
     IF rec.id;
         # Results table context
         ctx.bre_id = rec.id;
@@ -20,9 +30,9 @@
         tclass = "temporary";
     END;
 
-    href = mkurl(ctx.opac_root _ '/mylist/add', {
+    href = opac_wrap(mkurl(ctx.opac_root _ '/mylist/add', {
         record => ctx.bre_id, anchor => rec_anchor
-    }, stop_parms);
+    }, stop_parms));
 %]
 <ul class="popmenu">
     <li><a href="#" class="no-dec">
@@ -36,20 +46,20 @@
     [% IF default_list;
        label = (ctx.default_bookbag) ? ctx.default_bookbag : l('Default List');
        class = (ctx.bookbags.size) ? "default divider" : "default";
-       href = mkurl(ctx.opac_root _ '/myopac/list/update', {
+       href = opac_wrap(mkurl(ctx.opac_root _ '/myopac/list/update', {
             action => 'add_rec', list => default_list,
             record => ctx.bre_id, anchor => rec_anchor
-        }, stop_parms);
+        }, stop_parms));
     %]
     <li class="[% class %]"><a href="[% href %]">[% label %]</a></li>
     [% END %]
     [% IF ctx.bookbags.size;
        i = 0;
        FOREACH bag IN ctx.bookbags;
-           href = mkurl(ctx.opac_root _ '/myopac/list/update', {
+           href = opac_wrap(mkurl(ctx.opac_root _ '/myopac/list/update', {
                 action => 'add_rec', list => bag.id, record => ctx.bre_id,
                 anchor => rec_anchor
-           }, stop_parms);
+           }, stop_parms));
            i = i + 1;
            IF i == ctx.bookbags.size;
     %]
@@ -64,17 +74,17 @@
        END
     %]
     <li>
-        <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {
+        <a href="[% opac_wrap(mkurl(ctx.opac_root _ '/myopac/lists', {
             limit => ctx.bookbag_count, add_rec => ctx.bre_id,
             anchor => rec_anchor
-        }) %]">
+        })) %]">
         [% l('See All') %]
         </a>
     </li>
     <li class="new">
-    <a href="[% mkurl(ctx.opac_root _ '/myopac/lists', {
+    <a href="[% opac_wrap(mkurl(ctx.opac_root _ '/myopac/lists', {
         add_rec => ctx.bre_id, anchor => rec_anchor
-    }, stop_parms) %]">
+    }, stop_parms)) %]">
     [% l('Add to new list') %]
     </a>
     </li>

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

Summary of changes:
 .../lib/OpenILS/WWW/EGCatLoader/Account.pm         |   11 ++++--
 .../src/templates/opac/parts/bookbag_actions.tt2   |   30 +++++++++++++------
 2 files changed, 27 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list