<!--#include file="Admin.asp" -->
<!--#include file="cf.asp" -->
<!-- #include file="include/conn.asp" -->
<%
'转发时请保留此声明信息,这段声明不并会影响你的速度!
'*******************  凹丫丫客户管理系统*******************************
'作者:满载而归
'网站:http://www.oyaya.cn
'电子邮件:info@oyaya.net
'交流社区：http://www.oyaya.net
'=  qq:232706573
'=技术讨论：qq群号：61804028
'版权声明:版权所有,源代码公开,各种用途均可免费使用,但是修改后必须把修改后的文件
'发送一份给作者.并且保留作者此版权信息
'**********************************************************************
action=request("action")
if request("send")="ok" and action="add" then
	title=Replace(Request.Form("title"),"'","＇") 
	Comments=Request.Form("Comments")
	if title="" or request.form("Comments")="" then
	response.write "<script language='javascript'>"
	response.write "alert('填写资料不完整，请检查后重新输入！');"
	response.write "location.href='javascript:history.go(-1)';"
	response.write "</script>"
	response.end
	end if

	set rs=Server.CreateObject("ADODB.RecordSet")
	sql="select * from Summary where online='1' order by Postdate desc"
	rs.open sql,conn,1,3

			rs.Addnew
			rs("username")=request.cookies("Admin_Name")
			rs("comments")=comments
			rs("title")=replace(replace(replace(replace(title,"'","'"),"<","&lt;"),">","&gt;")," ","&nbsp;")
			rs("IP")=Request.serverVariables("REMOTE_ADDR")
			rs.Update
		rs.close
		set rs=nothing
	response.write "<script language='javascript'>"
	response.write "alert('提交成功，请等待领导批示；单击确定返回总结列表！');"
	response.write "location.href='Summary.asp';"	
	response.write "</script>"
	response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="./include/css.css" type="text/css">
<title>工作总结</title>
</head>

<body leftmargin="0" topmargin="0" bgcolor="#FFFFEE">
<br>
<table width="80%" border=0 cellspacing=0 cellpadding=0 align=center bgcolor="#FFFFFF">
<tr><td align=left><a href="Summary.asp?action=add"><strong>填写工作总结</strong></a><br><br>
<%
'管理首页
if action="" then%>
<form name=book action=Summary.asp method=post>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#000000" bordercolordark="#FFFFFF" style="table-layout:fixed;word-break:break-all">
	<tr><td width=5% height=25 align=center bgcolor="#FFFFFF">选</td>
	<td width=10% align=center bgcolor="#FFFFFF">姓名</td> 
	<td width=35% align=center bgcolor="#FFFFFF">内容（编辑与回复）</td>
	<td width=30% align=center bgcolor="#FFFFFF">日期</td>
	<td width=11% align=center bgcolor="#FFFFFF">状态</td>
	</tr>
<%
dim rs,msg_per_page
dim sql
msg_per_page = 15 '每页显示记录数
Set rs=Server.CreateObject("ADODB.Recordset")
if request.cookies("userkey")=10 then
	sql="select * from Summary where del=false order by top desc, PostDate desc"
elseif request.cookies("userkey")=9 then
	sql="select * from Summary where del=false and UserName in (select username from YY_users where authorize="&request.cookies("authorize")&" order by id) order by top desc, PostDate desc"
else
	sql="select * from Summary where del=false and UserName='"&request.cookies("Admin_Name")&"' order by top desc, PostDate desc"
end if
rs.cursorlocation = 3 
rs.pagesize = msg_per_page '每页显示记录数
rs.open sql,conn,1,1 

	if rs.eof and rs.bof then
	response.write "<tr><td colspan=5 align=center height=50 bgcolor=#FFFFFF>暂时没有留言</td></tr>"
	end if

	if not (rs.eof and rs.bof) then '检测记录集是否为空
		totalrec = RS.RecordCount '总记录条数
		if rs.recordcount mod msg_per_page = 0 then '计算总页数,recordcount:数据的总记录数
		n = rs.recordcount\msg_per_page 'n:总页数
		else 
		n = rs.recordcount\msg_per_page+1 
		end if 

		currentpage = request("page") 'currentpage:当前页
		If currentpage <> "" then
			currentpage = cint(currentpage)
			if currentpage < 1 then 
				currentpage = 1
			end if 
			if err.number <> 0 then 
				err.clear
				currentpage = 1
			end if
		else
			currentpage = 1
		End if 
		if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then 
			currentPage=1
		end if
		rs.absolutepage = currentpage 'absolutepage：设置指针指向某页开头
		rowcount = rs.pagesize 'pagesize：设置每一页的数据记录数
		'dim i
		dim k

		Do while not rs.eof and rowcount>0
	content=rs("title")	
	replay=rs("replay")
	UserName=rs("UserName")

	
	Response.write "<tr><td align=center bgcolor=#FFFFFF><input type='checkbox' value='"&rs("ID")&"' name=id>"
	Response.write "</td><td bgcolor=#FFFFFF>"&UserName&"</td><td bgcolor=#FFFFFF><a href='Summary.asp?action=replay&id="&rs("ID")&"'>"
	response.write content
	response.write "</a></td><td  align=center bgcolor=#FFFFFF>"&rs("Postdate")&"</td><td align=center bgcolor=#FFFFFF title=批复时间："&rs("ReplayDate")&">"
	if Isnull(Replay) then
		response.write "<font color=red>新</font>"
	else				
		response.write "已批复"
	end if
		response.write "</td></tr>"
	rowcount=rowcount-1
	rs.movenext		
	loop
	end if

	rs.close
	set rs=nothing
%>
<tr><td colspan=5 bgcolor="#FFFFFF"><input type='checkbox' name=chkall onclick='CheckAll(this.form)'> 全选 
	<%if request.cookies("userkey")=10 then%><input type="submit" name="action" value="删除" onClick="{if(confirm('该操作不可恢复！\n\n确实删除选定的留言？')){this.document.Prodlist.submit();return true;}return false;}"> 	<%end if%>
	</td></tr>
</table>
</form>
<%
call listPages()
end if

if request("action")="删除" then
	delid=replace(request("id"),"'","")
	if delid="" or isnull(delid) then
	response.write "<script language='javascript'>"
	response.write "alert('操作失败，没有选择合适参数，请单击确定返回！');"
	response.write "javascript:history.go(-1);"
	response.write "</script>"
	response.end

	else
		conn.execute("delete from Summary where ID in ("&delid&")")
	response.write "<script language='javascript'>"
	response.write "alert('信息删除成功，请单击确定返回！');"
	response.write "location.href='Summary.asp';"
	response.write "</script>"
	response.end

	end if
end if

if request("action")="replay" then
	id=request("id")
	call detailfeedback()
end if

if request("action")="add" then
	call add()
end if
%>                     
</td></tr>
</table>   
</body></html>
<%sub add()%>
<form action=Summary.asp?action=add method=post name="book">
<table width="100%" border="0" align="center" cellPadding="2" cellSpacing="0" borderColorLight="#000000" borderColorDark="#ffffff" background="images/mainpagerbg2.jpg" bgcolor="#CCCCCC">
  <tr bgColor="#ebebeb">
    <td   width="15%" height="30" align=right bgcolor="#FFFFFF">总结主题：</td>
    <td width="85%" bgcolor="#FFFFFF" ><input type=text name="title" size="60" maxlength=100 class="input"> 
      <font color="#FF0000">*</font></td>   
  </tr>
  <tr bgColor="#ebebeb">
    <td   width="15%" align=right bgcolor="#FFFFFF">总结内容：<br></td>
    <td bgcolor="#FFFFFF"><textarea name="Comments" id="Comments" rows="13" cols="70" style="overflow:auto;" class="input1"></textarea></td>
  </tr>
  <tr bgColor="#ebebeb">
    <td height="40" colSpan="2" align="center" bgcolor="#FFFFFF"><input type="submit" value="提交" name="Submit" class="input"> 
      <input type="reset" value="重新填写" name="Submit2" class="input"><input type=hidden name=send value=ok><input type=hidden name="UserName" size="30" maxlength=16 class="input" value="<%=request.cookies("Admin_Name")%>"> </td>
  </tr>
</table>
</form>
<%end sub

sub detailfeedback()
if id="" then
	response.write "<script language='javascript'>"
	response.write "alert('无此信息编号，请单击确定返回！');"
	response.write "location.href='Summary.asp';"
	response.write "</script>"
	response.end
end if

	'修改留言资料
if request("send")="ok" then
	set rs=server.createobject("adodb.recordset")
	sql = " select * from Summary where del=false and ID="&id
	rs.open sql,conn,1,3

		if not (rs.eof and rs.bof) then
		rs("comments")=request.form("comments")
		rs("Replay")=replace(request.form("Replay"),vbCRLF,"<BR>")
		rs("ReplayDate") = Now()
		rs.update
		end if

	rs.close

	response.write "<script language='javascript'>"
	response.write "alert('已经修改或批复成功，请单击确定返回！');"
	response.write "location.href='Summary.asp';"
	response.write "</script>"
	response.end
end if
	'response.Write id
	'response.End()
	'显示详细资料
	set rs = server.createobject("adodb.recordset")
	sql = "select * from Summary where ID="&id
	rs.open sql,conn,1,1

		if rs.eof and rs.bof then 
		response.write "<script language='javascript'>"
		response.write "alert('无此留言，请单击确定返回！');"
		response.write "location.href='Summary.asp';"
		response.write "</script>"
		response.end
		end if

		if not (rs.eof and rs.bof) then 
			Comments=rs("Comments")
			if rs("replay")<>"" then replay=rs("Replay") else repley=""  end if

		%>
   <table width="80%" border="1" align="center" cellpadding="3" bordercolor="#333333" style="border-collapse: collapse;">
		 <form name="repl" method="post" action='Summary.asp?action=replay&id=<%=id%>'>
		 <tr><TD align="right" width=25% height=15>IP地址</TD>
		 <td width="75%"><%=rs("IP")%></td></tr>
		 <tr><TD align="right" width=25%>日期</TD>
		 <td><%=rs("PostDate")%></td></tr>	
		 <tr><TD align="right" width=25%>标题</TD>
		 <td><%=rs("title")%>&nbsp;</td></tr>
		 <tr><TD align="right" width=25%>user</TD>
		 <td><%=rs("UserName")%>&nbsp;</td></tr>
		 <tr><TD align="right" width=25%>内容</TD>
		 <td><textarea style="overflow:auto" name="comments" id="comments" cols="60" rows="8"<%if request.cookies("userkey")<10 then%> readonly<%end if%>><%=server.htmlencode(Comments)%></textarea></td></tr>
		 <tr><TD align="right" width=25% valign=top>回复内容</TD>
		 <td><textarea style="overflow:auto" name="Replay" cols="60" rows="8"<%if request.cookies("userkey")<9 then%> readonly<%end if%>><%=replay%></textarea>&nbsp;</td></tr>

		
			<TR><TD align="right" width=25%>&nbsp;
			  <INPUT TYPE="hidden" name=send value=ok></TD><TD>
				<input type="submit" name="action" value=" 提 交 " <%if request.cookies("userkey")<9 then%>disabled<%end if%>></TD></TR>
</form></TABLE>
		<div align="center">
		  <%
		end if	

	rs.close
	set rs=nothing

end sub

'分页
sub listPages() 
if n <= 1 then exit sub 
%>
共<%=totalrec%>条总结 
<%if currentpage = 1 then%>
<font color=darkgray>首页 前页</font>
<%else%> 
<a href="<%=request.ServerVariables("script_name")%>?page=1">
首页</font></a> <a href="<%=request.ServerVariables("script_name")%>?page=<%=currentpage-1%>">前页</a>
<%end if%>
<%if currentpage = n then%> 
<font color=darkgray >下页 末页</font>
<%else%> 
<a href="<%=request.ServerVariables("script_name")%>?page=<%=currentpage+1%>">下页</a> <a href="<%=request.ServerVariables("script_name")%>?page=<%=n%>">末页</a>
<%end if%>
  第<%=currentpage%>页 共<%=n%>页
  <%end sub%>
        </div>
<br>
<br>
      <hr size="1" width="760">
      <p align="center" class="style1">Powered by <B><A href="<%=url%>" 
target=_blank><%=titlename%></A></B> &copy 2005-2006 , <B><A 
href="http://Www.oyaya.Cn">Www.oyaya.Cn</A></B> <B>(</B><A href="mailto:oyayaweb@163.com"><B>满载而归</B></A><B>)</B></p>
      <p>　</p>
</body>
</html><%conn.close
set conn=nothing%>