📄 wm.skin_templates.asp
字号:
<!--#include file="WM.Sys_Cook.asp"-->
<%
Dim ID,TempEdit,ModuleID,DefaultContent,ModuleSort,NewID
Dim WM_Name,WM_SortID,WM_IsDefault,WM_Explain,WM_Content,i,WM_SkinFolder,WM_TempPath,NewTempPath,WM_ChannelID
Dim TempDir
ID = WRMPS.CheckStr(Request("ID"), 1)
ChannelID = WRMPS.CheckStr(Request("ChannelID"), 1)
If ChannelID = "" Then ChannelID = 0
If ChannelID > 0 Then
If CheckAdminFlag("Templates_"&ChannelID) = False Then Call WRMPS.ErrView("·您没有权限进行此操作",0)
Else
If CheckAdminFlag("Templates") = False Then Call WRMPS.ErrView("·您没有权限进行此操作",0)
End If
ModuleID = WRMPS.CheckStr(Request("ModuleID"), 1)
If ModuleID = "" Then ModuleID = 0
WM_SortID = WRMPS.CheckStr(Request("WM_SortID"),1)
If WM_SortID <> "" Then ModuleSort = " And WM_SortID = " & WM_SortID Else ModuleSort = ""
Call DBConnBegin()
Content = Content & "<table width='100%' cellpadding=3 cellspacing=1 class=td1><tr class=td2><td><a href=?ModuleID=" & ModuleID & "&ChannelID="&ChannelID&">管理首页</a> | <a href=?Action=Add&ModuleID=" & ModuleID & "&WM_SortID=" & WM_SortID & "&ChannelID="&ChannelID&">添加</a></td></tr><tr><td class=td3>" & vbCrLf
Set Rs = Conn.Execute("Select WM_ID,WM_TempSortName from WM_TempSort where WM_ModuleID=" & ModuleID & " Order By WM_Taxis")
i = 0
Do While Not Rs.EOF
If i = 0 Then
Content = Content & "<a href=?ModuleID=" & ModuleID & "&WM_SortID=" & Rs(0) & "&ChannelID="&ChannelID&">" & Rs(1) & "</a>" & vbCrLf
Else
Content = Content & " | <a href=?ModuleID=" & ModuleID & "&WM_SortID=" & Rs(0) & "&ChannelID="&ChannelID&">" & Rs(1) & "</a>" & vbCrLf
End If
i = i + 1
Rs.MoveNext
Loop
Rs.Close
Content = Content & "</td></tr></table>" & vbCrLf
Select Case Request("Action")
Case "Save"
WM_Name = WRMPS.CheckStr(Request("WM_Name"),0)
If WM_Name = "" Then Call WRMPS.ErrView("·您输入模板名称", 0)
If WM_SortID = "" Then Call WRMPS.ErrView("·请选择模板类别", 0)
WM_TempPath = WRMPS.CheckStr(Request("WM_TempPath"),0)
If WM_TempPath = "" Then Call WRMPS.ErrView("·您输入模板路径", 0)
If Left(WM_TempPath,1) = "/" Then WM_TempPath = Right(WM_TempPath,Len(WM_TempPath)-1)
WM_IsDefault = WRMPS.CheckStr(Request("WM_IsDefault"),1)
If WM_IsDefault = "" Then WM_IsDefault = 0
WM_Explain = WRMPS.CheckStr(Request("WM_Explain"), 0)
If WM_Explain = "" Then WM_Explain = Null
WM_Content = Request.Form("Content")
If WM_IsDefault = 1 Then
Conn.Execute ("update WM_Templates set WM_IsDefault=0 Where WM_SkinFolder='" & WR_Setting(5) & "'" & ModuleSort & " and WM_ChannelID="&ChannelID&" And WM_ModuleID = " & ModuleID & "")
End If
Set Rs=server.createobject("adodb.recordset")
Rs.Open "Select WM_Name,WM_SkinFolder,WM_SortID,WM_ModuleID,WM_IsDefault,WM_Explain,WM_TempPath,WM_ChannelID From WM_Templates Where WM_TempPath='" & WM_TempPath & "' and WM_SkinFolder='" & WR_Setting(5) & "'", Conn, 1, 3
If Not Rs.EOF Then
Rs.Close
Set Rs = Nothing
Call WRMPS.ErrView("·模板可能已经存在或模板路径重复<meta http-equiv=refresh content='1;URL=?Action=Add&ChannelID="&ChannelID&"&WM_SortID="&WM_SortID&"&ModuleID="&ModuleID&"'>", 0)
Else
Rs.AddNew
Rs(0) = WM_Name
Rs(1) = WR_Setting(5)
Rs(2) = WM_SortID
Rs(3) = ModuleID
Rs(4) = WM_IsDefault
Rs(5) = WM_Explain
Rs(6) = WM_TempPath
Rs(7) = ChannelID
Rs.Update
Rs.Close
End If
Set Rs = Nothing
Call WRMPS.FsoBegin()
TempDir = ""
If Instr(WM_TempPath,"/") > 0 Then
For i = 0 To UBound(Split(WM_TempPath,"/"))-1
If TempDir = "" Then
TempDir = Split(WM_TempPath,"/")(i)
Else
TempDir = TempDir&"/"&Split(WM_TempPath,"/")(i)
End If
Next
End If
Call WRMPS.CreFolder("../Skins/"&WR_Setting(5)&"/Templates/"&TempDir)
Call WRMPS.CreateFile("../Skins/"&WR_Setting(5)&"/Templates/"&WM_TempPath,WM_Content)
Call WRMPS.FsoEnd()
WRMPS.DelCache "Templates"
Call WRMPS.ErrView("·模板添加成功<meta http-equiv=refresh content='1;URL=?ModuleID="&ModuleID&"&ChannelID="&ChannelID&"&WM_SortID="&WM_SortID&"'>", 1)
Case "EditSave"
WM_Name = WRMPS.CheckStr(Request("WM_Name"),0)
If WM_Name = "" Then Call WRMPS.ErrView("·您输入模板名称", 0)
If WM_SortID = "" Then Call WRMPS.ErrView("·请选择模板类别", 0)
WM_TempPath = WRMPS.CheckStr(Request("WM_TempPath"),0)
If WM_TempPath = "" Then Call WRMPS.ErrView("·您输入模板路径", 0)
If Left(WM_TempPath,1) = "/" Then WM_TempPath = Right(WM_TempPath,Len(WM_TempPath)-1)
WM_IsDefault = WRMPS.CheckStr(Request("WM_IsDefault"),1)
If WM_IsDefault = "" Then WM_IsDefault = 0
WM_Explain = WRMPS.CheckStr(Request("WM_Explain"), 0)
If WM_Explain = "" Then WM_Explain = Null
WM_Content = Request.Form("Content")
If WM_IsDefault = 1 Then
Conn.Execute ("update WM_Templates set WM_IsDefault=0 Where WM_SkinFolder='" & WR_Setting(5) & "' and WM_ChannelID="&ChannelID & ModuleSort & " And WM_ModuleID = " & ModuleID & "")
End If
Set Rs=server.createobject("adodb.recordset")
Rs.Open "Select WM_Name,WM_SortID,WM_ModuleID,WM_IsDefault,WM_Explain From WM_Templates Where WM_ID = " & ID & "", Conn, 1, 3
If Not Rs.EOF Then
Rs(0) = WM_Name
Rs(1) = WM_SortID
Rs(2) = ModuleID
Rs(3) = WM_IsDefault
Rs(4) = WM_Explain
Rs.Update
Rs.Close
End If
Set Rs = Nothing
Call WRMPS.FsoBegin()
TempDir = ""
If Instr(WM_TempPath,"/") > 0 Then
For i = 0 To UBound(Split(WM_TempPath,"/"))-1
If TempDir = "" Then
TempDir = Split(WM_TempPath,"/")(i)
Else
TempDir = TempDir&"/"&Split(WM_TempPath,"/")(i)
End If
Next
End If
Call WRMPS.CreFolder("../Skins/"&WR_Setting(5)&"/Templates/"&TempDir)
Call WRMPS.CreateFile("../Skins/"&WR_Setting(5)&"/Templates/"&WM_TempPath,WM_Content)
Call WRMPS.FsoEnd()
WRMPS.DelCache "Templates"
Call WRMPS.ErrView("·模板修改成功<meta http-equiv=refresh content='1;URL=?ModuleID="&ModuleID&"&ChannelID="&ChannelID&"&WM_SortID="&WM_SortID&"'>", 1)
Case "Default"
Conn.Execute ("update WM_Templates set WM_IsDefault=0 Where WM_ModuleID = " & ModuleID & ModuleSort & " and WM_ChannelID="&ChannelID&" And WM_SkinFolder = '" & WR_Setting(5) & "'")
Conn.Execute ("update WM_Templates set WM_IsDefault=1 Where WM_ID=" & ID & "")
WRMPS.DelCache "Templates"
Call WRMPS.ErrView("·设置成功<meta http-equiv=refresh content='1;URL=?ModuleID="&ModuleID&"&ChannelID="&ChannelID&"&WM_SortID="&WM_SortID&"'>", 1)
Case "Del"
Set Rs = Conn.Execute("Select WM_IsDefault,WM_TempPath From WM_Templates Where WM_ID = " & ID)
If Not Rs.EOF Then
Call WRMPS.FsoBegin()
Call WRMPS.FsoDel("File","../Skins/"&WR_Setting(5)&"/Templates/"&Rs(1))
Call WRMPS.FsoEnd()
If Rs(0) = 1 Then
Conn.Execute ("Delete From WM_Templates Where WM_ID = " & ID & "")
Set Rso = Conn.Execute("Select Top 1 WM_ID From WM_Templates Where WM_ModuleID = " & ModuleID & ModuleSort & " and WM_ChannelID="&ChannelID&" And WM_SkinFolder = '" & WR_Setting(5) & "'")
If Not Rso.EOF Then
Conn.Execute ("Update WM_Templates set WM_IsDefault=1 Where WM_ID=" & Rso(0) & "")
End If
Rso.Close
Set Rso = Nothing
Else
Conn.Execute ("Delete From WM_Templates Where WM_ID = " & ID & "")
End If
End If
Rs.Close
Set Rs = Nothing
WRMPS.DelCache "Templates"
Call WRMPS.ErrView("·模板删除成功<meta http-equiv=refresh content='1;URL=?ModuleID="&ModuleID&"&ChannelID="&ChannelID&"&WM_SortID="&WM_SortID&"'>", 1)
Case "Copy"
Set Rs=server.createobject("adodb.recordset")
Rs.Open "Select WM_Name,WM_SkinFolder,WM_SortID,WM_ModuleID,WM_IsDefault,WM_Explain,WM_TempPath,WM_ChannelID From WM_Templates Where WM_ID = " & ID & "", Conn, 1, 3
If Not Rs.EOF Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -