<%@ Page Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Rebex.Samples.Default"%>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <%-- RESET THE SAMPLE --%>
    <asp:Panel ID="PnlReset" runat="server" Visible="false" CssClass="reset">
        <a href="Default.aspx">Upload another file</a>
    </asp:Panel>

    <%-- STEP 1 - SPECIFY FILE AND FOLDER --%>
    <asp:Panel ID="UploadFormPanel" runat="server">
        <h2>Upload and extract a ZIP archive</h2>
        <table>
            <tr>
                <th>ZIP archive to upload:</th>
                <td>
                    <asp:FileUpload ID="FileUploadControl" runat="server" Width="305px" />
                    <asp:RequiredFieldValidator ID="FileUploadValidator" runat="server" ControlToValidate="FileUploadControl" Text="The file must be specified." />
                </td>
            </tr>
            <tr title="The folder will be created if it does not exist yet.">
                <th>Target folder name:<br />
                <span style="font-weight:normal">(within the &quot;TEMP&quot; folder)</span></th>
                <td>
                    <asp:TextBox ID="TargetFolder" runat="server" Width="300px"/>
                    <asp:RequiredFieldValidator ID="TargetFolderValidator" runat="server" ControlToValidate="TargetFolder" Text="The folder name must be specified." />
                </td>
            </tr>
            <tr>
                <th></th>
                <td><asp:CheckBox ID="CleanUpBeforeUpload" runat="server" Text="Clean up the folder before upload"/></td>
            </tr>
            <tr>
                <th></th>
                <td class="right"><asp:Button ID="PerformUpload" runat="server" Text="Perform upload" OnClick="PerformUpload_Click" /></td>
            </tr>
        </table>
    </asp:Panel>
    
    <%-- STEP 2 - SHOW UPLOADED FILES --%>
    <asp:Panel ID="UploadedFilesPanel" runat="server" Visible="false">
        <h2>Upload and extraction completed</h2>
        <p>
            <asp:Literal ID="UploadedFiles" runat="server" /> files have been extracted from the uploaded ZIP file <strong><asp:Literal ID="ArchiveFileName" runat="server" /></strong>
        </p>
        <p>
            Current content of the target folder:
        </p>
        <div id="DivFilesList" class="files-list" runat="server">
        </div>
        <p>
            <asp:LinkButton ID="CleanUp" runat="server" Text="Clean up the folder now" OnClick="CleanUp_Click" />
        </p>
    </asp:Panel>
    
    <%-- STEP 3 - CLEAN UP COMPLETED --%>
    <asp:Panel ID="CleanupCompletedPanel" runat="server" Visible="false">
        <h2>Cleanup completed</h2>
        <p>
            The target folder has been cleaned up.
        </p>
    </asp:Panel>

    
    <%-- COMMON ERROR MESSAGE --%>
    <asp:Label ID="ErrorMessage" runat="server" CssClass="error" Visible="false" EnableViewState="false"/>

</asp:Content>
