<%@ page language="C#" autoeventwireup="true" inherits="acad_adEdit, kfenlei" %><%@ Register Src="inc/adminTop.ascx" TagName="adminTop" TagPrefix="qth8" %><!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>
<title>框分类信息系统 后台管理</title>
<link href="css.css" rel="stylesheet" type="text/css" />
<%=tools.sHtmlEdit("content4,html")%>
</head>
<body>
<div align="center">
<div class="main" align="left">
<qth8:adminTop ID="AdminTop1" runat="server" />
<div class="d01">
<div class="tabTitle">广告修改</div>
<form id="adEdit" name="adEdit" class="layui-form" method="post" action="action.aspx?s=adEdit&id=<%=id%>">
<table width="100%" border="0" class="layui-table" cellspacing="0" cellpadding="0">
<tr>
<td class="head" width="150">广告位</td>
<td><div class="gggListLeft" style="width:550px;"><strong>网站首页：</strong>
<input type="radio" name="ad" checked="checked" lay-filter="ad" value="1" title="首页头部" />
<input type="radio" name="ad" lay-filter="ad" value="13" title="首页中部" />
<input type="radio" name="ad" lay-filter="ad" value="14" title="首页底部" />
<input type="radio" name="ad" lay-filter="ad" value="8" title="首页幻灯片" /><br />
<strong>分类信息：</strong>
<input type="radio" name="ad" lay-filter="ad" value="2" title="列表头部" />
<input type="radio" name="ad" lay-filter="ad" value="9" title="列表右侧" />
<input type="radio" name="ad" lay-filter="ad" value="3" title="信息内页" /><br />
<strong>商家黄页：</strong>
<input type="radio" name="ad" lay-filter="ad" value="4" title="列表头部" />
<input type="radio" name="ad" lay-filter="ad" value="5" title="列表右侧" />
<input type="radio" name="ad" lay-filter="ad" value="6" title="商家内页" /><br />
<strong>新闻资讯：</strong>
<input type="radio" name="ad" lay-filter="ad" value="10" title="列表头部" />
<input type="radio" name="ad" lay-filter="ad" value="11" title="列表左侧" />
<input type="radio" name="ad" lay-filter="ad" value="12" title="新闻内页" /><br />
<strong>搜索页面：</strong>
<input type="radio" name="ad" lay-filter="ad" value="7" title="列表右侧" /></div>
<div class="gggListRight"><strong>手机网站首页：</strong>
<input type="radio" name="ad" lay-filter="ad" value="15" title="手机头部" /><br />
<strong>手机分类信息：</strong>
<input type="radio" name="ad" lay-filter="ad" value="16" title="列表头部" />
<input type="radio" name="ad" lay-filter="ad" value="17" title="信息内页" /><br />
<strong>手机商家黄页：</strong>
<input type="radio" name="ad" lay-filter="ad" value="18" title="列表头部" />
<input type="radio" name="ad" lay-filter="ad" value="19" title="商家内页" /><br />
<strong>手机新闻资讯：</strong>
<input type="radio" name="ad" lay-filter="ad" value="20" title="列表头部" />
<input type="radio" name="ad" lay-filter="ad" value="21" title="新闻内页" /><br />
<strong>手机搜索页面：</strong>
<input type="radio" name="ad" lay-filter="ad" value="22" title="列表头部" /></div></td>
</tr>
<tr>
<td width="100">类别</td>
<td> <input type="radio" name="class" lay-filter="class" checked="checked" value="1" title="图片" /><input type="radio" name="class" lay-filter="class" value="2" title="Flash" /><input type="radio" name="class" lay-filter="class" value="3" title="代码" /><input type="radio" name="class" lay-filter="class" value="5" title="幻灯片" /><input type="radio" name="class" lay-filter="class" value="4" title="自由编辑" /></td>
</tr>
<tr id="trsort">
<td width="100">显示分类<br />
<span class="comments">设置广告生效的分类，不选为所有分类都显示</span></td>
<td><input name="sort" type="text" value="<%=sSort%>" id="sort" class="inputText" style="width:500px;" />
<script type="text/javascript">
var obj;
var objInput;
$("#sort").click(function()
{
obj=layer.tab({
  area: ['800px', '400px'],
  tab: [{title: '分类选择',  content: '<%=sSortList %>'}]});
});
function changesort(sobj)
{
	document.getElementById("sort").value=sobj
	layer.close(obj);
}
</script>
</td>
</tr>
<tr>
<td width="100">广告名称</td>
<td><input name="name" type="text" value="<%=sName%>" class="inputText" style="width:500px;" /></td>
</tr>
<tr id="pic">
<td width="100">图片地址</td>
<td><input name="content1" id="content1" type="text" value="<%=sContent1%>" class="inputText" style="width:500px;" /><a href="/<%=sContent1%>" target="_blank">【查看】</a> <a href="#nogo" onclick="showDiv('upfileDiv')">【上传】</a>
<div class="upfileDiv" style="width:505px;" id="upfileDiv">
<div class="upfileClose" onclick="hideDiv('upfileDiv')">关闭</div>
<iframe width="400" height="100" style="padding:0px; margin:0px;" src="inc/upFile.aspx?tn=content1&fn=adEdit&js=top.hideDiv('upfileDiv');top.valiUpPic('content1','','{picUrl}');" frameborder="0" scrolling="no"></iframe>
</div>
</td>
</tr>
<tr id="link">
<td width="100">链接</td>
<td><input name="link" type="text" value="<%=sLink%>" class="inputText" style="width:500px;" /></td>
</tr>
<tr id="flash">
<td width="100">Flash地址</td>
<td><input name="content2" id="content2" type="text" value="<%=sContent2%>" class="inputText" style="width:500px;" /> <a href="#nogo" onclick="showDiv('upfileDiv1')">【上传】</a>
<div class="upfileDiv" style=" width:505px;" id="upfileDiv1">
<div class="upfileClose" onclick="hideDiv('upfileDiv1')">关闭</div>
<iframe width="400" height="100" style="padding:0px; margin:0px;" src="inc/upFile.aspx?tn=content2&fn=adEdit&js=top.hideDiv('upfileDiv1');top.valiUpPic('content2','','{picUrl}');" frameborder="0" scrolling="no"></iframe>
</div>
</td>
</tr>
<tr id="code">
<td width="100">代码</td>
<td><textarea name="content3" cols="75" rows="8" class="layui-textarea"><%=sContent3%></textarea>
</td>
</tr>
<tr id="slide">
<td class="head" width="100">幻灯片</td>
<td><textarea name="content5" style="display:none;" id="content5" cols="75" rows="8"><%=sContent5%></textarea>
<div class="">
图片：<input type="text" class="inputText" name="slidePic" style="width:300px;" id="slidePic" /><a href="#nogo" onclick="showDiv('upfileDiv2')">【上传】</a> 链接：<input style="width:300px;" type="text" class="inputText" name="slideLink" id="slideLink" /> <input type="button" class="bt1" value="添加" onclick="slideAdd()" /> 
<div class="upfileDiv" style="width:505px;" id="upfileDiv2">
<div class="upfileClose" onclick="hideDiv('upfileDiv2')">关闭</div>
<iframe width="400" height="100" style="padding:0px; margin:0px;" src="inc/upFile.aspx?tn=content1&fn=adEdit&js=top.hideDiv('upfileDiv2');top.valiUpPic('slidePic','','{picUrl}');" frameborder="0" scrolling="no"></iframe>
</div>
<div id="slideList"></div>
</div>
</td>
</tr>
<tr id="zybj">
<td class="head" width="100">自由编辑</td>
<td><textarea style="" rows="20" cols="150" name="content4" id="content4"><%=sContent4%></textarea>
</td>
</tr>
<tr>
<td width="100">排序</td>
<td><input name="order"  type="text" value="<%=sOrder%>" class="inputText" style="width:500px;" />
</td>
</tr>
<tr>
<td width="100">大小：</td>
<td>宽：<input name="width" type="text" value="<%=sWidth%>" class="inputText" style="width:100px;" />
<div class="layui-input-inline" style="width:100px;"><select name="widthUnit"><option value="0">像素</option><option value="1">%</option></select></div> 高：<input name="height" type="text" value="<%=sHeight%>" class="inputText" style="width:100px;" />
<div class="layui-input-inline" style="width:100px;"><select name="heightUnit"><option value="0">像素</option><option value="1">%</option></select></div></td>
</tr>
<tr>
<td width="100">边距：</td>
<td>上：<input name="mt" type="text" value="<%=sMT%>" class="inputText" style="width:50px;" /> 右：<input name="mr" type="text" value="<%=sMR%>" class="inputText" style="width:50px;" /> 下：<input name="mb" type="text" value="<%=sMB%>" class="inputText" style="width:50px;" /> 左：<input name="ml" type="text" value="<%=sML%>" class="inputText" style="width:50px;" /></td>
</tr>
<tr>
<td width="100">日期：</td>
<td>开始：<input name="startDate" type="text" value="<%=sStartDate%>" onclick="layui.laydate({elem:this})" class="inputText" style="width:100px;" /> 结束：<input name="endDate" type="text" value="<%=sEndDate%>" onclick="layui.laydate({elem:this})" class="inputText" style="width:100px;" /></td>
</tr>
<tr id="html">
<td width="100">广告内容<br />
<span class="comments">（链接不填）设置广告内容后，点击广告会自动转到内容页面</span></td>
<td><textarea style="" rows="20" cols="150" name="html" id="html"><%=sHtml%></textarea>
</td>
</tr>
<tr>
<td width="100">备注</td>
<td><textarea rows="10" cols="50" name="about" class="layui-textarea"><%=sAbout%></textarea>
</td>
</tr>
<tr>
<td class="head" width="100"></td>
<td><input type="submit" class="layui-btn" value="确认修改" /></td>
</tr>
</table>
</div>
</div>
</div>
</form>
<script type="text/javascript">
function slideAdd()
{
	if($("#slidePic").val()!="")
	{
		$("#content5").val($("#content5").val()+$("#slidePic").val()+"|"+$("#slideLink").val()+"\n");
		$("#slidePic").val('');
		$("#slideLink").val('');
		slideUpdate();
	}
	else
	{
		alert("请上传图片");
	}
}
function slideUpdate()
{
	$("#slideList").html("");
	var sList="";
	var slideArr=$("#content5").val().split("\n");
	for(i=0;i<slideArr.length;i++)
	{
		if(slideArr[i]!="")
		{
			var slideArr1=slideArr[i].split('|');
			spic=slideArr1[0];
			if(spic[0]!="/"&&spic.toLowerCase().indexOf("http://")==-1)
			{
				spic="/"+spic;
			}
			sList+="<div class=\"slideList\"><div class=\"pic\"><div class=\"pic1\"><a href=\""+slideArr1[1]+"\" target=\"_blank\"><img src=\""+spic+"\" /></a></div></div><div class=\"bt1 fl5\" onclick=\"slideUp("+i+")\">上移</div> <div class=\"bt1 fl5\" onclick=\"slideDown("+i+")\">下移</div><div class=\"bt1 fl5\" onclick=\"slideDel("+i+")\">删除</div></div>";
		}			
	}
	$("#slideList").html(sList);
}
	
function slideDel(num)
{
	var sList="";
	var slideArr=$("#content5").val().split("\n");
	for(i=0;i<(slideArr.length-1);i++)
	{
		if(i!=num)
		{
			sList+=slideArr[i]+"\n";
		}
	}
	$("#content5").val(sList);
	slideUpdate();
}
function slideUp(num)
{
	var sList="";
	var slideArr=$("#content5").val().split("\n");
	if(num>0)
	{
		slideTemp=slideArr[num];
		slideArr[num]=slideArr[num-1];
		slideArr[num-1]=slideTemp;
	}
	for(i=0;i<(slideArr.length-1);i++)
	{
		sList+=slideArr[i]+"\n";
	}
	$("#content5").val(sList);
	slideUpdate();
}
function slideDown(num)
{
	var sList="";
	var slideArr=$("#content5").val().split("\n");
	if(num<(slideArr.length-2)&&slideArr.length!=2)
	{
		slideTemp=slideArr[num];
		slideArr[num]=slideArr[num+1];
		slideArr[num+1]=slideTemp;
	}
	for(i=0;i<(slideArr.length-1);i++)
	{
		sList+=slideArr[i]+"\n";
	}
	$("#content5").val(sList);
	slideUpdate();
}
slideUpdate();
</script>
<script language="javascript" type="text/javascript">
setTimeout('updateForm();',1000);
function updateForm()
{
$("#trsort").hide();$("#flash").hide();$("#pic").hide();$("#code").hide();$("#zybj").hide();$("#link").hide();$("#html").hide();$("#slide").hide();
var sClass=$("input:radio[name='class']:checked").val();
var sAd=$("input:radio[name='ad']:checked").val();
if(sAd=="9"||sAd=="2"||sAd=="16")
{
	$("#trsort").show();
}
if(sClass=="1")
{
$("#pic").show();$("#link").show();$("#html").show();
}
if(sClass=="2")
{
$("#flash").show();
}
if(sClass=="3")
{
$("#code").show();
}
if(sClass=="4")
{
$("#zybj").show();
}
if(sClass=="5")
{
$("#slide").show();
}
}
layui.use(['form','laydate'], function(){
var form = layui.form();
form.render();
form.on('radio(ad)', function(data){
updateForm();
});
form.on('radio(class)', function(data){
updateForm();
});
});
function showDiv(divId)
{
	var obj=divId.split(',');
	if(obj.length>0)
	{
		for(i=0;i<obj.length;i++)
		{
  			document.getElementById(obj[i]).style.display="block";
		}
	}
}
function hideDiv(divId)
{
	var obj=divId.split(',');
	if(obj.length>0)
	{
		for(i=0;i<obj.length;i++)
		{
  			document.getElementById(obj[i]).style.display="none";
		}
	}
}
ckRadio("ad","<%=sAd%>");
ckRadio("class","<%=sClass%>");
ckSelect("widthUnit","<%=sWidthUnit%>");
ckSelect("heightUnit","<%=sHeightUnit%>");
</script>
</body>
</html>
