<!--#include file="../../Inc/Cls_Main.Asp"-->
<!--#include file="../inc/Cls_Admin.Asp"-->
<!--#include file="../inc/Cls_MapPath.Asp"-->
<!--#include file="../Admin_Check.Asp"-->
<%
Dim CmsAdmin
'=============================================================================
Set CmsAdmin = New Cls_Admin
CmsAdmin.SetAdminTitle = CmsSiteName
CmsAdmin.SetBodyCssName = "mainbody"
CmsAdmin.SetAdminPath = CmsAdminMapPath
CmsAdmin.LoadHead()
'=============================================================================
Dim Action
'=============================================================================
Action = Easp.Get("action")
Select Case Action
    Case "savemain"
        Call SaveMain()
    Case Else
        Call PageLoad()
End Select
CmsAdmin.LoadFooter()
Set CmsAdmin = Nothing

Sub PageLoad()
    Dim oRs, Id, ClassId, Title, UserName, Tel, Info, IP
    Dim ReplyInfo, ReplyTime, IsChk, AddTime
    Id = Easp.Get("id:n:0")
    If Id = 0 Then
        CmsAdmin.JscriptMsg "参数错误！", "back", "Error", "null"
    End If
    Set oRs = Easp.db.GR(TablePrefix & "Book:1", " Id = "& Id &" ", "")
    If Easp.IsN(oRs) Then
        CmsAdmin.JscriptMsg "不存在的数据！", "back", "Error", "null"
    Else
        ClassId = oRs("ClassId")
        Title = oRs("Title")
        UserName = oRs("UserName")
        Tel = oRs("Tel")
        Info = Trim(oRs("Info"))
        IP = oRs("IP")
        ReplyInfo = Trim(oRs("ReplyInfo"))
        ReplyTime = oRs("ReplyTime")
        IsChk = oRs("IsChk")
        AddTime = oRs("AddTime")
    End If
%>
<script src="<%=CmsAdminMapPath%>js/check/public.type.check.js"></script>
<form name="myform" id="myform" method="post" action="?action=savemain">
  <input type="hidden" name="id" value="<%=Id%>" />
  <input type="hidden" name="ToUrl" value="<%=CmsFun.LoadToUrl()%>" />
  <div class="navigation"><a href="Admin.Index.Asp" class="back">留言管理</a> 插件管理 &gt; 留言管理 &gt; 回复留言 </div>
  <div id="contentTab">
    <div class="content-tab">
      <ul class="tab_nav">
        <li><a onclick="tabs(this);" class="selected" href="javascript:void(0);">回复留言</a></li>
      </ul>
    </div>
    <div class="tab_con" style="display: block;">
      <table class="form_table">
        <col width="200px">
          </col>
        
        <tbody>
          <tr>
            <th> 留 言 人： </th>
            <td><%=Title%></td>
          </tr>
          <tr>
            <th> 所属分类： </th>
            <td><%=Easp.db.RT(TablePrefix & "BookType"," Id = "& ClassId &" ","CnName")%></td>
          </tr>
          <tr>
            <th> 联系电话： </th>
            <td><%=Tel%></td>
          </tr>
          <tr>
            <th> 留言ＩＰ： </th>
            <td><%=IP%></td>
          </tr>
          <tr>
            <th> 留言时间： </th>
            <td><%=CmsFun.TimeToString(AddTime,"yyyy-mm-dd hh:ii:ss")%></td>
          </tr>
          <tr>
            <th> 审核状态： </th>
            <td><%=Easp.IIF(IsChk = 1,"已审核",CmsFun.ShowColor("未审核","red"))%></td>
          </tr>
          <tr>
            <th> 留言内容： </th>
            <td class="td2"><textarea name="Info" id="Info" class="w350" datatype="*0-10000" errormsg="最多10000个字符!"><%=Info%></textarea>
              <span class="Validform_checktip"></span></td>
          </tr>
          <tr>
            <th> 回复留言： </th>
            <td class="td2"><textarea name="ReplyInfo" id="ReplyInfo" class="w350" datatype="*0-10000" errormsg="最多10000个字符!"><%=ReplyInfo%></textarea>
              <span class="Validform_checktip"></span></td>
          </tr>
          <tr>
            <th> </th>
            <td><input type="submit" class="btnSubmit" value="提交保存" />
              &nbsp;
              <input name="重置" type="reset" class="btnSubmit" value="重 置" /></td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</form>
<%
Easp.C oRs
End Sub

Sub SaveMain()
    ChkSysAdminLevel "sys_book", "reply"
    '=========================================================================
    Dim Id, ReplyInfo, IsReply, ToUrl
    Id = Easp.Post("id:n:0")
    ReplyInfo = Easp.Post("ReplyInfo:s")
    ToUrl = Trim(Easp.Post("ToUrl:s"))
    If Id = 0 Then
        CmsAdmin.JscriptMsg "参数错误！", "back", "Error", "null"
    End If
    '=====================================================================
    Dim List, ResultVal
    Easp.Use "list"
    Set List = Easp.List.New
    List("ReplyInfo") = ReplyInfo
    List("IsReply") = Easp.IIf(Easp.IsN(ReplyInfo), 0, 1)
    List("ReplyTime") = Now()
    '=====================================================================
    ResultVal = Easp.db.UR(TablePrefix & "Book", " Id = "& Id &" ", List.Hash)
    '=====================================================================
    Easp.C List
    If ResultVal <> 0 Then
        CmsAdmin.JscriptMsg "回复留言成功！", Easp.IIf(Easp.IsN(ToUrl), "Admin.Index.Asp", ToUrl), "Success", "null"
    End If
    '=====================================================================
End Sub
%>
