Fixing delete shelf button javascript problem. Now works well with and without javasc...
authorOwen Leonard <oleonard@myacpl.org>
Sat, 27 Oct 2007 19:14:53 +0000 (14:14 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Mon, 29 Oct 2007 20:51:37 +0000 (15:51 -0500)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc

index 6594084..0750fb2 100644 (file)
@@ -5,7 +5,7 @@
        // prepare DOM for YUI Toolbar
 
         $(document).ready(function() {
-               $("#deleteshelfc").empty();
+               // $("#deleteshelfc").empty();
            yuiToolbar();
         });
 
        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);
+            }
+        }
 
        //]]>
        </script>
 <ul class="toolbar">
 
        <li><a id="newshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelves=1">New Shelf</a></li>
-       <!-- TMPL_IF NAME="viewshelf" --><!-- TMPL_IF name="manageshelf" --><li><a id="editshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?op=modif&amp;shelf=<!-- TMPL_VAR NAME="shelfnumber" -->">Edit Shelf</a></li><li id="deleteshelfc"><a id="deleteshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelves=1&amp;DEL-<!-- TMPL_VAR NAME="shelfnumber" -->=1">Delete Shelf</a></li><!-- /TMPL_IF --><!-- /TMPL_IF -->
+       <!-- TMPL_IF NAME="viewshelf" --><!-- TMPL_IF name="manageshelf" --><li><a id="editshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?op=modif&amp;shelf=<!-- TMPL_VAR NAME="shelfnumber" -->">Edit Shelf</a></li><li id="deleteshelfc"><form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post" id="deleteshelf_f">
+<input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->" />
+<input type="hidden" name="shelves" value="1" />
+<input type="submit" id="deleteshelf" value="Delete Shelf" onclick="return confirmDelete('Are you sure you want to delete this shelf?')" /></form>
+</li>
+
+<!-- /TMPL_IF --><!-- /TMPL_IF -->
 </ul></div>