<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inchuayuwebrlzywzhyweb/CONN.ASP"-->
<!--#include file="../inchuayuwebrlzywzhyweb/cls_huayuweb()^191563631.asp"-->
<!--#include file="../inchuayuwebrlzywzhyweb/cls_filemanagehycs.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>送货支付</title>
<link href="../inchuayuwebrlzywzhyweb/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<%oa.chkadmin()
dim classname
classname=request.QueryString("classname")
if classname="" or isnull(classname) then
classname="linkimg"
end if
%>
<table width="98%" height="35" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="14%" align="center" bgcolor="#6298E1" style="font-weight:bold"><div align="left"><a href="admin_link_manage.asp?classname=linkimg"><font color="white"><strong>&nbsp;<img src="../img/Explain.gif" width="18" height="18" border="0" align="absmiddle" />&nbsp;</strong><%select case classname
		           case "gunimg"
				   response.Write("三维机械网站群")
				   case "centerimg"
				   response.Write("三维机械下属单位")
				   case "bottomimg"
				   response.write("官方媒体")
				   case "linkimg"
				   response.write("友情链接")
			end select%></font></a></div></td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#6298E1">
  <tr>
    <td bgcolor="#FFFFFF">
	<%  Select Case oa.act
	           Case "add"
			   call linkadd()
			   Case "mod"
			   call linkmod()
			   Case "del"
			   call linkdel()
			  
			   Case Else
			    call main()
	
	
	
	
	    End Select
	%>
	
	
	
	
	
	<%
	Sub linkadd()  '添加支付方式
	 dim title,picpath,orderid,url
	  title=request.form("title"):orderid=request.form("orderid"):picpath=request.Form("picpath"):url=request.form("url"):classname=request.Form("classname")
	   if title=""  then oa.msgshow("链接标题不能为空！请返回重新输入！")
	   if url="" or instr(url,"http")<1  then oa.msgshow("链接地址不能为空,链接地址必须以“http“开头！请返回重新输入！")
	   if orderid="" or not isnumeric(orderid) then oa.msgshow("排序不能为空或格式不正确！请返回重新输入！ ")
	      set rs=oa.execute("select id from c_links where title='"&title&"' and classname='"&classname&"'")
	      if not rs.eof then oa.msgshow("该链接标题已经存在！请返回重新添加")
	      rs.close
	      oa.execute("insert into c_links (id,title,picpath,url,orderid,classname) values ("&oa.getid("c_links")&",'"&title&"','"&picpath&"','"&url&"',"&orderid&",'"&classname&"')")
	     response.redirect(oa.tmpstr)	
	End Sub
	Sub linkmod()  
	dim id,title,picpath,orderid,url
	  id=request.form("id"):title=request.form("title"):orderid=request.form("orderid"):picpath=request.Form("picpath"):url=request.form("url"):classname=request.Form("classname")
	  if id="" or not isnumeric(id) then oa.msgshow("非法操作！")
	   if title=""  then oa.msgshow("链接标题不能为空！请返回重新输入！")
	   if url="" or instr(url,"http")<1  then oa.msgshow("链接地址不能为空,链接地址必须以“http“开头！请返回重新输入！")
	   if orderid="" or not isnumeric(orderid) then oa.msgshow("排序不能为空或格式不正确！请返回重新输入！ ")
	      set rs=oa.execute("select id from c_links where title='"&title&"' and classname='"&classname&"' and id<>"&id)
	      if not rs.eof then oa.msgshow("该链接标题已经存在！请返回重新添加")
	      rs.close
	    if not isobject(conn) then connectiondatabase
		  set rs=server.createobject("adodb.recordset")
		  rs.open "select * from c_links where id="&id,conn,1,3
		  if rs.eof then oa.msgshow("该记录不存在或已被删除！请返回重新选择！")
		  rs("title")=title
		  rs("picpath")=picpath
		  rs("url")=url
		  rs("orderid")=orderid
		  
	      rs.update()
		  rs.close
		  response.redirect("admin_link_manage.asp?classname="&classname)	
	End Sub
	 Sub linkdel() '删除支付方式
	   dim id,sFilepath,file
	   id=request("id")
	   if id="" or not isnumeric(id) then oa.msgshow("非法操作！")
	   set rs=oa.execute("select picpath from c_links where id="&id)
	   if rs.eof then oa.msgshow("该记录不存在或已被删除！请返回重新选择！")
	   if rs(0)<>"" then
	    set file=new filemanage
	    sFilepath=server.mappath(webdir&rs(0))
		file.deletefile sFilepath
	   end if
	   oa.execute("delete from c_links where id="&id)	
	   response.redirect("admin_link_manage.asp?classname="&request("classname"))
	 End Sub
	
	
	
	
	
	%>
	
	<% Sub main()
	dim i	%>
	<table width="99%" border="0" align="center" cellpadding="3" cellspacing="0">
   
        <tr>
          <td height="25" colspan="5" style="font-weight:bold" align="center" bgcolor="#F0F0F0"><%select case classname
		           case "gunimg"
				   response.Write("三维机械网站群")
				   case "centerimg"
				   response.Write("三维机械下属单位")
				   case "bottomimg"
				   response.write("官方媒体")
				   case "linkimg"
				   response.write("友情链接")
			end select%></td>
        </tr>
        <tr>
          <td height="21" align="center"><div align="center"><strong>标题</strong></div></td>
          <td align="center"><div align="center"><strong>链接图片</strong></div></td>
          <td align="center"><div align="center"><strong>链接地址</strong></div></td>
          <td align="center"><div align="center"><strong>排序</strong></div></td>
          <td align="center"><div align="center"><strong>操作</strong></div></td>
        </tr>
		<% 
		 set rs=oa.execute("select * from c_links where classname='"&classname&"' and (id<>8 and id<>9 and id<>10)")
		 i=0
		do while not rs.eof%>
		  <form action="admin_link_manage.asp" method="post" name="<%="myform"&i%>" id="subform" >
        <tr>
          <td>
            <div align="center">
              <input name="title" type="text" class="wenbenkuang" id="title" value="<%=rs(2)%>" size="18" />
            </div></td>
          <td><div align="center">
            <input name="picpath" type="text" class="wenbenkuang" id="picpath" value="<%=rs(3)%>" size="28" />
            <a onClick="if (<%="myform"&i%>.picpath.value!=''){alert('请删除文件后再进行上传')}else{window.open('../inchuayuwebrlzywzhyweb/upfile.asp?formname=<%="myform"&i%>&amp;editname=picpath&amp;uppath=upfile/index_links/','','status=no,scrollbars=no,top=20,left=110,width=300,height=150')}" href="#" class="a2">上传</a> <a href="#" onClick="window.open('../inchuayuwebrlzywzhyweb/upload.asp?formname=<%="myform"&i%>&amp;editname=picpath&amp;action=del&amp;filepath='+<%="myform"&i%>.picpath.value,'','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" class="a2">删除</a> <a href="#" onClick="open1('<%=webdir%>'+<%="myform"&i%>.picpath.value)" class="a2">浏览</a> </div></td>
          <td><div align="center">
            <input name="url" type="text" class="wenbenkuang" id="url" value="<%=rs(4)%>" size="28" />
          </div></td>
          <td align="center"><div align="center">
            <input name="orderid" type="text" class="wenbenkuang" id="orderid" size="4" value="<%=rs(5)%>" />
          </div></td>
          <td>
            <div align="center">
              <input type="submit" name="Submit2" value="修改" />
              <input type="button" name="Submit22" onClick="location.href='admin_link_manage.asp?action=del&id=<%=rs(0)%>&classname=<%=classname%>'" value="删除" />
              <input name="action" type="hidden" id="action" value="mod" />
              <input name="classname" type="hidden" id="classname" value="<%=classname%>" />
              <input name="id" type="hidden" id="id" value="<%=rs(0)%>" />
            </div></td>
        </tr>
	    </form>
		<%
		i=i+1
		 rs.movenext
		loop
		rs.close
		%>
       
		   <form action="admin_link_manage.asp" method="post" name="myform" id="form1" >
		 
        <tr>
          <td height="30" colspan="5" ><input name="title" type="text" class="wenbenkuang" id="title" size="18" />           
            <input name="picpath" type="text" class="wenbenkuang" id="picpath" size="28" /> 
           <a onClick="if (myform.picpath.value!=''){alert('请删除文件后再进行上传')}else{window.open('../inchuayuwebrlzywzhyweb/upfile.asp?formname=myform&amp;editname=picpath&amp;uppath=upfile/index_links/','','status=no,scrollbars=no,top=20,left=110,width=300,height=150')}" href="#" class="a2">上传</a> <a href="#" onClick="window.open('../inchuayuwebrlzywzhyweb/upload.asp?formname=myform&amp;editname=picpath&amp;action=del&amp;filepath='+myform.picpath.value,'','status=no,scrollbars=no,top=20,left=110,width=420,height=165')" class="a2">删除</a> <a href="#" onClick="open1('<%=webdir%>'+myform.picpath.value)" class="a2">浏览</a>
            <input name="url" type="text" class="wenbenkuang" id="url" value="http://" size="28" />    
            <input name="orderid" type="text" class="wenbenkuang" id="orderid" value="100" size="4"  />
            <input type="submit" name="Submit23" value="添加" />
            <input type="reset" name="Submit222"  value="重置" />
            <input name="classname" type="hidden" id="classname" value="<%=classname%>" />
            <input name="action" type="hidden" id="action" value="add" /></td>
          </tr>
      </form>
    </table>
<%End Sub%>
	</td>
  </tr>
</table>
<script language="javascript">
function open1(valu)
{
if (valu=="<%=webdir%>")
{
alert('您还没有上传图片');
}
else
{
window.open(valu,'','')
}
}
</script>

</body>
</html>

