<% userPageRights="{member}" %>
<!--#include file="check.asp"-->
<!--#include file="../Include/char.asp" -->
<%
'Define Variable 
dim i
dim rs,rst
dim mTypeName,mGrade,mSql,mFlag,mBgColor
Set rs=Server.CreateObject("Adodb.RecordSet")
''''''----------------------------------------
'提升排序
if request("action")="add" then
  f_ArticleID=request("ArticleID")
 if f_ArticleID="" or IsNumeric(f_ArticleID)=false then
 Call Msgbox("对不起，ID号错误！",1)
 Response.end
 end if
 

 mSql="update rj_diary set f_index=f_index+1 where f_id="&f_ArticleID
  conn.execute mSql

 ' response.write msql
  'response.end
  response.redirect "admin_diary.asp"
end if

'降低排序
if request("action")="div" then
 f_ArticleID=request("ArticleID")
 if f_ArticleID="" or IsNumeric(f_ArticleID)=false then
 Call Msgbox("对不起，ID号错误！",1)
 Response.end
 end if
 

 mSql="update rj_diary set f_index=f_index-1 where f_id="&f_ArticleID
 conn.execute mSql

  response.redirect "admin_diary.asp"
end if






'initialization 
mFlag=true'add
m_modifyid=Request.QueryString("ModifyID")



%>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Images/Style.css" rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript">
function jDelete(url)
{
  if((confirm(" 警告:请确定是否删除,删除后不能恢复! "))==true) 
	self.location=url+'&action=del';
}
</SCRIPT>
<script language=Javascript>
<!--
function formsub(i){
if (i==1){
if (confirm('确定将以上活动通过审核？')==1){
   Del.action="";
   Del.submit();
}
}
if (i==2){
	if (confirm('确定删除以上日记本吗？')==1){
	Del.action="admin_diarydel.asp?Action=del";
    Del.submit();
	}
}
}

//-->
</script>
<SCRIPT language="JavaScript">
function jDelete(url)
{
  if((confirm(" 警告:请确定是否删除,删除俱乐部后其下所有数据将不能恢复!（建议使用前台修改） "))==true) 
	self.location=url+'&action=delete';
}
</SCRIPT>
<script language="javascript">
function CheckData(){
  if (document.SignUpForm.name.value=="")
   {
    alert("俱乐部名称不能为空，请输入！");
	document.SignUpForm.name.focus();
	return false;
   }
  if (document.SignUpForm.content.value=="")
   {
    alert("介绍不能为空，请输入！");
	document.SignUpForm.content.focus();
	return false;
   }

}
</script>
</head>
<body text="#000000" >
<br>
<table class=tableBorder width="95%" border="0" align="center" cellpadding="2" cellspacing="1">
  <tr > 
    <th height="21" colspan="9"> 心情日记本列表</span> <font color="#FF0000">(前台推荐排序越大越前)</font></th>
  </tr>
  <tr > 
    <td colspan="2" align="center" class=forumHeaderBackgroundAlternate><strong>次序</strong></td>
    <td width="11%" align="center" class=forumHeaderBackgroundAlternate><strong>排序设置</strong></td>
    <td class=forumHeaderBackgroundAlternate width="42%"><b>日记本名称</b></td>
    <td width="12%" class=forumHeaderBackgroundAlternate><b>发布人</b></td>
    
    <td width="19%" align="center" class=forumHeaderBackgroundAlternate><b>发布时间</b></td>
  </tr>
  <form name="Del" method="Post">
    <%  
	Set rs=Server.createobject("Adodb.RecordSet")
    pageno=request.querystring("pageno")
    pmcount=16  
    mSql="select * from rj_diary order by f_addtime desc"
	rs.open mSql,conn,1,1
	if rs.eof then
	   'response.write "<br><p  align='center'><font color=red><B> 对不起，数据已清空！</B></font></p>"
    else
    rs.pagesize=pmcount
    mpage=rs.pagecount
    if pageno="" then pageno=1
    if  cint(pageno)<1 or cint(pageno)>mpage then  pageno=1
    rs.absolutepage=pageno

 Dim rc,re
 rc=rs.pagesize
 re=1
 do while not rs.eof and rc>0
 mBgColor=Request.Querystring("BgColor")
 if Trim(rs("F_ID"))=Trim(mBgColor) then mColor= "D6DFFF" else mColor= "ffffff"
 Set rs_user = conn.Execute("select f_username FROM T_Member where f_id="&rs("f_userid"))
 if not rs_user.eof then
 diary_username=rs_user("f_username")
 end if
 rs_user.close
 set rs_user=nothing
%>
    <tr  > 
      <td width="8%" align="center" valign="top"  class=forumRow> <input name='ArticleID' type='checkbox' id="ArticleID" value="<%=rs("f_id")%>"> 
      </td>
      <td width="8%" align="center" valign="top"  class=forumRow><% if rs("F_index")<>"" then %>
        <%=rs("f_index")%>
        <% else
		conn.Execute("update rj_diary set f_index=0 where f_id="&rs("f_id"))
		 %>
        0
        <% end if %></td>
      <td width="11%" align="center" valign="top"  class=forumRow><a title="上升" href="admin_diary.asp?action=add&ArticleID=<%=rs("f_id")%>">[+]</a> 
        <a  title="降低" href="admin_diary.asp?action=div&ArticleID=<%=rs("f_id")%>">[-]</a></td>
      <td width="42%" valign="top" class=forumRow ><a href="../member/club_member_diary.asp?username=<%=diary_username%>" target="_blank"><%=rs("F_diaryname")%></a>
	  <%
	  cSql="select count(f_id)as mvalue from rj_diarylist where f_userid="&rs("f_userid")
      rsc=conn.execute (cSql)
	  num=rsc("mvalue")
	 ' rsc.close
	 ' set rsc=nothing
	  %>
        [<font color="#FF0000"><%=num%></font>] </td>
      <td valign="top" class=forumRow > &nbsp;<a href="../member/club_member.asp?username=<%=diary_username%>" target="_blank"><%=diary_username%></a></td>
    
      <td width="19%" align="center" valign="top" class=forumRow ><%=rs("F_addtime")%> </td>
    </tr>
    <%
 rs.movenext
 re=re+1
 rc=rc-1
 loop
 end if
%>
    <tr  > 
      <td colspan="8" align="center"  class=forumRow> &nbsp;&nbsp; <input type="button" name="Submit3" value="删除日记本"  onclick="formsub(2)" > 
      </td>
    </tr>
  </form>
  <tr  > 
    <td class=forumRow align="center" colspan="11"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="38%" height="22"> &nbsp;共 <font color=red><strong> 
            <% = rs.recordcount%>
            </strong></font> 条记录 当前第 <font color=red><strong> 
            <% = Trim(pageno)%>
            </strong></font>页/共 <font color=red><strong> 
            <% = Trim(mpage)%>
            </strong></font>页 </td>
          <td width="62%" align="right"> <%
if pageno>1 then
   response.write "<a href='admin_diary.asp'> <img alt='首页' src='Images/boqb02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='首页' src='Images/boqb02.gif' border=0 width='15' height='14'>"
end if

if pageno>1 then
   response.write "<a href='admin_diary.asp?pageno="&pageno-1&"'><img alt='上一页' src='Images/bob02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='上一页' src='Images/bob02.gif' border=0 width='15' height='14'>"
end if

add=5'数字分页个数+1
if pageno-int(add/2)<=1 then m=1 else m=pageno-int(add/2)
if m+add>mpage then 
   n=mpage
   if mpage-add<=1 then m=1 else m=mpage-add
else
   n=m+add
end if

for pno=m to n
 if pno=cint(pageno) then
   response.write "&nbsp;<font color=red>"&pno&"</font>"
 else
   response.write "<b>&nbsp;<a href='admin_diary.asp?pageno="&pno&"'>"&pno&"</a></b>"
 end if
next
response.write "&nbsp"

if int(pageno) < int(rs.pagecount) then
  response.write "<a href='admin_diary.asp?pageno="&pageno+1&"'><img alt='下一页' src='Images/fbob02.gif' border=0 width='15' height='14'></a>"
else 
  response.write "<img alt='下一页' src='Images/fbob02.gif' border=0 width='15' height='14'>"
end if

if int(pageno) < int(rs.pagecount) then
   response.write "<a href='admin_diary.asp?pageno="&mpage&"'><img alt='末页' src='Images/fboqb02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='末页' src='Images/fboqb02.gif' border=0 width='15' height='14'>"
end if
Response.write "&nbsp;&nbsp;"
%> </td>
        </tr>
      </table></td>
  </tr>
</table> 
       

</body>
</html>
<%
 rs.close
 set rs=nothing
 conn.close
 set conn=nothing
%>