admin_article.asp

来自「小游戏网站演示www.4399.io 拥有4万条游戏数据」· ASP 代码 · 共 1,419 行 · 第 1/5 页

ASP
1,419
字号
			<%
			If IsEdit Then
			Response.Write InitSelect(Rs("UploadImage"),Rs("ImageUrl"))
			Else
			%>
			<select name="ImageFileList" id="ImageFileList" onChange="ImageUrl.value=this.value;"><option value=''>不选择首页推荐图片</option></select><%End If%>
			<input type='button' name='selectpic' value='从已上传图片中选择' onclick='SelectPhoto()' class="button">&nbsp;&nbsp;
			</td>
        </tr>
		<tr>
          <td align="right" class="TableRow2"><b>上传图片:</b></td>
          <td colspan="3" class="TableRow1"><iframe name="image" frameborder="0" width='100%' height="45" scrolling="no" src="upload.asp?ChannelID=<%=ChannelID%>&stype=image&m=news&inst=content&s=1"></iframe></td>
        </tr>
        <tr>
          <td align="right" class="TableRow2"><b>浏览等级:</b></td>
          <td class="TableRow1"><select name="UserGroup">
<%
	Set RsObj = Newasp.Execute("Select GroupName,Grades From NC_UserGroup order by Groupid")
	Do While Not RsObj.EOF
		Response.Write Chr(9) & Chr(9) & "<option value=""" & RsObj("Grades") & """"
		If isEdit Then
			If Rs("UserGroup") = RsObj("Grades") Then Response.Write " selected"
		Else
			If RsObj("Grades") = 0 Then Response.Write " selected"
		End If
		Response.Write ">"
		Response.Write RsObj("GroupName")
		Response.Write "</option>" & vbCrLf
		RsObj.movenext
	Loop
	Set RsObj = Nothing
%>
          </select></td>
          <td align="right" class="TableRow2"><b>所需点数:</b></td>
          <td class="TableRow1"><input name="PointNum" type="text" size="10" value="<%If isEdit Then Response.Write Rs("PointNum"):Else Response.Write 0:End If%>"> 
            对匿名用户和管理员无效 </td>
        </tr>
        <tr>
          <td align="right" class="TableRow2"><b>初始点击数:</b></td>
          <td class="TableRow1"><input name="AllHits" type="text" id="AllHits" size="15" value="<%If isEdit Then Response.Write Rs("AllHits"):Else Response.Write 0%>"> 
          <font color=red>*</font></td>
          <td align="right" class="TableRow2"><b><%=sModuleName%>星级:</b></td>
          <td class="TableRow1"><select name="star">
		<%If isEdit Then%>
          	<option value=5<%If Rs("star") = 5 Then Response.Write (" selected")%>>★★★★★</option>
          	<option value=4<%If Rs("star") = 4 Then Response.Write (" selected")%>>★★★★</option>
          	<option value=3<%If Rs("star") = 3 Then Response.Write (" selected")%>>★★★</option>
		<option value=2<%If Rs("star") = 2 Then Response.Write (" selected")%>>★★</option>
		<option value=1<%If Rs("star") = 1 Then Response.Write (" selected")%>>★</option>
		<%Else%>
		<option value=5>★★★★★</option>
          	<option value=4>★★★★</option>
          	<option value=3 selected>★★★</option>
		<option value=2>★★</option>
		<option value=1>★</option>
		<%End If%>
          </select></td>
        </tr>
	<tr>
          <td align="right" class="TableRow2"><b>更新时间:</b></td>
          <td class="TableRow1"><input name="WriteTime" type="text" id="WriteTime" size="25" value="<%If isEdit Then Response.Write Rs("WriteTime"):Else Response.Write (Now())%>"> 
          <font color="red">*</font><%If isEdit Then%>
	    <input name="Update" type="checkbox" value="1"> 
            更新时间<%End If%></td>
		  <td align="right" class="TableRow2"><b>分页设置:</b></td>
          <td class="TableRow1"><input type="radio" name="AutoPages" value="1"<%If isEdit Then:If Rs("AutoPages") <> 0 Then Response.Write (" checked"):End If: Else Response.Write (" checked")%>/> 自动分页&nbsp;&nbsp;
		  <input type="radio" name="AutoPages" value="0"<%If isEdit Then:If Rs("AutoPages") = 0 Then Response.Write (" checked")%>/> 手动分页&nbsp;&nbsp;</td>
        </tr>
	<tr>
          <td align="right" class="TableRow2"><b>其它选项:</b></td>
          <td class="TableRow1" colspan="3"><input name="isTop" type="checkbox" id="isTop" value="1"<%If isEdit Then:If Rs("isTop") <> 0 Then Response.Write (" checked")%>>
            <%=sModuleName%>置顶 
            <input name="isBest" type="checkbox" id="isBest" value="1"<%If isEdit Then:If Rs("isBest") <> 0 Then Response.Write (" checked")%>> 
            <%=sModuleName%>推荐
	    <input name="ForbidEssay" type="checkbox" id="ForbidEssay" value="1"<%If isEdit Then:If Rs("ForbidEssay") <> 0 Then Response.Write (" checked")%>> 
            禁止发表评论
	    <input name="isAccept" type="checkbox" id="isAccept" value="1" checked> 
            立即发布(<font color=blue>否则审核后才能发布。</font>)
	    </td>
        </tr>
        <tr align="center">
          <td colspan="4" class="TableRow2">
	  <input type="button" name="Submit4" onclick="javascript:history.go(-1)" value="返回上一页" class="Button">
	  <input type="submit" name="btnSubmit" value="保存<%=sModuleName%>" class="Button"></td>
        </tr></form>
      </table>
</div>
<%If Newasp.setAdminEditor(0)=0 Then%>
<form name="NewAsp_UploadForm" action="remoteupload.asp?action=upload&ChannelID=<%=ChannelID%>" method="post" target="NewAsp_UploadTarget">
<input type="hidden" name="NewAsp_UploadText" value=""/>
</form>
<div id="divProcessing" style="width:200px;height:30px;position:absolute;display:none">
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" width="100%" height="100%"><tr><td bgcolor=#0650D2><marquee align="middle" behavior="alternate" scrollamount="5" style="font-size:9pt"><font color=#FFFFFF>...正在保存数据...请等待...</font></marquee></td></tr></table>
</div>
<script type="text/javascript">
<!--
function remoteUpload(o) {
	try{
		var strText = GetInnerContentHTML() ;

		var objField = document.getElementsByName("NewAsp_UploadText")[0];
		objField.value = strText ;

		if (o) {
			divProcessing.style.top = (document.body.clientHeight-parseFloat(divProcessing.style.height))/2;
			divProcessing.style.left = (document.body.clientWidth-parseFloat(divProcessing.style.width))/2;
			divProcessing.style.display = "";
			document.NewAsp_UploadForm.submit();
		}else{
			divProcessing.style.display = "none";
		}
	}
	catch(e){}
} 

function remoteUploadDone() {
	try{
	divProcessing.style.display = "none";
	}
	catch(e){}
}

function GetInnerContentHTML(){
	var strHTML ;
	try{
		var oEditor = FCKeditorAPI.GetInstance('content') ;
		strHTML = oEditor.GetXHTML()
	}
	catch(e){
		strHTML = '';
	}
	return strHTML
}
//-->
</script>
<%
	End If
	If isEdit Then
		Rs.Close
		Set Rs = Nothing
	End If
End Sub

Private Sub CheckSave()
	If Trim(Request.Form("title")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>" & sModuleName & "标题不能为空!</li>"
	End If
	If Len(Request.Form("title")) => 200 Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>" & sModuleName & "标题不能超过200个字符!</li>"
	End If
	If Trim(Request.Form("ColorMode")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>标题颜色参数错误!</li>"
	End If
	If Trim(Request.Form("FontMode")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>标题字体参数错误!</li>"
	End If
	If Len(Request.Form("Related")) => 220 Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>相关" & sModuleName & "不能超过220个字符!</li>"
	End If
	If Trim(Request.Form("Author")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>" & sModuleName & "作者不能为空!</li>"
	End If
	If Trim(Request.Form("ComeFrom")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>" & sModuleName & "来源不能为空!</li>"
	End If
	If Trim(Request.Form("PointNum")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>阅览" & sModuleName & "所需的点数不能为空!如果不想设置请输入零。</li>"
	End If
	If Not IsNumeric(Request.Form("star")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>" & sModuleName & "星级不能为空。</li>"
	End If
	If Not IsNumeric(Request.Form("UserGroup")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>阅览" & sModuleName & "等级参数错误!</li>"
	End If
	If Not IsNumeric(Request.Form("ClassID")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>该一级分类已经有下属分类,不能添加" & sModuleName & "!</li>"
		Exit Sub
	End If
	If Trim(Request.Form("ClassID")) = 0 Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>该分类是外部连接,不能添加" & sModuleName & "!</li>"
	End If
	If Trim(Request.Form("AllHits")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>初始点击数不能为空!</li>"
	End If
	If Not IsNumeric(Request("AllHits")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>初始点击数请输入整数!</li>"
		Exit Sub
	End If
	If Not IsNumeric(Request("SpecialID")) Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>专题ID参数错误!</li>"
		Exit Sub
	End If
	TextContent = ""
	For i = 1 To Request.Form("content").Count
		TextContent = TextContent & Request.Form("content")(i)
	Next
	If Trim(TextContent) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>" & sModuleName & "内容不能为空!</li>"
	End If
	If Newasp.setAdminEditor(0) <> 0 Then
		TextContent = Newasp.HTMLEncodes(TextContent)
	End If
	TextContent = Html2Ubb(Re_Replace(TextContent, InstallDir_ChannelDir, "[InstallDir_ChannelDir]"))
	
	ArticleTop = Newasp.ChkNumeric(Request.Form("isTop"))
	ArticleBest = Newasp.ChkNumeric(Request.Form("isBest"))
	ForbidEssay = Newasp.ChkNumeric(Request.Form("ForbidEssay"))
	ArticleAccept = Newasp.ChkNumeric(Request.Form("isAccept"))
End Sub

Private Sub SaveArticle()
	CheckSave
	If Founderr = True Then Exit Sub
	Set Rs = Server.CreateObject("ADODB.Recordset")
	SQL = "select * from NC_Article where (ArticleID is null)"
	Rs.Open SQL,Conn,1,3
	Rs.Addnew
		Rs("ChannelID") = ChannelID
		Rs("ClassID") = Trim(Request.Form("ClassID"))
		Rs("SpecialID") = Trim(Request.Form("SpecialID"))
		Rs("title") = Newasp.ChkFormStr(Request.Form("title"))
		Rs("subtitle") = Newasp.ChkFormStr(Request.Form("subtitle"))
		Rs("ColorMode") = Trim(Request.Form("ColorMode"))
		Rs("FontMode") = Trim(Request.Form("FontMode"))
		Rs("content") = TextContent
		Rs("Related") = Newasp.ChkFormStr(Request.Form("Related"))
		Rs("Author") = Trim(Request.Form("Author"))
		Rs("ComeFrom") = Trim(Request.Form("ComeFrom"))
		Rs("star") = Trim(Request.Form("star"))
		Rs("isTop") = ArticleTop
		Rs("AllHits") = CLng(Request.Form("AllHits"))
		Rs("DayHits") = CLng(Request.Form("AllHits"))
		Rs("WeekHits") = CLng(Request.Form("AllHits"))
		Rs("MonthHits") = CLng(Request.Form("AllHits"))
		Rs("HitsTime") = Now()
		Rs("WriteTime") = Formatime(Trim(Request.Form("WriteTime")))
		Rs("HtmlFileDate") = Trim(Newasp.HtmlRndFileName)
		Rs("username") = Trim(AdminName)
		Rs("isBest") = ArticleBest
		Rs("BriefTopic") = Trim(Request.Form("BriefTopic"))
		Rs("ImageUrl") = Trim(Request.Form("ImageUrl"))
		Rs("UploadImage") = Trim(Request.Form("UploadFileList"))
		Rs("UserGroup") = Trim(Request.Form("UserGroup"))
		Rs("PointNum") = Trim(Request.Form("PointNum"))
		Rs("isUpdate") = 1
		Rs("isAccept") = ArticleAccept
		Rs("ForbidEssay") = ForbidEssay
		Rs("AlphaIndex") = Newasp.ReadAlpha(ubb.CheckSpecialChar(Request.Form("title")))
		Rs("AutoPages") = Newasp.ChkNumeric(Request.Form("AutoPages"))
	Rs.update
	Rs.Close
	Rs.Open "select top 1 ArticleID from NC_Article where ChannelID=" & ChannelID & " order by ArticleID desc", Conn, 1, 1
	ArticleID = Rs("ArticleID")
	Rs.Close:Set Rs = Nothing
	ClassUpdateCount Request.Form("ClassID"),1
	Call RemoveCache
	Dim url
	If CInt(Newasp.IsCreateHtml) <> 0 Then
		Response.Write "<IE:Download ID=CreationID STYLE=""behavior:url(#default#download)"" />" & vbCrLf
		url = "admin_makenews.asp?ChannelID=" & ChannelID & "&ArticleID=" & ArticleID & "&showid=0"	
		Call ScriptCreation(url,ArticleID)
		SQL = "SELECT TOP 1 ArticleID FROM NC_Article WHERE ChannelID=" & ChannelID & " And isAccept <> 0 And ArticleID < " & ArticleID & " ORDER BY ArticleID DESC"
		Set Rs = Newasp.Execute(SQL)
		If Not (Rs.EOF And Rs.BOF) Then
			url = "admin_makenews.asp?ChannelID=" & ChannelID & "&ArticleID=" & Rs("ArticleID") & "&showid=0"	
			Call ScriptCreation(url,Rs("ArticleID"))
		End If
		Rs.Close

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?