<%@ Page Language="vb" Title="Zuri - Variáveis de Contexto de Processo(s)" MasterPageFile="~/wfadmin/ModalAdminPage.master" AutoEventWireup="false" CodeBehind="VariaveisContexto.aspx.vb" Inherits="WebFoundations.WFWorkflow.UI.VariaveisContexto" %>
<%@ Register TagPrefix="wff" Namespace="WebFoundations.WFWorkflow.Services.UI" Assembly="WebFoundations.WFWorkflow.Services" %>
<asp:Content runat="server" ContentPlaceHolderID="TagHead">
    <style type="text/css">
        .selectedVariable {
            width: 100%;
            height: 60px;
            margin: 5px 0;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {

            //function SelectedChangedHandler(sender, eventArgs) {
            //    var item = eventArgs.get_item();
            //    $(".selectedVariable").val(item.get_text());
            //    sender.set_text("You selected " + item.get_text());
            //}


            var selectText = (window.opener && window.opener.setContextVariable) ? "Selecionar e Fechar" : "Fechar";

            $("button.select").click(function () {
                try {
                    if (window.opener && window.opener.setContextVariable) {
                        var v = $(".selectedVariable").val();
                        if (v) {
                            window.opener.setContextVariable(v);
                        } else {
                            alert("Selecione uma variável");
                            return;
                        }
                    }
                    window.close();
                } catch (erro) { }
            }).html(selectText);
        })
    </script>
</asp:Content>

<asp:Content runat="server" ContentPlaceHolderID="MainContent">
    <h1>Variáveis de Contexto</h1>
    <div class="fields no-columns">
        <asp:PlaceHolder ID="phSelProcess" runat="server">
        <label>
            <span>Processo:</span>
            <asp:DropDownList ID="ddlProcess" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlProcess_SelectedIndexChanged" /></label></asp:PlaceHolder>
        <label>
            <span>Variáveis:</span>
            <wff:ZuriValuePicker id="ddlVariable" width="100%" ShowZuriProperties="true" ShowPortalProperties="false" ShowActivities="false"
                PagerSize="10" runat="server" autopostback="true"  />
        </label>
        <textarea id="selValue" runat="server" class="selectedVariable" readonly="readonly"></textarea>
    </div>
    <section class="actions">
        <button class="select">Selecionar</button>
    </section>
</asp:Content>
