From dc62af255494d7e50c7666e7e0f10a56c34fddde Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Sun, 27 Jan 2008 13:17:33 -0600 Subject: [PATCH] Fixes for cart functionality, including additions to update cart toolip window Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 4 +++- .../prog/en/includes/doc-head-close.inc | 18 +++++++++++---- .../opac-tmpl/prog/en/includes/masthead.inc | 23 +++++++++++-------- koha-tmpl/opac-tmpl/prog/en/js/basket.js | 10 ++++++-- koha-tmpl/opac-tmpl/prog/en/js/script.js | 11 ++++----- .../prog/en/modules/opac-sendbasketform.tmpl | 2 +- 6 files changed, 42 insertions(+), 26 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index b5444323bb..0ce0b5ae6a 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -1210,7 +1210,9 @@ div#changelanguage a.yuimenuitemlabel { #cartDetails { background-color : #FFF; border: 1px solid black; - padding : .5em; + color : black; + padding : .1em; + text-align : center; } body #listsmenulink.yui-button { diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc index e21907d5bc..21f4c5b4da 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc @@ -27,13 +27,21 @@ --> @@ -87,24 +85,29 @@ $(document).ready(function() { }); function init() { + var cartOverlay = new YAHOO.widget.Overlay("cartDetails", { context:["cartmenulink","tr","br"], - visible:false, - width:"200px" } ); - // cartOverlay.setHeader("Overlay #3 from Script"); - cartOverlay.setBody("Your cart contains 3 items."); - // cartOverlay.setFooter("End of Overlay #3"); - cartOverlay.render(document.body); + visible:false, + width:"200px" } ); + cartOverlay.render(); + + // var cartOverlay = new YAHOO.widget.Overlay("cartDetails", { context:["cartmenulink","tr","br"], + // visible:false, + // width:"200px" } ); + // cartOverlay.setBody("Your cart has "+basketcount+" items in it"); + // cartOverlay.render(document.body); YAHOO.util.Event.addListener("cartmenulink", "mouseover", cartOverlay.show, cartOverlay, true); YAHOO.util.Event.addListener("cartmenulink", "mouseout", cartOverlay.hide, cartOverlay, true); + YAHOO.util.Event.addListener("cartmenulink", "click", cartOverlay.hide, cartOverlay, true); } YAHOO.util.Event.addListener(window, "load", init); -Cart +Cart Lists - +
diff --git a/koha-tmpl/opac-tmpl/prog/en/js/basket.js b/koha-tmpl/opac-tmpl/prog/en/js/basket.js index 9aa460e633..1a39aa6bd5 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/basket.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/basket.js @@ -11,7 +11,7 @@ var valCookie = readCookie(nameCookie); if(valCookie){ var arrayRecords = valCookie.split("/"); if(arrayRecords.length > 0){ - var basketcount = " ("+(arrayRecords.length-1)+")"; + var basketcount = arrayRecords.length-1; } else { var basketcount = ""; } @@ -357,7 +357,12 @@ function showLess() { function updateBasket(updated_value,target) { if(typeof document.getElementById != "undefined") { - target.getElementById('basket').innerHTML = " ("+updated_value+")"; + if(target.getElementById('basket')){ + target.getElementById('basket').innerHTML = " ("+updated_value+")"; + } + if(target.getElementById('cartDetails')){ + target.getElementById('cartDetails').innerHTML = _("Your cart contains ")+updated_value+_(" items"); + } } else if (typeof document.layers != "undefined") { target.layers['basket'].open(); target.layers['basket'].write(" ("+updated_value+")"); @@ -366,6 +371,7 @@ function updateBasket(updated_value,target) { document.getElementById == "undefined") { target.all['basket'].innerHTML = " ("+updated_value+")"; } + var basketcount = updated_value; } function openBiblio(dest,biblionumber) { diff --git a/koha-tmpl/opac-tmpl/prog/en/js/script.js b/koha-tmpl/opac-tmpl/prog/en/js/script.js index 006c826429..4330224b41 100644 --- a/koha-tmpl/opac-tmpl/prog/en/js/script.js +++ b/koha-tmpl/opac-tmpl/prog/en/js/script.js @@ -35,24 +35,23 @@ function confirmDelete(message) { function Dopop(link) { newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes'); } + +$(document).ready(function(){ + if(basketcount){ updateBasket(basketcount,document) } +}); YAHOO.util.Event.onContentReady("changelanguage", function () { var oMenu = new YAHOO.widget.Menu("sublangs", { zindex: 2 }); - function positionoMenu() { oMenu.align("bl", "tl"); } - oMenu.subscribe("beforeShow", function () { if (this.getRoot() == this) { positionoMenu(); } }); - oMenu.render(); - oMenu.cfg.setProperty("context", ["showlang", "bl", "tl"]); - function onYahooClick(p_oEvent) { // Position and display the menu positionoMenu(); @@ -60,8 +59,6 @@ YAHOO.util.Event.onContentReady("changelanguage", function () { // Stop propagation and prevent the default "click" behavior YAHOO.util.Event.stopEvent(p_oEvent); } - YAHOO.util.Event.addListener("showlang", "click", onYahooClick); - YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionoMenu); }); \ No newline at end of file diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendbasketform.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendbasketform.tmpl index 009f38f513..8b03e7aff1 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendbasketform.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-sendbasketform.tmpl @@ -1,5 +1,5 @@ Koha Online Catalog › Sending Your Book Bag - + -- 2.39.5