<!--#include file="../Include/Head.asp"-->

<%call getValidform("linksform",1,1,1)%>
<%Call KindeditorPic("editorPic","Links",1,"upload","Logo")%>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="../Main/Right.asp">首页</a></li>
    <li><a href="Add.asp">链接添加</a></li>
    </ul>
    </div>
	
    <!------添加-------------------------------------->
  	<div id="tab1" class="tabson">
    <%
	Pid=clng(Request_QueryString("Pid"))
	sysID=Request_QueryString("id")
	action=Request_QueryString("action")
	If action="linksedit" then
		Set Rs=server.createobject("adodb.recordSet")
		Sql="select * from Jin_Links where sysID="&sysID
		Rs.Open Sql,Conn,1,1
		sysID=Rs("sysID")
		Pid=Rs("Pid")
		Title=Rs("Title")
		Logo=Rs("Logo")
		Url=Rs("Url")
		Target=Rs("Target")
		Info=Rs("Info")
		Rs.close
		Set Rs=nothing
	End If
	%>
    <ul class="forminfo">
    <%If action="linksedit" then%>
    <form name="form1" class="linksform" action="?Action=editLink&id=<%=sysID%>" method="post">
    <%else%>
    <form name="form1" class="linksform" action="?Action=addLink" method="post">
    <%end if%>
    <input name="Pid" type="hidden" value="<%=Pid%>"/>
        <li><label>名称<b>*</b></label><input name="Title" type="text" class="newinput450" value="<%=Title%>" style="width:343px;" datatype="*" nullmsg="请输入网站名称！" />
        <i class="Validform_checktip"></i>
        </li>
        
        <li><label>LOGO<b></b></label><input name="Logo" id="Logo" type="text" class="newinput450" value="<%=Logo%>" readonly="readonly" style="width:343px;"/>
        <i><a href="javascript:;" id="upload">上传</a></i> 
        </li>
        
        <li><label>链接<b>*</b></label><input name="Url" type="text" class="newinput450" value="<%=Url%>" style="width:343px;" datatype="*" nullmsg="请输入网站链接！" />
        <i class="Validform_checktip">外部链接请带http://</i>
        </li>
        
        <li><label class="left">打开方式<b>*</b></label>
		<div class="vocation">
		<select name="Target" class="s152">
		<option value="1" <%If Target=1 Then%>selected<%End If%>>新窗口打开</option>
		<option value="0" <%If Target=0 Then%>selected<%End If%>>原窗口打开</option>
		</select>
		</div>
        </li>
        
        <li><label class="left">简介<br><i style="padding:0; margin:0;">链接提示</i></label><textarea name="Info" cols="" rows="" class="textinput" style="height:90px;"><%=Info%></textarea></li>
        
        <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" value="<%If action="linksedit" then%>提交修改<%else%>确认添加<%end if%>"/><span id="msgdemo"></span></li>
        
    </form>
    </ul>
    </div> 
    

<%
'添加友链
If action="addLink" then
	Logo = sub_str(Trim(request_Form("Logo")),"Upload")
	Set Rs=server.createobject("adodb.recordSet")
	Sql="select * from Jin_Links"
	Rs.open Sql,conn,1,3
	Rs.Addnew
	Rs("Pid")=request_Form("Pid")
	Rs("Title")=request_Form("Title")
	Rs("Logo")=Logo
	Rs("Url")=request_Form("Url")
	Rs("Target")=request_Form("Target")
	Rs("Info")=request_Form("Info")
	Rs("Addtime")=getDate(Now(),"Y-M-D H:M:S")
	Rs("Edittime")=getDate(Now(),"Y-M-D H:M:S")
	Rs.Update
	Rs.close
	Set Rs=nothing
	response.Redirect session("ListPage")
End If
'修改友链
If action="editLink" then
	Logo = sub_str(Trim(request_Form("Logo")),"Upload")
	Set Rs=server.createobject("adodb.recordSet")
	Sql="select * from Jin_Links where sysID="&request.QueryString("id")
	Rs.open Sql,conn,1,3
	Rs("Pid")=request_Form("Pid")
	Rs("Title")=request_Form("Title")
	Rs("Logo")=Logo
	Rs("Url")=request_Form("Url")
	Rs("Info")=request_Form("Info")
	Rs("Target")=request_Form("Target")
	Rs("Edittime")=getDate(Now(),"Y-M-D H:M:S")
	Rs.Update
	Rs.close
	Set Rs=nothing
	response.Redirect session("ListPage")
End If
%>


<%Call BackFoot()%>