<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="True" Inherits="Kesion.NET.WebSite.Admin_CloudStorage" Title="Untitled Page" CodeBehind="KS.CloudStorage.aspx.cs" %>

<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Newtonsoft.Json" %>
<%@ Import Namespace="Newtonsoft.Json.Linq" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="Server">
    <asp:Panel ID="listPanel" runat="server" Width="100%">
        <script>   
            function ShowSelect(Name, id, Endpoint, ApiID, apikey, bucketName) {
                parent.openWin(Name, 'System/KS.CloudStorageSelect.aspx?CID=' + id + "&Endpoint=" + Endpoint + "&ApiID=" + ApiID + "&apikey=" + apikey + "&bucketName=" + bucketName, true, 800, 600);
            }
        </script>
        <div class="content-area mt20">
            <div class="myTitle">云存储API管理</div>
            <table width="99%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable">
                <tr>
                    <td width="100"><b>是否启用：</b></td>
                    <td width="600">
                        <asp:RadioButtonList ID="RdbApiAutoCreateUser" RepeatDirection="Horizontal" runat="server">
                            <asp:ListItem Value="1" Selected>启用</asp:ListItem>
                            <asp:ListItem Value="0">不启用</asp:ListItem>
                        </asp:RadioButtonList>
                        <span class="tips">是否启用云存储，云存储涉及的收费请向第三方了解。</span>
                    </td>
                    <td width="600"></td>
                </tr>
                <tr>
                <td width="100"><b>是否保留本地文件：</b></td>
                <td width="600">
                    <asp:RadioButtonList ID="RdbApiAutolocal" RepeatDirection="Horizontal" runat="server">
                        <asp:ListItem Value="0" Selected>不保留</asp:ListItem>
                        <asp:ListItem Value="1">保留</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                <td width="600"></td>
                </tr>
            </table>
            <asp:Panel ID="Panel2" runat="server" Width="100%">
                <div class="courseList">
                    <asp:Repeater ID="list" runat="server">
                        <HeaderTemplate>
                            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="CTable">
                                <tr class="CTitle">
                                    <td width="50">序号</td>
                                    <td width="50">默认</td>
                                    <td width="100">接口标识ID</td>
                                    <td width="100">接口名称</td>
                                    <td width="120">ApiID</td>
                                    <td width="120">apikey</td>
                                    <td width="150">存储空间名称</td>
                                    <td style="width: 150px">操作</td>
                                </tr>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr onmouseover="this.className=&#39;CtrMouseOver&#39;" onmouseout="this.className=&#39;CtrMouseOut&#39;" onclick="chk(this)">
                                <td class="Ctd" style="text-align: center"><%#this.list.Items.Count + 1%></td>
                                <td class="courseList" style="text-align: center">
                                    <div class="input">
                                        <input type="radio" name="browser" <%#Eval("enable").ToString()=="true"?"checked='checked'":"" %> value="<%#Eval("ID") %>" />
                                    </div>
                                </td>
                                <td class="Ctd" style="text-align: center"><%#Eval("ID") %></td>
                                <td class="Ctd" style="text-align: center"><%#Eval("name") %></td>
                                <td class="Ctd" style="text-align: center"><%#Eval("ApiID") %></td>
                                <td class="Ctd" style="text-align: center"><%#Eval("apikey").ToString() %></td>
                                <td class="Ctd" style="text-align: center"><%#Eval("bucketName") %> </td>
                                <td class="Ctd" style="text-align: center">
                                    <a class="plicon" href="javascript:;" title="查看已上传文件" <%#Eval("ID").ToString()=="aliyun"?"":"style='display:none'" %> onclick="ShowSelect('查看存储空间文件','<%#Eval("ID") %>','<%#Eval("Endpoint") %>','<%#Eval("ApiID") %>','<%#Eval("apikey").ToString() %>','<%#Eval("bucketName") %> ')"></a>
                                    <a class="plicon" href="javascript:;" title="查看已上传文件" <%#Eval("ID").ToString()=="txunyun"?"":"style='display:none'" %> onclick="ShowSelect('查看存储空间文件','<%#Eval("ID") %>','<%#Eval("AppID") %>','<%#Eval("ApiID") %>','<%#Eval("apikey").ToString() %>','<%#Eval("bucketName") %> ')"></a>&nbsp;&nbsp;&nbsp;&nbsp;              
                                    <a onclick="doNone(event);" href="?id=<%#Eval("id") %>" class="edit" title="修改API信息"></a>&nbsp;&nbsp;&nbsp;
                                    <a href="<%# Eval("ApplyUrl") %>" class="apply" title="跳转至第三方平台" target="_blank"></a>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            <tr style="display: <%# bool.Parse((list.Items.Count==0).ToString())?"":"none"%>">
                                <td align="center" colspan="7">
                                    <div class="empty">没有添加任何记录</div>
                                </td>
                            </tr>
                            </table>
                        </FooterTemplate>
                    </asp:Repeater>
                </div>
                <asp:Label ID="Label_where" Visible="false" runat="server"></asp:Label>
                <div class="h20"></div>
                <%--<asp:Label ID="LabPage" runat="server"  ></asp:Label>--%>
                <KS:Page ID="Page2" runat="server" />
            </asp:Panel>


            <script type="text/javascript">
                showtips('<span class="state"><strong>注意事项：</strong></span>');
            </script>


            <div style="display: none">

                <KS:Page ID="Page1" runat="server" />
            </div>
            <asp:Panel ID="Panel1" runat="server" Height="30px" CssClass="main-button">
                &nbsp;&nbsp;<asp:Button ID="Button1" CssClass="button" runat="server" Text="保存云存储接口API配置" OnClick="Button1_Click" />&nbsp;
            </asp:Panel>
        </div>
    </asp:Panel>
    <asp:Panel ID="addPanel" runat="server" Width="100%" Visible="false">
        <script>   
            function ShowSign(Name, id, Endpoint, ApiID, apikey) {
                parent.openWin(Name, 'System/KS.CloudStorageCreate.aspx?CID=' + id + "&Endpoint=" + Endpoint + "&ApiID=" + ApiID + "&apikey=" + apikey, true, 600, 300);
            }
        </script>
        <div class="content-area mt20">
            <div class="myTitle">修改第三方登录接口配置信息</div>
            <asp:HiddenField ID="HidID" runat="server" />
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable">
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><b>接口名称：</b></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtName" runat="server"></asp:TextBox>
                        <font color="#ff0000">*</font>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" Display="Dynamic" runat="server" ControlToValidate="TxtName"
                            ErrorMessage="请输入接口名称!"></asp:RequiredFieldValidator></td>
                </tr>
                <%if (KSCMS.S("ID") == "aliyun")
                    { %>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><b>访问域名：</b></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtEndpoint" runat="server"></asp:TextBox>
                        <font color="#ff0000">*</font>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Display="Dynamic" runat="server" ControlToValidate="TxtEndpoint"
                            ErrorMessage="请输入访问域名!"></asp:RequiredFieldValidator></td>
                </tr>
                <%}
                    else if (KSCMS.S("ID") == "txunyun")
                    { %>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><b>AppID：</b></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtAppID" runat="server"></asp:TextBox>
                        <font color="#ff0000">*</font>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" Display="Dynamic" runat="server" ControlToValidate="TxtAppID"
                            ErrorMessage="请输入AppID!"></asp:RequiredFieldValidator></td>
                </tr>

                <%} %>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><b>ApiID：</b></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtApiID" runat="server"></asp:TextBox>
                        <font color="#ff0000">*</font>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Display="Dynamic" runat="server" ControlToValidate="TxtApiID"
                            ErrorMessage="请输入ApiID!"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><b>apikey：</b></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="Txtapikey" runat="server"></asp:TextBox>
                        <font color="#ff0000">*</font>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" Display="Dynamic" runat="server" ControlToValidate="Txtapikey"
                            ErrorMessage="请输入ApiID!"></asp:RequiredFieldValidator>
                    </td>
                </tr>

                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><b>存储空间：</b></td>
                    <td class="righttd">&nbsp;
                        <asp:Label runat="server" ID="LblbucketName" Text=""></asp:Label>

                        <%if (KSCMS.S("ID") == "aliyun")
                            { %>
                        <a href="javascript:;" onclick="ShowSign('创建存储空间','<%=KSCMS.S("ID") %>','<%=this.TxtEndpoint.Text %>','<%=this.TxtApiID.Text %>','<%=this.Txtapikey.Text %>')" id="AliyunAbucketName" class="button button_on">创建存储空间</a>
                        <%}
                            else if (KSCMS.S("ID") == "txunyun")
                            {%>
                        <a href="javascript:;" onclick="ShowSign('创建存储空间','<%=KSCMS.S("ID") %>','<%=this.TxtAppID.Text %>','<%=this.TxtApiID.Text %>','<%=this.Txtapikey.Text %>')" id="TenxunyunAbucketName" class="button button_on">创建存储空间</a>
                        <%} %>
                        <font color="#ff0000">*</font>

                    </td>
                </tr>

            </table>
            <KS:Foot ID="Foot1" runat="server" OnSubmit="Foot1_Submit" />
        </div>
    </asp:Panel>
</asp:Content>

