<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FloatingFileUpload.aspx.cs" Inherits="PowerEasy.SiteFactory.WebSite.Admin.Accessories.FloatingFileUpload" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<script type="text/javascript" src="<%= ResolveClientUrl("~/JS/Silverlight.js")%>"></script>

<script type="text/javascript">
    function onSilverlightError(sender, args) {
        document.getElementById("Upload").style.display = "";
        document.getElementById("silverlightControlHost").style.display = "none";
        document.getElementById("errorLocation").innerHTML= "很抱歉，使用Silverlight上传的时候出错，请使用普通方式上传。";
    }
    function CheckSilverLight() {
        if (Silverlight.isInstalled(null)) {
            document.getElementById("Upload").style.display = "none";
        }
    }
</script>
<body class="floatingIframe">
    <form id="form1" runat="server">
    <table cellpadding="0" cellspacing="0" border="0" style="height: 100%; width: 100%" id="Upload">
        <tr>
            <td valign="top">
                <asp:FileUpload ID="FupFile" runat="server" /><asp:Button ID="BtnUpload" runat="server"
                    Text="上传" OnClick="BtnUpload_Click" /><pe:RequiredFieldValidator ID="ValFile" ShowRequiredText="false"
                        runat="server" ErrorMessage="请选择上传路径" ControlToValidate="FupFile"></pe:RequiredFieldValidator><asp:Label
                            ID="LblMessage" runat="server" ForeColor="red" Text=""></asp:Label>
            </td>
        </tr>
    </table>
    <div id='errorLocation' style="font-size: small;color: Gray;"></div>
    <div id="silverlightControlHost">
		<object data="data:application/x-silverlight-2,"  type="application/x-silverlight-2" width="100%" height="100">
			<param name="source" value="<%= ResolveClientUrl("~/ClientBin/FileUpLoad.zip")%>"/>
			<param name="onerror" value="onSilverlightError" />
			<param name="background" value="Transparent" />
			<param name="wmode" value="Transparent" />
			<param name="windowless" value="true" />
			<param name="minRuntimeVersion" value="2.0.31005.0" />
			<param name="autoUpgrade" value="true" />
			<param name="initParams" value="UploadHandlerName=<%= Page.Request.Url.Scheme + "://" + Page.Request.Url.Authority + BasePath + (IsAdminManage?"Admin":"User") %>/Accessories/HttpUploadHandler.ashx,EnableUploadFiles=<%=EnableUploadFiles%>,CustomParam=<%=CustomParam%>,FileFilter=文件(<%=FileExtArr%>)|<%=FileExtArr%>,ReturnJSFunction=<%=ReturnJSFunction%>,CustomReturnJSFunction=<%=CustomReturnJSFunction %>" />
			<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
     			<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="获取 Microsoft Silverlight" style="border-style: none"/><br />
                                你可以点此安装SilverLight以获得更好的上传体验
			</a>
		</object>
		<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
    </div>
    </form>
</body>
</html>
