Ok... here's the code I ended up using... slight difference at a
couple of points

function clickLink(link) {
    if (link.getAttribute('onclick') == null) {
        if (link.getAttribute('href')) document.location =
link.getAttribute('href');
    }
    else link.onclick();
}

function setupDialogRevert(ButtonSelector, DialogSelector) {
    var d = $(DialogSelector);

    d.each(function() {
        var parent = d.parent();
        d.data("oldParent", parent);
    });

    d.dialog({
        bgiframe: true,
        resizable: true,
        modal: true,
        autoOpen: false,
        width: 350,
        overlay: {
            backgroundColor: '#000',
            opacity: 0.5
        },
        buttons: {
            DialogOkButton: function(event) {
                $(this).dialog('close');
                var button = $(this).data("button");

                $(this).children().appendTo($(this).data("oldParent")
[0]).hide();

                $(button).data("IsConfirmed", true);

                if (button.tagName == "A")
                    clickLink(button);
                else
                    button.click();
            },
            Cancel: function() {
                $(this).dialog('close');
            }
        }
    });

    $(":button:contains('DialogOkButton')").attr("DialogButtonType",
"Ok").empty().prepend("Ok");

    $(ButtonSelector)
        .data("IsConfirmed", false)
        .data("dialog", d)
        .bind("click", {}, openDialogRevert);
}
function openDialogRevert(event) {
    if (!$(this).data("IsConfirmed")) {

        $(":button[DialogButtonType='Ok']").empty().prepend
(this.innerHTML);

        $(this).data("dialog").data("button", this).dialog('open');

        return false;
    } else {
        $(this).data("IsConfirmed", false);
        return true;
    }
}

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to