www.gusucode.com > 全球营销软件站整站源码4月最新数据 4.0源码程序 > 801wyxqf\adminadmin\sys\admin_special.asp

    <!--#include file="../../conn.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/const.asp"-->
<!--#include file="../inc/check.asp"-->
<%
Admin_header
'=====================================================================
' 软件名称:801w软件代理系统
' 当前版本:801wAsp 801w cn 801w com
' 文件名称:admin_main.asp
' 更新日期:2010-2-16
' 官方网站:801w代理系统(www.801w.cn www.801w.com) QQ:274667447
'=====================================================================
' Copyright 2003-2010 801w.cn - All Rights Reserved.
' 801wasp is a trademark of 801w.cn
'=====================================================================
%>
<table class="table1" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<td class="tableline linetitle" width="200" align="left"><%=NewAsp.ModuleName%>专题管理</td>
		<td class="tableline" width="*" align="right"><a href="admin_special.asp?ChannelID=<%=ChannelID%>">管理首页</a>
			 - <a href="admin_special.asp?action=add&ChannelID=<%=ChannelID%>">添加专题</a>
			 - <a href="admin_special.asp?action=orders&ChannelID=<%=ChannelID%>">专题排序</a>
			 - <a href="admin_setting.asp">基本设置</a>
			 - <a href="admin_channel.asp?action=edit&ChannelID=<%=ChannelID%>">频道管理</a>
			 - <a href="admin_class.asp?ChannelID=<%=ChannelID%>">分类管理</a>
		</td>
	</tr>
</table>
<script language="javascript">
function formatbt()
{
  var arr = showModalDialog("../script/btformat.htm?",null, "dialogWidth:250pt;dialogHeight:166pt;toolbar=no;location=no;directories=no;status=no;menubar=NO;scrollbars=no;resizable=no;help=0; status:0");
  if (arr != null){
     document.myform.Topicformat.value=arr;
     myt.innerHTML="<span style='background-color: #FFFFff;font-size:12px' "+arr+">设置标题样式 ABCdef</span>";
  }
}
function Cancelform()
{
  document.myform.Topicformat.value='';
  myt.innerHTML="<span style='background-color: #FFFFff;font-size:12px'>设置标题样式 ABCdef</span>";
}
//-->
</script>
<%
Dim Action,listArray,SpecialIDlist
Action=LCase(Request("action"))
If Not ChkAdmin("Special_"&ChannelID) Then
	Call Transfer_error()
End If
Select Case Trim(Action)
Case "save"
	Call savenew()
Case "modify"
	Call savedit()
Case "edit"
	Call editSpecial()
Case "add"
	Call addSpecial()
Case "del"
	Call delSpecial()
Case "orders"
	Call SpecialOrder()
Case "saveorder"
	Call SpecialRenewOrder()
Case Else
	Call showmain()
End Select
If FoundErr=True Then
	ReturnError(ErrMsg)
End If
Admin_footer
SaveLogInfo(AdminName)
NewAsp.PageEnd

Sub showmain()
	Dim Rs,i,iCount
	iCount=1:i=0
%>
<table id="tablehovered" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<tr>
	<th>专题名称</th>
	<th>连接目标</th>
	<th>连接类型</th>
	<th>修改专题栏目</th>
	<th>删除专题栏目</th>
</tr>
<%
Set Rs = NewAsp.Execute("SELECT SpecialID,ChannelID,SpecialName,Topicformat,Reopen,ChangeLink,SpecialUrl FROM NC_Special WHERE ChannelID="& ChannelID &" ORDER BY orders,SpecialID")
If Rs.BOF And Rs.EOF Then
	Response.Write "<tr><td align=""center"" colspan=""5"" class=""tablerow2"">还没有添加任何专题</td></tr>"
Else
	Do While Not Rs.EOF
		If (i mod 2) = 0 Then iCount=1 Else iCount=2
		Response.Write "<tr align=""center"">"
		Response.Write "	<td class=""tablerow"&iCount&" hovered"">"
		Response.Write "<A href=?action=edit&ChannelID="
		Response.Write Rs("ChannelID")
		Response.Write "&SpecialID="
		Response.Write Rs("SpecialID")
		Response.Write "><span "
		Response.Write Rs("Topicformat")
		Response.Write ">"
		Response.Write Rs("SpecialName")
		Response.Write "</span></A>"
		Response.Write "	</td>"
		Response.Write "	<td class=""tablerow"&iCount&" hovered"">"
		If Rs("Reopen") <> 0 Then
			Response.Write "<font color=""red"">新窗口打开</font>"
		Else
			Response.Write "<font color=""blue"">本窗口打开</font>"
		End If
		Response.Write "	</td>"
		Response.Write "	<td class=""tablerow"&iCount&" hovered"">"
		If Rs("ChangeLink") <> 0 Then
			Response.Write "<font color=""red"">转向连接</font>"
		Else
			Response.Write "<font color=""blue"">内部连接</font>"
		End If
		Response.Write "	</td>"
		Response.Write "	<td class=""tablerow"&iCount&" hovered"">"
		Response.Write "<A href=?action=edit&ChannelID="
		Response.Write Rs("ChannelID")
		Response.Write "&SpecialID="
		Response.Write Rs("SpecialID")
		Response.Write ">编 辑 专 题</A>"
		Response.Write "	</td>"
		Response.Write "	<td class=""tablerow"&iCount&" hovered"">"
		Response.Write "<A href=?action=del&ChannelID="
		Response.Write Rs("ChannelID")
		Response.Write "&SpecialID="
		Response.Write Rs("SpecialID")
		Response.Write " onclick=""{if(confirm('此操作将删除此专题\n您确定要删除吗?')){return true;}return false;}"">删 除 专 题</A>"
		Response.Write "	</td>"
		Response.Write "</tr>"
		Rs.movenext
		i=i+1
	Loop
	Rs.Close:Set Rs = Nothing
End If
%>
</table>
<%
End Sub

Sub addSpecial()
	Dim Rs,SQL
	Dim NewSpecialID
	SQL = "SELECT MAX(SpecialID) FROM NC_Special"
	Set Rs = NewAsp.Execute(SQL)
	If Rs.bof And Rs.EOF Then
		NewSpecialID = 1
	Else
		NewSpecialID = Rs(0) + 1
	End If
	If IsNull(NewSpecialID) Then NewSpecialID = 1
	Rs.Close:Set Rs = Nothing
%>
<form action="?action=save" method="post" name="myform">
<input type="hidden" name="ChannelID" value="<%=ChannelID%>" />
<input type="hidden" name="SpecialID" value="<%=NewSpecialID%>" />
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th colspan="2">添加<%=NewAsp.ModuleName%>专题栏目</th>
	</tr>
	<tr>
		<td class="tablerow1" width="20%"><strong>专题栏目名称:</strong></td>
		<td class="tablerow1" width="80%"><input name="SpecialName" type="text" /> 样式:<input type="hidden" size="1" name="Topicformat" />&nbsp; <span id="myt" onclick="javascript:formatbt(this);" style="font-size: 11pt; cursor: hand; background-color: #ffffff">设置标题样式 ABCdef</span> <input type="checkbox" onclick="Cancelform()" name="cancel" /> 取消格式</td>
	</tr>
	<tr>
		<td class="tablerow2"><strong>专题栏目说明:</strong></td>
		<td class="tablerow2"><input id="Readme" size="50" name="Readme" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1"><strong>专题所在目录:</strong></td>
		<td class="tablerow1"><input name="SpecialDir" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2"><strong>是否新窗口打开:</strong></td>
		<td class="tablerow2"><input type="radio" checked="checked" name="Reopen" value="0" /> 否&nbsp;&nbsp; <input type="radio" name="Reopen" value="1" /> 是&nbsp;&nbsp;</td>
	</tr>
	<tr>
		<td class="tablerow1"><strong>是否转向连接:</strong></td>
		<td class="tablerow1"><input type="radio" checked="checked" onClick="ChangeSetting.style.display='none';" name="ChangeLink" value="0" /> 否&nbsp;&nbsp; <input type="radio" onClick="ChangeSetting.style.display='';" name="ChangeLink" value="1" /> 是&nbsp;&nbsp;</td>
	</tr>
	<tr id="ChangeSetting" style="display: none">
		<td class="tablerow2"><strong>转向连接URL:</strong></td>
		<td class="tablerow2"><input size="50" name="SpecialUrl" value="http://" type="text" /></td>
	</tr>
	<tr align="center">
		<td class="tablerow2">&nbsp;</td>
		<td class="tablerow2"><input class="button" type="button" onclick="javascript:history.go(-1)" name="B1" value="返回上一页" />&nbsp;&nbsp; <input class="button" type="submit" name="submit_button" value="添加专题" /></td>
	</tr>
</table>
</form>
<%
End Sub

Sub editSpecial()
	Dim Rs
	Set Rs = NewAsp.Execute("SELECT SpecialID,SpecialName,Topicformat,Readme,Reopen,SpecialDir,ChangeLink,SpecialUrl FROM NC_Special WHERE ChannelID="& ChannelID &" And SpecialID=" & NewAsp.ChkNumeric(Request("SpecialID")))
	If Rs.BOF And Rs.EOF Then
		Response.Write "参数错误!"
		Exit Sub
	End If
%>
<form action="?action=modify" method="post" name="myform">
<input type="hidden" name="ChannelID" value="<%=ChannelID%>" />
<input type="hidden" name="SpecialID" value="<%=Rs("SpecialID")%>" />
<table class="tableborder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th colspan="2">修改<%=NewAsp.ModuleName%>专题栏目</th>
	</tr>
	<tr>
		<td class="tablerow1" width="20%"><strong>专题栏目名称:</strong></td>
		<td class="tablerow1" width="80%"><input name="SpecialName" value="<%=Rs("SpecialName")%>" type="text" /> 样式:<input type="hidden" size="1" name="Topicformat" value="<%=Server.HTMLEncode(Rs("Topicformat")&"")%>" />&nbsp; <span id="myt" onclick="javascript:formatbt(this);" style="font-size: 11pt; cursor: hand; background-color: #ffffff"><span <%=Rs("Topicformat")%>>设置标题样式 ABCdef</span></span> <input type="checkbox" onclick="Cancelform()" name="cancel" /> 取消格式</td>
	</tr>
	<tr>
		<td class="tablerow2"><strong>专题栏目说明:</strong></td>
		<td class="tablerow2"><input size="50" name="Readme" value="<%=Rs("Readme")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow1"><strong>专题所在目录:</strong></td>
		<td class="tablerow1"><input name="SpecialDir" value="<%=Rs("SpecialDir")%>" type="text" /></td>
	</tr>
	<tr>
		<td class="tablerow2"><strong>是否新窗口打开:</strong></td>
		<td class="tablerow2"><input type="radio" name="Reopen" value="0"<%If Rs("Reopen") = 0 Then Response.Write (" checked")%> /> 否&nbsp;&nbsp; <input type="radio" name="Reopen" value="1"<%If Rs("Reopen") = 1 Then Response.Write (" checked")%> /> 是&nbsp;&nbsp;</td>
	</tr>
	<tr>
		<td class="tablerow1"><strong>是否转向连接:</strong></td>
		<td class="tablerow1"><input type="radio" name="ChangeLink" value="0" onClick="document.getElementById('ChangeSetting').style.display='none';"<%If Rs("ChangeLink") = 0 Then Response.Write (" checked")%>/> 否&nbsp;&nbsp;
		<input type="radio" name="ChangeLink" value="1" onClick="document.getElementById('ChangeSetting').style.display='';"<%If Rs("ChangeLink") = 1 Then Response.Write (" checked")%>/> 是&nbsp;&nbsp;</td>
	</tr>
	<tr id="ChangeSetting"<%If Rs("ChangeLink") = 0 Then Response.Write (" style=""display:none""")%>>
		<td class="tablerow2"><strong>转向连接URL:</strong></td>
		<td class="tablerow2"><input size="50" name="SpecialUrl" value="<%=Rs("SpecialUrl")%>" type="text" /></td>
	</tr>
	<tr align="center">
		<td class="tablerow2">&nbsp;</td>
		<td class="tablerow2"><input class="button" type="button" onclick="javascript:history.go(-1)" name="B1" value="返回上一页" />&nbsp;&nbsp; <input class="button" type="submit" name="submit_button" value="修改专题" /></td>
	</tr>
</table>
</form>
<%
	Rs.Close:Set Rs = Nothing
End Sub

Sub checkSave()
	If Trim(Request.Form("SpecialName")) = "" Or Len(Request.Form("SpecialName")) => 30 Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>专题名称不能为空或者超过30个字符!</li>"
	End If
	If Trim(Request.Form("Readme")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>专题说明不能为空!</li>"
	End If
	If Trim(Request.Form("SpecialDir")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>专题目录不能为空!</li>"
	End If
	If Trim(Request.Form("SpecialUrl")) = "" Then
		FoundErr = True
		ErrMsg = ErrMsg + "<li>专题连接URL不能为空!</li>"
	End If
End Sub

Sub savenew()
	Call checkSave()
	Dim Rs,SQL
	Dim neworders,NewSpecialID,SpecialDir
	Set Rs = NewAsp.Execute("SELECT SpecialID FROM NC_Special WHERE SpecialID=" & CLng(Request("SpecialID")))
	If Not (Rs.EOF And Rs.BOF) Then
		ErrMsg = "<li>您不能指定和别的频道一样的序号。</li>"
		Founderr = True
		Exit Sub
	Else
		NewSpecialID = NewAsp.ChkNumeric(Request("SpecialID"))
	End If
	SpecialDir = Replace(Replace(Trim(Request.Form("SpecialDir")), "\", ""), "/", "")
	If Founderr = True Then Exit Sub
	Set Rs = NewAsp.Execute ("SELECT MAX(orders) FROM NC_Special WHERE ChannelID=" &ChannelID)
	If Not (Rs.EOF And Rs.BOF) Then
		neworders = Rs(0)
	End If
	If IsNull(neworders) Then neworders = 0
	Rs.Close
	Set Rs=NewAsp.CreateAXObject("ADODB.Recordset")
	SQL = "SELECT * FROM NC_Special"
	Rs.Open SQL,Conn,1,3
	Rs.Addnew
		Rs("SpecialID") = NewSpecialID
		Rs("ChannelID") = ChannelID
		Rs("SpecialName") = Trim(Request.Form("SpecialName"))
		Rs("Topicformat") = Trim(Request.Form("Topicformat"))
		Rs("Readme") = Trim(Request.Form("Readme"))
		Rs("orders") = neworders + 1
		Rs("Reopen") = NewAsp.ChkNumeric(Request.Form("Reopen"))
		Rs("SpecialDir") = Trim(Request.Form("SpecialDir"))
		Rs("ChangeLink") = NewAsp.ChkNumeric(Request.Form("ChangeLink"))
		Rs("SpecialUrl") = Trim(Request.Form("SpecialUrl"))
		Rs("IsUpdate") = 1
	Rs.update
	Rs.Close:Set Rs = Nothing
	Succeed("<li>添加新的专题栏目成功</li>")
End Sub

Sub savedit()
	Call checkSave()
	Dim Rs,SQL
	Dim SpecialDir
	SpecialDir = Replace(Replace(Trim(Request.Form("SpecialDir")), "\", ""), "/", "")
	Set Rs=NewAsp.CreateAXObject("ADODB.Recordset")
	SQL = "SELECT * FROM NC_Special WHERE SpecialID=" & CLng(Request("SpecialID"))
	Rs.Open SQL,Conn,1,3
		Rs("SpecialName") = Trim(Request.Form("SpecialName"))
		Rs("Topicformat") = Trim(Request.Form("Topicformat"))
		Rs("Readme") = Trim(Request.Form("Readme"))
		Rs("Reopen") = NewAsp.ChkNumeric(Request.Form("Reopen"))
		Rs("SpecialDir") = Trim(Request.Form("SpecialDir"))
		Rs("ChangeLink") = NewAsp.ChkNumeric(Request.Form("ChangeLink"))
		Rs("SpecialUrl") = Trim(Request.Form("SpecialUrl"))
		Rs("IsUpdate") = 1
	Rs.update
	Rs.Close:Set Rs = Nothing
	Succeed("<li>修改专题栏目成功</li>")
End Sub

Sub delSpecial()
	Dim FolderPath
	Dim Rs
	If Trim(Request("SpecialID")) <> "" Then
		Set Rs = NewAsp.Execute("SELECT SpecialDir FROM NC_Special WHERE SpecialID=" & CLng(Request("SpecialID")))
		NewAsp.Execute("DELETE FROM NC_Special WHERE SpecialID=" & CLng(Request("SpecialID")))
		Rs.Close:Set Rs = Nothing
		Succeed("<li>专题栏目删除操作成功!</li>")
	Else
		ErrMsg = "<li>请选择正确的系统参数!</li>"
		FoundErr = True
	End If
End Sub

Sub SpecialOrder()
	Dim trs
	Dim uporders
	Dim doorders
	Dim Rs,SQL,i
	Response.Write " <table border=""0"" cellspacing=""1"" cellpadding=""2"" class=""tableborder"" align=""center"">" & vbCrLf
	Response.Write " <tr>" & vbCrLf
	Response.Write " <th colspan=""2"">专题栏目重新排序修改"
	Response.Write " </th>"
	Response.Write " </tr>" & vbCrLf
	SQL = "SELECT * FROM NC_Special WHERE ChannelID="&ChannelID&" ORDER BY orders"
	Set Rs = NewAsp.Execute(SQL)
	If Rs.bof And Rs.EOF Then
		Response.Write "您还没有添加相应的专题。"
	Else
		Do While Not Rs.EOF
			Response.Write "<form action=""?action=saveorder"" method=""post""><tr><td width=""50%"" class=""tablerow1"">" & vbCrLf
			Response.Write "<span " & Rs("Topicformat") & ">" & Rs("SpecialName") & "</span>"
			Response.Write "</td><td width=""50%"" class=""tablerow2"">" & vbCrLf
			Set trs = NewAsp.Execute("SELECT COUNT(*) FROM NC_Special WHERE ChannelID="&ChannelID&" And orders<" & Rs("orders") & "")
				uporders = trs(0)
				If IsNull(uporders) Then uporders = 0

				Set trs = NewAsp.Execute("SELECT COUNT(*) FROM NC_Special WHERE ChannelID="&ChannelID&" And orders>" & Rs("orders") & "")
				doorders = trs(0)
				If IsNull(doorders) Then doorders = 0
				If uporders > 0 Then
					Response.Write "<select name=""uporders"" size=""1""><option value=""0"">↑</option>" & vbCrLf
					For i = 1 To uporders
						Response.Write "<option value=""" & i & """>↑" & i & "</option>" & vbCrLf
					Next
					Response.Write "</select>"
				End If
				If doorders > 0 Then
					If uporders > 0 Then Response.Write "&nbsp;"
					Response.Write "<select name=""doorders"" size=""1""><option value=""0"">↓</option>" & vbCrLf
					For i = 1 To doorders
						Response.Write "<option value=""" & i & """>↓" & i & "</option>" & vbCrLf
					Next
					Response.Write "</select>" & vbCrLf
				End If
				If doorders > 0 Or uporders > 0 Then
					Response.Write "<input type=""hidden"" name=""ChannelID"" value=""" & Rs("ChannelID") & """><input type=""hidden"" name=""SpecialID"" value=""" & Rs("SpecialID") & """>&nbsp;<input type=""submit"" name=""submit_button"" class=""button"" value='修 改'>" & vbCrLf
				End If
			Response.Write "&nbsp;</td></tr></form>" & vbCrLf
			Rs.movenext
		Loop
	End If
	Rs.Close
	Set Rs = Nothing
	Response.Write "</table>"
End Sub

Sub SpecialRenewOrder()
	Dim orders
	Dim uporders
	Dim doorders
	Dim oldorders
	Dim Rs,SQL,i
	If Not IsNumeric(Request("ChannelID")) Then
		ErrMsg = ErrMsg & "<li>非法的系统参数!</li>"
		Founderr = True
		Exit Sub
	End If
	If Not IsNumeric(Request("SpecialID")) Then
		ErrMsg = ErrMsg & "<li>非法的系统参数!</li>"
		Founderr = True
		Exit Sub
	End If
	If Request("uporders") <> "" And Not CInt(Request("uporders")) = 0 Then
		If Not IsNumeric(Request("uporders")) Then
			ErrMsg = ErrMsg & "<li>非法的系统参数!</li>"
			Founderr = True
			Exit Sub
		ElseIf CInt(Request("uporders")) = 0 Then
			ErrMsg = ErrMsg & "<li>请选择要提升的数字!</li>"
			Founderr = True
			Exit Sub
		End If
		Set Rs = NewAsp.Execute("SELECT SpecialID,orders FROM NC_Special WHERE ChannelID=" &ChannelID& " And SpecialID=" & CLng(Request("SpecialID")))
		orders = Rs(1)
		i = 0
		oldorders = 0
		Set Rs = NewAsp.Execute("SELECT SpecialID,orders FROM NC_Special WHERE ChannelID=" &ChannelID& " And orders<" & orders & " ORDER BY orders DESC")
		Do While Not Rs.EOF
			i = i + 1
			If CInt(Request("uporders")) >= i Then
				NewAsp.Execute ("UPDATE NC_Special SET orders=" & orders & "+" & oldorders & " WHERE ChannelID=" &ChannelID& " And SpecialID=" & Rs(0))
				If CInt(Request("uporders")) = i Then uporders = Rs(1)
			End If
			orders = Rs(1)
			Rs.movenext
		Loop
		NewAsp.Execute ("UPDATE NC_Special SET orders=" & uporders & " WHERE ChannelID=" &ChannelID& " And SpecialID=" & CLng(Request("SpecialID")))
		Set Rs = Nothing
	ElseIf Request("doorders") <> "" Then
		If Not IsNumeric(Request("doorders")) Then
			ErrMsg = ErrMsg & "<li>非法的参数!</li>"
			Founderr = True
			Exit Sub
		ElseIf CInt(Request("doorders")) = 0 Then
			ErrMsg = ErrMsg & "<li>请选择要下降的数字!</li>"
			Founderr = True
			Exit Sub
		End If
		Set Rs = NewAsp.Execute("SELECT SpecialID,orders FROM NC_Special WHERE ChannelID=" &ChannelID& " And SpecialID=" & CLng(Request("SpecialID")))
		orders = Rs(1)
		i = 0
		oldorders = 0
		Set Rs = NewAsp.Execute("SELECT SpecialID,orders FROM NC_Special WHERE ChannelID=" &ChannelID& " And orders>" & orders & " ORDER BY orders DESC")
		Do While Not Rs.EOF
			i = i + 1
			If CInt(Request("doorders")) >= i Then
				NewAsp.Execute ("UPDATE NC_Special SET orders=" & orders & " WHERE ChannelID=" &ChannelID& " And SpecialID=" & Rs(0))
				If CInt(Request("doorders")) = i Then doorders = Rs(1)
			End If
			orders = Rs(1)
			Rs.movenext
		Loop
		NewAsp.Execute ("UPDATE NC_Special SET orders=" & doorders & " WHERE ChannelID=" &ChannelID& " And SpecialID=" & CLng(Request("SpecialID")))
		Set Rs = Nothing
	End If
	Response.redirect "admin_special.asp?action=orders&ChannelID=" & ChannelID
End Sub
%>