<%
call admin_master(0,0)
call admin_cid_sid()
call admin_header(0,0)
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?'>模块列表</a></td>
  <td width=10></td>
  <td><a href='?action=add'<%if action="add" then response.write " class=red"%>>添加模块</a></td>
  <td width=10></td>
  <td><a href='?action=mInput'<%if action="mInput" then response.write " class=red"%>>导入模块</a></td>
  <td width=10></td>
  <td><a href='?action=mExport'<%if action="mExport" then response.write " class=red"%>>导出模块</a></td>
  <td width=10></td>
  <td><a href='admin_<% response.write index_url%>_gather.asp'>数据采集</a></td>
  </tr>
  </table>
</td></tr>
</table>
<%
if jk_mod="edit" then a_e="编辑" else a_e="添加" end if
if action="handle" then call joekoe_go_handle()
select case action
case "clear"
  call joekoe_go_clear()
case "add"
  call admin_table(1,1)
  call joekoe_chk_add()
case "add1"
  call admin_table(1,1)
  call joekoe_chk_add1()
case "add2"
  call admin_table(1,1)
  call joekoe_chk_add2()
case "add3"
  call admin_table(1,1)
  call joekoe_chk_add3()
case "ok_test"
  call admin_table(1,1)
  call joekoe_chk_ok_test()
case "edit"
  call admin_table(1,1)
  call joekoe_chk_edit()
case "Export"
 call admin_table(1,1)
 call joekoe_chk_Export()
case "input"
 call joekoe_chk_input()
case "mExport"
 call admin_table(1,1)
 call joekoe_chk_mExport()
case "mInput"
 call joekoe_chk_mInput()
case else
  call admin_table(1,0)
  call joekoe_chk_main()
end select

call admin_ender(1)

sub joekoe_chk_edit()
end sub

sub joekoe_chk_add()
  dim Name,FromName,FromUrl,ColumnID,PicValue,PicPath,PicType,FalshValue,FalshPath,FalshType,MusicValue,MusicPath,MusicType,OtherValue,OtherPath,OtherType,ManyPage,StructureLog,itemname
  if jk_mod="edit" then
    id=Isform(request.QueryString("id"),"数字","数据传递")
	sql="select * from [DB_Item] where id="&id
    call joekoe_cms.exec(sql,-1)
	rs.open sql,conn,1,1
	if rs.eof then
		Response.Write("<script language='JavaScript'>alert('数据传递出错！');history.go(-1);</script>")
		response.End()
	else
		FromUrl=rs("FromUrl")
		FromName=rs("FromName")
		ItemName=rs("ItemName")
		CID=rs("C_ID")
		SID=rs("S_ID")
		PicPath=rs("PicPath")
		PicValue=rs("PicValue")
		FalshPath=rs("FalshPath")
		FalshValue=rs("FalshValue")
		MusicPath=rs("MusicPath")
		MusicValue=rs("MusicValue")
		OtherPath=rs("OtherPath")
		OtherValue=rs("OtherValue")
		ManyPage=rs("Manypage")
		PicType=rs("PicType")
		FalshType=rs("FalshType")
		MusicType=rs("MusicType")
		OtherType=rs("OtherType")
		StructureLog=rs("StructureLog")
	end if
	rs.close
  end if
  call admin_td(a_e&tit_fir)

  if chk() then
   Name=isform(request.Form("Name"),"字符","新模块名称")
   FromName=isform(request.Form("FromName"),"字符","目标web名称")
   FromUrl=isform(request.Form("FromUrl"),"字符","目标web地址")
   csid=trim(request.form("c_id"))
    if cs_nd(csid)=false then
      call admin_error("请选择 "&tit_fir&"分类 ！")
      exit sub
    end if
   PicValue=request.Form("PicValue")
if PicValue<>0 then
	PicPath=request.Form("PicPath")
	PicType=replace(LCase(request.Form("PicType")),"，",",")
end if
   FalshValue=REQUEST.Form("FalshValue")
if FalshValue<>0 then
	FalshPath=request.Form("FalshPath")
	FalshType=replace(LCase(request.Form("FalshType")),"，",",")
end if
   MusicValue=request.Form("MusicValue")
if MusicValue<>0 then
	MusicPath=REQUEST.Form("MusicPath")
	MusicType=replace(LCase(request.Form("MusicType")),"，",",")
end if
   OtherValue=request.Form("OtherValue")
if OtherValue<>0 then
	OtherPath=request.Form("OtherPath")
	OtherType=replace(LCase(request.Form("OtherType")),"，",",")
end if
   ManyPage=request.Form("ManyPage")
if ManyPage=1 then
	ManyPage=true
else
	ManyPage=false
end if
StructureLog=isform(request.Form("StructureLog"),"字符","新模块说明")

    call chk_cid_sid()
    if jk_mod="edit" then
    sql="select * from  [DB_Item] where id="&id
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,1,3
	else
    sql="select * from  [DB_Item]"
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,1,3
    rs.addnew
	end if
    rs("c_id")=cid
    rs("s_id")=sid
    rs("ItemName")=Name
	rs("FromName")=FromName
	rs("FromUrl")=FromUrl
		if PicValue<>0 then
			rs("PicPath")=PicPath
		else
			rs("PicPath")=""
		end if
		rs("PicValue")=PicValue
		if FalshValue<>0 then
			rs("FalshPath")=FalshPath
		else
			rs("FalshPath")=""
		end if
		rs("FalshValue")=FalshValue
		if MusicValue<>0 then
			rs("MusicPath")=MusicPath
		else
			rs("MusicPath")=""
		end if
		rs("MusicValue")=MusicValue
		if OtherValue<>0 then
			rs("OtherPath")=OtherPath
		else
			rs("OtherPath")=""
		end if
	rs("OtherValue")=OtherValue
	rs("ManyPage")=ManyPage
	rs("StructureLog")=StructureLog
	rs("nsort")=index_url
	rs.update
	id=rs("id")
    rs.close
  if jk_mod<>"edit" then
			sql="select * from [DB_Dome]" 
            call joekoe_cms.exec(sql,-1)
            rs.open sql,conn,2,3
            dim DBarray,ddim
			DBarray=split(DB_array,"|")
			for i=0 to ubound(DBarray)
				rs.addnew
				rs("ItemID")=id
				ddim=split(dbarray(i),":")
				rs("ColumnID")=ddim(0)
				rs("Columncname")=ddim(1)
				rs("Columnename")=ddim(2)
				rs("mid")=ddim(3)
				rs("ColumnV")=ddim(4)
				rs("ColumnD")=ddim(5)
				rs("ColumnY")=ddim(6)
				rs.update
			next
            rs.close
  end if
    call admin_msg("已成功第一步操作！","?action=add1&jk_mod="&jk_mod&"&id="&id,1)
    exit sub
  end if
  call form_first()

if jk_mod="edit" then
  call module_menu()
end if
%>
<form name=add_frm action='?action=add&id=<%=id%>&jk_mod=<%=jk_mod%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td>模块名称：</td>
<td><input type=text name=name size=30 maxlength=30 value="<%=ItemName%>"><%response.write redx%>&nbsp;&nbsp;所属分类：<%call chk_csid(nsort,cid,sid)%></td>
</tr>
<tr>
<td><%response.write tit_fir%>目标web名称：</td>
<td><input type=text name=fromname size=30 maxlength=30 value="<%=fromname%>"><%response.write redx%>&nbsp;&nbsp;<%response.write tit_fir%>目标web地址：<input type=text name=fromurl size=30 maxlength=250 value="<%=fromurl%>"><%response.write redx%></td>
</tr>
<tr>
<td><%response.write tit_fir%>目标说明：</td>
<td>被采集的<%response.write tit_fir%>中是否包含分页  <input name="ManyPage" type="checkbox" id="ManyPage" value="1" <%if ManyPage then response.Write("checked")%>><BR><textarea name=StructureLog rows=5 cols=50><%=StructureLog%></textarea></td>
</tr>
<tr>
<td>图片保存地址：</td>
<td><input name="PicPath" type="text" value="" value="<%=PicPath%>">&nbsp;&nbsp;保存类型： 
              <select name="PicValue" id="PicValue">
                <option value="0" <%if PicValue=0 then response.Write("selected")%>>不保存</option>
                <option value="1" <%if PicValue=1 then response.Write("selected")%>>040728022626_19702.gif</option>
                <option value="2" <%if PicValue=2 then response.Write("selected")%>>040728\040728022626_19702.gif</option>
                <option value="3" <%if PicValue=3 then response.Write("selected")%>>04-07-28\040728022626_19702.gif</option>
              </select></td>
</tr>
<tr>
<td>图片限制：</td>
<td><input name="flashType" type="text" id="flashType" value="gif,jpg,bmp,png" size="40" value="<%=PicType%>">多个以,分开;例：gif,jpg</td>
</tr>
<tr>
<td>Falsh保存地址：</td>
<td><input name="flashPath" type="text" value="" value="<%=FalshPath%>">&nbsp;&nbsp;保存类型： 
              <select name="flashValue" id="flashValue">
                <option value="0" <%if FalshValue=0 then response.Write("selected")%>>不保存</option>
                <option value="1" <%if FalshValue=1 then response.Write("selected")%>>040728022626_19702.swf</option>
                <option value="2" <%if FalshValue=2 then response.Write("selected")%>>040728\040728022626_19702.swf</option>
                <option value="3" <%if FalshValue=3 then response.Write("selected")%>>04-07-28\040728022626_19702.swf</option>
              </select></td>
</tr>
<tr>
<td>Falsh限制：</td>
<td><input name="flashType" type="text" id="flashType" value="swf" size="40" value="<%=FalshType%>">多个以,分开;例：gif,jpg</td>
</tr>
<tr>
<td>音乐保存地址：</td>
<td><input name="musicPath" type="text" value="" value="<%=MusicPath%>">&nbsp;&nbsp;保存类型： 
              <select name="musicValue" id="musicValue">
                <option value="0" <%if MusicValue=0 then response.Write("selected")%>>不保存</option>
                <option value="1" <%if MusicValue=1 then response.Write("selected")%>>040728022626_19702.mp3</option>
                <option value="2" <%if MusicValue=2 then response.Write("selected")%>>040728\040728022626_19702.mp3</option>
                <option value="3" <%if MusicValue=3 then response.Write("selected")%>>04-07-28\040728022626_19702.mp3</option>
              </select></td>
</tr>
<tr>
<td>音乐限制：</td>
<td><input name="musicType" type="text" id="musicType" value="mp3" size="40" value="<%=MusicType%>">多个以,分开;例：gif,jpg</td>
</tr>
<tr>
<td>其它保存地址：</td>
<td><input name="otherPath" type="text" value="" value="<%=OtherPath%>">&nbsp;&nbsp;保存类型： 
              <select name="otherValue" id="otherValue">
                <option value="0" <%if OtherValue=0 then response.Write("selected")%>>不保存</option>
                <option value="1" <%if OtherValue=1 then response.Write("selected")%>>040728022626_19702.*</option>
                <option value="2" <%if OtherValue=2 then response.Write("selected")%>>040728\040728022626_19702.*</option>
                <option value="3" <%if OtherValue=3 then response.Write("selected")%>>04-07-28\040728022626_19702.*</option>
              </select></td>
</tr>
<tr>
<td>其它限制：</td>
<td><input name="otherType" type="text" id="otherType" value="js" size="40" value="<%=OtherType%>">多个以,分开;例：gif,jpg</td>
</tr>
<%
  call submit_add()
end sub

sub joekoe_chk_add1()
 dim fromurl,submit,Articlelist1,Articlelist2
 id=Isform(request.QueryString("id"),"数字","数据传递")
    sql="select * from [DB_Item] where id="&id
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,1,1
	if rs.eof then
		Response.Write("<script language='JavaScript'>alert('数据传递出错！');history.go(-1);</script>")
		response.End()
	else
		Articlelist1=rs("Articlelist1")
		Articlelist2=rs("Articlelist2")
		FromUrl=rs("FromUrl")
	end if
    rs.close
submit=request.Form("submit")
if submit="测试" then
call admin_td(a_e&tit_fir&"第二步（测试）")
Articlelist1=Isform(request.Form("Articlelist1"),"字符",tit_fir&"列表标记开始代码")
Articlelist2=Isform(request.Form("Articlelist2"),"字符",tit_fir&"列表标记结束代码")
else
  call admin_td(a_e&tit_fir&"第二步")
  if chk() then
    Articlelist1=Isform(request.Form("Articlelist1"),"字符",tit_fir&"列表标记开始代码")
    Articlelist2=Isform(request.Form("Articlelist2"),"字符",tit_fir&"列表标记结束代码")
    sql="select * from [DB_Item] where id="&id
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,2,3
	rs("Articlelist1")=Articlelist1
	rs("Articlelist2")=Articlelist2
    rs.update
    rs.close
    call admin_msg("已成功进行"&tit_fir&"第二步操作！","?action=add2&jk_mod="&jk_mod&"&id="&id,1)
    exit sub
  end if
end if
  call form_first()
  if jk_mod="edit" then
    call module_menu()
  end if
if submit="测试" then
%>
<tr>
<td colspan=2>
			<%
			dim webstr
			webstr=Cls.BytesToBstr(Cls.getHTTPPage(FromUrl),"GB2312")
			webstr=Cls.stripHTML(webstr,Articlelist1,Articlelist2)
			response.Write(webstr)
			%>
</td>
</tr>
<%end if%>
<form name=add_frm action='?action=add1&jk_mod=<%=jk_mod%>&id=<%=id%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td><%response.write tit_fir%>列表标记开始代码：</td>
<td><TEXTAREA name="Articlelist1" cols="60" rows="8" id="Articlelist1"><%=Articlelist1%></TEXTAREA></td>
</tr>
<tr>
<td><%response.write tit_fir%>列表标记结束代码：</td>
<td><TEXTAREA name="Articlelist2" cols="60" rows="8" id="Articlelist2"><%=Articlelist2%></TEXTAREA></td>
</tr>

<tr>
<td></td>
<td height=30><INPUT name="Submit" type="submit" id="Submit" value="测试">&nbsp;&nbsp;<INPUT type="submit" name="Submit2" value="保存"></td>
</tr></form>
</table>
<%
end sub

sub joekoe_chk_add2()
 dim fromurl,submit,Articlelist1,Articlelist2,Addresslist,Addresslist1,Addresslist2
 id=Isform(request.QueryString("id"),"数字","数据传递")
 sql="select * from [DB_Item] where id="&id
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,1,1
	if rs.eof then
		Response.Write("<script language='JavaScript'>alert('数据传递出错！');history.go(-1);</script>")
		response.End()
	else
		FromUrl=rs("FromUrl")
		Addresslist=rs("Addresslist")
		Articlelist1=rs("Articlelist1")
		Articlelist2=rs("Articlelist2")
		Addresslist1=rs("Addresslist1")
		Addresslist2=rs("Addresslist2")
	end if
	rs.close
submit=request.Form("submit")
if submit="测试" then
call admin_td(a_e&tit_fir&"第三步（测试）")
Addresslist1=Isform(request.Form("Addresslist1"),"字符",tit_fir&"列表地址标记开始代码")
Addresslist2=Isform(request.Form("Addresslist2"),"字符",tit_fir&"列表地址标记结束代码")
Addresslist=request.Form("Addresslist")
else
    call admin_td(a_e&tit_fir&"第三步")
  if chk() then
    Addresslist1=Isform(request.Form("Addresslist1"),"字符",tit_fir&"列表地址标记开始代码")
    Addresslist2=Isform(request.Form("Addresslist2"),"字符",tit_fir&"列表地址标记结束代码")
    Addresslist=request.Form("Addresslist")
    sql="select * from [DB_Item] where id="&id
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,2,3
	rs("Addresslist")=Addresslist
	rs("Addresslist1")=Addresslist1
	rs("Addresslist2")=Addresslist2
    rs.update
    rs.close
    call admin_msg("已成功进行"&tit_fir&"第三步操作！","?action=add3&jk_mod="&jk_mod&"&id="&id,1)
    exit sub
  end if
end if
  call form_first()
  if jk_mod="edit" then
    call module_menu()
  end if
if submit="测试" then
%>
<tr>
<td colspan=2>
            <%
			dim webstr
			webstr=Cls.BytesToBstr(Cls.getHTTPPage(FromUrl),"GB2312")
			webstr=Cls.stripHTML(webstr,Articlelist1,Articlelist2)
			webstr=Cls.SeparateHTML(webstr,Addresslist1,Addresslist2)
			webstr=Cls.HttpUrls(Addresslist&webstr,FromUrl)
			response.Write("<a href="&webstr&" target=""_blank"">"&webstr&"</a>")
			%> 
</td>
</tr>
<%end if%>
<form name=add_frm action='?action=add2&id=<%=id%>&jk_mod=<%=jk_mod%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td><%response.write tit_fir%>列表地址标记开始代码：</td>
<td><TEXTAREA name="Addresslist1" cols="60" rows="8" id="Addresslist1"><%=Addresslist1%></TEXTAREA></td>
</tr>
<tr>
<td><%response.write tit_fir%>列表标记地址结束代码：</td>
<td><TEXTAREA name="Addresslist2" cols="60" rows="8" id="Addresslist2"><%=Addresslist2%></TEXTAREA></td>
</tr>
<tr>
<td><%response.write tit_fir%>列表标记地址添加代码：</td>
<td><input name="Addresslist" type="text" id="Addresslist" value="<%=Addresslist%>" size="60"></td>
</tr>
<tr>
<td></td>
<td height=30><INPUT name="Submit" type="submit" id="Submit" value="测试">&nbsp;&nbsp;<INPUT type="submit" name="Submit2" value="保存"></td>
</tr></form>
</table>
<%
end sub

sub joekoe_chk_add3()
Dim MarkingA,MarkingB,Marking,dome_id
ID=Isform(request.QueryString("id"),"数字","数据传递")
Dome_ID=request.Form("Dome_ID")
Dome_ID=Split(Dome_ID,",")
'response.write ubound(Dome_ID)
'response.end
Dim DB_Nows()
Redim DB_Nows(ubound(Dome_ID))
  for i=0 to ubound(Dome_ID)
	DB_Nows(i)=request.Form("nows"&(i+1))
	if request.Form("ColumnY"&(i+1))="y" then
		if trim(request.Form("DB_CodeA"&(i+1)))="" or trim(request.Form("DB_CodeB"&(i+1)))="" then
			Response.Write("<script language='JavaScript'>alert('第["&i+1&"]组定义标签，不可以为空！');history.go(-1);</script>")
			response.End()
		end if
	end if
  next
    call admin_td(a_e&tit_fir&"第四步")
  if chk() then
    dim ii
	for i=0 to ubound(Dome_ID)
	sql="select * from [DB_Dome] where id="&Dome_ID(i)&""
    call joekoe_cms.exec(sql,-1)
	rs.open sql,conn,2,3
	ii=i+1
			rs("MID")=request.Form("nows"&ii)
			rs("MarkingA")=request.Form("DB_CodeA"&ii)
			rs("MarkingB")=request.Form("DB_CodeB"&ii)
			rs("Marking")=request.Form("DB_Code"&ii)
	rs.update
	rs.close
	next
    call admin_msg("采集设置成功 \n 确定进行测试...","?action=ok_test&jk_mod="&jk_mod&"&id="&id,1)
    exit sub
  end if
  call form_first()
  if jk_mod="edit" then
    call module_menu()
  end if
%>
<SCRIPT language=javascript1.2>
function showsubmenu(sid,isa)
{
	if (isa.value== 0)
		{
			eval("DBS" + sid + ".style.display=\"none\";");
			eval("DB" + sid + ".style.display=\"none\";");
		}else{
			if (isa.value== 1)
			{
				eval("DBS" + sid + ".style.display=\"\";");
				eval("DB" + sid + ".style.display=\"none\";");
			}else{
				eval("DB" + sid + ".style.display=\"\";");
				eval("DBS" + sid + ".style.display=\"none\";");
			}
	
		}
}
</SCRIPT>
<form name=add_frm action='?action=add3&jk_mod=<%=jk_mod%>&id=<%=id%>' method=post>
<input type=hidden name=chk value='yes'>
<TR> 
<TD colspan=2>
<%
dim ColumnID,ColumnCName,ColumnEName,MMID,ColumnY
sql="select * from [DB_Dome] where ItemID="&ID
call joekoe_cms.exec(sql,-1)
rs.open sql,conn,1,2
do while not rs.eof
	MMID=rs("MID")
	Columnid=rs("Columnid")
	ColumnCName=rs("ColumnCName")
	ColumnEName=rs("ColumnEName")
	EMarkingA=trim(rs("MarkingA")&" ")
	EMarkingB=trim(rs("MarkingB")&" ")
	EMarking=trim(rs("Marking")&" ")
	ColumnY=(rs("ColumnY"))
	call ArticleTitle(Columnid,ColumnCName&"-"&ColumnEName,MMID,rs("id"),"",ColumnY)
rs.movenext
loop
%>
</td>
</tr>
<tr>
<td height=30 colspan=2><INPUT name="Submit" type="submit" id="Submit" value="保存/下一步"></td>
</tr></form>
</table>
<%
end sub

sub joekoe_chk_ok_test()
    dim FromUrl,ManyPage,Articlelist1,Articlelist2,Addresslist1,Addresslist2,Addresslist
    ID=Isform(request.QueryString("id"),"数字","数据传递")
    sql="select * from [DB_Item] where id="&id
    call joekoe_cms.exec(sql,-1)
	rs.open sql,conn,1,1
	if rs.eof then
		Response.Write("<script language='JavaScript'>alert('数据传递出错！');history.go(-1);</script>")
		response.End()
	else
		FromUrl=rs("FromUrl")
		ManyPage=rs("ManyPage")
		Articlelist1=rs("Articlelist1")
		Articlelist2=rs("Articlelist2")
		Addresslist1=rs("Addresslist1")
		Addresslist2=rs("Addresslist2")
		Addresslist=rs("Addresslist")
	end if
	rs.close
  if chk() then
    call admin_msg("数据已保存 \n 现在进行采集...","admin_"&index_url&"_gather.asp?id="&id,1)
    exit sub
  end if
  call form_first()
  call admin_td("采集内容测试")
%>
<form name=add_frm action='?action=ok_test&id=<%=id%>' method=post>
<input type=hidden name=chk value='yes'>
<TR> 
<TD colspan=2>
            <%
			dim webstr,webstr1
			webstr=Cls.BytesToBstr(Cls.getHTTPPage(FromUrl),"GB2312")
			webstr=Cls.stripHTML(webstr,Articlelist1,Articlelist2)
			webstr=Cls.SeparateHTML(webstr,Addresslist1,Addresslist2)
			webstr=Cls.HttpUrls(Addresslist&webstr,FromUrl)
			webstr1=webstr
			webstr=Cls.BytesToBstr(Cls.getHTTPPage(webstr),"GB2312")
			sql="select * from [DB_Dome] where ItemID="&ID
            call joekoe_cms.exec(sql,-1)
			rs.open sql,conn,1,2
			do while not rs.eof
				MarkingA=trim(rs("MarkingA")&" ")
				MarkingB=trim(rs("MarkingB")&" ")
				Marking=trim(rs("Marking")&" ")
				response.Write("<strong><font color=""#0000FF"">")
				response.Write(rs("ColumnCname")&":")
				response.Write("</strong></font>")
				if Marking<>"" then
					response.Write(Marking)
				else
					response.Write(Cls.SeparateHTML(webstr,MarkingA,MarkingB))
				end if
				response.Write("<br><br>")
			rs.movenext
			loop
			response.Write("<strong><font color=""#0000FF"">")
			response.Write("采集地址：")
			response.Write("</strong></font>")
			response.Write("<a href="&webstr1&" target=""_blank"">"&webstr1&"</a>")
			response.Write("<br><br>")
			response.Write("<hr>")
			%>
</td>
</tr>
<tr>
<td height=30 colspan=2><INPUT name="Submit" type="submit" id="Submit" value="保存/下一步"></td>
</tr></form>
</table>
<%
end sub

sub joekoe_chk_main()
  dim name,types,pageurl2
  dim button,catch_data
  pageurl2=pageurl
  sql_add=" where nsort='"&index_url&"' "
  call sql_cid_sid(sql_add)
  button=request.Form("sel_type")
  if button="删除" then
  catch_data=isform(request.Form("sel_id"),"","选项")
	sql="delete from [DB_Item] where id in("&catch_data&")" 
	Set rs= Server.CreateObject("ADODB.Recordset") 
	rs.open sql,Conn,1,3
	sql="delete from [DB_Dome] where Itemid in("&catch_data&")" 
	Set rs= Server.CreateObject("ADODB.Recordset") 
	rs.open sql,Conn,1,3
	response.Redirect("?")
   end if
%>
<form name=sel_form action='?jk_mod=<%response.write jk_mod%>&action=handle&c_id=<%response.write cid%>&s_id=<%response.write sid%>' method=post>
<TR align=center> 
<TD width="5%" class=td>编号</TD>
<TD width="20%" class=td>模块名称</TD>
<TD width="15%" class=td>所属栏目</TD>
<TD width="15%" class=td>采集目标</TD>
<TD width="15%" class=td>创建日期</TD>
<TD width="3%" class=td>图</TD>
<TD width="3%" class=td>动</TD>
<TD width="3%" class=td>音</TD>
<TD width="3%" class=td>其</TD>
<TD width="15%" class=td>操作</TD>
<TD width="3%" class=td><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);"></TD>
</TR>
<%
  sql="select count(id) from [DB_Item] "&sql_add
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  call format_pagecute()
  sql="select top "&nummer*viewpage&" * from [DB_Item] "&sql_add&" order by id desc"
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,1
  if int(viewpage)>1 then rs.move (viewpage-1)*nummer
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
  for i=1 to nums
    id=rs("id")
%>
<tr align=center>
<td class=tims><%response.write (viewpage-1)*nummer+i%></td>
<td><a href='?action=add&jk_mod=edit&id=<%response.write id%>'><%=rs("ItemName")%></a></td>
<td>
			  <%
			 dim temprs
			 Set TempRs = Conn.Execute("Select * from jk_Class where C_ID = " & rs("C_ID") & "")
			 if TempRs.eof then
			 else
			 response.Write(TempRs("C_Name"))
			 end if
			  %>
</td>
<td><%response.Write("<A href="""&rs("FromUrl")&""" target=""_blank"">"&rs("FromName")&"</a>")%></TD>
  <td align=right><font class=tims><%response.write joekoe_cms.time_type(rs("ItemTime"),4)%></font></td>
  <TD>
			  <%
			  if rs("PicValue")=0 then
				  response.Write("假")
			  else
				  response.Write("真")
			  end if
			  %>
  </TD>
  <TD>
			  <%
			  if rs("FalshValue")=0 then
				  response.Write("假")
			  else
				  response.Write("真")
			  end if
			  %>
  </TD>
  <TD>
			  <%
			  if rs("MusicValue")=0 then
				  response.Write("假")
			  else
				  response.Write("真")
			  end if
			  %>
  </TD>
  <TD>
			  <%
			  if rs("OtherValue")=0 then
				  response.Write("假")
			  else
				  response.Write("真")
			  end if
			  %>
  </TD>
  <TD> <a href="?action=add&jk_mod=edit&id=<%=rs("id")%>">修改</a>&nbsp;<a href="#" title="<%=rs("StructureLog")%>">看备注</a></TD>
  <td><input type=checkbox name=sel_id value='<%response.write id%>'></td>
</tr>
<%
    rs.movenext
  next
  rs.close
%>
<tr class=tr1>
<td colspan=4>
现有<font class=red><%response.write rssum%></font>个<%response.write tit_fir%>，
页次：<font class=red><%response.write viewpage%></font>/<font class=red><%response.write thepages%></font>
分页：<%response.write jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")%>
</td>
<td colspan=7 align=center>
执行
<select name=sel_type size=1>
<option value='删除'>删除</option>
</select>
<input type=submit value='操作' onclick="return sel_click(this.form);">
</td>
</tr>
</form>
<%
end sub

sub ArticleTitle(ccid,Title,MMid,Dome_ID,readonly,ColumnY)
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td colspan="2"> 
					<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid #D6D3CE">
                      <tr> 
                      <td width="50%"><strong><font color="#0000FF">第<%=ccid%>组 </font><font color="#FF0000"><%=Title%>标记</font></strong></td>
                      <td align="left"><input type=hidden name=ColumnY<%=ccid%> value='<%=ColumnY%>'>
                      <input type="radio" name="nows<%=ccid%>" value=0 onClick="showsubmenu(<%=ccid%>,this)"
			  <%
			  if mmid=0 then
                 response.write "<input type=""radio"" name=""nows"&ccid&""" value=0 onClick=""showsubmenu("&ccid&",this)"" checked>&nbsp;不需要操作&nbsp;&nbsp;<input type=""radio"" name=""nows"&ccid&""" value=1 onClick=""showsubmenu("&ccid&",this)"">&nbsp;定义标签&nbsp;&nbsp;<input type=""radio"" name=""nows"&ccid&""" value=2 onClick=""showsubmenu("&ccid&",this)"">&nbsp;指定固定值&nbsp;&nbsp;<input name=""Dome_ID"" type=""hidden"" id=""Dome_ID"" value="""&Dome_ID&""">"
			  elseif mmid=1 then
                 response.write "<input type=""radio"" name=""nows"&ccid&""" value=0 onClick=""showsubmenu("&ccid&",this)"" disabled>&nbsp;不需要操作&nbsp;&nbsp;<input type=""radio"" name=""nows"&ccid&""" value=1 onClick=""showsubmenu("&ccid&",this)"" checked>&nbsp;定义标签&nbsp;&nbsp;<input type=""radio"" name=""nows"&ccid&""" value=2 onClick=""showsubmenu("&ccid&",this)"">&nbsp;指定固定值&nbsp;&nbsp;<input name=""Dome_ID"" type=""hidden"" id=""Dome_ID"" value="""&Dome_ID&""">"
			  else
                 response.write "<input type=""radio"" name=""nows"&ccid&""" value=0 onClick=""showsubmenu("&ccid&",this)"" disabled>&nbsp;不需要操作&nbsp;&nbsp;<input type=""radio"" name=""nows"&ccid&""" value=1 onClick=""showsubmenu("&ccid&",this)"" disabled>&nbsp;定义标签&nbsp;&nbsp;<input type=""radio"" name=""nows"&ccid&""" value=2 onClick=""showsubmenu("&ccid&",this)"" checked>&nbsp;指定固定值&nbsp;&nbsp;<input name=""Dome_ID"" type=""hidden"" id=""Dome_ID"" value="""&Dome_ID&""">"
			  end if
              %>
                        </td>
                      </tr>
                    </table></td>
          </tr>
          <tr> 
            <td colspan="2" id='DBS<%=ccid%>' style="display=
			<%
			if mmid=1 then
			     response.Write("""")
			else
				 response.Write("'none'")
			end if
			 %>"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr > 
                  
            <td width="50%" valign="top"><%=Title%>标记开始代码：</td>
                  
            <td width="50%"> 
              <TEXTAREA name="DB_CodeA<%=ccid%>" cols="60" rows="8" <%=readonly%>><%=EMarkingA%></TEXTAREA>
            </td>
                </tr>
                <tr> 
                  
            <td width="50%" valign="top"><%=Title%>标记结束代码：</td>
                  
            <td width="50%"> 
              <TEXTAREA name="DB_CodeB<%=ccid%>" cols="60" rows="8" id="DB_CodeB<%=ccid%>" <%=readonly%>><%=EMarkingB%></TEXTAREA>
            </td>
                </tr>
              </table>
              </td>
          </tr>
          <tr id='DB<%=ccid%>' style="display=
		  <%
		  if mmid=2 then
			   response.Write("""")
		  else
			   response.Write("'none'")
		  end if
		   %>"> 
            
                  <td width="48%">指定<%=Title%>：</td>
                  <td> 
                    <input name="DB_Code<%=ccid%>" type="text" value="<%=EMarking%>" size="50" <%=readonly%>>
                  </td>
          </tr>
        </table>
<%
end sub
sub joekoe_chk_mInput()
 dim temp_type,DataPath
 Temp_Type=Trim(request.QueryString("Type"))
if chk() then
 if Temp_Type="1" then
	DataPath=request.Form("DataPath")
	call CData1(DataPath)
	session("DBUG")="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &DataPath
	dim Conn_Temp,Connstr_Temp
    call form_first()
    call admin_table(1,0)
%>
<script language="JavaScript" type="text/JavaScript">
<!--
function checkdeletetion(){
   if (!confirm("你确定要删除选中的模块么？") == false )
       document.forms.form1.submit();
}
-->
</script>
<form name="form1" method="post" action="?action=mInput&type=2">
<input type=hidden name=chk value='yes'>
<TR align=center> 
<TD width="5%" class=td>编号</TD>
<TD width="20%" class=td>模块名称</TD>
<TD width="15%" class=td>采集目标</TD>
<TD width="15%" class=td>创建日期</TD>
<TD width="3%" class=td>图</TD>
<TD width="3%" class=td>动</TD>
<TD width="3%" class=td>音</TD>
<TD width="3%" class=td>其</TD>
<TD width="15%" class=td>采集多页</TD>
<TD width="3%" class=td><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);"></TD>
</TR>
<%
        dim sum
		sum=0
		Set Conn_Temp = Server.CreateObject("ADODB.Connection")
		Conn_Temp.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &DataPath
		sql="select * from [DB_Item] where  nsort='"&index_url&"' " 
		Set rs= Server.CreateObject("ADODB.Recordset") 
		rs.open sql,Conn_Temp,1,1
		do while not rs.eof
		sum=sum+1
		%>
            <TR> 
              <TD><%=sum%></TD>
              <TD><%=rs("ItemName")%></TD>
			  <TD>
			  <%
			  response.Write("<A href="""&rs("FromUrl")&""" target=""_blank"">"&rs("FromName")&"</a>")
			  %>
			  </TD>
              <TD><%=rs("ItemTime")%></TD>
			  <TD>
			  <%
			  if rs("PicValue")=0 then
				  response.Write("假")
			  else
				  response.Write("真")
			  end if
			  %>
			  </TD>
			  <TD>
			  <%
			  if rs("FalshValue")=0 then
				  response.Write("假")
			  else
				  response.Write("真")
			  end if
			  %>
			  </TD>
			  <TD>
			  <%
			  if rs("MusicValue")=0 then
				  response.Write("假")
			  else
				  response.Write("真")
			  end if
			  %>
			  </TD>
			  <TD>
			  <%
			  if rs("OtherValue")=0 then
				  response.Write("假")
			  else
				  response.Write("真")
			  end if
			  %>
			  </TD>
			  <TD>
			  <%
			  if not rs("ManyPage") then
				  response.Write("假")
			  else
				  response.Write("真")
			  end if
			  %>
			  </TD>
              <td><input type=checkbox name=sel_id value='<%response.write rs("id")%>'></td>
            </TR>
		<%rs.movenext
		  loop
		  %>
<tr class=tr1>
<td colspan=10 align=center>
&nbsp; <INPUT onclick="checkdeletetion();" type=button value=  删除模块设置   name=button>&nbsp;<input name="button" type="submit" id="button" value="导入模块设置">
</td>
</tr>
</form>
</TABLE>
	<%
 elseif Temp_Type="2" then
   dim button,catch_data,Temp_arr
   button=request.Form("button")
   catch_data=isform(request.Form("sel_id"),"","选项")
   Set Conn_Temp = Server.CreateObject("ADODB.Connection")
   Conn_Temp.Open session("DBUG")
   Temp_arr=array(1,2,3,4,5,6,7,8,9,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31)
   if button<>"导入模块设置" then
	sql="delete from [DB_Item] where id in("&catch_data&")" 
	Set rs= Server.CreateObject("ADODB.Recordset") 
	rs.open sql,Conn_Temp,1,3
	sql="delete from [DB_Dome] where Itemid in("&catch_data&")" 
	Set rs= Server.CreateObject("ADODB.Recordset") 
	rs.open sql,Conn_Temp,1,3
	response.Redirect("?action=mInput&type=1")
   else
        dim rs_Temp,rs_Temp1,Id_Temp
		sql="select * from [DB_Item] where id in("&catch_data&") and nsort='"&index_url&"' "
		Set rs_Temp= Server.CreateObject("ADODB.Recordset") 
		rs_Temp.open sql,Conn_Temp,1,1
		if rs_Temp.eof then
          call admin_msg(tit_fir&"ID不存在！","?action=mInput&type=1",1)
          exit sub
		else
			do while not rs_Temp.eof
					Id=rs_Temp(0)
					sql="select * from [DB_Item]" 
					Set rs= Server.CreateObject("ADODB.Recordset") 
					rs.open sql,Conn,2,3
					rs.addnew
						for i=0 to rs_Temp.Fields.count-1
						select case i
						case 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
							rs(rs_Temp.Fields(i).name)=rs_Temp(i)
						end select
						next
					rs.update
					sql="select top 1 id from [DB_Item] order by id desc" 
						Set rs= Server.CreateObject("ADODB.Recordset") 
						rs.open sql,Conn,1,1
						if not rs.eof then
					    Id_Temp=rs(0)
						end if
					sql="select * from [DB_Dome] where ItemID="&Id&"" 
					Set rs_Temp1= Server.CreateObject("ADODB.Recordset") 
					rs_Temp1.open sql,Conn_Temp,1,1
					if rs_Temp1.eof then
						response.Write("导入失败！您的 "&rs_Temp(1)&" 模块设置设置不对！")
						sql="select * from [DB_Item] where id="&Id_Temp&"" 
						Set rs= Server.CreateObject("ADODB.Recordset") 
						rs.open sql,Conn_Temp,2,3
						if not rs.eof then
							rs.delete
							rs.update
						end if
						response.End()
					else
						do while not rs_Temp1.eof
								sql="select * from [DB_Dome]" 
								Set rs= Server.CreateObject("ADODB.Recordset") 
								rs.open sql,conn,2,3
								rs.addnew
									for i=0 to rs_Temp1.Fields.count-1
									select case i
									case 2,3,4,5,6,7,8,9,10,11,12
										rs(rs_Temp1.Fields(i).name)=rs_Temp1(i)
									case 1
										rs(rs_Temp1.Fields(i).name)=Id_Temp
									end select
									next
								rs.update
						rs_Temp1.movenext
						loop
					end if
             call admin_msg(rs_Temp(1)&"模块设置导入成功！","?action=mInput",1)
             exit sub
			rs_Temp.movenext
			loop
             call admin_msg("导入完成，请对导入的模块进行详细设置，后在使用！","?action=mInput",1)
             exit sub
		end if
   end if
 end if
 exit sub
end if
  call admin_table(1,1)
  call admin_td("导入模块")
  call form_first()
%>
<form name="form1" method="post" action="?action=mInput&type=1">
<input type=hidden name=chk value='yes'>
<TR> 
<TD colspan=2 height=50 align=center>
模块数据库地址：<input name="DataPath" type="text" id="DataPath" value="DB_MODULE.MDB">
</TD>
</TR>
<TR>
<td></td>
<TD align=right><input type="submit" name="Submit" value="下一步"></TD>
</TR>
</TABLE>
</form>
<%
end sub

sub joekoe_chk_mExport()
dim dome_id,datapath,rs_Temp,Id_Temp
Dome_Id=request.Form("Dome_Id")
DataPath=request.Form("DataPath")
if chk() then
	call CData1(DataPath)
	dim Conn_Temp,Connstr_Temp
	Set Conn_Temp = Server.CreateObject("ADODB.Connection")
	Connstr_Temp="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &DataPath
	Conn_Temp.Open Connstr_Temp
	DataPath=request.Form("DataPath")
		sql="select * from [DB_Item] where id="&dome_id&"" 
		Set rs= Server.CreateObject("ADODB.Recordset") 
		rs.open sql,conn,1,1
		if rs.eof then
		else
				sql="select * from [DB_Item]" 
				Set rs_Temp= Server.CreateObject("ADODB.Recordset") 
				rs_Temp.open sql,Conn_Temp,2,3
				rs_Temp.addnew
					for i=0 to rs.Fields.count-1
					select case i
					case 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
						rs_Temp(rs.Fields(i).name)=rs(i)
					end select
					next
				rs_Temp.update
				Id_Temp=rs_Temp(0)
				sql="select * from [DB_Dome] where ItemID="&dome_id&"" 
				Set rs= Server.CreateObject("ADODB.Recordset") 
				rs.open sql,conn,1,1
				if rs.eof then
					response.Write("导出失败！您的模块设置设置不对！")
					sql="select * from [DB_Item] where id="&Id_Temp&"" 
					Set rs_Temp= Server.CreateObject("ADODB.Recordset") 
					rs_Temp.open sql,Conn_Temp,2,3
					if not rs_Temp.eof then
						rs_Temp.delete
						rs_Temp.update
					end if
					response.End()
				else
					do while not rs.eof
							sql="select * from [DB_Dome]" 
							Set rs_Temp= Server.CreateObject("ADODB.Recordset") 
							rs_Temp.open sql,Conn_Temp,2,3
							rs_Temp.addnew
								for i=0 to rs.Fields.count-1
								select case i
								case 2,3,4,5,6,7,8,9,10,11,12
									rs_Temp(rs.Fields(i).name)=rs(i)
								case 1
									rs_Temp(rs.Fields(i).name)=Id_Temp
								end select
								next
							rs_Temp.update
					rs.movenext
					loop
				end if
			response.Write("<br>")	
			response.Write("&nbsp;&nbsp;&nbsp;&nbsp;模块设置导出成功！")
			response.Write("<br>")
			response.Write("&nbsp;&nbsp;&nbsp;&nbsp;模块路径："&DataPath)
        call admin_msg(tit_fir&"导出成功！\n\n模块数据库名称："&DataPath,"?action=mExport",1)
        exit sub
		end if
end if
  call admin_td("导出模块")
  call form_first()
%>
<form name="form1" method="post" action="?action=mExport">
<input type=hidden name=chk value='yes'>
<TR> 
<TD colspan=2 height=50>
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="3">
    <TR align=center> 
<td>选择模块名称：<select name="Dome_Id" id="Dome_Id">
                <%
				sql="select * from [DB_Item]" 
				Set rs= Server.CreateObject("ADODB.Recordset") 
				rs.open sql,conn,1,1
				do while not rs.eof
				response.Write("<option value="&rs("id")&">"&rs("ItemName")&"</option>")
				rs.movenext
				loop
			  %>
</select></td>
<td>模块数据库地址：<input name="DataPath" type="text" id="DataPath" value="DB_MODULE.MDB">
</TD>
          </TR>
        </TABLE>
</TD>
</TR>
<TR>
<td></td>
<TD align=right><input type="submit" name="Submit" value="确定导出"></TD>
</TR>
</form>
</TABLE>
<%
end sub

Function CData1(dbPath)
On Error Resume Next
dbPath = server.mappath(dbPath)
if Err Then
Response.Write("<script language='JavaScript'>alert('数据库路径不正确！请仔细检查路径！');history.go(-1);</script>")
err.Clear
exit function
End If
dim conn0,connstr0
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(dbPath) Then
Set fso = Nothing
On Error Resume Next
connstr0="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath
Set conn0=Server.CreateObject("ADODB.CONNECTION")
conn0.open connstr0
conn0.close
set conn0=nothing
if Err Then
Response.Write("<script language='JavaScript'>alert('提供的数据库，格式不对！');history.go(-1);</script>")
err.Clear	
End If
Else
Response.Write("<script language='JavaScript'>alert('数据库路径不正确！请仔细检查路径！');history.go(-1);</script>")
End If
fso.close
set fso=nothing
End Function

function module_menu()
%>
<tr><td colspan=2>
<TABLE width="100%" border=0 align=center cellPadding=4 bgColor=#ffffff>
<TBODY>
<TR> 
<TD>·栏目模块设置</TD>
<TD align="right"><A href="?">模块列表</A> 
                  <a href="?action=add&id=<%=id%>&jk_mod=edit" <% if action="add" then response.write "class=red" %>>模块基本设置</A>
                  <a href="?action=add1&id=<%=id%>&jk_mod=edit" <% if action="add1" then response.write "class=red" %>>采集<%response.write tit_fir%>列表</a> 
                  <A href="?action=add2&id=<%=id%>&jk_mod=edit" <% if action="add2" then response.write "class=red" %>>采集<%response.write tit_fir%>联接</A> 
                  <A href="?action=add3&id=<%=id%>&jk_mod=edit" <% if action="add3" then response.write "class=red" %>>采集<%response.write tit_fir%>正文内容</A> 
                  高级过滤条件 
                  <a href="?action=ok_test&jk_mod=edit&id=<%=id%>">测试</a></TD>
</TR>
</TBODY>
</TABLE>
</td></tr>
<%
end function
%>