<!--#include file="user_top.asp"-->
<div id="main">
  <div class="submenu">
  	<div class="side_c1 side11"></div>
    <div class="side_c2 side21"></div>
	<div class="submenu_content">
	</div>
  </div>
  <div class="content">
  	<div class="content_top">
		  	<div class="side_d1 side11"></div>
		    <div class="side_d2 side21"></div>
			博客团队
	</div>
	
    <div class="content_body">
<%
dim action,id
action=request.QueryString("action")
id=trim(request("id"))
select case action
	case "addotheruser"
		call addotheruser()
	case "del"
		call delotheruser()
	case else
		call main
end select
%>
	</div>
	
    <div class="content_bot">
		  	<div class="side_e1 side12"></div>
   			<div class="side_e2 side22"></div>
 	</div>
	
  </div>
</div>  
  
  
  <div id="bottom"><%=oblog.user_copyright%></div>

</body>
</html>
<%

sub addotheruser()
	dim otheruser,rs
	otheruser=oblog.filt_badstr(Trim(Request.Form("otheruser")))
	If otheruser="" Then
		oblog.adderrstr("用户名称不能为空！")
		oblog.showusererr
		exit sub
	End If	 
	set rs=oblog.execute("select en_blogteam,userid from [oblog_user] where username='"&otheruser&"'")
	if rs.eof then
		set rs=nothing
		oblog.adderrstr("无此用户！")
		oblog.showusererr
		exit sub
	else
		if rs(0)<>1 then
			set rs=nothing
			oblog.adderrstr("该用户设置为不允许被加入团队！")
			oblog.showusererr
			exit sub
		else
			oblog.execute("insert into [oblog_blogteam] (mainuserid,otheruserid) values ("&oblog.logined_uid&","&rs(1)&")")
			set rs=nothing
			oblog.showok "加入团队成员成功！","user_team.asp"		
		end if		
	end if
end sub

sub delotheruser
	if id="" then
		oblog.adderrstr("请指定删除参数！")
		oblog.showusererr
		exit sub
	end if
	id=clng(id)
	oblog.execute("delete  from [oblog_blogteam] where id="&id&" and ( mainuserid="&oblog.logined_uid&" or otheruserid="&oblog.logined_uid&" )")
	oblog.showok "操作成功！",""
end sub
sub main()
%>
<style type="text/css">
<!--
	#list ul{ width: 85%;margin-left:-0px;margin-bottom:10px;} 
	#list ul li.t1 { width: 50px} 
	#list ul li.t2 { width: 300px} 
	#list ul li.t3 { width: 150px} 
-->
</style>
<h1>加入朋友到我的博客团队</h1>
<div id="list">	
	<ul class="list_edit" style="margin-left:0">
	可以让好友把日志发表到我的blog，现在就邀请吧!<hr>
	<form name="form1" method="post" action="user_team.asp?action=addotheruser">
	用户名： 
	<input name="otheruser" type="text" id="otheruser" maxlength="20" />            
	<input type="submit" value="邀请" />			             
	</form>
	</ul>
</div>
<h1>我的团队管理</h1>
<div id="list">
	<ul class="list_top">
	<li class="t1">排序</li>
	<li class="t2">团队成员</li>
	<li class="t3">管理操作</li>
	</ul>
<%
dim rs,i
set rs=oblog.execute("select a.username,b.id, a.user_dir,a.user_folder from oblog_user a,oblog_blogteam b where a.userid=b.otheruserid and b.mainuserid="&oblog.logined_uid)
while not rs.eof
	i=i+1 
%>
	<ul class="list_content"> 
	<li class="t1"><%=i%></li>
	<li class="t2"><a href="<%=rs("user_dir")&"/"&rs("user_folder")&"/index."&f_ext%>" target="_blank"><%=rs(0)%></a></li>
	<li class="t3"><a href="user_team.asp?action=del&id=<%=rs(1)%>" <%="onClick='return confirm(""删除后，此成员所有日志将不会在你的blog中显示,确定要删除吗？"");'"%>>删除此博客成员</a></li></ul>
<%
	rs.movenext
wend 
set rs=nothing
%>
</div>

<h1>我加入的团队</h1>
<div id="list">
	<ul class="list_top">
	<li class="t1">排序</li>
	<li class="t2">团队网站名</li>
	<li class="t3">团队管理员</li>
	<li class="t4">管理操作</li>
	</ul>
  <%
set rs=oblog.execute("select a.id,a.mainuserid,b.blogname,b.user_dir,b.username,b.user_folder from oblog_blogteam a,oblog_user b where a.otheruserid="&oblog.logined_uid&" and b.userid=a.mainuserid")
i=0
while not rs.eof
	i=i+1 
%>
	<ul class="list_content">
	<li class="t1"><%=i%></li>
	<li class="t2"><a href="<%=rs("user_dir")&"/"&rs("user_folder")&"/index."&f_ext%>" target="_blank"><%=rs(2)%></a></li>
	<li class="t3"><a href="<%=rs("user_dir")&"/"&rs("user_folder")&"/index."&f_ext%>" target="_blank"><%=rs(4)%></a></li>
	<li class="t4"><a href="user_team.asp?action=del&id=<%=rs("id")%>" <%="onClick='return confirm(""确认退出吗？"");'"%>>退出此博客团队</a></li>
	</ul>  
<%
rs.movenext
wend 
%>
</div>
<%end sub%>

