Fix for Bug 6970 - logout not redirecting to login page

For some reason the latest version of Firefox doesn't like
the javascript which empties the cart on logout. As Ian points
out, there is code which tries to redirect to "about:blank"
and close the window (since the main context of the function
is the Cart's popup window.

This patch adds a parameter to the delBasket function so
that we can pass a "popup" context to the function and
choose whether or not we want to ask JS to close the window.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit d139d400b1)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
Owen Leonard 2011-10-05 09:53:02 -04:00 committed by Chris Nighswonger
parent 0d3e10b2fb
commit 92913143c8
3 changed files with 12 additions and 7 deletions

View File

@ -65,7 +65,7 @@
[% loggedinusername %]
</span>
[% IF ( intranetbookbag ) %]
(<a href="/cgi-bin/koha/mainpage.pl?logout.x=1" onclick="clearHoldFor(); delBasket(true);">Log Out</a>) |
(<a href="/cgi-bin/koha/mainpage.pl?logout.x=1" onclick="clearHoldFor(); delBasket('main', true);">Log Out</a>) |
[% ELSE %]
(<a href="/cgi-bin/koha/mainpage.pl?logout.x=1" onclick="clearHoldFor();">Log Out</a>) |
[% END %]

View File

@ -299,15 +299,20 @@ function delRecord (n, s) {
}
function delBasket(rep) {
function delBasket(context,rep) {
if (rep == undefined){
rep = confirm(MSG_CONFIRM_DEL_BASKET);
}
if (rep) {
delCookie(nameCookie);
document.location = "about:blank";
updateBasket(0,top.opener);
window.close();
if(context == "popup"){
delCookie(nameCookie);
document.location = "about:blank";
updateBasket(0,top.opener);
window.close();
} else {
delCookie(nameCookie);
updateBasket(0,top.opener);
}
}
}

View File

@ -103,7 +103,7 @@ function placeHold () {
</li>
<li>
<span id="delete" class="yui-button yui-link-button"><span class="first-child">
<a class="empty" href="basket.pl" onclick="delBasket(); return false;">Empty and Close</a>
<a class="empty" href="basket.pl" onclick="delBasket('popup'); return false;">Empty and Close</a>
</span></span>
</li>
<li>