<!--#include file="Conn.asp"--><%Checklogin("")

Keys=Server.URLEnCode(Request.QueryString("Keys"))
Ord=Server.URLEnCode(Request.QueryString("Ord"))
Page=Request.QueryString("Page")
id=Request.QueryString("id")
cp=Request.QueryString("cp")
hrefstr="Keys="&Keys&"&Ord="&Ord&"&Page="&Page&"&id="&id&"&cp="&cp

If id="" Or Not IsNumeric(id) Then Response.Write "非法的操作":Response.End

%><!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=utf-8" />
<title>管理区域</title>
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script language="javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="xheditor-1.1.9/xheditor-1.1.9-zh-cn.min.js"></script>
<script>
$(document).ready(function(){

//var allPlugin={addproduct:{c:'tools_pro',t:'插入产品模板',e:function(){var _this=this;var jTest=$('<div>插入产品模块</div><div><textarea id="xheTestInput" style="width:260px;height:100px;display:none"><h1 class="p1_title"><!--产品名称--></h1><div class="p1_img"><a href="<!--图片地址-->" title="<!--产品名称-->" class="p1_showimg"><img src="<!--图片地址-->" alt="<!--产品名称-->" /></a><span>点击上图查看大图和更多...</span></div><dl class="p1_dl"><dt>型 号：</dt><dd>输入型号</dd></dl><dl class="p1_dl"><dt>品 牌：</dt><dd>输入品牌</dd></dl><dl class="p1_dl"><dt>产 地：</dt><dd>输入产地</dd></dl><dl class="p1_dl"><dt>产品简介：</dt><dd>输入简介</dd></dl><h2 class="p1_title1">产品介绍</h2><div class="p1_content">输入介绍</div><div class="p1_copyright">该<!--产品名称-->产品信息由Taber公司独家提供，严禁转载。</div></textarea></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>');var jTestInput=$('#xheTestInput',jTest),jSave=$('#xheSave',jTest);jSave.click(function(){var infotitle = document.getElementById("infotitle").value,infoimgurl=document.getElementById("infoimgurl").value;if(infotitle==''){alert('请先填写信息标题');return false;}if(infoimgurl==''){alert('请上传缩略图');return false;}_this.loadBookmark();var insertval = jTestInput.val().replace(/<!--产品名称-->/g,document.getElementById("infotitle").value).replace(/<!--图片地址-->/g,document.getElementById("infoimgurl").value);_this.pasteHTML(insertval);_this.hidePanel();return false;});_this.saveBookmark();_this.showDialog(jTest);}}}
$('#wxcontent').xheditor({
tools:'full',hoverExecDelay:-1,urlBase:'system/',//urlType:'root',//plugins:allPlugin,
upLinkUrl:"upload.asp",upLinkExt:"zip,rar,txt,pdf",
upImgUrl:"upload.asp",upImgExt:"jpg,jpeg,gif,png",
upFlashUrl:"upload.asp",upFlashExt:"swf",
upMediaUrl:"upload.asp",upMediaExt:"wmv,avi,wma,mp3,mid"
});
});
</script>

</head>

<body>
<div id="man_zone">
<%
Act = Request.QueryString("act")
If act = "save" Then
isedit = False

wxid = Request.Form("wxid")
If wxid<>"" And IsNumeric(wxid) Then isedit = True



wxtitle = TextEnCode(Request.Form("wxtitle"))
wxkeywords = TextEnCode(Request.Form("wxkeywords"))
wxdescription = TextEnCode(Request.Form("wxdescription"))
wxord = Request.Form("wxord")
wxcontent = HTMLEnCode(Request.Form("wxcontent"))

If isedit Then
	Set Rs = Server.CreateObject("ADODB.RecordSet")
	Rs.Open "Select * From xgwx Where id="&wxid,Conn,1,3
	If Not Rs.Bof And Not Rs.Eof Then
		Rs("pid")=id
		Rs("wxtitle") = wxtitle
		Rs("wxkeywords")=wxkeywords
		Rs("wxdescription") = wxdescription
		If wxord<>"" And IsNumeric(wxord) Then Rs("wxord") = wxord
		Rs("wxcontent")=wxcontent

	Else
		Rs.AddNew

		Rs("pid")=id
		Rs("wxtitle") = wxtitle
		Rs("wxkeywords")=wxkeywords
		Rs("wxdescription") = wxdescription
		If wxord<>"" And IsNumeric(wxord) Then Rs("wxord") = wxord
		Rs("wxcontent")=wxcontent
		Rs("wxstate") = 1
	End If
	Rs.Update:Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing
	Response.Redirect "?"&hrefstr
Else
	If wxord="" Or Not IsNumeric(wxord) Then wxord=0
	Conn.Execute("Insert into xgwx(pid,wxtitle,wxkeywords,wxdescription,wxcontent,wxord,wxstate) values("&id&",'"&wxtitle&"','"&wxkeywords&"','"&wxdescription&"','"&wxcontent&"',"&wxord&",1)")
	Conn.Close:Set Conn=Nothing:Response.Redirect "?"&hrefstr
End If

Conn.Close:Set Conn=Nothing

Response.End
End If 'end save

If Act = "add" Or Act = "edit" Then
wxid = Request.QueryString("wxid")
isedit = False
If wxid<>"" And IsNumeric(wxid) Then isedit=True
If isedit Then
	Set Rs = Server.CreateObject("ADODB.RecordSet")
	Rs.Open "Select * From xgwx Where id="&wxid,Conn,1,1
	If Not Rs.Bof And Not Rs.Eof Then
		wxtitle=Rs("wxtitle"):wxkeywords=Rs("wxkeywords"):wxdescription=Rs("wxdescription"):wxord=Rs("wxord"):wxcontent=Rs("wxcontent")
	Else
		isedit = False
	End If
	Rs.Close:Set Rs=Nothing
End If
%>
	<form name="form1" method="post" action="?<%=hrefstr%>&act=save">
	<table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
		<tbody>
			<tr>
				<th width="8%">文献名称</th>
				<td><input type="text" id="wxtitle" name="wxtitle" value="<%=wxtitle%>" class="txt1" /><input type="hidden" name="wxid" value="<%=wxid%>" /></td>
			</tr>
			<tr>
				<th width="8%">关键词</th>
				<td><input type="text" id="wxkeywords" name="wxkeywords" value="<%=wxkeywords%>" class="txt1" /></td>
			</tr>
			<tr>
				<th width="8%">描述</th>
				<td><input type="text" id="wxdescription" name="wxdescription" value="<%=wxdescription%>" class="txt1" /></td>
			</tr>
			<tr>
				<th width="8%">排序</th>
				<td><input type="text" id="wxord" name="wxord" value="<%=wxord%>" class="txt1" /></td>
			</tr>
			<tr>
				<th>内容</th>
				<td><textarea id="wxcontent" name="wxcontent" class="txt2"><%=wxcontent%></textarea></td>
			</tr>
			<tr>
				<th></th>
				<td><input type="submit" name="save" id="save" value="确定" class="btn1" /> <input type="reset" name="save" id="save" value="重置" class="btn1" /> <input type="button" value="返回" class="btn1" onClick="location.href='?<%=hrefstr%>'" /></td>
			</tr>
		</tbody>
	</table>
	</form>
</div>
</body>
</html>
<%
Response.End
End If 'End add


If Act="postchk" Then

Keys = Server.UrlEnCode(Request.QueryString("Keys"))
Ord = Server.UrlEnCode(Request.QueryString("Ord"))
Page = Request.QueryString("Page")

id=Request.QueryString("id")
cp=Request.QueryString("cp")

chkact = Request.Form("chkact")
SqlStr = ""
For i = 1 To Request.Form("chkbox").Count
	If SqlStr<>"" Then
		SqlStr = SqlStr & " Or id="&Request.Form("chkbox")(i)
	Else
		SqlStr = " Where id="&Request.Form("chkbox")(i)
	End If
Next

Select Case chkact
Case "0":SqlStr = "Update da Set dastate="&chkact&SqlStr
Case "1":SqlStr = "Update da Set dastate="&chkact&SqlStr
Case Else:SqlStr = "Delete From xgwx"&SqlStr
End Select

Conn.Execute(SqlStr):Conn.Close:Set Conn=Nothing
Response.Redirect "?Keys="&Keys&"&Ord="&Ord&"&Page="&Page&"&id="&id&"&cp="&cp
Response.End
End If	'End postchk


Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select * From xgwx Where pid="&id&" Order By wxord Desc,id Desc",Conn,1,1
%>	
	<form id="form1" method="post" action="?act=postchk&<%=hrefstr%>" onSubmit="return false" />
	<table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
		<thead>
			<tr>
				<th width="4%"><input type="checkbox" name="chkall" id="chkall" onClick="chkboxall(this,'chkbox')" /></th>
				<th width="6%">序号</th>
				<th width="66%">文献名称</th>
				<th width="8%">排序</th>
				<th width="8%">状态</th>
				<th width="8%">操作</th>
			</tr>
		</thead>
		<tbody>
<%
If Not Rs.Bof And Not Rs.Eof Then
	Do While Not Rs.Bof And Not Rs.Eof
%>
			<tr onMouseOver="this.style.background='#F7FCFF'" onMouseOut="this.style.background='#FFFFFF'">
				<td align="center"><input type="checkbox" name="chkbox" value="<%=Rs(0)%>" /></td>
				<td align="center"><%=TempNum%></td>
				<td align="center"><%=Rs("wxtitle")%></td>
				<td align="center"><%=Rs("wxord")%></td>
				<td align="center"><%If Rs("wxstate")=1 Then Response.Write "显示" Else Response.Write "隐藏" End If%></td>
				<td align="center"><a href="?<%=hrefstr%>&act=edit&wxid=<%=Rs(0)%>" class="ico_edit">修改</a></td>
			</tr>
<%
	Rs.MoveNext
	Loop
Else
%>
			<tr>
				<td align="center" colspan="6">Sorry，当前暂无产品文献</td>
			</tr>
<%
End If
%>
		</tbody>
		<tfoot>
			<tr>
				<td colspan="6">
					<div class="postchkbox">
						<select id="chkact" name="chkact">
							<option value="1">显示</option>
							<option value="0">隐藏</option>
							<option value="-1">删除</option>
						</select>
						<input type="button" value="执行" onClick="postchk(1)" class="btn1" />
						<input type="button" value="新增" onClick="location.href='?act=add&<%=hrefstr%>'" class="btn1" />
						<input type="button" value="返回" onClick="location.href='cp<%=cp%>.asp?<%=hrefstr%>'" class="btn1" />
					</div>
				</td>
			</tr>
		</tfoor>
	</table>
	</form>
<%Rs.Close:Set Rs=Nothing:Conn.Close:Set Conn=Nothing%>
</div>
</body>
</html>
