<!--#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 ChannelId, ChannelName, BriefName, TabName
ChannelId = Easp.Get("ChannelId:n:0")
If ChannelId = 0 Then
    CmsAdmin.JscriptMsg "频道参数错误！", "", "Error", "null"
End If
' 读取频道信息
Dim ArrayChannel
ArrayChannel = GetCaCheChannelInfo("Channel", ChannelId, ChannelField)
If Easp.IsN(ArrayChannel) Then
    CmsAdmin.JscriptMsg "不存在的频道！", "", "Error", "null"
Else
    ChannelName = ArrayChannel(0)
    BriefName = ArrayChannel(1)
    TabName = ArrayChannel(2)
End If
'=============================================================================
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, oSQL
    Dim Id, DataId, Title, UserName, Info
    Dim Ip, IsReply, ReplyInfo, ReplyTime, IsChk, AddTime
    Id = Easp.Get("id:n:0")
    If Id = 0 Then
        CmsAdmin.JscriptMsg "参数错误！", "back", "Error", "null"
    End If
    oSQL = "Select Top 1 a.DataId,b.Title,a.UserName,a.Info,a.Ip,"
    oSQL = oSQL & "a.IsReply,a.ReplyInfo,a.ReplyTime,a.IsChk,a.AddTime"
    oSQL = oSQL & " From ["& TablePrefix & "Comment] a Left Join ["& TabName & "] b On a.DataId = b.Id "
    oSQL = oSQL & " Where a.ChannelId = "& ChannelId &" And a.Id = "& Id &" "
    Set oRs = Easp.db.GRS(oSQL)
    If Easp.IsN(oRs) Then
        CmsAdmin.JscriptMsg "不存在的数据！", "back", "Error", "null"
    Else
        DataId = oRs("DataId")
        Title = oRs("Title")
        UserName = oRs("UserName")
        Info = Trim(oRs("Info"))
        Ip = oRs("Ip")
        IsReply = oRs("IsReply")
        ReplyInfo = Trim(oRs("ReplyInfo"))
        ReplyTime = oRs("ReplyTime")
        IsChk = oRs("IsChk")
        AddTime = oRs("AddTime")
    End If
    Easp.C oRs
%>
<form name="myform" id="myform" method="post" action="?action=savemain&ChannelId=<%=ChannelId%>">
  <input type="hidden" name="Id" value="<%=Id%>" />
  <input type="hidden" name="ToUrl" value="<%=CmsFun.LoadToUrl()%>" />
  <div class="navigation"><a href="Admin.Index.Asp?ChannelId=<%=ChannelId%>" class="back">评论管理</a> 频道管理 &gt; <%=ChannelName%> &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><%=UserName%></td>
          </tr>
          <tr>
            <th> 所属信息： </th>
            <td><a href="javascript:parent.f_addTab('ChannelId_<%=ChannelId%>','<%=ChannelName%>','info/Admin.Index.asp?ChannelId=<%=ChannelId%>&DataId=<%=DataId%>')"><%=Title%></a></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"><%=Info%></textarea></td>
          </tr>
          <tr>
            <th> 回复评论： </th>
            <td class="td2"><textarea name="ReplyInfo" id="ReplyInfo" class="w350"><%=ReplyInfo%></textarea></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()
    ChkChannelAdminLevel ChannelId, "edit"
    '=====================================================================
    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 & "Comment", " ChannelId = "& ChannelId &" And 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
%>
