<!-- #Include File="Include/AMH_onlogin.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V2.0》，简称“AsaiMHV2”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

Index_Url="BlogSkin"
call AMH_master(0,0)
'模板预览
if Action="show" then
call showskin()
response.end
end if
Call AMH_Header(1)
%>

<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td width=10></td>
  <td> <a href=AMH_Blog.asp>博客列表 </a></td>
  <td width=10></td>
  <td> <a href=AMH_BlogData.asp>内容管理 </a></td>
  <td width=10></td>
  <td> <a href=AMH_BlogBook.asp>留言管理</a></td>
  <td width=10></td>
   <td> <a href=AMH_Review.asp?ChannelIDs=10>评论管理</a></td>
  <td width=10></td>
  <td> <a href=AMH_BlogSkin.asp class=red>用户模板管理</a></td>
  <td width=10></td>
  <td> <a href=AMH_BlogSkin2.asp>模板导入导出</a></td>
   <td width=10></td>
  </tr>
  </table>
</td></tr>
</table>
<br />
<%

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()
	case "addconfig"
		call addconfig()
	case "delconfig"
		call delconfig()
	case else
	   call showconfig()
end select

Call AMH_Ender(tit)

sub showconfig()
set rs=cls.exec("select * from AsaiMHUserSkin ",1)
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td colspan=5>用户模板管理</td></tr>
<form name="form2" method="post" action="AMH_BlogSkin.asp?action=savedefault">

  <tr class="topbg"> 
      <td width="10%" height="25" >
<div align="center">ID</div></td>
    <td width="20%" > <div align="center">名称</div></td>
    <td width="20%" ><div align="center">作者</div></td>
      <td width="10%" >
<div align="center">默认模版</div></td>
      <td width="40%" > 
        <div align="center">模版管理</div></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="20%" ><div align="center"><%= rs("skinauthor") %></div></td>
            <td width="10%">              <div align="center"> 
               <input name="radiobutton" type="radio" class="tdbg" value='<%=rs("id")%>' <%if rs("isdefault")=true then response.Write "checked" %>>
          </div></td>  
      <td width="40%"> <div align="center"><a href="AMH_BlogSkin.asp?action=show&id=<%=rs("id")%>" target="_blank">预览</a>　<a href="AMH_BlogSkin.asp?action=modiconfig&id=<%=rs("id")%>">修改主模版</a>　<a href="AMH_BlogSkin.asp?action=modiviceconfig&id=<%=rs("id")%>">修改副模版</a>　<a href="AMH_BlogSkin.asp?action=delconfig&id=<%=rs("id")%>" onclick=return(confirm("确定要删除这个模版吗？"))>删除模版</a></div></td>
    </tr>
     
      <%
rs.movenext
wend
%>   
    <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
end sub

sub showskin()
    sql="select id,skinmain from AsaiMHUserSkin where id="&clng(request.QueryString("id"))
    call Cls.exec("",-1)
    rs.open sql,conn,1,3
	if not rs.eof then
    Response.Write replace(rs("skinmain"),"skin/","../blog/skin/")
	end if
	rs.close
	set rs=nothing
end sub

sub savedefault()
	dim isdefaultID
	isdefaultID=clng(trim(request("radiobutton")))
   sql="select id,isdefault from AsaiMHUserSkin"
   call Cls.exec("",-1)
   rs.open sql,conn,1,3
	while not rs.eof
		if isdefaultID=rs("id") then
			rs("isdefault")=true
		else
			rs("isdefault")=false
		end if
		rs.update
		rs.movenext
	wend
	rs.close
	set rs=nothing
	Response.Write"<script language=JavaScript>"
	Response.Write"alert(""修改成功！"");"
	Response.Write"window.history.go(-1);"
	Response.Write"</script>"
end sub


sub saveconfig()
    call Cls.exec("",-1)
	sql="select * from AsaiMHUserSkin where id="&clng(request.QueryString("id"))
	rs.open sql,conn,1,3
	rs("userskinname")=trim(request("userskinname"))
	rs("skinauthor")=trim(request("skinauthor"))
	rs("skinpic")=trim(request("skinpic"))
	rs("skinmain")=replace(request("skinmain"),Cls.web_dir&"blog/skin/","skin/")
	rs.update
	rs.close
	set rs=nothing
	response.Redirect "AMH_BlogSkin.asp?action=modiconfig&id="&clng(request.QueryString("id"))
end sub

sub saveviceconfig()
	call Cls.exec("",-1)
	sql="select * from AsaiMHUserSkin where id="&clng(request.QueryString("id"))
	rs.open sql,conn,1,3
	rs("userskinname")=trim(request("userskinname"))
	rs("skinauthor")=trim(request("skinauthor"))
	rs("skinpic")=trim(request("skinpic"))
	rs("skinshowlog")=replace(request("skinshowlog"),Cls.web_dir&"blog/skin/","skin/")
	rs.update
	rs.close
	set rs=nothing
	response.Redirect "AMH_BlogSkin.asp?action=modiviceconfig&id="&clng(request.QueryString("id"))
end sub

sub delconfig()
	call cls.exec("delete from AsaiMHUserSkin where id="&clng(request.QueryString("id")),0)
	response.Redirect "AMH_BlogSkin.asp?action=showconfig"	
end sub

sub modiconfig()
	set rs=cls.exec("select * from AsaiMHUserSkin where id="&clng(request.QueryString("id")),1)
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td colspan=5>用户模板管理    </td></tr>
<form method="POST" action="AMH_BlogSkin.asp?Action=saveconfig&id=<%=clng(request.QueryString("id"))%>" id="form1" name="form1">
    <tr> 
      <td width="769" height="22" class="topbg"><strong>现在修改的模版是<%=rs("userskinname")%>的主模版　　　</strong><a href="AMH_BlogSkin.asp?action=modiconfig&id=<%=rs("id")%>">修改主模版</a>　　　<a href="AMH_BlogSkin.asp?action=modiviceconfig&id=<%=rs("id")%>">修改副模版</a>　　　<a href="AMH_BlogSkin.asp?action=showconfig">返回管理菜单</a></strong></td>
    </tr>
    <tr>
      <td height="25" class="tdbg">模版名称： 
        <input name="userskinname" type="text" id="userskinname" value=<%=rs("userskinname")%>>
        　　作者：
        <input name="skinauthor" type="text" id="skinauthor" value=<%=rs("skinauthor")%>>
        　　预览图地址：
        <input name="skinpic" type="text" id="skinpic" value=<%=rs("skinpic")%>></td>
    </tr>
    <tr> 
      <td height="25" class="tdbg">
         <%=LoadSkinEditor(ichannelids,0,"form1","skinmain","",server.HTMLEncode(replace(rs("skinmain"),"skin/",Cls.web_dir&"blog/skin/")))%></td>
    </tr>
    <tr> 
      <td 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>
<input name="abc" type="hidden" > 
</form>
<%
set rs=nothing
end sub

sub modiviceconfig()
	set rs=cls.exec("select * from AsaiMHUserSkin where id="&clng(request.QueryString("id")),1)
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td colspan=5>用户模板管理    </td></tr>
<form method="POST" action="AMH_BlogSkin.asp?Action=saveviceconfig&id=<%=clng(request.QueryString("id"))%>" id="form1" name="form1">
    <tr> 
      <td width="769" height="22" class="topbg"><strong>现在修改的模版是<%=rs("userskinname")%>的副模版　　　</strong><a href="AMH_BlogSkin.asp?action=modiconfig&id=<%=rs("id")%>">修改主模版</a>　　　<a href="AMH_BlogSkin.asp?action=modiviceconfig&id=<%=rs("id")%>">修改副模版</a>　　　<a href="AMH_BlogSkin.asp?action=showconfig">返回管理菜单</a></strong></td>
    </tr>
    <tr>
      <td height="25" class="tdbg">模版名称： 
        <input name="userskinname" type="text" id="userskinname" value=<%=rs("userskinname")%>>
        　　作者：
        <input name="skinauthor" type="text" id="skinauthor" value=<%=rs("skinauthor")%>>
        　　预览图地址：
        <input name="skinpic" type="text" id="skinpic" value=<%=rs("skinpic")%>></td>
    </tr>
    <tr> 
      <td height="25" class="tdbg">
                <%=LoadSkinEditor(ichannelids,0,"form1","skinshowlog","",Server.HtmlEncode(replace(rs("skinshowlog"),"skin/",Cls.web_dir&"blog/skin/")))%></td>
    </tr>
    <tr> 
      <td 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>
<%
set rs=nothing
end sub
%>
