<!--#include file=../conn.asp-->
<!-- #include file="inc/const.asp" -->
<!--#include file="../z_BMEval_Conn.asp"-->
<!-- #include file="inc/z_BmEval_Const.asp" -->
<%
Head()
dim admin_flag
admin_flag=",36,"
if not Dvbbs.master or instr(","&session("flag")&",",admin_flag)=0 then
	Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=admin_index.asp target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
	dvbbs_error()
Else
	Call main()
	Footer()
End if

Sub main()
	If Request("action")="save_bm" Then
 		Call Save_BM()
 	ElseIf Request("action")="save_member" Then
 		Call Save_Member()
 	Else
 		Call Info()
	End If
End Sub

Sub Info()%>
	<br>
	<table width="100%" cellspacing="1" cellpadding="5" align="center" class=tableBorder>
		<form action="?action=save_bm" method="post">
		<tr height=25>
			<th colspan="2">版主评估基本设置</th>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>发薪日间隔&nbsp;</td>
			<td class=forumrow><input type=text name="PayDays" value="<%=PayDays%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>工作积分是否计算发帖量&nbsp;</td>
			<td class=forumrow><input type=Radio name="isArticle" value="0"<%If Not isArticle Then%> Checked<%End If%>> 不计算&nbsp;&nbsp;<input type=Radio name="isArticle" value="1"<%If isArticle Then%> Checked<%End If%>> 计算</td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>发帖量计算系数&nbsp;</td>
			<td class=forumrow><input type=text name="ArticleRate" value="<%=FormatNumber(ArticleRate,1,-1)%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>工作积分是否计算在线时间&nbsp;</td>
			<td class=forumrow><input type=Radio name="isOnlineTime" value="0"<%If Not isOnlineTime Then%> Checked<%End If%>> 不计算&nbsp;&nbsp;<input type=Radio name="isOnlineTime" value="1"<%If isOnlineTime Then%> Checked<%End If%>> 计算</td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>在线时间计算系数&nbsp;</td>
			<td class=forumrow><input type=text name="OnlineTimeRate" value="<%=FormatNumber(OnlineTimeRate,1,-1)%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>工作积分是否计算维护量&nbsp;</td>
			<td class=forumrow><input type=Radio name="isLogs" value="0"<%If Not isLogs Then%> Checked<%End If%>> 不计算&nbsp;&nbsp;<input type=Radio name="isLogs" value="1"<%If isLogs Then%> Checked<%End If%>> 计算</td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>维护量计算系数&nbsp;</td>
			<td class=forumrow><input type=text name="LogsRate" value="<%=FormatNumber(LogsRate,1,-1)%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>每个版面的基本工资&nbsp;</td>
			<td class=forumrow><input type=text name="SalaryPerBoard" value="<%=SalaryPerBoard%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>贵宾的附加工资&nbsp;</td>
			<td class=forumrow><input type=text name="SalaryForVIP" value="<%=SalaryForVip%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>超级版主的附加工资&nbsp;</td>
			<td class=forumrow><input type=text name="SalaryForSBM" value="<%=SalaryForSBM%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>管理员的附加工资&nbsp;</td>
			<td class=forumrow><input type=text name="SalaryForMaster" value="<%=SalaryForMaster%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>得到业绩工资所需工作积分底线&nbsp;</td>
			<td class=forumrow><input type=text name="BonusPoint" value="<%=BonusPoint%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>工作积分每增加多少涨一级业绩工资&nbsp;</td>
			<td class=forumrow><input type=text name="BonusStep" value="<%=BonusStep%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>每级业绩工资增加的金钱&nbsp;</td>
			<td class=forumrow><input type=text name="BonusWealth" value="<%=BonusWealth%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>每级业绩工资增加的经验&nbsp;</td>
			<td class=forumrow><input type=text name="BonusEP" value="<%=BonusEP%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>每级业绩工资增加的魅力&nbsp;</td>
			<td class=forumrow><input type=text name="BonusCP" value="<%=BonusCP%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>每级业绩工资增加的威望&nbsp;</td>
			<td class=forumrow><input type=text name="BonusPower" value="<%=BonusPower%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>超过多少天未登录取消版主职务&nbsp;</td>
			<td class=forumrow><input type=text name="BM_Period" value="<%=BM_Period%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>是否自动取消失职版主职务&nbsp;</td>
			<td class=forumrow><input type=Radio name="isAutoCancel" value="0"<%If Not isAutoCancel Then%> Checked<%End If%>> 手动&nbsp;&nbsp;<input type=Radio name="isAutoCancel" value="1"<%If isAutoCancel Then%> Checked<%End If%>> 自动</td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>发薪时是否短信通知&nbsp;</td>
			<td class=forumrow><input type=Radio name="isPayMsg" value="0"<%If Not isPayMsg Then%> Checked<%End If%>> 否&nbsp;&nbsp;<input type=Radio name="isPayMsg" value="1"<%If isPayMsg Then%> Checked<%End If%>> 是</td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>撤消版主时是否发布公告&nbsp;</td>
			<td class=forumrow><input type=Radio name="isCancelAnnounce" value="0"<%If Not isCancelAnnounce Then%> Checked<%End If%>> 否&nbsp;&nbsp;<input type=Radio name="isCancelAnnounce" value="1"<%If isCancelAnnounce Then%> Checked<%End If%>> 是</td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>撤消版主时是否短信通知被撤消者&nbsp;</td>
			<td class=forumrow><input type=Radio name="isCancelMsg" value="0"<%If Not isCancelMsg Then%> Checked<%End If%>> 否&nbsp;&nbsp;<input type=Radio name="isCancelMsg" value="1"<%If isCancelMsg Then%> Checked<%End If%>> 是</td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>撤消的版主降级到哪个用户组&nbsp;</td>
			<td class=forumrow><Select name="CancelToGroupID" size=1><%=DownGroupList()%></Select></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>版主评估每页显示的记录数&nbsp;</td>
			<td class=forumrow><input type=text name="BM_PageSize" value="<%=BM_PageSize%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td colspan=2 class=forumrowhighlight align=center>不需要进行考核的用户组&nbsp;&nbsp;全选/取消&nbsp;<input type=checkbox name=chkall1 value=on onclick="CheckAll1(this.form)"></td>
		</tr>
		<tr height=25 valign=middle>
			<td colspan=2 class=forumrow align=center><%=ShowUserGroup()%></td>
		</tr>
		<tr height=25 valign=middle>
			<td colspan=2 class=forumrowhighlight align=center>不需要进行考核的版主&nbsp;&nbsp;全选/取消&nbsp;<input type=checkbox name=chkall2 value=on onclick="CheckAll2(this.form)"></td>
		</tr>
		<tr height=25 valign=middle>
			<td colspan=2 class=forumrow align=center><%=ShowBoardMaster()%></td>
		</tr>
		<tr height=25 valign=middle>
			<td colspan=2 class=forumrowhighlight align=center><input type=submit name="submit" value=" 提  交 "></td>
		</tr>
		</form>
	</table>
	<br>
	<table width="100%" cellspacing="1" cellpadding="5" align="center" class=tableBorder>
		<form action="?action=save_member" method="post">
		<tr height=25>
			<th colspan="2">会员情况基本设置</th>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>多少天未登录的松散会员将被删除&nbsp;</td>
			<td class=forumrow><input type=text name="Member_Period" value="<%=Member_Period%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>会员情况每页显示的记录数&nbsp;</td>
			<td class=forumrow><input type=text name="Member_PageSize" value="<%=Member_PageSize%>" size=30></td>
		</tr>
		<tr height=25 valign=middle>
			<td width=40% class=forumrowhighlight align=right>是否自动删除松散会员&nbsp;</td>
			<td class=forumrow><input type=Radio name="isAutoDelete" value="0"<%If Not isAutoDelete Then%> Checked<%End If%>> 手动&nbsp;&nbsp;<input type=Radio name="isAutoDelete" value="1"<%If isAutoDelete Then%> Checked<%End If%>> 自动</td>
		</tr>
		<tr height=25 valign=middle>
			<td colspan=2 class=forumrowhighlight align=center><input type=submit name="submit" value=" 提  交 "></td>
		</tr>
		</form>
	</table>
	<SCRIPT LANGUAGE=JavaScript>
	<!--
	function CheckAll1(form) {  
		for (var i=0;i<form.elements.length;i++) {  
			var e = form.elements[i];  
			if (e.name == "UnEvalUserGroupID")
				e.checked = form.chkall1.checked;  
		}
	}
	function CheckAll2(form) {
		for (var i=0;i<form.elements.length;i++) {  
			var e = form.elements[i];  
			if (e.name == "UnEvalUserID")
				e.checked = form.chkall2.checked;  
		}
	}
	function SetBoardMaster(form,UserGroupID,isChecked) {
		for (var i=0;i<form.elements.length;i++) {  
			var e = form.elements[i];  
			if (e.name == "UnEvalUserID" && e.id == UserGroupID)
				e.disabled = isChecked
		}
	}
	//-->
	</SCRIPT>
<%End Sub

Function DownGroupList()
	Dim i
	Set BmEvalRs=Dvbbs.Execute("Select UserGroupID,UserTitle From Dv_UserGroups Where MinArticle=-1 Order By UserGroupID") 
	BmEvalSQL=BmEvalRs.GetRows
	Set BmEvalRs=Nothing
	For i=0 To Ubound(BmEvalSQL,2)
		DownGroupList=DownGroupList & "<option value="""&BmEvalSQL(0,i)&""""
		If Cint(BmEvalSQL(0,i))=Cint(CancelToGroupID) Then
			DownGroupList=DownGroupList & " selected"
		End If
		DownGroupList=DownGroupList & ">" & BmEvalSQL(1,i) & "</option>"
	Next	
End Function

Function ShowUserGroup()
	Dim i,k

	Set BmEvalRs=Dvbbs.Execute("Select UserGroupID,UserTitle From Dv_UserGroups Where Not ParentGID In (0,3) And UserGroupID<>4 And UserGroupID<>5 And UserGroupID<>6 And UserGroupID<>7 Order By UserGroupID")
	If Not BmEvalRs.Eof And Not BmEvalRs.Bof Then
		BmEvalSQL=BmEvalRs.GetRows
		ShowUserGroup = "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"" >"
		k=0
		For i=0 To Ubound(BmEvalSQL,2)
			k=k+1
			If k=1 Then
				ShowUserGroup = ShowUserGroup & "<tr><td align=right>" & BmEvalSQL(1,i) & "</td>"
				ShowUserGroup = ShowUserGroup & "<td width=""1%"">&nbsp;<input type=checkbox value="""&BmEvalSQL(0,i)&""" name=""UnEvalUserGroupID"" onclick=""SetBoardMaster(this.form,this.value,this.checked)"""
				If InStr(1,","&UnEvalUserGroupID&",",","&BmEvalSQL(0,i)&",")>0 Then
					ShowUserGroup = ShowUserGroup & " checked"
				End If
				ShowUserGroup = ShowUserGroup & ">&nbsp;</td>"
			Else
				ShowUserGroup = ShowUserGroup & "<td width=""1%"">&nbsp;<input type=checkbox value="""&BmEvalSQL(0,i)&""" name=""UnEvalUserGroupID"" onclick=""SetBoardMaster(this.form,this.value,this.checked)"""
				If InStr(1,","&UnEvalUserGroupID&",",","&BmEvalSQL(0,i)&",")>0 Then
					ShowUserGroup = ShowUserGroup & " checked"
				End If
				ShowUserGroup = ShowUserGroup & ">&nbsp;</td><td>" & BmEvalSQL(1,i) & "</td></tr>"
				k=0
			End If
		Next
		ShowUserGroup = ShowUserGroup & "</table>"
	Else
		ShowUserGroup = "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"" ><tr><td width=""100%"" align=center>没有任何用户组！</td></tr></table>"
	End If
	Set BmEvalRs=Nothing
End Function

Function ShowBoardMaster()
	Dim i,k
	Set BmEvalRs=Dvbbs.Execute("Select u.UserID,u.UserName,u.UserGroupID From [Dv_User] u Inner Join [Dv_UserGroups] g On u.UserGroupID=g.UserGroupID Where Not g.ParentGID In (0,3) And u.UserGroupID Not In (4,5,6,7) Order By u.UserGroupID")
	If Not BmEvalRs.Eof And Not BmEvalRs.Bof Then
		BmEvalSQL=BmEvalRs.GetRows
		ShowBoardMaster = "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"" >"
		k=0
		For i=0 To Ubound(BmEvalSQL,2)
			k=k+1
			If k=1 Then ShowBoardMaster = ShowBoardMaster & "<tr>"
			If k=1 Or k=3 Then
				ShowBoardMaster = ShowBoardMaster & "<td align=right>" & BmEvalSQL(1,i) & "</td>"
				ShowBoardMaster = ShowBoardMaster & "<td width=""1%"">&nbsp;<input type=checkbox value="""&BmEvalSQL(0,i)&""" name=""UnEvalUserID"" id="""&BmEvalSQL(2,i)&""""
				If InStr(1,","&UnEvalUserID&",",","&BmEvalSQL(0,i)&",") Then
					ShowBoardMaster = ShowBoardMaster & " checked"
				End If
				If InStr(1,","&UnEvalUserGroupID&",",","&BmEvalSQL(2,i)&",")>0 Then
					ShowBoardMaster = ShowBoardMaster & " disabled=true"
				End If
				ShowBoardMaster = ShowBoardMaster & ">&nbsp;</td>"
			Else
				ShowBoardMaster = ShowBoardMaster & "<td width=""1%"">&nbsp;<input type=checkbox value="""&BmEvalSQL(0,i)&""" name=""UnEvalUserID"" id="""&BmEvalSQL(2,i)&"""" 
				If InStr(1,","&UnEvalUserID&",",","&BmEvalSQL(0,i)&",")>0 Then
					ShowBoardMaster = ShowBoardMaster & " checked"
				End If
				If InStr(1,","&UnEvalUserGroupID&",",","&BmEvalSQL(2,i)&",")>0 Then
					ShowBoardMaster = ShowBoardMaster & " disabled=true"
				End If
				ShowBoardMaster = ShowBoardMaster & ">&nbsp;</td><td>" & BmEvalSQL(1,i) & "</td>"
			End If
			If k=4 Then
				ShowBoardMaster = ShowBoardMaster & "</tr>"
				k=0
			End If
		Next
		ShowBoardMaster = ShowBoardMaster & "</table>"
	Else
		ShowBoardMaster = "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"" ><tr><td width=""100%"" align=center>没有任何用户组！</td></tr></table>"
	End If
	Set BmEvalRs=Nothing
End Function

Sub Save_BM()
	PayDays=Request.Form("PayDays")
	SalaryPerBoard=Request.Form("SalaryPerBoard")
	SalaryForVIP=Request.Form("SalaryForVIP")
	SalaryForSBM=Request.Form("SalaryForSBM")
	SalaryForMaster=Request.Form("SalaryForMaster")
	BonusPoint=Request.Form("BonusPoint")
	BonusStep=Request.Form("BonusStep")
	BonusWealth=Request.Form("BonusWealth")
	BonusPower=Request.Form("BonusPower")
	BonusEP=Request.Form("BonusEP")
	BonusCP=Request.Form("BonusCP")
	BM_Period=Request.Form("BM_Period")
	BM_PageSize=Request.Form("BM_PageSize")
	If Not isInteger(PayDays) Or Not isInteger(SalaryPerBoard) Or Not isInteger(SalaryForVIP) Or Not isInteger(SalaryForSBM) Or Not isInteger(SalaryForMaster) Or Not isInteger(BonusPoint) Or Not isInteger(BonusStep) Or Not isInteger(BonusWealth) Or Not isInteger(BonusPower) Or Not isInteger(BonusEP) Or Not isInteger(BonusCP) Or Not isInteger(BM_Period) Or Not isInteger(BM_PageSize) then
		Response.Write "输入的数据有错误！"
		Response.End 
	End If
	ArticleRate=Request.Form("ArticleRate")
	OnlineTimeRate=Request.Form("OnlineTimeRate")
	LogsRate=Request.Form("LogsRate")
	If Not IsNumeric(ArticleRate) Or Not IsNumeric(OnlineTimeRate) Or Not IsNumeric(LogsRate) Then
		Response.Write "输入的数据有错误！"
		Response.End 
	End If
	isArticle=Request.Form("isArticle")
	If isArticle="1" Then
		isArticle=True
	Else
		isArticle=False
	End If
	isOnlineTime=Request.Form("isOnlineTime")
	If isOnlineTime="1" Then
		isOnlineTime=True
	Else
		isOnlineTime=False
	End If
	isLogs=Request.Form("isLogs")
	If isLogs="1" Then
		isLogs=True
	Else
		isLogs=False
	End If
	isAutoCancel=Request.Form("isAutoCancel")
	If isAutoCancel="1" Then
		isAutoCancel=True
	Else
		isAutoCancel=False
	End If
	isPayMsg=Request.Form("isPayMsg")
	If isPayMsg="1" Then
		isPayMsg=True
	Else
		isPayMsg=False
	End IF
	isCancelAnnounce=Request.Form("isCancelAnnounce")
	If isCancelAnnounce="1" Then
		isCancelAnnounce=True
	Else
		isCancelAnnounce=False
	End If
	isCancelMsg=Request.Form("isCancelMsg")
	If isCancelMsg="1" Then
		isCancelMsg=True
	Else
		isCancelMsg=False
	End If
	UnEvalUserGroupID=Replace(Request.Form("UnEvalUserGroupID")," ","")
	UnEvalUserID=Replace(Request.Form("UnEvalUserID")," ","")
	CancelToGroupID=CInt(Request.Form("CancelToGroupID"))
	Set BmEvalRs= Server.CreateObject("ADODB.Recordset") 
	BmEvalSQL = "Select * From BM_Config" 
	BmEvalRs.Open BmEvalSQL,BmEval_Conn,1,3 
	If BmEvalRs.Eof Or BmEvalRs.Bof Then 
		BmEvalRs.AddNew
	End If
	BmEvalRs("PayDays")=PayDays
	BmEvalRs("isArticle")=isArticle
	BmEvalRs("ArticleRate")=ArticleRate
	BmEvalRs("isOnlineTime")=isOnlineTime
	BmEvalRs("OnlineTimeRate")=OnlineTimeRate
	BmEvalRs("isLogs")=isLogs
	BmEvalRs("LogsRate")=LogsRate
	BmEvalRs("SalaryPerBoard")=SalaryPerBoard
	BmEvalRs("SalaryForVIP")=SalaryForVIP
	BmEvalRs("SalaryForSBM")=SalaryForSBM
	BmEvalRs("SalaryForMaster")=SalaryForMaster
	BmEvalRs("BonusPoint")=BonusPoint
	BmEvalRs("BonusStep")=BonusStep
	BmEvalRs("BonusWealth")=BonusWealth
	BmEvalRs("BonusPower")=BonusPower
	BmEvalRs("BonusEP")=BonusEP
	BmEvalRs("BonusCP")=BonusCP
	BmEvalRs("BM_Period")=BM_Period
	BmEvalRs("isAutoCancel")=isAutoCancel
	BmEvalRs("BM_PageSize")=BM_PageSize
	BmEvalRs("isPayMsg")=isPayMsg
	BmEvalRs("isCancelAnnounce")=isCancelAnnounce
	BmEvalRs("isCancelMsg")=isCancelMsg
	BmEvalRs("UnEvalUserGroupID")=UnEvalUserGroupID
	BmEvalRs("UnEvalUserID")=UnEvalUserID
	BmEvalRs("CancelToGroupID")=CancelToGroupID
	BmEvalRs.Update 
	BmEvalRs.Close
	Set BmEvalRs=Nothing 
	Response.Write "修改成功!" 
End Sub

Sub Save_Member() 
	Member_Period=Request.Form("Member_Period")
	Member_PageSize=Request.Form("Member_PageSize")
	If Not isInteger(Member_Period) Or Not isInteger(Member_PageSize) then
		Response.Write "输入的数据有错误！"
		Response.End 
	End If
	isAutoDelete=Request.Form("isAutoDelete")
	If isAutoDelete="1" Then
		isAutoDelete=True
	Else
		isAutoDelete=False
	End If
	Set BmEvalRs= Server.CreateObject("ADODB.Recordset") 
	BmEvalSQL = "Select * From BM_Config" 
	BmEvalRs.Open BmEvalSQL,BmEval_Conn,1,3 
	If BmEvalRs.Eof Or BmEvalRs.Bof Then 
		BmEvalRs.AddNew
	End If
	BmEvalRs("Member_Period")=Member_Period
	BmEvalRs("Member_PageSize")=Member_PageSize
	BmEvalRs("isAutoDelete")=isAutoDelete
	BmEvalRs.Update 
	BmEvalRs.Close 
	Set BmEvalRs=Nothing 
	Response.Write "修改成功!" 
End Sub
%>