From 532ce9579837bb74512f25a21206165804c1c2a3 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Sat, 27 Oct 2007 14:14:53 -0500 Subject: [PATCH] Fixing delete shelf button javascript problem. Now works well with and without javascript: No-js users will not get a warning, but they will get a form button rather than a link. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- .../en/includes/virtualshelves-toolbar.inc | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc index 6594084e22..0750fb2da4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc @@ -5,7 +5,7 @@ // prepare DOM for YUI Toolbar $(document).ready(function() { - $("#deleteshelfc").empty(); + // $("#deleteshelfc").empty(); yuiToolbar(); }); @@ -14,14 +14,15 @@ function yuiToolbar() { newshelfButton = new YAHOO.widget.Button("newshelf"); editshelfButton = new YAHOO.widget.Button("editshelf"); - deleteshelfButton = new YAHOO.widget.Button({ - id: "deleteshelf", - type: "button", - label: "Delete Shelf", - container: "deleteshelfc", - onclick: {fn:function(){confirmDelete("Are you sure you want to delete this shelf?")}} - }); + deleteshelfButton = new YAHOO.widget.Button("deleteshelf", { value: "deleteshelfvalue" }); + YAHOO.util.Event.on("deleteshelf_f", "submit", confirmDelete); } + function confirmDelete(p_oEvent) { + var bSubmit = window.confirm("Are you sure you want to delete this shelf?"); + if(!bSubmit) { + YAHOO.util.Event.preventDefault(p_oEvent); + } + } //]]> @@ -29,5 +30,11 @@ -- 2.39.5