<!--#include file="../setting/conn.asp"--><%:SoonBiz.chkadmin:jinlan="<a href='?'>频道管理</a>":act=SoonBiz.ract():Select Case act:Case "" : main():Case "ghost" : channelinfo(1) :Case "saveghost" : saveinfo (1):Case "delghost" : del:Case "delout" : delout :Case "savenew" : saveinfo(0) :Case "creatnew" : channelinfo (0) :Case "saveedit" : saveinfo (2):Case "edit" : channelinfo (2):Case "set" : setcha :Case "saveset" : saveset :End Select:SoonBiz.AdFoot():Setallnothing:Sub main():SoonBiz.Loadtemplatesadmin("admin_channel"):Dim sql:sql="select * from ["& sheethead &"_channel] order by cha_use desc,cha_show desc,cha_cls asc,id asc":SoonBiz.title="频道管理-http://www.wedonet.com":SoonBiz.adhead:SoonBiz.nstate(jinlan):htmlstr=template.html(1):HtmlStr=Replace(HtmlStr,"{$trhtml}", SoonBiz.ReplaceMdb("频道管理",sql,template.html(2),"",1)):Response.Write htmlstr:End Sub:Sub channelinfo(mytype):Dim action
If mytype=0 Then
jinlan=jinlan & " - 添加外部频道":action="?act=savenew"
Elseif mytype=1 Then
jinlan=jinlan & " - 克隆系统频道":action="?act=saveghost&id="&SoonBiz.rid("id")
elseif mytype=2 Then
jinlan=jinlan & " - 编辑频道":action="?act=saveedit&id="&SoonBiz.rid("id")
End If:SoonBiz.LoadTemplatesAdmin("admin_channel"):SoonBiz.title="频道管理":SoonBiz.adhead:SoonBiz.nstate(jinlan):HtmlStr=Template.Html(3):HtmlStr=Replace(HtmlStr,"{$action}",action):Response.Write HtmlStr
If mytype=2 or mytype=1 Then
Dim sql,rs:id=SoonBiz.rid("id"):sql="select * from "& sheethead &"_channel where id="&id:Set rs=SoonBiz.Execute(sql)
If rs.eof Then
ShowErr("1018")
End If:Response.write "<script type=""text/javascript"">":Response.Write " CheckInput('cha_name','"& Rs("cha_name") &"');":Response.Write " CheckInput('preimg','"& Rs("preimg") &"');":Response.Write " CheckInput('cha_title','"& Rs("cha_title") &"');":Response.Write " CheckInput('cha_tags','"& Rs("cha_tags") &"');":Response.Write " CheckInput('cha_readme','"& Rs("cha_readme") &"');":Response.Write " CheckInput('cha_url','"& Rs("cha_url") &"');":Response.Write " CheckInput('cha_cls','"& Rs("cha_cls") &"');":Response.Write " CheckSel('cha_opentype','"& Rs("cha_opentype") &"');":Response.Write " CheckSel('cha_show','"& Rs("cha_show") &"');":Response.Write " CheckSel('cha_use','"& Rs("cha_use") &"');"':::herboth::nowtheir^/"saidmightmostlikeourbeenhere
If clng(Rs("cha_moduleid"))=8 or clng(Rs("cha_moduleid"))=9 Then 
Response.Write " getobj(""chashow"").style.display='none';":Response.Write " getobj(""chaopen"").style.display='none';"
End If:Response.Write "</script>"
End If:End Sub:Sub saveinfo(mytype):Dim cha_name,cha_readme,cha_url,cha_opentype,cha_show,cha_type,cha_cls,preimg,cha_title:Dim cha_dir,cha_tname,cha_unit,cha_use:Dim cha_tags:Dim rsid:Dim SourceDir,SourceID:Dim rs:cha_name=SoonBiz.Requeststr("Keywords","cha_name","post",1,1,255,30,1):preimg=SoonBiz.Requeststr("频道图标","preimg","post",1,1,255,30,0):cha_title=SoonBiz.Requeststr("Title","cha_title","post",1,1,255,30,0):cha_tags=SoonBiz.Requeststr("关键词","cha_tags","post",1,1,255,30,0):cha_readme=SoonBiz.Requeststr("Description","cha_readme","post",1,1,255,30,0):cha_url=SoonBiz.Requeststr("链接地址","cha_url","post",1,1,255,30,1):cha_opentype=SoonBiz.rid("cha_opentype"):cha_show=SoonBiz.rid("cha_show"):cha_cls=SoonBiz.rid("cha_cls"):cha_use=SoonBiz.rid("cha_use"):ShowErr(""):SoonBiz.connectionDatabase
If mytype=2 Then 
id=SoonBiz.rid("id"):Set rs=server.CreateObject("adodb.recordset"):rs.open "select * from "& sheethead &"_channel where id="&id,conn,1,3'only:hadfromthesemanyofgot:here":stillhave:sincehis~:
Elseif mytype=1 Then 
Dim rssourcechannel:Set rsid=SoonBiz.execute("select Max(id) from "& sheethead &"_channel"):id=rsid(0)
If id<100 Then id=100
id=id+1:Set rsid=Nothing :Set rssourcechannel=SoonBiz.execute("select * from "& sheethead &"_channel where id="&SoonBiz.rid("id")):Set rs=server.CreateObject("adodb.recordset"):rs.open ""& sheethead &"_channel",conn,1,3 :rs.addnew:rs("id")=id:rs("cha_type")=1:rs("cha_url")=rssourcechannel("cha_url"):rs("cha_dir")=rssourcechannel("cha_dir")&rs(0):rs("cha_set")=rssourcechannel("cha_set"):rs("cha_moduleid")=rssourcechannel("id"):rs("cha_page")=rssourcechannel("cha_page"):rs("cha_cachegap")=rssourcechannel("cha_cachegap"):rs("cha_cachekeep")=rssourcechannel("cha_cachekeep"):rs("cha_viewcls")=rssourcechannel("cha_viewcls"):rs("cha_postcls")=rssourcechannel("cha_postcls"):Rs("cha_field")=rssourcechannel("cha_field"):Rs("preimg")=rssourcechannel("preimg"):Rs("cha_relate")="1,"&id:SourceDir=rssourcechannel("cha_dir"):SourceID=rssourcechannel("id"):Set rssourcechannel=Nothing
Elseif mytype=0 Then 
Set rsid=SoonBiz.execute("select Max(id) from "& sheethead &"_channel"):cid=rsid(0)'otherorbyby:"any:::anout:outneverher:@{
If cid<100 Then cid=100
cid=cid+1:Set rsid=Nothing:Set rs=server.CreateObject("adodb.recordset"):rs.open ""& sheethead &"_channel",conn,1,3:rs.addnew:rs("id")=cid:rs("cha_type")=2 
End If:Rs("cha_name")=cha_name:Rs("preimg")=preimg:Rs("cha_title")=cha_title:Rs("cha_tags")=cha_tags:Rs("cha_readme")=cha_readme:Rs("cha_url")=cha_url:Rs("cha_opentype")=cha_opentype:Rs("cha_show")=cha_show:Rs("cha_cls")=cha_cls:Rs("cha_use")=cha_use:rs.update:rs.close:Set rs=Nothing:SoonBiz.LoadChannel():SoonBiz.loadcachenum (0)
If mytype=1 Then
copytemplate SoonBiz.rid("id"),id
End If:SoonBiz.nok:End Sub:Sub copytemplate(channelid1,channelid2):Dim i,sql,rs:Dim rsnew:Dim arrsstyle :Dim rspage_1,rsstr_1:Dim rspage,rsstr:Set rs=SoonBiz.execute("select id from "& sheethead &"_styleclass order by id asc"):arrsstyle=rs.getrows(-1):Rs.Close:Set Rs=Nothing:SoonBiz.ConnectionDatabase:Set rspage=server.CreateObject("adodb.recordset"):Set rsstr=server.CreateObject("adodb.recordset"):For i=0 To ubound(arrsstyle,2):Set rspage_1=SoonBiz.Execute("select * from "& sheethead &"_page where styleid=1 and cid="& channelid1 &" order by id asc"):Do While Not rspage_1.eof :rspage.open sheethead & "_page",conn,1,3:rspage.addnew:rspage("cid")=channelid2:rspage("styleid")=arrsstyle(0,i):rspage("title")=rspage_1("title"):rspage("readme")=rspage_1("readme"):rspage.update:Set rsstr_1=SoonBiz.execute("select * from "& sheethead &"_style where styleid=1 and pageid="&rspage_1("id")&" order by id asc"):Do While Not rsstr_1.eof:rsstr.open sheethead & "_style",conn,1,3:rsstr.addnew:rsstr("cid")=channelid2:rsstr("styleid")=arrsstyle(0,i):rsstr("pageid")=rspage("id"):rsstr("pagename")=rsstr_1("pagename"):rsstr("title")=rsstr_1("title"):rsstr("readme")=rsstr_1("readme"):rsstr("str")=rsstr_1("str"):rsstr.update:rsstr.close:rsstr_1.movenext:Loop:rspage.close:rspage_1.movenext:Loop:Next:Set rspage_1=Nothing:Set rsstr_1=Nothing:Set rspage=Nothing:Set rsstr=Nothing:SoonBiz.loadchannel():SoonBiz.Loadstyle():SoonBiz.loadcachenum (0):End Sub:Sub del():Dim sql,i,rs:id=SoonBiz.rid("id")':'}'betweensuchthat'&at%each:also:"couldmorebeing
If id < 11 and id<>2 Then
ShowErr("系统频道禁止删除")
End If:SoonBiz.execute ("delete from "& sheethead &"_channel where id="&id)
If act="delghost" Then
sql="delete from "& sheethead &"_article where cid="&id:SoonBiz.execute(sql):SoonBiz.execute ("delete from "& sheethead &"_class where cid="&id):SoonBiz.execute("delete from "& sheethead &"_topic where cid="&id):SoonBiz.execute("delete from "& sheethead &"_page where cid="&id):SoonBiz.execute("delete from "& sheethead &"_style where cid="&id):SoonBiz.execute("update "& sheethead &"_uplist set isdel=1 where cid="&id)
End If:SoonBiz.loadchannel():SoonBiz.Loadclass():SoonBiz.Loadstyle():SoonBiz.loadcachenum (0):SoonBiz.ok:End Sub:Sub delout():Dim sql:sql="delete from "& sheethead &"_channel where id="&SoonBiz.rid("id"):SoonBiz.execute(sql):SoonBiz.loadchannel():SoonBiz.loadcachenum (0):SoonBiz.ok:End Sub:Sub setcha():Dim rs,sql:Dim cha_name,cha_page,cha_cachegap,cha_cachekeep,cha_field,cha_type,cha_relate:Dim cha_viewcls,cha_postcls,cha_searchcls:Dim fieldother,fieldname,mustfill:Dim i:id=SoonBiz.rid("id"):sql="select cha_name,cha_page,cha_cachegap,cha_cachekeep,cha_viewcls,cha_postcls,cha_field,cha_type,cha_relate,cha_searchcls from "& sheethead &"_channel where id="&id:Set rs=SoonBiz.Execute(sql):cha_name=rs(0):cha_page=rs(1):cha_cachegap=rs(2):cha_cachekeep=rs(3):cha_viewcls=rs(4):cha_postcls=rs(5):cha_field=rs(6):cha_type=rs(7):cha_relate=rs(8):cha_searchcls=rs(9)':::::seeitshould/!him:::~':came"
If cint(cha_type)=2 Then
ShowErr("外部频道没有参数")
End If:cha_field=split(cha_field,"|"):fieldother=split(cha_field(2),","):mustfill=split(cha_field(3),","):fieldname=split(cha_field(4),","):rs.close:Set rs=Nothing:SoonBiz.adhead:SoonBiz.nstate(cha_name&"参数设置"):Response.Write "<form method=""post"" action=""?act=saveset&id="& id &""">":Response.Write "<table cellspacing=1 class=tableborder1>":Response.Write "<th colspan=2>频道参数设置</th>":Response.Write "<tr>":Response.Write " <td width=""45%"">列表页每页显示记录数</td>":Response.Write " <td width=""55%""><input type=""text"" id=""cha_page"" name=""cha_page"" size=""3"" value="""& cha_page &""" /></td>":Response.Write "</tr>":Response.Write "<tr>":Response.Write " <td>网页缓存最少保留时间(分)</td>":Response.Write " <td><input type=""text"" id=""cha_cachegap"" name=""cha_cachegap"" size=""4"" maxlength=""4"" value="""& cha_cachegap &""" /></td>":Response.Write "</tr>":Response.Write "<tr>":Response.Write " <td>显示产品字段</td>":Response.Write " <td>":Response.Write " <select id=""fieldproduct"" name=""fieldproduct"">":Response.Write " <option value=""1"">是,显示</option>":Response.Write " <option value=""0"">否,不显示</option>":Response.Write " </select>":Response.Write " </td>":Response.Write "</tr>":Response.Write "<tr>":Response.Write " <td>显示下载字段</td>":Response.Write " <td>":Response.Write " <select id=""fielddownload"" name=""fielddownload"">":Response.Write " <option value=""1"">是,显示</option>":Response.Write " <option value=""0"">否,不显示</option>":Response.Write " </select>":Response.Write " </td>":Response.Write "</tr>":For i=1 To 5:Response.Write "<tr>":Response.Write " <td>显示附加字段"& i &",是否必填,字段名称</td>":Response.Write " <td>":Response.Write " <select id=""fieldother"& i &""" name=""fieldother"& i &""">":Response.Write " <option value=""1"">是,显示</option>":Response.Write " <option value=""0"">否,不显示</option>":Response.Write " </select>":Response.Write " <select id=""mustfill"& i &""" name=""mustfill"& i &""">":Response.Write " <option value=""0"">选填</option>":Response.Write " <option value=""1"">必填</option>":Response.Write " </select>":Response.Write " <input type=""text"" id=""filedname"& i &""" name=""filedname"& i &""" size=""20"" />":Response.Write " </td>":Response.Write "</tr>":Next:Response.Write "<tr valign=top>":Response.Write " <td>浏览权限</td>":Response.Write " <td>"& makecls_channel("cha_viewcls",cha_viewcls) &"</td>":Response.Write "</tr>":Response.Write "<tr valign=top>":Response.Write " <td>添加权限</td>":Response.Write " <td>"& makecls_channel("cha_postcls",cha_postcls) &"</td>":Response.Write "</tr>":Response.Write "<tr valign=top>":Response.Write " <td>搜索权限</td>":Response.Write " <td>"& makecls_channel("cha_searchcls",cha_searchcls) &"</td>":Response.Write "</tr>":Response.Write "<tr valign=top>":Response.Write " <td>关联频道<br /><u>本频道更新时,同时刷新关联频道的缓存</u></td>":Response.Write " <td>"& make_relate(cha_relate,id) &"</td>":Response.Write "</tr>":Response.Write "</table>":Response.Write "<div class=""operate""><input type=""submit"" value=""保存"" /></div>":Response.Write "</form>":SoonBiz.ostate("<li>添加权限和字段设置只对有内容列表的频道有效,例如:文章,新闻,产品频道.</li><li>网页缓存最少保留时间:在此时间内,网站更新也不刷新缓存.一般设为0即可(更新内容自动刷新缓存).对于访问量巨大的网站可以设的长一些.</li>"):Response.Write "<script type=""text/javascript"">":Response.Write "CheckSel(""fieldproduct"","""& cha_field(0) &""");":Response.Write "CheckSel(""fielddownload"","""& cha_field(1) &""");":For i=1 To 5:Response.Write "CheckSel(""fieldother"& i &""","""& fieldother(i-1) &""");":Response.Write "CheckSel(""mustfill"& i &""","""& mustfill(i-1) &""");":Response.Write "getobj(""filedname"& i &""").value="""&fieldname(i-1) &""";":Next:Response.Write "</script>":End Sub:Sub saveset():Dim sql,i:Dim cha_page,cha_cachegap,cha_cachekeep,cha_field,cha_relate:Dim cha_viewcls,cha_postcls,cha_searchcls:For i=1 To 5
If instr(Request.Form("filedname"&i),",")>0 or instr(Request.Form("filedname"&i),"|")>0 Then
ShowErr("字段"&i&"中有非法字段")
End If:Next:cha_page=SoonBiz.RequestStr("每页显示记录数","cha_page","post",0,1,999,0,1):cha_cachegap=SoonBiz.RequestStr("网页缓存最少保留时间","cha_cachegap","post",0,0,2880,0,1):cha_viewcls=Trim(Request.Form("cha_viewcls")):cha_postcls=Trim(Request.Form("cha_postcls")):cha_searchcls=Trim(Request.Form("cha_searchcls")):cha_relate=Trim(Request.Form("cha_relate")):cha_viewcls=Replace(cha_viewcls," ",""):cha_postcls=Replace(cha_postcls," ",""):cha_searchcls=Replace(cha_searchcls," ",""):cha_relate=Replace(cha_relate," ",""):cha_field=SoonBiz.rid("fieldproduct") & "|":cha_field=cha_field & SoonBiz.rid("fielddownload") &"|":cha_field=cha_field & SoonBiz.rid("fieldother1") & ",":cha_field=cha_field & SoonBiz.rid("fieldother2") & ",":cha_field=cha_field & SoonBiz.rid("fieldother3") & ",":cha_field=cha_field & SoonBiz.rid("fieldother4") & ",":cha_field=cha_field & SoonBiz.rid("fieldother5") & "|":cha_field=cha_field & SoonBiz.rid("mustfill1") & ",":cha_field=cha_field & SoonBiz.rid("mustfill2") & ",":cha_field=cha_field & SoonBiz.rid("mustfill3") & ",":cha_field=cha_field & SoonBiz.rid("mustfill4") & ",":cha_field=cha_field & SoonBiz.rid("mustfill5") & "|":cha_field=cha_field & Trim(Request.Form("filedname1")) & ",":cha_field=cha_field & Trim(Request.Form("filedname2")) & ",":cha_field=cha_field & Trim(Request.Form("filedname3")) & ",":cha_field=cha_field & Trim(Request.Form("filedname4")) & ",":cha_field=cha_field & Trim(Request.Form("filedname5")):ShowErr(""):sql="update "& sheethead &"_channel set ":sql=sql & "cha_page="&cha_page:sql=sql & ",cha_cachegap="&cha_cachegap:sql=sql & ",cha_viewcls='"& cha_viewcls &"'":sql=sql & ",cha_postcls='"& cha_postcls &"'":sql=sql & ",cha_searchcls='"& cha_searchcls &"'":sql=sql & ",cha_relate='"& cha_relate &"'":sql=sql & ",cha_field='"& SoonBiz.Checkstr(cha_field) &"'":sql=sql & " where id="&SoonBiz.rid("id"):SoonBiz.Execute(sql):SoonBiz.loadchannel():SoonBiz.loadcachenum (0):SoonBiz.nok:End Sub:Function makecls_channel(obj,str):Dim node:Dim ischecked:Dim fuyou:For Each node In application(CacheName & "_group").documentElement.childNodes':#_::"after::takefrom:cameother:many:onstill
If SoonBiz.ins(str,node.getAttribute("id")) Then
ischecked=" checked=""checked"" "
Else:ischecked=""
End If:fuyou=fuyou & "<li><input type='checkbox' name='"& obj &"' value='"&node.getAttribute("id")&"' "&ischecked&">"&node.getAttribute("title")&" </li>":Next:makecls_channel=fuyou:End Function:Function make_relate(str,thiscid):Dim node:Dim ischecked:Dim fuyou:For Each node In application(CacheName & "_channel").documentElement.childNodes
If clng(node.getAttribute("cha_type"))<2 Then 
If (SoonBiz.ins(str,node.getAttribute("id")) or clng(node.getAttribute("id"))=clng(thiscid)) Then'=::%'^is:doithassomethese:getheover:there
ischecked=" checked=""checked"" "
Else:ischecked=""
End If:fuyou=fuyou & "<li><input type='checkbox' name='cha_relate' value='"&node.getAttribute("id")&"' "&ischecked&">"&node.getAttribute("cha_name")&" </li>"
End If:Next:make_relate=fuyou:End Function
%>