<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SelectFile.aspx.cs" Inherits="Mail_SelectFile" meta:resourcekey="Page" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../libs/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../libs/fontawesome/css/all.min.css" >
    <script type="text/javascript" src="../libs/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="../libs/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
    <script type="text/javascript">
        $(document).ready(function () {        
        });

        function ApplyUpload() {
            var wnd = window.opener;
            window.setTimeout(function () {
                if (wnd.OnCompletedUpload != null) wnd.OnCompletedUpload();
                self.close();
            }, 100);
        }

        function Close() {
            window.close();
        }
    </script>

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>

        <div class="container-fluid">
            <div class="row" id="toolBar" data-spy="affix">
                <div class="col-xs-12" style="padding-top:2px;padding-bottom:2px;">
                    <button type="button" id="selectToolButton" runat="server" class="btn btn-primary" onclick="ApplyUpload()"
                        disabled="disabled"><span class="fa-solid fa-floppy-disk"></span> <asp:Localize ID="Localize1" runat="server" meta:resourcekey="L01">파일 추가</asp:Localize></button>              
                    <span>&nbsp;</span>
                    <button type="button" id="Button2" class="btn btn-primary" onclick="Close();"><span class="fa-solid fa-xmark"></span></button>
                </div>
            </div>
        </div>

        <div class="container-fluid" style="padding-top:40px">
            <div class="form-group">
                <label for="FileUpload1"><asp:Localize ID="Localize2" runat="server" meta:resourcekey="L02">파일 1</asp:Localize>:</label>
                <asp:FileUpload ID="FileUpload1" runat="server" CssClass="form-control" />
            </div>
            <div class="form-group">
                <label for="FileUpload1"><asp:Localize ID="Localize3" runat="server" meta:resourcekey="L03">파일 2</asp:Localize>:</label>
                <asp:FileUpload ID="FileUpload2" runat="server" CssClass="form-control" />
            </div>
            <asp:Button ID="UploadButton" runat="server" CssClass="btn btn-primary btn-block" Text="업로드" OnClick="UploadButton_Click" meta:resourcekey="UploadButton" />
            <div>&nbsp;</div>
            
            <asp:Panel ID="ErrorPanel" runat="server" CssClass="alert alert-danger" Visible="false">
                <strong><asp:Localize ID="Localize4" runat="server" meta:resourcekey="L04">오류</asp:Localize></strong> <asp:Label ID="ErrorLabel" runat="server" Text=""></asp:Label>
            </asp:Panel>
            
            <asp:Panel ID="UploadResultPanel" runat="server" Visible="false">
                 <asp:GridView ID="ResultGridView" runat="server" CssClass="table table-hover" GridLines="None"
                    AutoGenerateColumns="False" OnPreRender="ResultGridView_PreRender">
                    <EmptyDataTemplate>
                        <div class="NoRecords"><asp:Localize ID="Localize5" runat="server" meta:resourcekey="L05">업로드된 파일이 없습니다.</asp:Localize></div>
                    </EmptyDataTemplate>
                    <Columns>                        
                        <asp:BoundField HeaderText="파일 이름" DataField="FileName" meta:resourcekey="FileName">
                            <HeaderStyle HorizontalAlign="Left" />
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="파일 크기" meta:resourcekey="FileSize">
                            <HeaderStyle HorizontalAlign="Right" />
                            <ItemStyle HorizontalAlign="Right" />
                            <ItemTemplate>
                               <%# WebUtil.GetFormattedFileSize((long)Eval("FileSize")) %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField HeaderText="악성코드" DataField="VirusName" meta:resourcekey="VirusName">
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:BoundField>
                    </Columns>
                </asp:GridView>
            </asp:Panel>                        
        </div>
    </form>
</body>
</html>
