<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CSEasyWMDefinitionImport.aspx.vb" Inherits="CSEasyWM.CSEasyWMDefinitionImport" %>
<%@ register tagprefix="ex" namespace="Exact.Web.UI.Controls" assembly="Exact.Web.UI.Controls" %>

<html>
<head>
    <title></title>
    <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">
        function ImportFiles() {
            $("#btnDisplay").attr("disabled", "disabled");
            SysSubmit(1);
        }


        $(document).ready(function () {
            $("select[name^='UseConn']").on("change", function () {
                const selectedValue = $(this).val();
                const currentText = $(this).closest("td").prev().text().trim();

                $("select[name^='UseConn']").each(function () {
                    const $this = $(this);
                    const textBefore = $this.closest("td").prev().text().trim();

                    if (textBefore === currentText && $this.val() === "") {
                        $this.val(selectedValue);
                    }
                });
            });
        });

    </script>
</head>
<body>
<ep:form id="Baco" runat="server" enctype="multipart/form-data">

<ex:CardControl runat="server" ID="Card" Action="Show">
    <ex:header id="hdr" caption="WordMerge Definitions" captionid="421004" CaptionSuffix=":Import" CaptionSuffixID="7440" runat="server" showsitemappath="false">
        <ex:headerbutton id="hbFavorite" buttonstyle="Favorite" />
    </ex:header>

    <ex:buttonbar runat="server" id="Buttons">
        <ex:button runat="server" id="btnDisplay" buttonstyle="Custom" Caption="Display" CaptionID="8549" onClick="ImportFiles();" />
        <ex:button runat="server" id="btnImport" buttonstyle="Custom" Caption="Import" CaptionID="7440" onClick="SysSubmit(1);" />
        <ex:button runat="server" id="btnClose" buttonstyle="Close" />
    </ex:buttonbar>

    <ex:bcerrormessages runat="server" id="errmsg" Mode="Notification" />

    <ex:cardrow runat="server" id="crImport">
        <ex:cardcolumn runat="server" id="ccImport">
		    <ex:cardsection runat="server" id="csImport" caption="Import" captionid="7440">
				<ex:cardfield runat="server" id="cfFile" caption="WordMerge Definitions file" captionid="421176">
                    <input runat="server" id="FileAttachment" type="file" size="500" />
				</ex:cardfield>
                <ex:cardfield runat="server" id="cfDocumentType" caption="Document type" captionid="15829">
					<ex:combobox id="DocumentType" runat="server" ListValues="select ft.TypeID, ft.Description from BacoDiscussionFixedTypes ft inner join CSEasyWMDocumentType t on t.LinkID = ft.TypeID and t.ContainsTemplates = 1 where ft.Active = 1 order by ft.Description" AllowEmpty="False" />
				</ex:cardfield>
                <ex:cardfield runat="server" id="cfWarning1" caption="" captionid="0">
					<ex:inputfield id="Warning1" runat="server" ReadOnly="True" />
				</ex:cardfield>
            </ex:cardsection>

            <ex:cardlistview runat="server" id="clvConfirm" caption="Confirm" captionid="6593" captionsuffix=":Import" captionsuffixid="7440" showheader="False" customizecolumns="False" customizerows="False">
                <ex:listview runat="server" id="lvConfirm" ongetdata="lvConfirm_OnGetData" showbutton="False" visible="True" caption="Confirm" captionid="6593" captionsuffix=":Import" captionsuffixid="7440" ShowPageSize="false" ScrollBar="None">
                    <Columns>
                        <ex:listviewcheckboxcolumn runat="server" id="cCheck" type="selectall" selectallprefix="chk" align="Center" width="5%" />
                        <ex:listviewcolumn id="colTitle" caption="Title" captionid="10189" sorting="none"/>
                        <ex:listviewcolumn id="colList" caption="List" captionid="421080" sorting="none"/>
                        <ex:listviewcolumn id="colConnectionUsed" caption="Connection" captionid="27055" captionsuffix=":In use" captionsuffixid="6385" width="10%" sorting="none"/>
                        <ex:listviewcolumn id="colConnectionImport" caption="Connection" captionid="27055" captionsuffix=":Import" captionsuffixid="7440" width="10%" sorting="none"/>
                        <ex:listviewcolumn id="colExists" caption="Existing" captionid="22" sorting="none" width="5%"/>
                        <ex:listviewcolumn id="colExportDate" caption="Export date" captionid="40767" sorting="none" width="10%" />
                    </Columns>
                </ex:listview>
            </ex:cardlistview>
        </ex:cardcolumn>
    </ex:cardrow>
</ex:CardControl>
</ep:form>
</body>
</html>
