<!--#include file="../../Inc/Cls_Main.Asp"-->
<!--#include file="../inc/Cls_Admin.Asp"-->
<!--#include file="../inc/Cls_MapPath.Asp"-->
<!--#include file="../inc/Cls_InType.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()
%>
<script src="<%=CmsAdminMapPath%>js/check/hdp.check.js"></script>
<form name="myform" id="myform" method="post" action="?action=savemain">
  <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 class="td2"><%=GetHdpType(0, "")%><span class="Validform_checktip">*</span></td>
          </tr>
          <tr>
            <th> 提示说明： </th>
            <td class="td2"><input type="text" class="txtInput w350" name="Title" id="Title" autocomplete="off" datatype="*6-150" nullmsg="提示说明必须填写" errormsg="至少6个字符,最多150个字符!" />
              <span class="Validform_checktip">*</span></td>
          </tr>
          <tr>
            <th> 链接URL： </th>
            <td class="td2"><input type="text" class="txtInput w350" name="Url" id="Url" autocomplete="off" datatype="*1-150" nullmsg="链接URL必须填写" errormsg="至少1个字符,最多150个字符!" />
              <span class="Validform_checktip">*</span></td>
          </tr>
          <tr>
            <th> 大图地址： </th>
            <td class="td2"><input type="text" class="txtInput w350 left" name="Img" id="Img" data-img="show" autocomplete="off" datatype="*6-150" nullmsg="大图地址必须填写" errormsg="至少6个字符,最多150个字符!" />
              <a href="javascript:;" class="files">
              <input type="file" id="FileUploadImg" name="FileUploadImg" onchange="Upload('../', 'UpFile', 12000, 1, 'Img');" autocomplete="off" />
              </a> <span class="uploading">正在上传，请稍候...</span>　
              <input type="button" class="btnSearch" value="从已上传中选择" onclick="ShowWin('Img', '从已上传中选择', '../Admin_File.Asp?action=sf&ChannelId=12000&ReturnId=Img', SetDialog.PublicWidth, SetDialog.PublicHeight, false);" />
              <span class="Validform_checktip">*</span></td>
          </tr>
          <tr>
            <th> 小图地址： </th>
            <td class="td2"><input type="text" class="txtInput w350 left" name="Imgs" id="Imgs" data-img="show" datatype="*0-150" errormsg="最多150个字符!" />
              <a href="javascript:;" class="files">
              <input type="file" id="FileUploadImgs" name="FileUploadImgs" onchange="Upload('../', 'UpFile', 12000, 1, 'Imgs');" autocomplete="off" />
              </a> <span class="uploading">正在上传，请稍候...</span>　
              <input type="button" class="btnSearch" value="从已上传中选择" onclick="ShowWin('Imgs', '从已上传中选择', '../Admin_File.Asp?action=sf&ChannelId=12000&ReturnId=Imgs', SetDialog.PublicWidth, SetDialog.PublicHeight, false);" />
              <span class="Validform_checktip"></span></td>
          </tr>
          <tr>
            <th> 其它说明： </th>
            <td class="td2"><textarea name="Info" id="Info" class="w350" datatype="*0-500" errormsg="最多500个字符!"></textarea>
              <span class="Validform_checktip">支持Html</span></td>
          </tr>
          <tr>
            <th> 链接排序： </th>
            <td class="td2"><input type="text" class="txtInput w100" name="Px" id="Px" autocomplete="off" value="100" datatype="px" nullmsg="排序必须填写" errormsg="只能是数字越小越排前,不可为：0,最多5位数" />
              <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>
<%
End Sub

Sub SaveMain()
    ChkSysAdminLevel "sys_hdp", "add"
    '=====================================================================
    Dim ClassId, Title, Url, Img, Imgs, Info, Px
    ClassId = Easp.Post("ClassId:n:0")
    Title = Easp.Post("Title:s")
    Url = Easp.Post("Url:s")
    Img = Easp.Post("Img:s")
    Imgs = Easp.Post("Imgs:s")
    Info = Easp.Post("Info:s")
    Px = Easp.Post("Px:n:0")
    '=====================================================================
    If ClassId = 0 Then
        CmsAdmin.JscriptMsg "所属分类必须选择！", "back", "Error", "null"
    End If
    If Easp.IsN(Title) Then
        CmsAdmin.JscriptMsg "提示说明必须填写！", "back", "Error", "null"
    End If
    If Easp.IsN(Url) Then
        CmsAdmin.JscriptMsg "链接URL必须填写！", "back", "Error", "null"
    End If
    If Easp.IsN(Img) Then
        CmsAdmin.JscriptMsg "大图地址必须填写！", "back", "Error", "null"
    End If
    If Px = 0 Then
        CmsAdmin.JscriptMsg "排序必须填写！", "back", "Error", "null"
    End If
    '=====================================================================
    Dim List, ResultVal
    Easp.Use "list"
    Set List = Easp.List.New
    List("ClassId") = ClassId
    List("Title") = Title
    List("Url") = Url
    List("Img") = Img
    List("Imgs") = Imgs
    List("Info") = Info
    List("Px") = Px
    List("AddTime") = Now()
    '=====================================================================
    ResultVal = Easp.db.AR(TablePrefix & "Hdp:id", List.Hash)
    '=====================================================================
    Easp.C List
    If ResultVal <> 0 Then
        CmsAdmin.LoadCreateIndex()
        CmsAdmin.JscriptMsg "添加幻灯片成功！", "Admin.Index.Asp", "Success", "null"
    End If
    '=====================================================================
End Sub
%>
