<!--#include file="../conn.asp"-->
<!--#include file="admin_check.asp"-->
<!--#include file="../inc/function.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>管理页面</title>
<link id="maincss" rel="stylesheet" href="images/css/admin_style_<%= AdminSkin %>.css" type="text/css" media="all" />
</head>
<body leftmargin="0" bottommargin="0" rightmargin="0" topmargin="5" marginheight="0" marginwidth="0" bgcolor="#DDEEFF">
<%
Call chkFlag(9)
Dim Act
Act=Trim(Request.QueryString("act"))
Dim AskD
opendb
Set AskD = Server.CreateObject("KwAsk.FunAsk")
	set AskD.myConn =conn
	AskD.myPredb =predb
	AskD.Getsetting()
	siteinfo=AskD.siteinfo
	setting=AskD.setting
	regForm=AskD.regForm
select case act
   case "show"
    call ShowRole()
   case "save"
    call saveRole()
   case else
    call main()
end select
set AskD.myConn =Nothing
closedb
Set AskD = Nothing

sub saverole()
dim checkbox
checkbox=Trim(Request.Form("checkbox"))
checkbox=replace(checkbox," ","")
checkbox=","&checkbox&","
   conn.execute("update "&predb&"Score set userflag='"&checkbox&"' where grade="&Trim(Request.Form("grade")))
   Call AskD.ClsUserRole()
   Response.Redirect("?")
end sub

Sub ShowRole()
dim usertype,grade,rs,userflag
usertype=Trim(Request.QueryString("type"))
grade=Trim(Request.QueryString("grade"))

set rs=conn.execute("select userflag from "&predb&"Score where grade="&grade)
userflag=rs("userflag")
set rs=nothing
%>
<table class="tableBorder" cellspacing="1" cellpadding="2" width="96%" align="center" border="0">
    <tr>
		<th height="25" colspan="3" align="left"><strong>用户权限设置</strong></th>
  </tr>
<form action="?act=save" method="post"><input name="grade" type="hidden" value="<%= grade %>">
    <tr>
      <td colspan="3" class="TableRow1">普通用户对应权限 <font color="#FF0000">等级：<%= grade %></font> <% If usertype="1" Then %><font color="#009900">专家普通权限继承其对应普通等级</font><% End If %></td>
    </tr>
  <tr>
    <td width="23%" align="right" class="TableRow2">允许上传附件：</td>
    <td width="31%" align="center" class="TableRow2"><input name="checkbox" type="checkbox" id="checkbox" value="1" <% If instr(userflag,",1,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>></td>
    <td width="46%" class="TableRow2"><font color="#999999">提问或回答时可以上传附件</font></td>
  </tr>
  <tr>
    <td align="right" class="TableRow1">允许参考资料：</td>
    <td align="center" class="TableRow1">
      <input name="checkbox" type="checkbox" id="checkbox" value="2" <% If instr(userflag,",2,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>>    </td>
    <td class="TableRow1">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="TableRow2">允许图文问答：</td>
    <td align="center" class="TableRow2"><input name="checkbox" type="checkbox" id="checkbox" value="3" <% If instr(userflag,",3,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>></td>
    <td class="TableRow2"><font color="#999999">提问时可以使用编辑器</font></td>
  </tr>
  
  <tr>
    <td align="right" class="TableRow1">允许删除提问：</td>
    <td align="center" class="TableRow1"><input name="checkbox" type="checkbox" id="checkbox" value="4" <% If instr(userflag,",4,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>></td>
    <td class="TableRow1">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="TableRow2">允许删除回答：</td>
    <td align="center" class="TableRow2"><input name="checkbox" type="checkbox" id="checkbox" value="5" <% If instr(userflag,",5,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>></td>
    <td class="TableRow2">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="TableRow1">允许站内短信：</td>
    <td align="center" class="TableRow1"><input name="checkbox" type="checkbox" id="checkbox" value="6" <% If instr(userflag,",6,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>></td>
    <td class="TableRow1">&nbsp;</td>
  </tr>
  <tbody style="display:none">
  <tr>
    <td align="right" class="TableRow2">允许建立群：</td>
    <td align="center" class="TableRow2"><input name="checkbox" type="checkbox" id="checkbox" value="7" <% If instr(userflag,",7,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>></td>
    <td class="TableRow2">&nbsp;</td>
  </tr>
  </tbody>
  <tr>
    <td align="right" class="TableRow1">允许评论：</td>
    <td align="center" class="TableRow1"><input name="checkbox" type="checkbox" id="checkbox" value="8" <% If instr(userflag,",8,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>></td>
    <td class="TableRow1">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="TableRow2">允许定制页面模板：</td>
    <td align="center" class="TableRow2"><input name="checkbox" type="checkbox" id="checkbox" value="9" <% If instr(userflag,",9,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>></td>
    <td class="TableRow2">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="TableRow1">允许签名：</td>
    <td align="center" class="TableRow1"><input name="checkbox" type="checkbox" id="checkbox" value="10" <% If instr(userflag,",10,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>></td>
    <td class="TableRow1">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="TableRow2">允许上传头像：</td>
    <td align="center" class="TableRow2"><input name="checkbox" type="checkbox" id="checkbox" value="11" <% If instr(userflag,",11,")>0 Then %>checked<% End If %><% If usertype="1" Then %> onClick="return false;"<% End If %>></td>
    <td class="TableRow2">&nbsp;</td>
  </tr>
  <% If usertype="1" Then %>
  <tr>
    <td colspan="3" class="TableRow1">专家用户对应权限 <font color="#FF0000">等级：<%= grade %></font></td>
  </tr>
  <tr>
    <td align="right" class="TableRow2">允许专家采纳：</td>
    <td align="center" class="TableRow2"><input name="checkbox" type="checkbox" id="checkbox" value="12" <% If instr(userflag,",12,")>0 Then %>checked<% End If %>></td>
    <td class="TableRow2">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="TableRow1">允许专家删除提问：</td>
    <td align="center" class="TableRow1"><input name="checkbox" type="checkbox" id="checkbox" value="13" <% If instr(userflag,",13,")>0 Then %>checked<% End If %>></td>
    <td class="TableRow1">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="TableRow2">允许专家删除回答：</td>
    <td align="center" class="TableRow2"><input name="checkbox" type="checkbox" id="checkbox" value="14" <% If instr(userflag,",14,")>0 Then %>checked<% End If %>></td>
    <td class="TableRow2">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="TableRow1">允许专家删除评论：</td>
    <td align="center" class="TableRow1">
      <input name="checkbox" type="checkbox" id="checkbox" value="15" <% If instr(userflag,",15,")>0 Then %>checked<% End If %>>    </td>
    <td class="TableRow1">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" class="TableRow2">允许专家审核：</td>
    <td align="center" class="TableRow2"><input name="checkbox" type="checkbox" id="checkbox" value="16" <% If instr(userflag,",16,")>0 Then %>checked<% End If %>></td>
    <td class="TableRow2">&nbsp;</td>
  </tr>
  <% End If %>
  <tr>
    <td colspan="3" align="center" class="TableRow1"><input type="submit" name="button" id="button" value="确认修改">
      &nbsp; <input type="button" name="button2" id="button2" value=" 返 回 " onClick="history.go(-1)"></td>
  </tr>
  </form>
</table>
<%
End Sub

Sub Main()
%>
<table class="tableBorder" cellspacing="1" cellpadding="2" width="96%" align="center" border="0">
    <tr>
		<th height="25" colspan="3" align="left"><strong>用户权限设置</strong></th>
	</tr>

  <tr>
    <td colspan="3" align="center" class="TableRow2"><font color="#008800"><strong>注册会员权限</strong></font></td>
  </tr>
 <%
Dim rs,sql,i,r,userflag
Set rs = Server.CreateObject("adodb.recordset")
sql="select * from "&predb&"Score order by grade asc"
rs.open sql,conn,1,1
do while not rs.eof
userflag=rs("userflag")
i=i+1
if i mod 2=0 then 
   r=2
else
   r=1
end if
 %>
  <tr>
    <td width="7%" class="TableRow<%= r %>">会员<b><%= rs("grade") %></b></td>
    <td width="9%" align="center" class="TableRow<%= r %>"><a href="?act=show&type=0&grade=<%= rs("grade") %>"><img src="Images/editg.gif" width="48" height="18" border="0"></a></td>
    <td width="84%" class="TableRow<%= r %>">
    <% If instr(userflag,",1,")>0 Then %>允许上传附件｜<% End If %><% If instr(userflag,",2,")>0 Then %>允许参考资料｜<% End If %><% If instr(userflag,",3,")>0 Then %>允许图文问答｜<% End If %><% If instr(userflag,",4,")>0 Then %>允许删除提问｜<% End If %><% If instr(userflag,",5,")>0 Then %>允许删除回答｜<% End If %><% If instr(userflag,",6,")>0 Then %>允许站内短信｜<% End If %><% If instr(userflag,",7,")>0 Then %>允许建立群｜<% End If %><% If instr(userflag,",8,")>0 Then %>允许评论｜<% End If %><% If instr(userflag,",9,")>0 Then %>允许建立个人页面｜<% End If %><% If instr(userflag,",10,")>0 Then %>允许签名｜<% End If %><% If instr(userflag,",11,")>0 Then %>允许上传头像<% End If %>
    </td>
  </tr>
<%
rs.movenext
loop
%>
  <tr>
    <td colspan="3" align="center" class="TableRow2"><font color="#008800"><strong>专家会员权限</strong></font></td>
  </tr>
<%
rs.movefirst
i=0
do while not rs.eof
userflag=rs("userflag")
i=i+1
if i mod 2=0 then 
   r=2
else
   r=1
end if
%>
  <tr>
    <td class="TableRow<%= r %>">专家 <b><%= rs("grade") %></b></td>
    <td align="center" class="TableRow<%= r %>"><a href="?act=show&type=1&grade=<%= rs("grade") %>"><img src="Images/editg.gif" width="48" height="18" border="0"></a></td>
    <td class="TableRow<%= r %>">
    <% If instr(userflag,",1,")>0 Then %>允许上传附件｜<% End If %><% If instr(userflag,",2,")>0 Then %>允许参考资料｜<% End If %><% If instr(userflag,",3,")>0 Then %>允许图文问答｜<% End If %><% If instr(userflag,",4,")>0 Then %>允许删除提问｜<% End If %><% If instr(userflag,",5,")>0 Then %>允许删除回答｜<% End If %><% If instr(userflag,",6,")>0 Then %>允许站内短信｜<% End If %><% If instr(userflag,",7,")>0 Then %>允许建立群｜<% End If %><% If instr(userflag,",8,")>0 Then %>允许评论｜<% End If %><% If instr(userflag,",9,")>0 Then %>允许建立个人页面｜<% End If %><% If instr(userflag,",10,")>0 Then %>允许签名｜<% End If %><% If instr(userflag,",11,")>0 Then %>允许上传头像<% End If %>
    <br><% If instr(userflag,",12,")>0 Then %>允许专家采纳｜<% End If %><% If instr(userflag,",13,")>0 Then %>允许专家删除｜<% End If %><% If instr(userflag,",14,")>0 Then %>允许专家删除回答｜<% End If %><% If instr(userflag,",15,")>0 Then %>允许专家删除评论 | <% End If %><% If instr(userflag,",16,")>0 Then %>允许专家审核<% End If %>
    </td>
  </tr>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</table>
<% end sub %>
<br>
</body>
</html>
