<%@ LANGUAGE = VBScript.Encode %>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
<TITLE>友情链接编辑</TITLE>
<link rel="stylesheet" href="Images/Admin.css">
<script language="javascript" src="../Script/Admin.js"></script>
</HEAD>
<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="CheckAdmin.asp"-->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方客服中心 http://www.ip126.com
'微信公众号 ip126com
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<BODY>
<%
if Instr(session("AdminPurview"),"|4,")=0 then
  response.write ("<br><br><div align=""center""><font style=""color:red; font-size:9pt; "")>您没有管理该模块的权限！</font></div>")
  response.end
End If
dim Result
Result=request.QueryString("Result")
dim ID,LinkNameCh,LinkNameEn,ViewFlagCh,ViewFlagEn,LinkType,LinkFaceCh,LinkFaceEn,LinkUrl,RemarkCH,RemarkEN,px_id
ID=request.QueryString("ID")
call FriendLinkEdit()
%>

<br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <th>友情链接：添加，修改友情链接相关的内容</th>
  </tr>
  <tr>
    <td height="24" align="center" nowrap  class="forumrow"><a href="FriendLinkEdit.asp?Result=Add" onClick='changeAdminFlag("添加友情链接")'>添加友情链接</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="FriendLinkList.asp" onClick='changeAdminFlag("友情链接列表")'>查看友情链接</a></td>
  </tr>
</table>
<br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
<form name="editForm" method="post" action="FriendLinkEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
  <tr>
    <th height="22" colspan="2">【<%If Result = "Add" then%>添加<%ElseIf Result = "Modify" then%>修改<%End If%>友情链接】</th>
  </tr>
  <tr>
    <td width="20%" align="right" class="forumRow">中文名称：</td>
    <td width="80%" class="forumRowHighlight"><input name="LinkNameCH" type="text" id="LinkNameCH" style="width: 180" value="<%=LinkNameCH%>"> <input name="ViewFlagCH" type="checkbox" value="1" checked <%if ViewFlagCH then response.write ("checked")%>>
    是否发布 <font color="red">*</font></td>
  </tr>
  <%if chinato=1 then%>
  <tr>
    <td width="20%" align="right" class="forumRow">英文名称：</td>
    <td width="80%" class="forumRowHighlight"><input name="LinkNameEN" type="text" id="LinkNameEN" style="width: 180" value="<%=LinkNameEN%>"> 
    <input name="ViewFlagEN" type="checkbox" value="1" <%if ViewFlagEN then response.write ("checked")%>>是否发布 <font color="red">*</font></td>
  </tr>
  <%End if%>
  <tr>
    <td align="right" class="forumRow">链接类型：</td>
    <td class="forumRowHighlight"><input name="LinkType" type="radio" value="1" <%if LinkType then response.write ("checked=checked")%> />图片 <input name="LinkType" type="radio" value="0" <%if not LinkType then response.write ("checked=checked")%> />文字</td>
  </tr>
 <tr>
    <td align="right" class="forumRow">链接网址：</td>
    <td class="forumRowHighlight"><input name="LinkUrl" type="text" id="LinkUrl" style="width: 280" value="<%=LinkUrl%>"> <font color="red">*</font> 前面带http://</td>
  </tr>
  <tr>
    <td width="20%" align="right" class="forumRow">中文LOGO图片：</td>
    <td width="80%" class="forumRowHighlight"><input class="smallInput" name="LinkFaceCh" size="50" value="<%=LinkFaceCh%>"><iframe style="top:2px" ID="UploadFiles" src="upload_Friend.asp?PhotoUrlID=1" frameborder=0 scrolling=no width="470" height="21"></iframe><font color="red">*</font></td>
  </tr>
  <%if chinato=1 then%>
  <tr>
    <td width="20%" align="right" class="forumRow">英文LOGO图片：</td>
    <td width="80%" class="forumRowHighlight"><input class="smallInput" name="LinkFaceEn" size="50" value="<%=LinkFaceEn%>"><iframe style="top:2px" ID="UploadFiles" src="upload_Friend.asp?PhotoUrlID=2" frameborder=0 scrolling=no width="470" height="21"></iframe> <font color="red">*</font></td>
  </tr>
  <%End if%>
  <tr>
    <td width="20%" align="right" class="forumRow">中文简短说明：</td>
    <td width="80%" class="forumRowHighlight"><input name="RemarkCH" type="text" id="RemarkCH" style="width: 280" value="<%=RemarkCH%>" maxlength="100"> 100字符内</td>
  </tr>
  <%if chinato=1 then%>
  <tr>
    <td width="20%" align="right" class="forumRow">英文简短说明：</td>
    <td width="80%" class="forumRowHighlight"><input name="RemarkEN" type="text" id="RemarkEN" style="width: 280" value="<%=RemarkEN%>" maxlength="100"> 100字符内</td>
  </tr>
  <%End if%>
  <tr>
    <td width="20%" align="right" class="forumRow">排&nbsp;&nbsp;&nbsp;&nbsp;序：</td>
    <td width="80%" class="forumRowHighlight"><input name="px_id" type="text" id="px_id" style="width: 280" value="<%=px_id%>" maxlength="100" <%=onKeyUp%>> 数字越大越靠前</td>
  </tr>
  <tr>
    <td align="right" class="forumRow"></td>
    <td class="forumRowHighlight"><input name="submitSaveEdit" type="submit" id="submitSaveEdit" value="保存"> <input type="button" value="返回上一页" onClick="history.back(-1)"></td>
  </tr>
  </form>
</table>
</BODY>
</HTML>
<%
sub FriendLinkEdit()
  dim Action,rsCheckAdd,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then
    set rs = server.createobject("adodb.recordset")
    if len(trim(request.Form("LinkNameCh")))<1 then
      response.write ("<script language=javascript> alert('""中文""名称为必填项！');history.back(-1);</script>")
      response.end
    end if
    if len(trim(request.Form("LinkFaceCh")))<1  then
      response.write ("<script language=javascript> alert('中文LOGO为必填项目！');history.back(-1);</script>")
      response.end
    end if
    if request.Form("ViewFlagEn")=1 then
      if len(trim(request.Form("LinkNameEn")))<1 or len(trim(request.Form("LinkFaceEn")))<1 then
      response.write ("<script language=javascript> alert('您已经选择了""英文""显示，因此英文名称、英文LOGO必填！');history.back(-1);</script>")
      response.end
      end if
    end if
    if len(trim(request.Form("LinkUrl")))<6 then
      response.write ("<script language=javascript> alert('链接网址为必填项目且不少于6个字符！');history.back(-1);</script>")
      response.end
    end if
    if len(trim(request.Form("px_id")))<1 then
      response.write ("<script language=javascript> alert('排序不能为空');history.back(-1);</script>")
      response.end
    end if
    if Result="Add" then
	  sql="select * from TianTianCMS_FriendLink"
      rs.open sql,conn,1,3
      rs.addnew
      rs("LinkNameCh")=trim(Request.Form("LinkNameCh"))
      rs("LinkNameEn")=trim(Request.Form("LinkNameEn"))
	  if Request.Form("ViewFlagCh")=1 then
        rs("ViewFlagCh")=Request.Form("ViewFlagCh")
	  else
        rs("ViewFlagCh")=0
	  end if
	  if Request.Form("ViewFlagEn")=1 then
        rs("ViewFlagEn")=Request.Form("ViewFlagEn")
	  else
        rs("ViewFlagEn")=0
	  end if
      rs("LinkFaceCh")=trim(Request.Form("LinkFaceCh"))
      rs("LinkFaceEn")=trim(Request.Form("LinkFaceEn"))
      rs("LinkUrl")=trim(Request.Form("LinkUrl"))
	  if Request.Form("LinkType")=1 then
        rs("LinkType")=Request.Form("LinkType")
	  else
        rs("LinkType")=0
	  end if 

	  rs("RemarkCH")=trim(Request.Form("RemarkCH"))
	  rs("RemarkEN")=trim(Request.Form("RemarkEN"))
	  rs("AddTime")=now()
	end if
	if Result="Modify" then
      sql="select * from TianTianCMS_FriendLink where ID="&ID
      rs.open sql,conn,1,3
      rs("LinkNameCh")=trim(Request.Form("LinkNameCh"))
      if chinato=1 then rs("LinkNameEn")=trim(Request.Form("LinkNameEn"))
	  if Request.Form("ViewFlagCh")=1 then
        rs("ViewFlagCh")=Request.Form("ViewFlagCh")
	  else
        rs("ViewFlagCh")=0
	  end if
	  if Request.Form("ViewFlagEn")=1 then
        if chinato=1 then rs("ViewFlagEn")=Request.Form("ViewFlagEn")
	  else
        if chinato=1 then rs("ViewFlagEn")=0
	  end if
      rs("LinkFaceCh")=trim(Request.Form("LinkFaceCh"))
      if chinato=1 then rs("LinkFaceEn")=trim(Request.Form("LinkFaceEn"))
      rs("LinkUrl")=trim(Request.Form("LinkUrl"))
	  if Request.Form("LinkType")=1 then
        rs("LinkType")=Request.Form("LinkType")
	  else
        rs("LinkType")=0
	  end if	  
	  rs("RemarkCH")=trim(Request.Form("RemarkCH"))
	  if chinato=1 then rs("RemarkEN")=trim(Request.Form("RemarkEN"))
	end If
	rs("px_id")=trim(Request.Form("px_id"))
	rs.update
	rs.close
    set rs=nothing
    response.write "<script language='javascript'>alert('设置成功！');location.replace('FriendLinkList.asp');</script>"
  else
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from TianTianCMS_FriendLink where ID="& ID
      rs.open sql,conn,1,1
	  LinkNameCh=rs("LinkNameCh")
	  LinkNameEn=rs("LinkNameEn")
	  ViewFlagCh=rs("ViewFlagCh")
	  ViewFlagEn=rs("ViewFlagEn")
	  LinkType=rs("LinkType")
	  LinkFaceCh=rs("LinkFaceCh")
	  LinkFaceEn=rs("LinkFaceEn")
      LinkUrl=rs("LinkUrl")
      RemarkCH=rs("RemarkCH")
	  RemarkEN=rs("RemarkEN")
	  px_id=rs("px_id")
	  rs.close
      set rs=nothing
	end if
  end if
end sub
%>