Attempt to ensure that we always write to oils://remote when needed.
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
# when they're already logged in.
return $self->generic_redirect(
sprintf(
- "https://%s%s/myopac/main",
- $self->apache->hostname, $self->ctx->{opac_root}
+ "%s://%s%s/myopac/main",
+ $self->ctx->{proto},
+ $self->ctx->{hostname}, $self->ctx->{opac_root}
)
);
}
# -----------------------------------------------------------------------------
sub redirect_ssl {
my $self = shift;
- my $new_page = sprintf('https://%s%s', $self->apache->hostname, $self->apache->unparsed_uri);
+ my $new_page = sprintf('%s://%s%s', ($self->ctx->{is_staff} ? 'oils' : 'https'), $self->ctx->{hostname}, $self->apache->unparsed_uri);
return $self->generic_redirect($new_page);
}
# -----------------------------------------------------------------------------
sub redirect_auth {
my $self = shift;
- my $login_page = sprintf('https://%s%s/login', $self->apache->hostname, $self->ctx->{opac_root});
+ my $login_page = sprintf('%s://%s%s/login',($self->ctx->{is_staff} ? 'oils' : 'https'), $self->ctx->{hostname}, $self->ctx->{opac_root});
my $redirect_to = uri_escape($self->apache->unparsed_uri);
return $self->generic_redirect("$login_page?redirect_to=$redirect_to");
}
my $oils_wrapper = $self->apache->headers_in->get('OILS-Wrapper') || '';
$ctx->{is_staff} = ($oils_wrapper =~ /true/);
$ctx->{proto} = 'oils' if $ctx->{is_staff};
+ $ctx->{hostname} = 'remote' if $ctx->{is_staff};
$ctx->{physical_loc} = $self->get_physical_loc;
# capture some commonly accessed pages
- $ctx->{home_page} = 'http://' . $self->apache->hostname . $self->ctx->{opac_root} . "/home";
- $ctx->{logout_page} = 'https://' . $self->apache->hostname . $self->ctx->{opac_root} . "/logout";
+ $ctx->{home_page} = $ctx->{proto} . '://' . $ctx->{hostname} . $self->ctx->{opac_root} . "/home";
+ $ctx->{logout_page} = ($ctx->{proto} eq 'http' ? 'https' : $ctx->{proto} ) . '://' . $ctx->{hostname} . $self->ctx->{opac_root} . "/logout";
if($e->authtoken($self->cgi->cookie(COOKIE_SES))) {
'open-ils.circ.hold.update.batch.atomic',
$e->authtoken, undef, \@vals
)->gather(1); # LFW XXX test for failure
- $url = 'https://' . $self->apache->hostname . $self->ctx->{opac_root} . '/myopac/holds';
+ $url = $self->ctx->{proto} . '://' . $self->ctx->{hostname} . $self->ctx->{opac_root} . '/myopac/holds';
foreach my $param (('loc', 'qtype', 'query')) {
if ($self->cgi->param($param)) {
$url .= ";$param=" . uri_escape($self->cgi->param($param));
# This url intentionally leaves off the edit_notes parameter, but
# may need to add some back in for paging.
- my $url = "https://" . $self->apache->hostname .
+ my $url = $self->ctx->{proto} . "://" . $self->ctx->{hostname} .
$self->ctx->{opac_root} . "/myopac/lists?";
foreach my $param (('loc', 'qtype', 'query', 'sort')) {
my $base_url = sprintf(
"%s://%s%s/temp_warn",
- $self->cgi->https ? 'https' : 'http',
- $self->apache->hostname,
+ $self->ctx->{proto},
+ $self->ctx->{hostname},
$self->ctx->{opac_root}
);
my $base_url = sprintf(
'%s://%s%s/record/%s',
- ($ctx->{is_staff} ? 'oils' : $ctx->{proto}),
- ($ctx->{is_staff} ? 'remote' : $self->apache->hostname),
+ $self->ctx->{proto},
+ $self->ctx->{hostname},
$self->ctx->{opac_root},
$$rec_ids[0],
);
if (my $cnfrag = $self->cgi->param("query")) {
my $url = sprintf(
- 'http%s://%s%s/cnbrowse?cn=%s',
- $self->cgi->https ? "s" : "",
- $self->apache->hostname,
+ '%s://%s%s/cnbrowse?cn=%s',
+ $self->ctx->{proto},
+ $self->ctx->{hostname},
$self->ctx->{opac_root},
$cnfrag # XXX some kind of escaping needed here?
);
$ctx->{kpac_layout} = $layout;
$ctx->{kpac_config} = $kpac_config;
$ctx->{kpac_root} = $ctx->{base_path} . "/kpac";
- $ctx->{home_page} = 'http://' . $self->apache->hostname . $ctx->{kpac_root} . "/home";
+ $ctx->{home_page} = $ctx->{proto} . '://' . $ctx->{hostname} . $ctx->{kpac_root} . "/home";
$ctx->{global_search_filter} = $kpac_config->{global_filter};
}