<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="opendb.asp" -->
<%
Call CheckAdmin()
'Call CnkAdminRight(1)
Dim ShowLang
ShowLang=Trim(Request("ShowLang"))
if ShowLang<>"" then ShowLang=Clng(ShowLang) else ShowLang=Lang
thispage=request("page_code")
if thispage="" then
thispage=1
else
thispage=clng(thispage)
end if
if thispage<1 then thispage=1
PagePara="?ChannelID="&ChannelID&"&ShowLang="&ShowLang
Dim Action,Language,title,author,fromwhere,imagename,PageKeywords,PageDescription,outlink,content,id
'Dim newflag,recommend,ReadRight
Action=Trim(Request("Action"))
'Language=Trim(Request.Form("Language"))
title=Trim(Request.Form("title"))
author=Trim(Request.Form("author"))
fromwhere=Trim(Request.Form("fromwhere"))
'imagename=Trim(Request.Form("imagename"))
PageKeywords=Trim(Request.Form("PageKeywords"))
PageDescription=Trim(Request.Form("PageDescription"))
'outlink=Trim(Request.Form("outlink"))
content=Trim(Request.Form("content"))
content=replace(content,"'","""")
id=Trim(Request("id"))
'newflag=Trim(Request.Form("newflag"))
'recommend=Trim(Request.Form("recommend"))
'ReadRight=Trim(Request.Form("ReadRight"))
Call Head()
%>
<script language="javascript">
function
save_onclick()
{
document.form1.content.value=editor.HtmlEdit.document.body.innerHTML;
return true;
}
function cform(){
if(!confirm("您确认删除吗? 请注意删除后无法恢复!"))
return false;
}
</script>
<body>
<div class="cnkbox">
<% =GetChannelContent(ChannelID,"ChannelName")%>
管理导航: <a href="?ChannelID=<%= ChannelID %>">文章管理首页</a> | <a href="?ChannelID=<%= ChannelID %>&Action=Add">添加新文章</a></div>
<%
select case Action
case "saveadd"
Call SaveAdd()
case "savemodi"
Call SaveModi()
case "del"
Call AdminRight("DelAdmin",ChannelID,session("admin"))
Call del()
case ""
%>
<div class="cnkbox">
<div class="title">
<% =GetChannelContent(ChannelID,"ChannelName")%>
文章/新闻管理</div>
<% If Lang=2 Then %>
<a href="?ChannelID=<%=ChannelID%>">显示全部</a> <!--| <a href="?ChannelID=<%'=ChannelID%>&ShowLang=0">只显示中文</a> | <a href="?ChannelID=<%'=ChannelID%>&ShowLang=1">只显示英文</a>-->
<% End If %>
<% Dim ipage
sql="select id,title,initime from cnk_Article where ChannelID="&ChannelID
if ShowLang<>2 then sql=sql&" and Lang="&ShowLang
sql=sql&" order by initime desc"
rs.open sql,conn,1,3
if not rs.eof and not rs.bof then
'if rs.recordcount=0 then
'Response.Write "未有内容"
'Response.end
' else
rs.pagesize=20
if thispage>rs.pagecount then thispage=rs.pagecount
rs.AbsolutePage = thispage
%>
<table width="96%" border="0" cellpadding="3" cellspacing="1">
<tr bgcolor="#C2E0FE" align="center">
<td width="17%">时间</td>
<td width="58%">标题</td>
<td width="12%" align="center">修改</td>
<td width="13%" align="center">删除</td>
</tr>
<% for ipage=1 to rs.pagesize%>
<tr bgcolor="#F6F6F6"
onMouseOut="mOut(this,'#F6F6F6');" onMouseOver="mOvr(this,'#EBFFBB');">
<td><%=rs("initime")%> </td>
<td>
<%' If rs("Lang")=0 Then Response.Write("中") Else Response.Write("英")%>
<a href="?id=<%=rs("id")%>&ChannelID=<%=ChannelID%>&Action=modi"><%=rs("title")%> </a></td>
<td align="center"><a href="?id=<%=rs("id")%>&ChannelID=<%=ChannelID%>&ShowLang=<%= ShowLang %>&Action=modi">修改</a></td>
<td align="center"><a href="?id=<%=rs("id")%>&ChannelID=<%=ChannelID%>&ShowLang=<%= ShowLang %>&Action=del"
onclick="return cform()">删除</a></td>
</tr>
<%rs.movenext
if rs.eof then exit for
next%>
</table>
<table width="96%" height="21" border="0" background="images/bg-xg.gif" bgcolor="#EFEFEF">
<tr>
<td width="50%"><% = GetPageList(rs.pagecount,thispage,PagePara,0) %></td>
<td width="50%" align="right"> 共 <strong><%=rs.recordcount%></strong> 条
<% = GetPage(rs.pagecount,thispage,PagePara,0) %></td>
</tr>
</table>
<% rs.close
set rs=nothing
End If %>
</div>
<% Case "Add"
Call AdminRight("AddAdmin",ChannelID,session("admin"))%>
<form name="form1" method="post" action="Article.asp" onSubmit="return save_onclick()">
<div class="cnkbox">
<div class="title">
<% =GetChannelContent(ChannelID,"ChannelName")%>
添加文章</div>
<div class="content">
<div id="list">
<!-- <ul>
<li class="t1">选择语言:</li>
<li class="t2">
<%' If Lang=0 or Lang=2 Then %>
<input type="radio" name="Language" value="0" id="Lang1" checked="checked" />
<label for="Lang1">中文</label>
<%' End If %>
<%' If Lang=1 or Lang=2 Then %>
<input type="radio" name="Language" value="1" id="Lang2" <%' If Lang=1 Then Response.Write("checked=""checked""")%> />
<label for="Lang2">EngLish</label>
<% 'End If %>
</li>
</ul>-->
<ul>
<li class="t1">标题:</li>
<li class="t2">
<input name="title" type="text" class="input" id="title" size="30" maxlength="100" />
</li>
</ul>
<!--<ul>
<li class="t1">图片:</li>
<li class="t2">
<input name="imagename" type="text" class="input" id="imagename" value="http://" size="30" maxlength="100" />
<input type="button" name="Submit2" value="上传" onClick="window.open('upload_flash.asp?formname=form1&editname=imagename&uppath=upfiles&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
可用外部图片地址或上传图片 </li>
</ul>-->
<ul>
<li class="t1">作者:</li>
<li class="t2">
<input name="author" type="text" class="input" id="author" size="30" maxlength="20" />
</li>
</ul>
<ul>
<li class="t1">来源:</li>
<li class="t2">
<input name="fromwhere" type="text" class="input" id="fromwhere" size="30" maxlength="20" />
</li>
</ul>
<ul>
<li class="t1">关键词:</li>
<li class="t2">
<input name="PageKeywords" type="text" class="input" id="PageKeywords" size="30" maxlength="255" />
用逗号分隔,最多255字符 </li>
</ul>
<ul>
<li class="t1">内容描述:</li>
<li class="t2">
<input name="PageDescription" type="text" class="input" id="PageDescription" size="30" maxlength="255" />
用逗号分隔,最多255字符 </li>
</ul>
<!--
<ul>
<li class="t1">外部链接:</li>
<li class="t2">
<input name="outlink" type="text" class="input" id="outlink" size="30" maxlength="255" />
如填写本项,打开页面时将跳转到这个链接 </li>
<ul>
<li class="t1">重点图片:</li>
<li class="t2">
<input type="radio" name="newflag" value="1" id="newflag1">
<label for="newflag1">是</label>
<input name="newflag" type="radio" id="newflag2" value="0" checked>
<label for="newflag2">否</label>
(在调用代码时显示) </li>
</ul>
<ul>
<li class="t1">推荐:</li>
<li class="t2">
<input type="radio" name="recommend" value="1" id="recommend1">
<label for="recommend1">是</label>
<input name="recommend" type="radio" id="recommend2" value="0" checked>
<label for="recommend2">否</label>
(在调用代码时显示) </li>
</ul>
<ul>
<li class="t1">正文内容:</li>
<li class="t2"> <font color="#FF0000">·换行请按Shift+Enter
·另起一段请按Enter ·用|||设置分页符 </font><br />
<textarea name="content" style="display:none"></textarea>
<iframe ID="editor" src="editor.asp" frameborder=1 scrolling=no width="600" height="405"></iframe>
</li>
</ul>
<br />
<ul>
<li class="t1">
<input name="Action" type="hidden" id="Action" value="saveadd" />
<input name="ChannelID" type="hidden" id="ChannelID" value="<%= ChannelID %>" />
<input name="ShowLang" type="hidden" id="ShowLang" value="<%= ShowLang %>" />
</li>
<li class="t2">
<input name="提交" type="submit" class="button" value="提交" />
</li>
</ul>
<div class="clearboth"></div>
</div>
</div>
</div>
</form>
<% Case "modi"
Call AdminRight("ModiAdmin",ChannelID,session("admin"))
rs.open "select * from cnk_Article where id="&id,conn,1,3
%>
<form name="form1" method="post" action="Article.asp" onSubmit="return save_onclick()">
<div class="cnkbox">
<div class="title">
<% =GetChannelContent(ChannelID,"ChannelName")&" -- "%>
修改文章</div>
<div class="content">
<div id="list">
<!--<ul>
<li class="t1">选择语言:</li>
<li class="t2">
<% 'If Lang=0 or Lang=2 Then %>
<input type="radio" name="Language" value="0" id="Lang1" <%' If rs("Lang")=0 Then Response.Write("checked=""checked""")%> />
<label for="Lang1">中文</label>
<%'End If %>
<% 'If Lang=1 or Lang=2 Then %>
<input type="radio" name="Language" value="1" id="Lang2" <% 'If rs("Lang")=1 Then Response.Write("checked=""checked""")%> />
<label for="Lang2">EngLish</label>
<% 'End If %>
</li>
</ul>-->
<ul>
<li class="t1">标题:</li>
<li class="t2">
<input name="title" type="text" class="input" id="title" value="<%= rs("title") %>" size="30" maxlength="100" />
</li>
</ul>
<!-- <ul>
<li class="t1">图片:</li>
<li class="t2">
<input name="imagename" type="text" class="input" id="imagename" value="<%'= rs("imagename") %>" size="30" maxlength="100" />
<input type="button" name="Submit2" value="上传" onClick="window.open('upload_flash.asp?formname=form1&editname=imagename&uppath=upfiles&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
可用外部图片地址或上传图片 </li>
</ul>-->
<ul>
<li class="t1">作者:</li>
<li class="t2">
<input name="author" type="text" class="input" id="author" value="<%= rs("author") %>" size="30" maxlength="20" />
</li>
</ul>
<ul>
<li class="t1">来源:</li>
<li class="t2">
<input name="fromwhere" type="text" class="input" id="fromwhere" value="<%= rs("fromwhere") %>" size="30" maxlength="20" />
</li>
</ul>
<ul>
<li class="t1">关键词:</li>
<li class="t2">
<input name="PageKeywords" type="text" class="input" id="PageKeywords" value="<%= rs("Keywords") %>" size="30" maxlength="255" />
用逗号分隔,最多255字符 </li>
</ul>
<ul>
<li class="t1">内容描述:</li>
<li class="t2">
<input name="PageDescription" type="text" class="input" id="PageDescription" value="<%= rs("Description") %>" size="30" maxlength="255" />
用逗号分隔,最多255字符 </li>
</ul>
<!--
<ul>
<li class="t1">外部链接:</li>
<li class="t2">
<input name="outlink" type="text" class="input" id="outlink" value="<%'= rs("outlink") %>" size="30" maxlength="255" />
如填写本项,打开页面时将跳转到这个链接 </li>
</ul>
<ul>
<li class="t1">焦点:</li>
<li class="t2">
<input type="radio" name="newflag" value="1" id="newflag1" <%' If rs("newflag")=1 Then Response.Write("checked=""checked""")%>>
<label for="newflag1">是</label>
<input name="newflag" type="radio" id="newflag2" value="0" <%' If rs("newflag")=0 Then Response.Write("checked=""checked""")%>>
<label for="newflag2">否</label>
(在调用焦点时显示) </li>
</ul>
<ul>
<li class="t1">推荐:</li>
<li class="t2">
<input type="radio" name="recommend" value="1" id="recommend1" <%' If rs("recommend")=1 Then Response.Write("checked=""checked""")%>>
<label for="recommend1">是</label>
<input name="recommend" type="radio" id="recommend2" value="0" <%' If rs("recommend")=0 Then Response.Write("checked=""checked""")%>>
<label for="recommend2">否</label>
(在调用推荐时显示) </li>
</ul>
<ul>
<li class="t1">正文内容:</li>
<li class="t2"> <font color="#FF0000">·换行请按Shift+Enter
·另起一段请按Enter ·用|||设置分页符 </font><br />
<textarea name="content" style="display:none"></textarea>
<iframe ID="editor" src="editor.asp?table=cnk_Article&zd=content&id=<%= rs("id") %>" frameborder=1 scrolling=no width="600" height="405"></iframe>
</li>
</ul>
<br />
<ul>
<li class="t1">
<input name="Action" type="hidden" id="Action" value="savemodi" />
<input name="id" type="hidden" id="id" value="<%= rs("id") %>" />
<input name="ChannelID" type="hidden" id="ChannelID" value="<%= ChannelID %>" />
<input name="ShowLang" type="hidden" id="ShowLang" value="<%= ShowLang %>" />
</li>
<li class="t2">
<input name="提交" type="submit" class="button" value="提交" />
</li>
</ul>
<div class="clearboth"></div>
</div>
</div>
</div>
</form>
<%
rs.close
End Select
Call Closedb()
Sub SaveAdd()
sql="insert into cnk_Article"
sql=sql&" (ChannelID,title,author,fromwhere,Keywords,Description,content)"
sql=sql&" values ("&ChannelID&",'"&title&"','"&author&"','"&fromwhere&"','"&PageKeywords&"','"&PageDescription&"','"&content&"')"
conn.execute(sql)
Call alertmsg_url("添加成功","Article.asp?ChannelID="&ChannelID&"&ShowLang="&ShowLang)
End Sub
Sub SaveModi()
sql="update cnk_Article set"
sql=sql&" ChannelID="&ChannelID&",title='"&title&"',author='"&author&"',fromwhere='"&fromwhere&"',Keywords='"&PageKeywords&"',Description='"&PageDescription&"',content='"&content&"'where id="&id
conn.execute(sql)
Call alertmsg_url("修改成功","Article.asp?ChannelID="&ChannelID&"&ShowLang="&ShowLang)
End Sub
Sub del()
conn.execute("delete from cnk_Article where id="&id)
Call alertmsg_url("删除成功","Article.asp?ChannelID="&ChannelID&"&ShowLang="&ShowLang)
End Sub
%>
这个是添加和修改文章调用的页面代码