<!-- #include file="include/admin_onlogin.asp" -->
<%
admins=true
index_url="other"
tit_fir="权限"
tit="权限管理"

call admin_header(0,0)
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?'><%response.write tit%></a></td>
  <td width=10></td>
  <td><a href='admins_menu.asp'>管理菜单</a></td>
  </tr>
  </table>
</td></tr>
</table>
<%
call admin_table(1)
call menu_main()
call admin_ender(1)

sub menu_main()
  dim m_popedom,n_p,usernames,popedoms,username,popedom,frm_view,tmp1,tmp2
  frm_view=false
  username=trim(request.querystring("username"))
%>
<tr><td class=td colspan=2><%response.write tit%></td></tr>
<tr valign=top>
<td width='20%' align=center>
  <table border=0 cellspacing=1 cellpadding=4>
  <tr><td height=30>现有管理员：</td></tr>
<%
  sql="select username,popedom from user_data where power='"&format_power2(1,1)&"' order by id"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    usernames=rs("username")
    response.write vbcrlf&"<tr><td>"&img_admin("s_left","")&"<a href='?username="&server.urlencode(usernames)&"'"
    if username=usernames then
      popedoms=rs("popedom")
      if len(popedoms)<>50 then 
	    popedoms="00000000000000000000000000000000000000000000000000"
	  end if 
      popedom=right(popedoms,(50-max_pop))
      response.write " class=red"
      frm_view=true
    end if
    response.write ">"&usernames&"</a></td></tr>"
    rs.movenext
  loop
  rs.close
  if frm_view and joekoe_cms.chk() then
    for i=1 to max_pop
      tmp2=trim(request.form("popedom_"&i))
      if tmp2="yes" then
        tmp1=tmp1&"1"
      else
        tmp1=tmp1&"0"
      end if
    next
    popedoms=tmp1&popedom
    call joekoe_cms.exec("update user_data set popedom='"&popedoms&"' where username='"&username&"'",0)
    response.write "<script language=javascript>alert(""成功修改了管理员 "&username&" 的管理权限！"");</script>"
  end if
%>
  </table>
</td>
<td width='80%' align=center>
  <table border=0 width=300>
  <tr><td width='50%'></td><td width='50%'></td></tr>
  <form name=popedom_frm action='?username=<%response.write server.urlencode(username)%>' method=post>
  <input type=hidden name=chk value='yes'>
<%
  i=0
  sql="select m_popedom,m_tit from admin_menu where m_is_master=1 and m_popedom>0 order by m_popedom"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    m_popedom=rs("m_popedom")
    if i mod 2=0 then response.write vbcrlf&"  <tr>"
    response.write vbcrlf&"  <td><input type=checkbox value='yes' name=popedom_"&m_popedom
    if frm_view=true then
      n_p=joekoe_cms.popedom_p(popedoms,m_popedom)
      if int(n_p)>0 then response.write " checked"
    end if
    response.write ">"&rs("m_tit")&tit_fir&"<font class=tims>("&m_popedom&")</font></td>"
    if i+1 mod 2=0 then response.write vbcrlf&"  </tr>"
    rs.movenext
    i=i+1
  loop
  rs.close
%>
  <tr><td colspan=2 align=center height=30>
<% if frm_view then %>
<input type=submit value='提 交 修 改'>　　　<input type=reset value=' 重 置 '></td>
</form>
<% else %>
<font class=blue>请点选左边的管理员以进行下一步操作</font></td>
<% end if %>
  </tr>
  </table>
</td>
</tr>
<%
end sub
%>