<%@ Register TagPrefix="ftb" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<%@ Page language="c#" Codebehind="AD.aspx.cs" AutoEventWireup="true" Inherits="XpShop.Manage.AD" validateRequest="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
	<HEAD>
	    <!--#include file="inc/head.inc"-->
		<title>AD</title>
		<script type="text/javascript">
			function div(id,img)
			{
				if(document.getElementById(id).style.display=="none")
				{
					document.getElementById(id).style.display="";
					document.getElementById(img).src="Images/open.gif";
					return false;
				}
				else
				{
					document.getElementById(id).style.display="none";
					document.getElementById(img).src="Images/colse.gif";
					return false;
				}
				
			}
			
			$(document).ready(function(){
			    $('[@id^=rptADCategory__ct] tr').hover(function(){
			        $(this).css('background','#edf1f8');
			    },function(){
			        $(this).css('background','#ffffff');
			    });
			})
		</script>
	</HEAD>
	<body>	    <div class="container">
		<div class="sub_container">
		<div class="sub_container_title"><a href="<%=AdminDefault%>" target="_top">桌面</a><img src="images/admin_title.jpg" height=9px width=8px align="absmiddle" />
		    <% if(Request.QueryString["ADID"] == null) {%>广告列表<% }else{%>广告添加<% }%>
		</div>
		<div class="sub_container_content">
		<form id="Form1" method="post" runat="server">
			<% if(Request.QueryString["ADID"] == null) {%>
		    <div class="frame">
		        <div class="frame_title" style="display:none">固定广告管理</div>
		        <div class="frame_content" style="display:none">
		            <table class="tableBorder" cellSpacing="0" cellPadding="0" width="98%" align="center" border="0">
				        <tr>
					        <td height="23" class="forumRowHighlight">
						        <asp:datagrid id="dgList" runat="server" PageSize="15" PagerStyle-Mode="NumericPages" AutoGenerateColumns="False"
							        DataKeyField="ADID" Width="100%" HorizontalAlign="Center" HeaderStyle-CssClass="summary-title">
							        <HeaderStyle Font-Bold="True" CssClass="summary-title"></HeaderStyle>
							        <Columns>
								        <asp:TemplateColumn HeaderText="广告位置">
									        <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
									        <ItemStyle HorizontalAlign="Left"></ItemStyle>
									        <ItemTemplate>
										        <%# DataBinder.Eval(Container.DataItem, "Name") %>
									        </ItemTemplate>
								        </asp:TemplateColumn>
								        <asp:TemplateColumn HeaderText="开放/关闭" ItemStyle-Width="60" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
									        <HeaderStyle></HeaderStyle>
									        <ItemTemplate>
										        <a href='Actions.aspx?Action=ChangeADInNav&ADID=<%# DataBinder.Eval(Container.DataItem, "ADID") %>&Status=<%# DataBinder.Eval(Container.DataItem, "IsOpen")%>'>
											        <img src='images/publish_<%# DataBinder.Eval(Container.DataItem, "IsOpen")%>.png' border="0"></a>
									        </ItemTemplate>
								        </asp:TemplateColumn>
								        <asp:TemplateColumn>
									        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
									        <ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
									        <ItemTemplate>
										        <a href='AD.aspx?ADID=<%# DataBinder.Eval(Container.DataItem, "ADID") %>'>修改</a>
									        </ItemTemplate>
								        </asp:TemplateColumn>
							        </Columns>
							        <PagerStyle Mode="NumericPages"></PagerStyle>
						        </asp:datagrid>
					        </td>
				        </tr>
			        </table>
		        </div>
	        </div>
			
		    <div class="frame">
		        <div class="frame_title">自定义广告管理</div>
		        <div class="frame_content">
		            <table class="tableBorder" cellSpacing="0" cellPadding="0" width="98%" align="center" border="0">
				        <tr>
					        <td height="23" class="forumRowHighlight">
						        <table width="100%">
							        <asp:Repeater Runat="server" ID="rptADCategory">
								        <ItemTemplate>
								        <tr bgcolor="#EDF5FF">
									        <td align="left">
									            <a href="#" onclick="return div('d<%# DataBinder.Eval(Container.DataItem, "ADCategoryID")%>','p<%# DataBinder.Eval(Container.DataItem,"ADCategoryID") %>')"><img src="Images/colse.gif" align="absmiddle" border="0" id='p<%# DataBinder.Eval(Container.DataItem,"ADCategoryID") %>' /><%# DataBinder.Eval(Container.DataItem,"ADCategoryName")%></a>
									        </td>
								        </tr>
								        <tr id="d<%# DataBinder.Eval(Container.DataItem, "ADCategoryID")%>" style="display:none">
									        <td align="left">
										        <asp:datagrid id="dgCustomADList" runat="server" AllowPaging="False" AutoGenerateColumns="False"
											        DataKeyField="ADID" DataSource='<%# BindCustomADss(DataBinder.Eval(Container.DataItem, "ADCategoryID").ToString())%>' Width="100%" HorizontalAlign="Center" HeaderStyle-CssClass="summary-title">
											        <HeaderStyle Font-Bold="True" CssClass="summary-title"></HeaderStyle>
											        <Columns>
												        <asp:TemplateColumn HeaderText="广告位置名称">
													        <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
													        <ItemStyle HorizontalAlign="Left"></ItemStyle>
													        <ItemTemplate>
														        <%# DataBinder.Eval(Container.DataItem, "Name") %>
													        </ItemTemplate>
												        </asp:TemplateColumn>
												        <asp:TemplateColumn HeaderText="广告页面代码">
													        <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
													        <ItemStyle HorizontalAlign="Left"></ItemStyle>
													        <ItemTemplate>
																<input type="text" value="&lt;%=GetAD(<%#DataBinder.Eval(Container.DataItem, "ADID")%>)%&gt;" disabled="false" style="border:0px;font-size:14px;" />
													        </ItemTemplate>
												        </asp:TemplateColumn>
												        <asp:TemplateColumn HeaderText="开放/关闭" ItemStyle-Width="60" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
													        <HeaderStyle></HeaderStyle>
													        <ItemTemplate>
														        <a href='Actions.aspx?Action=ChangeADInNav&ADID=<%# DataBinder.Eval(Container.DataItem, "ADID") %>&Status=<%# DataBinder.Eval(Container.DataItem, "IsOpen")%>'>
															        <img src='images/publish_<%# DataBinder.Eval(Container.DataItem, "IsOpen")%>.png' border="0"></a>
													        </ItemTemplate>
												        </asp:TemplateColumn>
												        <asp:TemplateColumn>
													        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
													        <ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
													        <ItemTemplate>
														        <a href='AD.aspx?ADID=<%# DataBinder.Eval(Container.DataItem, "ADID") %>'>修改</a>
													        </ItemTemplate>
												        </asp:TemplateColumn>
												        <asp:TemplateColumn>
													        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
													        <ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
													        <ItemTemplate>
														        <a href='AD.aspx?DADID=<%# DataBinder.Eval(Container.DataItem, "ADID") %>' onclick='javascript:return confirm("确认删除吗？")'>删除</a>
													        </ItemTemplate>
												        </asp:TemplateColumn>
											        </Columns>
											        <PagerStyle Mode="NumericPages"></PagerStyle>
										        </asp:datagrid>
									        </td>
								        </tr>
								        </ItemTemplate>
								        <AlternatingItemTemplate>
									        <tr bgcolor="edf1f8">
										        <td align="left">
										            <a href="#" onclick="return div('d<%# DataBinder.Eval(Container.DataItem, "ADCategoryID")%>','p<%# DataBinder.Eval(Container.DataItem,"ADCategoryID") %>')"><img src="Images/colse.gif" align="absmiddle" border="0" id='p<%# DataBinder.Eval(Container.DataItem,"ADCategoryID") %>' /><%# DataBinder.Eval(Container.DataItem,"ADCategoryName")%></a></td>
									        </tr>
									        <tr id="d<%# DataBinder.Eval(Container.DataItem, "ADCategoryID")%>" style="display:none">
										        <td align="left">
											        <asp:datagrid id="dgCustomADList" runat="server" AllowPaging="False" AutoGenerateColumns="False"
												        DataKeyField="ADID" DataSource='<%# BindCustomADss(DataBinder.Eval(Container.DataItem, "ADCategoryID").ToString())%>' Width="100%" HorizontalAlign="Center" HeaderStyle-CssClass="summary-title">
												        <HeaderStyle Font-Bold="True" CssClass="summary-title"></HeaderStyle>
												        <Columns>
													        <asp:TemplateColumn HeaderText="广告位置名称">
														        <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
														        <ItemStyle HorizontalAlign="Left"></ItemStyle>
														        <ItemTemplate>
															        <%# DataBinder.Eval(Container.DataItem, "Name") %>
														        </ItemTemplate>
													        </asp:TemplateColumn>
													        <asp:TemplateColumn HeaderText="广告页面代码">
														        <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
														        <ItemStyle HorizontalAlign="Left"></ItemStyle>
														        <ItemTemplate>
															        <input type="text" value="&lt;%=GetAD(<%#DataBinder.Eval(Container.DataItem, "ADID")%>)%&gt;" disabled="false" style="border:0px;font-size:14px;" />
														        </ItemTemplate>
													        </asp:TemplateColumn>
													        <asp:TemplateColumn HeaderText="开放/关闭" ItemStyle-Width="60" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
														        <HeaderStyle></HeaderStyle>
														        <ItemTemplate>
															        <a href='Actions.aspx?Action=ChangeADInNav&ADID=<%# DataBinder.Eval(Container.DataItem, "ADID") %>&Status=<%# DataBinder.Eval(Container.DataItem, "IsOpen")%>'>
																        <img src='images/publish_<%# DataBinder.Eval(Container.DataItem, "IsOpen")%>.png' border="0"></a>
														        </ItemTemplate>
													        </asp:TemplateColumn>
													        <asp:TemplateColumn>
														        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
														        <ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
														        <ItemTemplate>
															        <a href='AD.aspx?ADID=<%# DataBinder.Eval(Container.DataItem, "ADID") %>'>修改</a>
														        </ItemTemplate>
													        </asp:TemplateColumn>
													        <asp:TemplateColumn>
														        <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
														        <ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
														        <ItemTemplate>
															        <a href='AD.aspx?DADID=<%# DataBinder.Eval(Container.DataItem, "ADID") %>' onclick='javascript:return confirm("确认删除吗？")'>删除</a>
														        </ItemTemplate>
													        </asp:TemplateColumn>
												        </Columns>
												        <PagerStyle Mode="NumericPages"></PagerStyle>
											        </asp:datagrid>
										        </td>
									        </tr>
								        </AlternatingItemTemplate>
							        </asp:Repeater>
						        </table>
					        </td>
				        </tr>
			        </table>
		        </div>
	        </div>
			
		    <div class="frame">
		        <div class="frame_title">官网广告类型管理</div>
		        <div class="frame_content">
		            <table class="tableBorder" cellSpacing="0" cellPadding="0" width="98%" align="center" border="0">
				        <tr>
					        <td width="100px">选择广告类型：</td>
					        <td width="150px">
						        <asp:DropDownList id="ddlXpShopADType" runat="server"></asp:DropDownList>
					        </td>
					        <td rowspan="2">
						        XpShop新普网络商城系统是免费开放使用的一套功能强大的在线购物系统，作为对官方的回报，使用XpShop的网站需要开放一个广告位，广告内容由XpShop提供，管理员可以选择使用不同商品类型的广告来适应网站的风格和内容。如果没适合自己内容的广告，请联系XpShop客服添加。
					        </td>
				        </tr>
				        <tr>
					        <td colspan="2" align="center">
						        <asp:Button id="btnSaveType" OnClick="btnSaveType_Click" runat="server" Text="保 存" CssClass="inputbtn"></asp:Button>
					        </td>
				        </tr>
			        </table>
		        </div>
	        </div>
			
				<%if(Request.QueryString["d"] != null){%>
				<script>div('d<%=Request.QueryString["d"]%>','p<%=Request.QueryString["d"]%>')</script>
				<%}%>
			<% }else{%>
		    <div class="frame">
		        <div class="frame_title">广告<asp:Literal Runat="server" ID="ltrAction" Text="修改"></asp:Literal></div>
		        <div class="frame_content">
		            <table cellSpacing="0" cellPadding="0" class="ptable">
				        <tr>
					        <th class="tl">广告位置描述：</th>
					        <td class="tr">
						        <asp:TextBox id="txtName" runat="server"></asp:TextBox>
						    </td>
				        </tr>
				         <tr>
					        <th class="tl">所属类别：</th>
					        <td class="tr">
						        <asp:DropDownList id="ddlAdType" Width="120" runat="server"></asp:DropDownList>
						    </td>
				        </tr>
				        <tr>
					        <th class="tl">开放该广告：</th>
					        <td class="tr">
						        <asp:CheckBox id="cbOpen" runat="server" Text=""></asp:CheckBox>
					        </td>
				        </tr>
				        <% if(Request.QueryString["ADID"] == "3") {%>
				        <tr>
					        <th class="tl">广告属性：</th>
					        <td class="tr">
						        长:<asp:TextBox id="txtWidth" runat="server" Width="50px"></asp:TextBox>px&nbsp;&nbsp; 
						        距离浏览器顶部:<asp:TextBox id="txtTop" runat="server" Width="50px"></asp:TextBox>px&nbsp;&nbsp;
						        <br>
						        高:<asp:TextBox id="txtHigth" runat="server" Width="50px"></asp:TextBox>px&nbsp;&nbsp; 
						        距离浏览器左边:<asp:TextBox id="txtLeft" runat="server" Width="50px"></asp:TextBox>px&nbsp;&nbsp;
					        </td>
				        </tr>
				        <% }%>
				        <tr>
					        <th class="tl">广告内容：</th>
					        <td class="tr">
						        <FTB:FREETEXTBOX id="ftbContent" runat="Server" ImageGalleryPath="Upload/" ToolbarType="OfficeXP" ButtonPath="images/ftb/officeXP/" ButtonDownImage="True" ButtonOverImage="True" Width="790"></FTB:FREETEXTBOX>
					        </td>
				        </tr>
				        <tr>
					        <td colspan="2" class="center">
						        <asp:Button id="btnSave" OnClick="btnSave_Click" runat="server" Text="保 存" CssClass="inputbtn"></asp:Button><FONT face="宋体">&nbsp;</FONT>
						        <asp:Button id="btnCancel" OnClick="btnCancel_Click" runat="server" Text="取消" CssClass="inputbtn"></asp:Button>
						        <%--<input type="button" value="测试" style=" border:1px solid #8f8f8f; background:url(images/btnbg5.gif) repeat-x; letter-spacing:5px; padding:1px; height:26px; line-height:22px; cursor:pointer;" />--%>
						    </td>
				        </tr>
			        </table>
		        </div>
	        </div>
			<% }%>
		</form>
		</div>
		</div>
		</div>
	</body>
</HTML>
