<!--#include file="../Include/Conno.asp" -->
<!--#include file="../Include/char.asp" -->
<!--#include file="IsLogin.asp" -->
<%
m_UserID = Session("CurUserID")
If Request.ServerVariables("REQUEST_METHOD")="POST" then
  'Read Reuest
  m_Title = checkStr(Trim(Request.Form("txtTitle")))
  m_Content = checkStr(rTrim(Request.Form("txtContent")))
  m_Canto = Trim(Request.Form("selCanto"))
  m_Weather = Trim(Request.Form("selWeather"))
  m_IsLock = Trim(Request.Form("radIsLock"))
  m_HeartPic = Trim(Request.Form("selHeartPic"))
  m_Addtime = Request.Form("txtAddtime")
  m_Addtime = m_Addtime+" "+formatdatetime(now,4)

  'Insert 
  m_Sql = "Insert Into RJ_DiaryList(F_UserID,F_Title,F_Content,F_Addtime,F_Weather,F_HeartPic,F_Canto,F_IsLock)"
  m_Sql =  m_Sql + " Values("&m_UserID&",'"&m_Title&"','"&m_Content&"','"&m_Addtime&"','"&m_Weather&"','"&m_HeartPic&"','"&m_Canto&"',"&m_IsLock&")"
  conn.Execute(m_Sql)
  call CloseDatabase()
  Response.Write "<script language=""javascript"">opener.location.reload();window.close();</script>"
end if
%>
<html>
<head>
<title>添加记录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/member.css" rel="stylesheet" type="text/css">
<script src="../Diary/ubbcode.js"></script>
<script language="javascript">
<!--
function isDate(str)
{var regstr=/^\d{4}-(\d{1}|11|12)-([1-2]?\d{1}|3[0-1])$/;
 return regstr.test(str);
}

function CheckData()
{
  if (document.form1.txtTitle.value=="")
  {
    alert("对不起，记录标题不能为空，请输入！");
	document.form1.txtTitle.focus();
	return false;
   }
  if (document.form1.txtContent.value=="")
  {
    alert("对不起，记录内容不能为空，请输入！");
	document.form1.txtContent.focus();
	return false;
   }
  if (!isDate(document.form1.txtAddtime.value))
	{alert('请按照规定格式输入日期！');
	 document.form1.txtAddtime.select();
	 return false;
	 }
  

}
//-->
</script>

</head>
<body bgcolor="#CCCCCC" leftmargin="0" topmargin="0">
<SCRIPT language=JavaScript src="../include/Popcalendar.js"></SCRIPT>
<table width="100%" border="0" cellpadding="0" cellspacing="1">
  <tr>
    <form name="form1" method="post" action="RJ_DiaryAddNew.asp" onSubmit="return CheckData()">
      <td width="100%" valign="top"><table width="100%" height="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="f2f2f2">
          <tr> 
            <td colspan="3" align="center"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td align="center" background="../images/mmTo.gif"><span style="CURSOR: hand; FILTER: dropshadow(color=#FFFFFF, offx=1, offy=1, positive=1);  WIDTH: 100%"><strong>今天你写日记了吗？</strong></span><strong><span style="CURSOR: hand; FILTER: dropshadow(color=#FFFFFF, offx=1, offy=1, positive=1);  WIDTH: 100%"> 
                    </span></strong></td>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td width="14%" height="11" align="right" bgcolor="#FFFFFF">日记标题：</td>
            <td height="11" colspan="2" bgcolor="#FFFFFF"> <input name="txtTitle" type="text" class="text" size="55" maxlength="28">
            </td>
          </tr>
          <tr> 
            <td width="14%" height="4" align="right" bgcolor="#FFFFFF">故事心情：</td>
            <td colspan="2" bgcolor="#FFFFFF"> <select name="selCanto">
                <option value="甜蜜篇">甜蜜篇</option>
                <option value="深情篇">深情篇</option>
                <option value="柔情篇">柔情篇</option>
                <option value="感伤篇">感伤篇</option>
                <option value="沧桑篇">沧桑篇</option>
                <option value="苦涩篇">苦涩篇</option>
              </select> &nbsp; <img src="../Diary/HeartPic/000.gif"  alt=心情图片 align="absmiddle" id=HeartPic > 
              更多表情 
              <select name=selHeartPic class=editbox2  onChange="document.images['HeartPic'].src=options[selectedIndex].value;" size=1 >
                <%
				  for i = 0 to 20
				   m_HeartPic = Right("00"&cstr(i),3)
				   Response.Write "<OPTION value=../Diary/HeartPic/"&m_HeartPic&".gif>"&m_HeartPic&"</OPTION>"
				  next
				%>
              </select> &nbsp;&nbsp;&nbsp; &nbsp;天气状况： 
              <select name="selWeather">
                <option value="阳光" selected>阳光</option>
                <option value="多云">多云</option>
                <option value="小雨">小雨</option>
                <option value="大雨">大雨</option>
                <option value="打雷">打雷</option>
                <option value="下雪">下雪</option>
                <option value="月亮">月亮</option>
                <option value="星星">星星</option>
              </select> </td>
          </tr>
          <tr align="center" valign="bottom"> 
            <td height="44" colspan="3"><table width="97%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td> <!--#include file="../Diary/getubb.asp" --> </td>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td height="1" align="right" bgcolor="#FFFFFF">日记内容：</td>
            <td height="1" colspan="2" bgcolor="#FFFFFF"><textarea name="txtContent" cols="57" rows="12" class="text"></textarea></td>
          </tr>
          <tr> 
            <td height="13" align="right" bgcolor="#FFFFFF">发布时间：</td>
            <td width="36%" bgcolor="#FFFFFF">
			<script language=JavaScript>
								var FaultStr=""
								arrowtag("txtAddtime"," " );
							 </script>
            <input name="hidAddtime" type="hidden" value="<%=now%>"   size="21" maxlength="50"> 
            </td>
            <td width="50%" align="center" bgcolor="#FFFFFF">是否上锁： 
              <input name="radIsLock" type="radio" value="1" checked>
              公开 
              <input type="radio" name="radIsLock" value="0">
              上锁</td>
          </tr>
          <tr> 
            <td height="35" bgcolor="#FFFFFF">&nbsp;</td>
            <td height="35" colspan="2" bgcolor="#FFFFFF"><input type="submit" name="Submit" value="提交"> 
              <input type="reset" name="Submit2" value="取消"> <input type="button" name="Submit22" value="关闭" onClick="javascript:window.close()"></td>
          </tr>
        </table></td>
    </form>
  </tr>
</table>
</body>
</html>
