<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/function.asp"-->
<!--#include file="../inc/md5.asp"-->
<%call adminpassword()
action=request("action")
t=checksql(request("t"))
if t="" then t=0
if request("action")="Classsave" and request("id")<>"" then
	set rs=Server.CreateObject("ADODB.Recordset")
	sql="select * from D_NewsClass where id="&abs(request("id"))
	rs.open sql,conn,3,3
	rs("ClassName")=checksql(request("ClassName"))
	rs("Color")=checksql(request("color"))
	if request("NewsRows")="" then 
	NewsRows=0
	else
	NewsRows=checksql(request("NewsRows"))
	end if
	if request("NewsHidden")="" then 
	NewsHidden=0
	else
	NewsHidden=checksql(request("NewsHidden"))
	end if
	if request("NewsOrder")="" then 
	NewsOrder=0
	else
	NewsOrder=checksql(request("NewsOrder"))
	end if
	rs("NewsOrder")=NewsOrder
	rs("NewsRows")=NewsRows
	rs("NewsHidden")=NewsHidden
	rs("NewsType")=checksql(request("t"))
	rs.update
	rs.close
	set rs=nothing
	response.write"<SCRIPT language=JavaScript>alert('恭喜您，修改成功！');"
	response.write"this.location.href='News.asp?action=Class&t="&t&"';</SCRIPT>" 
	response.end
end if
if request("action")="Classadd" then
	set rs=Server.CreateObject("ADODB.Recordset")
	sql="select * from D_NewsClass"
	rs.open sql,conn,3,3
    rs.addnew

	rs("ClassName")=checksql(request("ClassName"))
	rs("Color")=checksql(request("color999"))
	if request("NewsRows")="" then 
	NewsRows=0
	else
	NewsRows=checksql(request("NewsRows"))
	end if
	if request("NewsHidden")="" then 
	NewsHidden=0
	else
	NewsHidden=checksql(request("NewsHidden"))
	end if
	if request("NewsOrder")="" then 
	NewsOrder=0
	else
	NewsOrder=checksql(request("NewsOrder"))
	end if
	rs("NewsOrder")=NewsOrder
	rs("NewsRows")=NewsRows
	rs("NewsHidden")=NewsHidden
	rs("NewsType")=checksql(request("t"))
	rs.update
	rs.close
	set rs=nothing
	response.write"<SCRIPT language=JavaScript>alert('恭喜您，添加成功！');"
	response.write"this.location.href='News.asp?action=Class&t="&t&"';</SCRIPT>" 
	response.end
end if
if request("action")="Classdel" and request("id")<>"" then

	set rs=Server.CreateObject("ADODB.Recordset")
	sql="delete from D_NewsClass where id="&abs(request("id"))
	rs.open sql,conn,3,3
	set rs=nothing
	response.write"<SCRIPT language=JavaScript>alert('恭喜您，添加成功！');"
	response.write"this.location.href='News.asp?action=Class&t="&t&"';</SCRIPT>" 
	response.end
	
end if
if request("action")="Newsdel" and request("id")<>"" then

	set rs=Server.CreateObject("ADODB.Recordset")
	sql="delete from D_News where id="&abs(request("id"))
	rs.open sql,conn,3,3
	set rs=nothing
	response.write"<SCRIPT language=JavaScript>alert('恭喜您，添加成功！');"
	response.write"this.location.href='News.asp?action=News&t="&t&"';</SCRIPT>" 
	response.end
	
end if%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=Dshop_webname%>后台管理登陆</title>
<link rel="stylesheet" href="style.css">
<style type="text/css">
<!--
body {
	margin: 20px;
}
body,td,th {
	color: #999999;
}
-->
</style></head>

<body>
<table width="700" height="32" border="0">
  <tr>
    <td colspan="3"><a href="News_edit.asp?t=<%=t%>">发布新闻</a></td>
  </tr>
</table>
<%if action="Class" then
if t="" then t=0%>
<table width="860" border="0" cellpadding="0" cellspacing="1" bgcolor="#EFEFEF">
				
					

				<tr>
				  <td bgcolor="#FFFFFF" height="25" align="center">分类名称</td>
				  <td align="center" bgcolor="#FFFFFF">颜色</td>
				  <td align="center" bgcolor="#FFFFFF">显示条数</td>
				  <td align="center" bgcolor="#FFFFFF">排序</td>
			      <td align="center" bgcolor="#FFFFFF">显示</td>
			      <td align="center" bgcolor="#FFFFFF">操作</td>
			  </tr><%	set rs=Server.CreateObject("ADODB.Recordset")
	sql="select * from D_NewsClass where NewsType="&t&" order by id"
	rs.open sql,conn,1,1
	iii=0	
	do while not rs.eof
iii=iii+1
%><form name="form<%=iii%>" method="post" action="?action=Classsave&id=<%=rs("id")%>&t=<%=t%>">
				<tr>
              <td bgcolor="#FFFFFF" height="25" align="center"><span>
                <input name="ClassName" type="text" id="ClassName" value="<%=rs("ClassName")%>" size="36">
              </span></td>
				  <td align="center" bgcolor="#FFFFFF"><input name="color" type="hidden" id="color<%=iii%>" value="<%=rs("color")%>" size="10">				    
		      
				  <div id='icon_change<%=iii%>' style="cursor:hand;background:<%=rs("color")%>;width:20px;height:20px;" onClick="ShowColor('div_icon<%=iii%>');" title="标题颜色"><img src="/Images/change.gif" /></div>   <div id='div_icon<%=iii%>' style='background:#fafafa;width:78px;margin-top:-21px;margin-left:10px;border:1px solid #cccccc;position:absolute;display:inline;visibility:hidden;'>
<div>
<table border="0" cellpadding="2" cellspacing="3" bgcolor="#FFFFFF" >
  <tr>
    <td width="15" height="14" bgcolor="#666666" onClick="chicon('#666666','#333333',<%=iii%>)" style='margin:0px;cursor:hand;' ></td>
    <td width="15" height="14" bgcolor="#0099CC" onClick="chicon('#0099CC','#0099CC',<%=iii%>)" style='margin:0px;cursor:hand;' ></td>
    <td width="15" height="14" bgcolor="#999900" onClick="chicon('#999900','#999900',<%=iii%>)" style='margin:0px;cursor:hand;' ></td>
	<td width="15" height="14" bgcolor="#993399" onClick="chicon('#993399','#993399',<%=iii%>)" style='margin:0px;cursor:hand;' ></td>
  </tr>
  <tr>
    <td width="15" height="14" bgcolor="#FF3300" onClick="chicon('#FF3300','#FF3300',<%=iii%>)" style='margin:0px;cursor:hand;' ></td>
    <td width="15" height="14" bgcolor="#FF3399" onClick="chicon('#FF3399','#FF3399',<%=iii%>)" style='margin:0px;cursor:hand;' ></td>
    <td width="15" height="14" bgcolor="#003399" onClick="chicon('#003399','#003399',<%=iii%>)" style='margin:0px;cursor:hand;' ></td>
	<td width="15" height="14" bgcolor="#669900" onClick="chicon('#669900','#669900',<%=iii%>)" style='margin:0px;cursor:hand;' ></td>
  </tr>
</table>
</div>
</div></td>
				  <td align="center" bgcolor="#FFFFFF"><label>
                <input name="NewsRows" type="text" id="NewsRows" value="<%=rs("NewsRows")%>" size="8">
              </label></td>
				  <td align="center" bgcolor="#FFFFFF"><input name="NewsOrder" type="text" id="NewsOrder" value="<%=rs("NewsOrder")%>" size="8"></td>
				    <td align="center" bgcolor="#FFFFFF"><select name="NewsHidden" id="NewsHidden">
                      <option value="0" <%if rs("NewsHidden")=0 then%>selected<%end if%>>显示</option>
                      <option value="1" <%if rs("NewsHidden")=1 then%>selected<%end if%>>隐藏</option>
                    </select></td>
				    <td align="center" bgcolor="#FFFFFF"><label>
				      <input name="Submit" type="submit" class="ian" value="修改">
			      <a href="?action=Classdel&id=<%=rs("id")%>&t=<%=t%>">删除</a>			      </label></td>
				</tr>
					</form>
					<%rs.movenext
					loop%>
			  </table>
<table width="700" height="32" border="0">
  <tr>
    <td colspan="3">&nbsp;</td>
  </tr>
</table>
<table width="860" border="0" cellpadding="0" cellspacing="1" bgcolor="#efefef">
              <tr>
                <td bgcolor="#FFFFFF" height="25" align="center">连接文字名称</td>
                <td align="center" bgcolor="#FFFFFF">颜色</td>
                <td align="center" bgcolor="#FFFFFF">显示条数</td>
                <td align="center" bgcolor="#FFFFFF">排序</td>
                <td align="center" bgcolor="#FFFFFF">显示</td>
                <td align="center" bgcolor="#FFFFFF">操作</td>
              </tr>
			 <form name="forma" method="post" action="?action=Classadd&t=<%=t%>">
                <tr>
                  <td bgcolor="#FFFFFF" height="25" align="center">
                    <input name="ClassName" type="text" id="ClassName" size="36"></td>
                  <td align="center" bgcolor="#FFFFFF"><input name="color999" type="hidden" id="color999" value="#666666" size="10">
                 <div id='icon_change999' style="cursor:hand;background:#666666;width:20px;height:20px;" onClick="ShowColor('div_icon999');" title="标题颜色"><img src="/Images/change.gif" /></div>   <div id='div_icon999' style='background:#fafafa;width:78px;margin-top:-21px;margin-left:10px;border:1px solid #cccccc;position:absolute;display:inline;visibility:hidden;'>
<div>
<table border="0" cellpadding="2" cellspacing="3" bgcolor="#FFFFFF" >
  <tr>
    <td width="15" height="14" bgcolor="#666666" onClick="chicon('#666666','#333333',999)" style='margin:0px;cursor:hand;' ></td>
    <td width="15" height="14" bgcolor="#0099CC" onClick="chicon('#0099CC','#0099CC',999)" style='margin:0px;cursor:hand;' ></td>
    <td width="15" height="14" bgcolor="#999900" onClick="chicon('#999900','#999900',999)" style='margin:0px;cursor:hand;' ></td>
	<td width="15" height="14" bgcolor="#993399" onClick="chicon('#993399','#993399',999)" style='margin:0px;cursor:hand;' ></td>
  </tr>
  <tr>
    <td width="15" height="14" bgcolor="#FF3300" onClick="chicon('#FF3300','#FF3300',999)" style='margin:0px;cursor:hand;' ></td>
    <td width="15" height="14" bgcolor="#FF3399" onClick="chicon('#FF3399','#FF3399',999)" style='margin:0px;cursor:hand;' ></td>
    <td width="15" height="14" bgcolor="#003399" onClick="chicon('#003399','#003399',999)" style='margin:0px;cursor:hand;' ></td>
	<td width="15" height="14" bgcolor="#669900" onClick="chicon('#669900','#669900',999)" style='margin:0px;cursor:hand;' ></td>
  </tr>
</table>
</div>
</div></font></td>
                  <td align="center" bgcolor="#FFFFFF"><label>
                    <input name="NewsRows" type="text" id="NewsRows" size="8">
                  </label></td>
                  <td align="center" bgcolor="#FFFFFF"><input name="NewsOrder" type="text" id="NewsOrder" size="8"></td>
                  <td align="center" bgcolor="#FFFFFF"><select name="NewsHidden" id="NewsHidden">
                    <option value="0">显示</option>
                    <option value="1">隐藏</option>
                  </select></td>
                  <td align="center" bgcolor="#FFFFFF"><label>
                    <input name="Submit2" type="submit" class="ian" value="添加">
                  </label></td>
                </tr>
  </form>
</table>
<%end if%>
<script language="javascript" type="text/javascript">

function closeiconDiv(num) {
	document.getElementById('div_icon'+num).style.visibility = 'hidden';
}
function ShowColor(act) {
	document.getElementById(act).style.visibility = 'visible';
}
function chicon(iconid, color, num) {
	//alert('icon_change'+num)
	document.getElementById('icon_change'+num).style.background = color;
	document.getElementById('color'+num).value = iconid;
	closeiconDiv(num);
}
</script>
<%if action="News" then
if t="" then t=0%>
<table width="860" border="0" cellpadding="5" cellspacing="1" bgcolor="#EFEFEF">
				
					

				<tr>
				  <td bgcolor="#FAFAFA" height="25">标题</td>
				  <td width="80" align="center" bgcolor="#FAFAFA">点击</td>
				  <td align="center" bgcolor="#FAFAFA">发布时间</td>
				  <td width="80" align="center" bgcolor="#FAFAFA">设置</td>
		      </tr><%	set rs=Server.CreateObject("ADODB.Recordset")
	sql="select * from D_News where NewsType="&t&" order by id"
	rs.open sql,conn,1,1	
  rs.pagesize = 20
if request("page")=""  or isempty(request("page")) then
page = 1
else
page=int(request("page"))
end if
if page>rs.pagecount then
page=rs.pagecount
end if
if not rs.BOF then
Rs.Move Rs.PageSize*(page-1)
end if
i=1
do while not rs.eof and i<=rs.pagesize

%>
				<tr>
					
              <td bgcolor="#FFFFFF" height="25"><%=rs("Title")%></td>
				  <td align="center" bgcolor="#FFFFFF"><%=rs("Hot")%></td>
				  <td width="100" align="center" bgcolor="#FFFFFF"><%=year(rs("AddDate"))%>/<%=Month(rs("AddDate"))%>/<%=day(rs("AddDate"))%></td>	
              <td align="center" bgcolor="#FFFFFF"><a href="News_edit.asp?action=edit&amp;id=<%=rs("id")%>" class="bt">修改</a>&nbsp;<a href=?action=Newsdel&id=<%=rs("id")%>&t=<%=t%> class="bt">删除</a></td>
			    </tr>
					
					<%rs.movenext
					loop%>
</table>
<table width="860" height="32" border="0">
  <tr>
    <td colspan="3" align="right"><%if rs.recordcount<>0 then
if page-1 mod 10=0 then
		p=(page-1) \ 10
	else
		p=(page-1) \ 10
	end if

	response.write "页次："& page &"/"& rs.pagecount &"页"&_
					" 分页："
        if rs.pagecount>1 and page<>1 then response.write "<a href=action="&checksql(request("action"))&"&t="&t&"&page=1 title='首页'>[|<]</a> "
	if p*10>0 then response.write "<a href='action="&checksql(request("action"))&"&t="&t&"&page="&p*10&"' title=上十页>[&lt;&lt;]</a>   "
    uming_i=1
	for ii=p*10+1 to P*10+10
		   if ii=page then
	          response.write "<font color=#ff0000>["+Cstr(ii)+"]</font> "
		   else
		      response.write "<a href='action="&checksql(request("action"))&"&t="&t&"&page="&ii&"'>["+Cstr(ii)+"]</a>   "
		   end if
		if ii=rs.pagecount then exit for
		 uming_i=uming_i+1
	next
	if ii<=rs.pagecount and uming_i=11 then response.write "<a href='?action="&checksql(request("action"))&"&t="&t&"&page="&ii&"' title=下十页>[&gt;&gt;]</a>   "
        if rs.pagecount>1 and page<>rs.pagecount then response.write "<a href=?action="&checksql(request("action"))&"&t="&t&"&page="& rs.pagecount &" title='尾页'>[>|]</a>"
end if
rs.close
set rs=nothing%></td>
  </tr>
</table>
<%end if%>
</body>
</html>
