From ffd07393d18dea23899a342ac46798ad638eddf2 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Thu, 22 Oct 2020 16:32:54 -0400 Subject: [PATCH 1/1] LP#1879790: Give carousels their own context org Before this commit, the context org unit for carousels was the same as the physical_loc environment variable, or the client-passed physcial location, or the search location, whichever was set in that order. This commit provides the ability to specify a carousel_loc environment variable in the apache vhost configuration, as an override to physical_loc. This, in turn, allows hostname-segregated branches of the org hierarchy in a resource sharing group to specify their own carousels even when they want the top of the group to be the default search location. Signed-off-by: Mike Rylander Signed-off-by: Terran McCanna Signed-off-by: Chris Sharp --- Open-ILS/examples/apache_24/eg.conf.in | 5 +++++ Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Open-ILS/examples/apache_24/eg.conf.in b/Open-ILS/examples/apache_24/eg.conf.in index b872a3e1a0..0733794e34 100644 --- a/Open-ILS/examples/apache_24/eg.conf.in +++ b/Open-ILS/examples/apache_24/eg.conf.in @@ -113,6 +113,11 @@ ExpiresByType text/css "access plus 1 year" SSLHonorCipherOrder On SSLCipherSuite ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM + # Uncomment and set this variable to the id of the context org unit + # you want to provide visible carousels for this vhost. + # + # SetEnv carousel_loc 1 + # If you don't have an SSL cert, you can create self-signed # certificate and key with: # openssl req -new -x509 -nodes -out server.crt -keyout server.key diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 907ae8bec0..663cde60d4 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -349,6 +349,7 @@ sub load_common { $ctx->{hostname} = 'remote'; } + $ctx->{carousel_loc} = $self->get_carousel_loc; $ctx->{physical_loc} = $self->get_physical_loc; # capture some commonly accessed pages @@ -403,7 +404,7 @@ sub load_common { # FIXME - move carousel helpers to a separate file $ctx->{get_visible_carousels} = sub { - my $org_unit = $self->ctx->{physical_loc} || $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id; + my $org_unit = $self->ctx->{carousel_loc} || $self->ctx->{physical_loc} || $self->cgi->param('loc') || $self->ctx->{aou_tree}->()->id; return $U->simplereq( 'open-ils.actor', 'open-ils.actor.carousel.retrieve_by_org', @@ -527,6 +528,11 @@ sub get_physical_loc { return $self->cgi->cookie(COOKIE_PHYSICAL_LOC); } +sub get_carousel_loc { + my $self = shift; + return $self->cgi->param('carousel_loc') || $ENV{carousel_loc}; +} + # ----------------------------------------------------------------------------- # Log in and redirect to the redirect_to URL (or home) # ----------------------------------------------------------------------------- -- 2.43.2