<html>
<head>
<META content=ywnt,云网互动影视管理系统 name=keywords>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>云网互动影视6.0--风格管理</title>
<LINK href="css/css.css" type=text/css rel=stylesheet>
</head>
<BODY leftMargin=0 topMargin=0 scroll=yes MARGINHEIGHT="0" MARGINWIDTH="0">
<!--#include file="../Conn.asp" -->
<!--#include file="YWNT_TMS_inc/YWNT_TMS_Function.asp" -->
<%
'===================================================================================================================
'软件名称：云网影视管理系统
'Copyright (C) 2002-2007 ywnt.net  All rights reserved.
'产品咨询QQ：489234,2813712
'程序版权：云网互动科技有限公司
'程序开发：云网互动科技有限公司
'官方网站：http://www.ywnt.net 
'郑重声明:
'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
'    2、任何个人或组织不得在授权允许的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；
'    3、云网互动科技有限公司保留此软件的法律追究权利
'===================================================================================================================
Call CheckLogin("Style")
sub EditSave()
		if Request.Form("StyleDefault")=1 then
		Conn.execute("Update YWNT_TMS_Style set StyleDefault=0")
		end if
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Style where ID="&NoSqlHack(Request.Form("ID"))
		Rs.open sql,Conn,1,3
		RS("StyleName")=NoSqlHack(Request.Form("StyleName"))
		RS("StyleContent")=NoSqlHack(Request.Form("StyleContent"))
		RS("StyleDefault")=NoSqlHack(Request.Form("StyleDefault"))
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		Call AddLog("修改风格"&Request.Form("StyleName"),6)
		call Admin_ShowErr("<li>修改风格成功</li>","Admin_Style.asp",1)
end sub
sub AddSave()
		if Request.Form("StyleDefault")=1 then
		Conn.execute("Update YWNT_TMS_Style set StyleDefault=0")
		end if
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Style"
		Rs.open sql,Conn,1,3
		Rs.addnew
		RS("StyleName")=NoSqlHack(Request.Form("StyleName"))
		RS("StyleContent")=NoSqlHack(Request.Form("StyleContent"))
		RS("StyleDefault")=NoSqlHack(Request.Form("StyleDefault"))
		RS("StyleDate")=date()
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		Call AddLog("添加风格"&Request.Form("StyleName"),6)
		call Admin_ShowErr("<li>添加风格成功</li>","Admin_Style.asp",1)
end sub
sub Del()
	conn.execute "delete from YWNT_TMS_Style WHERE ID = "&NoSqlHack(Request("ID"))&""
	conn.execute "delete from YWNT_TMS_Template WHERE StyleID = "&NoSqlHack(Request("ID"))&""
	Call AddLog("删除风格",6)
	call Admin_ShowErr("<li>删除风格成功！</li>","Admin_Style.asp",1)
end sub%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td class=xingmu>模版管理</td>
    </tr>
    <tr>
      <td class="hback"><a href="Admin_Style.asp">风格管理首页</a> | <a href="Admin_Style.asp?Action=Derived">导出风格</a> | <a href="Admin_Style.asp?Action=Introduction">导入风格</a> | <a href="Admin_Style.asp?Action=Add">添加风格</a></td>
    </tr>
  </tbody>
</table>
<% Action=Trim(request("Action"))
Select Case Action
Case "Add"
	call Add()
Case "AddSave"
	call AddSave()
Case "Edit"
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Style where ID="&NoSqlHack(Request.QueryString("ID"))
		Rs.open sql,Conn,1,1
		YWNT_TMS_ID=RS("ID")
		YWNT_TMS_StyleName=RS("StyleName")
		YWNT_TMS_StyleContent=RS("StyleContent")
		YWNT_TMS_StyleDefault=RS("StyleDefault")
		RS.close   
      	set RS=nothing
	call Edit()
Case "EditSave"
	call EditSave()
Case "Del"
	call Del()
Case "Derived"
	call Derived()
Case "DerivedSave"
	call DerivedSave()
Case "Introduction"
	call Introduction()
Case "Introduction2"
	call Introduction2()
Case "IntroductionSave"
	call IntroductionSave()
Case else
	call List()
End Select
sub List()%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td width="5%" align="center" class=xingmu>ID</td>
      <td align="center" class=xingmu>风格名称</td>
      <td width="15%" align="center" class=xingmu>是否默认风格</td>
      <td width="10%" align="center" class=xingmu>添加时间</td>
	  <td width="10%" align="center" class=xingmu>操作</td>
    </tr>
<%Set Rs = server.CreateObject(YWNT_TMS_RS)
sql="Select ID,StyleName,StyleDefault,Styledate from YWNT_TMS_Style Order by ID desc"
Rs.open sql,Conn,1,1
if RS.eof then
Response.Write"<TR  class=""hback""><TD colspan=""5"" class=""hback"" height=""40"">没有记录。</TD></TR>"
else
do while not RS.eof%>
    <tr>
      <td height=32 align="center" class="hback"><%=RS("ID")%></td>
      <td height=32 class="hback"><%=RS("StyleName")%></td>
      <td height=32 align="center" class="hback"><%if RS("StyleDefault")=1 then Response.Write"默认风格" else Response.Write"候选风格" end if%></td>
      <td align="center" class="hback"><%=RS("Styledate")%></td>
	  <td align="center" class="hback"><A href="Admin_Style.asp?Action=Edit&ID=<%=RS("ID")%>">修改</A>｜<A onClick="{if(confirm('确定要删除吗?\n如果此风格\n此风格下的隶属模版将也被删除!!')){return true;}return false;}" href="Admin_Style.asp?Action=Del&ID=<%=RS("ID")%>">删除</A></td>
    </tr>
<%RS.movenext     
loop
end if
RS.close     
set RS=nothing%>
  </tbody>
</table>
<%end sub
sub Add()%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td colspan="2" class=xingmu>添加风格</td>
    </tr>
	 <form name="form" action="Admin_Style.asp?Action=AddSave" method="post">
    <tr>
      <td width="21%" height=32 align="right" class="hback">风格名称：</td>
      <td height=7 class="hback"><input name="StyleName" type="text" id="StyleName" size="40"></td>
    </tr>
	    <tr>
      <td height=32 align="right" class="hback">默认风格：</td>
      <td height=16 class="hback"><input type="radio" name="StyleDefault" value="1">
        是
          <input name="StyleDefault" type="radio" value="0" checked>
          否</td>
	    </tr>
    <tr>
      <td height=32 align="right" class="hback">风格说明：</td>
      <td height=16 class="hback"><textarea name="StyleContent" cols="40" rows="5" id="StyleContent"></textarea></td>
    </tr>
    <tr>
      <td height=32 colspan="2" align="center" class="hback"><input type="submit" name="Submit" value="添 加"></td>
    </tr>
	</form>
  </tbody>
</table>
<%end sub
sub Edit()%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td colspan="2" class=xingmu>修改风格</td>
    </tr>
	 <form name="form" action="Admin_Style.asp?Action=EditSave" method="post">
    <tr>
      <td width="21%" height=32 align="right" class="hback">风格名称：</td>
      <td height=7 class="hback"><input name="StyleName" type="text" id="StyleName" value="<%=YWNT_TMS_StyleName%>" size="40"></td>
    </tr>
	    <tr>
      <td height=32 align="right" class="hback">默认风格：</td>
      <td height=16 class="hback"><input name="StyleDefault" type="radio" value="1" <%if YWNT_TMS_StyleDefault=1 then Response.Write"checked"%>>
        是
          <input type="radio" name="StyleDefault" value="0" <%if YWNT_TMS_StyleDefault=0 then Response.Write"checked"%>>
          否</td>
	    </tr>
    <tr>
      <td height=32 align="right" class="hback">风格说明：</td>
      <td height=16 class="hback"><textarea name="StyleContent" cols="40" rows="5" id="StyleContent"><%=YWNT_TMS_StyleContent%></textarea></td>
    </tr>
    <tr>
      <td height=32 colspan="2" align="center" class="hback"><input name="ID" type="hidden" value="<%=YWNT_TMS_ID%>"><input type="submit" name="Submit" value="修 改"></td>
    </tr>
	</form>
  </tbody>
</table>
<%end sub
sub Derived()%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td colspan="2" class=xingmu>导出风格</td>
    </tr>
	 <form name="form" action="Admin_Style.asp?Action=DerivedSave" method="post">
    <tr>
      <td width="21%" height=32 align="right" class="hback">风格选择：</td>
      <td height=16 class="hback"><select name="StyleID" size="10" multiple style="width:400px">
<%Set Rs = server.CreateObject(YWNT_TMS_RS)
sql="Select ID,StyleName from YWNT_TMS_Style Order by ID desc"
Rs.open sql,Conn,1,1
if RS.eof then
Response.Write"<option value="""">没有记录</option>"
else
do while not RS.eof
Response.Write"<option value="""&RS("ID")&""">"&RS("StyleName")&"</option>"
RS.movenext     
loop
end if
RS.close     
set RS=nothing%>
          </select></td>
    </tr>
    <tr>
      <td height=32 align="right" class="hback">导出数据库：</td>
      <td height=7 class="hback"><input name="DerivedMdb" type="text" value="../Template/YWNT_TMS_Skin.mdb" size="40">
      <input name="DelMdb" type="checkbox" value="1" checked>
      清空数据库中原有内容</td>
    </tr>
    <tr>
      <td height=32 colspan="2" align="center" class="hback"><input type="submit" name="Submit" value="导出"></td>
    </tr>
	</form>
  </tbody>
</table>
<%end sub
sub DerivedSave()
On Error Resume Next
connstrskin = "provider=microsoft.jet.oledb.4.0;data source=" & server.mappath(Request.Form("DerivedMdb"))
Set connskin = server.CreateObject("ADODB.Connection")
connskin.open connstrskin
If Err Then Err.Clear:Set connskin = Nothing:call Admin_ShowErr("<li>导出数据库连接出错</li>","javascript:history.go(-1)",0):Response.End

if Request.Form("DelMdb")=1 then
connskin.Execute("delete from YWNT_TMS_StyleSkin")
connskin.Execute("delete from YWNT_TMS_CssSkin")
connskin.Execute("delete from YWNT_TMS_TemplateSkin")
connskin.Execute("delete from YWNT_TMS_ZyLebSkin")
end if

Set Rs = server.CreateObject(YWNT_TMS_RS)
sql="Select * from YWNT_TMS_Css"
Rs.open sql,Conn,1,1
do while not RS.eof
connskin.Execute("insert into YWNT_TMS_CssSkin(CssName,CssContent,CssDate,Cssid) values('"&Rs("CssName")&"','"&Rs("CssContent")&"','"&Rs("CssDate")&"',"&Rs("id")&")")
RS.movenext     
loop
RS.close     
set RS=nothing

Set Rs = server.CreateObject(YWNT_TMS_RS)
sql="Select * from YWNT_TMS_ZyLab"
Rs.open sql,Conn,1,1
do while not RS.eof
connskin.Execute("insert into YWNT_TMS_ZyLebSkin(LabName,LabNote,LabContent,LebDate) values('"&Rs("LabName")&"','"&Rs("LabNote")&"','"&Rs("LabContent")&"','"&Rs("LebDate")&"')")
RS.movenext     
loop
RS.close     
set RS=nothing

Set Rs = server.CreateObject(YWNT_TMS_RS)
sql="Select * from YWNT_TMS_Style where id in ("&NoSqlHack(Request.Form("StyleID"))&")"
Rs.open sql,Conn,1,1
do while not RS.eof

Set RsStyleSkin = server.CreateObject(YWNT_TMS_RS)
sqlStyleSkin="Select * from YWNT_TMS_StyleSkin"
RsStyleSkin.open sqlStyleSkin,connskin,1,3
RsStyleSkin.Addnew
RsStyleSkin("StyleName")=RS("StyleName")
RsStyleSkin("StyleContent")=RS("StyleContent")
RsStyleSkin("StyleDefault")=RS("StyleDefault")
RsStyleSkin("Styledate")=RS("Styledate")
RsStyleSkin.update
RsStyleSkin.close     
set RsStyleSkin=nothing
set RsStyleSkin = connskin.execute("select top 1 ID from YWNT_TMS_StyleSkin Order by ID desc")
StyleSkinID=RsStyleSkin("ID")
RsStyleSkin.Close
Set RsStyleSkin = Nothing

Set RsTemplate = server.CreateObject(YWNT_TMS_RS)
sqlTemplate="Select * from YWNT_TMS_Template where StyleID ="&RS("ID")&""
RsTemplate.open sqlTemplate,Conn,1,1
do while not RSTemplate.eof

Set RsCss = server.CreateObject(YWNT_TMS_RS)
sqlCss="Select ID from YWNT_TMS_CssSkin where CssID ="&RsTemplate("CssID")&""
RsCss.open sqlCss,connskin,1,1
CssID=RsCss("ID")
RsCss.close     
set RsCss=nothing
connskin.Execute("insert into YWNT_TMS_TemplateSkin(TemplateName,StyleID,CssID,TemplateType,Template,TemplateDate) values('"&RsTemplate("TemplateName")&"',"&StyleSkinID&","&CssID&","&RsTemplate("TemplateType")&",'"&RsTemplate("Template")&"','"&RsTemplate("TemplateDate")&"')")

RSTemplate.movenext     
loop
RSTemplate.close     
set RSTemplate=nothing

RS.movenext     
loop
RS.close     
set RS=nothing
connskin.close
set connskin=nothing
Call AddLog("导出风格",6)
call Admin_ShowErr("<li>风格导出成功</li>","Admin_Style.asp",1)
end sub
sub Introduction()%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td colspan="2" class=xingmu>导入风格第一步</td>
    </tr>
	<form name="form" action="Admin_Style.asp?Action=Introduction2" method="post">
    <tr>
      <td width="21%" height=32 align="right" class="hback">导入风格数据库名称：</td>
      <td height=7 class="hback"><input name="IntroductionMdb" type="text" value="../Template/YWNT_TMS_Skin.mdb" size="40"></td>
    </tr>
    <tr>
      <td height=32 colspan="2" align="center" class="hback"><input type="submit" name="Submit" value="下一步"></td>
    </tr>
	</form>
  </tbody>
</table>
<%end sub
sub Introduction2()
On Error Resume Next
connstrskin = "provider=microsoft.jet.oledb.4.0;data source=" & server.mappath(Request.Form("IntroductionMdb"))
Set connskin = server.CreateObject("ADODB.Connection")
connskin.open connstrskin
If Err Then Err.Clear:Set connskin = Nothing:call Admin_ShowErr("<li>导入数据库连接出错</li>","javascript:history.go(-1)",0):Response.End
%>
<table class=table cellspacing=1 cellpadding=3 width="98%" align=center border=0>
  <tbody>
    <tr>
      <td colspan="3" class=xingmu>导入风格第二步</td>
    </tr>
	<form name="form" action="Admin_Style.asp?Action=IntroductionSave" method="post">
	<input name="IntroductionMdb" type="hidden" value="<%=Request.Form("IntroductionMdb")%>">
    <tr>
      <td width="40%" height=15 align="center" class="hback">目标数据库中的风格</td>
      <td height=16 rowspan="2" align="center" class="hback"><input type="submit" name="Submit" value="导入&gt;&gt;"></td>
      <td width="40%" align="center" class="hback">系统中存在的风格</td>
    </tr>
    <tr>
      <td height=16 align="right" class="hback"><select name="StyleSkinID" size="10" multiple style="width:300px">
<%Set Rs = server.CreateObject(YWNT_TMS_RS)
sql="Select ID,StyleName from YWNT_TMS_StyleSkin Order by ID desc"
Rs.open sql,Connskin,1,1
if RS.eof then
Response.Write"<option value="""">没有记录</option>"
else
do while not RS.eof
Response.Write"<option value="""&RS("ID")&""">"&RS("StyleName")&"</option>"
RS.movenext     
loop
end if
RS.close     
set RS=nothing
Connskin.close
set Connskin=nothing%>
      </select></td>
      <td width="40%" class="hback"><select name="select" size="10" style="width:300px">
<%Set Rs = server.CreateObject(YWNT_TMS_RS)
sql="Select ID,StyleName from YWNT_TMS_Style Order by ID desc"
Rs.open sql,Conn,1,1
if RS.eof then
Response.Write"<option value="""">没有记录</option>"
else
do while not RS.eof
Response.Write"<option value="""&RS("ID")&""">"&RS("StyleName")&"</option>"
RS.movenext     
loop
end if
RS.close     
set RS=nothing%>
      </select></td>
    </tr>
	</form>
  </tbody>
</table>
<%end sub
sub IntroductionSave()
On Error Resume Next
connstrskin = "provider=microsoft.jet.oledb.4.0;data source=" & server.mappath(Request.Form("IntroductionMdb"))
Set connskin = server.CreateObject("ADODB.Connection")
connskin.open connstrskin
If Err Then Err.Clear:Set connskin = Nothing:call Admin_ShowErr("<li>导入数据库连接出错</li>","javascript:history.go(-1)",0):Response.End

Set RS = server.CreateObject(YWNT_TMS_RS)
sql="Select * from YWNT_TMS_CssSkin"
RS.open sql,connskin,1,1
do while not RS.eof
conn.Execute("insert into YWNT_TMS_Css(CssName,CssContent,CssDate,Cssid) values('"&RS("CssName")&"','"&RS("CssContent")&"','"&RS("CssDate")&"',"&RS("ID")&")")
RS.movenext
loop
RS.close     
set RS=nothing

Set Rs = server.CreateObject(YWNT_TMS_RS)
sql="Select * from YWNT_TMS_ZyLebSkin"
Rs.open sql,Connskin,1,1
do while not RS.eof
Set RsZyLab = server.CreateObject(YWNT_TMS_RS)
sqlZyLab="Select * from YWNT_TMS_ZyLab Where LabName='"&Rs("LabName")&"'"
RsZyLab.open sqlZyLab,conn,1,3
if RsZyLab.eof then
RsZyLab.Addnew
RsZyLab("LabName")=Rs("LabName")
RsZyLab("LabNote")=Rs("LabNote")
RsZyLab("LabContent")=Rs("LabContent")
RsZyLab("LebDate")=Rs("LebDate")
RsZyLab.update
end if
RsZyLab.close
set RsZyLab=nothing
RS.movenext
loop
RS.close
set RS=nothing

Set Rs = server.CreateObject(YWNT_TMS_RS)
sql="Select * from YWNT_TMS_StyleSkin where id in ("&NoSqlHack(Request.Form("StyleSkinID"))&")"
Rs.open sql,ConnSkin,1,1
do while not RS.eof

Set RsStyleSkin = server.CreateObject(YWNT_TMS_RS)
sqlStyleSkin="Select * from YWNT_TMS_Style"
RsStyleSkin.open sqlStyleSkin,conn,1,3
RsStyleSkin.Addnew
RsStyleSkin("StyleName")=RS("StyleName")
RsStyleSkin("StyleContent")=RS("StyleContent")
RsStyleSkin("StyleDefault")=RS("StyleDefault")
RsStyleSkin("Styledate")=RS("Styledate")
RsStyleSkin.update
RsStyleSkin.close
set RsStyleSkin=nothing
set RsStyleSkin = Conn.execute("select top 1 ID from YWNT_TMS_Style Order by ID desc")
StyleSkinID=RsStyleSkin("ID")
RsStyleSkin.Close
Set RsStyleSkin = Nothing

Set RsTemplate = server.CreateObject(YWNT_TMS_RS)
sqlTemplate="Select * from YWNT_TMS_TemplateSkin where StyleID ="&RS("ID")&""
RsTemplate.open sqlTemplate,ConnSkin,1,1
do while not RSTemplate.eof

Set RsCss = server.CreateObject(YWNT_TMS_RS)
sqlCss="Select ID from YWNT_TMS_Css where CssID ="&RsTemplate("CssID")&""
RsCss.open sqlCss,conn,1,1
CssID=RsCss("ID")
RsCss.close
set RsCss=nothing
conn.Execute("insert into YWNT_TMS_Template(TemplateName,StyleID,CssID,TemplateType,Template,TemplateDate) values('"&RsTemplate("TemplateName")&"',"&StyleSkinID&","&CssID&","&RsTemplate("TemplateType")&",'"&RsTemplate("Template")&"','"&RsTemplate("TemplateDate")&"')")

RSTemplate.movenext
loop
RSTemplate.close
set RSTemplate=nothing

RS.movenext
loop
RS.close
set RS=nothing
connskin.close
set connskin=nothing
Call AddLog("导入风格",6)
call Admin_ShowErr("<li>风格导入成功</li>","Admin_Style.asp",1)
end sub
call connclose()%>
</BODY></HTML>
