- Added an option to override the session cookie domain.

- fix: Search results not showing synopses
 - fix: Redirects get displayed inside page layouts as '0'
 - fix: Mysterious "0" Appearing When Admin Is Off
 - fix: Deletion of Products
This commit is contained in:
JT Smith 2006-08-08 17:27:41 +00:00
parent 6a88fa5ca2
commit c956ba3969
9 changed files with 36 additions and 7 deletions

View file

@ -5,6 +5,11 @@
- Fixed the test skeleton
- Fixed some bugs regarding Search relevance sorting (Len Kranendonk / www.ilance.nl)
- Added an option to override the session cookie name.
- Added an option to override the session cookie domain.
- fix: Search results not showing synopses
- fix: Redirects get displayed inside page layouts as '0'
- fix: Mysterious "0" Appearing When Admin Is Off
- fix: Deletion of Products
- Fix Asset.pm so that if no className is passed primeval Assets are not
returned.

View file

@ -12,6 +12,12 @@
"cookieName" : "wgSession",
# Explicitly set the domain that the WebGUI session cookie
# should be assigned to. Defaults to the domain that the user
# is browsing the site under.
# "cookieDomain" : ".example.com",
# The location where the WebGUI server will be handling
# requests. This is normally just '/' or the root of the
# server, but on some installations it might be /webgui or

View file

@ -112,7 +112,7 @@ sub contentHandler {
} else {
$output = page($session);
}
$session->http->setCookie($session->config->getCookieName,$session->var->{_var}{sessionId}) unless $session->var->{_var}{sessionId} eq $session->http->getCookies->{$session->config->getCookieName};
$session->http->setCookie($session->config->getCookieName,$session->var->getId, undef, $session->config->get("cookieDomain")) unless $session->var->getId eq $session->http->getCookies->{$session->config->getCookieName};
my $filename = $session->http->getStreamedFile();
if ((defined $filename) && ($session->config->get("enableStreamingUploads") eq "1")) {
my $ct = guess_media_type($filename);

View file

@ -197,7 +197,7 @@ sub checkView {
$self->logView();
# must find a way to do this next line better
my $cookieName = $self->session->config->getCookieName;
$self->session->http->setCookie($cookieName,$self->session->var->{_var}{sessionId}) unless $self->session->var->{_var}{sessionId} eq $self->session->http->getCookies->{$cookieName};
$self->session->http->setCookie($cookieName,$self->session->var->getId, undef, $self->session->config->get("cookieDomain")) unless $self->session->var->getId eq $self->session->http->getCookies->{$cookieName};
return undef;
}
@ -1802,7 +1802,11 @@ Returns "".
sub view {
my $self = shift;
return $self->getToolbar if ($self->session->var->get("adminOn"));
if ($self->session->var->get("adminOn")) {
return $self->getToolbar;
} else {
return "";
}
}
#-------------------------------------------------------------------

View file

@ -111,7 +111,10 @@ sub www_view {
<li><a href="'.$self->getParent->getUrl.'">'.$i18n->get("go to the redirect parent page").'</a></li>
</ul>',$i18n->get("assetName"));
}
$self->session->http->setRedirect($url) unless $url eq $self->get("url");
unless ($url eq $self->get("url")) {
$self->session->http->setRedirect($url);
return "";
}
return $i18n->get('self_referential');
}

View file

@ -158,7 +158,7 @@ sub view {
push(@results, {
url=>$data->{url},
title=>$data->{title},
synposis=>$data->{synopsis},
synopsis=>$data->{synopsis},
});
}
}

View file

@ -673,7 +673,7 @@ sub www_listProducts {
while ($row = $sth->hashRef) {
$output .= '<tr>';
$output .= '<td>';
$output .= $session->icon->delete('op=deleteProduct;productId='.$row->{productId});
$output .= $session->icon->delete('op=deleteProduct;productId='.$row->{productId}, undef, $i18n->get("confirm delete product"));
$output .= $session->icon->edit('op=manageProduct;productId='.$row->{productId});
$output .= '</td>';
$output .= '<td>'.$row->{title}.'</td>';

View file

@ -242,7 +242,7 @@ sub setCacheControl {
#-------------------------------------------------------------------
=head2 setCookie ( name, value [ , timeToLive ] )
=head2 setCookie ( name, value [ , timeToLive, domain ] )
Sends a cookie to the browser.
@ -258,6 +258,10 @@ The value to set.
The time that the cookie should remain in the browser. Defaults to "+10y" (10 years from now).
=head3 domain
Explicitly set the domain for this cookie.
=cut
sub setCookie {
@ -265,6 +269,7 @@ sub setCookie {
my $name = shift;
my $value = shift;
my $ttl = shift;
my $domain = shift;
$ttl = (defined $ttl ? $ttl : '+10y');
if ($self->session->request) {
require Apache2::Cookie;
@ -274,6 +279,7 @@ sub setCookie {
-expires=>$ttl,
-path=>'/'
);
$cookie->domain($domain) if ($domain);
$cookie->bake($self->session->request);
}
}

View file

@ -1,6 +1,11 @@
package WebGUI::i18n::English::ProductManager;
our $I18N = {
'confirm delete product' => {
message => q|Are you certain you wish to delete this product?|,
lastUpdated => 0,
context => q|displayed when deleting a product|
},
'manage products' => {
message => q|Products|,
lastUpdated => 0,