<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ProcessListAccess.aspx.vb" Inherits="WebFoundations.WFWorkflow.UI.ProcessListAccess" %>

<%@ Register Src="~/WFControls/AccessList.ascx" TagName="AccessList" TagPrefix="wf" %>
<%@ Register Src="~/WFAdmin/TagHeadAdmin.ascx" TagPrefix="wf" TagName="TagHeadAdmin" %>


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <wf:TagHeadAdmin runat="server" id="TagHeadAdmin" />
</head>
<body class="access">
    <form id="form1" runat="server">
        <asp:ScriptManager runat="server" />
        <div>
            <wf:accesslist id="listaacesso" enableuser="true" enablerole="true" enablerolegroup="true" runat="server" />
        </div>
    </form>
    <script type="text/javascript">
        try {
            if (window.parent && window.parent.Zuri && window.parent.Zuri.updateAccess) {

                if (Sys && Sys.WebForms && Sys.WebForms.PageRequestManager) {
                    var rm = Sys.WebForms.PageRequestManager.getInstance();

                    if (rm) {
                        rm.add_endRequest(function () {
                            try {
                                var items = [];
                                $(".wfbal-aclitems .wfbal-acl").each(function () {

                                    var o = $("input[type=hidden]", this);
                                    if (o && o.length) {
                                        var t = 'g';
                                        var id = 0;
                                        var v = o.val();
                                        if (v[0] == "u") {
                                            t = "u"
                                        } else if (v[0] == "p") {
                                            t = "p"
                                        }
                                        id = v.replace(/[^-0-9]/g, "");

                                        var item = $(".wfacl-item", this);
                                        var name="--"
                                        if (item && item.length) {
                                            name = item.text().replace(/\s*((<[^>]*>)|(\[[^\]]*\]))\s*/g, "");
                                        }

                                        items.push({ id: id, identityType: t, name: name });
                                    }
                                });

                                window.parent.Zuri.updateAccess("<%=Request("kind")%>", items);
                            } catch (e2) { }
                        });
                    }
                }
            }
        } catch (error) { }
    </script>
</body>
</html>
