<!--#include file="../Inc/Consts.inc" -->
<!--#include file="CheckAdmin.Asp"-->
<!--#include file="../Inc/common.Asp" -->
<!--#include file="../Inc/strfunc.Asp" -->

<%
' Ss简单网站管理系统-开源版 
'晴天设计www.xxzwz.com
If InStr(SsMasterPurview, "|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,rs, sql
Result = request.QueryString("Result")
Dim ID, LinkName, ViewFlag, LinkType, LinkFace, LinkUrl, Remark
ID = request.QueryString("ID")
Call Ss_FriendLinkEdit()
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="Images/Admin_style.css">
<script language="javascript" src="Admin.js"></script>
<script language="javascript" src="Images/Disp.js"></script>
<table class="tableBorder" width="95%" border="0" align="center" cellpadding="5" cellspacing="1">
<form name="editForm" method="post" action="Ss_FriendLinkEdit.Asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
  <tr>
    <th height="22" colspan="2" sytle="line-height:150%">【<%If Result = "Add" then%>添加<%ElseIf Result = "Modify" then%>修改<%End If%>友情链接】</th>
  </tr>
  <tr>
    <td width="10%" align="right" class="forumRow">站点名称：</td>
    <td width="90%" class="forumRowHighlight"><input name="LinkName" type="text" id="LinkName" style="width: 180" value="<%=LinkName%>"> <input name="ViewFlag" type="checkbox" value="1" <%if ViewFlag then response.write ("checked")%>>是否发布 <font color="red">*</font></td>
  </tr>
  <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 width="10%" align="right" nowrap="nowrap" class="forumRow">前台显示文字、图片：</td>
    <td width="90%" class="forumRowHighlight"><div style="float:left;width:270px;height:25px;line-height:25px;"><input name="LinkFace" type="text" id="LinkFace" style="width:200px;" value="<%=LinkFace%>"><input type="checkbox" onClick="display('upload1');" id="box1"/><label for='box1'>上传图片</label></div>
		<div id="upload1" style="float:left;display:none;">			
		<iframe frameborder=0 width=290 height=25 scrolling=no src="Ss_upload.asp?action=LinkFace&filetype=1&flag=reload"></iframe>
		</div><font color="red">*</font></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></td>
  </tr>
  <tr>
    <td width="10%" align="right" class="forumRow">简短说明：</td>
    <td width="90%" class="forumRowHighlight"><textarea name="Remark" rows="8" id="Remark" style="width: 500"><%=Remark%></textarea></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>
<%
Sub Ss_FriendLinkEdit()
    Dim Action, rsCheckAdd
    Action = request.QueryString("Action")
    If Action = "SaveEdit" Then
        Set rs = server.CreateObject("adodb.recordset")
        If Len(Trim(request.Form("LinkName")))<2 Then Call Alert("请填写网站名称并保持至少在1个汉字以上！","b-1"):response.End
        If Trim(request.Form("LinkFace")) = "" Then Call Alert("请填写前台显示文字或上传友情链接LOGO图片！","b-1"):response.End
        If request.Form("LinkType") = 0 Then
            If Trim(request.Form("LinkFace")) = "" Then Call Alert("请填写前台显示文字或图片地址！","b-1"):response.End
        End If
        If Trim(request.Form("LinkUrl")) = "" Then  Call Alert("请填写友情链接网址！","b-1"):response.End
        If Result = "Add" Then
            sql = "select LinkName,ViewFlag,LinkFace,LinkUrl,LinkType,Remark from ["&Datapre&"_FriendLink]"
            set rs=db(sql,3)
            rs.addnew
            call savedatas()            
        End If
        If Result = "Modify" Then
            sql = "select LinkName,ViewFlag,LinkFace,LinkUrl,LinkType,Remark from ["&Datapre&"_FriendLink] where ID="&ID
            set rs=db(sql,3)
           call savedatas()
        End If
        rs.update
        rs.Close:Set rs = Nothing
       call Alert("提交成功！","Ss_FriendLinkList.Asp")
    Else
        If Result = "Modify" Then
            sql = "select LinkName,ViewFlag,LinkType,LinkFace,LinkUrl,Remark from ["&Datapre&"_FriendLink] where ID="& ID
            set rs=db(sql,2)
            LinkName = rs("LinkName")
            ViewFlag = rs("ViewFlag")
            LinkType = rs("LinkType")
            LinkFace = rs("LinkFace")
            LinkUrl = rs("LinkUrl")
            Remark = rs("Remark")
            rs.Close: Set rs = Nothing
        End If
    End If
End Sub
sub savedatas()
rs("LinkName") = Trim(Request.Form("LinkName"))
            If Request.Form("ViewFlag") = 1 Then
                rs("ViewFlag") = 1
            Else
                rs("ViewFlag") = 0
            End If
            rs("LinkFace") = Trim(Request.Form("LinkFace"))
            rs("LinkUrl") = Trim(Request.Form("LinkUrl"))
            If Request.Form("LinkType") = 1 Then
                rs("LinkType") = 1
            Else
                rs("LinkType") = 0
            End If
            rs("Remark") = Trim(Request.Form("Remark"))
end sub
%>