📄 admin_template.asp
字号:
Set Rs = Server.CreateObject("Adodb.recordset")
SQL = "Select Top 1 * From Cl_TemplateProject"
OpenConn : Rs.Open SQL,Conn,1,3
Rs.AddNew
Rs("ProjectID") = ProjectID
Rs("ProjectName") = ProjectName
Rs("ProjectIntro") = ProjectIntro
Rs("IsDefault") = IsDefault
Rs.Update
Rs.Close : Set Rs = Nothing
'====这里复制默认模板数据+CSS
Dim tmpProjectID
Set Rs = Cl.Execute("select ProjectID From Cl_TemplateProject Where IsDefault=True")
If Rs.Eof Then
tmpProjectID = 0
Else
tmpProjectID = Rs(0)
End If
Rs.Close : Set Rs = Nothing
If tmpProjectID>0 Then
Call CopyProject(tmpProjectID,ProjectID,ProjectName,0)
End if
'==============================================
End If
Call Cl.ShowSuc("恭喜您,操作成功。 <a href='Admin_Template.asp'><< <b>返回模板首页</b></a>")
End Sub
Rem sType(0=只复制默认,1=复制所有,2=复制所有,包括回收站)
Sub CopyProject(oldProjectID,newProjectID,newProjectName,sType)
Rem 复制模版数据
Dim WhereStr
Select Case sType
Case 0
WhereStr = "Where ProjectID="&oldProjectID&" and IsDefault=True and Deleted=False"
Case 1
WhereStr = "Where ProjectID="&oldProjectID&" and Deleted=False"
Case Else
WhereStr = "Where ProjectID="&oldProjectID&""
End Select
'Set Rs = Cl.Execute("Select Max(TemplateID) From Cl_Template")
'TemplateID = Rs(0)
'Rs.Close : Set Rs = Nothing
'if IsNull(TemplateID) or Not IsNumeric(TemplateID) then TemplateID=0
Set Rs = Cl.Execute("select * From Cl_Template "&WhereStr&" Order by TemplateID")
Do While Not Rs.Eof
'TemplateID = TemplateID + 1
Cl.Execute("Insert Into Cl_Template (ModuleID,ChannelID,TemplateName,TemplateIntro,TemplateContent,IsDefault,TypeID,ProjectID,ProjectName) values ("&Rs("ModuleID")&",0,'"&Cl.CheckStr(Rs("TemplateName"))&"','"&Cl.CheckStr(Rs("TemplateIntro"))&"','"&Cl.CheckStr(Rs("TemplateContent"))&"',"&ConvertCbool(Rs("IsDefault"))&","&Rs("TypeID")&","&newProjectID&",'"&Cl.CheckStr(newProjectName)&"')")
Rs.MoveNext
Loop
Rs.Close : Set Rs = Nothing
Rem 复制CSS
Set Rs = Cl.Execute("Select Max(CssID) From Cl_Css")
CssID = Rs(0)
Rs.Close : Set Rs = Nothing
if IsNull(CssID) or Not IsNumeric(CssID) then CssID=0
Set Rs = Cl.Execute("select * From Cl_Css Where ProjectID="&oldProjectID&" Order by CssID")
Do While Not Rs.Eof
CssID = CssID + 1
Cl.Execute("Insert Into Cl_Css (CssID,CssName,CssIntro,CssContent,IsDefault,ProjectID,ProjectName) values ("&CssID&",'"&Cl.CheckStr(Rs("CssName"))&"','"&Cl.CheckStr(Rs("CssIntro"))&"','"&Cl.CheckStr(Rs("CssContent"))&"',"&ConvertCbool(Rs("IsDefault"))&","&newProjectID&",'"&Cl.CheckStr(newProjectName)&"')")
Rs.MoveNext
Loop
Rs.Close : Set Rs = Nothing
End Sub
Sub CopyTemplate()
Dim oldTemplateID
oldTemplateID = Cl.GetClng(Request("TemplateID"))
Set Rs = Cl.Execute("select * From Cl_Template Where TemplateID="&oldTemplateID&"")
If Not Rs.Eof Then
Cl.Execute("Insert Into Cl_Template (ModuleID,ChannelID,TemplateName,TemplateIntro,TemplateContent,IsDefault,TypeID,ProjectID,ProjectName) values ("&Rs("ModuleID")&",0,'"&Cl.CheckStr(Rs("TemplateName"))&"','"&Cl.CheckStr(Rs("TemplateIntro"))&"','"&Cl.CheckStr(Rs("TemplateContent"))&"',0,"&Rs("TypeID")&","&Rs("ProjectID")&",'"&Cl.CheckStr(Rs("ProjectName"))&"')")
End If
Rs.Close : Set Rs = Nothing
Call Cl.ShowSuc("恭喜您,操作成功。 <a href='"&ComeUrl&"'><< <b>返回上一步</b></a>")
End Sub
Sub CopyCss()
Dim oldCssID
oldCssID = Cl.GetClng(Request("CssID"))
Set Rs = Cl.Execute("Select Max(CssID) From Cl_Css")
CssID = Rs(0)
Rs.Close : Set Rs = Nothing
if IsNull(CssID) or Not IsNumeric(CssID) then CssID=0
Set Rs = Cl.Execute("select * From Cl_Css Where CssID="&oldCssID&"")
If Not Rs.Eof Then
Cl.Execute("Insert Into Cl_Css (CssID,CssName,CssIntro,CssContent,IsDefault,ProjectID,ProjectName) values ("&Rs("CssID")&",'"&Cl.CheckStr(Rs("CssName"))&"','"&Cl.CheckStr(Rs("CssIntro"))&"','"&Cl.CheckStr(Rs("CssContent"))&"',0,"&Rs("ProjectID")&",'"&Cl.CheckStr(Rs("ProjectName"))&"')")
End if
Rs.Close : Set Rs = Nothing
Call Cl.ShowSuc("恭喜您,操作成功。 <a href='"&ComeUrl&"'><< <b>返回上一步</b></a>")
End Sub
Sub DelProject()
If ProjectID<1 Then
Cl.ShowErr("<br /><li>请正确选择要删除的模板方案!</li>")
End If
Set Rs = Cl.Execute("select IsDefault From Cl_TemplateProject Where ProjectID="&ProjectID&"")
If Rs.Eof Then
Rs.Close : Set Rs = Nothing
Cl.ShowErr("<br /><li>请正确选择要删除的模板方案!</li>")
End If
Dim IsDefaultStr
IsDefaultStr = Rs(0)
Rs.Close : Set Rs = Nothing
If IsDefaultStr=True Then
Cl.ShowErr("<br /><li>默认模板方案不能删除!</li>")
End If
'先删除模板
Cl.Execute("Delete From Cl_Css Where ProjectID="&ProjectID&"")
Cl.Execute("Delete From Cl_Template Where ProjectID="&ProjectID&"")
'再删除方案
Cl.Execute("delete From Cl_TemplateProject Where ProjectID="&ProjectID&"")
Call Cl.ShowSuc("恭喜您,操作成功。 <a href='Admin_Template.asp'><< <b>返回模板首页</b></a>")
End Sub
Sub SetDefaultProject()
If ProjectID<1 Then
Cl.ShowErr("<br /><li>请正确选择模板方案!</li>")
End If
Set Rs = Cl.Execute("select ProjectID From Cl_TemplateProject Where ProjectID="&ProjectID&"")
If Rs.Eof Then
Rs.Close : Set Rs = Nothing
Cl.ShowErr("<br /><li>请正确选择模板方案!</li>")
End If
Rs.Close : Set Rs = Nothing
Rem 取得默认CSS
Set Rs = Cl.Execute("select CssID From Cl_Css Where ProjectID="&ProjectID&" and IsDefault=True ")
If Rs.Eof Then
Set Rs = Cl.Execute("select Top 1 CssID From Cl_Css Where ProjectID="&ProjectID&"")
If Rs.Eof Then
Rs.Close : Set Rs = Nothing
Cl.ShowErr("<br /><li>此模板方案无下属CSS,请先清加CSS风格!</li>")
End if
End If
CssID = Rs(0)
Rs.Close : Set Rs = Nothing
Rem 更新默认模版
Cl.Execute("update Cl_TemplateProject Set IsDefault=False")
Cl.Execute("update Cl_TemplateProject Set IsDefault=True Where ProjectID="&ProjectID&"")
Rem 更新Setup
Cl.Execute("update Cl_Setup Set DefaultProjectID="&ProjectID&",DefaultCssID="&CssID&"")
Cl.Load_Setup()
Cl.Load_DefaultCssID()
Call Cl.ShowSuc("恭喜您,操作成功。 <a href='Admin_Template.asp'><< <b>返回模板首页</b></a>")
End Sub
Rem Project===========End
Rem Template==========Begin
Sub AddTemplate()
Dim NameStr,IDStr,i
IDStr = Split(TempLateModuleID,",")
NameStr = Split(TempLateModuleName,",")
%>
<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="border">
<tr class="title">
<td width="100%" align="center" height="25" colspan="2">添加模板(<%=CurrentProjectName%>)</td>
</tr>
<%If request("Step")<>"2" Then %>
<tr class="tdbg">
<td width="20%" align="right" height="25"><b>模块选择</b></td>
<td width="80%" align="left" height="25">
<%For i=0 to Ubound(NameStr)
%> <a href="Admin_Template.asp?ProjectID=<%=ProjectID%>&ModuleID=<%=IDStr(i)%>&Action=AddTemplate&Step=2"><%=NameStr(i)%>模块</a> <%
Next
%>
</td>
</tr>
<tr class="tdbg">
<td width="20%" align="right" height="25" colspan="2">
<font color="#888888">提示:请选择要添加的模板模块</font>
</td>
</tr>
<%else%>
<tr class="tdbg">
<td width="20%" align="right" height="25"><b>模块选择</b></td>
<td width="80%" align="left" height="25">
<%For i=0 to Ubound(NameStr)
%> <a href="Admin_Template.asp?ProjectID=<%=ProjectID%>&ModuleID=<%=IDStr(i)%>&Action=AddTemplate&Step=2" <%
if ModuleID=Clng(IDStr(i)) then
Response.write "style=""color:#ff0033;"""
end if
%>><%=NameStr(i)%>模块</a> <%
Next
%>
</td>
</tr>
<tr class="tdbg">
<td width="20%" align="right" height="25"><b>类型选择</b></td>
<td width="80%" align="left" height="25"><%
Dim TempStr
TempStr = Split(GetTemplateType(ModuleID),"|")
For i=0 To UBound(TempStr)
Response.write " [<font color=""#0000ff"">"&i+1&"</font>] <a href=""Admin_Template.asp?ProjectID="&ProjectID&"&ModuleID="&ModuleID&"&Action=AddTemplate2&TypeID="&i+1&""">"&TempStr(i)&"</a> <br />"
Next
TempStr = Empty
%></td>
</tr>
<tr class="tdbg">
<td width="20%" align="right" height="25" colspan="2">
<font color="#888888">提示:请选择要添加的模块类型</font>
</td>
</tr>
<%End if%>
</table>
<%
IDStr = Empty : NameStr = Empty
End Sub
Sub TemplateInfo()
Dim TemplateName,TemplateIntro,TemplateContent,IsDefault,TypeID
IsDefault = False
TypeID = Cl.GetClng(Request("TypeID"))
TemplateContent = "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">" & vbcrlf
TemplateContent = TemplateContent & "<html xmlns=""http://www.w3.org/1999/xhtml"">" & vbcrlf
TemplateContent = TemplateContent & "<head>" & vbcrlf
TemplateContent = TemplateContent & "<title>{$title}</title>" & vbcrlf
TemplateContent = TemplateContent & "<meta name=""generator"" content=""{$generator}"" />" & vbcrlf
TemplateContent = TemplateContent & "<meta name=""keywords"" content=""{$keywords}"" />" & vbcrlf
TemplateContent = TemplateContent & "<meta name=""description"" content=""{$description}"" />" & vbcrlf
TemplateContent = TemplateContent & "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"" />" & vbcrlf
TemplateContent = TemplateContent & "<script type=""text/javascript"" src=""{$webdir}inc/js/stm31.js""></script>" & vbcrlf
TemplateContent = TemplateContent & "<script type=""text/javascript"" src=""{$webdir}inc/js/Font.js""></script>" & vbcrlf
TemplateContent = TemplateContent & "{$webcss}" & vbcrlf
TemplateContent = TemplateContent & "</head>" & vbcrlf
TemplateContent = TemplateContent & " <body>" & vbcrlf
TemplateContent = TemplateContent & " <!-- 请在此处输入模板代码 -->" & vbcrlf
TemplateContent = TemplateContent & " </body>" & vbcrlf
TemplateContent = TemplateContent & "</html>"
Select Case ModuleID
Case -1
If TypeID=3 Or TypeID=4 Then
TemplateContent = "<!--用户登录表单-->@@@<!--用户控制面板-->@@@<!--用户控制面板(管理员)-->@@@<!--用户信息(计点)-->@@@<!--用户信息(计天)-->@@@<!--用户登录验证码-->"
End If
Case 1,2,3,4,5
If TypeID=9 Then
TemplateContent = "<!-- 栏目循环(1) -->@@@<!-- 栏目循环(2) -->@@@<!-- 栏目循环(3) -->@@@<!-- 栏目循环(4) -->"
End If
Case -2
If TypeID=5 Then
TemplateContent = "<!--取回密码(1)-->@@@<!--取回密码(2)-->@@@<!--取回密码(3)-->@@@<!--取回密码(4)-->"
End If
End Select
If Action="edittemplate" Then
If TemplateID<1 Then
Cl.ShowErr("<br /><li>请正确选择要编辑的模板!</li>")
End if
Set Rs = Cl.Execute("Select TemplateID,ModuleID,ChannelID,TemplateName,TemplateIntro,TemplateContent,IsDefault,TypeID,ProjectID From Cl_Template Where TemplateID="&TemplateID&"")
If Rs.Eof Then
Rs.Close : Set Rs = Nothing
Cl.ShowErr("<br /><li>请正确选择要编辑的模板!</li>")
End If
ModuleID = Rs(1)
ChannelID = Rs(2)
TemplateName = Rs(3)
TemplateIntro = Rs(4)
TemplateContent = Rs(5)
IsDefault = Rs(6)
TypeID = Rs(7)
ProjectID = Rs(8)
Rs.Close : Set Rs = Nothing
End if
%>
<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center" class="border">
<form method="post" action="Admin_Template.asp?Action=Save<%=Action%>" name="TemplateEdit" id="TemplateEdit">
<tr class="title">
<td width="100%" align="center" height="25" colspan="2">模板代码编辑</td>
</tr>
<tr class="tdbg">
<td width="20%" align="right" height="25"><b>所属方案</b></td>
<td width="80%" align="left" height="25"><%=CurrentProjectName%> <b>模块:</b><%
Dim NameStr,IDStr,i
IDStr = Split(TempLateModuleID,",")
NameStr = Split(TempLateModuleName,",")
For i=0 to Ubound(NameStr)
if ModuleID=Clng(IDStr(i)) then
Response.write NameStr(i) & "模块"
end if
Next
IDStr = Empty : NameStr = Empty
%></td>
</tr>
<input type="hidden" name="ChannelID" value="<%=ChannelID%>" />
<tr class="tdbg">
<td width="20%" align="right" height="25"><b>模板类型</b></td>
<td width="80%" align="left" height="25"><input type="hidden" id="TypeID" name="TypeID" value="<%=TypeID%>" />[<font color="#0000ff"><%=TypeID%></font>] <%=GetTemplateTypeName(ModuleID,TypeID)%></td>
</tr>
<tr class="tdbg">
<td width="20%" align="right" height="25"><b>模板名称</b></td>
<td width="80%" align="left" height="25"><input type="text" style="width:280px;" name="TemplateName" value="<%=TemplateName%>" /> <font color="#FF0000">*</font> <font color="#888888">说明:请输入模板名称</font></td>
</tr>
<tr class="tdbg">
<td width="20%" align="right" height="25"><b>模板说明</b></td>
<td width="80%" align="left" height="25"><textarea name="TemplateIntro" id="TemplateIntro" style="width:280px;height:80px;"><%=TemplateIntro%></textarea></td>
</tr>
<tr class="tdbg">
<td width="20%" align="right" height="25"><b>是否默认</b></td>
<td width="80%" align="left" height="25"><input type="checkbox" name="IsDefault" id="IsDefault" value="1" <%If IsDefault=True Then %>checked="checked" disabled<%End if%> /> <font color="#888888">说明:默认模板不能取消,如要取消,请设其它方案为默认即可</font></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -