<%@ Import Namespace="edu.jhu.Cas.Util" %>
<%@ Register TagPrefix="uc1" TagName="Trailer" Src="Trailer.ascx" %>
<%@ Register TagPrefix="uc2" TagName="Header" Src="top.ascx" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.IO" %>
<%@ Page Language="c#" AutoEventWireup="false" Inherits="edu.jhu.Cas.Web.OutputPage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Output</title>
    <%
	
        string text = Request.Params["lmessage"];
        if (null == text) text = "";       
    %>
    <link href="cjobs.css" rel="stylesheet" />
</head>
<body>
    <uc2:Header ID="Header" runat="server" />
    <p>
        <i>Refresh this page to get latest info</i></p>
    <p>
        <p>
            <i>Output files have a lifetime of one week, after which they are deleted.</i></p>
        Below is a list of all outputs you are currently able to download.
        <br />
        Don't see any output? Try extracting a table from your <a href="MyDB.aspx">MyDB</a>.</p>
    <form id="Output" method="post" runat="server">
        <p>
            <b>Pending Output:</b><br>
            <% if (pendingDs.Tables[0].Rows.Count > 0) {%>
            <asp:DataGrid ID="pendingGrid" runat="server" DataSource="<% #pendingDs%>" BorderStyle="None"
                CellPadding="4" AutoGenerateColumns="false" EnableViewState="false" AllowSorting="True">
                <HeaderStyle Font-Bold="True"></HeaderStyle>
                <Columns>
                    <asp:BoundColumn DataField="taskName" HeaderText="Table Name" />
                    <asp:BoundColumn DataField="outputtype" HeaderText="Type" />
                    <asp:BoundColumn DataField="TimeSubmit" HeaderText="Submitted" />
                </Columns>
            </asp:DataGrid>
            <%} else {%>
            <i>You have no output jobs in progress.</i>
            <%}%>
        </p>
        <div>
            <b>Available Output:</b><br>
            <% if (ds.Tables[0].Rows.Count > 0) {%>
            <asp:DataGrid ID="grid" runat="server" DataSource="<% #ds%>" BorderStyle="None" CellPadding="4"
                AutoGenerateColumns="false" EnableViewState="false" AllowSorting="True">
                <HeaderStyle Font-Bold="True"></HeaderStyle>
                <Columns>
                    <asp:BoundColumn DataField="taskName" HeaderText="Table Name" />
                    <asp:BoundColumn DataField="outputtype" HeaderText="Type" />
                    <asp:BoundColumn DataField="timeend" HeaderText="Completed" />
                    <asp:HyperLinkColumn HeaderText="" DataNavigateUrlField="outputloc" Text="Download"
                        DataNavigateUrlFormatString="{0}" Target="" />
                </Columns>
            </asp:DataGrid>
            <%} else {%>
            <i>You have no output available for download.</i>
            <%}%>
        </div>
        <br />
        <div>
            <b>Failed Output:</b><br>
            <% if (failedDs.Tables[0].Rows.Count > 0) {%>
            <asp:DataGrid ID="failedGrid" runat="server" DataSource="<% #failedDs%>" BorderStyle="None"
                CellPadding="4" AutoGenerateColumns="false" EnableViewState="false" AllowSorting="True">
                <HeaderStyle Font-Bold="True"></HeaderStyle>
                <Columns>
                    <asp:BoundColumn DataField="taskName" HeaderText="Table Name" />
                    <asp:BoundColumn DataField="outputtype" HeaderText="Type" />
                    <asp:BoundColumn DataField="TimeSubmit" HeaderText="Submitted" />
                    <asp:BoundColumn DataField="Message" HeaderText="Error" />
                </Columns>
            </asp:DataGrid>
            <%} else {%>
            <i>You have no failed output jobs.</i>
            <%}%>
        </div>
    </form>
    <uc1:Trailer ID="Trailer1" runat="server" cvsTag="$Name$" cvsRev="$Revision: 111295 $">
    </uc1:Trailer>
</body>
</html>