<!--#include file="conn.asp"-->
<!--#include file="user_chkpass.asp"-->
<!--#include file="inc/usercode.asp"-->
<!--#include file="inc/function.asp"-->
<html>
<head>
<title>oBlog__用户模版管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css">
</head>
<SCRIPT language=javascript>
function VerifySubmit()
{
	submits(); 
	if (document.form1.edit.value == "")
     {
        alert("请输入模版内容!");
	return false;
     }	
	return true;

}
</SCRIPT>
<%
if CheckUserLogined()=false then
	response.Redirect "user_login.asp"
end if
dim action
Action=trim(request("Action"))

select case Action
	case "saveconfig" 
		call saveconfig()
	case "showconfig"
		call showconfig()
	case "modiconfig"
		call modiconfig()
	case "savedefault"
		call savedefault()
	case "modiviceconfig"
		call modiviceconfig()
	case "saveviceconfig"
		call saveviceconfig()
end select

sub showconfig()
	dim rs,defaultskin
	set rs=conn.execute("select defaultskin from [user] where username='"&username&"'")
	defaultskin=rs(0)
	set rs=nothing
	set rs=conn.execute("select * from userskin ")
%>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor">
<br>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
    <tr class="topbg"> 
      
    <td width="769" height="22" align=center><strong>设定我的默认模版</strong></td>
    </tr>
</table>
<form name="form2" method="post" action="user_skin.asp?action=savedefault">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" Class="border">
    <tr class="topbg"> 
      <td width="10%" height="25" > <div align="center">ID</div></td>
      <td width="20%" > <div align="center">名称</div></td>
      <td width="30%" ><div align="center">作者</div></td>
      <td width="20%" > <div align="center">默认模版</div>
        <div align="center"></div></td>
      <td width="20%" >点击预览(<a href="http://www.yan163.com/bbs/list.asp?boardid=71" target="_blank">更多</a>)</td>
    </tr>
    <% while not rs.eof %>
    <tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'"> 
      <td width="10%" > <div align="center"><%= rs("id") %>&nbsp;</div></td>
      <td width="20%" > <div align="center"><%= rs("userskinname") %></div></td>
      <td width="30%" ><div align="center"><%= rs("skinauthor") %></div></td>
      <td> <div align="center"> 
          <input name="radiobutton" type="radio" class="tdbg" value='<%=rs("id")%>' 
				<%
				if defaultskin=0 and rs("isdefault")="true" then
					response.Write "checked"
				else
					if defaultskin=rs("id") then 
						response.Write "checked"						
					end if
				end if				
				%>>
        </div>
        <div align="center"></div></td>
      <td><div align="center"><a href="showskin.asp?id=<%=rs("id")%>" target="_blank">预览</a></div></td>
    </tr>
    <%
rs.movenext
wend
%>
    <tr> 
      <td height="40" colspan="5" align="center" class="tdbg"> <div align="center"> 
          <input type="submit" name="Submit" value="保存设置">
        </div></td>
    </tr>
  </table>
</form>

<%
	set rs=nothing
	call closeconn
end sub

sub savedefault()
	dim rs,rsskin,isdefaultID
	isdefaultID=clng(trim(request("radiobutton")))
	set rsskin=conn.execute("select skinmain,skinshowlog from userskin where id="&isdefaultID)
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select userskinmain,userskinshowlog,defaultskin from [user] where username='"&username&"'",conn,1,3
	'response.Write username
	rs(0)=rsskin(0)
	rs(1)=rsskin(1)
	rs(2)=isdefaultID
	set rsskin=nothing
	rs.update
	rs.close
	set rs=nothing
	call closeconn()
	Response.Write"<script language=JavaScript>"
	Response.Write"alert(""修改成功！"");"
	Response.Write"window.history.go(-1);"
	Response.Write"</script>"
end sub


sub saveconfig()
	dim rs,sql
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from [user] where username='"&username&"'"
	rs.open sql,conn,1,3
	rs("userskinmain")=debadstr(trim(request("skinmain")))
	rs.update
	rs.close
	set rs=nothing
	call closeconn
	response.Redirect "user_skin.asp?action=modiconfig&id="&clng(request.QueryString("id"))
end sub

sub saveviceconfig()
	dim rs,sql
	set rs=server.CreateObject("adodb.recordset")
	sql="select * from [user] where username='"&username&"'"
	rs.open sql,conn,1,3
	rs("userskinshowlog")=debadstr(trim(request("skinshowlog")))
	rs.update
	rs.close
	set rs=nothing
	call closeconn
	response.Redirect "user_skin.asp?action=modiviceconfig&id="&clng(request.QueryString("id"))
end sub


sub modiconfig()
	dim rs,rsshowlog
	set rs=conn.execute("select userskinmain,defaultskin,userskinshowlog from [user] where username='"&username&"'")
	if rs("defaultskin")=0  or rs("defaultskin")="" then 
	Response.Write"<script language=JavaScript>"
	Response.Write"alert(""请先选择一个喜欢的默认模版！"");"
	Response.Write"window.location.replace('user_skin.asp?action=showconfig');"
	Response.Write"</script>"
	response.End()		
	end if
%>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor" onLoad="oblog_Size(400)">
<br>
  
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
  <tr class="topbg"> 
    <td height="22" align=center><strong>修改我的个性模版</strong></td>
  </tr>
  <tr class="tdbg"> 
    <td height="30"> <strong>管理导航：</strong><a href="user_skin.asp?action=modiconfig">修改主模版</a>　　　<a href="user_skin.asp?action=modiviceconfig">修改副模版</a>　　　<a href="user_skin.asp?action=showconfig">选择模版</a></td>
  </tr>
</table>

<form method="POST" action="user_skin.asp" id="form1" name="form1" onSubmit="return VerifySubmit()">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border" >
    <tr> 
      <td width="769" class="topbg"><strong>现在修改的是我的主模版</strong></td>
    </tr>
    <tr> 
      <td class="tdbg"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td>
                <input type="hidden" name="skinmain" id="edit" value="<%=Server.HtmlEncode(rs(0))%>" >
	<!--#include file="edit.asp"-->
			</td>
        </tr>
      </table></td>
    </tr>
    <tr> 
      <td height="40" align="center" class="tdbg">
        <div align="center">
          <input name="Action" type="hidden" id="Action" value="saveconfig"> 
          <input name="cmdSave" type="submit" id="cmdSave" value=" 保存修改 " > 
        </div></td>
    </tr>
  </table>

</form><br>
  
<table width="98%" border="0" align=center cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
  <tr align="center"> 
    <td height=25 colspan="2" class="topbg"><strong>用户模版标记说明</strong> 
  <tr> 
    <td height=23 colspan="2" class="tdbg"><strong>主模版：</strong></td>
  </tr>
  <tr> 
    <td width="18%" height=23 class="tdbg">$show_log$</td>
    <td width="82%" height=23 class="tdbg"> 重要，此标记显示日志主体部分，包括评论等信息。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_placard$ </td>
    <td height=23 class="tdbg">此标记显示用户公告。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_calendar$</td>
    <td height=23 class="tdbg"> 此标记显示日历。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_newblog$</td>
    <td height=23 class="tdbg"> 此标记显示最新日志列表。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_comment$</td>
    <td height=23 class="tdbg"> 此标记显示最新回复列表。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_subject$</td>
    <td height=23 class="tdbg"> 此标记显示专题分类。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_subject_l$</td>
    <td height=23 class="tdbg"> 此标记横向显示专题分类。 </td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_newblog$</td>
    <td height=23 class="tdbg"> 此标记显示最新日志列表。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_newmessage$ </td>
    <td height=23 class="tdbg">此标记显示最新留言列表。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_info$</td>
    <td height=23 class="tdbg"> 此标记显示Blog名称，统计信息等。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_login$</td>
    <td height=23 class="tdbg"> 此标记显示登陆窗口。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_links$</td>
    <td height=23 class="tdbg"> 此标记显示链接信息。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_blogname$ </td>
    <td height=23 class="tdbg">此标记显示用户blog名称，若名称为空则显示用户id。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_search$</td>
    <td height=23 class="tdbg"> 此标记显示搜索表单。</td>
  </tr>
  <tr> 
    <td height=23 class="tdbg">$show_xml$</td>
    <td height=23 class="tdbg"> 此标记显示rss连接标志。</td>
  </tr>
</table>
<%
set rs=nothing
end sub

sub modiviceconfig()
	dim rs
	set rs=conn.execute("select userskinshowlog,defaultskin from [user] where username='"&username&"'")
	if rs("defaultskin")=0  then 
		set rs=conn.execute("select skinshowlog from userskin where isdefault='true'")
	end if
%>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="tdbg" onLoad="oblog_Size(200);">
  <br>
  
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
  <tr class="topbg"> 
    <td height="22" align=center><strong>修改我的个性模版</strong></td>
  </tr>
  <tr class="tdbg"> 
    <td height="30"> <strong>管理导航：</strong><a href="admin_userlevel.asp?action=showconfig"></a><a href="user_skin.asp?action=modiconfig">修改主模版</a>　　　<a href="user_skin.asp?action=modiviceconfig">修改副模版</a>　　　<a href="user_skin.asp?action=showconfig">选择模版</a></td>
  </tr>
</table>

<form method="POST" action="user_skin.asp?id=<%=clng(request.QueryString("id"))%>" id="form1" name="form1" onSubmit="return VerifySubmit()">

  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
    <tr> 
      <td width="769" class="topbg"><strong>现在修改的是我的副模版</strong></td>
    </tr>
    <tr> 
      <td height="25" class="tdbg"><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td><input type="hidden" name="skinshowlog" id="edit" value="<%=Server.HtmlEncode(rs(0))%>" >
	<!--#include file="edit.asp"--></td>
        </tr>
      </table></td>
    </tr>
    <tr> 
      <td height="40" class="tdbg"> <div align="center">
        <input name="Action" type="hidden" id="Action" value="saveviceconfig"> 
        <input name="cmdSave" type="submit" id="cmdSave" value=" 保存修改 " > 
      </div></td>
    </tr>
  </table>

</form><br>
<table cellpadding="2" cellspacing="1" border="0" width="98%" class="border" align=center>
  <tr align="center"> 
    <td height=25 colspan="2" class="topbg"><strong>用户模版标记说明</strong> 
  <tr> 
    <td height=23 colspan="2" class="tdbg"><strong>副模版：</strong></td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td width="17%" height=23 class="tdbg">$show_topic$</td>
    <td width="83%" height=23 class="tdbg"> 此标记显示表情图标，专题名，日志标题,。</td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td height=23 class="tdbg">$show_loginfo$</td>
    <td class="tdbg">此标记显示日志作者，发表时间等信息。</td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td height=23 class="tdbg">$show_logtext$</td>
    <td height=23 class="tdbg"> 此标记显示日志正文。</td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td height=23 class="tdbg">$show_more$</td>
    <td height=23 class="tdbg"> 此标记显示阅读全文(次数)，回复(次数)，引用链接。</td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td height=23 class="tdbg">$show_emot$</td>
    <td height=23 class="tdbg">此标记仅显示显示表情图标。</td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td height=23 class="tdbg">$show_author$</td>
    <td height=23 class="tdbg">此标记仅显示作者名。</td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td height=23 class="tdbg">$show_addtime$</td>
    <td height=23 class="tdbg">此标记仅显示发表时间。</td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <td height=23 class="tdbg">$show_topictxt$</td>
    <td height=23 class="tdbg">此标记仅显示日志标题。</td>
  </tr>
</table>
</body>
</html>
<%
set rs=nothing
call closeconn()
end sub
%>
