<!--#include file="user_top.asp"-->
<body scroll="no" style="overflow:auto!important;overflow:hidden;background:#fff;">
<%
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
%>
</body>
</html>
<%

sub addotheruser()
	dim otheruser,rs,trs
	otheruser=oblog.filt_badstr(Trim(Request.Form("otheruser")))
	If otheruser="" Then
		oblog.adderrstr("用户名称不能为空！")
		oblog.showusererr
		exit sub
	End If	 
	If otheruser=oblog.l_uname 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
			Set trs = oblog.Execute ("SELECT * From oblog_blogteam WHERE otheruserid = " & rs(1))
			If Not trs.EOF Then 
				oblog.adderrstr("该用户已经为团队成员！")
				oblog.showusererr
				exit Sub
			End if
			oblog.execute("insert into [oblog_blogteam] (mainuserid,otheruserid) values ("&oblog.l_uid&","&rs(1)&")")
			set rs=nothing
			oblog.showok "加入团队成员成功！","user_blogteam.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.l_uid&" or otheruserid="&oblog.l_uid&" )")
	oblog.showok "操作成功！",""
end sub
sub main()
%>
<div id="user_page_search">
	<form name="form1" method="post" action="user_blogteam.asp?action=addotheruser">
	    加入朋友到我的博客团队,可以让好友把日志发表到我的blog，现在就邀请吧!　用户名： 
	<input name="otheruser" type="text" id="otheruser" maxlength="20" />            
	<input type="submit" value="邀请" />			             
	</form>
</div>
<style type="text/css">
<!--
	#user_page_search {bottom:0!important;bottom:37px;}
	*+html #user_page_search {bottom:48px!important;}/* IE7 hack */
	.content_li_top {border-top:1px #84b6ce solid;}
	.content_li_top .t3 {margin:-2px 0 0 0;}
	.content_li_top .t4 {margin:0px 0 0 0;}
	#user_page_content {}
	#content_li {height:41%!important;}
	.content_li_conten .t4 {width:106px!important;}
	.content_li_top .t5 {width:120px!important;}
	.content_li_conten .t5 {width:116px!important;padding:5px 0 0 18px;margin:0 0 0 -10px;}
-->
</style>
   <div id="user_page_content">
		<ul class="content_li_top">
			<li class="t1">排序</li>
			<li class="t3">团队成员　　<strong>[我的团队管理]</strong></li>
			<li class="t4">管理操作</li>
		</ul>
		<div id="content_li">
<%
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.l_uid)
while not rs.eof
	i=i+1 
%>
			<ul class="content_li_conten"> 
				<li class="t1"><%=i%></li>
				<li class="t3"><a href="<%=rs("user_dir")&"/"&rs("user_folder")&"/index."&f_ext%>" target="_blank"><%=rs(0)%></a></li>
				<li class="t4"><a href="user_blogteam.asp?action=del&id=<%=rs(1)%>" <%="onClick='return confirm(""删除后，此成员所有日志将不会在你的blog中显示,确定要删除吗？"");'"%>>删除此博客成员</a></li>
			</ul>
<%
	rs.movenext
wend 
set rs=nothing
%>
		</div>
	</div>

   <div id="user_page_content">
		<ul class="content_li_top">
			<li class="t1">排序</li>
			<li class="t3">团队网站名　　<strong>[我加入的团队]</strong></li>
			<li class="t5">团队管理员</li>
			<li class="t4">管理操作</li>
		</ul>
		<div id="content_li">
<%
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.l_uid&" and b.userid=a.mainuserid")
i=0
while not rs.eof
	i=i+1 
%>
			<ul class="content_li_conten">
				<li class="t1"><%=i%></li>
				<li class="t3"><a href="<%=rs("user_dir")&"/"&rs("user_folder")&"/index."&f_ext%>" target="_blank"><%=rs(2)%></a></li>
				<li class="t5"><a href="<%=rs("user_dir")&"/"&rs("user_folder")&"/index."&f_ext%>" target="_blank"><%=rs(4)%></a></li>
				<li class="t4"><a href="user_blogteam.asp?action=del&id=<%=rs("id")%>" <%="onClick='return confirm(""确认退出吗？"");'"%>>退出此博客团队</a></li>
			</ul>  
<%
rs.movenext
wend 
%>
		</div>
	</div>
<%end sub%>