<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CSEasyWMDefinitionAction.aspx.vb" Inherits="CSEasyWM.CSEasyWMDefinitionAction" %>
<%@ register tagprefix="ex" namespace="Exact.Web.UI.Controls" assembly="Exact.Web.UI.Controls" %>
<html>
<head>
	<meta name="save" content="history" />
	<link rel="stylesheet" type="text/css" href="Exact.css" />
    <script language="javascript" type="text/javascript" src="jquery.js"></script>
    <script language="javascript" type="text/javascript" src="CSEasyWMDefinitionPopup.js"></script>
    <script language="javascript" type="text/javascript">
    $(document).ready(function () {
        $('select[name^="cbPAP"]').change(function () {
            var name = $(this).attr('name').substr(5);
            var selector;
            if ($(this).val() == '1') // constant value
            {
                selector = '#fvPAP' + name; $(selector).show();
                selector = '#fvIMG' + name; $(selector).show();
                selector = '#fvPAP' + name + 'Time'; $(selector).show();
                selector = '#pfvPAP' + name; $(selector).show();
                selector = '#fcPAP' + name; $(selector).hide();
                selector = '#enPAP' + name; $(selector).hide();
            }
            else if ($(this).val() == '2') // FieldCode
            {
                selector = '#fvPAP' + name; $(selector).hide();
                selector = '#fvIMG' + name; $(selector).hide();
                selector = '#fvPAP' + name + 'Time'; $(selector).hide();
                selector = '#pfvPAP' + name; $(selector).hide();
                selector = '#fcPAP' + name; $(selector).show();
                selector = '#enPAP' + name; $(selector).hide();
            }
            else if ($(this).val() == '3') // environment
            {
                selector = '#fvPAP' + name; $(selector).hide();
                selector = '#fvIMG' + name; $(selector).hide();
                selector = '#fvPAP' + name + 'Time'; $(selector).hide();
                selector = '#pfvPAP' + name; $(selector).hide();
                selector = '#fcPAP' + name; $(selector).hide();
                selector = '#enPAP' + name; $(selector).show();
            }
            else {
                selector = '#fvPAP' + name; $(selector).hide();
                selector = '#fvIMG' + name; $(selector).hide();
                selector = '#fvPAP' + name + 'Time'; $(selector).hide();
                selector = '#pfvPAP' + name; $(selector).hide();
                selector = '#fcPAP' + name; $(selector).hide();
                selector = '#enPAP' + name; $(selector).hide();
            }
        });

        $('select[name^="cbPAP"]').each(function () {
            var name = $(this).attr('name').substr(5);
            var selector;
            selector = '#cbPAP' + name; $(selector).trigger('change');
            selector = '#fvPAP' + name; $(selector).trigger('change');
            selector = '#fcPAP' + name; $(selector).trigger('change');
        });

        $('img[src="images/insert.png"').css('cursor', 'pointer');
    });

    var textElementName;
    function ShowInsert(elementName) {
        textElementName = elementName;
        
        SysShowModalPopup('CSEasyWMDefinitionInsertTag.aspx?DefinitionID=' + SysGet('DefinitionID'), "", "640px", "480px", function () { ModalWindowClosed(); }, null);
    }

    function ModalWindowClosed() {
        var res = SysDialog.returnValue;
        if (res == null || res.length == 0) return;

        var selector = '#' + textElementName;
        $(selector).val($(selector).val() + res[0]);
    }
    </script>
</head>
<body>

<ep:form id="frm" runat="server">

<ex:InputField runat="server" Hidden="True" ID="DoClose" ValidationAs="Int" ValidationDefault="0" CreateClientControl="True" />
<ex:InputField runat="server" Hidden="True" ID="DefinitionID" ValidationAs="Guid" DataSource="bc" DataField="DefID" CreateClientControl="True" />

<ex:CardControl runat="server" ID="Card" Action="Show">
    <ex:Header runat="server" ID="hdr">
    </ex:Header>

    <ex:headerproperties runat="server" id="hdrProps" headerpropertiesstyle="CreatedModified" datasource="bc" datafieldcreated="Created" datafieldcreator="Creator" datafieldcreatorname="CreatorFullName" datafieldmodified="Modified" datafieldmodifier="Modifier" datafieldmodifiername="ModifierFullName" />

    <ex:ButtonBar runat="server" ID="Buttons">
        <ex:Button runat="server" ID="btnSave" ButtonStyle="Save" DataSource="bc" />
        <ex:Button runat="server" ID="btnDelete" ButtonStyle="Delete" DataSource="bc" />
        <ex:Button runat="server" ID="btnClose" ButtonStyle="Close" />
    </ex:ButtonBar>

    <ex:BCDataSource runat="server" ID="bc" Component="CSEasyWMDefActions" AddNewProps="DefID" />

    <ex:cardrow runat="server" id="cr">
	    <ex:cardcolumn runat="server" id="cc">
		    <ex:cardsection runat="server" id="csGeneral" caption="Action" captionid="10221">
                <ex:cardfield runat="server" id="cfDefinition" caption="WordMerge Definition" captionid="421008" ReadOnly="True">
				    <ex:inputfield runat="server" id="DefIDTitle" datasource="bc" ReadOnly="True" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfTitle" caption="Title" captionid="10189">
				    <ex:inputfield runat="server" id="ActionTitle" datasource="bc" DataField="Title" StartFocus="True" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfDescription" caption="Description" captionid="4243">
                    <ex:memofield id="Description" runat="server" datasource="bc" width="100%" height="3" htmlencoded="true" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfActionOrder" caption="Order" captionid="3558">
                    <ex:combobox runat="server" id="ActionOrder" datasource="bc" ShowKey="True" />
			    </ex:cardfield>
            </ex:cardsection>
            <ex:cardsection runat="server" id="csNET" caption=".NET" captionid="0">
                <ex:cardfield runat="server" id="cfAssembly" caption=".NET assembly" captionid="0">
                    <ex:combobox runat="server" id="Assembly" datasource="bc" AllowEmpty="True" AutoPostback="True" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfClassName" caption=".NET class" captionid="0">
                    <ex:combobox runat="server" id="ClassName" datasource="bc" AllowEmpty="True" AutoPostback="True" />
                    <ex:inputfield runat="server" id="ClassNameDescription" ReadOnly="True" />
			    </ex:cardfield>
                <ex:cardfield runat="server" id="cfMoment" caption="Action moment" captionid="421115">
				    <ex:combobox runat="server" id="Moment" datasource="bc" />
			    </ex:cardfield>
		    </ex:cardsection>
            <ex:cardsection runat="server" id="csParams" caption="Parameters" captionid="26031">
            </ex:cardsection>
	    </ex:cardcolumn>
    </ex:cardrow>
</ex:CardControl>

</ep:form>
</body>
</html>
