<!--#include file="admin_start.asp"-->

<%
dim object_id
dim qu
dim grade
dim show
dim i_s

object_id=trim(request("id_up"))

if not MySys.check.isInteger(object_id) then
MySys.error.info="请选择您新建广告所属的上级栏目！"
MySys.error.location="back"
MySys.error.err()
end if

set rs_t=conn.execute("select object_id,object_print,object_name,object_template from jins_object_list where object_id="&object_id&" and object_insert=1")
if rs_t.eof then
MySys.error.info="您不能在这个栏目下加入广告！"
MySys.error.location="back"
MySys.error.err()
end if

if request.form("ads_width")<>"" then
if not MySys.check.isInteger(request.form("ads_width")) then
MySys.error.info="广告的宽度请填入整数！"
MySys.error.location="javascript:history.back(-1)"
MySys.error.err()
end if
end if

if request.form("ads_height")<>"" then
if not MySys.check.isInteger(request.form("ads_height")) then
MySys.error.info="广告的高度请填入整数！"
MySys.error.location="javascript:history.back(-1)"
MySys.error.err()
end if
end if

'广告栏目模版
ads_template=rs_t("object_template")&"_ads"
set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If Not objFSO.FileExists(Server.MapPath("../"&MySys.info.folder_object&"/" & ads_template & ".asp")) Then ads_template="template_ads"
set objFSO=nothing

ads_print=rs_t("object_print")&"_"&rs_t("object_name")
ads_print=replace(ads_print,"root_","")
set rs_t=nothing

'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
rs.open "select * from jins_object_list",conn,1,3
rs.addnew
rs("object_description")=request.form("object_description")
rs("object_up")=object_id
rs("object_template")=ads_template
rs("object_print")=ads_print
rs("object_name")="ads"
rs("object_class")="object"
rs("object_customer_grade")=">=|-1|0"
rs("object_open")=1
rs("object_open_temp")=1
rs("object_num")=1
rs("object_num_temp")=1
rs("object_ads")=1
rs("object_qu")=-1
rs.update
id_object=rs("object_id")
rs.close

'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

rs.open "select * from jins_site_ads ",conn,1,3
rs.addnew
rs("object_id")=id_object
rs("ads_alt")=request.form("ads_alt")
rs("ads_width")=request.form("ads_width")
rs("ads_height")=request.form("ads_height")
rs("ads_url")=request.form("ads_url")
rs("ads_src")=request.form("ads_src")
if rs("ads_src")<>"" then
	if instr(1,rs("ads_src"),"http://")=0 then
		set im=MySys.image
		ims=im.showimage(server.mappath("../"&rs("ads_src")),rs("ads_width"),rs("ads_height"))
		rs("ads_width")=ims(0)
		rs("ads_height")=ims(1)
		set im=nothing
	end if
end if
rs("ads_flash")=int(request.form("ads_flash"))
rs("ads_style")=request.form("ads_style")
rs("ads_addtime")=now()
rs("ads_open")=1
'rs("ads_num")=1
rs.update
rs.close

session("FB_EM_1_SQL_uppath")=""

MySys.error.info="新增广告栏目成功！"
MySys.error.location="admin/admin_site_ads_list.asp"
MySys.error.suc()
%>
<!--#include file="admin_end.asp"-->