<!--#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, Title, Info, Content
    Id = Easp.Get("id:n:0")
    If Id = 0 Then
        CmsAdmin.JscriptMsg "参数错误！", "back", "Error", "null"
    End If
    Set oRs = Easp.db.GR(TablePrefix & "FreeTag:1", " Id = "& Id &" ", "")
    If Easp.IsN(oRs) Then
        CmsAdmin.JscriptMsg "不存在的数据！", "back", "Error", "null"
    Else
        Title = oRs("Title")
        Info = oRs("Info")
        Content = oRs("Content")
    End If
    Easp.C oRs
%>
<script src="<%=CmsAdminMapPath%>js/check/free.tag.check.js"></script>
<form name="myform" id="myform" method="post" action="?action=savemain" onsubmit="return CheckForm();">
  <input type="hidden" name="id" value="<%=Id%>" />
  <input type="hidden" name="ToUrl" value="<%=CmsFun.LoadToUrl()%>" />
  <div class="navigation"><a href="Admin.Tag.List.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 class="td2"><input type="text" class="txtInput w350" name="Title" id="Title" maxlength="150" value="<%=Title%>" autocomplete="off" />
              <label> *不需要加：{ZjjCmsTag:},不可重复</label></td>
          </tr>
          <tr id="trd3">
            <th> 自定义标签描述： </th>
            <td class="td2"><input type="text" class="txtInput w350" name="Info" id="Info" maxlength="150" value="<%=Info%>" autocomplete="off" />
              <span class="Validform_checktip">*</span></td>
          </tr>
          <tr>
            <th> 自定义标签内容： </th>
            <td class="td2"><textarea name="Content" id="Content" class="big"><%=Content%></textarea>
              <label> 支持Html</label></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>
<%
End Sub

Sub SaveMain()
    ChkSysAdminLevel "sys_free", "edit"
    '=====================================================================
    Dim Id, Title, Info, Content, ToUrl
    Id = Easp.Post("Id:n:0")
    Title = Trim(Easp.Post("Title:s"))
    Info = Trim(Easp.Post("Info:s"))
    Content = Trim(Easp.Post("Content:s"))
    ToUrl = Trim(Easp.Post("ToUrl:s"))
    '=====================================================================
    If Id = 0 Then
        CmsAdmin.JscriptMsg "参数错误！", "back", "Error", "null"
    End If
    If Easp.IsN(Title) Then
        CmsAdmin.JscriptMsg "自定义标签名称不能为空！", "back", "Error", "null"
    End If
    If Easp.IsN(Info) Then
        CmsAdmin.JscriptMsg "自定义标签描述不能为空！", "back", "Error", "null"
    End If
    If Easp.IsN(Content) Then
        CmsAdmin.JscriptMsg "自定义标签内容不能为空！", "back", "Error", "null"
    End If
    '=====================================================================
    Dim List, ResultVal
    Easp.Use "list"
    Set List = Easp.List.New
    List("Title") = Title
    List("Info") = Info
    List("Content") = Content
    '=====================================================================
    ResultVal = Easp.db.UR(TablePrefix & "FreeTag", " Id = "& Id &" ", List.Hash)
    '=====================================================================
    Easp.C List
    If ResultVal <> 0 Then
        CmsAdmin.JscriptMsg "编辑自定义标签成功！", Easp.IIf(Easp.IsN(ToUrl), "Admin.Tag.List.Asp", ToUrl), "Success", "null"
    End If
    '=====================================================================
End Sub
%>
