|
|
7227117
发表于 2011-8-2 05:08:00
|
显示全部楼层
加入了这个文件出问题大家帮看下
不加的<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>话.后台的文章页面是?号.生成出来的东西除了内容是中文外,其它分类标题都是?号.加了后.生成HTML的文章.只能生成出来HTML的扩展名文件.但里面没有内容.是零字节
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--#include file="../Conn.asp"-->
<!--#include file="../webconfig.asp"-->
<!--#include file="../include/Char.asp"-->
<!--#include file="../include/Const.asp"-->
<!--#include file="../include/function.asp"-->
<!--#include file="creat_inc.asp"-->
<%
' 检查用户权限
CheckFlag( "5|1|" & Request("Grade") & "" )
dim i
dim rs,rst
dim mTypeName,mGrade,mSql,mFlag,mBgColor
dim mSmallCategoryID,mBigCategoryID
Dim mTemplatePath,mTemplateAllPath
Dim mNewsContent,mAllPath,mFileName,mPathDir
'initialization
mFlag=true'add
'EditorMode=site_info(14)'编辑模试
'fsoMode=site_info(15)'编辑模试
mBigCategoryID = Request("BigCategoryID")
'mBigCategoryID = Request("BigCategoryID")
mSmallCategoryID = Request("SmallCategoryID")
mGrade = Request("Grade")
mSmallGrade = Request("SmallGrade")
Set rs = Server.CreateObject("Adodb.RecordSet")
'Display
if request("action")="edit" then
mSql="Select * From T_Article Where F_ID="&Request.QueryString("ModifyID")
Set rs=Conn.Execute(mSql)
If not rs.Eof then
ID = Request.QueryString("ModifyID")
mSmallCategoryID = rs("F_SmallCategoryID")
mTitle = rs("F_Title")
mKeyWords = rs("F_KeyWords")
mAuthor = rs("F_Author")
mContent = rs("F_Content")
mLink = rs("F_Link")
mFilePath = rs("F_FilePath")
mComeFrom = rs("F_ComeFrom")
mAddtime = rs("F_Addtime")
mIsCommend = rs("F_IsCommend")
mIsPic = rs("F_IsPic")
rs.Close
End if
mFlag=false
end if
'Save Records and Create Html
If Request.ServerVariables("REQUEST_METHOD")="POST" then
if Request.Form("txtContent")="" then
call Msgbox("请输入新闻内容!",1)
Response.end
end if
mSmallCategoryID = Request("selSmallCategory")
'Read V_ArticlePath
mSql = "Select top 1 * From V_ArticlePath Where F_SmallCateID=" & mSmallCategoryID
Set rst = conn.Execute(mSql)
if rst.Eof then
Response.write "对不起,请不要非法操作!"
Response.End()
Else
mBigCateID = rst("F_BigCateID")
mBigCateName = rst("F_BigCateName")
mSmallCateID = rst("F_SmallCateID")
mSmallCateName = rst("F_SmallCateName")
mBigFolder = rst("F_BigFolder")
mSmallFolder = rst("F_SmallFolder")
mTemplatePath = rst("F_TemplatePath")
End if
rst.Close:Set rst = Nothing
mTitle = checkStr(Trim(Request.Form("txtTitle")))
mContent = checkStr(rTrim(Request.Form("txtContent")))
mAuthor = checkStr(Trim(Request.Form("txtAuthor")))
if mAuthor="" then mAuthor = "不详"
mLink = checkStr(Trim(Request.Form("txtLink")))
mComeFrom = checkStr(Trim(Request.Form("txtComeFrom")))
if mComeFrom="" then mComeFrom = "不详"
mAddtime = checkStr(Trim(Request.Form("txtAddtime")))
mKeywords = checkStr(Trim(Request.Form("txtKeywords")))
if Request.Form("chkIsPic")=1 then mIsPic = 1 else mIsPic = 0
if Request.Form("chkIsCommend")=1 then mIsCommend = 1 else mIsCommend =0
if session("curUserGrade")="超级用户" then mIsAuditing = 1 else mIsAuditing = 0
If Request("action") = "Insert" then
mFileName = DateToFilename(now)
mFilePath = mBigFolder + "/" + mSmallFolder + "/"+mFileName
mSql = "Insert Into T_Article(F_BigCategoryID,F_SmallCategoryID,F_Title,F_KeyWords,F_Content,F_Author,F_Link,F_FilePath,F_ComeFrom,F_AddTime,F_IsPic,F_IsCommend,F_IsAuditing,F_UserName)"
mSql = mSql +"Values('"&mBigCategoryID&"','"&mSmallCategoryID&"','"&mTitle&"','"&mKeywords&"','"&mContent&"','"&mAuthor&"','"&mLink&"','"&mFilePath&"','"&mComeFrom&"','"&mAddtime&"',"&mIsPic&","&mIsCommend&","&mIsAuditing&",'["&Session("master")&"]')"
conn.Execute(mSql)
mFlag = True
Else
mFilePath = Request.Form("hidFilePath")
mFileName = mid(mFilePath,instr(instr(1,mFilePath,"/")+1,mFilePath,"/")+1)
mSql = "update T_Article set F_SmallCategoryID='"&mSmallCategoryID&"',F_Title='"&mTitle&"',F_Keywords='"&mKeywords&"',F_Content='"&mContent&"',F_Author='"&mAuthor&"',F_Link='"&mLink&"',F_ComeFrom='"&mComeFrom&"',F_UserName='["&session("master")&"]',F_Addtime='"&mAddtime&"',F_IsPic="&mIsPic&",F_IsCommend="&mIsCommend&",F_IsAuditing="&mIsAuditing
mSql = mSql +" Where F_ID=" & Request("ModifyID")
conn.Execute(mSql)
mFlag = False
End if
'------------------------------------------------------html
'Read Max ID
mSql = "Select Max(F_ID) from T_Article"
Set rs = conn.Execute(mSql)
ID = rs(0)
rs.Close
'Create Html
Set fso = CreateObject("Scripting.FileSystemObject")
dim Tmpl_shop_url,Tmpl_url,Tmpl_File_Path
Tmpl_shop_url = WebRootPatch
Tmpl_File_Path="htmls\Templates\"+mTemplatePath+".html"
If Not fso.FileExists(mTemplateAllPath) then
Tmpl_url = GetUrl & WebRootPatch & mTemplatePath&"_zw.asp"
Call SaveFile(Tmpl_File_Path,GetBody(Tmpl_url),3)
Call write_html(Tmpl_File_Path,ReplaceUrl(Tmpl_File_Path,3),3)
End If
mTemplateAllPath = Server.MapPath("../htmls/Templates/"&mTemplatePath&".html")
If fso.FileExists(mTemplateAllPath) then
Set objStream = fso.OpenTextFile(mTemplateAllPath)
Else
Call Msgbox("对不起,该类别文章的模板文件 "&mTemplatePath&".html 找不到,\n请先创建该类别的模板文件!",1)
End if
Do While not objStream.AtEndOfStream
mNewsContent = mNewsContent & objStream.ReadLine
mNewsContent = replace(mNewsContent,"[id]",ID)
mNewsContent = replace(mNewsContent,"[bigcategoryid]",mBigCategoryID)
mNewsContent = replace(mNewsContent,"[bigcategoryname]",mBigCateName)
mNewsContent = replace(mNewsContent,"[smallcategoryid]",mSmallCategoryID)
mNewsContent = replace(mNewsContent,"[smallcategoryname]",mSmallCateName)
mNewsContent = replace(mNewsContent,"[title]",HTMLEncode2(mTitle))
mNewsContent = replace(mNewsContent,"[content]",mContent)
mNewsContent = replace(mNewsContent,"[comefrom]",HTMLEncode2(mComeFrom))
mNewsContent = replace(mNewsContent,"[addtime]",mAddtime)
mNewsContent = replace(mNewsContent,"[link]",mLink)
mNewsContent = replace(mNewsContent,"[author]",HTMLEncode2(mAuthor))
mNewsContent = replace(mNewsContent,"[keywords]",HTMLEncode2(mKeywords))
Loop
objStream.Close
'Create BigFolder
folderPath = Server.MapPath("../Htmls")
mPathDir = folderPath & "\" & mBigFolder
If Not fso.FolderExists(mPathDir) Then
Set f = fso.CreateFolder(mPathDir)
Set f=nothing
end if
'Create SmallFolder
mPathDir = folderPath & "\" & mBigFolder&"\"& mSmallFolder
If Not fso.FolderExists(mPathDir) Then
Set f = fso.CreateFolder(mPathDir)
Set f=nothing
end if
'Create FileName
Set objHtml = fso.CreateTextFile(mPathDir+"\"+mFileName)
objHtml.WriteLine mNewsContent
objHtml.close
set fso=nothing
call MsgBox("文章文件生成成功!\n\n主题:\n"& mTitle &"\n\n路径:\n"&Replace(mPathDir+"\"+mFileName,"\","\\")&"\n\n显示:\nhttp://" & Request.ServerVariables("HTTP_HOST")&Replace(mid(request.ServerVariables("URL"),1,instr(2,Request.ServerVariables("URL"),"/")) &"Article/" &mBigFolder +"/"+mSmallFolder+"/"+ mFileName,"\","/")&"\n\n","Admin_Article.asp?Grade="&mGrade&"&SmallGrade="&mSmallGrade&"&BigCategoryID="&mBigCategoryID&"&SmallCategoryID="&mSmallCategoryID&"&pageno="&Request("pageno"))
response.end
End if
'Delect Records
If Request("action")="Delete" then
mBigCategoryID=Request("BigCategoryID")
mSql = "DELETE FROM T_Article WHERE F_ID=" &Request.QueryString("DeleteID")
conn.execute mSql
'Delete Html
DelFname=Server.MapPath("../Htmls/"+Request("FilePath"))
Set TestFileObject=Server.Createobject("Scripting.FileSystemObject")
If TestFileObject.FileExists(DelFname) then
Set NewFile=TestFileObject.getfile(DelFname)
Newfile.delete
End if
Response.write "<script>location.replace('Admin_Article.asp?Grade="&mGrade&"&SmallGrade="&Request("SmallGrade")&"&SmallCategoryID="&Request("SmallCategoryID")&"&action=IsDelete&BigCategoryID="& mBigCategoryID &"&pageno="&Request.Querystring("pageno")&"')</script>"
end if
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<!--#include file="Admin_IsLogin.asp" -->
<link href="skin/Style01/Style.css" rel="stylesheet" type="text/css" />
<link href="skin/Style01/topmenu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../expansion/jquery/jqueryCore.js"></script>
<script type="text/javascript" src="../expansion/fckeditor/fckeditor.js"></script>
<script src="skin/Style01/BGcolor.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
// document init
$(function(){
// 加载编辑器
var oFCKeditor = new FCKeditor( 'txtContent' ) ;
oFCKeditor.BasePath = '<%=WebRootPatch%>expansion/fckeditor/' ;
oFCKeditor.Config['CustomConfigurationsPath'] = '../config.asp';
oFCKeditor.Height = '500';
oFCKeditor.ReplaceTextarea() ;
});
function jDelete(url)
{
if((confirm(" 警告:请确定是否删除,删除后不能恢复! "))==true)
self.location=url+'&action=Delete';
}
</script>
<script language="JavaScript" type="text/javascript">
function CheckData(){
if (document.LatticeEditorForm.txtTitle.value=="")
{
errorMsg="对不起,文章标题不能为空,请输入!"
alert(errorMsg+'\n\n Copyright by 2006-2008 vidimedia.com.cn');
document.LatticeEditorForm.txtTitle.focus();
return false;
}
}
</script>
</head>
<body>
<%
' if Request("SmallGrade") <> "" then admin_flag=",2|"&Request("Grade")&"|"&Request("SmallGrade")&""
' if instr(session("flag"),admin_flag)=0 or isnull(session("flag"))=true then
' Response.write "<br><br><br><br><b><font color=red>对不起,您没有管理本页面的权限!</font></B>"'
' Response.end
' end if
%>
<div class="right_toptitle">
<h4>文章管理
<span>
<%
Response.write "分类显示:| "
mSql="Select F_ID,F_Value from T_SmallCategory Where F_BigCategoryID="& mBigCategoryID &" order by F_Grade"
Set rs=conn.Execute(mSql)
if not rs.eof then
arrSmaillCategory = rs.getrows()
end if
rs.close
if isarray(arrSmaillCategory) then
for i=0 to ubound(arrSmaillCategory,2)
Response.write "<a href='Admin_Article.asp?Grade="&Request("Grade")&"&SmallGrade="&i+1&"&BigCategoryID="&mBigCategoryID&"&SmallCategoryID="&arrSmaillCategory(0,i)&"'>"
Response.write arrSmaillCategory(1,i)
Response.write "</a>"
Response.Write " | "
Next
end if
%></span>
</h4></div>
<br />
<table width="100%" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="100%" align="center" valign="top">
<table width="98%" border="0" cellspacing="1" cellpadding="0" align="center" class="BG_huise">
<tr align="center" class="title01">
<td width="7%" height="16" class="forumHeaderBackgroundAlternate"><b>ID</b></td>
<td width="33%" class="forumHeaderBackgroundAlternate"><b>标题</b></td>
<td width="12%" class="forumHeaderBackgroundAlternate"><b>二级类别</b></td>
<td width="9%" class="forumHeaderBackgroundAlternate"><b>操作者</b></td>
<td width="11%" class="forumHeaderBackgroundAlternate"><b>更新时间</b></td>
<%if session("curUserGrade")="超级用户" then%>
<td width="6%" class="forumHeaderBackgroundAlternate"><b>审核</b></td>
<td width="6%" class="forumHeaderBackgroundAlternate"><b>推荐</b></td>
<%end if%>
<td width="16%" class="forumHeaderBackgroundAlternate"> <b>管理</b></td>
</tr>
<%
Set rs=Server.createobject("Adodb.RecordSet")
pageno=request.querystring("pageno")
pmcount=18
admin_flag=",2|"&Request("Grade")&"|"&Request("SmallCategoryID")&""
mSql="Select * From V_Article Where (1=1)"
if session("curUserName") <> "admin" then mSql = mSql +" and F_UserName='["&session("curUserName")&"]'"
if Request("SmallCategoryID") <> "" then mSql = mSql + " and F_SmallCategoryID=" & mSmallCategoryID
mSql = mSql + " and F_BigCategoryID="& mBigCategoryID &" order by F_Addtime desc"
rs.open mSql,conn,1,1
if not rs.eof then
rs.pagesize=pmcount
mpage=rs.pagecount
if pageno="" then pageno=1
if cint(pageno)<1 or cint(pageno)>mpage then pageno=1
rs.absolutepage=pageno
rc=rs.pagesize
re=1
do while not rs.eof and rc>0
mBgColor=Request.Querystring("BgColor")
if Trim(rs("F_ID"))=Trim(mBgColor) then mColor= "D6DFFF" else mColor= "ffffff"
%>
<tr class="BG_baise" onmouseover="switchBG(this,'BG_Y');" onmouseout="switchBG(this,'BG_Y');">
<td width="7%" height="30" align="center"><%=rs("F_ID")%></td>
<td align="left"> <a title="<%=HTMLEncode(rs("F_Title"))%>" target="_blank" href="../Htmls/<%=rs("F_FilePath")%>">
<%
Response.write GetWord(rs("F_Title"),28,"")
Response.write "(<font color=red>"&rs("F_Hits")&"</font>)"
if rs("F_IsPic")=1 then Response.write "[<font color=D669A5>图</font>]"
%>
</a> <a title="请确认是否要想重新生成该文章HTML文件?" href="Admin_ArticleCreateHtml.asp?ID=<%=rs("F_ID")%>&BigCategoryID=<%=Request("BigCategoryID")%>&Grade=<%=Request("Grade")%>&SmallGrade=<%=Request("SmallGrade")%>&SmallCategoryID=<%=Request("SmallCategoryID")%>">
<font color="red">[生成]</font> </a> </td>
<td width="12%" height="2" align="center" ><%=rs("F_SmallCategoryName")%>
</td>
<td width="9%" align="center" ><%=rs("F_UserName")%>
</td>
<td width="11%" align="center" ><%=formatdatetime(rs("F_Addtime"),2)%>
</td>
<%if session("curUserGrade")="超级用户" then%>
<td width="6%" align="center" >
<%
'审核处理
if Request("action") = "IsAuditing" then
mIsAuditing = Request("IsAuditing")
if mIsAuditing=1 then mIsAuditing = 0 else mIsAuditing = 1
mSql = "update T_Article Set F_IsAuditing= "&mIsAuditing&" Where F_ID="&Request("ID")
conn.execute(mSql)
Response.redirect "Admin_Article.asp?Grade="&mGrade&"&SmallGrade="&mSmallGrade&"&BigCategoryID="&mBigCategoryID&"&SmallCategoryID="&mSmallCategoryID&"&pageno="&Request("pageno")
end if
Response.Write "<a href='Admin_Article.asp?action=IsAuditing&IsAuditing="&rs("F_IsAuditing")&"&Grade="&mGrade&"&SmallGrade="&mSmallGrade&"&BigCategoryID="&mBigCategoryID&"&SmallCategoryID="&mSmallCategoryID&"&pageno="&Request("pageno")&"&ID="&rs("F_ID")&"'>"
if rs("F_IsAuditing")=1 then Response.Write "<font color=red>是</font>" Else Response.write "否"
Response.Write "</a>"
%>
</td>
<td width="6%" align="center">
<%
'推荐处理
if Request("action") = "IsCommend" then
mIsCommend = Request("IsCommend")
if mIsCommend=1 then mIsCommend = 0 else mIsCommend = 1
mSql = "update T_Article Set F_IsCommend= "&mIsCommend&" Where F_ID="&Request("ID")
conn.execute(mSql)
Response.redirect "Admin_Article.asp?Grade="&mGrade&"&SmallGrade="&mSmallGrade&"&BigCategoryID="&mBigCategoryID&"&SmallCategoryID="&mSmallCategoryID&"&pageno="&Request("pageno")
end if
Response.Write "<a href='Admin_Article.asp?action=IsCommend&IsCommend="&rs("F_IsCommend")&"&Grade="&mGrade&"&SmallGrade="&mSmallGrade&"&BigCategoryID="&mBigCategoryID&"&SmallCategoryID="&mSmallCategoryID&"&pageno="&Request("pageno")&"&ID="&rs("F_ID")&"'>"
if rs("F_IsCommend")=1 then Response.Write "<font color=red>是</font>" Else Response.write "否"
Response.Write "</a>"
%>
</td>
<%end if%> |
|