<%@ Page Title="友情链接 - 管理中心" Language="C#" MasterPageFile="Frame.master" AutoEventWireup="true"
    CodeBehind="LinkList.aspx.cs" Inherits="ynhtm.Admin.LinkList" %>

<%@ Register Assembly="ynhtm.WebControls" Namespace="ynhtm.WebControls" TagPrefix="YNHTM" %>
<asp:Content ID="contentTitle" ContentPlaceHolderID="contentTitlePlaceHolder" runat="server">
    <h1>
        友情链接</h1>
    <script type="text/javascript">

        function Upfile_Click(url, id) {
            if (id == "Logo") {
                $("[id$='txtLogo']").val(url);
            }
            setTimeout($.fancybox.close, 10);
        }
    </script>
</asp:Content>
<asp:Content ID="contentRight" ContentPlaceHolderID="contentRightPlaceHolder" runat="server">
    <h2>
        <asp:Label ID="lblSubTitle" runat="server"></asp:Label></h2>
    <asp:Panel runat="server" DefaultButton="btnEdit" CssClass="form">
        <table cellpadding="0" cellspacing="10">
            <tr>
                <td>
                    <asp:Label runat="server" AssociatedControlID="txtName">名称:</asp:Label><br />
                    <asp:TextBox ID="txtName" runat="server" Width="243px" ValidationGroup="Form"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ControlToValidate="txtName" ErrorMessage="名称不能为空"
                        ValidationGroup="Form"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label runat="server" AssociatedControlID="txtUrl">地址:</asp:Label><br />
                    <asp:TextBox ID="txtUrl" runat="server" Width="243px" ValidationGroup="Form"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ControlToValidate="txtUrl" ErrorMessage="地址不能为空"
                        ValidationGroup="Form"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label runat="server" AssociatedControlID="txtLogo">图标:</asp:Label>
                    <a href="Upfile.htm" onclick="javascript:$.fancybox(this.href + '?ID=Logo,' + upfilePar, { width: '75%', height: '90%', transitionIn: 'none', transitionOut: 'none', type: 'iframe' });return false;">
                        选择</a><br />
                    <asp:TextBox ID="txtLogo" runat="server" Width="243px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label runat="server" AssociatedControlID="txtDisplayOrder">排序:</asp:Label><br />
                    <asp:TextBox ID="txtDisplayOrder" runat="server" Width="50px" ValidationGroup="Form">1000</asp:TextBox>
                    <span class="hit">越小越靠前</span>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnEdit" runat="server" OnClick="btnEdit_Click" ValidationGroup="Form"
                        UseSubmitBehavior="false" />
                    <asp:Button ID="btnCancel" runat="server" Text="取消" CausesValidation="false" UseSubmitBehavior="false"
                        OnClick="btnCancel_Click" />
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>
<asp:Content ID="contentLeft" ContentPlaceHolderID="contentLeftPlaceHolder" runat="server">
    <table class="list list-link" cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <th>
                    名称
                </th>
                <th style="width: 150px;" class="center">
                    图标
                </th>
                <th style="width: 60px;" class="center">
                    排序
                </th>
                <th style="width: 130px;" class="center">
                    创建日期
                </th>
                <th style="width: 80px;" class="center">
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
            <YNHTM:Repeater ID="rptList" runat="server" OnItemCommand="rptList_ItemCommand">
                <EmptyTemplate>
                    <tr class="list-empty">
                        <td colspan="5">
                            没有任何友情链接
                        </td>
                    </tr>
                </EmptyTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <a href="<%#this.Eval("Url")%>" target="_blank">
                                <%#this.Eval<string>("Name").HtmlEncode()%></a>
                        </td>
                        <td class="center gray">
                            <%#this.EvalLogo%>
                        </td>
                        <td class="center">
                            <%#this.Eval("DisplayOrder")%>
                        </td>
                        <td class="center">
                            <%#this.Eval("CreateDate","{0:f}")%>
                        </td>
                        <td class="center gray">
                            <asp:LinkButton runat="server" CssClass="b" CausesValidation="false" CommandName="Edit" CommandArgument='<%#this.Eval("LinkID")%>'>编辑</asp:LinkButton>
                            |
                            <asp:LinkButton runat="server" CssClass="b" CausesValidation="false" CommandName="Del" CommandArgument='<%#this.Eval("LinkID")%>'
                                OnClientClick="javascript:if(!confirm('确认删除该链接吗？')) return false;">删除</asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
            </YNHTM:Repeater>
        </tbody>
    </table>
</asp:Content>
