<!--#INCLUDE FILE="conn.asp" -->
<!--#include file="Diary_Conn.asp"-->
<!--#INCLUDE FILE="Class_Checkuser.asp" -->
<!--#INCLUDE FILE="Class_Top.asp" -->
<%
locat="风铃日记"

if membername="" Then
  	ErrMsg=ErrMsg+"<br>"+"<li>您还没有<a href=Class_Login.asp><font color=red>登录或注册校友录</font></a>。"
	Call pagehead()
	Call Error("Information",ErrMsg)
	
Else
call plus_main()
 end if
dim ismast,content
Sub plus_main()
%>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Diary_Diarymain.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">

function chk_form()
{
if(document.all["msgcontent"].value==""){
	alert("你什么都没有输入啊！");
	return false;
}
if(document.all["msgcontent"].value.length>255){
	alert("内容超过长度！");
	return false;
}
}
function delone(d){

if (confirm("您确实要删除吗？此操作将删除本日记！")) {
document.all["upform"].src="Diary_del.asp?id="+d;
window.close();
}
}
function edit_diary(d)
{
window.showModelessDialog('Diary_edit.asp?e_id='+d,'dd','dialogWidth:500pt;dialogHeight:390pt;dialogleft:50pt;status:0;');
}
</script>

</head>

<% 
dim a_id,e_id,title,content,weather,xinqing,ispub,addtime,sampname,whois,dotime,hitnum

	e_id=clasky_string(request("e_id"))
	if e_id<>"" then e_id=dateadd("d",e_id,"2003-1-1")
a_id=clasky_string(request("a_id"))
if a_id="" then 
sql="select * from clasky_diary where addtime like '"&e_id&"' and whois='"&membername&"'"
else
sql="select * from clasky_diary where id="&a_id
end if

	set rs=server.createobject("adodb.recordset")
    rs.open sql,clasky_cn,1,3
	if rs.eof then
    Response.Write "参数错误！"
	Response.end
	else
e_id=rs("id")
	weather=rs("weather")
	xinqing=rs("xinqing")
	sampname=rs("sampname")
	title=rs("title")
	content=rs("content")
	addtime=rs("addtime")
	whois=rs("whois")
	
	dotime=rs("dotime")
	hitnum=rs("hitnum")


	rs("hitnum")=hitnum+1
	rs.update
	end if
	rs.close


 %>



<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="window.focus()">
<script language="JavaScript">
 if (document.all) {
 document.body.style.cssText="background:white url(images/clasky_diary/image/back/<%=sampname%>.gif) no-repeat fixed center center" 
 }
 </script>. 
<table width="99%" height="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="73%" height="25" class="ttitle1"><font color="#666666"><%= addtime %> 
      星期<%= weeks(datepart("w",addtime)) %>&nbsp;<%= weather %></font></td>
    <td width="27%" style="font-size:12px"><div align="center"><font color="#666666"><a href="#liuyan">查看留言</a> 
        <% if whois=membername then %>
        <a href="#" onClick="delone('<%=e_id%>')">删除</a> 
        <a href="#" onClick="edit_diary('<%=e_id%>')">编辑</a>
        <% end if %></font></div></td>
  </tr>
  <tr> 
    <td colspan="2" valign="top"> <table width="98%" height="362" border="0" align="center" cellpadding="2" cellspacing="0">
        <tr> 
          <td width="17" rowspan="2"><font color="#000000"><img src="images/clasky_diary/<%= doweather(weather) %>" width="17" height="17"></font></td>
          <td height="30"><div align="center"></div>
            <div align="center"><strong><%= title %></strong></div>
            <div align="right"></div></td>
          <td width="2" rowspan="2">&nbsp;</td>
        </tr>
        <tr> 
          <td height="20" valign="top"><div align="center">作者<font color="#000066">：<%= whois %></font> 
              阅读：<font color="#000066"><%= hitnum %> </font>留言：<font id="lynums1" color="#000066">0</font>
              <hr size="1" noshade>
            </div></td>
        </tr>
        <tr> 
          <td height="300">&nbsp;</td>
          <td valign="top">
<table width="60" border="0" align="left" cellpadding="0" cellspacing="0">
              <tr> 
                <td><font color="#000066"><img src="images/clasky_diary/image/xq/<%= xinqing %>.gif" width="50" height="53"></font></td>
              </tr>
            </table>
            <div class="text1"> <%= ubbtietu(content) %> </div><p class="text1">&nbsp;</p></td>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
          <td><form action="Diary_up_msg.asp" method="post" name="form1" target="upform" onSubmit="return chk_form()">
              <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr> 
                  <td>留言： <strong><font id="lynums">0</font></strong> 条 每条留言不超过255字</td>
                </tr>
                <tr> 
                  <td><textarea name="msgcontent" cols="53" rows="5"  wrap="VIRTUAL" class="BotLine" id="msgcontent"></textarea> 
                    <input type="submit" name="Submit" value="说两句" >
                    <a name="liuyan"></a>
                    <input name="diaryid" type="hidden" id="diaryid" value="<%=e_id%>">
</td>
                </tr>
                <tr> 
                  <td>
				   <br>
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td id="msgtxt">
<% 
dim lynum,lycontent,lywhois,lytime
	sql="select * from clasky_msg where diaryid="&e_id&" order by addtime desc"
    rs.open sql,clasky_cn,1,3
	if rs.eof then
    Response.Write "还没有留言。"
	else
	lynum=rs.recordcount
	do while not rs.eof
	lycontent=rs("content")
	lywhois=rs("whois")
	lytime=rs("addtime")
	rs.movenext

%>
                          <table width="100%" border="1" cellpadding="3" cellspacing="0" class="border1">
                            <tr><td height="13" onMouseOver="this.style.backgroundColor='#eeeeff'" onMouseOut="this.style.backgroundColor=''"><p><%= lycontent %></p>
                                <p>作者：<%= lywhois %> 时间：<%= lytime %></p></td>
                          </tr></table> <br>
<% 	loop
Response.Write "<script>"
Response.Write "document.all[""lynums""].innerText='"&lynum&"';"
Response.Write "document.all[""lynums1""].innerText='"&lynum&"';"
Response.Write "</script>"
	end if
	rs.close %>						  
                         							
						  </td>
                      </tr>
                    </table>
                    <iframe id="upform" name="upform" width="0" frameborder="0" height="0"></iframe><br>
                  </td>
                </tr>
              </table>
            </form></td>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>

      </td>
  </tr>
  <tr> 
    <td height="20" colspan="2" class="clsSubTabOn"><div align="center"><a href="#" onClick="window.close()">关 
        闭</a></div></td>
  </tr>
</table>
</body>
<%
End Sub
%>
<% 
call Close_clasky_cn
function weeks(w)
select case w
	case 1 weeks="日"
	case 2 weeks="一"
	case 3 weeks="二"
	case 4 weeks="三"
	case 5 weeks="四"
	case 6 weeks="五"
	case 7 weeks="六"
end select

end function

function doweather(w)
select case w
	case "晴天" doweather="image/shine.gif"
	case "阴天" doweather="image/cloud.gif"
	case "雨" doweather="image/rain.gif"
	case "雪" doweather="image/xue.gif"
	case "雾" doweather="image/wu.gif"
end select

end function

function ubbtietu(s)
dim re
dim fString
fString=s
if not isnull(fString) then
	fString = replace(fString, ">", "&gt;")
	fString = replace(fString, "<", "&lt;")
	fString = Replace(fString, CHR(32), "&nbsp;")
	fString = Replace(fString, CHR(9), "&nbsp;")
	fString = Replace(fString, CHR(34), "&quot;")
	fString = Replace(fString, CHR(39), "&#39;")
	fString = Replace(fString, vbCrLf & vbCrLf, "<P>")
	fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10), "<BR>")
end if
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern="\[tt([0-9]*)\]"
ubbtietu=re.Replace(fString,"<img src=images/clasky_diary/image/xq/tietu/$1.gif></img>")
end function
 %>
 